@demicodes/just-bash 3.0.1-demi.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/LICENSE +201 -0
- package/README.md +620 -0
- package/dist/AGENTS.md +327 -0
- package/dist/Bash.d.ts +256 -0
- package/dist/ast/types.d.ts +609 -0
- package/dist/banned-patterns-test.d.ts +1 -0
- package/dist/bin/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/chunks/awk2-XSVZFGAA.js +3 -0
- package/dist/bin/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/chunks/chunk-2FCLTY3Z.js +15 -0
- package/dist/bin/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/chunks/chunk-2TVVPMMT.js +34 -0
- package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/chunks/chunk-42Z7Z3TQ.js +288 -0
- package/dist/bin/chunks/chunk-4BNS566Q.js +4 -0
- package/dist/bin/chunks/chunk-52Z5MJO2.js +17 -0
- package/dist/bin/chunks/chunk-5WLKCCX7.js +6 -0
- package/dist/bin/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/chunks/chunk-6GSBC77G.js +22 -0
- package/dist/bin/chunks/chunk-6UL3WIEK.js +3 -0
- package/dist/bin/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/chunks/chunk-7GBHDJNC.js +34 -0
- package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/chunks/chunk-7NDRU2ZN.js +5 -0
- package/dist/bin/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/chunks/chunk-FX7BQD2Q.js +20 -0
- package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/chunks/chunk-HADFAIPZ.js +17 -0
- package/dist/bin/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/chunks/chunk-HSTAQAVQ.js +11 -0
- package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/chunks/chunk-IWXPUD2J.js +12 -0
- package/dist/bin/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/chunks/chunk-LZHWUYJZ.js +24 -0
- package/dist/bin/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/chunks/chunk-NKAT2N47.js +7 -0
- package/dist/bin/chunks/chunk-NYIPFY36.js +3 -0
- package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/chunks/chunk-OPMLWMNH.js +17 -0
- package/dist/bin/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/chunks/chunk-PSGVOB5U.js +3 -0
- package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/chunks/chunk-QPHXCMJV.js +80 -0
- package/dist/bin/chunks/chunk-RJUDCNEZ.js +29 -0
- package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/chunks/chunk-SAF4OIHD.js +20 -0
- package/dist/bin/chunks/chunk-SMLKRKMP.js +11 -0
- package/dist/bin/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/chunks/chunk-T74E2U4J.js +64 -0
- package/dist/bin/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/chunks/chunk-UVKD35GR.js +9 -0
- package/dist/bin/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/chunks/chunk-VP3OTMHX.js +22 -0
- package/dist/bin/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/chunks/chunk-X5WRKSEU.js +101 -0
- package/dist/bin/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/chunks/chunk-XCUJL2AJ.js +141 -0
- package/dist/bin/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/chunks/chunk-YOKQNNQO.js +6 -0
- package/dist/bin/chunks/chunk-YR32XGKD.js +3 -0
- package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/chunks/chunk-ZAMAXG5K.js +85 -0
- package/dist/bin/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/chunks/date-OFYBOAUE.js +3 -0
- package/dist/bin/chunks/diff-TL7IV4S2.js +3 -0
- package/dist/bin/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/chunks/expansion-YT6DLHRE.js +3 -0
- package/dist/bin/chunks/expr-XNBNPKSF.js +3 -0
- package/dist/bin/chunks/file-U4GYVT3G.js +3 -0
- package/dist/bin/chunks/find-CZ6UMSZX.js +3 -0
- package/dist/bin/chunks/flag-coverage-MPBSMQIN.js +3 -0
- package/dist/bin/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/chunks/grep-JCHLTP7S.js +3 -0
- package/dist/bin/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/chunks/head-77V5O3RE.js +3 -0
- package/dist/bin/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/chunks/html-to-markdown-PHASM44U.js +3 -0
- package/dist/bin/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/chunks/jq-W6KOII4Y.js +3 -0
- package/dist/bin/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/chunks/js-exec-worker.js +4639 -0
- package/dist/bin/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/chunks/ls-YGNSAGDK.js +3 -0
- package/dist/bin/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/chunks/printf-XXZMDRGE.js +3 -0
- package/dist/bin/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/chunks/rg-OHJSRKFS.js +3 -0
- package/dist/bin/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/chunks/sed-4GRUPTAO.js +3 -0
- package/dist/bin/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +1728 -0
- package/dist/bin/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/chunks/tail-LGNECVQA.js +3 -0
- package/dist/bin/chunks/tar-K6HVPBVB.js +3 -0
- package/dist/bin/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/chunks/worker.js +3150 -0
- package/dist/bin/chunks/xan-LGEJUGOM.js +3 -0
- package/dist/bin/chunks/xan-view-L75WEJE2.js +3 -0
- package/dist/bin/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/chunks/yq-V6YWS23E.js +3 -0
- package/dist/bin/just-bash.js +778 -0
- package/dist/bin/shell/chunks/alias-YRVAW27Y.js +3 -0
- package/dist/bin/shell/chunks/awk2-XSVZFGAA.js +3 -0
- package/dist/bin/shell/chunks/base64-RZRLGMB3.js +3 -0
- package/dist/bin/shell/chunks/basename-F3AQ4KAQ.js +3 -0
- package/dist/bin/shell/chunks/bash-CLP24TE2.js +3 -0
- package/dist/bin/shell/chunks/cat-LQH5FSAR.js +3 -0
- package/dist/bin/shell/chunks/chmod-S564JCJW.js +3 -0
- package/dist/bin/shell/chunks/chunk-22HCD466.js +3 -0
- package/dist/bin/shell/chunks/chunk-2AIXTPH2.js +9 -0
- package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/shell/chunks/chunk-2FCLTY3Z.js +15 -0
- package/dist/bin/shell/chunks/chunk-2GG3NVC4.js +10 -0
- package/dist/bin/shell/chunks/chunk-2NRAWO6E.js +7 -0
- package/dist/bin/shell/chunks/chunk-2SVX7I5P.js +14 -0
- package/dist/bin/shell/chunks/chunk-2TVVPMMT.js +34 -0
- package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/shell/chunks/chunk-3WIMLJM7.js +8 -0
- package/dist/bin/shell/chunks/chunk-42Z7Z3TQ.js +288 -0
- package/dist/bin/shell/chunks/chunk-4BNS566Q.js +4 -0
- package/dist/bin/shell/chunks/chunk-52Z5MJO2.js +17 -0
- package/dist/bin/shell/chunks/chunk-5WLKCCX7.js +6 -0
- package/dist/bin/shell/chunks/chunk-5XSZHUEI.js +15 -0
- package/dist/bin/shell/chunks/chunk-6FSBHK6H.js +22 -0
- package/dist/bin/shell/chunks/chunk-6GSBC77G.js +22 -0
- package/dist/bin/shell/chunks/chunk-6UL3WIEK.js +3 -0
- package/dist/bin/shell/chunks/chunk-6WJQNLR2.js +7 -0
- package/dist/bin/shell/chunks/chunk-77MLOOQS.js +11 -0
- package/dist/bin/shell/chunks/chunk-7AYT3UKI.js +6 -0
- package/dist/bin/shell/chunks/chunk-7GBHDJNC.js +34 -0
- package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/shell/chunks/chunk-7NDRU2ZN.js +5 -0
- package/dist/bin/shell/chunks/chunk-7UU7KPEM.js +7 -0
- package/dist/bin/shell/chunks/chunk-7VCQWCSH.js +15 -0
- package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-BE4PARL3.js +13 -0
- package/dist/bin/shell/chunks/chunk-BGX3RW7H.js +10 -0
- package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/shell/chunks/chunk-BPZJYOUA.js +33 -0
- package/dist/bin/shell/chunks/chunk-C7ISPH7Y.js +18 -0
- package/dist/bin/shell/chunks/chunk-CAZ75E7E.js +3 -0
- package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/shell/chunks/chunk-EDTBGO7F.js +37 -0
- package/dist/bin/shell/chunks/chunk-F3GKANW3.js +12 -0
- package/dist/bin/shell/chunks/chunk-F3WNDKOC.js +3 -0
- package/dist/bin/shell/chunks/chunk-FKVQZWJQ.js +10 -0
- package/dist/bin/shell/chunks/chunk-FX7BQD2Q.js +20 -0
- package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/shell/chunks/chunk-H7JTIXAO.js +4 -0
- package/dist/bin/shell/chunks/chunk-HADFAIPZ.js +17 -0
- package/dist/bin/shell/chunks/chunk-HL4ZS7TX.js +6 -0
- package/dist/bin/shell/chunks/chunk-HN2DCT7T.js +13 -0
- package/dist/bin/shell/chunks/chunk-HSTAQAVQ.js +11 -0
- package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/shell/chunks/chunk-IWXPUD2J.js +12 -0
- package/dist/bin/shell/chunks/chunk-IZGLHVBB.js +8 -0
- package/dist/bin/shell/chunks/chunk-J7TUF2VI.js +9 -0
- package/dist/bin/shell/chunks/chunk-JXLDT4KX.js +4 -0
- package/dist/bin/shell/chunks/chunk-KFMPGSUT.js +9 -0
- package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/shell/chunks/chunk-KRRM5UCC.js +3 -0
- package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNNWMRCB.js +3 -0
- package/dist/bin/shell/chunks/chunk-LNVSXNT7.js +3 -0
- package/dist/bin/shell/chunks/chunk-LZHWUYJZ.js +24 -0
- package/dist/bin/shell/chunks/chunk-MLUOPG3W.js +3 -0
- package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/shell/chunks/chunk-NKAT2N47.js +7 -0
- package/dist/bin/shell/chunks/chunk-NYIPFY36.js +3 -0
- package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/shell/chunks/chunk-OPMLWMNH.js +17 -0
- package/dist/bin/shell/chunks/chunk-PAYQNSZN.js +18 -0
- package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-PSGVOB5U.js +3 -0
- package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/shell/chunks/chunk-QPHXCMJV.js +80 -0
- package/dist/bin/shell/chunks/chunk-RJUDCNEZ.js +29 -0
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/shell/chunks/chunk-SAF4OIHD.js +20 -0
- package/dist/bin/shell/chunks/chunk-SMLKRKMP.js +11 -0
- package/dist/bin/shell/chunks/chunk-SMSELHIY.js +12 -0
- package/dist/bin/shell/chunks/chunk-T74E2U4J.js +64 -0
- package/dist/bin/shell/chunks/chunk-UO5LOD7U.js +12 -0
- package/dist/bin/shell/chunks/chunk-UOMNSQEZ.js +10 -0
- package/dist/bin/shell/chunks/chunk-UVKD35GR.js +9 -0
- package/dist/bin/shell/chunks/chunk-V2RP73X4.js +15 -0
- package/dist/bin/shell/chunks/chunk-VP3OTMHX.js +22 -0
- package/dist/bin/shell/chunks/chunk-VZK4FHWJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-WDWNEHHE.js +9 -0
- package/dist/bin/shell/chunks/chunk-X4MX6EHF.js +6 -0
- package/dist/bin/shell/chunks/chunk-X5WRKSEU.js +101 -0
- package/dist/bin/shell/chunks/chunk-XBB73LFB.js +5 -0
- package/dist/bin/shell/chunks/chunk-XCUJL2AJ.js +141 -0
- package/dist/bin/shell/chunks/chunk-XHCCSVP6.js +9 -0
- package/dist/bin/shell/chunks/chunk-XJ37N3S5.js +7 -0
- package/dist/bin/shell/chunks/chunk-XPTYN6UE.js +8 -0
- package/dist/bin/shell/chunks/chunk-XRUDFQG5.js +7 -0
- package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/shell/chunks/chunk-YOKQNNQO.js +6 -0
- package/dist/bin/shell/chunks/chunk-YR32XGKD.js +3 -0
- package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/shell/chunks/chunk-YY5PJR7O.js +7 -0
- package/dist/bin/shell/chunks/chunk-ZAMAXG5K.js +85 -0
- package/dist/bin/shell/chunks/chunk-ZFUVUYWG.js +15 -0
- package/dist/bin/shell/chunks/clear-FGNEKYDU.js +3 -0
- package/dist/bin/shell/chunks/column-AQB3A3PJ.js +3 -0
- package/dist/bin/shell/chunks/comm-Q4VDF6ZO.js +3 -0
- package/dist/bin/shell/chunks/cp-HYXTMN3D.js +3 -0
- package/dist/bin/shell/chunks/curl-PLHETP4J.js +27 -0
- package/dist/bin/shell/chunks/cut-ZI2HIAW7.js +3 -0
- package/dist/bin/shell/chunks/date-OFYBOAUE.js +3 -0
- package/dist/bin/shell/chunks/diff-TL7IV4S2.js +3 -0
- package/dist/bin/shell/chunks/dirname-VCINTLPD.js +3 -0
- package/dist/bin/shell/chunks/du-4LRQIGRG.js +3 -0
- package/dist/bin/shell/chunks/echo-KCOHTNDF.js +3 -0
- package/dist/bin/shell/chunks/env-NY32PQJM.js +3 -0
- package/dist/bin/shell/chunks/expand-YYSO35NS.js +3 -0
- package/dist/bin/shell/chunks/expansion-YT6DLHRE.js +3 -0
- package/dist/bin/shell/chunks/expr-XNBNPKSF.js +3 -0
- package/dist/bin/shell/chunks/file-U4GYVT3G.js +3 -0
- package/dist/bin/shell/chunks/find-CZ6UMSZX.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-MPBSMQIN.js +3 -0
- package/dist/bin/shell/chunks/fold-5MF7QZWQ.js +3 -0
- package/dist/bin/shell/chunks/grep-JCHLTP7S.js +3 -0
- package/dist/bin/shell/chunks/gzip-UGBQQKIH.js +3 -0
- package/dist/bin/shell/chunks/head-77V5O3RE.js +3 -0
- package/dist/bin/shell/chunks/help-CGUEOGXQ.js +3 -0
- package/dist/bin/shell/chunks/history-AQQWW3QB.js +3 -0
- package/dist/bin/shell/chunks/hostname-USNWOQCK.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-PHASM44U.js +3 -0
- package/dist/bin/shell/chunks/join-EJ73DYTK.js +3 -0
- package/dist/bin/shell/chunks/jq-W6KOII4Y.js +3 -0
- package/dist/bin/shell/chunks/js-exec-BC6NI55L.js +98 -0
- package/dist/bin/shell/chunks/ln-LP4HMCSM.js +3 -0
- package/dist/bin/shell/chunks/ls-YGNSAGDK.js +3 -0
- package/dist/bin/shell/chunks/md5sum-MCVDIB35.js +3 -0
- package/dist/bin/shell/chunks/mkdir-P4DKRCDX.js +3 -0
- package/dist/bin/shell/chunks/mv-QQK4FQX6.js +3 -0
- package/dist/bin/shell/chunks/nl-KUPLVCTS.js +3 -0
- package/dist/bin/shell/chunks/od-YQ5ZUI2H.js +3 -0
- package/dist/bin/shell/chunks/paste-A5KKPWXX.js +3 -0
- package/dist/bin/shell/chunks/printf-XXZMDRGE.js +3 -0
- package/dist/bin/shell/chunks/pwd-FCNDA467.js +3 -0
- package/dist/bin/shell/chunks/python3-BQWDPUBM.js +13 -0
- package/dist/bin/shell/chunks/readlink-25V57VOL.js +3 -0
- package/dist/bin/shell/chunks/rev-PYHOZ4D4.js +3 -0
- package/dist/bin/shell/chunks/rg-OHJSRKFS.js +3 -0
- package/dist/bin/shell/chunks/rm-ECNUFR66.js +3 -0
- package/dist/bin/shell/chunks/rmdir-DLOHIA7Q.js +3 -0
- package/dist/bin/shell/chunks/sed-4GRUPTAO.js +3 -0
- package/dist/bin/shell/chunks/seq-UXDJE6FB.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-4KF52U3Y.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-6YEPULPX.js +3 -0
- package/dist/bin/shell/chunks/sleep-QHAPNY3Q.js +3 -0
- package/dist/bin/shell/chunks/sort-4C6WOKNK.js +3 -0
- package/dist/bin/shell/chunks/split-TV7NL7LA.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-W777NCI4.js +3 -0
- package/dist/bin/shell/chunks/stat-BD6KT3BP.js +3 -0
- package/dist/bin/shell/chunks/strings-MDD72LR6.js +3 -0
- package/dist/bin/shell/chunks/tac-C2N4NQ6S.js +3 -0
- package/dist/bin/shell/chunks/tail-LGNECVQA.js +3 -0
- package/dist/bin/shell/chunks/tar-K6HVPBVB.js +3 -0
- package/dist/bin/shell/chunks/tee-UQHPO4OW.js +3 -0
- package/dist/bin/shell/chunks/time-ZPY52VT2.js +3 -0
- package/dist/bin/shell/chunks/timeout-5AX3ZS3X.js +3 -0
- package/dist/bin/shell/chunks/touch-DFGSVIX7.js +3 -0
- package/dist/bin/shell/chunks/tr-G7K6M6HP.js +3 -0
- package/dist/bin/shell/chunks/tree-6D7SMPUR.js +3 -0
- package/dist/bin/shell/chunks/true-SKL4L7JP.js +3 -0
- package/dist/bin/shell/chunks/unexpand-QIR4EDPG.js +3 -0
- package/dist/bin/shell/chunks/uniq-I7PVFJR4.js +3 -0
- package/dist/bin/shell/chunks/wc-6NGWULAP.js +3 -0
- package/dist/bin/shell/chunks/which-LCXKCLFC.js +3 -0
- package/dist/bin/shell/chunks/whoami-TZDZDU7T.js +3 -0
- package/dist/bin/shell/chunks/xan-LGEJUGOM.js +3 -0
- package/dist/bin/shell/chunks/xan-view-L75WEJE2.js +3 -0
- package/dist/bin/shell/chunks/xargs-UWHPYLY7.js +3 -0
- package/dist/bin/shell/chunks/yq-V6YWS23E.js +3 -0
- package/dist/bin/shell/shell.js +757 -0
- package/dist/browser.d.ts +23 -0
- package/dist/bundle/browser.js +1546 -0
- package/dist/bundle/chunks/alias-RTYYYW3D.js +2 -0
- package/dist/bundle/chunks/awk2-GS47M5U7.js +2 -0
- package/dist/bundle/chunks/base64-C2AIWVNC.js +2 -0
- package/dist/bundle/chunks/basename-UB3CIYNI.js +2 -0
- package/dist/bundle/chunks/bash-YZ33HQZQ.js +2 -0
- package/dist/bundle/chunks/cat-TSFMZVYS.js +2 -0
- package/dist/bundle/chunks/chmod-TFEPA42X.js +2 -0
- package/dist/bundle/chunks/chunk-27JIFWUR.js +3 -0
- package/dist/bundle/chunks/chunk-2JIPICV3.js +13 -0
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
- package/dist/bundle/chunks/chunk-2VDTE5BV.js +14 -0
- package/dist/bundle/chunks/chunk-2VJJEDV2.js +8 -0
- package/dist/bundle/chunks/chunk-4JLVZKHC.js +8 -0
- package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
- package/dist/bundle/chunks/chunk-4N6J7B5P.js +6 -0
- package/dist/bundle/chunks/chunk-4WKZNNJK.js +2 -0
- package/dist/bundle/chunks/chunk-5A3ZCIHP.js +2 -0
- package/dist/bundle/chunks/chunk-5H5SCKJM.js +11 -0
- package/dist/bundle/chunks/chunk-5IFY2NZJ.js +19 -0
- package/dist/bundle/chunks/chunk-6LASZU3O.js +5 -0
- package/dist/bundle/chunks/chunk-6SHYIICL.js +4 -0
- package/dist/bundle/chunks/chunk-6VAT5Z2D.js +5 -0
- package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
- package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
- package/dist/bundle/chunks/chunk-7F47ISLI.js +33 -0
- package/dist/bundle/chunks/chunk-7JHM3L42.js +6 -0
- package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
- package/dist/bundle/chunks/chunk-AA63C4TN.js +23 -0
- package/dist/bundle/chunks/chunk-ACSZB4FE.js +11 -0
- package/dist/bundle/chunks/chunk-BOZLBWPL.js +100 -0
- package/dist/bundle/chunks/chunk-BU36VZYL.js +4 -0
- package/dist/bundle/chunks/chunk-BVKWRAS6.js +12 -0
- package/dist/bundle/chunks/chunk-BXERNLCU.js +33 -0
- package/dist/bundle/chunks/chunk-BZUGFHVS.js +2 -0
- package/dist/bundle/chunks/chunk-CBJVD2XA.js +7 -0
- package/dist/bundle/chunks/chunk-CN5XGDNN.js +6 -0
- package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
- package/dist/bundle/chunks/chunk-DVHZ434T.js +10 -0
- package/dist/bundle/chunks/chunk-EBAPSGAO.js +9 -0
- package/dist/bundle/chunks/chunk-EXLJT6MD.js +140 -0
- package/dist/bundle/chunks/chunk-FAXLQUCQ.js +10 -0
- package/dist/bundle/chunks/chunk-FE7TPM5F.js +79 -0
- package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
- package/dist/bundle/chunks/chunk-FJK43EBQ.js +14 -0
- package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
- package/dist/bundle/chunks/chunk-FW54FHZR.js +2 -0
- package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
- package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
- package/dist/bundle/chunks/chunk-GGC5NEPZ.js +8 -0
- package/dist/bundle/chunks/chunk-GJC3WVOW.js +2 -0
- package/dist/bundle/chunks/chunk-GSPYNYZA.js +6 -0
- package/dist/bundle/chunks/chunk-HBVMHTO5.js +2 -0
- package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
- package/dist/bundle/chunks/chunk-HJBTD7PY.js +21 -0
- package/dist/bundle/chunks/chunk-ICIEVHY5.js +36 -0
- package/dist/bundle/chunks/chunk-J2XQNA2Z.js +8 -0
- package/dist/bundle/chunks/chunk-JYUAM3H7.js +16 -0
- package/dist/bundle/chunks/chunk-KD3KENL6.js +11 -0
- package/dist/bundle/chunks/chunk-KWGBQNTV.js +32 -0
- package/dist/bundle/chunks/chunk-KXUUKRXD.js +2 -0
- package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
- package/dist/bundle/chunks/chunk-L64BMZUV.js +2 -0
- package/dist/bundle/chunks/chunk-L66DE7G5.js +21 -0
- package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
- package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
- package/dist/bundle/chunks/chunk-LWXDWLMH.js +14 -0
- package/dist/bundle/chunks/chunk-MFDPAVC6.js +14 -0
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
- package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
- package/dist/bundle/chunks/chunk-NRSASXYY.js +2 -0
- package/dist/bundle/chunks/chunk-OGJ5CFPR.js +9 -0
- package/dist/bundle/chunks/chunk-OVGANXCG.js +8 -0
- package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
- package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
- package/dist/bundle/chunks/chunk-R4IFXNY5.js +28 -0
- package/dist/bundle/chunks/chunk-R74UQCKX.js +5 -0
- package/dist/bundle/chunks/chunk-RBQG6ZUG.js +3 -0
- package/dist/bundle/chunks/chunk-S3LEJEPP.js +2 -0
- package/dist/bundle/chunks/chunk-S443BAN4.js +7 -0
- package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
- package/dist/bundle/chunks/chunk-SETW5JBN.js +9 -0
- package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
- package/dist/bundle/chunks/chunk-SJYEXC2Z.js +14 -0
- package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
- package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
- package/dist/bundle/chunks/chunk-T3EYGW4N.js +63 -0
- package/dist/bundle/chunks/chunk-T4TFLF3R.js +16 -0
- package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
- package/dist/bundle/chunks/chunk-TN7HHBQW.js +5 -0
- package/dist/bundle/chunks/chunk-U73A73IE.js +17 -0
- package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
- package/dist/bundle/chunks/chunk-UP6MSJGD.js +17 -0
- package/dist/bundle/chunks/chunk-UURAZSVT.js +10 -0
- package/dist/bundle/chunks/chunk-V6PSIUPR.js +11 -0
- package/dist/bundle/chunks/chunk-V77XGLKX.js +5 -0
- package/dist/bundle/chunks/chunk-VBRPS3D5.js +2 -0
- package/dist/bundle/chunks/chunk-VLCHOJWK.js +6 -0
- package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
- package/dist/bundle/chunks/chunk-WM5IJFMP.js +8 -0
- package/dist/bundle/chunks/chunk-WN7T6YIH.js +287 -0
- package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
- package/dist/bundle/chunks/chunk-WPGQVBSY.js +6 -0
- package/dist/bundle/chunks/chunk-XCQWV4AU.js +12 -0
- package/dist/bundle/chunks/chunk-XHLMAZX2.js +5 -0
- package/dist/bundle/chunks/chunk-XRFHFXFP.js +2 -0
- package/dist/bundle/chunks/chunk-Y4LIDHSD.js +7 -0
- package/dist/bundle/chunks/chunk-Y4SO5AJF.js +16 -0
- package/dist/bundle/chunks/chunk-YCLFEX4T.js +3 -0
- package/dist/bundle/chunks/chunk-YRXX457F.js +6 -0
- package/dist/bundle/chunks/chunk-YS4NUBYX.js +9 -0
- package/dist/bundle/chunks/chunk-ZDIT6ST5.js +7 -0
- package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
- package/dist/bundle/chunks/chunk-ZLAEZD2P.js +21 -0
- package/dist/bundle/chunks/clear-HKGFEOF6.js +2 -0
- package/dist/bundle/chunks/column-XT6UFXNQ.js +2 -0
- package/dist/bundle/chunks/comm-VV2LDX2J.js +2 -0
- package/dist/bundle/chunks/cp-BISAAS7A.js +2 -0
- package/dist/bundle/chunks/curl-GRYA74XW.js +26 -0
- package/dist/bundle/chunks/cut-OKARJCCV.js +2 -0
- package/dist/bundle/chunks/date-XKUEQ4WF.js +2 -0
- package/dist/bundle/chunks/diff-MWJFIG7X.js +2 -0
- package/dist/bundle/chunks/dirname-MPHRFUTI.js +2 -0
- package/dist/bundle/chunks/du-572XNP42.js +2 -0
- package/dist/bundle/chunks/echo-NDWZZHPO.js +2 -0
- package/dist/bundle/chunks/env-36M5BO7M.js +2 -0
- package/dist/bundle/chunks/expand-JSPG6VOP.js +2 -0
- package/dist/bundle/chunks/expansion-2O6WLRBD.js +2 -0
- package/dist/bundle/chunks/expr-6MFJ5XZG.js +2 -0
- package/dist/bundle/chunks/file-55SY74D5.js +2 -0
- package/dist/bundle/chunks/find-BKC2BIAO.js +2 -0
- package/dist/bundle/chunks/flag-coverage-4GZNBF47.js +2 -0
- package/dist/bundle/chunks/fold-4TQNYMSW.js +2 -0
- package/dist/bundle/chunks/grep-2ILJFW6Y.js +2 -0
- package/dist/bundle/chunks/gzip-O5ASJAFY.js +2 -0
- package/dist/bundle/chunks/head-BALRBIDD.js +2 -0
- package/dist/bundle/chunks/help-HZ6M2CKN.js +2 -0
- package/dist/bundle/chunks/history-WYYKSLSZ.js +2 -0
- package/dist/bundle/chunks/hostname-C4HQXXUP.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-JW4MSQZO.js +2 -0
- package/dist/bundle/chunks/join-TBRGI3LQ.js +2 -0
- package/dist/bundle/chunks/jq-QLLVLUWT.js +2 -0
- package/dist/bundle/chunks/js-exec-N5KEZBH7.js +97 -0
- package/dist/bundle/chunks/js-exec-worker.js +4639 -0
- package/dist/bundle/chunks/ln-4LGSXXGD.js +2 -0
- package/dist/bundle/chunks/ls-ZJGQER7M.js +2 -0
- package/dist/bundle/chunks/md5sum-SPU24VSG.js +2 -0
- package/dist/bundle/chunks/mkdir-MEPGZOB6.js +2 -0
- package/dist/bundle/chunks/mv-W5BIQ646.js +2 -0
- package/dist/bundle/chunks/nl-WSDW7I4O.js +2 -0
- package/dist/bundle/chunks/od-WOKFDJTP.js +2 -0
- package/dist/bundle/chunks/paste-7JC6S4DX.js +2 -0
- package/dist/bundle/chunks/printf-I2B4W2XW.js +2 -0
- package/dist/bundle/chunks/pwd-WE6EN5AV.js +2 -0
- package/dist/bundle/chunks/python3-POMOR4OA.js +12 -0
- package/dist/bundle/chunks/readlink-OPJF4DL5.js +2 -0
- package/dist/bundle/chunks/rev-5EHFX4EJ.js +2 -0
- package/dist/bundle/chunks/rg-X6MJUOKW.js +2 -0
- package/dist/bundle/chunks/rm-SSGETQVQ.js +2 -0
- package/dist/bundle/chunks/rmdir-OC4ZLPYA.js +2 -0
- package/dist/bundle/chunks/sed-JWIN756M.js +2 -0
- package/dist/bundle/chunks/seq-M5EC7Q57.js +2 -0
- package/dist/bundle/chunks/sha1sum-2PTOAFR6.js +2 -0
- package/dist/bundle/chunks/sha256sum-NS7D3IXX.js +2 -0
- package/dist/bundle/chunks/sleep-X22JJINO.js +2 -0
- package/dist/bundle/chunks/sort-SW2YEO5B.js +2 -0
- package/dist/bundle/chunks/split-4KKZZXXE.js +2 -0
- package/dist/bundle/chunks/sqlite3-CGOEFJAO.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
- package/dist/bundle/chunks/stat-CD34IZ4P.js +2 -0
- package/dist/bundle/chunks/strings-6WDHLGMX.js +2 -0
- package/dist/bundle/chunks/tac-2STMMJYW.js +2 -0
- package/dist/bundle/chunks/tail-3JSKDTET.js +2 -0
- package/dist/bundle/chunks/tar-WT6S4IJX.js +2 -0
- package/dist/bundle/chunks/tee-YUZ2FKCJ.js +2 -0
- package/dist/bundle/chunks/time-D4LNBSWX.js +2 -0
- package/dist/bundle/chunks/timeout-YDCRSLPQ.js +2 -0
- package/dist/bundle/chunks/touch-UA33VN3N.js +2 -0
- package/dist/bundle/chunks/tr-36LHWFRQ.js +2 -0
- package/dist/bundle/chunks/tree-YLD52CNT.js +2 -0
- package/dist/bundle/chunks/true-FHQXJXBE.js +2 -0
- package/dist/bundle/chunks/unexpand-CADSA4VO.js +2 -0
- package/dist/bundle/chunks/uniq-XSIZR6PB.js +2 -0
- package/dist/bundle/chunks/wc-LF7NU4LA.js +2 -0
- package/dist/bundle/chunks/which-XEM24D5D.js +2 -0
- package/dist/bundle/chunks/whoami-XMTX52VE.js +2 -0
- package/dist/bundle/chunks/worker.js +3150 -0
- package/dist/bundle/chunks/xan-5D7XBVRF.js +2 -0
- package/dist/bundle/chunks/xan-view-P7JTBY6N.js +2 -0
- package/dist/bundle/chunks/xargs-MGZPH7AX.js +2 -0
- package/dist/bundle/chunks/yq-6N2YNRZS.js +2 -0
- package/dist/bundle/index.cjs +2209 -0
- package/dist/bundle/index.js +733 -0
- package/dist/commands/alias/alias.d.ts +6 -0
- package/dist/commands/awk/ast.d.ts +202 -0
- package/dist/commands/awk/awk2.d.ts +9 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +75 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/lexer.d.ts +100 -0
- package/dist/commands/awk/parser2-print.d.ts +35 -0
- package/dist/commands/awk/parser2.d.ts +81 -0
- package/dist/commands/base64/base64.d.ts +7 -0
- package/dist/commands/basename/basename.d.ts +4 -0
- package/dist/commands/bash/bash.d.ts +6 -0
- package/dist/commands/browser-excluded.d.ts +16 -0
- package/dist/commands/cat/cat.d.ts +4 -0
- package/dist/commands/chmod/chmod.d.ts +4 -0
- package/dist/commands/clear/clear.d.ts +4 -0
- package/dist/commands/column/column.d.ts +11 -0
- package/dist/commands/comm/comm.d.ts +12 -0
- package/dist/commands/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/response-formatting.d.ts +20 -0
- package/dist/commands/curl/types.d.ts +60 -0
- package/dist/commands/cut/cut.d.ts +4 -0
- package/dist/commands/date/date.d.ts +7 -0
- package/dist/commands/diff/diff.d.ts +7 -0
- package/dist/commands/dirname/dirname.d.ts +4 -0
- package/dist/commands/du/du.d.ts +4 -0
- package/dist/commands/duration.d.ts +5 -0
- package/dist/commands/echo/echo.d.ts +4 -0
- package/dist/commands/env/env.d.ts +6 -0
- package/dist/commands/expand/expand.d.ts +12 -0
- package/dist/commands/expand/unexpand.d.ts +12 -0
- package/dist/commands/expr/expr.d.ts +9 -0
- package/dist/commands/file/file.d.ts +9 -0
- package/dist/commands/find/find.d.ts +4 -0
- package/dist/commands/find/matcher.d.ts +69 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +88 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +12 -0
- package/dist/commands/format-mode.d.ts +4 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +8 -0
- package/dist/commands/gzip/gzip.d.ts +13 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +4 -0
- package/dist/commands/help/help.d.ts +4 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +4 -0
- package/dist/commands/hostname/hostname.d.ts +11 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/join/join.d.ts +12 -0
- package/dist/commands/jq/jq.d.ts +9 -0
- package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/js-exec-worker.d.ts +32 -0
- package/dist/commands/js-exec/js-exec.d.ts +11 -0
- package/dist/commands/js-exec/module-shims.d.ts +29 -0
- package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
- package/dist/commands/ln/ln.d.ts +4 -0
- package/dist/commands/ls/ls.d.ts +4 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/md5sum/md5sum.d.ts +4 -0
- package/dist/commands/md5sum/sha1sum.d.ts +4 -0
- package/dist/commands/md5sum/sha256sum.d.ts +4 -0
- package/dist/commands/mkdir/mkdir.d.ts +4 -0
- package/dist/commands/mv/mv.d.ts +4 -0
- package/dist/commands/nl/nl.d.ts +12 -0
- package/dist/commands/od/od.d.ts +12 -0
- package/dist/commands/paste/paste.d.ts +4 -0
- package/dist/commands/printf/escapes.d.ts +25 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +9 -0
- package/dist/commands/pwd/pwd.d.ts +4 -0
- package/dist/commands/python3/python3.d.ts +16 -0
- package/dist/commands/python3/worker.d.ts +28 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +40 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +9 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +83 -0
- package/dist/commands/query-engine/value-operations.d.ts +41 -0
- package/dist/commands/readlink/readlink.d.ts +4 -0
- package/dist/commands/registry.d.ts +56 -0
- package/dist/commands/rev/rev.d.ts +13 -0
- package/dist/commands/rg/file-types.d.ts +49 -0
- package/dist/commands/rg/gitignore.d.ts +98 -0
- package/dist/commands/rg/rg-options.d.ts +61 -0
- package/dist/commands/rg/rg-parser.d.ts +20 -0
- package/dist/commands/rg/rg-search.d.ts +15 -0
- package/dist/commands/rg/rg.d.ts +14 -0
- package/dist/commands/rm/rm.d.ts +4 -0
- package/dist/commands/rmdir/rmdir.d.ts +4 -0
- package/dist/commands/search-engine/index.d.ts +10 -0
- package/dist/commands/search-engine/matcher.d.ts +66 -0
- package/dist/commands/search-engine/regex.d.ts +46 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/lexer.d.ts +86 -0
- package/dist/commands/sed/parser.d.ts +18 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/sed.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +216 -0
- package/dist/commands/seq/seq.d.ts +16 -0
- package/dist/commands/sleep/sleep.d.ts +4 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +4 -0
- package/dist/commands/sort/types.d.ts +30 -0
- package/dist/commands/split/split.d.ts +12 -0
- package/dist/commands/sqlite3/formatters.d.ts +15 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +23 -0
- package/dist/commands/sqlite3/worker.d.ts +45 -0
- package/dist/commands/sqlite3/worker.js +1728 -0
- package/dist/commands/stat/stat.d.ts +4 -0
- package/dist/commands/strings/strings.d.ts +12 -0
- package/dist/commands/tac/tac.d.ts +11 -0
- package/dist/commands/tail/tail.d.ts +4 -0
- package/dist/commands/tar/archive.d.ts +135 -0
- package/dist/commands/tar/bzip2-compress.d.ts +17 -0
- package/dist/commands/tar/tar-options.d.ts +37 -0
- package/dist/commands/tar/tar.d.ts +10 -0
- package/dist/commands/tee/tee.d.ts +4 -0
- package/dist/commands/time/time.d.ts +27 -0
- package/dist/commands/timeout/timeout.d.ts +4 -0
- package/dist/commands/touch/touch.d.ts +4 -0
- package/dist/commands/tr/tr.d.ts +4 -0
- package/dist/commands/tree/tree.d.ts +4 -0
- package/dist/commands/true/true.d.ts +6 -0
- package/dist/commands/uniq/uniq.d.ts +4 -0
- package/dist/commands/wc/wc.d.ts +4 -0
- package/dist/commands/which/which.d.ts +4 -0
- package/dist/commands/whoami/whoami.d.ts +11 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
- package/dist/commands/worker-bridge/protocol.d.ts +141 -0
- package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
- package/dist/commands/xan/aggregation.d.ts +20 -0
- package/dist/commands/xan/column-selection.d.ts +19 -0
- package/dist/commands/xan/csv.d.ts +37 -0
- package/dist/commands/xan/moonblade-parser.d.ts +80 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
- package/dist/commands/xan/subcommands.d.ts +15 -0
- package/dist/commands/xan/xan-agg.d.ts +8 -0
- package/dist/commands/xan/xan-columns.d.ts +8 -0
- package/dist/commands/xan/xan-core.d.ts +10 -0
- package/dist/commands/xan/xan-data.d.ts +52 -0
- package/dist/commands/xan/xan-filter.d.ts +8 -0
- package/dist/commands/xan/xan-map.d.ts +11 -0
- package/dist/commands/xan/xan-reshape.d.ts +40 -0
- package/dist/commands/xan/xan-simple.d.ts +40 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +10 -0
- package/dist/commands/xargs/xargs.d.ts +4 -0
- package/dist/commands/yq/formats.d.ts +64 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +42 -0
- package/dist/encoding.d.ts +115 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +75 -0
- package/dist/fs/in-memory-fs/index.d.ts +1 -0
- package/dist/fs/init.d.ts +22 -0
- package/dist/fs/interface.d.ts +251 -0
- package/dist/fs/mountable-fs/index.d.ts +1 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
- package/dist/fs/overlay-fs/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +165 -0
- package/dist/fs/path-utils.d.ts +46 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +98 -0
- package/dist/fs/real-fs-utils.d.ts +90 -0
- package/dist/fs/sanitize-error.d.ts +19 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/interpreter/alias-expansion.d.ts +23 -0
- package/dist/interpreter/arithmetic.d.ts +24 -0
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +39 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +35 -0
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +9 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +14 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +45 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +9 -0
- package/dist/interpreter/builtins/shift.d.ts +15 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +16 -0
- package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
- package/dist/interpreter/errors.d.ts +167 -0
- package/dist/interpreter/expansion/analysis.d.ts +37 -0
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +20 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
- package/dist/interpreter/expansion/pattern.d.ts +23 -0
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +12 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +36 -0
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +29 -0
- package/dist/interpreter/expansion.d.ts +53 -0
- package/dist/interpreter/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +43 -0
- package/dist/interpreter/helpers/condition.d.ts +22 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +104 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/quoting.d.ts +24 -0
- package/dist/interpreter/helpers/readonly.d.ts +45 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +60 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -0
- package/dist/interpreter/helpers/string-compare.d.ts +24 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/tilde.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +26 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/index.d.ts +4 -0
- package/dist/interpreter/interpreter.d.ts +91 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/redirections.d.ts +60 -0
- package/dist/interpreter/simple-command-assignments.d.ts +29 -0
- package/dist/interpreter/subshell-group.d.ts +32 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +393 -0
- package/dist/limits.d.ts +52 -0
- package/dist/network/allow-list/shared.d.ts +59 -0
- package/dist/network/allow-list.d.ts +59 -0
- package/dist/network/dns-pin.d.ts +43 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +155 -0
- package/dist/parser/arithmetic-parser.d.ts +23 -0
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +28 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +16 -0
- package/dist/parser/lexer.d.ts +197 -0
- package/dist/parser/parser-substitution.d.ts +76 -0
- package/dist/parser/parser.d.ts +136 -0
- package/dist/parser/types.d.ts +25 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +35 -0
- package/dist/sandbox/Sandbox.d.ts +90 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/shell-metadata.d.ts +25 -0
- package/dist/timers.d.ts +4 -0
- package/dist/types.d.ts +248 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +74 -0
- package/dist/utils/glob.d.ts +25 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +188 -0
- package/vendor/cpython-emscripten/python.cjs +2 -0
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/vendor/cpython-emscripten/python313.zip +0 -0
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
var V7=Object.create;var qa=Object.defineProperty;var q7=Object.getOwnPropertyDescriptor;var Z7=Object.getOwnPropertyNames;var K7=Object.getPrototypeOf,Q7=Object.prototype.hasOwnProperty;var Jn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ui=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ee=(e,t)=>{for(var n in t)qa(e,n,{get:t[n],enumerable:!0})},X7=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Z7(t))!Q7.call(e,s)&&s!==n&&qa(e,s,{get:()=>t[s],enumerable:!(r=q7(t,s))||r.enumerable});return e};var zf=(e,t,n)=>(n=e!=null?V7(K7(e)):{},X7(t||!e||!e.__esModule?qa(n,"default",{value:e,enumerable:!0}):n,e));function Hf(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}var jf=I(()=>{"use strict"});function Gf(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function e4(e,t,...n){return Ue.run(e,()=>t(...n))}function t4(e){return e===void 0?{...Za,enabled:!1}:typeof e=="boolean"?{...Za,enabled:e}:{...Za,...e}}var lr,Ka,Y7,de,Ue,J7,Za,bt,cn=I(()=>{"use strict";jf();lr=!0;Ka=null;if(!lr)try{let{AsyncLocalStorage:e}=Jn("node:async_hooks");Ka=e}catch{}Y7=`
|
|
2
|
+
|
|
3
|
+
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,de=class extends Error{violation;constructor(t,n){super(t+Y7),this.violation=n,this.name="SecurityViolationError"}},Ue=!lr&&Ka?new Ka:null,J7=1e3;Za={enabled:!0,auditMode:!1};bt=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=t4(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(n.enabled!==r.enabled||n.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${n.enabled}, auditMode: ${n.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return Ue?Ue?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(Ue)return Ue?.getStore()?.executionId}static enterTrustedScope(t){let n=e.trustedExecutionDepth.get(t)??0;e.trustedExecutionDepth.set(t,n+1)}static leaveTrustedScope(t){let n=e.trustedExecutionDepth.get(t);if(n){if(n===1){e.trustedExecutionDepth.delete(t);return}e.trustedExecutionDepth.set(t,n-1)}}static isTrustedScopeActive(t){return t?(e.trustedExecutionDepth.get(t)??0)>0:!1}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let n=this.contextCache.get(t);return n||(n={sandboxActive:!0,executionId:t},this.contextCache.set(t,n)),n}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let t of this.activeExecutionIds)return t}static bindCurrentContext(t){if(!Ue)return t;let n=e.instance,r=Ue.getStore(),s=r?.sandboxActive===!0?r.executionId:n?.getPreferredActiveExecutionId();if(!s)return t;let i=n?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let a=e.instance;if(!(a&&!a.isExecutionIdActive(s)&&(a.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!a.config.auditMode)))return e4(i,t,...o)})}isEnabled(){return this.config.enabled===!0&&Ue!==null&&!lr}updateConfig(t){this.config={...this.config,...t}}activate(){if(lr||!this.config.enabled||!Ue){let r=Gf(),s=!1;return{run:i=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):i(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let t=Gf(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),Ue.run({sandboxActive:!0,executionId:t},r)),deactivate:()=>{n||(n=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(t,n){return t===globalThis?`globalThis.${n}`:t===process?`process.${n}`:t===Error?`Error.${n}`:t===Function.prototype?`Function.prototype.${n}`:t===Object.prototype?`Object.prototype.${n}`:`<object>.${n}`}static runTrusted(t){if(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},()=>{e.enterTrustedScope(r);try{let s=t();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{e.leaveTrustedScope(r)}):(e.leaveTrustedScope(r),s)}catch(s){throw e.leaveTrustedScope(r),s}})}static async runTrustedAsync(t){if(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}shouldBlock(){if(lr||this.config.auditMode||!Ue)return!1;let t=Ue?.getStore();return!(t?.sandboxActive!==!0||t.trusted||e.isTrustedScopeActive(t.executionId))}recordViolation(t,n,r){let s={timestamp:Date.now(),type:t,message:r,path:n,stack:new Error().stack,executionId:Ue?.getStore()?.executionId};if(this.violations.length<J7&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return s}createBlockingProxy(t,n,r){let s=this;return new Proxy(t,{apply(i,o,a){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new de(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new de(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,n,r,s){let i=this;return new Proxy(t,{get(o,a,l){if(i.shouldBlock()){if(s&&typeof a=="string"&&s.has(a))return Reflect.get(o,a,l);let c=`${n}.${String(a)}`,u=`${c} is blocked during script execution`,f=i.recordViolation(r,c,u);throw new de(u,f)}if(i.config.auditMode&&Ue?.getStore()?.sandboxActive===!0){let c=`${n}.${String(a)}`;i.recordViolation(r,c,`${c} accessed (audit mode)`)}return Reflect.get(o,a,l)},set(o,a,l,c){if(i.shouldBlock()){let u=`${n}.${String(a)}`,f=`${u} modification is blocked during script execution`,p=i.recordViolation(r,u,f);throw new de(f,p)}return Reflect.set(o,a,l,c)},ownKeys(o){if(i.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,l=i.recordViolation(r,n,a);throw new de(a,l)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} descriptor access is blocked during script execution`,u=i.recordViolation(r,l,c);throw new de(c,u)}return Reflect.getOwnPropertyDescriptor(o,a)},has(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} existence check is blocked during script execution`,u=i.recordViolation(r,l,c);throw new de(c,u)}return Reflect.has(o,a)},deleteProperty(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} deletion is blocked during script execution`,u=i.recordViolation(r,l,c);throw new de(c,u)}return Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){if(i.shouldBlock()){let l=`${n} setPrototypeOf is blocked during script execution`,c=i.recordViolation(r,n,l);throw new de(l,c)}return Reflect.setPrototypeOf(o,a)},defineProperty(o,a,l){if(i.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} defineProperty is blocked during script execution`,f=i.recordViolation(r,c,u);throw new de(u,f)}return Reflect.defineProperty(o,a,l)}})}applyPatches(){this.patchFailures=[];let t=Hf(),n=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let i of t)n.has(i.violationType)||this.applyPatch(i);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(i=>r.includes(i));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,n=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==n&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let n=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:n});let r=n?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new de(i,o)}t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}protectPromiseThen(){let t=this;try{let i=function(...o){return Ue.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var n=i;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(a,l){if(!Ue)return Reflect.apply(s,this,[a,l]);let c=Ue.getStore(),u=c?.sandboxActive===!0&&c.trusted!==!0?c.executionId:void 0;if(!u)return Reflect.apply(s,this,[a,l]);let f=t.getCachedContext(u),p=(h,d)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:f,cb:h,kind:d});return Reflect.apply(s,this,[p(a,"fulfilled"),p(l,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let a=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,a);throw new de(a,l)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} accessed (audit mode)`),o},set(a){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new de(l,c)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){this.patchFailures.push(n),console.debug(`[DefenseInDepthBox] Could not patch ${n}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:n});let r=n?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let s="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",s);throw new de(s,i)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",o=t.recordViolation("process_main_module","process.mainModule",i);throw new de(i,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",n instanceof Error?n.message:n)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:n});let r=n?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let s="process.execPath access is blocked during script execution",i=t.recordViolation("process_exec_path","process.execPath",s);throw new de(s,i)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.execPath modification is blocked during script execution",o=t.recordViolation("process_exec_path","process.execPath",i);throw new de(i,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}lockWellKnownSymbols(){let t=(n,r)=>{try{let s=Object.getOwnPropertyDescriptor(n,r);if(s?.configurable){if("value"in s){Object.defineProperty(n,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(n,r,{...s,configurable:!1})}}catch{}};for(let n of[Array,Map,Set,RegExp,Promise])t(n,Symbol.species);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(n,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,n);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(n,Symbol.toStringTag);try{let n=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:n}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let t=this;try{let n=Proxy.revocable;if(typeof n!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(i,o){if(t.shouldBlock()){let a="Proxy.revocable is blocked during script execution",l=t.recordViolation("proxy","Proxy.revocable",a);throw new de(a,l)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),n(i,o)},writable:!1,configurable:!0})}catch(n){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",n instanceof Error?n.message:n)}}protectDynamicImport(){if(!(lr||e.importHooksRegistered))try{let t=this,n=Jn("node:module"),r=new Set;for(let o of n.builtinModules??[]){let a=o.startsWith("node:")?o.slice(5):o;r.add(a);let l=a.indexOf("/");l>0&&r.add(a.slice(0,l))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let a=o.startsWith("node:")?o.slice(5):o;if(!a)return!1;if(typeof n.isBuiltin=="function"&&n.isBuiltin(a)||r.has(a))return!0;let l=a.indexOf("/");return l>0&&r.has(a.slice(0,l))},i=()=>{let o=Ue?.getStore();return t.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!e.isTrustedScopeActive(o.executionId)};if(typeof n.registerHooks=="function"){n.registerHooks({resolve(o,a,l){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let c=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(t.shouldBlock()){let f=t.recordViolation("dynamic_import_builtin",c,u);throw new de(u,f)}i()&&t.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return l(o,a)}}),e.importHooksRegistered=!0;return}if(typeof n.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
|
|
4
|
+
`);n.register(`data:text/javascript,${encodeURIComponent(o)}`),e.importHooksRegistered=!0}}catch(t){console.debug("[DefenseInDepthBox] Could not register import() hooks:",t instanceof Error?t.message:t)}}protectModuleLoad(){if(!lr)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Jn<"u"&&typeof Jn.main<"u"&&(t=Jn.main.constructor),!t||typeof t._load!="function")return;let n=t._load,r=Object.getOwnPropertyDescriptor(t,"_load");this.originalDescriptors.push({target:t,prop:"_load",descriptor:r});let i=this.createBlockingProxy(n,"Module._load","module_load");Object.defineProperty(t,"_load",{value:i,writable:!0,configurable:!0})}catch(t){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",t instanceof Error?t.message:t)}}protectModuleResolveFilename(){if(!lr)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Jn<"u"&&typeof Jn.main<"u"&&(t=Jn.main.constructor),!t||typeof t._resolveFilename!="function")return;let n=t._resolveFilename,r=Object.getOwnPropertyDescriptor(t,"_resolveFilename");this.originalDescriptors.push({target:t,prop:"_resolveFilename",descriptor:r});let i=this.createBlockingProxy(n,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(t,"_resolveFilename",{value:i,writable:!0,configurable:!0})}catch(t){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",t instanceof Error?t.message:t)}}applyPatch(t){let{target:n,prop:r,violationType:s,strategy:i}=t;try{let o=n[r];if(o===void 0)return;let a=Object.getOwnPropertyDescriptor(n,r);if(this.originalDescriptors.push({target:n,prop:r,descriptor:a}),i==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let l=this.getPathForTarget(n,r),c=typeof o=="function"?this.createBlockingProxy(o,l,s):this.createBlockingObjectProxy(o,l,s,t.allowedKeys);Object.defineProperty(n,r,{value:c,writable:!0,configurable:!0})}}catch(o){let a=this.getPathForTarget(n,r);this.patchFailures.push(a),console.debug(`[DefenseInDepthBox] Could not patch ${a}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.originalDescriptors[t];try{s?Object.defineProperty(n,r,s):delete n[r]}catch(i){let o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}}});function s4(e){return typeof e!="function"?e:bt.bindCurrentContext(e)}var n4,r4,fk,pk,$r,ss,Xs=I(()=>{"use strict";cn();n4=globalThis.setTimeout.bind(globalThis),r4=globalThis.clearTimeout.bind(globalThis),fk=globalThis.setInterval.bind(globalThis),pk=globalThis.clearInterval.bind(globalThis);$r=((e,t,...n)=>n4(s4(e),t,...n)),ss=r4});var Vf={};ee(Vf,{echoCommand:()=>o4,flagsForFuzzing:()=>a4});function i4(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"){if(n+1>=e.length){t+="\\";break}let r=e[n+1];switch(r){case"\\":t+="\\",n+=2;break;case"n":t+=`
|
|
5
|
+
`,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"c":return{output:t,stop:!0};case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\0";else{let o=parseInt(s,8)%256;t+=String.fromCharCode(o)}n=i;break}case"x":{let s="",i=n+2;for(;i<e.length&&i<n+4&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\x",n+=2;else{let o=parseInt(s,16);t+=String.fromCharCode(o),n=i}break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\u",n+=2;else{let o=parseInt(s,16);t+=String.fromCodePoint(o),n=i}break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\U",n+=2;else{let o=parseInt(s,16);try{t+=String.fromCodePoint(o)}catch{t+=`\\U${s}`}n=i}break}default:t+=`\\${r}`,n+=2}}else t+=e[n],n++;return{output:t,stop:!1}}var o4,a4,qf=I(()=>{"use strict";o4={name:"echo",async execute(e,t){let n=!1,r=t.xpgEcho??!1,s=0;for(;s<e.length;){let o=e[s];if(o==="-n")n=!0,s++;else if(o==="-e")r=!0,s++;else if(o==="-E")r=!1,s++;else if(o==="-ne"||o==="-en")n=!0,r=!0,s++;else break}let i=e.slice(s).join(" ");if(r){let o=i4(i);if(i=o.output,o.stop)return{stdout:i,stderr:"",exitCode:0}}return n||(i+=`
|
|
6
|
+
`),{stdout:i,stderr:"",exitCode:0}}},a4={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function le(e){let t=e;if(!t)return t;let n=!1;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);if(i>255)return t;i>127&&(n=!0)}if(!n)return t;let r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{return l4.decode(r)}catch{return t}}function un(e){if(!e)return e;let t=c4.encode(e),n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return n}function u4(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}async function fn(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):u4(await e.readFileBuffer(t))}function f4(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function Qa(e){return f4(e)==="bytes"?e.stdout:un(e.stdout)}var l4,c4,Zf,ye=I(()=>{"use strict";l4=new TextDecoder("utf-8",{fatal:!0}),c4=new TextEncoder;Zf=""});function B(e){let t=`${e.name} - ${e.summary}
|
|
7
|
+
|
|
8
|
+
`;if(t+=`Usage: ${e.usage}
|
|
9
|
+
`,e.description){if(t+=`
|
|
10
|
+
Description:
|
|
11
|
+
`,typeof e.description=="string")for(let n of e.description.split(`
|
|
12
|
+
`))t+=n?` ${n}
|
|
13
|
+
`:`
|
|
14
|
+
`;else if(e.description.length>0)for(let n of e.description)t+=n?` ${n}
|
|
15
|
+
`:`
|
|
16
|
+
`}if(e.options&&e.options.length>0){t+=`
|
|
17
|
+
Options:
|
|
18
|
+
`;for(let n of e.options)t+=` ${n}
|
|
19
|
+
`}if(e.examples&&e.examples.length>0){t+=`
|
|
20
|
+
Examples:
|
|
21
|
+
`;for(let n of e.examples)t+=` ${n}
|
|
22
|
+
`}if(e.notes&&e.notes.length>0){t+=`
|
|
23
|
+
Notes:
|
|
24
|
+
`;for(let n of e.notes)t+=` ${n}
|
|
25
|
+
`}return{stdout:t,stderr:"",exitCode:0}}function W(e){return e.includes("--help")}function Q(e,t){return{stdout:"",stderr:t.startsWith("--")?`${e}: unrecognized option '${t}'
|
|
26
|
+
`:`${e}: invalid option -- '${t.replace(/^-/,"")}'
|
|
27
|
+
`,exitCode:1}}var ae=I(()=>{"use strict"});function Ee(e,t,n){let r=new Map,s=new Map;for(let[l,c]of Object.entries(n)){let u={name:l,type:c.type};c.short&&r.set(c.short,u),c.long&&s.set(c.long,u)}let i=Object.create(null);for(let[l,c]of Object.entries(n))c.default!==void 0?i[l]=c.default:c.type==="boolean"&&(i[l]=!1);let o=[],a=!1;for(let l=0;l<t.length;l++){let c=t[l];if(a||!c.startsWith("-")||c==="-"){o.push(c);continue}if(c==="--"){a=!0;continue}if(c.startsWith("--")){let u=c.indexOf("="),f,p;u!==-1?(f=c.slice(2,u),p=c.slice(u+1)):f=c.slice(2);let h=s.get(f);if(!h)return{ok:!1,error:Q(e,c)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!0;else{if(p===void 0){if(l+1>=t.length)return{ok:!1,error:{stdout:"",stderr:`${e}: option '--${f}' requires an argument
|
|
28
|
+
`,exitCode:1}};p=t[++l]}i[d]=m==="number"?parseInt(p,10):p}}else{let u=c.slice(1);for(let f=0;f<u.length;f++){let p=u[f],h=r.get(p);if(!h)return{ok:!1,error:Q(e,`-${p}`)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!0;else{let g;if(f+1<u.length)g=u.slice(f+1);else if(l+1<t.length)g=t[++l];else return{ok:!1,error:{stdout:"",stderr:`${e}: option requires an argument -- '${p}'
|
|
29
|
+
`,exitCode:1}};i[d]=m==="number"?parseInt(g,10):g;break}}}}return{ok:!0,result:{flags:i,positional:o}}}var ct=I(()=>{"use strict";ae()});var is=I(()=>{"use strict"});async function Tr(e,t,n){let{cmdName:r,allowStdinMarker:s=!0,stopOnError:i=!1,batchSize:o=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],l="",c=0;for(let u=0;u<t.length;u+=o){let f=t.slice(u,u+o),p=await Promise.all(f.map(async h=>{if(s&&h==="-")return{filename:"-",content:e.stdin,error:null};try{let d=e.fs.resolvePath(e.cwd,h),m=await fn(e.fs,d);return{filename:h,content:m,error:null}}catch{return{filename:h,content:Zf,error:`${r}: ${h}: No such file or directory
|
|
30
|
+
`}}}));for(let h of p)if(h.error){if(l+=h.error,c=1,i)return{files:a,stderr:l,exitCode:c}}else a.push({filename:h.filename,content:h.content})}return{files:a,stderr:l,exitCode:c}}async function os(e,t,n){let r=await Tr(e,t,{...n,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(i=>i.content).join("")}}var Or=I(()=>{"use strict";ye();is()});var Kf={};ee(Kf,{catCommand:()=>d4,flagsForFuzzing:()=>g4});function m4(e,t){let n=e.split(`
|
|
31
|
+
`),r=e.endsWith(`
|
|
32
|
+
`),s=r?n.slice(0,-1):n;return{content:s.map((o,a)=>`${String(t+a).padStart(6," ")} ${o}`).join(`
|
|
33
|
+
`)+(r?`
|
|
34
|
+
`:""),nextLineNumber:t+s.length}}var p4,h4,d4,g4,Qf=I(()=>{"use strict";ye();ct();Or();ae();p4={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},h4={number:{short:"n",long:"number",type:"boolean"}},d4={name:"cat",async execute(e,t){if(W(e))return B(p4);let n=Ee("cat",e,h4);if(!n.ok)return n.error;let r=n.result.flags.number,s=n.result.positional,i=await Tr(t,s,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",a=1;for(let{content:l}of i.files){let c=l;if(r){let u=m4(c,a);o+=u.content,a=u.nextLineNumber}else o+=c}return{stdout:o,stderr:i.stderr,exitCode:i.exitCode,stdoutEncoding:"binary"}}};g4={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Bi(e){return e instanceof gt||e instanceof kt||e instanceof St}var vt,gt,kt,St,_t,Ot,Ce,De,Nt,Ln,as,K,ls,Mn,pn,Ft,we=I(()=>{"use strict";vt=class extends Error{stdout;stderr;constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr}},gt=class extends vt{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},kt=class extends vt{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},St=class extends vt{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},_t=class extends vt{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},Ot=class extends vt{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
|
|
35
|
+
`),this.varName=t}},Ce=class extends vt{exitCode;name="ExitError";constructor(t,n="",r=""){super("exit",n,r),this.exitCode=t}},De=class extends vt{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
|
|
36
|
+
`,this.fatal=s}},Nt=class extends vt{name="BadSubstitutionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}: bad substitution
|
|
37
|
+
`}},Ln=class extends vt{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
|
|
38
|
+
`}},as=class extends vt{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
|
|
39
|
+
`}},K=class extends vt{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
|
|
40
|
+
`}},ls=class extends vt{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Mn=class extends vt{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}},pn=class extends vt{exitCode;name="BuiltinFatalError";constructor(t,n="",r=""){super("builtin fatal error",n,r),this.exitCode=t}};Ft=class extends vt{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Ke(e){return e instanceof Error?e.message:String(e)}var nn=I(()=>{"use strict"});function Wi(e,t,n){let r=e;n>=0&&r.length>n&&(r=r.slice(0,n));let s=Math.abs(t);return s>r.length&&(t<0?r=r.padEnd(s," "):r=r.padStart(s," ")),r}function Xf(e,t){let n=t,r=0,s=-1,i=!1;for(n<e.length&&e[n]==="-"&&(i=!0,n++);n<e.length&&/\d/.test(e[n]);)r=r*10+parseInt(e[n],10),n++;if(n<e.length&&e[n]===".")for(n++,s=0;n<e.length&&/\d/.test(e[n]);)s=s*10+parseInt(e[n],10),n++;return i&&r>0&&(r=-r),[r,s,n-t]}function zi(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
|
|
41
|
+
`,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}case"x":{let s=[],i=n;for(;i+3<e.length&&e[i]==="\\"&&e[i+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(i+2,i+4));)s.push(parseInt(e.slice(i+2,i+4),16)),i+=4;if(s.length>0){try{let o=new TextDecoder("utf-8",{fatal:!0});t+=o.decode(new Uint8Array(s))}catch{for(let o of s)t+=String.fromCharCode(o)}n=i}else t+=e[n],n++;break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\U",n+=2);break}default:t+=e[n],n++}else t+=e[n],n++;return t}var Xa=I(()=>{"use strict"});function Rr(e,t,n){let r=new Date(t*1e3),s="",i=0;for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let o=e[i+1],a=w4(r,o,n);a!==null?(s+=a,i+=2):(s+=e[i],i++)}else s+=e[i],i++;return s}function y4(e,t){let n={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:t};try{let s=new Intl.DateTimeFormat("en-US",n).formatToParts(e),i=c=>s.find(u=>u.type===c)?.value??"",o=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),a=i("weekday"),l=(c,u)=>{let f=Number.parseInt(c,10);return Number.isNaN(f)?u:f};return{year:l(i("year"),e.getFullYear()),month:l(i("month"),e.getMonth()+1),day:l(i("day"),e.getDate()),hour:l(i("hour"),e.getHours())%24,minute:l(i("minute"),e.getMinutes()),second:l(i("second"),e.getSeconds()),weekday:o.get(a)??e.getDay()}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),weekday:e.getDay()}}}function w4(e,t,n){let r=y4(e,n),s=(l,c=2)=>String(l).padStart(c,"0"),i=e1(r.year,r.month,r.day),o=Yf(r.year,r.month,r.day,r.weekday,0),a=Yf(r.year,r.month,r.day,r.weekday,1);switch(t){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][r.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1]} ${String(r.day).padStart(2," ")} ${s(r.hour)}:${s(r.minute)}:${s(r.second)} ${r.year}`;case"C":return s(Math.floor(r.year/100));case"d":return s(r.day);case"D":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"e":return String(r.day).padStart(2," ");case"F":return`${r.year}-${s(r.month)}-${s(r.day)}`;case"g":return s(Jf(r.year,r.month,r.day)%100);case"G":return String(Jf(r.year,r.month,r.day));case"H":return s(r.hour);case"I":return s(r.hour%12||12);case"j":return String(i).padStart(3,"0");case"k":return String(r.hour).padStart(2," ");case"l":return String(r.hour%12||12).padStart(2," ");case"m":return s(r.month);case"M":return s(r.minute);case"n":return`
|
|
42
|
+
`;case"N":return"000000000";case"p":return r.hour<12?"AM":"PM";case"P":return r.hour<12?"am":"pm";case"r":return`${s(r.hour%12||12)}:${s(r.minute)}:${s(r.second)} ${r.hour<12?"AM":"PM"}`;case"R":return`${s(r.hour)}:${s(r.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return s(r.second);case"t":return" ";case"T":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"u":return String(r.weekday===0?7:r.weekday);case"U":return s(o);case"V":return s(E4(r.year,r.month,r.day));case"w":return String(r.weekday);case"W":return s(a);case"x":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"X":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"y":return s(r.year%100);case"Y":return String(r.year);case"z":return b4(e,n);case"Z":return x4(e,n);case"%":return"%";default:return null}}function b4(e,t){if(!t){let o=-e.getTimezoneOffset(),a=o>=0?"+":"-",l=Math.floor(Math.abs(o)/60),c=Math.abs(o)%60;return`${a}${String(l).padStart(2,"0")}${String(c).padStart(2,"0")}`}try{let l=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(c=>c.type==="timeZoneName");if(l){let c=l.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(c)return`${c[1]}${c[2]}${c[3]}`;if(l.value==="GMT"||l.value==="UTC")return"+0000"}}catch{}let n=-e.getTimezoneOffset(),r=n>=0?"+":"-",s=Math.floor(Math.abs(n)/60),i=Math.abs(n)%60;return`${r}${String(s).padStart(2,"0")}${String(i).padStart(2,"0")}`}function x4(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(i=>i.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function e1(e,t,n){let r=[31,28,31,30,31,30,31,31,30,31,30,31];(e%4===0&&e%100!==0||e%400===0)&&(r[1]=29);let i=n;for(let o=0;o<t-1;o++)i+=r[o];return i}function Yf(e,t,n,r,s){let i=e1(e,t,n),o=new Date(e,0,1).getDay(),a=1+(7+s-o)%7,l=i-a;return l<0?0:Math.floor(l/7)+1}function E4(e,t,n){let r=new Date(e,t-1,n,12,0,0);r.setDate(r.getDate()+3-(r.getDay()+6)%7);let s=new Date(r.getFullYear(),0,4);s.setDate(s.getDate()+3-(s.getDay()+6)%7);let i=r.getTime()-s.getTime();return 1+Math.round(i/(10080*60*1e3))}function Jf(e,t,n){let r=new Date(e,t-1,n,12,0,0);return r.setDate(r.getDate()+3-(r.getDay()+6)%7),r.getFullYear()}var Ya=I(()=>{"use strict"});var n1={};ee(n1,{flagsForFuzzing:()=>D4,printfCommand:()=>C4});import{sprintf as cs}from"sprintf-js";function A4(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=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){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=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){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function v4(e,t,n,r){let s="",i=0,o=0,a=!1,l="";for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let c=i;if(i++,e[i]==="%"){s+="%",i++;continue}let u=e.slice(c).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(u){let A=u[1]?parseInt(u[1],10):0,C=u[2]?parseInt(u[2],10):-1,$=u[3],D=u[0],v=t[n+o]||"";o++;let P;v===""||v==="-1"||v==="-2"?P=Math.floor(Date.now()/1e3):P=parseInt(v,10)||0;let k=Rr($,P,r);if(C>=0&&k.length>C&&(k=k.slice(0,C)),A!==0){let N=Math.abs(A);k.length<N&&(A<0?k=k.padEnd(N," "):k=k.padStart(N," "))}s+=k,i=c+D.length;continue}for(;i<e.length&&"+-0 #'".includes(e[i]);)i++;let f=!1;if(e[i]==="*")f=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;let p=!1;if(e[i]===".")if(i++,e[i]==="*")p=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;i<e.length&&"hlL".includes(e[i])&&i++;let h=e[i]||"";i++;let m=e.slice(c,i);if(f){let A=parseInt(t[n+o]||"0",10);o++,m=m.replace("*",String(A))}if(p){let A=parseInt(t[n+o]||"0",10);o++,m=m.replace(".*",`.${A}`)}let g=t[n+o]||"";o++;let{value:y,parseError:w,parseErrMsg:b,stopped:x}=k4(m,h,g);if(s+=y,w&&(a=!0,b&&(l=b)),x)return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!0}}else s+=e[i],i++;return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!1}}function k4(e,t,n){let r=!1,s="";switch(t){case"d":case"i":{let i=Hi(n);return r=En,r&&(s=`printf: ${n}: invalid number
|
|
43
|
+
`),{value:t1(e,i),parseError:r,parseErrMsg:s}}case"o":{let i=Hi(n);return r=En,r&&(s=`printf: ${n}: invalid number
|
|
44
|
+
`),{value:N4(e,i),parseError:r,parseErrMsg:s}}case"u":{let i=Hi(n);r=En,r&&(s=`printf: ${n}: invalid number
|
|
45
|
+
`);let o=i<0?i>>>0:i;return{value:t1(e.replace("u","d"),o),parseError:r,parseErrMsg:s}}case"x":case"X":{let i=Hi(n);return r=En,r&&(s=`printf: ${n}: invalid number
|
|
46
|
+
`),{value:I4(e,i),parseError:r,parseErrMsg:s}}case"e":case"E":case"f":case"F":case"g":case"G":{let i=parseFloat(n)||0;return{value:R4(e,t,i),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:T4(e,n),parseError:!1,parseErrMsg:""};case"q":return{value:O4(e,n),parseError:!1,parseErrMsg:""};case"b":{let i=P4(n);return{value:i.value,parseError:!1,parseErrMsg:"",stopped:i.stopped}}default:try{return{value:cs(e,n),parseError:!1,parseErrMsg:""}}catch{return{value:"",parseError:!0,parseErrMsg:`printf: [sprintf] unexpected placeholder
|
|
47
|
+
`}}}}function Hi(e){En=!1;let t=e.trimStart(),n=t!==t.trimEnd();if(e=t.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)?(En=!0,0):(n&&(En=!0),r)}if(e.startsWith("0")&&e.length>1&&/^-?0[0-7]+$/.test(e))return n&&(En=!0),parseInt(e,8)||0;if(/^\d+#/.test(e)){En=!0;let r=e.match(/^(\d+)#/);return r?parseInt(r[1],10):0}if(e!==""&&!/^-?\d+$/.test(e)){En=!0;let r=parseInt(e,10);return Number.isNaN(r)?0:r}return n&&(En=!0),parseInt(e,10)||0}function t1(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[diu]$/);if(!n)return cs(e.replace(/\.\d*/,""),t);let r=n[1]||"",s=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=t<0,a=Math.abs(t),l=String(a);i>=0&&(l=l.padStart(i,"0"));let c="";o?c="-":r.includes("+")?c="+":r.includes(" ")&&(c=" ");let u=c+l;return s>u.length&&(r.includes("-")?u=u.padEnd(s," "):r.includes("0")&&i<0?u=c+l.padStart(s-c.length,"0"):u=u.padStart(s," ")),u}function N4(e,t){let n=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?o$/);if(!n)return cs(e,t);let r=n[1]||"",s=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=Math.abs(t).toString(8);i>=0&&(o=o.padStart(i,"0")),r.includes("#")&&!o.startsWith("0")&&(o=`0${o}`);let a=o;return s>a.length&&(r.includes("-")?a=a.padEnd(s," "):r.includes("0")&&i<0?a=a.padStart(s,"0"):a=a.padStart(s," ")),a}function I4(e,t){let n=e.includes("X"),r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[xX]$/);if(!r)return cs(e,t);let s=r[1]||"",i=r[2]?parseInt(r[2],10):0,o=r[3]!==void 0?r[4]?parseInt(r[4],10):0:-1,a=Math.abs(t).toString(16);n&&(a=a.toUpperCase()),o>=0&&(a=a.padStart(o,"0"));let l="";s.includes("#")&&t!==0&&(l=n?"0X":"0x");let c=l+a;return i>c.length&&(s.includes("-")?c=c.padEnd(i," "):s.includes("0")&&o<0?c=l+a.padStart(i-l.length,"0"):c=c.padStart(i," ")),c}function $4(e){if(e==="")return"''";if(/^[a-zA-Z0-9_./-]+$/.test(e))return e;if(/[\x00-\x1f\x7f-\xff]/.test(e)){let r="$'";for(let s of e){let i=s.charCodeAt(0);s==="'"?r+="\\'":s==="\\"?r+="\\\\":s===`
|
|
48
|
+
`?r+="\\n":s===" "?r+="\\t":s==="\r"?r+="\\r":s==="\x07"?r+="\\a":s==="\b"?r+="\\b":s==="\f"?r+="\\f":s==="\v"?r+="\\v":s==="\x1B"?r+="\\E":i<32||i>=127&&i<=255?r+=`\\${i.toString(8).padStart(3,"0")}`:s==='"'?r+='\\"':r+=s}return r+="'",r}let n="";for(let r of e)" |&;<>()$`\\\"'*?[#~=%!{}".includes(r)?n+=`\\${r}`:n+=r;return n}function T4(e,t){let n=e.match(/^%(-?)(\d*)(\.(\d*))?s$/);if(!n)return cs(e.replace(/0+(?=\d)/,""),t);let r=n[1]==="-",s=n[2]?parseInt(n[2],10):0,i=n[3]!==void 0?n[4]?parseInt(n[4],10):0:-1,o=r?-s:s;return Wi(t,o,i)}function O4(e,t){let n=$4(t),r=e.match(/^%(-?)(\d*)q$/);if(!r)return n;let s=r[1]==="-",i=r[2]?parseInt(r[2],10):0,o=n;return i>o.length&&(s?o=o.padEnd(i," "):o=o.padStart(i," ")),o}function R4(e,t,n){let r=e.match(/^%([- +#0']*)(\d*)(\.(\d*))?[eEfFgG]$/);if(!r)return cs(e,n);let s=r[1]||"",i=r[2]?parseInt(r[2],10):0,o=r[3]!==void 0?r[4]?parseInt(r[4],10):0:6,a,l=t.toLowerCase();if(l==="e"?(a=n.toExponential(o),a=a.replace(/e([+-])(\d)$/,"e$10$2"),t==="E"&&(a=a.toUpperCase())):l==="f"?(a=n.toFixed(o),s.includes("#")&&o===0&&!a.includes(".")&&(a+=".")):l==="g"?(a=n.toPrecision(o||1),s.includes("#")||(a=a.replace(/\.?0+$/,""),a=a.replace(/\.?0+e/,"e")),a=a.replace(/e([+-])(\d)$/,"e$10$2"),t==="G"&&(a=a.toUpperCase())):a=n.toString(),n>=0&&(s.includes("+")?a=`+${a}`:s.includes(" ")&&(a=` ${a}`)),i>a.length)if(s.includes("-"))a=a.padEnd(i," ");else if(s.includes("0")){let c=a.match(/^[+ -]/)?.[0]||"",u=c?a.slice(1):a;a=c+u.padStart(i-c.length,"0")}else a=a.padStart(i," ");return a}function P4(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
|
|
49
|
+
`,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"c":return{value:t,stopped:!0};case"x":{let s=[],i=n;for(;i+1<e.length&&e[i]==="\\"&&e[i+1]==="x";){let o="",a=i+2;for(;a<e.length&&a<i+4&&/[0-9a-fA-F]/.test(e[a]);)o+=e[a],a++;if(o)s.push(parseInt(o,16)),i=a;else break}s.length>0?(t+=A4(s),n=i):(t+="\\x",n+=2);break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);break}case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;s?t+=String.fromCharCode(parseInt(s,8)):t+="\0",n=i;break}case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}default:t+=e[n],n++}else t+=e[n],n++;return{value:t,stopped:!1}}var S4,C4,En,D4,r1=I(()=>{"use strict";we();nn();ae();Xa();Ya();S4={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)"]},C4={name:"printf",async execute(e,t){if(W(e))return B(S4);if(e.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
50
|
+
`,exitCode:2};let n=null,r=0;for(;r<e.length;){let o=e[r];if(o==="--"){r++;break}if(o==="-v"){if(r+1>=e.length)return{stdout:"",stderr:`printf: -v: option requires an argument
|
|
51
|
+
`,exitCode:1};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(n))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
|
|
52
|
+
`,exitCode:2};r+=2}else{if(o.startsWith("-")&&o!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
|
|
53
|
+
`,exitCode:1};let s=e[r],i=e.slice(r+1);try{let o=zi(s),a="",l=0,c=!1,u="",f=t.env.get("TZ"),p=t.limits?.maxStringLength;do{let{result:h,argsConsumed:d,error:m,errMsg:g,stopped:y}=v4(o,i,l,f);if(a+=h,p!==void 0&&p>0&&a.length>p)throw new K(`printf: output size limit exceeded (${p} bytes)`,"string_length");if(l+=d,m&&(c=!0,g&&(u=g)),y)break}while(l<i.length&&l>0);if(l===0&&i.length>0,n){let h=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let d=h[1],m=h[3];m=m.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(g,y)=>t.env.get(y)??""),t.env.set(`${d}_${m}`,a)}else t.env.set(n,a);return{stdout:"",stderr:u,exitCode:c?1:0}}return{stdout:a,stderr:u,exitCode:c?1:0}}catch(o){if(o instanceof K)throw o;return{stdout:"",stderr:`printf: ${Ke(o)}
|
|
54
|
+
`,exitCode:1}}}};En=!1;D4={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});var o1={};ee(o1,{flagsForFuzzing:()=>U4,lsCommand:()=>L4});import{minimatch as s1}from"minimatch";function ji(e){if(e<1024)return String(e);if(e<1024*1024){let n=e/1024;return n<10?`${n.toFixed(1)}K`:`${Math.round(n)}K`}if(e<1024*1024*1024){let n=e/1048576;return n<10?`${n.toFixed(1)}M`:`${Math.round(n)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function Gi(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),s=new Date,i=new Date(s.getTime()-4320*60*60*1e3);if(e>i){let a=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${n} ${r} ${a}:${l}`}let o=e.getFullYear();return`${n} ${r} ${o}`}function Pr(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}async function M4(e,t,n,r,s,i=!1,o=!1,a=!1,l=!1){let c=n||r,u=t.fs.getAllPaths(),f=t.fs.resolvePath(t.cwd,"."),p=[];for(let h of u){let d=h.startsWith(f)&&h.slice(f.length+1)||h;if(s1(d,e)||s1(h,e)){let m=d.split("/").pop()||d;if(!c&&m.startsWith("."))continue;p.push(d||h)}}if(p.length===0)return{stdout:"",stderr:`ls: ${e}: No such file or directory
|
|
55
|
+
`,exitCode:2};if(a){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.stat(m);h.push({path:d,size:g.size??0})}catch{h.push({path:d,size:0})}}h.sort((d,m)=>m.size-d.size),p.length=0,p.push(...h.map(d=>d.path))}else p.sort();if(i&&p.reverse(),s){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.stat(m),y=g.isDirectory?"drwxr-xr-x":"-rw-r--r--",w=l?Pr(await t.fs.lstat(m)):g.isDirectory?"/":"",b=g.size??0,x=o?ji(b).padStart(5):String(b).padStart(5),A=g.mtime??new Date(0),C=Gi(A);h.push(`${y} 1 user user ${x} ${C} ${d}${w}`)}catch{h.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${d}`)}}return{stdout:`${h.join(`
|
|
56
|
+
`)}
|
|
57
|
+
`,stderr:"",exitCode:0}}if(l){let h=[];for(let d of p){let m=t.fs.resolvePath(t.cwd,d);try{let g=await t.fs.lstat(m);h.push(`${d}${Pr(g)}`)}catch{h.push(d)}}return{stdout:`${h.join(`
|
|
58
|
+
`)}
|
|
59
|
+
`,stderr:"",exitCode:0}}return{stdout:`${p.join(`
|
|
60
|
+
`)}
|
|
61
|
+
`,stderr:"",exitCode:0}}async function i1(e,t,n,r,s,i,o,a=!1,l=!1,c=!1,u=!1,f=!1){let p=n||r,h=t.fs.resolvePath(t.cwd,e);try{let d=await t.fs.stat(h);if(!d.isDirectory){let y=u?Pr(await t.fs.lstat(h)):"";if(s){let w=d.size??0,b=l?ji(w).padStart(5):String(w).padStart(5),x=d.mtime??new Date(0),A=Gi(x);return{stdout:`-rw-r--r-- 1 user user ${b} ${A} ${e}${y}
|
|
62
|
+
`,stderr:"",exitCode:0}}return{stdout:`${e}${y}
|
|
63
|
+
`,stderr:"",exitCode:0}}let m=await t.fs.readdir(h);if(p||(m=m.filter(y=>!y.startsWith("."))),c){let y=[];for(let w of m){let b=h==="/"?`/${w}`:`${h}/${w}`;try{let x=await t.fs.stat(b);y.push({name:w,size:x.size??0})}catch{y.push({name:w,size:0})}}y.sort((w,b)=>b.size-w.size),m=y.map(w=>w.name)}else m.sort();n&&(m=[".","..",...m]),a&&m.reverse();let g="";if((i||o)&&(g+=`${e}:
|
|
64
|
+
`),s){g+=`total ${m.length}
|
|
65
|
+
`;let y=m.filter(A=>A==="."||A===".."),w=m.filter(A=>A!=="."&&A!=="..");for(let A of y)g+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${A}
|
|
66
|
+
`;let b=[];for(let A=0;A<w.length;A+=100){let C=w.slice(A,A+100),$=await Promise.all(C.map(async D=>{let v=h==="/"?`/${D}`:`${h}/${D}`;try{let P=await t.fs.stat(v),k=P.isDirectory?"drwxr-xr-x":"-rw-r--r--",N=u?Pr(await t.fs.lstat(v)):P.isDirectory?"/":"",R=P.size??0,O=l?ji(R).padStart(5):String(R).padStart(5),_=P.mtime??new Date(0),M=Gi(_);return{name:D,line:`${k} 1 user user ${O} ${M} ${D}${N}
|
|
67
|
+
`}}catch{return{name:D,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${D}
|
|
68
|
+
`}}}));b.push(...$)}let x=new Map(w.map((A,C)=>[A,C]));b.sort((A,C)=>(x.get(A.name)??0)-(x.get(C.name)??0));for(let{line:A}of b)g+=A}else if(u){let y=[],w=m.filter(x=>x!=="."&&x!==".."),b=m.filter(x=>x==="."||x==="..");for(let x of b)y.push(`${x}/`);for(let x=0;x<w.length;x+=100){let A=w.slice(x,x+100),C=await Promise.all(A.map(async $=>{let D=h==="/"?`/${$}`:`${h}/${$}`;try{let v=await t.fs.lstat(D);return`${$}${Pr(v)}`}catch{return $}}));y.push(...C)}g+=y.join(`
|
|
69
|
+
`)+(y.length?`
|
|
70
|
+
`:"")}else g+=m.join(`
|
|
71
|
+
`)+(m.length?`
|
|
72
|
+
`:"");if(i){let y=m.filter(x=>x!=="."&&x!==".."),w=[];if(t.fs.readdirWithFileTypes)w=(await t.fs.readdirWithFileTypes(h)).filter(A=>A.isDirectory&&y.includes(A.name)).map(A=>({name:A.name,isDirectory:!0}));else for(let x=0;x<y.length;x+=100){let A=y.slice(x,x+100),C=await Promise.all(A.map(async $=>{let D=h==="/"?`/${$}`:`${h}/${$}`;try{let v=await t.fs.stat(D);return{name:$,isDirectory:v.isDirectory}}catch{return{name:$,isDirectory:!1}}}));w.push(...C.filter($=>$.isDirectory))}w.sort((x,A)=>x.name.localeCompare(A.name)),a&&w.reverse();let b=[];for(let x=0;x<w.length;x+=100){let A=w.slice(x,x+100),C=await Promise.all(A.map(async $=>{let D=e==="."?`./${$.name}`:`${e}/${$.name}`,v=await i1(D,t,n,r,s,i,!1,a,l,c,u,!0);return{name:$.name,result:v}}));b.push(...C)}b.sort((x,A)=>x.name.localeCompare(A.name)),a&&b.reverse();for(let{result:x}of b)g+=`
|
|
73
|
+
`,g+=x.stdout}return{stdout:g,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${e}: No such file or directory
|
|
74
|
+
`,exitCode:2}}}var _4,F4,L4,U4,a1=I(()=>{"use strict";ct();is();ae();_4={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},F4={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},L4={name:"ls",async execute(e,t){if(W(e))return B(_4);let n=Ee("ls",e,F4);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.showAlmostAll,i=n.result.flags.longFormat,o=n.result.flags.humanReadable,a=n.result.flags.recursive,l=n.result.flags.reverse,c=n.result.flags.sortBySize,u=n.result.flags.classifyFiles,f=n.result.flags.directoryOnly,p=n.result.flags.sortByTime;n.result.flags.onePerLine;let h=n.result.positional;h.length===0&&h.push(".");let d="",m="",g=0;for(let y=0;y<h.length;y++){let w=h[y];if(y>0&&d&&!d.endsWith(`
|
|
75
|
+
|
|
76
|
+
`)&&(d+=`
|
|
77
|
+
`),f){let b=t.fs.resolvePath(t.cwd,w);try{let x=await t.fs.stat(b);if(i){let A=x.isDirectory?"drwxr-xr-x":"-rw-r--r--",C=u?Pr(await t.fs.lstat(b)):x.isDirectory?"/":"",$=x.size??0,D=o?ji($).padStart(5):String($).padStart(5),v=x.mtime??new Date(0),P=Gi(v);d+=`${A} 1 user user ${D} ${P} ${w}${C}
|
|
78
|
+
`}else{let A=u?Pr(await t.fs.lstat(b)):"";d+=`${w}${A}
|
|
79
|
+
`}}catch{m+=`ls: cannot access '${w}': No such file or directory
|
|
80
|
+
`,g=2}continue}if(w.includes("*")||w.includes("?")||w.includes("[")){let b=await M4(w,t,r,s,i,l,o,c,u);d+=b.stdout,m+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}else{let b=await i1(w,t,r,s,i,a,h.length>1,l,o,c,u);d+=b.stdout,m+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}}return{stdout:d,stderr:m,exitCode:g}}};U4={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0}});function B4(e,t,n){if(!e)return e;let r=e.replace(/\n\s+at\s.*/g,"");return n&&(r=r.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),r=r.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),r=r.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),r=r.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),n&&(r=r.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),r}function ze(e){return B4(e,!1,!1)}var An=I(()=>{"use strict"});var l1={};ee(l1,{flagsForFuzzing:()=>H4,mkdirCommand:()=>z4});var W4,z4,H4,c1=I(()=>{"use strict";An();nn();ct();W4={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},z4={name:"mkdir",async execute(e,t){let n=Ee("mkdir",e,W4);if(!n.ok)return n.error;let r=n.result.flags.recursive,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
81
|
+
`,exitCode:1};let o="",a="",l=0;for(let c of i)try{let u=t.fs.resolvePath(t.cwd,c);await t.fs.mkdir(u,{recursive:r}),s&&(o+=`mkdir: created directory '${c}'
|
|
82
|
+
`)}catch(u){let f=Ke(u);f.includes("ENOENT")||f.includes("no such file")?a+=`mkdir: cannot create directory '${c}': No such file or directory
|
|
83
|
+
`:f.includes("EEXIST")||f.includes("already exists")?a+=`mkdir: cannot create directory '${c}': File exists
|
|
84
|
+
`:a+=`mkdir: cannot create directory '${c}': ${ze(f)}
|
|
85
|
+
`,l=1}return{stdout:o,stderr:a,exitCode:l}}},H4={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var p1={};ee(p1,{flagsForFuzzing:()=>Z4,rmdirCommand:()=>V4});async function q4(e,t,n,r){let s="",i="",a=e.fs.resolvePath(e.cwd,t),l=await u1(e,a,t,r);if(s+=l.stdout,i+=l.stderr,l.exitCode!==0)return{stdout:s,stderr:i,exitCode:l.exitCode};if(n){let c=a,u=t;for(;;){let f=f1(c),p=f1(u);if(f===c||f==="/"||f==="."||p==="."||p==="")break;let h=await u1(e,f,p,r);if(s+=h.stdout,h.exitCode!==0)break;c=f,u=p}}return{stdout:s,stderr:i,exitCode:0}}async function u1(e,t,n,r){try{if(!await e.fs.exists(t))return{stdout:"",stderr:`rmdir: failed to remove '${n}': No such file or directory
|
|
86
|
+
`,exitCode:1};if(!(await e.fs.stat(t)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Not a directory
|
|
87
|
+
`,exitCode:1};if((await e.fs.readdir(t)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Directory not empty
|
|
88
|
+
`,exitCode:1};await e.fs.rm(t,{recursive:!1,force:!1});let a="";return r&&(a=`rmdir: removing directory, '${n}'
|
|
89
|
+
`),{stdout:a,stderr:"",exitCode:0}}catch(s){let i=Ke(s);return{stdout:"",stderr:`rmdir: failed to remove '${n}': ${i}
|
|
90
|
+
`,exitCode:1}}}function f1(e){let t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?".":n===0?"/":t.substring(0,n)}var j4,G4,V4,Z4,h1=I(()=>{"use strict";nn();ct();j4=`Usage: rmdir [-pv] DIRECTORY...
|
|
91
|
+
Remove empty directories.
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
-p, --parents Remove DIRECTORY and its ancestors
|
|
95
|
+
-v, --verbose Output a diagnostic for every directory processed`,G4={parents:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},help:{long:"help",type:"boolean"}},V4={name:"rmdir",async execute(e,t){let n=Ee("rmdir",e,G4);if(!n.ok)return n.error;if(n.result.flags.help)return{stdout:`${j4}
|
|
96
|
+
`,stderr:"",exitCode:0};let r=n.result.flags.parents,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`rmdir: missing operand
|
|
97
|
+
`,exitCode:1};let o="",a="",l=0;for(let c of i){let u=await q4(t,c,r,s);o+=u.stdout,a+=u.stderr,u.exitCode!==0&&(l=u.exitCode)}return{stdout:o,stderr:a,exitCode:l}}};Z4={name:"rmdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var d1={};ee(d1,{flagsForFuzzing:()=>X4,touchCommand:()=>Q4});function K4(e){let t=e.replace(/\//g,"-"),n=new Date(t);if(!Number.isNaN(n.getTime()))return n;let r=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(r){let[,i,o,a]=r;if(n=new Date(Number.parseInt(i,10),Number.parseInt(o,10)-1,Number.parseInt(a,10)),!Number.isNaN(n.getTime()))return n}let s=t.match(/^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/);if(s){let[,i,o,a,l,c,u]=s;if(n=new Date(Number.parseInt(i,10),Number.parseInt(o,10)-1,Number.parseInt(a,10),Number.parseInt(l,10),Number.parseInt(c,10),Number.parseInt(u,10)),!Number.isNaN(n.getTime()))return n}return null}var Q4,X4,m1=I(()=>{"use strict";nn();ae();Q4={name:"touch",async execute(e,t){let n=[],r=null,s=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c==="--"){n.push(...e.slice(l+1));break}else if(c==="-d"||c==="--date"){if(l+1>=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd'
|
|
98
|
+
`,exitCode:1};r=e[++l]}else if(c.startsWith("--date="))r=c.slice(7);else if(c==="-c"||c==="--no-create")s=!0;else if(c==="-a"||c==="-m"||c==="-r"||c==="-t")(c==="-r"||c==="-t")&&l++;else{if(c.startsWith("--"))return Q("touch",c);if(c.startsWith("-")&&c.length>1){let u=!1;for(let f of c.slice(1))if(f==="c")s=!0;else if(!(f==="a"||f==="m"))if(f==="d"){if(l+1>=e.length)return{stdout:"",stderr:`touch: option requires an argument -- 'd'
|
|
99
|
+
`,exitCode:1};r=e[++l],u=!0;break}else if(f==="r"||f==="t"){l++,u=!0;break}else return Q("touch",`-${f}`);if(u)continue}else n.push(c)}}if(n.length===0)return{stdout:"",stderr:`touch: missing file operand
|
|
100
|
+
`,exitCode:1};let i=null;if(r!==null&&(i=K4(r),i===null))return{stdout:"",stderr:`touch: invalid date format '${r}'
|
|
101
|
+
`,exitCode:1};let o="",a=0;for(let l of n)try{let c=t.fs.resolvePath(t.cwd,l);if(!await t.fs.exists(c)){if(s)continue;await t.fs.writeFile(c,"")}let f=i??new Date;await t.fs.utimes(c,f,f)}catch(c){o+=`touch: cannot touch '${l}': ${Ke(c)}
|
|
102
|
+
`,a=1}return{stdout:"",stderr:o,exitCode:a}}},X4={name:"touch",flags:[{flag:"-c",type:"boolean"},{flag:"-a",type:"boolean"},{flag:"-m",type:"boolean"},{flag:"-d",type:"value",valueHint:"string"}],needsArgs:!0}});var g1={};ee(g1,{flagsForFuzzing:()=>e3,rmCommand:()=>J4});var Y4,J4,e3,y1=I(()=>{"use strict";An();nn();ct();Y4={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},J4={name:"rm",async execute(e,t){let n=Ee("rm",e,Y4);if(!n.ok)return n.error;let r=n.result.flags.recursive||n.result.flags.recursiveUpper,s=n.result.flags.force,i=n.result.flags.verbose,o=n.result.positional;if(o.length===0)return s?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
103
|
+
`,exitCode:1};let a="",l="",c=0;for(let u of o)try{let f=t.fs.resolvePath(t.cwd,u);if((await t.fs.stat(f)).isDirectory&&!r){l+=`rm: cannot remove '${u}': Is a directory
|
|
104
|
+
`,c=1;continue}await t.fs.rm(f,{recursive:r,force:s}),i&&(a+=`removed '${u}'
|
|
105
|
+
`)}catch(f){if(!s){let p=Ke(f);p.includes("ENOENT")||p.includes("no such file")?l+=`rm: cannot remove '${u}': No such file or directory
|
|
106
|
+
`:p.includes("ENOTEMPTY")||p.includes("not empty")?l+=`rm: cannot remove '${u}': Directory not empty
|
|
107
|
+
`:l+=`rm: cannot remove '${u}': ${ze(p)}
|
|
108
|
+
`,c=1}}return{stdout:a,stderr:l,exitCode:c}}},e3={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var w1={};ee(w1,{cpCommand:()=>r3,flagsForFuzzing:()=>s3});var t3,n3,r3,s3,b1=I(()=>{"use strict";nn();ct();ae();t3={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},n3={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},r3={name:"cp",async execute(e,t){if(W(e))return B(t3);let n=Ee("cp",e,n3);if(!n.ok)return n.error;let r=n.result.flags.recursive||n.result.flags.recursiveUpper,s=n.result.flags.noClobber,i=n.result.flags.preserve,o=n.result.flags.verbose,a=n.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
109
|
+
`,exitCode:1};let l=a.pop()??"",c=a,u=t.fs.resolvePath(t.cwd,l),f="",p="",h=0,d=!1;try{d=(await t.fs.stat(u)).isDirectory}catch{}if(c.length>1&&!d)return{stdout:"",stderr:`cp: target '${l}' is not a directory
|
|
110
|
+
`,exitCode:1};for(let m of c)try{let g=t.fs.resolvePath(t.cwd,m),y=await t.fs.stat(g),w=u;if(d){let b=m.split("/").pop()||m;w=u==="/"?`/${b}`:`${u}/${b}`}if(y.isDirectory&&!r){p+=`cp: -r not specified; omitting directory '${m}'
|
|
111
|
+
`,h=1;continue}if(s)try{await t.fs.stat(w);continue}catch{}await t.fs.cp(g,w,{recursive:r}),o&&(f+=`'${m}' -> '${w}'
|
|
112
|
+
`)}catch(g){let y=Ke(g);y.includes("ENOENT")||y.includes("no such file")?p+=`cp: cannot stat '${m}': No such file or directory
|
|
113
|
+
`:p+=`cp: cannot copy '${m}': ${y}
|
|
114
|
+
`,h=1}return{stdout:f,stderr:p,exitCode:h}}},s3={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var x1={};ee(x1,{flagsForFuzzing:()=>l3,mvCommand:()=>a3});var i3,o3,a3,l3,E1=I(()=>{"use strict";nn();ct();ae();i3={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},o3={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},a3={name:"mv",async execute(e,t){if(W(e))return B(i3);let n=Ee("mv",e,o3);if(!n.ok)return n.error;let r=n.result.flags.force,s=n.result.flags.noClobber,i=n.result.flags.verbose,o=n.result.positional;if(s&&(r=!1),o.length<2)return{stdout:"",stderr:`mv: missing destination file operand
|
|
115
|
+
`,exitCode:1};let a=o.pop()??"",l=o,c=t.fs.resolvePath(t.cwd,a),u="",f="",p=0,h=!1;try{h=(await t.fs.stat(c)).isDirectory}catch{}if(l.length>1&&!h)return{stdout:"",stderr:`mv: target '${a}' is not a directory
|
|
116
|
+
`,exitCode:1};for(let d of l)try{let m=t.fs.resolvePath(t.cwd,d),g=c;if(h){let y=d.split("/").pop()||d;g=c==="/"?`/${y}`:`${c}/${y}`}if(s)try{await t.fs.stat(g);continue}catch{}if(await t.fs.mv(m,g),i){let y=h?`${a}/${d.split("/").pop()||d}`:a;u+=`renamed '${d}' -> '${y}'
|
|
117
|
+
`}}catch(m){let g=Ke(m);g.includes("ENOENT")||g.includes("no such file")?f+=`mv: cannot stat '${d}': No such file or directory
|
|
118
|
+
`:f+=`mv: cannot move '${d}': ${g}
|
|
119
|
+
`,p=1}return{stdout:u,stderr:f,exitCode:p}}},l3={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var A1={};ee(A1,{flagsForFuzzing:()=>f3,lnCommand:()=>u3});var c3,u3,f3,S1=I(()=>{"use strict";An();ae();c3={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},u3={name:"ln",async execute(e,t){if(W(e))return B(c3);let n=!1,r=!1,s=!1,i=0;for(;i<e.length&&e[i].startsWith("-");){let f=e[i];if(f==="-s"||f==="--symbolic")n=!0,i++;else if(f==="-f"||f==="--force")r=!0,i++;else if(f==="-v"||f==="--verbose")s=!0,i++;else if(f==="-n"||f==="--no-dereference")i++;else if(/^-[sfvn]+$/.test(f))f.includes("s")&&(n=!0),f.includes("f")&&(r=!0),f.includes("v")&&(s=!0),i++;else if(f==="--"){i++;break}else return Q("ln",f)}let o=e.slice(i);if(o.length<2)return{stdout:"",stderr:`ln: missing file operand
|
|
120
|
+
`,exitCode:1};let a=o[0],l=o[1],c=t.fs.resolvePath(t.cwd,l);if(await t.fs.exists(c))if(r)try{await t.fs.rm(c,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${l}': Permission denied
|
|
121
|
+
`,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${n?"symbolic ":""}link '${l}': File exists
|
|
122
|
+
`,exitCode:1};try{if(n)await t.fs.symlink(a,c);else{let f=t.fs.resolvePath(t.cwd,a);if(!await t.fs.exists(f))return{stdout:"",stderr:`ln: failed to access '${a}': No such file or directory
|
|
123
|
+
`,exitCode:1};await t.fs.link(f,c)}}catch(f){let p=f;return p.message.includes("EPERM")?{stdout:"",stderr:`ln: '${a}': hard link not allowed for directory
|
|
124
|
+
`,exitCode:1}:{stdout:"",stderr:`ln: ${ze(p.message)}
|
|
125
|
+
`,exitCode:1}}let u="";return s&&(u=`'${l}' -> '${a}'
|
|
126
|
+
`),{stdout:u,stderr:"",exitCode:0}}},f3={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var v1={};ee(v1,{chmodCommand:()=>h3,flagsForFuzzing:()=>d3});async function C1(e,t,n,r,s){let i="",o=await e.fs.readdir(t);for(let a of o){let l=t==="/"?`/${a}`:`${t}/${a}`,c;if(n!==void 0)c=n;else if(r!==void 0){let f=await e.fs.stat(l);c=Ja(r,f.mode)}else c=420;await e.fs.chmod(l,c),s&&(i+=`mode of '${l}' changed to ${c.toString(8).padStart(4,"0")}
|
|
127
|
+
`),(await e.fs.stat(l)).isDirectory&&(i+=await C1(e,l,n,r,s))}return i}function Ja(e,t=420){if(/^[0-7]+$/.test(e))return parseInt(e,8);let n=t&4095,r=e.split(",");for(let s of r){let i=s.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!i)throw new Error(`Invalid mode: ${e}`);let o=i[1]||"a",a=i[2],l=i[3];(o==="a"||o==="")&&(o="ugo");let c=0;l.includes("r")&&(c|=4),l.includes("w")&&(c|=2),(l.includes("x")||l.includes("X"))&&(c|=1);let u=0;l.includes("s")&&(o.includes("u")&&(u|=2048),o.includes("g")&&(u|=1024)),l.includes("t")&&(u|=512);for(let f of o){let p=0;f==="u"?p=6:f==="g"?p=3:f==="o"&&(p=0);let h=c<<p;a==="+"?n|=h:a==="-"?n&=~h:a==="="&&(n&=~(7<<p),n|=h)}a==="+"?n|=u:a==="-"?n&=~u:a==="="&&(l.includes("s")&&(o.includes("u")&&(n&=-2049,n|=u&2048),o.includes("g")&&(n&=-1025,n|=u&1024)),l.includes("t")&&(n&=-513,n|=u&512))}return n}var p3,h3,d3,k1=I(()=>{"use strict";ae();p3={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"]},h3={name:"chmod",async execute(e,t){if(W(e))return B(p3);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
|
|
128
|
+
`,exitCode:1};let n=!1,r=!1,s=0;for(;s<e.length&&e[s].startsWith("-");){let p=e[s];if(p==="-R"||p==="--recursive")n=!0,s++;else if(p==="-v"||p==="--verbose")r=!0,s++;else if(p==="--"){s++;break}else{if(/^[+-]?[rwxugo]+/.test(p)||/^\d+$/.test(p))break;if(/^-[Rv]+$/.test(p)){p.includes("R")&&(n=!0),p.includes("v")&&(r=!0),s++;continue}return Q("chmod",p)}}if(e.length-s<2)return{stdout:"",stderr:`chmod: missing operand
|
|
129
|
+
`,exitCode:1};let i=e[s],o=e.slice(s+1),a=/^[0-7]+$/.test(i),l;if(a)l=parseInt(i,8);else try{Ja(i,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${i}'
|
|
130
|
+
`,exitCode:1}}let c="",u="",f=!1;for(let p of o){let h=t.fs.resolvePath(t.cwd,p);try{let d;if(a&&l!==void 0)d=l;else{let m=await t.fs.stat(h);d=Ja(i,m.mode)}if(await t.fs.chmod(h,d),r&&(c+=`mode of '${p}' changed to ${d.toString(8).padStart(4,"0")}
|
|
131
|
+
`),n&&(await t.fs.stat(h)).isDirectory){let g=await C1(t,h,a?l:void 0,a?void 0:i,r);c+=g}}catch{u+=`chmod: cannot access '${p}': No such file or directory
|
|
132
|
+
`,f=!0}}return{stdout:c,stderr:u,exitCode:f?1:0}}};d3={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var N1={};ee(N1,{flagsForFuzzing:()=>g3,pwdCommand:()=>m3});var m3,g3,I1=I(()=>{"use strict";m3={name:"pwd",async execute(e,t){let n=!1;for(let s of e)if(s==="-P")n=!0;else if(s==="-L")n=!1;else{if(s==="--")break;s.startsWith("-")}let r=t.cwd;if(n)try{r=await t.fs.realpath(t.cwd)}catch{}return{stdout:`${r}
|
|
133
|
+
`,stderr:"",exitCode:0}}},g3={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]}});var $1={};ee($1,{flagsForFuzzing:()=>b3,readlinkCommand:()=>w3});var y3,w3,b3,T1=I(()=>{"use strict";ae();y3={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},w3={name:"readlink",async execute(e,t){if(W(e))return B(y3);let n=!1,r=0;for(;r<e.length&&e[r].startsWith("-");){let a=e[r];if(a==="-f"||a==="--canonicalize")n=!0,r++;else if(a==="--"){r++;break}else return Q("readlink",a)}let s=e.slice(r);if(s.length===0)return{stdout:"",stderr:`readlink: missing operand
|
|
134
|
+
`,exitCode:1};let i="",o=!1;for(let a of s){let l=t.fs.resolvePath(t.cwd,a);try{if(n){let c=l,u=new Set;for(;!u.has(c);){u.add(c);try{let f=await t.fs.readlink(c);if(f.startsWith("/"))c=f;else{let p=c.substring(0,c.lastIndexOf("/"))||"/";c=t.fs.resolvePath(p,f)}}catch{break}}i+=`${c}
|
|
135
|
+
`}else{let c=await t.fs.readlink(l);i+=`${c}
|
|
136
|
+
`}}catch{n?i+=`${l}
|
|
137
|
+
`:o=!0}}return{stdout:i,stderr:"",exitCode:o?1:0}}},b3={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0}});function Vi(e,t){let n=10,r=null,s=!1,i=!1,o=!1,a=[];for(let l=0;l<e.length;l++){let c=e[l];if(c==="-n"&&l+1<e.length){let u=e[++l];t==="tail"&&u.startsWith("+")?(o=!0,n=parseInt(u.slice(1),10)):n=parseInt(u,10)}else if(t==="tail"&&c.startsWith("-n+"))o=!0,n=parseInt(c.slice(3),10);else if(c.startsWith("-n"))n=parseInt(c.slice(2),10);else if(c==="-c"&&l+1<e.length)r=parseInt(e[++l],10);else if(c.startsWith("-c"))r=parseInt(c.slice(2),10);else if(c.startsWith("--bytes="))r=parseInt(c.slice(8),10);else if(c.startsWith("--lines="))n=parseInt(c.slice(8),10);else if(c==="-q"||c==="--quiet"||c==="--silent")s=!0;else if(c==="-v"||c==="--verbose")i=!0;else if(c.match(/^-\d+$/))n=parseInt(c.slice(1),10);else{if(c.startsWith("--"))return{ok:!1,error:Q(t,c)};if(c.startsWith("-")&&c!=="-")return{ok:!1,error:Q(t,c)};a.push(c)}}return r!==null&&(Number.isNaN(r)||r<0)?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of bytes
|
|
138
|
+
`,exitCode:1}}:Number.isNaN(n)||n<0?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of lines
|
|
139
|
+
`,exitCode:1}}:{ok:!0,options:{lines:n,bytes:r,quiet:s,verbose:i,files:a,fromLine:o}}}async function qi(e,t,n,r){let{quiet:s,verbose:i,files:o}=t;if(o.length===0)return{stdout:r(e.stdin),stderr:"",exitCode:0,stdoutEncoding:"binary"};let a="",l="",c=0,u=i||!s&&o.length>1,f=0;for(let p=0;p<o.length;p++){let h=o[p];try{let d=e.fs.resolvePath(e.cwd,h),m=await fn(e.fs,d);u&&(f>0&&(a+=`
|
|
140
|
+
`),a+=un(`==> ${h} <==
|
|
141
|
+
`)),a+=r(m),f++}catch{l+=`${n}: ${h}: No such file or directory
|
|
142
|
+
`,c=1}}return{stdout:a,stderr:l,exitCode:c,stdoutEncoding:"binary"}}function O1(e,t,n){if(n!==null)return e.slice(0,n);if(t===0)return"";let r=0,s=0,i=e.length;for(;r<i&&s<t;){let o=e.indexOf(`
|
|
143
|
+
`,r);if(o===-1)return`${e}
|
|
144
|
+
`;s++,r=o+1}return r>0?e.slice(0,r):""}function R1(e,t,n,r){if(n!==null)return e.slice(-n);let s=e.length;if(s===0)return"";if(r){let l=0,c=1;for(;l<s&&c<t;){let f=e.indexOf(`
|
|
145
|
+
`,l);if(f===-1)break;c++,l=f+1}let u=e.slice(l);return u.endsWith(`
|
|
146
|
+
`)?u:`${u}
|
|
147
|
+
`}if(t===0)return"";let i=s-1;e[i]===`
|
|
148
|
+
`&&i--;let o=0;for(;i>=0&&o<t;){if(e[i]===`
|
|
149
|
+
`&&(o++,o===t)){i++;break}i--}i<0&&(i=0);let a=e.slice(i);return e[s-1]===`
|
|
150
|
+
`?a:`${a}
|
|
151
|
+
`}var el=I(()=>{"use strict";ye();ae()});var P1={};ee(P1,{flagsForFuzzing:()=>A3,headCommand:()=>E3});var x3,E3,A3,D1=I(()=>{"use strict";ae();el();x3={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},E3={name:"head",async execute(e,t){if(W(e))return B(x3);let n=Vi(e,"head");if(!n.ok)return n.error;let{lines:r,bytes:s}=n.options;return qi(t,n.options,"head",i=>O1(i,r,s))}},A3={name:"head",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}});var _1={};ee(_1,{flagsForFuzzing:()=>v3,tailCommand:()=>C3});var S3,C3,v3,F1=I(()=>{"use strict";el();ae();S3={name:"tail",summary:"output the last part of files",usage:"tail [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the last NUM bytes","-n, --lines=NUM print the last NUM lines (default 10)","-n +NUM print starting from line NUM","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},C3={name:"tail",async execute(e,t){if(W(e))return B(S3);let n=Vi(e,"tail");if(!n.ok)return n.error;let{lines:r,bytes:s,fromLine:i}=n.options;return qi(t,n.options,"tail",o=>R1(o,r,s,i??!1))}},v3={name:"tail",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"text",needsFiles:!0}});var M1={};ee(M1,{flagsForFuzzing:()=>$3,wcCommand:()=>I3});function L1(e,t){let n=e,r=n.length,s=t?Array.from(le(e)).length:r,i=0,o=0,a=!1;for(let l=0;l<r;l++){let c=n[l];c===`
|
|
152
|
+
`?(i++,a&&(o++,a=!1)):c===" "||c===" "||c==="\r"?a&&(o++,a=!1):a=!0}return a&&o++,{lines:i,words:o,third:s}}function tl(e,t,n,r,s,i){let o=[];t&&o.push(String(e.lines).padStart(i)),n&&o.push(String(e.words).padStart(i)),r&&o.push(String(e.third).padStart(i));let a=o.join(" ");return s&&(a+=` ${s}`),a}var k3,N3,I3,$3,U1=I(()=>{"use strict";ye();ct();Or();ae();k3={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},N3={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},I3={name:"wc",async execute(e,t){if(W(e))return B(k3);let n=Ee("wc",e,N3);if(!n.ok)return n.error;let{lines:r,words:s}=n.result.flags,i=n.result.flags.bytes,o=n.result.flags.chars,a=n.result.positional;!r&&!s&&!i&&!o&&(r=s=i=!0);let l=i||o,c=await Tr(t,a,{cmdName:"wc",stopOnError:!1});if(a.length===0){let b=L1(c.files[0].content,o);return{stdout:`${tl(b,r,s,l,"",0)}
|
|
153
|
+
`,stderr:"",exitCode:0}}let u=[],f=0,p=0,h=0;for(let{filename:b,content:x}of c.files){let A=L1(x,o);f+=A.lines,p+=A.words,h+=A.third,u.push({filename:b,stats:A})}let d=a.length>1?f:Math.max(...u.map(b=>b.stats.lines)),m=a.length>1?p:Math.max(...u.map(b=>b.stats.words)),g=a.length>1?h:Math.max(...u.map(b=>b.stats.third)),y=a.length>1?3:0;r&&(y=Math.max(y,String(d).length)),s&&(y=Math.max(y,String(m).length)),l&&(y=Math.max(y,String(g).length));let w="";for(let{filename:b,stats:x}of u)w+=`${tl(x,r,s,l,b,y)}
|
|
154
|
+
`;return a.length>1&&(w+=`${tl({lines:f,words:p,third:h},r,s,l,"total",y)}
|
|
155
|
+
`),{stdout:w,stderr:c.stderr,exitCode:c.exitCode}}};$3={name:"wc",flags:[{flag:"-l",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-m",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Ys(e,t){let n=t?"d":"-",r=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"];return n+r.join("")}var nl=I(()=>{"use strict"});var B1={};ee(B1,{flagsForFuzzing:()=>P3,statCommand:()=>R3});var T3,O3,R3,P3,W1=I(()=>{"use strict";ct();nl();ae();T3={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"]},O3={format:{short:"c",type:"string"}},R3={name:"stat",async execute(e,t){if(W(e))return B(T3);let n=Ee("stat",e,O3);if(!n.ok)return n.error;let r=n.result.flags.format??null,s=n.result.positional;if(s.length===0)return{stdout:"",stderr:`stat: missing operand
|
|
156
|
+
`,exitCode:1};let i="",o="",a=!1;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{let u=await t.fs.stat(c);if(r){let f=r,p=u.mode.toString(8),h=Ys(u.mode,u.isDirectory);f=f.replace(/%n/g,l),f=f.replace(/%N/g,`'${l}'`),f=f.replace(/%s/g,String(u.size)),f=f.replace(/%F/g,u.isDirectory?"directory":"regular file"),f=f.replace(/%a/g,p),f=f.replace(/%A/g,h),f=f.replace(/%u/g,"1000"),f=f.replace(/%U/g,"user"),f=f.replace(/%g/g,"1000"),f=f.replace(/%G/g,"group"),i+=`${f}
|
|
157
|
+
`}else{let f=u.mode.toString(8).padStart(4,"0"),p=Ys(u.mode,u.isDirectory);i+=` File: ${l}
|
|
158
|
+
`,i+=` Size: ${u.size} Blocks: ${Math.ceil(u.size/512)}
|
|
159
|
+
`,i+=`Access: (${f}/${p})
|
|
160
|
+
`,i+=`Modify: ${u.mtime.toISOString()}
|
|
161
|
+
`}}catch{o+=`stat: cannot stat '${l}': No such file or directory
|
|
162
|
+
`,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},P3={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var V,F,T,hn,ue,Oe,ap,cr,Zi,rl,fs,Bn,sl,il,Je,ps,je,ol,Sn,al,Ki,he,ll,Qi,Js,D3,_3,cl,ul,L,fl,us,pl,hl,Te,z1,H1,j1,G1,V1,q1,Z1,K1,Q1,X1,Y1,J1,ep,tp,np,rp,sp,ip,op,Un,ei,dl,ml,gl,yl,wl,ur,lp=I(()=>{V=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},F=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
|
|
163
|
+
`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(t){let n=String.fromCodePoint(t).toUpperCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}static toLowerCase(t){let n=String.fromCodePoint(t).toLowerCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}},T=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let n=t*this.SIZE;return[this.data[n],this.data[n+1],this.data[n+2]]}get length(){return this.data.length/this.SIZE}},hn=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new T(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new T(new Uint32Array([0,31,1,127,159,1]));static Cf=new T(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new T(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new T(new Uint32Array([55296,57343,1]));static L=new T(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new T(new Uint32Array([837,837,1]));static Ll=new T(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new T(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new T(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new T(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new T(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new T(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new T(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new T(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new T(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new T(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new T(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new T(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new T(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new T(new Uint32Array([921,953,32,8126,8126,1]));static N=new T(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new T(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new T(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new T(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new T(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new T(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new T(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new T(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new T(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new T(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new T(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new T(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new T(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new T(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new T(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new T(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new T(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new T(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new T(new Uint32Array([8232,8232,1]));static Zp=new T(new Uint32Array([8233,8233,1]));static Zs=new T(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new T(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new T(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new T(new Uint32Array([82944,83526,1]));static Arabic=new T(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new T(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new T(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new T(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new T(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new T(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new T(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new T(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new T(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new T(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new T(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new T(new Uint32Array([10240,10495,1]));static Buginese=new T(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new T(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new T(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new T(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new T(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new T(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new T(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new T(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new T(new Uint32Array([69552,69579,1]));static Common=new T(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new T(new Uint32Array([924,956,32]));static Coptic=new T(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new T(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new T(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new T(new Uint32Array([77712,77810,1]));static Cyrillic=new T(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new T(new Uint32Array([66560,66639,1]));static Devanagari=new T(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new T(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new T(new Uint32Array([71680,71739,1]));static Duployan=new T(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new T(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new T(new Uint32Array([66816,66855,1]));static Elymaic=new T(new Uint32Array([69600,69622,1]));static Ethiopic=new T(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new T(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new T(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new T(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new T(new Uint32Array([66352,66378,1]));static Grantha=new T(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new T(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new T(new Uint32Array([181,837,656]));static Gujarati=new T(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new T(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new T(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new T(new Uint32Array([90368,90425,1]));static Han=new T(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new T(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new T(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new T(new Uint32Array([5920,5940,1]));static Hatran=new T(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new T(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new T(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new T(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new T(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new T(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new T(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new T(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new T(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new T(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new T(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new T(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new T(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new T(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new T(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new T(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new T(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new T(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new T(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new T(new Uint32Array([93504,93561,1]));static Lao=new T(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new T(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new T(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new T(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new T(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new T(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new T(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new T(new Uint32Array([66176,66204,1]));static Lydian=new T(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new T(new Uint32Array([69968,70006,1]));static Makasar=new T(new Uint32Array([73440,73464,1]));static Malayalam=new T(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new T(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new T(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new T(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new T(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new T(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new T(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new T(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new T(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new T(new Uint32Array([67968,67999,1]));static Miao=new T(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new T(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new T(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new T(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new T(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new T(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new T(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new T(new Uint32Array([124112,124153,1]));static Nandinagari=new T(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new T(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new T(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new T(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new T(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new T(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new T(new Uint32Array([5760,5788,1]));static Ol_Chiki=new T(new Uint32Array([7248,7295,1]));static Ol_Onal=new T(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new T(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new T(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new T(new Uint32Array([68224,68255,1]));static Old_Permic=new T(new Uint32Array([66384,66426,1]));static Old_Persian=new T(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new T(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new T(new Uint32Array([68192,68223,1]));static Old_Turkic=new T(new Uint32Array([68608,68680,1]));static Old_Uyghur=new T(new Uint32Array([69488,69513,1]));static Oriya=new T(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new T(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new T(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new T(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new T(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new T(new Uint32Array([72384,72440,1]));static Phags_Pa=new T(new Uint32Array([43072,43127,1]));static Phoenician=new T(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new T(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new T(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new T(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new T(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new T(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new T(new Uint32Array([70016,70111,1]));static Shavian=new T(new Uint32Array([66640,66687,1]));static Siddham=new T(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new T(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new T(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new T(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new T(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new T(new Uint32Array([72272,72354,1]));static Sundanese=new T(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new T(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new T(new Uint32Array([43008,43052,1]));static Syriac=new T(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new T(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new T(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new T(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new T(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new T(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new T(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new T(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new T(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new T(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new T(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new T(new Uint32Array([1920,1969,1]));static Thai=new T(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new T(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new T(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new T(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new T(new Uint32Array([67008,67059,1]));static Toto=new T(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new T(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new T(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new T(new Uint32Array([42240,42539,1]));static Vithkuqi=new T(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new T(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new T(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new T(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new T(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new T(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",e.C],["Cc",e.Cc],["Cf",e.Cf],["Co",e.Co],["Cs",e.Cs],["L",e.L],["Ll",e.Ll],["Lm",e.Lm],["Lo",e.Lo],["Lt",e.Lt],["Lu",e.Lu],["M",e.M],["Mc",e.Mc],["Me",e.Me],["Mn",e.Mn],["N",e.N],["Nd",e.Nd],["Nl",e.Nl],["No",e.No],["P",e.P],["Pc",e.Pc],["Pd",e.Pd],["Pe",e.Pe],["Pf",e.Pf],["Pi",e.Pi],["Po",e.Po],["Ps",e.Ps],["S",e.S],["Sc",e.Sc],["Sk",e.Sk],["Sm",e.Sm],["So",e.So],["Z",e.Z],["Zl",e.Zl],["Zp",e.Zp],["Zs",e.Zs]]);static SCRIPTS=new Map([["Adlam",e.Adlam],["Ahom",e.Ahom],["Anatolian_Hieroglyphs",e.Anatolian_Hieroglyphs],["Arabic",e.Arabic],["Armenian",e.Armenian],["Avestan",e.Avestan],["Balinese",e.Balinese],["Bamum",e.Bamum],["Bassa_Vah",e.Bassa_Vah],["Batak",e.Batak],["Bengali",e.Bengali],["Bhaiksuki",e.Bhaiksuki],["Bopomofo",e.Bopomofo],["Brahmi",e.Brahmi],["Braille",e.Braille],["Buginese",e.Buginese],["Buhid",e.Buhid],["Canadian_Aboriginal",e.Canadian_Aboriginal],["Carian",e.Carian],["Caucasian_Albanian",e.Caucasian_Albanian],["Chakma",e.Chakma],["Cham",e.Cham],["Cherokee",e.Cherokee],["Chorasmian",e.Chorasmian],["Common",e.Common],["Coptic",e.Coptic],["Cuneiform",e.Cuneiform],["Cypriot",e.Cypriot],["Cypro_Minoan",e.Cypro_Minoan],["Cyrillic",e.Cyrillic],["Deseret",e.Deseret],["Devanagari",e.Devanagari],["Dives_Akuru",e.Dives_Akuru],["Dogra",e.Dogra],["Duployan",e.Duployan],["Egyptian_Hieroglyphs",e.Egyptian_Hieroglyphs],["Elbasan",e.Elbasan],["Elymaic",e.Elymaic],["Ethiopic",e.Ethiopic],["Garay",e.Garay],["Georgian",e.Georgian],["Glagolitic",e.Glagolitic],["Gothic",e.Gothic],["Grantha",e.Grantha],["Greek",e.Greek],["Gujarati",e.Gujarati],["Gunjala_Gondi",e.Gunjala_Gondi],["Gurmukhi",e.Gurmukhi],["Gurung_Khema",e.Gurung_Khema],["Han",e.Han],["Hangul",e.Hangul],["Hanifi_Rohingya",e.Hanifi_Rohingya],["Hanunoo",e.Hanunoo],["Hatran",e.Hatran],["Hebrew",e.Hebrew],["Hiragana",e.Hiragana],["Imperial_Aramaic",e.Imperial_Aramaic],["Inherited",e.Inherited],["Inscriptional_Pahlavi",e.Inscriptional_Pahlavi],["Inscriptional_Parthian",e.Inscriptional_Parthian],["Javanese",e.Javanese],["Kaithi",e.Kaithi],["Kannada",e.Kannada],["Katakana",e.Katakana],["Kawi",e.Kawi],["Kayah_Li",e.Kayah_Li],["Kharoshthi",e.Kharoshthi],["Khitan_Small_Script",e.Khitan_Small_Script],["Khmer",e.Khmer],["Khojki",e.Khojki],["Khudawadi",e.Khudawadi],["Kirat_Rai",e.Kirat_Rai],["Lao",e.Lao],["Latin",e.Latin],["Lepcha",e.Lepcha],["Limbu",e.Limbu],["Linear_A",e.Linear_A],["Linear_B",e.Linear_B],["Lisu",e.Lisu],["Lycian",e.Lycian],["Lydian",e.Lydian],["Mahajani",e.Mahajani],["Makasar",e.Makasar],["Malayalam",e.Malayalam],["Mandaic",e.Mandaic],["Manichaean",e.Manichaean],["Marchen",e.Marchen],["Masaram_Gondi",e.Masaram_Gondi],["Medefaidrin",e.Medefaidrin],["Meetei_Mayek",e.Meetei_Mayek],["Mende_Kikakui",e.Mende_Kikakui],["Meroitic_Cursive",e.Meroitic_Cursive],["Meroitic_Hieroglyphs",e.Meroitic_Hieroglyphs],["Miao",e.Miao],["Modi",e.Modi],["Mongolian",e.Mongolian],["Mro",e.Mro],["Multani",e.Multani],["Myanmar",e.Myanmar],["Nabataean",e.Nabataean],["Nag_Mundari",e.Nag_Mundari],["Nandinagari",e.Nandinagari],["New_Tai_Lue",e.New_Tai_Lue],["Newa",e.Newa],["Nko",e.Nko],["Nushu",e.Nushu],["Nyiakeng_Puachue_Hmong",e.Nyiakeng_Puachue_Hmong],["Ogham",e.Ogham],["Ol_Chiki",e.Ol_Chiki],["Ol_Onal",e.Ol_Onal],["Old_Hungarian",e.Old_Hungarian],["Old_Italic",e.Old_Italic],["Old_North_Arabian",e.Old_North_Arabian],["Old_Permic",e.Old_Permic],["Old_Persian",e.Old_Persian],["Old_Sogdian",e.Old_Sogdian],["Old_South_Arabian",e.Old_South_Arabian],["Old_Turkic",e.Old_Turkic],["Old_Uyghur",e.Old_Uyghur],["Oriya",e.Oriya],["Osage",e.Osage],["Osmanya",e.Osmanya],["Pahawh_Hmong",e.Pahawh_Hmong],["Palmyrene",e.Palmyrene],["Pau_Cin_Hau",e.Pau_Cin_Hau],["Phags_Pa",e.Phags_Pa],["Phoenician",e.Phoenician],["Psalter_Pahlavi",e.Psalter_Pahlavi],["Rejang",e.Rejang],["Runic",e.Runic],["Samaritan",e.Samaritan],["Saurashtra",e.Saurashtra],["Sharada",e.Sharada],["Shavian",e.Shavian],["Siddham",e.Siddham],["SignWriting",e.SignWriting],["Sinhala",e.Sinhala],["Sogdian",e.Sogdian],["Sora_Sompeng",e.Sora_Sompeng],["Soyombo",e.Soyombo],["Sundanese",e.Sundanese],["Sunuwar",e.Sunuwar],["Syloti_Nagri",e.Syloti_Nagri],["Syriac",e.Syriac],["Tagalog",e.Tagalog],["Tagbanwa",e.Tagbanwa],["Tai_Le",e.Tai_Le],["Tai_Tham",e.Tai_Tham],["Tai_Viet",e.Tai_Viet],["Takri",e.Takri],["Tamil",e.Tamil],["Tangsa",e.Tangsa],["Tangut",e.Tangut],["Telugu",e.Telugu],["Thaana",e.Thaana],["Thai",e.Thai],["Tibetan",e.Tibetan],["Tifinagh",e.Tifinagh],["Tirhuta",e.Tirhuta],["Todhri",e.Todhri],["Toto",e.Toto],["Tulu_Tigalari",e.Tulu_Tigalari],["Ugaritic",e.Ugaritic],["Vai",e.Vai],["Vithkuqi",e.Vithkuqi],["Wancho",e.Wancho],["Warang_Citi",e.Warang_Citi],["Yezidi",e.Yezidi],["Yi",e.Yi],["Zanabazar_Square",e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",e.foldL],["Ll",e.foldLl],["Lt",e.foldLt],["Lu",e.foldLu],["M",e.foldM],["Mn",e.foldMn]]);static FOLD_SCRIPT=new Map([["Common",e.foldCommon],["Greek",e.foldGreek],["Inherited",e.foldInherited]]);static Print=new T(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},ue=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(t,n){let r=0,s=t.length;for(;r<s;){let i=r+Math.floor((s-r)/2),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){let l=t.getStride(i);return(n-o)%l===0}n<o?s=i:r=i+1}return!1}static is(t,n){if(n<=this.MAX_LATIN1){for(let r=0;r<t.length;r++){let s=t.getHi(r);if(n>s)continue;let i=t.getLo(r);if(n<i)return!1;let o=t.getStride(r);return(n-i)%o===0}return!1}return t.length>0&&n>=t.getLo(0)&&this.is32(t,n)}static isUpper(t){if(t<=this.MAX_LATIN1){let n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return this.is(hn.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(hn.Print,t)}static simpleFold(t){if(hn.CASE_ORBIT.has(t))return hn.CASE_ORBIT.get(t);let n=F.toLowerCase(t);return n!==t?n:F.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t<0||n<0||t===n)return!0;if(t<=this.MAX_ASCII&&n<=this.MAX_ASCII)return F.CODES.get("A")<=t&&t<=F.CODES.get("Z")&&(t|=32),F.CODES.get("A")<=n&&n<=F.CODES.get("Z")&&(n|=32),t===n;for(let r=this.simpleFold(t);r!==t;r=this.simpleFold(r))if(r===n)return!0;return!1}},Oe=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(t){return F.CODES.get("0")<=t&&t<=F.CODES.get("9")||F.CODES.get("a")<=t&&t<=F.CODES.get("z")||F.CODES.get("A")<=t&&t<=F.CODES.get("Z")}static unhex(t){return F.CODES.get("0")<=t&&t<=F.CODES.get("9")?t-F.CODES.get("0"):F.CODES.get("a")<=t&&t<=F.CODES.get("f")?t-F.CODES.get("a")+10:F.CODES.get("A")<=t&&t<=F.CODES.get("F")?t-F.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(ue.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case F.CODES.get('"'):n+='\\"';break;case F.CODES.get("\\"):n+="\\\\";break;case F.CODES.get(" "):n+="\\t";break;case F.CODES.get(`
|
|
164
|
+
`):n+="\\n";break;case F.CODES.get("\r"):n+="\\r";break;case F.CODES.get("\b"):n+="\\b";break;case F.CODES.get("\f"):n+="\\f";break;default:{let r=t.toString(16);t<256?(n+="\\x",r.length===1&&(n+="0"),n+=r):n+=`\\x{${r}}`;break}}return n}static stringToRunes(t){return String(t).split("").map(n=>n.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return F.CODES.get("a")<=t&&t<=F.CODES.get("z")||F.CODES.get("A")<=t&&t<=F.CODES.get("Z")||F.CODES.get("0")<=t&&t<=F.CODES.get("9")||t===F.CODES.get("_")}static emptyOpContext(t,n){let r=0;return t<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===F.CODES.get(`
|
|
165
|
+
`)&&(r|=this.EMPTY_BEGIN_LINE),n<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),n===F.CODES.get(`
|
|
166
|
+
`)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ue.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},ap=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},cr=class e{static Encoding=ap(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},Zi=class extends cr{constructor(t=null){super(),this.bytes=t}getEncoding(){return cr.Encoding.UTF_8}asCharSequence(){return Oe.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},rl=class extends cr{constructor(t=null){super(),this.charSequence=t}getEncoding(){return cr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},fs=class{static utf16(t){return new rl(t)}static utf8(t){return Array.isArray(t)?new Zi(t):new Zi(Oe.stringToUtf8ByteArray(t))}},Bn=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},sl=class extends Bn{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return Bn.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return Oe.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},il=class extends Bn{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|Oe.charCount(n)}else return Bn.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return Oe.emptyOpContext(n,r)}},Je=class{static fromUTF8(t,n=0,r=t.length){return new sl(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new il(t,n,r)}},ps=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},je=class extends ps{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},ol=class extends ps{constructor(t){super(t),this.name="RE2JSCompileException"}},Sn=class extends ps{constructor(t){super(t),this.name="RE2JSGroupException"}},al=class extends ps{constructor(t){super(t),this.name="RE2JSFlagsException"}},Ki=class{static quoteReplacement(t,n=!1){return n?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(r=>{let s=r.codePointAt(0);return s===F.CODES.get("\\")||s===F.CODES.get("$")?`\\${r}`:r}).join(""):t.indexOf("$")<0?t:t.split("").map(r=>r.codePointAt(0)===F.CODES.get("$")?"$$":r).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof cr?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(fs.utf8(n)):this.resetMatcherInput(fs.utf16(n))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new Sn(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new Sn(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new Sn(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new Sn(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new Sn("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new Sn("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,V.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,V.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new Sn(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,V.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?Oe.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),r}appendReplacementInternalJava(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===F.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===F.CODES.get("$")){let o=t.codePointAt(i+1);if(F.CODES.get("0")<=o&&o<=F.CODES.get("9")){let a=o-F.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<F.CODES.get("0")||o>F.CODES.get("9")||a*10+o-F.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-F.CODES.get("0");if(a>this.patternGroupCount)throw new Sn(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===F.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==F.CODES.get("}")&&t.codePointAt(a)!==F.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==F.CODES.get("}"))throw new Sn("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalJs(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===F.CODES.get("$")){let o=t.codePointAt(i+1);if(F.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(F.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(F.CODES.get("1")<=o&&o<=F.CODES.get("9")){let a=o-F.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<F.CODES.get("0")||o>F.CODES.get("9")||a*10+o-F.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-F.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===F.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==F.CODES.get(">")&&t.codePointAt(a)!==F.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==F.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},he=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(t){let n='"';for(let r of t)n+=Oe.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&V.FOLD_CASE)!==0?ue.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return"match";case e.FAIL:return"fail";case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?"rune <null>":["rune ",e.escapeRunes(this.runes),(this.arg&V.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},ll=class{constructor(){this.inst=null,this.cap=[]}},Qi=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},Js=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Qi(n.prog.numInst()),n.q1=new Qi(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?Oe.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new ll,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===Oe.EMPTY_ALL||(r===V.ANCHOR_START||r===V.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==Bn.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let p;for(n===0?p=Oe.emptyOpContext(-1,l):p=t.context(n);;){if(i.isEmpty()){if((s&Oe.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===V.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,p,null));let h=n+c;if(p=t.context(h),this.step(i,o,n,h,l,p,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let d=i;i=o,o=d}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let p=f.inst,h=!1;switch(p.op){case he.MATCH:if(a===V.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case he.RUNE:h=p.matchRune(i);break;case he.RUNE1:h=i===p.runes[0];break;case he.RUNE_ANY:h=!0;break;case he.RUNE_ANY_NOT_NL:h=i!==F.CODES.get(`
|
|
167
|
+
`);break;default:throw new Error("bad inst")}h&&(f=this.add(n,p.out,s,f.cap,o,f)),f!==null&&(this.freeThread(f),t.denseThreads[u]=null)}t.clear()}add(t,n,r,s,i,o){if(n===0||t.contains(n))return o;let a=t.add(n),l=this.prog.inst[n];switch(l.op){case he.FAIL:break;case he.ALT:case he.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case he.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case he.NOP:o=this.add(t,l.out,r,s,i,o);break;case he.CAPTURE:if(l.arg<this.ncap){let c=s[l.arg];s[l.arg]=r,this.add(t,l.out,r,s,i,null),s[l.arg]=c}else o=this.add(t,l.out,r,s,i,o);break;case he.MATCH:case he.RUNE:case he.RUNE1:case he.RUNE_ANY:case he.RUNE_ANY_NOT_NL:o===null?o=this.alloc(l):o.inst=l,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),t.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}},D3=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},_3=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},cl=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(ue.MAX_ASCII+1).fill(null),this.nextMap=new Map}},ul=class{constructor(t){this.prog=t,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=1e4}computeClosure(t){let n=new Set,r=[...t],s=!1;for(;r.length>0;){let o=r.pop();if(n.has(o))continue;n.add(o);let a=this.prog.getInst(o);switch(a.op){case he.MATCH:s=!0;break;case he.ALT:case he.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case he.NOP:case he.CAPTURE:r.push(a.out);break;case he.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(n).sort(),isMatch:s}}getState(t){let n=this.computeClosure(t);if(!n)return null;let r=n.pcs,s=D3(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(_3(l.nfaStates,r))return l}else i=[],this.stateCache.set(s,i);if(this.stateCount>=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let o=new cl(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===V.UNANCHORED&&n<=ue.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===V.UNANCHORED?0:ue.MAX_RUNE+1);if(t.nextMap.has(o))return t.nextMap.get(o)}let s=[];for(let o=0;o<t.nfaStates.length;o++){let a=t.nfaStates[o],l=this.prog.getInst(a);he.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===V.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===V.UNANCHORED&&n<=ue.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===V.UNANCHORED?0:ue.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===V.ANCHOR_START||r===V.ANCHOR_BOTH)&&n!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=t.endPos(),i=this.startState;if(i.isMatch)if(r===V.ANCHOR_BOTH){if(n===s)return!0}else return!0;let o=n;for(;o<s;){let a=t.step(o),l=a>>3,c=a&7;if(c===0)break;if(i=this.step(i,l,r),i===null)return null;if(i.isMatch)if(r===V.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==V.UNANCHORED)return!1;o+=c}return!1}},L=class e{static Op=ap(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===F.CODES.get("-")?"\\":""}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case e.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case e.Op.EMPTY_MATCH:t+="(?:)";break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+="*";break;case e.Op.PLUS:t+="+";break;case e.Op.QUEST:t+="?";break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&V.NON_GREEDY)!==0&&(t+="?");break}case e.Op.CONCAT:{for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break}case e.Op.ALTERNATE:{let n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case e.Op.LITERAL:(this.flags&V.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=Oe.escapeRune(n);(this.flags&V.FOLD_CASE)!==0&&(t+=")");break;case e.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case e.Op.ANY_CHAR:t+="(?s:.)";break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case e.Op.BEGIN_TEXT:t+="\\A";break;case e.Op.END_TEXT:(this.flags&V.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case e.Op.BEGIN_LINE:t+="^";break;case e.Op.END_LINE:t+="$";break;case e.Op.WORD_BOUNDARY:t+="\\b";break;case e.Op.NO_WORD_BOUNDARY:t+="\\B";break;case e.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===ue.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,s=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=Oe.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Oe.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],s=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=Oe.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Oe.escapeRune(s))}t+="]";break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let n of this.subs){let r=n.maxCap();t<r&&(t=r)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:{if((this.flags&V.WAS_DOLLAR)!==(t.flags&V.WAS_DOLLAR))return!1;break}case e.Op.LITERAL:case e.Op.CHAR_CLASS:{if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break}case e.Op.ALTERNATE:case e.Op.CONCAT:{if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break}case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:{if((this.flags&V.NON_GREEDY)!==(t.flags&V.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&V.NON_GREEDY)!==(t.flags&V.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.CAPTURE:{if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}}return!0}},fl=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new he(t))}skipNop(t){let n=this.inst[t];for(;n.op===he.NOP||n.op===he.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!he.isRuneOp(n.op)||n.runes.length!==1)return[n.op===he.MATCH,t];for(;he.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&V.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===he.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case he.EMPTY_WIDTH:t|=r.arg;break;case he.FAIL:return-1;case he.CAPTURE:case he.NOP:break;default:break e}n=r.out}return t}next(t){let n=this.inst[t>>1];return(t&1)===0?n.out:n.arg}patch(t,n){for(;t!==0;){let r=this.inst[t>>1];(t&1)===0?(t=r.out,r.out=n):(t=r.arg,r.arg=n)}}append(t,n){if(t===0)return n;if(n===0)return t;let r=t;for(;;){let i=this.next(r);if(i===0)break;r=i}let s=this.inst[r>>1];return(r&1)===0?s.out=n:s.arg=n,t}toString(){let t="";for(let n=0;n<this.inst.length;n++){let r=t.length;t+=n,n===this.start&&(t+="*"),t+=" ".substring(t.length-r),t+=this.inst[n],t+=`
|
|
168
|
+
`}return t}},us=class{constructor(t=0,n=0,r=!1){this.i=t,this.out=n,this.nullable=r}},pl=class e{static ANY_RUNE_NOT_NL(){return[0,F.CODES.get(`
|
|
169
|
+
`)-1,F.CODES.get(`
|
|
170
|
+
`)+1,ue.MAX_RUNE]}static ANY_RUNE(){return[0,ue.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(he.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new fl,this.newInst(he.FAIL)}newInst(t){return this.prog.addInst(t),new us(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(he.NOP);return t.out=t.i<<1,t}fail(){return new us}cap(t){let n=this.newInst(he.CAPTURE);return n.out=n.i<<1,this.prog.getInst(n.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),n}cat(t,n){return t.i===0||n.i===0?this.fail():(this.prog.patch(t.out,n.i),new us(t.i,n.out,t.nullable&&n.nullable))}alt(t,n){if(t.i===0)return n;if(n.i===0)return t;let r=this.newInst(he.ALT),s=this.prog.getInst(r.i);return s.out=t.i,s.arg=n.i,r.out=this.prog.append(t.out,n.out),r.nullable=t.nullable||n.nullable,r}loop(t,n){let r=this.newInst(he.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),this.prog.patch(t.out,r.i),r}quest(t,n){let r=this.newInst(he.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),r.out=this.prog.append(r.out,t.out),r}star(t,n){return t.nullable?this.quest(this.plus(t,n),n):this.loop(t,n)}plus(t,n){return new us(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(he.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(he.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=V.FOLD_CASE,(t.length!==1||ue.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&V.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=he.RUNE1:t.length===2&&t[0]===0&&t[1]===ue.MAX_RUNE?s.op=he.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===F.CODES.get(`
|
|
171
|
+
`)-1&&t[2]===F.CODES.get(`
|
|
172
|
+
`)+1&&t[3]===ue.MAX_RUNE&&(s.op=he.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case L.Op.NO_MATCH:return this.fail();case L.Op.EMPTY_MATCH:return this.nop();case L.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case L.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case L.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case L.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case L.Op.BEGIN_LINE:return this.empty(Oe.EMPTY_BEGIN_LINE);case L.Op.END_LINE:return this.empty(Oe.EMPTY_END_LINE);case L.Op.BEGIN_TEXT:return this.empty(Oe.EMPTY_BEGIN_TEXT);case L.Op.END_TEXT:return this.empty(Oe.EMPTY_END_TEXT);case L.Op.WORD_BOUNDARY:return this.empty(Oe.EMPTY_WORD_BOUNDARY);case L.Op.NO_WORD_BOUNDARY:return this.empty(Oe.EMPTY_NO_WORD_BOUNDARY);case L.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case L.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&V.NON_GREEDY)!==0);case L.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&V.NON_GREEDY)!==0);case L.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&V.NON_GREEDY)!==0);case L.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case L.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new ol("regexp: unhandled case in compile")}}},hl=class e{static simplify(t){if(t===null)return null;switch(t.op){case L.Op.CAPTURE:case L.Op.CONCAT:case L.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=L.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case L.Op.STAR:case L.Op.PLUS:case L.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case L.Op.REPEAT:{if(t.min===0&&t.max===0)return new L(L.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(L.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(L.Op.PLUS,t.flags,n,null);let s=new L(L.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(L.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(L.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new L(L.Op.CONCAT);o.subs=[n,s],s=e.simplify1(L.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new L(L.Op.CONCAT);return s.subs=r.slice(0),s}return new L(L.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===L.Op.EMPTY_MATCH||t===r.op&&(n&V.NON_GREEDY)===(r.flags&V.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&V.NON_GREEDY)===(n&V.NON_GREEDY)&&r===s.subs[0]||(s=new L(t),s.flags=n,s.subs=[r]),s)}},Te=class{constructor(t,n){this.sign=t,this.cls=n}},z1=[48,57],H1=[9,10,12,13,32,32],j1=[48,57,65,90,95,95,97,122],G1=new Map([["\\d",new Te(1,z1)],["\\D",new Te(-1,z1)],["\\s",new Te(1,H1)],["\\S",new Te(-1,H1)],["\\w",new Te(1,j1)],["\\W",new Te(-1,j1)]]),V1=[48,57,65,90,97,122],q1=[65,90,97,122],Z1=[0,127],K1=[9,9,32,32],Q1=[0,31,127,127],X1=[48,57],Y1=[33,126],J1=[97,122],ep=[32,126],tp=[33,47,58,64,91,96,123,126],np=[9,13,32,32],rp=[65,90],sp=[48,57,65,90,95,95,97,122],ip=[48,57,65,70,97,102],op=new Map([["[:alnum:]",new Te(1,V1)],["[:^alnum:]",new Te(-1,V1)],["[:alpha:]",new Te(1,q1)],["[:^alpha:]",new Te(-1,q1)],["[:ascii:]",new Te(1,Z1)],["[:^ascii:]",new Te(-1,Z1)],["[:blank:]",new Te(1,K1)],["[:^blank:]",new Te(-1,K1)],["[:cntrl:]",new Te(1,Q1)],["[:^cntrl:]",new Te(-1,Q1)],["[:digit:]",new Te(1,X1)],["[:^digit:]",new Te(-1,X1)],["[:graph:]",new Te(1,Y1)],["[:^graph:]",new Te(-1,Y1)],["[:lower:]",new Te(1,J1)],["[:^lower:]",new Te(-1,J1)],["[:print:]",new Te(1,ep)],["[:^print:]",new Te(-1,ep)],["[:punct:]",new Te(1,tp)],["[:^punct:]",new Te(-1,tp)],["[:space:]",new Te(1,np)],["[:^space:]",new Te(-1,np)],["[:upper:]",new Te(1,rp)],["[:^upper:]",new Te(-1,rp)],["[:word:]",new Te(1,sp)],["[:^word:]",new Te(-1,sp)],["[:xdigit:]",new Te(1,ip)],["[:^xdigit:]",new Te(-1,ip)]]),Un=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=Oe.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&V.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=ue.MIN_FOLD&&n>=ue.MAX_FOLD)return this.appendRange(t,n);if(n<ue.MIN_FOLD||t>ue.MAX_FOLD)return this.appendRange(t,n);t<ue.MIN_FOLD&&(this.appendRange(t,ue.MIN_FOLD-1),t=ue.MIN_FOLD),n>ue.MAX_FOLD&&(this.appendRange(ue.MAX_FOLD+1,n),n=ue.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ue.simpleFold(r);s!==r;s=ue.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=ue.MAX_RUNE&&this.appendRange(n,ue.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ue.MAX_RUNE&&this.appendRange(n,ue.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=ue.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ue.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},ei=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},dl=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=Oe.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},ml=class e{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new T(new Uint32Array([0,ue.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?ei.of(e.ANY_TABLE,e.ANY_TABLE):hn.CATEGORIES.has(t)?ei.of(hn.CATEGORIES.get(t),hn.FOLD_CATEGORIES.get(t)):hn.SCRIPTS.has(t)?ei.of(hn.SCRIPTS.get(t),hn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ue.MIN_FOLD||t>ue.MAX_FOLD)return t;let n=t,r=t;for(t=ue.simpleFold(t);t!==r;t=ue.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===L.Op.EMPTY_MATCH)return null;if(t.op===L.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===L.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new L(L.Op.LITERAL);return r.flags=n,r.runes=Oe.stringToRunes(t),r}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new je(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ue.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==F.CODES.get("_")&&!Oe.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=F.CODES.get("0")&&t.peek()<=F.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===F.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===L.Op.LITERAL&&t.runes.length===1||t.op===L.Op.CHAR_CLASS||t.op===L.Op.ANY_CHAR_NOT_NL||t.op===L.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case L.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case L.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case L.Op.ANY_CHAR_NOT_NL:return n!==F.CODES.get(`
|
|
173
|
+
`);case L.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case L.Op.ANY_CHAR:break;case L.Op.ANY_CHAR_NOT_NL:e.matchRune(n,F.CODES.get(`
|
|
174
|
+
`))&&(t.op=L.Op.ANY_CHAR);break;case L.Op.CHAR_CLASS:n.op===L.Op.LITERAL?t.runes=new Un(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Un(t.runes).appendClass(n.runes).toArray();break;case L.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=L.Op.CHAR_CLASS,t.runes=new Un().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new je(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case F.CODES.get("1"):case F.CODES.get("2"):case F.CODES.get("3"):case F.CODES.get("4"):case F.CODES.get("5"):case F.CODES.get("6"):case F.CODES.get("7"):if(!t.more()||t.peek()<F.CODES.get("0")||t.peek()>F.CODES.get("7"))break;case F.CODES.get("0"):{let s=r-F.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<F.CODES.get("0")||t.peek()>F.CODES.get("7"));i++)s=s*8+t.peek()-F.CODES.get("0"),t.skip(1);return s}case F.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===F.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===F.CODES.get("}"))break;let l=Oe.unhex(r);if(l<0||(a=a*16+l,a>ue.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=Oe.unhex(r);if(!t.more())break;r=t.pop();let i=Oe.unhex(r);if(s<0||i<0)break;return s*16+i}case F.CODES.get("a"):return F.CODES.get("\x07");case F.CODES.get("f"):return F.CODES.get("\f");case F.CODES.get("n"):return F.CODES.get(`
|
|
175
|
+
`);case F.CODES.get("r"):return F.CODES.get("\r");case F.CODES.get("t"):return F.CODES.get(" ");case F.CODES.get("v"):return F.CODES.get("\v");default:if(r<=ue.MAX_ASCII&&!Oe.isalnum(r))return r;break}throw new je(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new je(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static concatRunes(t,n){return[...t,...n]}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new L(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new je(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===L.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>e.MAX_SIZE/this.repeats?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<e.MAX_SIZE/this.repeats)return;this.size={};for(let n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new je(e.ERR_LARGE)}calcSize(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let r=0;switch(t.op){case L.Op.LITERAL:{r=t.runes.length;break}case L.Op.CAPTURE:case L.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case L.Op.PLUS:case L.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case L.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case L.Op.ALTERNATE:{for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break}case L.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size[t]=r,r}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new je(e.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let r=1;for(let s of t.subs){let i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height[t]=r,r}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,n=t;for(;n>0&&!L.isPseudoOp(this.stack[n-1].op);)n--;let r=this.stack.slice(n,t);return this.stack=this.stack.slice(0,n),r}push(t){if(this.numRunes+=t.runes.length,t.op===L.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=L.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===L.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ue.simpleFold(t.runes[0])===t.runes[2]&&ue.simpleFold(t.runes[2])===t.runes[0]||t.op===L.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ue.simpleFold(t.runes[0])===t.runes[1]&&ue.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|V.FOLD_CASE))return null;t.op=L.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|V.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let s=this.stack[r-1],i=this.stack[r-2];return s.op!==L.Op.LITERAL||i.op!==L.Op.LITERAL||(s.flags&V.FOLD_CASE)!==(i.flags&V.FOLD_CASE)?!1:(i.runes=e.concatRunes(i.runes,s.runes),t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1))}newLiteral(t,n){let r=this.newRegexp(L.Op.LITERAL);return r.flags=n,(n&V.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,o){let a=this.flags;if((a&V.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=V.NON_GREEDY),o!==-1))throw new je(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(L.isPseudoOp(c.op))throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===L.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new je(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===L.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(L.Op.EMPTY_MATCH)):this.push(this.collapse(t,L.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(L.Op.NO_MATCH)):this.push(this.collapse(t,L.Op.ALTERNATE))}cleanAlt(t){t.op===L.Op.CHAR_CLASS&&(t.runes=new Un(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ue.MAX_RUNE?(t.runes=[],t.op=L.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===F.CODES.get(`
|
|
176
|
+
`)-1&&t.runes[2]===F.CODES.get(`
|
|
177
|
+
`)+1&&t.runes[3]===ue.MAX_RUNE&&(t.runes=[],t.op=L.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===L.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,p=0,h=0;if(u<r){let d=t[n+u];if(d.op===L.Op.CONCAT&&d.subs.length>0&&(d=d.subs[0]),d.op===L.Op.LITERAL&&(f=d.runes,p=d.runes.length,h=d.flags&V.FOLD_CASE),h===a){let m=0;for(;m<o&&m<p&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=this.newRegexp(L.Op.LITERAL);d.flags=a,d.runes=i.slice(0,o);for(let y=l;y<u;y++)t[n+y]=this.removeLeadingString(t[n+y],o),this.checkLimits(t[n+y]);let m=this.collapse(t.slice(n+l,n+u),L.Op.ALTERNATE),g=this.newRegexp(L.Op.CONCAT);g.subs=[d,m],t[s++]=g}l=u,i=f,o=p,a=h}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===L.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let p=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let h=this.collapse(t.slice(n+l,n+u),L.Op.ALTERNATE),d=this.newRegexp(L.Op.CONCAT);d.subs=[p,h],t[s++]=d}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let h=l+1;h<u;h++){let d=t[n+f],m=t[n+h];(d.op<m.op||d.op===m.op&&(d.runes!==null?d.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=h)}let p=t[n+l];t[n+l]=t[n+f],t[n+f]=p;for(let h=l+1;h<u;h++)e.mergeCharClass(t[n+l],t[n+h]),this.reuse(t[n+h]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===L.Op.EMPTY_MATCH&&t[n+u+1].op===L.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===L.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===L.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=L.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===L.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=L.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===L.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=L.Op.EMPTY_MATCH,t.subs=L.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(L.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&V.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new dl(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case F.CODES.get("("):if((this.flags&V.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(L.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case F.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case F.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case F.CODES.get("^"):(this.flags&V.ONE_LINE)!==0?this.op(L.Op.BEGIN_TEXT):this.op(L.Op.BEGIN_LINE),s.skip(1);break;case F.CODES.get("$"):(this.flags&V.ONE_LINE)!==0?this.op(L.Op.END_TEXT).flags|=V.WAS_DOLLAR:this.op(L.Op.END_LINE),s.skip(1);break;case F.CODES.get("."):(this.flags&V.DOT_NL)!==0?this.op(L.Op.ANY_CHAR):this.op(L.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case F.CODES.get("["):this.parseClass(s);break;case F.CODES.get("*"):case F.CODES.get("+"):case F.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case F.CODES.get("*"):a=L.Op.STAR;break;case F.CODES.get("+"):a=L.Op.PLUS;break;case F.CODES.get("?"):a=L.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case F.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&ue.MAX_BMP)<<16>>16,this.repeat(L.Op.REPEAT,n,r,o,s,t);break}case F.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&V.PERL_X)!==0&&s.more())switch(s.pop()){case F.CODES.get("A"):this.op(L.Op.BEGIN_TEXT);break e;case F.CODES.get("b"):this.op(L.Op.WORD_BOUNDARY);break e;case F.CODES.get("B"):this.op(L.Op.NO_WORD_BOUNDARY);break e;case F.CODES.get("C"):throw new je(e.ERR_INVALID_ESCAPE,"\\C");case F.CODES.get("Q"):{let f=s.rest(),p=f.indexOf("\\E");p>=0&&(f=f.substring(0,p)),s.skipString(f),s.skipString("\\E");let h=0;for(;h<f.length;){let d=f.codePointAt(h);this.literal(d),h+=Oe.charCount(d)}break e}case F.CODES.get("z"):this.op(L.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(L.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Un;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Un;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new je(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){let a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new je(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new je(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(L.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new je(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case F.CODES.get("i"):s|=V.FOLD_CASE,o=!0;break;case F.CODES.get("m"):s&=-17,o=!0;break;case F.CODES.get("s"):s|=V.DOT_NL,o=!0;break;case F.CODES.get("U"):s|=V.NON_GREEDY,o=!0;break;case F.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case F.CODES.get(":"):case F.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===F.CODES.get(":")&&this.op(L.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new je(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(L.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===L.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===L.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==L.Op.LEFT_PAREN)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=L.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&V.PERL_X)===0||!t.more()||t.pop()!==F.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=G1.has(s)?G1.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&V.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=op.has(i)?op.get(i):null;if(o===null)throw new je(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&V.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&V.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===F.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==F.CODES.get("{"))o=Oe.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===F.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new je(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&V.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Un().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(L.Op.CHAR_CLASS);r.flags=this.flags;let s=new Un,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&V.CLASS_NL)===0&&s.appendRange(F.CODES.get(`
|
|
178
|
+
`),F.CODES.get(`
|
|
179
|
+
`)));let o=!0;for(;!t.more()||t.peek()!==F.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&V.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new je(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);let l=e.parseClassChar(t,n),c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=e.parseClassChar(t,n),c<l)throw new je(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&V.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},gl=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}},yl=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,V.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,V.POSIX,!0)}static compileImpl(t,n,r){let s=ml.parse(t,n),i=s.maxCap();s=hl.simplify(s);let o=pl.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=Oe.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}static match(t,n){return e.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new gl,this.dfa=new ul(n)}executeEngine(t,n,r,s){if(s>0)return this.doExecuteNFA(t,n,r,s);let i=this.dfa.match(t,n,r);return i!==null?i?[]:null:this.doExecuteNFA(t,n,r,s)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=Js.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecuteNFA(t,n,r,s){let i=this.get(),o=!1;i?i.next!==null&&(i=Js.fromMachine(i),o=!0):(i=Js.fromRE2(this),o=!0),i.init(s);let a=i.match(t,n,r)?i.submatches():null;return this.put(i,o),a}match(t){return this.executeEngine(Je.fromUTF16(t),0,V.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof cr||(t=fs.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let o=t.isUTF16Encoding()?Je.fromUTF16(t.asCharSequence(),0,r):Je.fromUTF8(t.asBytes(),0,r),a=this.executeEngine(o,n,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(t){return this.executeEngine(Je.fromUTF8(t),0,V.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,o="",a=Je.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,V.UNANCHORED,2);if(c===null||c.length===0)break;o+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(o+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=a.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return o+=t.substring(s),o}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[],i=t.endPos();n<0&&(n=i+1);let o=0,a=0,l=-1;for(;a<n&&o<=i;){let c=this.executeEngine(t,o,V.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===o){c[0]===l&&(u=!1);let f=t.step(o);f<0?o=i+1:o+=f&7}else o=c[1];l=c[1],u&&(s.push(r(this.pad(c))),a++)}return s}findUTF8(t){let n=this.executeEngine(Je.fromUTF8(t),0,V.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(Je.fromUTF8(t),0,V.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(Je.fromUTF16(t),0,V.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(Je.fromUTF16(t),0,V.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(Je.fromUTF8(t),0,V.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(Je.fromUTF8(t),0,V.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(Je.fromUTF16(t),0,V.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.executeEngine(Je.fromUTF16(t),0,V.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(Je.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(Je.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(Je.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(Je.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(Je.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(Je.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(Je.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(Je.fromUTF16(t),n);return r.length===0?null:r}},wl=class e{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,s=t.length;s===0&&(n="(?:)",r=!0);let i=0;for(;i<s;){let o=t[i];if(o==="\\"){if(i+1<s)switch(o=t[i+1],o){case"\\":{n+="\\\\",i+=2;continue}case"c":{if(i+2<s){let l=t[i+2];if(e.isUpperCaseAlpha(l)){n+="\\x",n+=(l.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),i+=3,r=!0;continue}}n+="\\c",i+=2;continue}case"u":{if(i+2<s){let l=t[i+2];if(e.isHexadecimal(l)){n+="\\x{"+l,i+=3;for(let c=0;c<3&&i<s&&(l=t[i],!!e.isHexadecimal(l));++i,++c)n+=l;n+="}",r=!0;continue}else if(l==="{"){n+="\\x",i+=2,r=!0;continue}}n+="\\u",i+=2;continue}default:{n+="\\";let l=e.getUtf8CharSize(o);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(o==="/"){n+="\\/",i+=1,r=!0;continue}else if(o==="("&&i+2<s&&t[i+1]==="?"&&t[i+2]==="<"&&(i+3>=s||t[i+3]!=="="&&t[i+3]!=="!")){n+="(?P<",i+=3,r=!0;continue}let a=e.getUtf8CharSize(o);n+=t.substring(i,i+a),i+=a}return r?n:t}},ur=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return Oe.quoteMeta(t)}static quoteReplacement(t,n=!1){return Ki.quoteReplacement(t,n)}static translateRegExp(t){return wl.translate(t)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new al("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=V.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=yl.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).testExact(n)}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");let s=new e(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=fs.utf8(t)),new Ki(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?Je.fromUTF8(t):Je.fromUTF16(t);return this.re2Input.executeEngine(n,0,V.ANCHOR_BOTH,0)!==null}split(t,n=0){let r=this.matcher(t),s=[],i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(o,r.inputLength())),s}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function F3(e){let t=0;return e.includes("i")&&(t|=ur.CASE_INSENSITIVE),e.includes("m")&&(t|=ur.MULTILINE),e.includes("s")&&(t|=ur.DOTALL),t}function L3(e){return ur.translateRegExp(e)}function X(e,t=""){return new Xi(e,t)}var Xi,er,cp=I(()=>{"use strict";lp();Xi=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}constructor(t,n=""){this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m");try{let r=L3(t),s=F3(n);this._re2=ur.compile(r,s)}catch(r){if(r instanceof je){let s=r.message||"",i="";throw s.includes("(?=")||s.includes("(?!")||s.includes("(?<")||s.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?i=" Lookahead (?=, ?!) and lookbehind (?<=, ?<!) assertions are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support these features.":(s.includes("backreference")||/\\[1-9]/.test(t))&&(i=" Backreferences (\\1, \\2, etc.) are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support backreferences."),new SyntaxError(`Invalid regular expression: /${t}/: ${s}${i}`)}throw r}}test(t){return this._global&&(this._lastIndex=0),this.acquireMatcher(t).find()}exec(t){let n=this.acquireMatcher(t),r=this._global?this._lastIndex:0;if(!n.find(r))return this._global&&(this._lastIndex=0),null;let s=this._re2.groupCount(),i=[];i.push(n.group(0)??"");for(let l=1;l<=s;l++){let c=n.group(l);i.push(c)}let o=i;o.index=n.start(0),o.input=t;let a=this._re2.namedGroups();if(a&&Object.keys(a).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(a)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),o}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let n=[],r=this.acquireMatcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(n.push(i),s=r.end(0),r.start(0)===r.end(0)&&s++,s>t.length)break}return n.length>0?n:null}replace(t,n){if(this._global&&(this._lastIndex=0),typeof n=="string"){let c=this.acquireMatcher(t);return this._global?c.replaceAll(n,!0):c.replaceFirst(n,!0)}let r=[],s=this._re2.matcher(t),i=0,o=0,a=this._re2.groupCount(),l=this._re2.namedGroups();for(;s.find(o);){r.push(t.slice(i,s.start(0)));let c=[],u=s.group(0)??"";for(let h=1;h<=a;h++)c.push(s.group(h));if(c.push(s.start(0)),c.push(t),l&&Object.keys(l).length>0){let h=Object.create(null);for(let[d,m]of Object.entries(l))h[d]=s.group(m)??"";c.push(h)}let f=s.start(0),p=s.end(0);if(r.push(n(u,...c)),i=p,o=i,f===p&&o++,!this._global||o>t.length)break}return r.push(t.slice(i)),r.join("")}split(t,n){return n===void 0||n<0?this._re2.split(t,-1):n===0?[]:this._re2.split(t,-1).slice(0,n)}search(t){let n=this.acquireMatcher(t);return n.find()?n.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let n=this._re2.matcher(t),r=this._re2.groupCount(),s=this._re2.namedGroups(),i=0;for(;n.find(i);){let o=[];o.push(n.group(0)??"");for(let l=1;l<=r;l++)o.push(n.group(l));let a=o;if(a.index=n.start(0),a.input=t,s&&Object.keys(s).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(s)){let f=n.group(u);f!==null&&(l[c]=f)}a.groups=l}if(yield a,i=n.end(0),n.start(0)===n.end(0)&&i++,i>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(t){this._lastIndex=t}};er=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,n){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,n)}split(t,n){return t.split(this._regex,n)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let n=this._regex.exec(t);for(;n!==null;)yield n,n[0].length===0&&this._regex.lastIndex++,n=this._regex.exec(t)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(t){this._regex.lastIndex=t}}});var Qe=I(()=>{"use strict";cp()});function Lt(e,t,n){let r=typeof n=="boolean"?{ignoreCase:n}:n??{},s=t;r.stripQuotes&&(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1));let i=r.ignoreCase?`i:${s}`:s,o=ti.get(i);if(!o){if(o=U3(s,r.ignoreCase),ti.size>=M3){let a=ti.keys().next().value;a!==void 0&&ti.delete(a)}ti.set(i,o)}return o.test(e)}function U3(e,t){let n="^";for(let r=0;r<e.length;r++){let s=e[r];if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=r+1;for(;i<e.length&&e[i]!=="]";)i++;n+=e.slice(r,i+1),r=i}else s==="."||s==="+"||s==="^"||s==="$"||s==="{"||s==="}"||s==="("||s===")"||s==="|"||s==="\\"?n+=`\\${s}`:n+=s}return n+="$",X(n,t?"i":"")}var M3,ti,bl=I(()=>{"use strict";Qe();M3=2048,ti=new Map});function ni(e,t){let n=e.ignoreCase?t.toLowerCase():t,r=e.needles;for(let s=0;s<r.length;s++)if(n.indexOf(r[s])!==-1)return!0;return!1}function up(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(n,r,s)=>{if(r==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let i=parseInt(r,10);return t[i]??""})}function hs(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:o=!1,filename:a="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:p="--",showColumn:h=!1,vimgrep:d=!1,showByteOffset:m=!1,replace:g=null,passthru:y=!1,multiline:w=!1,kResetGroup:b,preFilter:x}=n;if(w)return B3(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:m,replace:g,kResetGroup:b,preFilter:x});let A=e.split(`
|
|
180
|
+
`),C=A.length,$=C>0&&A[C-1]===""?C-1:C;if(i||o){let R=0,O=(o||l)&&!r;for(let M=0;M<$;M++){let z=A[M];if(!(x&&!r&&!ni(x,z)))if(t.lastIndex=0,O)for(let ie=t.exec(z);ie!==null;ie=t.exec(z))R++,ie[0].length===0&&t.lastIndex++;else t.test(z)!==r&&R++}return{output:`${a?`${a}:${R}`:String(R)}
|
|
181
|
+
`,matched:R>0,matchCount:R}}if(c===0&&u===0&&!y){let R=[],O=!1,_=0,M=0;for(let z=0;z<$&&!(f>0&&_>=f);z++){let ie=A[z],me=null;if(x&&!ni(x,ie)||(t.lastIndex=0,me=t.exec(ie)),me!==null!==r)if(O=!0,_++,l)for(let j=me;j!==null;j=t.exec(ie)){let te=b!==void 0?j[b]??"":j[0],Se=g!==null?up(g,j):te,oe=a?`${a}:`:"";m&&(oe+=`${M+j.index}:`),s&&(oe+=`${z+1}:`),h&&(oe+=`${j.index+1}:`),R.push(oe+Se),j[0].length===0&&t.lastIndex++}else if(d)for(let j=me;j!==null;j=t.exec(ie)){let te=a?`${a}:`:"";m&&(te+=`${M+j.index}:`),s&&(te+=`${z+1}:`),h&&(te+=`${j.index+1}:`),R.push(te+ie),j[0].length===0&&t.lastIndex++}else{let j=me?me.index+1:1,te=ie;g!==null&&(t.lastIndex=0,te=t.replace(ie,(...oe)=>{if(oe[0].length===0)return"";let G=oe,Pe=oe[oe.length-1];return typeof Pe=="object"&&Pe!==null?(G.groups=Pe,G.input=oe[oe.length-2],G.index=oe[oe.length-3]):(G.input=oe[oe.length-1],G.index=oe[oe.length-2]),up(g,G)}));let Se=a?`${a}:`:"";m&&(Se+=`${M+(me?me.index:0)}:`),s&&(Se+=`${z+1}:`),h&&(Se+=`${j}:`),R.push(Se+te)}M+=ie.length+1}return{output:R.length>0?`${R.join(`
|
|
182
|
+
`)}
|
|
183
|
+
`:"",matched:O,matchCount:_}}if(y){let R=[],O=!1,_=0;for(let M=0;M<$;M++){let z=A[M],ie;x&&!ni(x,z)?ie=!1:(t.lastIndex=0,ie=t.test(z));let me=ie!==r;me&&(O=!0,_++);let q=me?":":"-",j=a?`${a}${q}`:"";s&&(j+=`${M+1}${q}`),R.push(j+z)}return{output:R.length>0?`${R.join(`
|
|
184
|
+
`)}
|
|
185
|
+
`:"",matched:O,matchCount:_}}let D=[],v=0,P=new Set,k=-1,N=[];for(let R=0;R<$&&!(f>0&&v>=f);R++){let O=A[R],_;x&&!ni(x,O)?_=!1:(t.lastIndex=0,_=t.test(O)),_!==r&&(N.push(R),v++)}for(let R of N){let O=Math.max(0,R-c);k>=0&&O>k+1&&D.push(p);for(let M=O;M<R;M++)if(!P.has(M)){P.add(M),k=M;let z=A[M];s&&(z=`${M+1}-${z}`),a&&(z=`${a}-${z}`),D.push(z)}if(!P.has(R)){P.add(R),k=R;let M=A[R];if(l){t.lastIndex=0;for(let z=t.exec(M);z!==null;z=t.exec(M)){let ie=b!==void 0?z[b]??"":z[0],me=g!==null?g:ie,q=a?`${a}:`:"";s&&(q+=`${R+1}:`),h&&(q+=`${z.index+1}:`),D.push(q+me),z[0].length===0&&t.lastIndex++}}else{let z=M;s&&(z=`${R+1}:${z}`),a&&(z=`${a}:${z}`),D.push(z)}}let _=Math.min($-1,R+u);for(let M=R+1;M<=_;M++)if(!P.has(M)){P.add(M),k=M;let z=A[M];s&&(z=`${M+1}-${z}`),a&&(z=`${a}-${z}`),D.push(z)}}return{output:D.length>0?`${D.join(`
|
|
186
|
+
`)}
|
|
187
|
+
`:"",matched:v>0,matchCount:v}}function B3(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:d,replace:m,kResetGroup:g,preFilter:y}=n;if(y&&!r&&!ni(y,e))return i||o?{output:`${a?`${a}:0`:"0"}
|
|
188
|
+
`,matched:!1,matchCount:0}:{output:"",matched:!1,matchCount:0};let w=e.split(`
|
|
189
|
+
`),b=w.length,x=b>0&&w[b-1]===""?b-1:b,A=[0];for(let N=0;N<e.length;N++)e[N]===`
|
|
190
|
+
`&&A.push(N+1);let C=N=>{let R=0;for(let O=0;O<A.length&&!(A[O]>N);O++)R=O;return R},$=N=>{let R=C(N);return N-A[R]+1},D=[];t.lastIndex=0;for(let N=t.exec(e);N!==null&&!(f>0&&D.length>=f);N=t.exec(e)){let R=C(N.index),O=C(N.index+Math.max(0,N[0].length-1)),_=g!==void 0?N[g]??"":N[0];D.push({startLine:R,endLine:O,byteOffset:N.index,column:$(N.index),matchText:_}),N[0].length===0&&t.lastIndex++}if(i||o){let N;if(o)N=r?0:D.length;else{let O=new Set;for(let _ of D)for(let M=_.startLine;M<=_.endLine;M++)O.add(M);N=r?x-O.size:O.size}return{output:`${a?`${a}:${N}`:String(N)}
|
|
191
|
+
`,matched:N>0,matchCount:N}}if(r){let N=new Set;for(let O of D)for(let _=O.startLine;_<=O.endLine;_++)N.add(_);let R=[];for(let O=0;O<x;O++)if(!N.has(O)){let _=w[O];s&&(_=`${O+1}:${_}`),a&&(_=`${a}:${_}`),R.push(_)}return{output:R.length>0?`${R.join(`
|
|
192
|
+
`)}
|
|
193
|
+
`:"",matched:R.length>0,matchCount:R.length}}if(D.length===0)return{output:"",matched:!1,matchCount:0};let v=new Set,P=-1,k=[];for(let N of D){let R=Math.max(0,N.startLine-c),O=Math.min(x-1,N.endLine+u);P>=0&&R>P+1&&k.push(p);for(let _=R;_<N.startLine;_++)if(!v.has(_)){v.add(_),P=_;let M=w[_];s&&(M=`${_+1}-${M}`),a&&(M=`${a}-${M}`),k.push(M)}if(l){let _=m!==null?m:N.matchText,M=a?`${a}:`:"";d&&(M+=`${N.byteOffset}:`),s&&(M+=`${N.startLine+1}:`),h&&(M+=`${N.column}:`),k.push(M+_);for(let z=N.startLine;z<=N.endLine;z++)v.add(z),P=z}else for(let _=N.startLine;_<=N.endLine&&_<x;_++)if(!v.has(_)){v.add(_),P=_;let M=w[_];m!==null&&_===N.startLine&&(t.lastIndex=0,M=t.replace(M,m));let z=a?`${a}:`:"";d&&_===N.startLine&&(z+=`${N.byteOffset}:`),s&&(z+=`${_+1}:`),h&&_===N.startLine&&(z+=`${N.column}:`),k.push(z+M)}for(let _=N.endLine+1;_<=O;_++)if(!v.has(_)){v.add(_),P=_;let M=w[_];s&&(M=`${_+1}-${M}`),a&&(M=`${a}-${M}`),k.push(M)}}return{output:k.length>0?`${k.join(`
|
|
194
|
+
`)}
|
|
195
|
+
`:"",matched:!0,matchCount:D.length}}var fp=I(()=>{"use strict"});function pp(e){let t="",n=0;for(;n<e.length;){if(e.slice(n,n+7)==="[[:<:]]"){t+="\\b",n+=7;continue}if(e.slice(n,n+7)==="[[:>:]]"){t+="\\b",n+=7;continue}if(e[n]==="["){let r="[";for(n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++),n<e.length&&e[n]==="]"&&(r+="\\]",n++);n<e.length&&e[n]!=="]";){if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=W3.get(i);if(o){r+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]==="]"&&(r+="]",n++),t+=r;continue}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function ri(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=pp(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=G3(n),n=V3(n),n=q3(n);let a=X3(n);n=a.pattern,r=a.kResetGroup}break}default:n=pp(e),n=e8(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^${n}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(n),i="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":""),o=z3(n,t.ignoreCase??!1);return{regex:X(n,i),kResetGroup:r,preFilter:o??void 0}}function z3(e,t){let n=e;if(n.startsWith("\\b(?:")&&n.endsWith(")\\b")?n=n.slice(5,n.length-3):n.startsWith("\\b")&&n.endsWith("\\b")&&n.length>=4&&(n=n.slice(2,n.length-2)),n.length===0)return null;let r=H3(n);if(r===null)return null;let s=[];for(let i of r){let o=j3(i);if(o===null||o.length===0)return null;s.push(o)}return s.length===0?null:{needles:t?s.map(i=>i.toLowerCase()):s,ignoreCase:t}}function H3(e){let t=[],n=0,r=!1,s=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="\\"){i++;continue}if(r){o==="]"&&(r=!1);continue}if(o==="[")r=!0;else if(o==="(")n++;else if(o===")"){if(n--,n<0)return null}else o==="|"&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return n!==0||r?null:(t.push(e.slice(s)),t)}function j3(e){let t=e;if(t.startsWith("^")&&(t=t.slice(1)),t.endsWith("$")){let r=0;for(let s=t.length-2;s>=0&&t[s]==="\\";s--)r++;r%2===0&&(t=t.slice(0,-1))}if(t.length===0)return null;let n="";for(let r=0;r<t.length;r++){let s=t[r];if(s==="\\"){let i=t[r+1];if(i===void 0||/[dDwWsSbBAZzGQE0-9ckpPNXRxuU]/.test(i))return null;i==="n"?n+=`
|
|
196
|
+
`:i==="t"?n+=" ":i==="r"?n+="\r":i==="f"?n+="\f":i==="v"?n+="\v":n+=i,r++;continue}if(/[.*+?^${}()|[\]]/.test(s))return null;n+=s}return n}function G3(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="Q"){n+=2;let r="";for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="E"){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else t+=e[n],n++;return t}function V3(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function q3(e){let t="",n=0;for(;n<e.length;){if(e[n]==="("&&n+1<e.length&&e[n+1]==="?"){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let s=r[1]||"",i=r[2]||"",o=r[3];if(o===":"){let a=n+r[0].length-1,l=Z3(e,n);if(l!==-1){let c=e.slice(a+1,l),u=K3(c,s,i);t+=`(?:${u})`,n=l+1;continue}}else if(o===")"||o===""){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Z3(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]==="["){for(r++;r<e.length&&e[r]!=="]";)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="(")n++;else if(e[r]===")"&&(n--,n===0))return r;r++}return-1}function K3(e,t,n){let r=e;return t.includes("i")&&(r=Q3(r)),r}function Q3(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r==="\\"){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r==="["){t+=r,n++,n<e.length&&e[n]==="^"&&(t+=e[n],n++);let s=[];for(;n<e.length&&e[n]!=="]";)if(e[n]==="\\")s.push(e[n]),n++,n<e.length&&(s.push(e[n]),n++);else if(e[n]==="-"&&s.length>0&&n+1<e.length&&e[n+1]!=="]"){let i=s[s.length-1],o=e[n+1];s.push("-"),s.push(o),/[a-z]/.test(i)&&/[a-z]/.test(o)?(s.push(i.toUpperCase()),s.push("-"),s.push(o.toUpperCase())):/[A-Z]/.test(i)&&/[A-Z]/.test(o)&&(s.push(i.toLowerCase()),s.push("-"),s.push(o.toLowerCase())),n+=2}else{let i=e[n];if(s.push(i),/[a-zA-Z]/.test(i)){let o=i===i.toLowerCase()?i.toUpperCase():i.toLowerCase();s.includes(o)||s.push(o)}n++}t+=s.join(""),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let s=r.toLowerCase(),i=r.toUpperCase();t+=`[${i}${s}]`}else t+=r;n++}return t}function X3(e){let t=Y3(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=J3(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function Y3(e){let t=0;for(;t<e.length-1;)if(e[t]==="\\"){if(e[t+1]==="K"){let n=0,r=t-1;for(;r>=0&&e[r]==="\\";)n++,r--;if(n%2===0)return t}t+=2}else t++;return-1}function J3(e){let t=0,n=0;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]==="["){for(n++;n<e.length&&e[n]!=="]";)e[n]==="\\"&&n++,n++;n++;continue}if(e[n]==="(")if(n+1<e.length&&e[n+1]==="?"){if(n+2<e.length){let r=e[n+2];if(r===":"||r==="="||r==="!"){n++;continue}if(r==="<"&&n+3<e.length){let s=e[n+3];if(s==="="||s==="!"){n++;continue}t++,n++;continue}}}else t++;n++}return t}function xl(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function e8(e){let t="",n=0,r=!0,s=0;for(;n<e.length;){let i=e[n];if(i==="["){for(t+=i,n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(t+=e[n],n++),n<e.length&&e[n]==="]"&&(t+=e[n],n++);n<e.length&&e[n]!=="]";)e[n]==="\\"&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]==="]"&&(t+=e[n],n++),r=!1;continue}if(i==="\\"&&n+1<e.length){let o=e[n+1];if(o==="|"){t+="|",n+=2,r=!0;continue}if(o==="("){t+="(",n+=2,s++,r=!0;continue}if(o===")"){t+=")",n+=2,s=Math.max(0,s-1),r=!1;continue}if(o==="{"){let l=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(l){let c=l[1],u=l[2]!==void 0,f=l[3]||"";u?t+=`{${c},${f}}`:t+=`{${c}}`,n+=l[0].length,r=!1;continue}t+="\\{",n+=2,r=!1;continue}if(o==="}"){t+="\\}",n+=2,r=!1;continue}t+=i+o,n+=2,r=!1;continue}if(i==="*"&&r){t+="\\*",n++;continue}if(i==="^"){if(r){t+="^",n++;continue}t+="\\^",n++;continue}if(i==="$"){let o=n===e.length-1,a=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";o||a?t+="$":t+="\\$",n++,r=!1;continue}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?t+=`\\${i}`:t+=i,n++,r=!1}return t}var W3,hp=I(()=>{"use strict";Qe();W3=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]])});var El=I(()=>{"use strict";fp();hp()});var Ji={};ee(Ji,{egrepCommand:()=>s8,egrepFlagsForFuzzing:()=>a8,fgrepCommand:()=>r8,fgrepFlagsForFuzzing:()=>o8,flagsForFuzzing:()=>i8,grepCommand:()=>Al});async function mp(e,t,n,r,s=0){if(s>=dp)return;let i=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(i)).isDirectory){let l=e.split("/").pop()||"";if(t){let c=t.replace(/^\//,"");Lt(l,c,{stripQuotes:!0})&&r.push(e)}return}let a=await n.fs.readdir(i);for(let l of a){let c=e==="."?l:`${e}/${l}`,u=n.fs.resolvePath(n.cwd,c);if((await n.fs.stat(u)).isDirectory)await mp(c,t,n,r,s+1);else if(t){let p=t.replace(/^\//,"");Lt(l,p,{stripQuotes:!0})&&r.push(c)}}}catch{}}async function n8(e,t){let n=[],r=e.lastIndexOf("/"),s,i;if(r===-1?(s=t.cwd,i=e):(s=e.slice(0,r)||"/",i=e.slice(r+1)),e.includes("**")){let a=[],l=e.split("**"),c=l[0].replace(/\/$/,"")||".",u=l[1]||"";return await mp(c,u,t,a),a.map(f=>({path:f}))}let o=t.fs.resolvePath(t.cwd,s);try{if(t.fs.readdirWithFileTypes){let a=await t.fs.readdirWithFileTypes(o);for(let l of a)if(Lt(l.name,i,{stripQuotes:!0})){let c=r===-1?l.name:`${s}/${l.name}`;n.push({path:c,isFile:l.isFile})}}else{let a=await t.fs.readdir(o);for(let l of a)if(Lt(l,i,{stripQuotes:!0})){let c=r===-1?l:`${s}/${l}`;n.push({path:c})}}}catch{}return n.sort((a,l)=>a.path.localeCompare(l.path))}async function Yi(e,t,n=[],r=[],s=[],i,o=0){if(o>=dp)return[];let a=t.fs.resolvePath(t.cwd,e),l=[];try{let c,u;if(i!==void 0)c=i,u=!i;else{let p=await t.fs.stat(a);c=p.isFile,u=p.isDirectory}if(c){let p=e.split("/").pop()||e;return r.length>0&&r.some(h=>Lt(p,h,{stripQuotes:!0}))?[]:n.length>0&&!n.some(h=>Lt(p,h,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!u)return[];let f=e.split("/").pop()||e;if(s.length>0&&s.some(p=>Lt(f,p,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let p=await t.fs.readdirWithFileTypes(a);for(let h of p){if(h.name.startsWith("."))continue;let d=e==="."?h.name:`${e}/${h.name}`,m=await Yi(d,t,n,r,s,h.isFile,o+1);l.push(...m)}}else{let p=await t.fs.readdir(a);for(let h of p){if(h.startsWith("."))continue;let d=e==="."?h:`${e}/${h}`,m=await Yi(d,t,n,r,s,void 0,o+1);l.push(...m)}}}catch{}return l}var t8,Al,dp,r8,s8,i8,o8,a8,eo=I(()=>{"use strict";ye();bl();ae();El();t8={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},Al={name:"grep",async execute(e,t){if(W(e))return B(t8);let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=0,w=0,b=0,x=[],A=[],C=[],$=null,D=[];for(let j=0;j<e.length;j++){let te=e[j];if(te.startsWith("-")&&te!=="-"){if(te==="-e"&&j+1<e.length){$=e[++j];continue}if(te.startsWith("--include=")){x.push(te.slice(10));continue}if(te.startsWith("--exclude=")){A.push(te.slice(10));continue}if(te.startsWith("--exclude-dir=")){C.push(te.slice(14));continue}if(te.startsWith("--max-count=")){y=parseInt(te.slice(12),10);continue}let Se=te.match(/^-m(\d+)$/);if(Se){y=parseInt(Se[1],10);continue}if(te==="-m"&&j+1<e.length){y=parseInt(e[++j],10);continue}let oe=te.match(/^-([ABC])(\d+)$/);if(oe){let G=parseInt(oe[2],10);oe[1]==="A"?b=G:oe[1]==="B"?w=G:oe[1]==="C"&&(w=G,b=G);continue}if((te==="-A"||te==="-B"||te==="-C")&&j+1<e.length){let G=parseInt(e[++j],10);te==="-A"?b=G:te==="-B"?w=G:(w=G,b=G);continue}let $e=te.startsWith("--")?[te]:te.slice(1).split("");for(let G of $e)if(G==="i"||G==="--ignore-case")n=!0;else if(G==="n"||G==="--line-number")r=!0;else if(G==="v"||G==="--invert-match")s=!0;else if(G==="c"||G==="--count")i=!0;else if(G==="l"||G==="--files-with-matches")o=!0;else if(G==="L"||G==="--files-without-match")a=!0;else if(G==="r"||G==="R"||G==="--recursive")l=!0;else if(G==="w"||G==="--word-regexp")c=!0;else if(G==="x"||G==="--line-regexp")u=!0;else if(G==="E"||G==="--extended-regexp")f=!0;else if(G==="P"||G==="--perl-regexp")p=!0;else if(G==="F"||G==="--fixed-strings")h=!0;else if(G==="o"||G==="--only-matching")d=!0;else if(G==="h"||G==="--no-filename")m=!0;else if(G==="q"||G==="--quiet"||G==="--silent")g=!0;else{if(G.startsWith("--"))return Q("grep",G);if(G.length===1)return Q("grep",`-${G}`)}}else $===null?$=te:D.push(te)}if($===null)return{stdout:"",stderr:`grep: missing pattern
|
|
197
|
+
`,exitCode:2};let v=h?"fixed":f?"extended":p?"perl":"basic",P,k,N;try{let j=ri($,{mode:v,ignoreCase:n,wholeWord:c,lineRegexp:u});P=j.regex,k=j.kResetGroup,N=j.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${$}
|
|
198
|
+
`,exitCode:2}}if(D.length===0&&t.stdin!==void 0){let j=hs(le(t.stdin),P,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:d,beforeContext:w,afterContext:b,maxCount:y,kResetGroup:k,preFilter:N});return g?{stdout:"",stderr:"",exitCode:j.matched?0:1}:{stdout:j.output,stderr:"",exitCode:j.matched?0:1}}if(D.length===0)return{stdout:"",stderr:`grep: no input files
|
|
199
|
+
`,exitCode:2};let R="",O="",_=!1,M=!1,z=[];for(let j of D)if(j.includes("*")||j.includes("?")||j.includes("[")){let te=await n8(j,t);if(l)for(let Se of te){let oe=await Yi(Se.path,t,x,A,C,Se.isFile);z.push(...oe)}else z.push(...te)}else if(l){let te=await Yi(j,t,x,A,C);z.push(...te)}else z.push({path:j});let ie=(z.length>1||l)&&!m,me=50;for(let j=0;j<z.length;j+=me){let te=z.slice(j,j+me),Se=await Promise.all(te.map(async oe=>{let $e=oe.path,G=$e.split("/").pop()||$e;if(A.length>0&&!l&&A.some(Pe=>Lt(G,Pe,{stripQuotes:!0}))||x.length>0&&!l&&!x.some(Pe=>Lt(G,Pe,{stripQuotes:!0})))return null;try{let Pe=t.fs.resolvePath(t.cwd,$e),Ye=!1;if(oe.isFile===void 0?Ye=(await t.fs.stat(Pe)).isDirectory:Ye=!oe.isFile,Ye)return l?null:{error:`grep: ${$e}: Is a directory
|
|
200
|
+
`};let at=await t.fs.readFile(Pe);if(N&&!s){let st=N.ignoreCase?at.toLowerCase():at;if(!N.needles.some(tt=>st.includes(tt))){if(i){let tt=ie?`${$e}:0`:"0";return{file:$e,result:{output:`${tt}
|
|
201
|
+
`,matched:!1,matchCount:0}}}return{file:$e,result:{output:"",matched:!1,matchCount:0}}}}let dt=hs(at,P,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:ie?$e:"",onlyMatching:d,beforeContext:w,afterContext:b,maxCount:y,kResetGroup:k,preFilter:N});return{file:$e,result:dt}}catch{return{error:`grep: ${$e}: No such file or directory
|
|
202
|
+
`}}}));for(let oe of Se){if(oe===null)continue;if("error"in oe&&oe.error){O+=oe.error,oe.error.includes("Is a directory")||(M=!0);continue}if(!("file"in oe)||!oe.result)continue;let{file:$e,result:G}=oe;if(G.matched){if(_=!0,g)return{stdout:"",stderr:"",exitCode:0};o?R+=`${$e}
|
|
203
|
+
`:a||(R+=G.output)}else a?R+=`${$e}
|
|
204
|
+
`:i&&!o&&(R+=G.output)}}let q;return M?q=2:a?q=R.length>0?0:1:q=_?0:1,g?{stdout:"",stderr:"",exitCode:q}:{stdout:R,stderr:O,exitCode:q}}},dp=256;r8={name:"fgrep",async execute(e,t){return Al.execute(["-F",...e],t)}},s8={name:"egrep",async execute(e,t){return Al.execute(["-E",...e],t)}},i8={name:"grep",flags:[{flag:"-E",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-P",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-L",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"pattern"}],stdinType:"text",needsArgs:!0},o8={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},a8={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function yp(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function Fe(e){return!gp.has(e)}function He(e,t,n){yp(e,"safeSet"),Fe(t)&&(e[t]=n)}function Wn(e,t){return yp(e,"safeHasOwn"),Object.hasOwn(e,t)}function ds(e){let t=new WeakMap,n=r=>{if(r===null||typeof r!="object"||r instanceof Date)return r;let s=t.get(r);if(s!==void 0)return s;if(Array.isArray(r)){let o=[];t.set(r,o);for(let a of r)o.push(n(a));return o}let i=Object.create(null);t.set(r,i);for(let o of Object.keys(r))i[o]=n(r[o]);return i};return n(e)}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function wp(e){return Object.assign(Object.create(null),e)}function xt(e){return Object.assign(Object.create(null),e)}function Sl(...e){return Object.assign(Object.create(null),...e)}var gp,UN,Cn=I(()=>{"use strict";gp=new Set(["__proto__","constructor","prototype"]),UN=new Set([...gp,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function xp(){let e=[];for(let[t,n]of Object.entries(bp).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
|
|
205
|
+
`)}
|
|
206
|
+
`}var bp,si,Cl=I(()=>{"use strict";Qe();Cn();bp=wp({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),si=class{types;constructor(){this.types=new Map(Object.entries(bp).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let r=t.slice(0,n),s=t.slice(n+1);if(s.startsWith("include:")){let i=s.slice(8),o=this.types.get(i);if(o){let a=this.types.get(r)||{extensions:[],globs:[]};a.extensions.push(...o.extensions),a.globs.push(...o.globs),this.types.set(r,a)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(s.startsWith("*.")&&!s.slice(2).includes("*")){let o=s.slice(1);i.extensions.includes(o)||i.extensions.push(o)}else i.globs.includes(s)||i.globs.push(s);this.types.set(r,i)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let r=t.toLowerCase();for(let s of n){if(s==="all"){if(this.matchesAnyType(t))return!0;continue}let i=this.types.get(s);if(i){for(let o of i.extensions)if(r.endsWith(o))return!0;for(let o of i.globs)if(o.includes("*")){let a=o.replace(/\./g,"\\.").replace(/\*/g,".*");if(X(`^${a}$`,"i").test(t))return!0}else if(r===o.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let r of this.types.values()){for(let s of r.extensions)if(n.endsWith(s))return!0;for(let s of r.globs)if(s.includes("*")){let i=s.replace(/\./g,"\\.").replace(/\*/g,".*");if(X(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function Ep(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var Ap=I(()=>{"use strict"});function l8(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function c8(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
|
|
207
|
+
`,exitCode:1}}function Sp(e){return null}function p8(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function h8(e,t,n){let r=e[t];for(let s of Cp){if(r.startsWith(`--${s.long}=`)){let i=r.slice(`--${s.long}=`.length),o=to(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r.startsWith(`-${s.short}`)&&r.length>2){let i=r.slice(2),o=to(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r===`-${s.short}`||r===`--${s.long}`){if(t+1>=e.length)return null;let i=e[t+1],o=to(n,s,i);return o?{newIndex:t+1,error:o}:{newIndex:t+1}}}return null}function d8(e){return Cp.find(t=>t.short===e)}function to(e,t,n){if(t.validate){let s=t.validate(n);if(s)return s}if(t.ignored||!t.target)return;let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function m8(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let r=e[t+1];if(r==="path"||r==="none")return{value:r,newIndex:t+1}}if(n.startsWith("--sort=")){let r=n.slice(7);if(r==="path"||r==="none")return{value:r,newIndex:t}}return null}function g8(e,t){let n=e[t],r=n.match(/^-([ABC])(\d+)$/);return r?{flag:r[1],value:parseInt(r[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function y8(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function vp(e){let t=Ep(),n=null,r=[],s=-1,i=-1,o=-1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c.startsWith("-")&&c!=="-"){let u=g8(e,l);if(u){let{flag:g,value:y,newIndex:w}=u;g==="A"?s=Math.max(s,y):g==="B"?i=Math.max(i,y):o=y,l=w;continue}let f=y8(c);if(f!==null){t.maxCount=f;continue}let p=h8(e,l,t);if(p){if(p.error)return{success:!1,error:p.error};l=p.newIndex;continue}let h=m8(e,l);if(h){t.sort=h.value,l=h.newIndex;continue}let d=c.startsWith("--")?[c]:c.slice(1).split(""),m=!1;for(let g of d){if(f8.has(g)){t.lineNumber=!0,a=!0;continue}if(g==="u"||g==="--unrestricted"){p8(t);continue}if(g==="P"||g==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
|
|
208
|
+
`,exitCode:1}};if(g.length===1){let w=d8(g);if(w){if(l+1>=e.length)return{success:!1,error:Q("rg",`-${g}`)};let b=to(t,w,e[l+1]);if(b)return{success:!1,error:b};l++,m=!0;continue}}let y=u8.get(g);if(y){y(t);continue}if(g.startsWith("--"))return{success:!1,error:Q("rg",g)};if(g.length===1)return{success:!1,error:Q("rg",`-${g}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=c:r.push(c)}return(s>=0||o>=0)&&(t.afterContext=Math.max(s>=0?s:0,o>=0?o:0)),(i>=0||o>=0)&&(t.beforeContext=Math.max(i>=0?i:0,o>=0?o:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(a=!0),{success:!0,options:t,paths:r,explicitLineNumbers:a}}var Cp,u8,f8,kp=I(()=>{"use strict";ae();Ap();Cp=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:Sp},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:Sp},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:l8,validate:c8},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",ignored:!0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],u8=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),f8=new Set(["n","--line-number"])});function w8(e){return`'${e.replace(/'/g,"'\\''")}'`}function rn(e){return e.map(w8).join(" ")}var Dr=I(()=>{"use strict"});async function vl(e,t,n=!1,r=!1,s=[]){let i=new oi(e,t,n,r);await i.load(t);for(let o of s)try{let a=e.resolvePath(t,o),l=await e.readFile(a);i.addPatternsFromContent(l,t)}catch{}return i}var ii,oi,Np=I(()=>{"use strict";Qe();ii=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
|
|
209
|
+
`);for(let r of n){let s=r.replace(/\s+$/,"");if(!s||s.startsWith("#"))continue;let i=!1;s.startsWith("!")&&(i=!0,s=s.slice(1));let o=!1;s.endsWith("/")&&(o=!0,s=s.slice(0,-1));let a=!1;s.startsWith("/")?(a=!0,s=s.slice(1)):s.includes("/")&&!s.startsWith("**/")&&(a=!0);let l=this.patternToRegex(s,a);this.patterns.push({pattern:r,regex:l,negated:i,directoryOnly:o,rooted:a})}}patternToRegex(t,n){let r="";n?r="^":r="(?:^|/)";let s=0;for(;s<t.length;){let i=t[s];if(i==="*")t[s+1]==="*"?t[s+2]==="/"?(r+="(?:.*/)?",s+=3):(s+2>=t.length,r+=".*",s+=2):(r+="[^/]*",s++);else if(i==="?")r+="[^/]",s++;else if(i==="["){let o=s+1;for(o<t.length&&t[o]==="!"&&o++,o<t.length&&t[o]==="]"&&o++;o<t.length&&t[o]!=="]";)o++;if(o<t.length){let a=t.slice(s,o+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),r+=a,s=o+1}else r+="\\[",s++}else i==="/"?(r+="/",s++):(r+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s++)}return r+="(?:/.*)?$",X(r)}matches(t,n){let r=t.replace(/^\.\//,"");r=r.replace(/^\//,"");let s=!1;for(let i of this.patterns)i.directoryOnly&&!n||i.regex.test(r)&&(s=!i.negated);return s}isWhitelisted(t,n){let r=t.replace(/^\.\//,"");r=r.replace(/^\//,"");for(let s of this.patterns)if(!(s.directoryOnly&&!n)&&s.negated&&s.regex.test(r))return!0;return!1}getBasePath(){return this.basePath}},oi=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,r=!1,s=!1){this.fs=t,this.skipDotIgnore=r,this.skipVcsIgnore=s}async load(t){let n=[],r=t;for(;;){n.unshift(r);let i=this.fs.resolvePath(r,"..");if(i===r)break;r=i}let s=[];this.skipVcsIgnore||s.push(".gitignore"),this.skipDotIgnore||s.push(".rgignore",".ignore");for(let i of n){this.loadedDirs.add(i);for(let o of s){let a=this.fs.resolvePath(i,o);try{let l=await this.fs.readFile(a),c=new ii(i);c.parse(l),this.parsers.push(c)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let r of n){let s=this.fs.resolvePath(t,r);try{let i=await this.fs.readFile(s),o=new ii(t);o.parse(i),this.parsers.push(o)}catch{}}}addPatternsFromContent(t,n){let r=new ii(n);r.parse(t),this.parsers.push(r)}matches(t,n){for(let r of this.parsers){let s=r.getBasePath();if(!t.startsWith(s))continue;let i=t.slice(s.length).replace(/^\//,"");if(r.matches(i,n))return!0}return!1}isWhitelisted(t,n){for(let r of this.parsers){let s=r.getBasePath();if(!t.startsWith(s))continue;let i=t.slice(s.length).replace(/^\//,"");if(r.isWhitelisted(i,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}}});import{gunzipSync as b8}from"node:zlib";function x8(e){return e.length>=2&&e[0]===31&&e[1]===139}function E8(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r==="["&&!t?t=!0:r==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function Ip(e){let{ctx:t,options:n,paths:r,explicitLineNumbers:s}=e;for(let g of n.globs){let y=g.startsWith("!")?g.slice(1):g,w=E8(y);if(w)return{stdout:"",stderr:`${w}
|
|
210
|
+
`,exitCode:1}}if(n.files){let g=[...n.patterns,...r];return C8(t,g,n)}let i=[...n.patterns];for(let g of n.patternFiles)try{let y;if(g==="-")y=le(t.stdin);else{let b=t.fs.resolvePath(t.cwd,g);y=await t.fs.readFile(b)}let w=y.split(`
|
|
211
|
+
`).filter(b=>b.length>0);i.push(...w)}catch{return{stdout:"",stderr:`rg: ${g}: No such file or directory
|
|
212
|
+
`,exitCode:2}}if(i.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
|
|
213
|
+
`,exitCode:2};let o=r.length===0?["."]:r,a=A8(n,i),l,c;try{let g=S8(i,n,a);l=g.regex,c=g.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${i.join(", ")}
|
|
214
|
+
`,exitCode:2}}let u=null;n.noIgnore||(u=await vl(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let f=new si;for(let g of n.typeClear)f.clearType(g);for(let g of n.typeAdd)f.addType(g);let{files:p,singleExplicitFile:h}=await $p(t,o,n,u,f);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let d=!n.noFilename&&(n.withFilename||!h||p.length>1),m=n.lineNumber;return s||(h&&p.length===1&&(m=!1),n.onlyMatching&&(m=!1)),N8(t,p,l,n,d,m,c)}function A8(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function S8(e,t,n){let r;return e.length===1?r=e[0]:r=e.map(s=>t.fixedStrings?s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${s})`).join("|"),ri(r,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function $p(e,t,n,r,s){let i=[],o=0,a=0;for(let c of t){let u=e.fs.resolvePath(e.cwd,c);try{let f=await e.fs.stat(u);if(f.isFile){if(o++,n.maxFilesize>0&&f.size>n.maxFilesize)continue;Op(c,n,r,u,s)&&i.push(c)}else f.isDirectory&&(a++,await Tp(e,c,u,0,n,r,s,i))}catch{}}return{files:n.sort==="path"?i.sort():i,singleExplicitFile:o===1&&a===0}}async function Tp(e,t,n,r,s,i,o,a){if(!(r>=s.maxDepth)){i&&await i.loadForDirectory(n);try{let l=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(c=>({name:c,isFile:void 0}));for(let c of l){let u=c.name;if(!s.noIgnore&&oi.isCommonIgnored(u))continue;let f=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,h=e.fs.resolvePath(n,u),d,m,g=!1;if(c.isFile!==void 0&&"isDirectory"in c){let b=c;if(g=b.isSymbolicLink===!0,g&&!s.followSymlinks)continue;if(g&&s.followSymlinks)try{let x=await e.fs.stat(h);d=x.isFile,m=x.isDirectory}catch{continue}else d=b.isFile,m=b.isDirectory}else try{let b=e.fs.lstat?await e.fs.lstat(h):await e.fs.stat(h);if(g=b.isSymbolicLink===!0,g&&!s.followSymlinks)continue;let x=g&&s.followSymlinks?await e.fs.stat(h):b;d=x.isFile,m=x.isDirectory}catch{continue}if(!i?.matches(h,m)&&!(f&&!s.hidden&&!i?.isWhitelisted(h,m))){if(m)await Tp(e,p,h,r+1,s,i,o,a);else if(d){if(s.maxFilesize>0)try{if((await e.fs.stat(h)).size>s.maxFilesize)continue}catch{continue}Op(p,s,i,h,o)&&a.push(p)}}}}catch{}}}function Op(e,t,n,r,s){let i=e.split("/").pop()||e;if(n?.matches(r,!1)||t.types.length>0&&!s.matchesType(i,t.types)||t.typesNot.length>0&&s.matchesType(i,t.typesNot))return!1;if(t.globs.length>0){let o=t.globCaseInsensitive,a=t.globs.filter(c=>!c.startsWith("!")),l=t.globs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(a.length>0){let c=!1;for(let u of a)if(vn(i,u,o)||vn(e,u,o)){c=!0;break}if(!c)return!1}for(let c of l)if(c.startsWith("/")){let u=c.slice(1);if(vn(e,u,o))return!1}else if(vn(i,c,o)||vn(e,c,o))return!1}if(t.iglobs.length>0){let o=t.iglobs.filter(l=>!l.startsWith("!")),a=t.iglobs.filter(l=>l.startsWith("!")).map(l=>l.slice(1));if(o.length>0){let l=!1;for(let c of o)if(vn(i,c,!0)||vn(e,c,!0)){l=!0;break}if(!l)return!1}for(let l of a)if(l.startsWith("/")){let c=l.slice(1);if(vn(e,c,!0))return!1}else if(vn(i,l,!0)||vn(e,l,!0))return!1}return!0}function vn(e,t,n=!1){let r="^";for(let s=0;s<t.length;s++){let i=t[s];if(i==="*")t[s+1]==="*"?(r+=".*",s++):r+="[^/]*";else if(i==="?")r+="[^/]";else if(i==="["){let o=s+1;for(o<t.length&&t[o]==="!"&&o++,o<t.length&&t[o]==="]"&&o++;o<t.length&&t[o]!=="]";)o++;if(o<t.length){let a=t.slice(s,o+1);a.startsWith("[!")&&(a=`[^${a.slice(2)}`),r+=a,s=o}else r+="\\["}else r+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return r+="$",X(r,n?"i":"").test(e)}async function C8(e,t,n){let r=null;n.noIgnore||(r=await vl(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let s=new si;for(let c of n.typeClear)s.clearType(c);for(let c of n.typeAdd)s.addType(c);let i=t.length===0?["."]:t,{files:o}=await $p(e,i,n,r,s);if(o.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let a=n.nullSeparator?"\0":`
|
|
215
|
+
`;return{stdout:o.map(c=>c+a).join(""),stderr:"",exitCode:0}}function v8(e,t){if(t.length===0)return!0;for(let n of t)if(vn(e,n,!1))return!0;return!1}async function k8(e,t,n,r){try{if(r.preprocessor&&e.exec){let o=n.split("/").pop()||n;if(v8(o,r.preprocessorGlobs)){let a=await e.exec(rn([r.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(a.exitCode===0&&a.stdout){let l=le(a.stdout),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0")}}}}if(r.searchZip&&n.endsWith(".gz")){let o=await e.fs.readFileBuffer(t);if(x8(o))try{let a=b8(o),l=new TextDecoder().decode(a),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0")}}catch{return null}}let s=await e.fs.readFile(t),i=s.slice(0,8192);return{content:s,isBinary:i.includes("\0")}}catch{return null}}async function N8(e,t,n,r,s,i,o){let a="",l=!1,c=[],u=0,f=0,p=0,h=50;e:for(let g=0;g<t.length;g+=h){let y=t.slice(g,g+h),w=await Promise.all(y.map(async b=>{let x=e.fs.resolvePath(e.cwd,b),A=await k8(e,x,b,r);if(!A)return null;let{content:C,isBinary:$}=A;if(p+=C.length,$&&!r.searchBinary)return null;let D=s&&!r.heading?b:"",v=hs(C,n,{invertMatch:r.invertMatch,showLineNumbers:i,countOnly:r.count,countMatches:r.countMatches,filename:D,onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace!==null?xl(r.replace):null,passthru:r.passthru,multiline:r.multiline,kResetGroup:o});return r.json&&v.matched?{file:b,result:v,content:C,isBinary:!1}:{file:b,result:v}}));for(let b of w){if(!b)continue;let{file:x,result:A}=b;if(A.matched){if(l=!0,f++,u+=A.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let C=b.content||"";c.push(JSON.stringify({type:"begin",data:{path:{text:x}}}));let $=C.split(`
|
|
216
|
+
`);n.lastIndex=0;let D=0;for(let v=0;v<$.length;v++){let P=$[v];n.lastIndex=0;let k=[];for(let N=n.exec(P);N!==null;N=n.exec(P)){let R={match:{text:N[0]},start:N.index,end:N.index+N[0].length};r.replace!==null&&(R.replacement={text:r.replace}),k.push(R),N[0].length===0&&n.lastIndex++}if(k.length>0){let N={type:"match",data:{path:{text:x},lines:{text:`${P}
|
|
217
|
+
`},line_number:v+1,absolute_offset:D,submatches:k}};c.push(JSON.stringify(N))}D+=P.length+1}c.push(JSON.stringify({type:"end",data:{path:{text:x},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:C.length,bytes_printed:0,matched_lines:A.matchCount,matches:A.matchCount}}}))}else if(r.filesWithMatches){let C=r.nullSeparator?"\0":`
|
|
218
|
+
`;a+=`${x}${C}`}else r.filesWithoutMatch||(r.heading&&!r.noFilename&&(a+=`${x}
|
|
219
|
+
`),a+=A.output)}else if(r.filesWithoutMatch){let C=r.nullSeparator?"\0":`
|
|
220
|
+
`;a+=`${x}${C}`}else r.includeZero&&(r.count||r.countMatches)&&(a+=A.output)}}r.json&&(c.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:f,bytes_searched:p,bytes_printed:0,matched_lines:u,matches:u}}})),a=`${c.join(`
|
|
221
|
+
`)}
|
|
222
|
+
`);let d=r.quiet&&!r.json?"":a;if(r.stats&&!r.json){let g=["",`${u} matches`,`${u} matched lines`,`${f} files contained matches`,`${t.length} files searched`,`${p} bytes searched`].join(`
|
|
223
|
+
`);d+=`${g}
|
|
224
|
+
`}let m;return r.filesWithoutMatch?m=a.length>0?0:1:m=l?0:1,{stdout:d,stderr:"",exitCode:m}}var Rp=I(()=>{"use strict";ye();Dr();Qe();El();Cl();Np()});var Pp={};ee(Pp,{flagsForFuzzing:()=>T8,rgCommand:()=>$8});var I8,$8,T8,Dp=I(()=>{"use strict";ae();Cl();kp();Rp();I8={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
|
|
225
|
+
Unlike grep, rg is recursive by default and respects .gitignore files.
|
|
226
|
+
|
|
227
|
+
EXAMPLES:
|
|
228
|
+
rg foo Search for 'foo' in current directory
|
|
229
|
+
rg foo src/ Search in src/ directory
|
|
230
|
+
rg -i foo Case-insensitive search
|
|
231
|
+
rg -w foo Match whole words only
|
|
232
|
+
rg -t js foo Search only JavaScript files
|
|
233
|
+
rg -g '*.ts' foo Search files matching glob
|
|
234
|
+
rg --hidden foo Include hidden files
|
|
235
|
+
rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},$8={name:"rg",async execute(e,t){if(W(e))return B(I8);if(e.includes("--type-list"))return{stdout:xp(),stderr:"",exitCode:0};let n=vp(e);return n.success?Ip({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},T8={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0}});function lt(e,t,n){if(!e||bt.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new de(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:bt.getCurrentExecutionId()})}async function Rt(e,t,n,r){lt(e,t,`${n} (pre-await)`);let s=await r();return lt(e,t,`${n} (post-await)`),s}var zn=I(()=>{"use strict";cn()});function Il(e){let t="",n=0,r=!1;for(;n<e.length;){if(e[n]==="["&&!r){if(e[n+1]==="["&&e[n+2]===":"){let s=e.indexOf(":]]",n+3);if(s!==-1){let i=e.slice(n+3,s),o=Nl.get(i);if(o){t+=`[${o}]`,n=s+3;continue}}}if(e[n+1]==="^"&&e[n+2]==="["&&e[n+3]===":"){let s=e.indexOf(":]]",n+4);if(s!==-1){let i=e.slice(n+4,s),o=Nl.get(i);if(o){t+=`[^${o}]`,n=s+3;continue}}}t+="[",n++,r=!0,n<e.length&&e[n]==="^"&&(t+="^",n++),n<e.length&&e[n]==="]"&&(t+="\\]",n++);continue}if(r){if(e[n]==="]"){t+="]",n++,r=!1;continue}if(e[n]==="["&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=Nl.get(i);if(o){t+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]==="\\"&&n+1<e.length){let s=e[n+1];if(s==="+"||s==="?"||s==="|"){t+=s,n+=2;continue}if(s==="("||s===")"){t+=s,n+=2;continue}if(s==="{"||s==="}"){t+=s,n+=2;continue}if(s==="t"){t+=" ",n+=2;continue}if(s==="n"){t+=`
|
|
236
|
+
`,n+=2;continue}if(s==="r"){t+="\r",n+=2;continue}t+=e[n]+s,n+=2;continue}if(e[n]==="+"||e[n]==="?"||e[n]==="|"||e[n]==="("||e[n]===")"){t+=`\\${e[n]}`,n++;continue}if(e[n]==="^"&&!(t===""||t.endsWith("("))){t+="\\^",n++;continue}if(e[n]==="$"){let s=n===e.length-1,i=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";if(!s&&!i){t+="\\$",n++;continue}}t+=e[n],n++}return t}function $l(e){let t="",n=!1;for(let r=0;r<e.length;r++)e[r]==="["&&!n?(n=!0,t+="[",r++,r<e.length&&e[r]==="^"&&(t+="^",r++),r<e.length&&e[r]==="]"&&(t+="]",r++),r--):e[r]==="]"&&n?(n=!1,t+="]"):!n&&e[r]==="{"&&e[r+1]===","?(t+="{0,",r++):t+=e[r];return t}function _p(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=r.charCodeAt(0);r==="\\"?t+="\\\\":r===" "?t+="\\t":r===`
|
|
237
|
+
`?t+=`$
|
|
238
|
+
`:r==="\r"?t+="\\r":r==="\x07"?t+="\\a":r==="\b"?t+="\\b":r==="\f"?t+="\\f":r==="\v"?t+="\\v":s<32||s>=127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return`${t}$`}var Nl,Fp=I(()=>{"use strict";Nl=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function Mp(e,t,n){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:n||new Map,linesConsumedInCycle:0}}function R8(e){return typeof e=="object"&&"first"in e&&"step"in e}function P8(e){return typeof e=="object"&&"offset"in e}function ms(e,t,n,r,s){if(e==="$")return t===n;if(typeof e=="number")return t===e;if(R8(e)){let{first:i,step:o}=e;return o===0?t===i:(t-i)%o===0&&t>=i}if(typeof e=="object"&&"pattern"in e)try{let i=e.pattern;i===""&&s?.lastPattern?i=s.lastPattern:i!==""&&s&&(s.lastPattern=i);let o=$l(Il(i));return X(o).test(r)}catch{return!1}return!1}function Tl(e){let t=n=>n===void 0?"undefined":n==="$"?"$":typeof n=="number"?String(n):"pattern"in n?`/${n.pattern}/`:"first"in n?`${n.first}~${n.step}`:"unknown";return`${t(e.start)},${t(e.end)}`}function D8(e,t,n,r,s,i){if(!e||!e.start&&!e.end)return!0;let o=e.start,a=e.end;if(o!==void 0&&a===void 0)return ms(o,t,n,r,i);if(o!==void 0&&a!==void 0){let l=typeof o=="object"&&"pattern"in o,c=typeof a=="object"&&"pattern"in a,u=P8(a);if(u&&s){let p=Tl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active){let d=h.startLine||t;return t>=d+a.offset&&(h.active=!1,s.set(p,h)),!0}else return ms(o,t,n,r,i)?(h.active=!0,h.startLine=t,s.set(p,h),a.offset===0&&(h.active=!1,s.set(p,h)),!0):!1}if(!l&&!c&&!u){let p=typeof o=="number"?o:o==="$"?n:1,h=typeof a=="number"?a:n;if(p<=h)return t>=p&&t<=h;if(s){let d=Tl(e),m=s.get(d);return m||(m={active:!1},s.set(d,m)),!m.completed&&t>=p?(m.completed=!0,s.set(d,m),!0):!1}return!1}if(s){let p=Tl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active)return ms(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0;{if(h.completed)return!1;let d=!1;return typeof o=="number"?d=t>=o:d=ms(o,t,n,r,i),d?(h.active=!0,h.startLine=t,s.set(p,h),ms(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0):!1}}return ms(o,t,n,r,i)}return!0}function _r(e,t,n,r,s,i){let o=D8(e,t,n,r,s,i);return e?.negated?!o:o}function _8(e,t,n,r){let s="",i=0,o=!1;for(;i<=e.length;){t.lastIndex=i;let a=t.exec(e);if(!a){s+=e.slice(i);break}if(a.index!==i){s+=e.slice(i,a.index),i=a.index,o=!1;continue}let l=a[0],c=a.slice(1);if(o&&l.length===0){if(i<e.length)s+=e[i],i++;else break;o=!1;continue}if(s+=r(l,c),o=!1,l.length===0)if(i<e.length)s+=e[i],i++;else break;else i+=l.length,o=!0}return s}function Ol(e,t,n){let r="",s=0;for(;s<e.length;){if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];if(i==="&"){r+="&",s+=2;continue}if(i==="n"){r+=`
|
|
239
|
+
`,s+=2;continue}if(i==="t"){r+=" ",s+=2;continue}if(i==="r"){r+="\r",s+=2;continue}let o=parseInt(i,10);if(o===0){r+=t,s+=2;continue}if(o>=1&&o<=9){r+=n[o-1]||"",s+=2;continue}r+=i,s+=2;continue}if(e[s]==="&"){r+=t,s++;continue}r+=e[s],s++}return r}function Lp(e,t,n){if(t>0&&e.length>t)throw new K(`sed: ${n} size limit exceeded (${t} bytes)`,"string_length")}function F8(e,t,n){let{lineNumber:r,totalLines:s,patternSpace:i}=t;if(e.type==="label"){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(_r(e.address,r,s,i,t.rangeStates,t))switch(t.coverage?.hit(`sed:cmd:${e.type}`),e.type){case"substitute":{let o=e,a="";o.global&&(a+="g"),o.ignoreCase&&(a+="i");let l=o.pattern;l===""&&t.lastPattern?l=t.lastPattern:l!==""&&(t.lastPattern=l);let c=$l(o.extendedRegex?l:Il(l));try{let u=X(c,a),f=u.test(t.patternSpace);if(u.lastIndex=0,f){if(t.substitutionMade=!0,o.nthOccurrence&&o.nthOccurrence>0&&!o.global){let p=0,h=o.nthOccurrence,d=X(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=d.replace(t.patternSpace,(m,...g)=>{if(p++,p===h){let y=g.slice(0,-2);return Ol(o.replacement,m,y)}return m})}else if(o.global){let p=X(c,`g${o.ignoreCase?"i":""}`);t.patternSpace=_8(t.patternSpace,p,o.replacement,(h,d)=>Ol(o.replacement,h,d))}else t.patternSpace=u.replace(t.patternSpace,(p,...h)=>{let d=h.slice(0,-2);return Ol(o.replacement,p,d)});o.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case"print":t.lineNumberOutput.push(t.patternSpace);break;case"printFirstLine":{let o=t.patternSpace.indexOf(`
|
|
240
|
+
`);o!==-1?t.lineNumberOutput.push(t.patternSpace.slice(0,o)):t.lineNumberOutput.push(t.patternSpace);break}case"delete":t.deleted=!0;break;case"deleteFirstLine":{let o=t.patternSpace.indexOf(`
|
|
241
|
+
`);o!==-1?(t.patternSpace=t.patternSpace.slice(o+1),t.restartCycle=!0,t.inDRestartedCycle=!0):t.deleted=!0;break}case"zap":t.patternSpace="";break;case"append":t.appendBuffer.push(e.text);break;case"insert":t.appendBuffer.unshift(`__INSERT__${e.text}`);break;case"change":t.deleted=!0,t.changedText=e.text;break;case"hold":t.holdSpace=t.patternSpace;break;case"holdAppend":t.holdSpace?t.holdSpace+=`
|
|
242
|
+
${t.patternSpace}`:t.holdSpace=t.patternSpace,Lp(t.holdSpace,n?.maxStringLength??0,"hold space");break;case"get":t.patternSpace=t.holdSpace;break;case"getAppend":t.patternSpace+=`
|
|
243
|
+
${t.holdSpace}`,Lp(t.patternSpace,n?.maxStringLength??0,"pattern space");break;case"exchange":{let o=t.patternSpace;t.patternSpace=t.holdSpace,t.holdSpace=o;break}case"next":t.printed=!0;break;case"quit":t.quit=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"quitSilent":t.quit=!0,t.quitSilent=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case"list":{let o=_p(t.patternSpace);t.lineNumberOutput.push(o);break}case"printFilename":t.currentFilename&&t.lineNumberOutput.push(t.currentFilename);break;case"version":{let o=[4,8,0];if(e.minVersion){let a=e.minVersion.split("."),l=[],c=!1;for(let u of a){let f=parseInt(u,10);if(Number.isNaN(f)||f<0){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: invalid version string: ${e.minVersion}`,c=!0;break}l.push(f)}if(!c){for(;l.length<3;)l.push(0);for(let u=0;u<3;u++){if(l[u]>o[u]){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: this is not GNU sed version ${e.minVersion}`;break}if(l[u]<o[u])break}}}break}case"readFile":t.pendingFileReads.push({filename:e.filename,wholeFile:!0});break;case"readFileLine":t.pendingFileReads.push({filename:e.filename,wholeFile:!1});break;case"writeFile":t.pendingFileWrites.push({filename:e.filename,content:`${t.patternSpace}
|
|
244
|
+
`});break;case"writeFirstLine":{let o=t.patternSpace.indexOf(`
|
|
245
|
+
`),a=o!==-1?t.patternSpace.slice(0,o):t.patternSpace;t.pendingFileWrites.push({filename:e.filename,content:`${a}
|
|
246
|
+
`});break}case"execute":t.errorMessage="sed: e command (shell execution) is not supported in sandboxed environment",t.quit=!0;break;case"transliterate":t.patternSpace=L8(t.patternSpace,e);break;case"lineNumber":t.lineNumberOutput.push(String(t.lineNumber));break;case"branch":break;case"branchOnSubst":break;case"branchOnNoSubst":break;case"group":break}}function L8(e,t){let n="";for(let r of e){let s=t.source.indexOf(r);s!==-1?n+=t.dest[s]:n+=r}return n}function Rl(e,t,n,r){let s=new Map;for(let l=0;l<e.length;l++){let c=e[l];c.type==="label"&&s.set(c.name,l)}let i=r?.maxIterations??O8,o=0,a=0;for(;a<e.length;){if(o++,o>i)throw new K(`sed: command execution exceeded maximum iterations (${i})`,"iterations");if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let l=e[a];if(l.type==="next"){if(_r(l.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit("sed:cmd:next"),t.nCommandOutput.push(t.patternSpace),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let c=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace=c,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1,t.substitutionMade=!1}else{t.quit=!0,t.deleted=!0;break}a++;continue}if(l.type==="nextAppend"){if(_r(l.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit("sed:cmd:nextAppend"),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let c=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace+=`
|
|
247
|
+
${c}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}a++;continue}if(l.type==="branch"){let c=l;if(_r(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)){if(t.coverage?.hit("sed:cmd:branch"),c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="branchOnSubst"){let c=l;if(_r(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:branchOnSubst"),t.substitutionMade)){if(t.substitutionMade=!1,c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="branchOnNoSubst"){let c=l;if(_r(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:branchOnNoSubst"),!t.substitutionMade)){if(c.label){let u=s.get(c.label);if(u!==void 0){a=u;continue}t.branchRequest=c.label;break}break}a++;continue}if(l.type==="group"){let c=l;if(_r(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit("sed:cmd:group"),Rl(c.commands,t,n,r),t.branchRequest)){let u=s.get(t.branchRequest);if(u!==void 0){t.branchRequest=void 0,a=u;continue}break}a++;continue}F8(l,t,r),a++}return t.linesConsumedInCycle}var O8,Up=I(()=>{"use strict";we();Qe();Fp();O8=1e4});var ne,no,Bp=I(()=>{"use strict";(function(e){e.NUMBER="NUMBER",e.DOLLAR="DOLLAR",e.PATTERN="PATTERN",e.STEP="STEP",e.RELATIVE_OFFSET="RELATIVE_OFFSET",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.COMMA="COMMA",e.NEGATION="NEGATION",e.COMMAND="COMMAND",e.SUBSTITUTE="SUBSTITUTE",e.TRANSLITERATE="TRANSLITERATE",e.LABEL_DEF="LABEL_DEF",e.BRANCH="BRANCH",e.BRANCH_ON_SUBST="BRANCH_ON_SUBST",e.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",e.TEXT_CMD="TEXT_CMD",e.FILE_READ="FILE_READ",e.FILE_READ_LINE="FILE_READ_LINE",e.FILE_WRITE="FILE_WRITE",e.FILE_WRITE_LINE="FILE_WRITE_LINE",e.EXECUTE="EXECUTE",e.VERSION="VERSION",e.EOF="EOF",e.ERROR="ERROR"})(ne||(ne={}));no=class{input;pos=0;line=1;column=1;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&t.push(n)}return t.push(this.makeToken(ne.EOF,"")),t}makeToken(t,n,r){return{type:t,value:n,line:this.line,column:this.column,...r}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
248
|
+
`?(this.line++,this.column=1):this.column++,t}readEscapedString(t){let n="";for(;this.pos<this.input.length&&this.peek()!==t;)if(this.peek()==="\\"){this.advance();let r=this.advance();r==="n"?n+=`
|
|
249
|
+
`:r==="t"?n+=" ":n+=r}else{if(this.peek()===`
|
|
250
|
+
`)return null;n+=this.advance()}return n}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
251
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
|
|
252
|
+
`?(this.advance(),{type:ne.NEWLINE,value:`
|
|
253
|
+
`,line:t,column:n}):r===";"?(this.advance(),{type:ne.SEMICOLON,value:";",line:t,column:n}):r==="{"?(this.advance(),{type:ne.LBRACE,value:"{",line:t,column:n}):r==="}"?(this.advance(),{type:ne.RBRACE,value:"}",line:t,column:n}):r===","?(this.advance(),{type:ne.COMMA,value:",",line:t,column:n}):r==="!"?(this.advance(),{type:ne.NEGATION,value:"!",line:t,column:n}):r==="$"?(this.advance(),{type:ne.DOLLAR,value:"$",line:t,column:n}):this.isDigit(r)?this.readNumber():r==="+"&&this.isDigit(this.input[this.pos+1]||"")?this.readRelativeOffset():r==="/"?this.readPattern():r===":"?this.readLabelDef():this.readCommand()}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="~"){this.advance();let s="";for(;this.isDigit(this.peek());)s+=this.advance();let i=parseInt(r,10),o=parseInt(s,10)||0;return{type:ne.STEP,value:`${i}~${o}`,first:i,step:o,line:t,column:n}}return{type:ne.NUMBER,value:parseInt(r,10),line:t,column:n}}readRelativeOffset(){let t=this.line,n=this.column;this.advance();let r="";for(;this.isDigit(this.peek());)r+=this.advance();let s=parseInt(r,10)||0;return{type:ne.RELATIVE_OFFSET,value:`+${s}`,offset:s,line:t,column:n}}readPattern(){let t=this.line,n=this.column;this.advance();let r="",s=!1;for(;this.pos<this.input.length;){let i=this.peek();if(i==="/"&&!s)break;if(i==="\\")r+=this.advance(),this.pos<this.input.length&&this.peek()!==`
|
|
254
|
+
`&&(r+=this.advance());else{if(i===`
|
|
255
|
+
`)break;i==="["&&!s?(s=!0,r+=this.advance(),this.peek()==="^"&&(r+=this.advance()),this.peek()==="]"&&(r+=this.advance())):i==="]"&&s?(s=!1,r+=this.advance()):r+=this.advance()}}return this.peek()==="/"&&this.advance(),{type:ne.PATTERN,value:r,pattern:r,line:t,column:n}}readLabelDef(){let t=this.line,n=this.column;for(this.advance();this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
|
|
256
|
+
`||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:ne.LABEL_DEF,value:r,label:r,line:t,column:n}}readCommand(){let t=this.line,n=this.column,r=this.advance();switch(r){case"s":return this.readSubstitute(t,n);case"y":return this.readTransliterate(t,n);case"a":case"i":case"c":return this.readTextCommand(r,t,n);case"b":return this.readBranch(ne.BRANCH,"b",t,n);case"t":return this.readBranch(ne.BRANCH_ON_SUBST,"t",t,n);case"T":return this.readBranch(ne.BRANCH_ON_NO_SUBST,"T",t,n);case"r":return this.readFileCommand(ne.FILE_READ,"r",t,n);case"R":return this.readFileCommand(ne.FILE_READ_LINE,"R",t,n);case"w":return this.readFileCommand(ne.FILE_WRITE,"w",t,n);case"W":return this.readFileCommand(ne.FILE_WRITE_LINE,"W",t,n);case"e":return this.readExecute(t,n);case"p":case"P":case"d":case"D":case"h":case"H":case"g":case"G":case"x":case"n":case"N":case"q":case"Q":case"z":case"=":case"l":case"F":return{type:ne.COMMAND,value:r,line:t,column:n};case"v":return this.readVersion(t,n);default:return{type:ne.ERROR,value:r,line:t,column:n}}}readSubstitute(t,n){let r=this.advance();if(!r||r===`
|
|
257
|
+
`)return{type:ne.ERROR,value:"s",line:t,column:n};let s="",i=!1;for(;this.pos<this.input.length;){let l=this.peek();if(l===r&&!i)break;if(l==="\\")this.advance(),this.pos<this.input.length&&this.peek()!==`
|
|
258
|
+
`?this.peek()===r&&!i?s+=this.advance():(s+="\\",s+=this.advance()):s+="\\";else{if(l===`
|
|
259
|
+
`)break;l==="["&&!i?(i=!0,s+=this.advance(),this.peek()==="^"&&(s+=this.advance()),this.peek()==="]"&&(s+=this.advance())):l==="]"&&i?(i=!1,s+=this.advance()):s+=this.advance()}}if(this.peek()!==r)return{type:ne.ERROR,value:"unterminated substitution pattern",line:t,column:n};this.advance();let o="";for(;this.pos<this.input.length&&this.peek()!==r;)if(this.peek()==="\\")if(this.advance(),this.pos<this.input.length){let l=this.peek();l==="\\"?(this.advance(),this.pos<this.input.length&&this.peek()===`
|
|
260
|
+
`?(o+=`
|
|
261
|
+
`,this.advance()):o+="\\"):l===`
|
|
262
|
+
`?(o+=`
|
|
263
|
+
`,this.advance()):o+=`\\${this.advance()}`}else o+="\\";else{if(this.peek()===`
|
|
264
|
+
`)break;o+=this.advance()}this.peek()===r&&this.advance();let a="";for(;this.pos<this.input.length;){let l=this.peek();if(l==="g"||l==="i"||l==="p"||l==="I"||this.isDigit(l))a+=this.advance();else break}return{type:ne.SUBSTITUTE,value:`s${r}${s}${r}${o}${r}${a}`,pattern:s,replacement:o,flags:a,line:t,column:n}}readTransliterate(t,n){let r=this.advance();if(!r||r===`
|
|
265
|
+
`)return{type:ne.ERROR,value:"y",line:t,column:n};let s=this.readEscapedString(r);if(s===null||this.peek()!==r)return{type:ne.ERROR,value:"unterminated transliteration source",line:t,column:n};this.advance();let i=this.readEscapedString(r);if(i===null||this.peek()!==r)return{type:ne.ERROR,value:"unterminated transliteration dest",line:t,column:n};this.advance();let o=this.peek();for(;o===" "||o===" ";)this.advance(),o=this.peek();return o!==""&&o!==";"&&o!==`
|
|
266
|
+
`&&o!=="}"?{type:ne.ERROR,value:"extra text at the end of a transform command",line:t,column:n}:{type:ne.TRANSLITERATE,value:`y${r}${s}${r}${i}${r}`,source:s,dest:i,line:t,column:n}}readTextCommand(t,n,r){let s=!1;this.peek()==="\\"&&this.pos+1<this.input.length&&(this.input[this.pos+1]===`
|
|
267
|
+
`||this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&(s=!0,this.advance()),(this.peek()===" "||this.peek()===" ")&&this.advance(),this.peek()==="\\"&&this.pos+1<this.input.length&&(this.input[this.pos+1]===" "||this.input[this.pos+1]===" ")&&this.advance(),s&&this.peek()===`
|
|
268
|
+
`&&this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===`
|
|
269
|
+
`){if(i.endsWith("\\")){i=`${i.slice(0,-1)}
|
|
270
|
+
`,this.advance();continue}break}if(o==="\\"&&this.pos+1<this.input.length){let a=this.input[this.pos+1];if(a==="n"){i+=`
|
|
271
|
+
`,this.advance(),this.advance();continue}if(a==="t"){i+=" ",this.advance(),this.advance();continue}if(a==="r"){i+="\r",this.advance(),this.advance();continue}}i+=this.advance()}return{type:ne.TEXT_CMD,value:t,text:i,line:n,column:r}}readBranch(t,n,r,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===" "||o===" "||o===`
|
|
272
|
+
`||o===";"||o==="}"||o==="{")break;i+=this.advance()}return{type:t,value:n,label:i||void 0,line:r,column:s}}readVersion(t,n){for(;this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
|
|
273
|
+
`||s===";"||s==="}"||s==="{")break;r+=this.advance()}return{type:ne.VERSION,value:"v",label:r||void 0,line:t,column:n}}readFileCommand(t,n,r,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let i="";for(;this.pos<this.input.length;){let o=this.peek();if(o===`
|
|
274
|
+
`||o===";")break;i+=this.advance()}return{type:t,value:n,filename:i.trim(),line:r,column:s}}readExecute(t,n){for(;this.peek()===" "||this.peek()===" ";)this.advance();let r="";for(;this.pos<this.input.length;){let s=this.peek();if(s===`
|
|
275
|
+
`||s===";")break;r+=this.advance()}return{type:ne.EXECUTE,value:"e",command:r.trim()||void 0,line:t,column:n}}isDigit(t){return t>="0"&&t<="9"}}});function Wp(e,t=!1){let n=!1,r=!1,s=[];for(let l=0;l<e.length;l++){let c=e[l];if(s.length===0&&l===0){let u=c.match(/^#([nr]+)\s*(?:\n|$)/i);if(u){let f=u[1].toLowerCase();f.includes("n")&&(n=!0),f.includes("r")&&(r=!0),c=c.slice(u[0].length)}}if(s.length>0&&s[s.length-1].endsWith("\\")){let u=s[s.length-1];s[s.length-1]=`${u}
|
|
276
|
+
${c}`}else s.push(c)}let i=s.join(`
|
|
277
|
+
`),a=new Pl([i],t||r).parse();if(!a.error&&a.commands.length>0){let l=M8(a.commands);if(l)return{commands:[],error:l,silentMode:n,extendedRegexMode:r}}return{...a,silentMode:n,extendedRegexMode:r}}function M8(e){let t=new Set;zp(e,t);let n=Hp(e,t);if(n)return`undefined label '${n}'`}function zp(e,t){for(let n of e)n.type==="label"?t.add(n.name):n.type==="group"&&zp(n.commands,t)}function Hp(e,t){for(let n of e){if((n.type==="branch"||n.type==="branchOnSubst"||n.type==="branchOnNoSubst")&&n.label&&!t.has(n.label))return n.label;if(n.type==="group"){let r=Hp(n.commands,t);if(r)return r}}}var Pl,jp=I(()=>{"use strict";Bp();Pl=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(t,n=!1){this.scripts=t,this.extendedRegex=n}parse(){let t=[];for(let n of this.scripts){let r=new no(n);for(this.tokens=r.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(ne.NEWLINE)||this.check(ne.SEMICOLON)){this.advance();continue}let s=this.pos,i=this.parseCommand();if(i.error)return{commands:[],error:i.error};if(i.command&&t.push(i.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:t}}parseCommand(){let t=this.parseAddressRange();if(t?.error)return{command:null,error:t.error};let n=t?.address;for(this.check(ne.NEGATION)&&(this.advance(),n&&(n.negated=!0));this.check(ne.NEWLINE)||this.check(ne.SEMICOLON);)this.advance();if(this.isAtEnd())return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null};let r=this.peek();switch(r.type){case ne.COMMAND:return this.parseSimpleCommand(r,n);case ne.SUBSTITUTE:return this.parseSubstituteFromToken(r,n);case ne.TRANSLITERATE:return this.parseTransliterateFromToken(r,n);case ne.LABEL_DEF:return this.advance(),{command:{type:"label",name:r.label||""}};case ne.BRANCH:return this.advance(),{command:{type:"branch",address:n,label:r.label}};case ne.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:n,label:r.label}};case ne.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:n,label:r.label}};case ne.TEXT_CMD:return this.advance(),this.parseTextCommand(r,n);case ne.FILE_READ:return this.advance(),{command:{type:"readFile",address:n,filename:r.filename||""}};case ne.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:n,filename:r.filename||""}};case ne.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:n,filename:r.filename||""}};case ne.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:n,filename:r.filename||""}};case ne.EXECUTE:return this.advance(),{command:{type:"execute",address:n,command:r.command}};case ne.VERSION:return this.advance(),{command:{type:"version",address:n,minVersion:r.label}};case ne.LBRACE:return this.parseGroup(n);case ne.RBRACE:return{command:null};case ne.ERROR:return{command:null,error:`invalid command: ${r.value}`};default:return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(t,n){this.advance();let r=t.value;switch(r){case"p":return{command:{type:"print",address:n}};case"P":return{command:{type:"printFirstLine",address:n}};case"d":return{command:{type:"delete",address:n}};case"D":return{command:{type:"deleteFirstLine",address:n}};case"h":return{command:{type:"hold",address:n}};case"H":return{command:{type:"holdAppend",address:n}};case"g":return{command:{type:"get",address:n}};case"G":return{command:{type:"getAppend",address:n}};case"x":return{command:{type:"exchange",address:n}};case"n":return{command:{type:"next",address:n}};case"N":return{command:{type:"nextAppend",address:n}};case"q":return{command:{type:"quit",address:n}};case"Q":return{command:{type:"quitSilent",address:n}};case"z":return{command:{type:"zap",address:n}};case"=":return{command:{type:"lineNumber",address:n}};case"l":return{command:{type:"list",address:n}};case"F":return{command:{type:"printFilename",address:n}};default:return{command:null,error:`unknown command: ${r}`}}}parseSubstituteFromToken(t,n){this.advance();let r=t.flags||"",s,i=r.match(/(\d+)/);return i&&(s=parseInt(i[1],10)),{command:{type:"substitute",address:n,pattern:t.pattern||"",replacement:t.replacement||"",global:r.includes("g"),ignoreCase:r.includes("i")||r.includes("I"),printOnMatch:r.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(t,n){this.advance();let r=t.source||"",s=t.dest||"";return r.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:n,source:r,dest:s}}}parseTextCommand(t,n){let r=t.value,s=t.text||"";switch(r){case"a":return{command:{type:"append",address:n,text:s}};case"i":return{command:{type:"insert",address:n,text:s}};case"c":return{command:{type:"change",address:n,text:s}};default:return{command:null,error:`unknown text command: ${r}`}}}parseGroup(t){this.advance();let n=[];for(;!this.isAtEnd()&&!this.check(ne.RBRACE);){if(this.check(ne.NEWLINE)||this.check(ne.SEMICOLON)){this.advance();continue}let r=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&n.push(s.command),this.pos===r&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(ne.RBRACE)?(this.advance(),{command:{type:"group",address:t,commands:n}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(ne.COMMA))return{error:"expected context address"};let t=this.parseAddress();if(t===void 0)return;let n;if(this.check(ne.RELATIVE_OFFSET))n={offset:this.advance().offset||0};else if(this.check(ne.COMMA)&&(this.advance(),n=this.parseAddress(),n===void 0))return{error:"expected context address"};return{address:{start:t,end:n}}}parseAddress(){let t=this.peek();switch(t.type){case ne.NUMBER:return this.advance(),t.value;case ne.DOLLAR:return this.advance(),"$";case ne.PATTERN:return this.advance(),{pattern:t.pattern||t.value};case ne.STEP:return this.advance(),{first:t.first||0,step:t.step||0};case ne.RELATIVE_OFFSET:return this.advance(),{offset:t.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:ne.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(t){return this.peek().type===t}isAtEnd(){return this.peek().type===ne.EOF}}});var Gp={};ee(Gp,{flagsForFuzzing:()=>W8,sedCommand:()=>B8});async function Dl(e,t,n,r={}){let{limits:s,filename:i,fs:o,cwd:a,coverage:l,requireDefenseContext:c}=r;lt(c,"sed","processing entry");let u=(P,k)=>Rt(c,"sed",P,k),f=e.endsWith(`
|
|
278
|
+
`),p=e.split(`
|
|
279
|
+
`);p.length>0&&p[p.length-1]===""&&p.pop();let h=p.length,d="",m,g=!1,y=s?.maxStringLength??0,w=P=>{if(d+=P,y>0&&d.length>y)throw new K(`sed: output size limit exceeded (${y} bytes)`,"string_length")},b="",x,A=new Map,C=new Map,$=new Map,D=new Map,v=s?{maxIterations:s.maxSedIterations,maxStringLength:y}:void 0;for(let P=0;P<p.length;P++){let k={...Mp(h,i,A),patternSpace:p[P],holdSpace:b,lastPattern:x,lineNumber:P+1,totalLines:h,substitutionMade:!1,coverage:l},N={lines:p,currentLineIndex:P},R=0,O=1e4;k.linesConsumedInCycle=0;do{if(R++,R>O)break;if(k.restartCycle=!1,k.pendingFileReads=[],k.pendingFileWrites=[],Rl(t,k,N,v),o&&a){for(let q of k.pendingFileReads){let j=o.resolvePath(a,q.filename);try{if(q.wholeFile){let te=await u("read command file",()=>o.readFile(j));k.appendBuffer.push(te.replace(/\n$/,""))}else{if(!C.has(j)){let oe=await u("read command file line cache",()=>o.readFile(j));C.set(j,oe.split(`
|
|
280
|
+
`)),$.set(j,0)}let te=C.get(j),Se=$.get(j);te&&Se!==void 0&&Se<te.length&&(k.appendBuffer.push(te[Se]),$.set(j,Se+1))}}catch(te){if(te instanceof de)throw te}}for(let q of k.pendingFileWrites){let j=o.resolvePath(a,q.filename),te=D.get(j)||"";D.set(j,te+q.content)}}}while(k.restartCycle&&!k.deleted&&!k.quit&&!k.quitSilent);if(P+=k.linesConsumedInCycle,b=k.holdSpace,x=k.lastPattern,!n)for(let q of k.nCommandOutput)w(`${q}
|
|
281
|
+
`);let _=k.lineNumberOutput.length>0;for(let q of k.lineNumberOutput)w(`${q}
|
|
282
|
+
`);let M=[],z=[];for(let q of k.appendBuffer)q.startsWith("__INSERT__")?M.push(q.slice(10)):z.push(q);for(let q of M)w(`${q}
|
|
283
|
+
`);let ie=!1;!k.deleted&&!k.quitSilent?n?k.printed&&(w(`${k.patternSpace}
|
|
284
|
+
`),ie=!0):(w(`${k.patternSpace}
|
|
285
|
+
`),ie=!0):k.changedText!==void 0&&(w(`${k.changedText}
|
|
286
|
+
`),ie=!0);for(let q of z)w(`${q}
|
|
287
|
+
`);if(g=(_||ie)&&z.length===0,k.quit||k.quitSilent){if(k.exitCode!==void 0&&(m=k.exitCode),k.errorMessage)return{output:"",exitCode:m||1,errorMessage:k.errorMessage};break}}if(o&&a)for(let[P,k]of D)try{await u("flush pending file writes",()=>o.writeFile(P,k))}catch(N){if(N instanceof de)throw N}return!f&&g&&d.endsWith(`
|
|
288
|
+
`)&&(d=d.slice(0,-1)),{output:d,exitCode:m}}var U8,B8,W8,Vp=I(()=>{"use strict";ye();An();we();zn();cn();ae();Up();jp();U8={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands:
|
|
289
|
+
s/regexp/replacement/[flags] substitute
|
|
290
|
+
d delete pattern space
|
|
291
|
+
p print pattern space
|
|
292
|
+
a\\ text append text after line
|
|
293
|
+
i\\ text insert text before line
|
|
294
|
+
c\\ text change (replace) line with text
|
|
295
|
+
h copy pattern space to hold space
|
|
296
|
+
H append pattern space to hold space
|
|
297
|
+
g copy hold space to pattern space
|
|
298
|
+
G append hold space to pattern space
|
|
299
|
+
x exchange pattern and hold spaces
|
|
300
|
+
n read next line into pattern space
|
|
301
|
+
N append next line to pattern space
|
|
302
|
+
y/source/dest/ transliterate characters
|
|
303
|
+
= print line number
|
|
304
|
+
l list pattern space (escape special chars)
|
|
305
|
+
b [label] branch to label
|
|
306
|
+
t [label] branch on substitution
|
|
307
|
+
T [label] branch if no substitution
|
|
308
|
+
:label define label
|
|
309
|
+
q quit
|
|
310
|
+
Q quit without printing
|
|
311
|
+
|
|
312
|
+
Addresses:
|
|
313
|
+
N line number
|
|
314
|
+
$ last line
|
|
315
|
+
/regexp/ lines matching regexp
|
|
316
|
+
N,M range from line N to M
|
|
317
|
+
first~step every step-th line starting at first`};B8={name:"sed",async execute(e,t){lt(t.requireDefenseContext,"sed","execution entry");let n=(m,g)=>Rt(t.requireDefenseContext,"sed",m,g);if(W(e))return B(U8);let r=[],s=[],i=!1,o=!1,a=!1,l=[];for(let m=0;m<e.length;m++){let g=e[m];if(g==="-n"||g==="--quiet"||g==="--silent")i=!0;else if(g==="-i"||g==="--in-place")o=!0;else if(g.startsWith("-i"))o=!0;else if(g==="-E"||g==="-r"||g==="--regexp-extended")a=!0;else if(g==="-e")m+1<e.length&&r.push(e[++m]);else if(g==="-f")m+1<e.length&&s.push(e[++m]);else{if(g.startsWith("--"))return Q("sed",g);if(g==="-")l.push(g);else if(g.startsWith("-")&&g.length>1){for(let y of g.slice(1))if(y!=="n"&&y!=="e"&&y!=="f"&&y!=="i"&&y!=="E"&&y!=="r")return Q("sed",`-${y}`);g.includes("n")&&(i=!0),g.includes("i")&&(o=!0),(g.includes("E")||g.includes("r"))&&(a=!0),g.includes("e")&&!g.includes("n")&&!g.includes("i")&&m+1<e.length&&r.push(e[++m]),g.includes("f")&&!g.includes("e")&&m+1<e.length&&s.push(e[++m])}else!g.startsWith("-")&&r.length===0&&s.length===0?r.push(g):g.startsWith("-")||l.push(g)}}for(let m of s){let g=t.fs.resolvePath(t.cwd,m);try{let y=await n("script file read",()=>t.fs.readFile(g));for(let w of y.split(`
|
|
318
|
+
`)){let b=w.trim();b&&!b.startsWith("#")&&r.push(b)}}catch(y){if(y instanceof de)throw y;return{stdout:"",stderr:`sed: couldn't open file ${m}: No such file or directory
|
|
319
|
+
`,exitCode:1}}}if(r.length===0)return{stdout:"",stderr:`sed: no script specified
|
|
320
|
+
`,exitCode:1};let{commands:c,error:u,silentMode:f}=Wp(r,a);if(u)return{stdout:"",stderr:`sed: ${u}
|
|
321
|
+
`,exitCode:1};let p=!!(i||f);if(o){if(l.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
|
|
322
|
+
`,exitCode:1};for(let m of l){if(m==="-")continue;let g=t.fs.resolvePath(t.cwd,m);try{let y=await n("in-place input read",()=>t.fs.readFile(g)),w=await n("in-place processing",()=>Dl(y,c,p,{limits:t.limits,filename:m,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(w.errorMessage)return{stdout:"",stderr:`${w.errorMessage}
|
|
323
|
+
`,exitCode:w.exitCode??1};await n("in-place output write",()=>t.fs.writeFile(g,w.output))}catch(y){if(y instanceof de)throw y;return y instanceof K?{stdout:"",stderr:`sed: ${ze(y.message)}
|
|
324
|
+
`,exitCode:K.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
|
|
325
|
+
`,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let h="";if(l.length===0){h=le(t.stdin);try{let m=await n("stdin processing",()=>Dl(h,c,p,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
|
|
326
|
+
`:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof de)throw m;if(m instanceof K)return{stdout:"",stderr:`sed: ${ze(m.message)}
|
|
327
|
+
`,exitCode:K.EXIT_CODE};throw m}}let d=!1;for(let m of l){let g;if(m==="-")d?g="":(g=le(t.stdin),d=!0);else{let y=t.fs.resolvePath(t.cwd,m);try{g=await n("input file read",()=>t.fs.readFile(y))}catch(w){if(w instanceof de)throw w;return w instanceof K?{stdout:"",stderr:`sed: ${ze(w.message)}
|
|
328
|
+
`,exitCode:K.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
|
|
329
|
+
`,exitCode:1}}}h.length>0&&g.length>0&&!h.endsWith(`
|
|
330
|
+
`)&&(h+=`
|
|
331
|
+
`),h+=g}try{let m=await n("final processing",()=>Dl(h,c,p,{limits:t.limits,filename:l.length===1?l[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
|
|
332
|
+
`:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof de)throw m;if(m instanceof K)return{stdout:"",stderr:`sed: ${ze(m.message)}
|
|
333
|
+
`,exitCode:K.EXIT_CODE};throw m}}},W8={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function It(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function dn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Fr(...e){return Object.assign(Object.create(null),...e)}var tr=I(()=>{"use strict"});function _l(e={}){let{fieldSep:t=j8,maxIterations:n=z8,maxRecursionDepth:r=H8,maxOutputSize:s=0,fs:i,cwd:o,exec:a,coverage:l,requireDefenseContext:c}=e;return{FS:" ",OFS:" ",ORS:`
|
|
334
|
+
`,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:i,cwd:o,exec:a,coverage:l,requireDefenseContext:c}}var z8,H8,j8,qp=I(()=>{"use strict";Qe();z8=1e4,H8=100,j8=new er(/\s+/)});function Zp(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var Kp=I(()=>{"use strict"});function mn(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function $t(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function ro(e,t){if(e.type==="regex")return e.pattern;let n=$t(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function Xp(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(mn(await t.evalExpr(e.index)))}`:"$0":"$0"}function Yp(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return $t(t.vars[e]??"")}function Jp(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function G8(e,t,n){return e.length===0?t.line.length:$t(await n.evalExpr(e[0])).length}async function V8(e,t,n){if(e.length<2)return"";let r=$t(await n.evalExpr(e[0])),s=Math.floor(mn(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(mn(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function q8(e,t,n){if(e.length<2)return 0;let r=$t(await n.evalExpr(e[0])),s=$t(await n.evalExpr(e[1])),i=r.indexOf(s);return i===-1?0:i+1}async function Z8(e,t,n){if(e.length<2)return 0;let r=$t(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let i=s.name,o=t.FS;if(e.length>=3){let l=e[2];if(l.type==="regex")o=X(l.pattern);else{let c=$t(await n.evalExpr(l));o=c===" "?X("\\s+"):c}}else t.FS===" "&&(o=X("\\s+"));let a=typeof o=="string"?r.split(o):o.split(r);t.arrays[i]=Object.create(null);for(let l=0;l<a.length;l++)t.arrays[i][String(l+1)]=a[l];return a.length}async function K8(e,t,n){if(e.length<2)return 0;let r=await ro(e[0],n),s=$t(await n.evalExpr(e[1])),i=await Xp(e[2],n),o=Yp(i,t);try{let l=X(r).replace(o,eh(s)),c=l!==o?1:0;return Jp(i,l,t),c}catch{return 0}}async function Q8(e,t,n){if(e.length<2)return 0;let r=await ro(e[0],n),s=$t(await n.evalExpr(e[1])),i=await Xp(e[2],n),o=Yp(i,t);try{let a=X(r,"g"),l=a.match(o),c=l?l.length:0,u=a.replace(o,eh(s));return Jp(i,u,t),c}catch{return 0}}function eh(e){return t=>{let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length){let s=e[r+1];s==="&"?(n+="&",r+=2):s==="\\"?(n+="\\",r+=2):(n+=e[r+1],r+=2)}else e[r]==="&"?(n+=t,r++):(n+=e[r],r++);return n}}async function X8(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=$t(await n.evalExpr(e[0])),s=await ro(e[1],n);try{let o=X(s).exec(r);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function Y8(e,t,n){if(e.length<3)return"";let r=await ro(e[0],n),s=$t(await n.evalExpr(e[1])),i=$t(await n.evalExpr(e[2])),o=e.length>=4?$t(await n.evalExpr(e[3])):t.line;try{let a=i.toLowerCase()==="g",l=a?0:parseInt(i,10)||1;if(a)return X(r,"g").replace(o,(u,...f)=>Qp(s,u,f.slice(0,-2)));{let c=0;return X(r,"g").replace(o,(f,...p)=>(c++,c===l?Qp(s,f,p.slice(0,-2)):f))}}catch{return o}}function Qp(e,t,n){let r="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];if(i==="&")r+="&",s+=2;else if(i==="0")r+=t,s+=2;else if(i>="1"&&i<="9"){let o=parseInt(i,10)-1;r+=n[o]||"",s+=2}else i==="n"?(r+=`
|
|
335
|
+
`,s+=2):i==="t"?(r+=" ",s+=2):(r+=i,s+=2)}else e[s]==="&"?(r+=t,s++):(r+=e[s],s++);return r}async function J8(e,t,n){return e.length===0?"":$t(await n.evalExpr(e[0])).toLowerCase()}async function e9(e,t,n){return e.length===0?"":$t(await n.evalExpr(e[0])).toUpperCase()}async function t9(e,t,n){if(e.length===0)return"";let r=$t(await n.evalExpr(e[0])),s=[];for(let i=1;i<e.length;i++)s.push(await n.evalExpr(e[i]));return so(r,s)}async function n9(e,t,n){return e.length===0?0:Math.floor(mn(await n.evalExpr(e[0])))}async function r9(e,t,n){return e.length===0?0:Math.sqrt(mn(await n.evalExpr(e[0])))}async function s9(e,t,n){return e.length===0?0:Math.sin(mn(await n.evalExpr(e[0])))}async function i9(e,t,n){return e.length===0?0:Math.cos(mn(await n.evalExpr(e[0])))}async function o9(e,t,n){let r=e.length>0?mn(await n.evalExpr(e[0])):0,s=e.length>1?mn(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function a9(e,t,n){return e.length===0?0:Math.log(mn(await n.evalExpr(e[0])))}async function l9(e,t,n){return e.length===0?1:Math.exp(mn(await n.evalExpr(e[0])))}function c9(e,t,n){return t.random?t.random():Math.random()}async function u9(e,t,n){let r=e.length>0?mn(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function f9(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function Fl(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function so(e,t){let n=0,r="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let i=s+1,o="",a="",l="",c,u=i;for(;i<e.length&&/\d/.test(e[i]);)i++;i>u&&e[i]==="$"?(c=parseInt(e.substring(u,i),10)-1,i++):i=u;let f=()=>{if(i<e.length){if(i+1<e.length&&(e[i]==="h"&&e[i+1]==="h"||e[i]==="l"&&e[i+1]==="l")){i+=2;return}/[lzjh]/.test(e[i])&&i++}};for(;i<e.length&&/[-+ #0]/.test(e[i]);)o+=e[i++];if(e[i]==="*"){let m=t[n++],g=m!==void 0?Math.floor(Number(m)):0;g<0?(o+="-",a=String(Math.min(-g,Lr))):a=String(Math.min(g,Lr)),i++}else for(;i<e.length&&/\d/.test(e[i]);)a+=e[i++];if(a&&parseInt(a,10)>Lr&&(a=String(Lr)),e[i]==="."){if(i++,e[i]==="*"){let m=t[n++];l=String(Math.min(m!==void 0?Math.floor(Number(m)):0,Lr)),i++}else for(;i<e.length&&/\d/.test(e[i]);)l+=e[i++];l&&parseInt(l,10)>Lr&&(l=String(Lr))}f();let p=e[i],d=t[c!==void 0?c:n];switch(p){case"s":{let m=d!==void 0?String(d):"";if(l&&(m=m.substring(0,parseInt(l,10))),a){let g=parseInt(a,10);o.includes("-")?m=m.padEnd(g):m=m.padStart(g)}r+=m,c===void 0&&n++;break}case"d":case"i":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=m<0,y=Math.abs(m).toString();if(l){let x=parseInt(l,10);y=y.padStart(x,"0")}let w="";g?w="-":o.includes("+")?w="+":o.includes(" ")&&(w=" ");let b=w+y;if(a){let x=parseInt(a,10);o.includes("-")?b=b.padEnd(x):o.includes("0")&&!l?b=w+y.padStart(x-w.length,"0"):b=b.padStart(x)}r+=b,c===void 0&&n++;break}case"f":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toFixed(g);if(a){let w=parseInt(a,10);o.includes("-")?y=y.padEnd(w):y=y.padStart(w)}r+=y,c===void 0&&n++;break}case"e":case"E":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toExponential(g);if(p==="E"&&(y=y.toUpperCase()),a){let w=parseInt(a,10);o.includes("-")?y=y.padEnd(w):y=y.padStart(w)}r+=y,c===void 0&&n++;break}case"g":case"G":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m!==0?Math.floor(Math.log10(Math.abs(m))):0,w;if(m===0?w="0":y<-4||y>=g?(w=m.toExponential(g-1),p==="G"&&(w=w.toUpperCase())):w=m.toPrecision(g),w.includes(".")&&(w=w.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),w.includes("e")&&(w=w.replace(/\.?0+e/,"e")),a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"x":case"X":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(16);if(p==="X"&&(g=g.toUpperCase()),l){let b=parseInt(l,10);g=g.padStart(b,"0")}let y=m<0?"-":"",w=y+g;if(a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):o.includes("0")&&!l?w=y+g.padStart(b-y.length,"0"):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"o":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(8);if(l){let b=parseInt(l,10);g=g.padStart(b,"0")}let y=m<0?"-":"",w=y+g;if(a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):o.includes("0")&&!l?w=y+g.padStart(b-y.length,"0"):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"c":{typeof d=="number"?r+=String.fromCharCode(d):r+=String(d??"").charAt(0)||"",c===void 0&&n++;break}case"%":r+="%";break;default:r+=e.substring(s,i+1)}s=i+1}else if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];switch(i){case"n":r+=`
|
|
336
|
+
`;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;default:r+=i}s+=2}else r+=e[s++];return r}var Lr,th,Ll=I(()=>{"use strict";Qe();Lr=1e4;th=new Map([["length",G8],["substr",V8],["index",q8],["split",Z8],["sub",K8],["gsub",Q8],["match",X8],["gensub",Y8],["tolower",J8],["toupper",e9],["sprintf",t9],["int",n9],["sqrt",r9],["sin",s9],["cos",i9],["atan2",o9],["log",a9],["exp",l9],["rand",c9],["srand",u9],["system",f9("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Fl("systime")],["mktime",Fl("mktime")],["strftime",Fl("strftime")]])});function Mt(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function nt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Me(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function Ml(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function ai(e,t){try{return X(e).test(t)}catch{return!1}}var gs=I(()=>{"use strict";Qe()});function nh(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function io(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Ul(e,t,n){if(t===0)e.line=Me(n),e.fields=nh(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=Me(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function ys(e,t){e.line=t,e.fields=nh(e,t),e.NF=e.fields.length}function rh(e,t){if(e.FS=t,t===" ")e.fieldSep=new er(/\s+/);else try{e.fieldSep=X(t)}catch{e.fieldSep=X(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var oo=I(()=>{"use strict";Qe();gs()});function ao(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function ws(e,t,n){switch(t){case"FS":rh(e,Me(n));return;case"OFS":e.OFS=Me(n);return;case"ORS":e.ORS=Me(n);return;case"OFMT":e.OFMT=Me(n);return;case"NR":e.NR=Math.floor(nt(n));return;case"NF":{let r=Math.floor(nt(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(nt(n));return;case"FILENAME":e.FILENAME=Me(n);return;case"RSTART":e.RSTART=Math.floor(nt(n));return;case"RLENGTH":e.RLENGTH=Math.floor(nt(n));return;case"SUBSEP":e.SUBSEP=Me(n);return}e.vars[t]=n}function li(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function lo(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=li(e,t);return e.arrays[r]?.[n]??""}function Bl(e,t,n,r){let s=li(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=r}function sh(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=li(e,t);return e.arrays[r]?.[n]!==void 0}function ih(e,t,n){let r=li(e,t);e.arrays[r]&&delete e.arrays[r][n]}function oh(e,t){let n=li(e,t);delete e.arrays[n]}var Wl=I(()=>{"use strict";oo();gs()});function lh(e){ah=e}function Gt(e,t){lt(e.requireDefenseContext,"awk",t)}function Le(e,t,n){return Rt(e.requireDefenseContext,"awk",t,n)}async function fe(e,t){switch(Gt(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return ai(t.pattern,e.line)?1:0;case"field":return p9(e,t);case"variable":return ao(e,t.name);case"array_access":return h9(e,t);case"binary":return d9(e,t);case"unary":return y9(e,t);case"ternary":return Mt(await Le(e,"ternary condition evaluation",()=>fe(e,t.condition)))?await Le(e,"ternary consequent evaluation",()=>fe(e,t.consequent)):await Le(e,"ternary alternate evaluation",()=>fe(e,t.alternate));case"call":return w9(e,t.name,t.args);case"assignment":return x9(e,t);case"pre_increment":return E9(e,t.operand);case"pre_decrement":return A9(e,t.operand);case"post_increment":return S9(e,t.operand);case"post_decrement":return C9(e,t.operand);case"in":return v9(e,t.key,t.array);case"getline":return k9(e,t.variable,t.file,t.command);case"tuple":return $9(e,t.elements);default:return""}}async function p9(e,t){Gt(e,"field reference evaluation");let n=Math.floor(nt(await Le(e,"field index evaluation",()=>fe(e,t.index))));return io(e,n)}async function h9(e,t){Gt(e,"array access evaluation");let n=Me(await Le(e,"array key evaluation",()=>fe(e,t.key)));return lo(e,t.array,n)}async function d9(e,t){Gt(e,"binary expression evaluation");let n=t.operator;if(n==="||")return Mt(await Le(e,"logical-or left evaluation",()=>fe(e,t.left)))||Mt(await Le(e,"logical-or right evaluation",()=>fe(e,t.right)))?1:0;if(n==="&&")return Mt(await Le(e,"logical-and left evaluation",()=>fe(e,t.left)))&&Mt(await Le(e,"logical-and right evaluation",()=>fe(e,t.right)))?1:0;if(n==="~"){let a=await Le(e,"regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Le(e,"regex right evaluation",()=>fe(e,t.right)));try{return X(l).test(Me(a))?1:0}catch{return 0}}if(n==="!~"){let a=await Le(e,"negated-regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Le(e,"negated-regex right evaluation",()=>fe(e,t.right)));try{return X(l).test(Me(a))?0:1}catch{return 1}}let r=await Le(e,"binary left evaluation",()=>fe(e,t.left)),s=await Le(e,"binary right evaluation",()=>fe(e,t.right));if(n===" "){let a=Me(r)+Me(s);if(e.maxOutputSize>0&&a.length>e.maxOutputSize)throw new K(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return a}if(m9(n))return g9(r,s,n);let i=nt(r),o=nt(s);return Zp(i,o,n)}function m9(e){return["<","<=",">",">=","==","!="].includes(e)}function g9(e,t,n){let r=Ml(e),s=Ml(t);if(r&&s){let a=nt(e),l=nt(t);switch(n){case"<":return a<l?1:0;case"<=":return a<=l?1:0;case">":return a>l?1:0;case">=":return a>=l?1:0;case"==":return a===l?1:0;case"!=":return a!==l?1:0}}let i=Me(e),o=Me(t);switch(n){case"<":return i<o?1:0;case"<=":return i<=o?1:0;case">":return i>o?1:0;case">=":return i>=o?1:0;case"==":return i===o?1:0;case"!=":return i!==o?1:0}return 0}async function y9(e,t){Gt(e,"unary expression evaluation");let n=await Le(e,"unary operand evaluation",()=>fe(e,t.operand));switch(t.operator){case"!":return Mt(n)?0:1;case"-":return-nt(n);case"+":return+nt(n);default:return n}}async function w9(e,t,n){Gt(e,"function call evaluation");let r=th.get(t);if(r)return r(n,e,{evalExpr:i=>fe(e,i)});let s=e.functions.get(t);return s?b9(e,s,n):""}async function b9(e,t,n){if(Gt(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new K(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let a of t.params)r[a]=e.vars[a];let s=[];for(let a=0;a<t.params.length;a++){let l=t.params[a];if(a<n.length){let c=n[a];c.type==="variable"&&(e.arrayAliases.set(l,c.name),s.push(l));let u=await Le(e,"user function argument evaluation",()=>fe(e,c));e.vars[l]=u}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let i=ah;i&&await Le(e,"user function body execution",()=>i(e,t.body.statements));let o=e.returnValue??"";for(let a of t.params)r[a]!==void 0?e.vars[a]=r[a]:delete e.vars[a];for(let a of s)e.arrayAliases.delete(a);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function x9(e,t){Gt(e,"assignment evaluation");let n=await Le(e,"assignment value evaluation",()=>fe(e,t.value)),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let o;if(r.type==="field"){let c=Math.floor(nt(await Le(e,"assignment field index",()=>fe(e,r.index))));o=io(e,c)}else if(r.type==="variable")o=ao(e,r.name);else{let c=Me(await Le(e,"assignment array key",()=>fe(e,r.key)));o=lo(e,r.array,c)}let a=nt(o),l=nt(n);switch(s){case"+=":i=a+l;break;case"-=":i=a-l;break;case"*=":i=a*l;break;case"/=":i=l!==0?a/l:0;break;case"%=":i=l!==0?a%l:0;break;case"^=":i=a**l;break;default:i=n}}if(r.type==="field"){let o=Math.floor(nt(await Le(e,"assignment target field index",()=>fe(e,r.index))));Ul(e,o,i)}else if(r.type==="variable")ws(e,r.name,i);else{let o=Me(await Le(e,"assignment target array key",()=>fe(e,r.key)));Bl(e,r.array,o,i)}return i}async function co(e,t,n,r){Gt(e,"inc/dec evaluation");let s;if(t.type==="field"){let i=Math.floor(nt(await Le(e,"inc/dec field index",()=>fe(e,t.index))));s=nt(io(e,i)),Ul(e,i,s+n)}else if(t.type==="variable")s=nt(ao(e,t.name)),ws(e,t.name,s+n);else{let i=Me(await Le(e,"inc/dec array key",()=>fe(e,t.key)));s=nt(lo(e,t.array,i)),Bl(e,t.array,i,s+n)}return r?s+n:s}async function E9(e,t){return co(e,t,1,!0)}async function A9(e,t){return co(e,t,-1,!0)}async function S9(e,t){return co(e,t,1,!1)}async function C9(e,t){return co(e,t,-1,!1)}async function v9(e,t,n){Gt(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(Me(await Le(e,"tuple key element evaluation",()=>fe(e,i))));r=s.join(e.SUBSEP)}else r=Me(await Le(e,"in-expression key evaluation",()=>fe(e,t)));return sh(e,n,r)?1:0}async function k9(e,t,n,r){if(Gt(e,"getline evaluation"),r)return N9(e,t,r);if(n)return I9(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let i=e.lines[s];return t?ws(e,t,i):ys(e,i),e.NR++,e.lineIndex=s,1}async function N9(e,t,n){let r=e.exec;if(!r)return-1;Gt(e,"getline command source");let s=Me(await Le(e,"getline command expression",()=>fe(e,n))),i=`__cmd_${s}`,o=`__cmdi_${s}`,a,l;if(e.vars[i]===void 0)try{let f=await Le(e,"getline command exec",()=>r(s));a=le(f.stdout).split(`
|
|
337
|
+
`),a.length>0&&a[a.length-1]===""&&a.pop(),e.vars[i]=JSON.stringify(a),e.vars[o]=-1,l=-1}catch(f){if(f instanceof de)throw f;return-1}else a=JSON.parse(e.vars[i]),l=e.vars[o];let c=l+1;if(c>=a.length)return 0;let u=a[c];return e.vars[o]=c,t?ws(e,t,u):ys(e,u),1}async function I9(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;Gt(e,"getline file source");let s=Me(await Le(e,"getline filename evaluation",()=>fe(e,n)));if(s==="/dev/null")return 0;let i=r.resolvePath(e.cwd,s),o=`__fc_${i}`,a=`__fi_${i}`,l,c;if(e.vars[o]===void 0)try{l=(await Le(e,"getline file read",()=>r.readFile(i))).split(`
|
|
338
|
+
`),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[o]=JSON.stringify(l),e.vars[a]=-1,c=-1}catch(p){if(p instanceof de)throw p;return-1}else l=JSON.parse(e.vars[o]),c=e.vars[a];let u=c+1;if(u>=l.length)return 0;let f=l[u];return e.vars[a]=u,t?ws(e,t,f):ys(e,f),1}async function $9(e,t){if(Gt(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Le(e,"tuple intermediate element",()=>fe(e,t[n]));return Le(e,"tuple final element",()=>fe(e,t[t.length-1]))}var ah,zl=I(()=>{"use strict";ye();we();Qe();zn();cn();Kp();Ll();oo();gs();Wl();ah=null});function Hl(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new K(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function kn(e,t){lt(e.requireDefenseContext,"awk",t)}function Re(e,t,n){return Rt(e.requireDefenseContext,"awk",t,n)}async function bs(e,t){kn(e,"block execution");for(let n of t)if(await Re(e,"statement execution",()=>Mr(e,n)),T9(e))break}function T9(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Mr(e,t){switch(kn(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await Re(e,"nested block statement",()=>bs(e,t.statements));break;case"expr_stmt":await Re(e,"expression statement",()=>fe(e,t.expression));break;case"print":await Re(e,"print statement",()=>O9(e,t.args,t.output));break;case"printf":await Re(e,"printf statement",()=>R9(e,t.format,t.args,t.output));break;case"if":await Re(e,"if statement",()=>P9(e,t));break;case"while":await Re(e,"while statement",()=>D9(e,t));break;case"do_while":await Re(e,"do-while statement",()=>_9(e,t));break;case"for":await Re(e,"for statement",()=>F9(e,t));break;case"for_in":await Re(e,"for-in statement",()=>L9(e,t));break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(nt(await Re(e,"exit code expression",()=>fe(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await Re(e,"return expression",()=>fe(e,n)):""}break;case"delete":await Re(e,"delete statement",()=>M9(e,t.target));break}}async function O9(e,t,n){kn(e,"print execution");let r=[];for(let i of t){let o=await Re(e,"print argument evaluation",()=>fe(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(so(e.OFMT,[o])):r.push(Me(o))}let s=r.join(e.OFS)+e.ORS;n?await Re(e,"print redirection write",()=>ch(e,n.redirect,n.file,s)):(e.output+=s,Hl(e))}async function R9(e,t,n,r){kn(e,"printf execution");let s=Me(await Re(e,"printf format evaluation",()=>fe(e,t))),i=[];for(let a of n)i.push(await Re(e,"printf argument evaluation",()=>fe(e,a)));let o=so(s,i);r?await Re(e,"printf redirection write",()=>ch(e,r.redirect,r.file,o)):(e.output+=o,Hl(e))}async function ch(e,t,n,r){kn(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,Hl(e);return}let i=Me(await Re(e,"redirection filename evaluation",()=>fe(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await Re(e,"redirection append write",()=>s.appendFile(o,r)):(await Re(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await Re(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function P9(e,t){if(kn(e,"if execution"),Mt(await Re(e,"if condition evaluation",()=>fe(e,t.condition))))await Re(e,"if consequent execution",()=>Mr(e,t.consequent));else if(t.alternate){let n=t.alternate;await Re(e,"if alternate execution",()=>Mr(e,n))}}async function D9(e,t){kn(e,"while execution");let n=0;for(;Mt(await Re(e,"while condition evaluation",()=>fe(e,t.condition)));){if(n++,n>e.maxIterations)throw new K(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Re(e,"while body execution",()=>Mr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function _9(e,t){kn(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new K(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Re(e,"do-while body execution",()=>Mr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(Mt(await Re(e,"do-while condition evaluation",()=>fe(e,t.condition))))}async function F9(e,t){kn(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await Re(e,"for init evaluation",()=>fe(e,n));let i=0;for(;!r||Mt(await Re(e,"for condition evaluation",()=>fe(e,r)));){if(i++,i>e.maxIterations)throw new K(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Re(e,"for body execution",()=>Mr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await Re(e,"for update evaluation",()=>fe(e,s))}}async function L9(e,t){kn(e,"for-in execution");let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await Re(e,"for-in body execution",()=>Mr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function M9(e,t){if(kn(e,"delete execution"),t.type==="array_access"){let n=Me(await Re(e,"delete key evaluation",()=>fe(e,t.key)));ih(e,t.array,n)}else t.type==="variable"&&oh(e,t.name)}var uh=I(()=>{"use strict";we();zn();Ll();zl();gs();Wl();lh(bs)});var ci,fh=I(()=>{"use strict";zn();zl();oo();uh();gs();ci=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){lt(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return Rt(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>bs(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){ys(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>bs(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>bs(this.ctx,t.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return ai(r.pattern,this.ctx.line);case"expr_pattern":return Mt(await this.withDefenseContext("expression pattern evaluation",()=>fe(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return ai(t.pattern,this.ctx.line);case"expr_pattern":return Mt(await this.withDefenseContext("nested expression pattern",()=>fe(this.ctx,t.expression)));default:return!1}}}});var ph=I(()=>{"use strict";qp();fh()});function B9(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var S,U9,W9,uo,hh=I(()=>{"use strict";(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(S||(S={}));U9=new Map([["BEGIN",S.BEGIN],["END",S.END],["if",S.IF],["else",S.ELSE],["while",S.WHILE],["do",S.DO],["for",S.FOR],["in",S.IN],["break",S.BREAK],["continue",S.CONTINUE],["next",S.NEXT],["nextfile",S.NEXTFILE],["exit",S.EXIT],["return",S.RETURN],["delete",S.DELETE],["function",S.FUNCTION],["print",S.PRINT],["printf",S.PRINTF],["getline",S.GETLINE]]);W9=new Set([S.COMMA,S.LBRACE,S.AND,S.OR,S.QUESTION,S.COLON,S.DO,S.ELSE,S.IF,S.WHILE]),uo=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(S.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
|
|
339
|
+
`?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
|
|
340
|
+
`)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
|
|
341
|
+
`;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
|
|
342
|
+
`?(this.advance(),this.lastTokenType!==null&&W9.has(this.lastTokenType)?this.nextToken():{type:S.NEWLINE,value:`
|
|
343
|
+
`,line:t,column:n}):r==='"'?this.readString():r==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(r)||r==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(r)||r==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,S.NEWLINE,S.SEMICOLON,S.LBRACE,S.RBRACE,S.LPAREN,S.LBRACKET,S.COMMA,S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN,S.AND,S.OR,S.NOT,S.MATCH,S.NOT_MATCH,S.QUESTION,S.COLON,S.LT,S.GT,S.LE,S.GE,S.EQ,S.NE,S.PLUS,S.MINUS,S.STAR,S.PERCENT,S.CARET,S.PRINT,S.PRINTF,S.IF,S.WHILE,S.DO,S.FOR,S.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":r+=`
|
|
344
|
+
`;break;case"t":r+=" ";break;case"r":r+="\r";break;case"f":r+="\f";break;case"b":r+="\b";break;case"v":r+="\v";break;case"a":r+="\x07";break;case"\\":r+="\\";break;case'"':r+='"';break;case"/":r+="/";break;case"x":{let i="";for(;i.length<2&&/[0-9a-fA-F]/.test(this.peek());)i+=this.advance();i.length>0?r+=String.fromCharCode(parseInt(i,16)):r+="x";break}default:if(/[0-7]/.test(s)){let i=s;for(;i.length<3&&/[0-7]/.test(this.peek());)i+=this.advance();r+=String.fromCharCode(parseInt(i,8))}else r+=s}}else r+=this.advance();return this.peek()==='"'&&this.advance(),{type:S.STRING,value:r,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")r+=this.advance(),this.pos<this.input.length&&(r+=this.advance());else{if(this.peek()===`
|
|
345
|
+
`)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=B9(r),{type:S.REGEX,value:r,line:t,column:n}}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(r+=this.advance();this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(r+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(r+=this.advance());this.isDigit(this.peek());)r+=this.advance();return{type:S.NUMBER,value:parseFloat(r),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,r="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)r+=this.advance();let s=U9.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:S.IDENT,value:r,line:t,column:n}}readOperator(){let t=this.line,n=this.column,r=this.advance(),s=this.peek();switch(r){case"+":return s==="+"?(this.advance(),{type:S.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:S.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:S.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:S.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:S.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:S.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:S.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:S.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:S.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:S.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:S.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:S.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:S.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:S.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:S.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:S.EQ,value:"==",line:t,column:n}):{type:S.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:S.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:S.NOT_MATCH,value:"!~",line:t,column:n}):{type:S.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:S.LE,value:"<=",line:t,column:n}):{type:S.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:S.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:S.APPEND,value:">>",line:t,column:n}):{type:S.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:S.AND,value:"&&",line:t,column:n}):{type:S.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:S.OR,value:"||",line:t,column:n}):{type:S.PIPE,value:"|",line:t,column:n};case"~":return{type:S.MATCH,value:"~",line:t,column:n};case"?":return{type:S.QUESTION,value:"?",line:t,column:n};case":":return{type:S.COLON,value:":",line:t,column:n};case",":return{type:S.COMMA,value:",",line:t,column:n};case";":return{type:S.SEMICOLON,value:";",line:t,column:n};case"(":return{type:S.LPAREN,value:"(",line:t,column:n};case")":return{type:S.RPAREN,value:")",line:t,column:n};case"{":return{type:S.LBRACE,value:"{",line:t,column:n};case"}":return{type:S.RBRACE,value:"}",line:t,column:n};case"[":return{type:S.LBRACKET,value:"[",line:t,column:n};case"]":return{type:S.RBRACKET,value:"]",line:t,column:n};case"$":return{type:S.DOLLAR,value:"$",line:t,column:n};default:return{type:S.IDENT,value:r,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}}});function wh(e){e.expect(Y.PRINT);let t=[];if(e.check(Y.NEWLINE)||e.check(Y.SEMICOLON)||e.check(Y.RBRACE)||e.check(Y.PIPE)||e.check(Y.GT)||e.check(Y.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(fo(e));e.check(Y.COMMA);)e.advance(),t.push(fo(e));let n;return e.check(Y.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function fo(e){return z9(e)?jl(e,!0):jl(e,!1)}function jl(e,t){let n=t?e.parseTernary():H9(e);if(e.match(Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN)){let r=e.advance(),s=jl(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(r.value)??"=",target:n,value:s}}return n}function z9(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===Y.LPAREN&&t++,r.type===Y.RPAREN&&t--,r.type===Y.QUESTION&&t===0)return!0;if(r.type===Y.NEWLINE||r.type===Y.SEMICOLON||r.type===Y.RBRACE||r.type===Y.COMMA||r.type===Y.PIPE)return!1;n++}return!1}function H9(e){let t=dh(e);for(;e.check(Y.OR);){e.advance();let n=dh(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function dh(e){let t=mh(e);for(;e.check(Y.AND);){e.advance();let n=mh(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function mh(e){let t=j9(e);if(e.check(Y.IN)){e.advance();let n=String(e.expect(Y.IDENT).value);return{type:"in",key:t,array:n}}return t}function j9(e){let t=gh(e);for(;G9(e)&&!V9(e);){let n=gh(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function gh(e){let t=yh(e);for(;e.match(Y.MATCH,Y.NOT_MATCH);){let n=e.advance().type===Y.MATCH?"~":"!~",r=yh(e);t={type:"binary",operator:n,left:t,right:r}}return t}function yh(e){let t=e.parseAddSub();for(;e.match(Y.LT,Y.LE,Y.GE,Y.EQ,Y.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function G9(e){return e.match(Y.NUMBER,Y.STRING,Y.IDENT,Y.DOLLAR,Y.LPAREN,Y.NOT,Y.MINUS,Y.PLUS,Y.INCREMENT,Y.DECREMENT)}function V9(e){return e.match(Y.AND,Y.OR,Y.QUESTION,Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN,Y.COMMA,Y.SEMICOLON,Y.NEWLINE,Y.RBRACE,Y.RPAREN,Y.RBRACKET,Y.COLON,Y.PIPE,Y.APPEND,Y.GT,Y.IN)}function bh(e){e.expect(Y.PRINTF);let t=e.check(Y.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():fo(e),r=[];for(;e.check(Y.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():fo(e));t&&(e.skipNewlines(),e.expect(Y.RPAREN));let s;return e.check(Y.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var Y,xh=I(()=>{"use strict";Y={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"}});var po,Eh=I(()=>{"use strict";hh();xh();po=class{tokens=[];pos=0;parse(t){let n=new uo(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:S.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let r=this.current();throw new Error(n||`Expected ${t}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(S.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(S.NEWLINE)||this.check(S.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(S.EOF)&&(this.skipNewlines(),!this.check(S.EOF));)this.check(S.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(S.FUNCTION);let t=this.expect(S.IDENT).value;this.expect(S.LPAREN);let n=[];if(!this.check(S.RPAREN))for(n.push(this.expect(S.IDENT).value);this.check(S.COMMA);)this.advance(),n.push(this.expect(S.IDENT).value);this.expect(S.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(S.BEGIN))this.advance(),t={type:"begin"};else if(this.check(S.END))this.advance(),t={type:"end"};else if(this.check(S.LBRACE))t=void 0;else if(this.check(S.REGEX)){let r=this.advance();if(this.check(S.AND)||this.check(S.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:r.value};if(this.check(S.COMMA)){this.advance();let i;this.check(S.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(S.COMMA)){this.advance();let i;this.check(S.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}this.skipNewlines();let n;return this.check(S.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(S.LBRACE),this.skipNewlines();let t=[];for(;!this.check(S.RBRACE)&&!this.check(S.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(S.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(S.SEMICOLON)||this.check(S.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(S.LBRACE))return this.parseBlock();if(this.check(S.IF))return this.parseIf();if(this.check(S.WHILE))return this.parseWhile();if(this.check(S.DO))return this.parseDoWhile();if(this.check(S.FOR))return this.parseFor();if(this.check(S.BREAK))return this.advance(),{type:"break"};if(this.check(S.CONTINUE))return this.advance(),{type:"continue"};if(this.check(S.NEXT))return this.advance(),{type:"next"};if(this.check(S.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(S.EXIT)){this.advance();let n;return!this.check(S.NEWLINE)&&!this.check(S.SEMICOLON)&&!this.check(S.RBRACE)&&!this.check(S.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(S.RETURN)){this.advance();let n;return!this.check(S.NEWLINE)&&!this.check(S.SEMICOLON)&&!this.check(S.RBRACE)&&!this.check(S.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(S.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(S.PRINT)?wh(this):this.check(S.PRINTF)?bh(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(S.IF),this.expect(S.LPAREN);let t=this.parseExpression();this.expect(S.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(S.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(S.WHILE),this.expect(S.LPAREN);let t=this.parseExpression();this.expect(S.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(S.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(S.WHILE),this.expect(S.LPAREN);let n=this.parseExpression();return this.expect(S.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(S.FOR),this.expect(S.LPAREN),this.check(S.IDENT)){let i=this.advance();if(this.check(S.IN)){this.advance();let o=this.expect(S.IDENT).value;this.expect(S.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for_in",variable:i.value,array:o,body:a}}this.pos--}let t;this.check(S.SEMICOLON)||(t=this.parseExpression()),this.expect(S.SEMICOLON);let n;this.check(S.SEMICOLON)||(n=this.parseExpression()),this.expect(S.SEMICOLON);let r;this.check(S.RPAREN)||(r=this.parseExpression()),this.expect(S.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN)){let n=this.advance(),r=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),i=n.value;if(!s.has(i))throw new Error(`Unknown assignment operator: ${i}`);return{type:"assignment",operator:i,target:t,value:r}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(S.QUESTION)){this.advance();let n=this.parseExpression();this.expect(S.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(S.PIPE)){if(this.advance(),!this.check(S.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(S.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(S.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(S.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(S.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(S.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(S.IN)){this.advance();let n=this.expect(S.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(S.MATCH,S.NOT_MATCH);){let n=this.advance().type===S.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(S.LT,S.LE,S.GT,S.GE,S.EQ,S.NE);){let n=this.advance(),r=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}canStartExpression(){return this.match(S.NUMBER,S.STRING,S.IDENT,S.DOLLAR,S.LPAREN,S.NOT,S.MINUS,S.PLUS,S.INCREMENT,S.DECREMENT)}isConcatTerminator(){return this.match(S.AND,S.OR,S.QUESTION,S.ASSIGN,S.PLUS_ASSIGN,S.MINUS_ASSIGN,S.STAR_ASSIGN,S.SLASH_ASSIGN,S.PERCENT_ASSIGN,S.CARET_ASSIGN,S.COMMA,S.SEMICOLON,S.NEWLINE,S.RBRACE,S.RPAREN,S.RBRACKET,S.COLON,S.PIPE,S.APPEND,S.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(S.PLUS,S.MINUS);){let n=this.advance().value,r=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:r}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(S.STAR,S.SLASH,S.PERCENT);){let n=this.advance(),r=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:r}}return t}parseUnary(){if(this.check(S.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(S.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(S.NOT,S.MINUS,S.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(S.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(S.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(S.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(S.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(S.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(S.NOT,S.MINUS,S.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(S.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(S.NUMBER))return{type:"number",value:this.advance().value};if(this.check(S.STRING))return{type:"string",value:this.advance().value};if(this.check(S.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(S.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(S.RPAREN),t}if(this.check(S.IDENT)){let t=this.advance().value;if(this.check(S.LPAREN)){this.advance();let n=[];if(!this.check(S.RPAREN))for(n.push(this.parseExpression());this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(S.RPAREN),{type:"call",name:t,args:n}}if(this.check(S.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(S.COMMA)){let r=[n];for(;this.check(S.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(S.RBRACKET);let s=r.reduce((i,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:o}));return{type:"array_access",array:t,key:s}}return this.expect(S.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(S.NUMBER))return{type:"number",value:this.advance().value};if(this.check(S.STRING))return{type:"string",value:this.advance().value};if(this.check(S.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(S.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(S.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(S.COMMA)){let n=[t];for(;this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(S.RPAREN),{type:"tuple",elements:n}}return this.expect(S.RPAREN),t}if(this.check(S.GETLINE)){this.advance();let t,n;return this.check(S.IDENT)&&(t=this.advance().value),this.check(S.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(S.IDENT)){let t=this.advance().value;if(this.check(S.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(S.RPAREN))for(n.push(this.parseExpression());this.check(S.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(S.RPAREN),{type:"call",name:t,args:n}}if(this.check(S.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(S.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(S.RBRACKET);let r;if(n.length===1)r=n[0];else{r=n[0];for(let s=1;s<n.length;s++)r={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:r,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:r}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}});var Ch={};ee(Ch,{awkCommand2:()=>Z9,flagsForFuzzing:()=>K9});function Gl(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
|
|
346
|
+
`).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function Ah(e){if(e===" ")return X("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return X(e)}catch{return X(Sh(e))}return X(Sh(e))}function Sh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var q9,Z9,K9,vh=I(()=>{"use strict";ye();tr();we();Qe();zn();cn();ae();ph();Eh();q9={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},Z9={name:"awk",async execute(e,t){lt(t.requireDefenseContext,"awk","execution entry");let n=(y,w)=>Rt(t.requireDefenseContext,"awk",y,w);if(W(e))return B(q9);let r=new er(/\s+/),s=" ",i=Object.create(null),o=0;for(let y=0;y<e.length;y++){let w=e[y];if(w==="-F"&&y+1<e.length)s=Gl(e[++y]),r=Ah(s),o=y+1;else if(w.startsWith("-F"))s=Gl(w.slice(2)),r=Ah(s),o=y+1;else if(w==="-v"&&y+1<e.length){let b=e[++y],x=b.indexOf("=");if(x>0){let A=b.slice(0,x),C=Gl(b.slice(x+1));i[A]=C}o=y+1}else{if(w.startsWith("--"))return Q("awk",w);if(w.startsWith("-")&&w.length>1){let b=w[1];if(b!=="F"&&b!=="v")return Q("awk",`-${b}`);o=y+1}else if(!w.startsWith("-")){o=y;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
|
|
347
|
+
`,exitCode:1};let a=e[o],l=e.slice(o+1),c=new po,u;try{u=c.parse(a)}catch(y){return{stdout:"",stderr:`awk: ${y instanceof Error?y.message:String(y)}
|
|
348
|
+
`,exitCode:1}}let f={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(y,w)=>{try{let b=await n("appendFile read",()=>t.fs.readFile(y));await n("appendFile write",()=>t.fs.writeFile(y,b+w))}catch(b){if(b instanceof de)throw b;await n("appendFile create",()=>t.fs.writeFile(y,w))}},resolvePath:t.fs.resolvePath.bind(t.fs)},p=t.exec,h=_l({fieldSep:r,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:f,cwd:t.cwd,exec:p?y=>n("command pipe exec",()=>p(y,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});h.FS=s,h.vars=Object.assign(Object.create(null),i),h.ARGC=l.length+1,h.ARGV=Object.create(null),h.ARGV[0]="awk";for(let y=0;y<l.length;y++)h.ARGV[String(y+1)]=l[y];h.ENVIRON=It(t.env);let d=new ci(h);d.execute(u);let m=u.rules.some(y=>y.pattern?.type!=="begin"&&y.pattern?.type!=="end"),g=u.rules.some(y=>y.pattern?.type==="end");try{if(await n("BEGIN execution",()=>d.executeBegin()),h.shouldExit)return await n("END execution after BEGIN exit",()=>d.executeEnd()),{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};if(!m&&!g)return{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};let y=[];if(l.length>0)for(let w of l)try{let b=t.fs.resolvePath(t.cwd,w),A=(await n("input file read",()=>t.fs.readFile(b))).split(`
|
|
349
|
+
`);A.length>0&&A[A.length-1]===""&&A.pop(),y.push({filename:w,lines:A})}catch(b){if(b instanceof de)throw b;return{stdout:"",stderr:`awk: ${w}: No such file or directory
|
|
350
|
+
`,exitCode:1}}else{let w=le(t.stdin).split(`
|
|
351
|
+
`);w.length>0&&w[w.length-1]===""&&w.pop(),y.push({filename:"",lines:w})}for(let w of y){for(h.FILENAME=w.filename,h.FNR=0,h.lines=w.lines,h.lineIndex=-1,h.shouldNextFile=!1;h.lineIndex<w.lines.length-1;){h.lineIndex++;let b=h.lineIndex;if(await n("line execution",()=>d.executeLine(w.lines[b])),h.shouldExit||h.shouldNextFile)break}if(h.shouldExit)break}return await n("END execution",()=>d.executeEnd()),{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()}}catch(y){if(y instanceof de)throw y;let w=y instanceof Error?y.message:String(y),b=y instanceof K?K.EXIT_CODE:2;return{stdout:d.getOutput(),stderr:`awk: ${w}
|
|
352
|
+
`,exitCode:b}}}};K9={name:"awk",flags:[{flag:"-F",type:"value",valueHint:"delimiter"},{flag:"-v",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function kh(e){let t=e.trim(),n=t.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!n){let o=parseFloat(t);return Number.isNaN(o)?0:o}let r=parseFloat(n[1]),s=(n[2]||"").toLowerCase(),i=Q9.get(s)??1;return r*i}function Nh(e){let t=e.trim().toLowerCase().slice(0,3);return X9.get(t)??0}function Y9(e,t){let n=e.split(/(\d+)/),r=t.split(/(\d+)/),s=Math.max(n.length,r.length);for(let i=0;i<s;i++){let o=n[i]||"",a=r[i]||"",l=/^\d+$/.test(o)?parseInt(o,10):null,c=/^\d+$/.test(a)?parseInt(a,10):null;if(l!==null&&c!==null){if(l!==c)return l-c}else if(o!==a)return o.localeCompare(a)}return 0}function Ih(e){return e.replace(/[^a-zA-Z0-9\s]/g,"")}function Vl(e,t,n){let r=n!==null?n:/\s+/,s=e.split(r),i=t.startField-1;if(i>=s.length)return"";if(t.endField===void 0){let l=s[i]||"";return t.startChar!==void 0&&(l=l.slice(t.startChar-1)),t.ignoreLeading&&(l=l.trimStart()),l}let o=Math.min(t.endField-1,s.length-1),a="";for(let l=i;l<=o&&l<s.length;l++){let c=s[l]||"";if(l===i&&t.startChar!==void 0&&(c=c.slice(t.startChar-1)),l===o&&t.endChar!==void 0){let u=l===i&&t.startChar!==void 0?t.endChar-t.startChar+1:t.endChar;c=c.slice(0,u)}l>i&&(a+=n||" "),a+=c}return t.ignoreLeading&&(a=a.trimStart()),a}function $h(e,t,n){let r=e,s=t;if(n.dictionaryOrder&&(r=Ih(r),s=Ih(s)),n.ignoreCase&&(r=r.toLowerCase(),s=s.toLowerCase()),n.monthSort){let i=Nh(r),o=Nh(s);return i-o}if(n.humanNumeric){let i=kh(r),o=kh(s);return i-o}if(n.versionSort)return Y9(r,s);if(n.numeric){let i=parseFloat(r)||0,o=parseFloat(s)||0;return i-o}return r.localeCompare(s)}function Th(e){let{keys:t,fieldDelimiter:n,numeric:r,ignoreCase:s,reverse:i,humanNumeric:o,versionSort:a,dictionaryOrder:l,monthSort:c,ignoreLeadingBlanks:u,stable:f}=e;return(p,h)=>{let d=p,m=h;if(u&&(d=d.trimStart(),m=m.trimStart()),t.length===0){let y=$h(d,m,{numeric:r,ignoreCase:s,humanNumeric:o,versionSort:a,dictionaryOrder:l,monthSort:c});if(y!==0)return i?-y:y;if(!f){let w=p.localeCompare(h);return i?-w:w}return 0}for(let g of t){let y=Vl(d,g,n),w=Vl(m,g,n);g.ignoreLeading&&(y=y.trimStart(),w=w.trimStart());let b={numeric:g.numeric??r,ignoreCase:g.ignoreCase??s,humanNumeric:g.humanNumeric??o,versionSort:g.versionSort??a,dictionaryOrder:g.dictionaryOrder??l,monthSort:g.monthSort??c},x=g.reverse??i,A=$h(y,w,b);if(A!==0)return x?-A:A}if(!f){let g=p.localeCompare(h);return i?-g:g}return 0}}function Oh(e,t){if(t.keys.length===0){if(t.ignoreCase){let s=new Set;return e.filter(i=>{let o=i.toLowerCase();return s.has(o)?!1:(s.add(o),!0)})}return[...new Set(e)]}let n=t.keys[0],r=new Set;return e.filter(s=>{let i=Vl(s,n,t.fieldDelimiter);return(n.ignoreCase??t.ignoreCase)&&(i=i.toLowerCase()),r.has(i)?!1:(r.add(i),!0)})}var Q9,X9,Rh=I(()=>{"use strict";Q9=new Map([["",1],["k",1024],["m",1048576],["g",1073741824],["t",1099511627776],["p",0x4000000000000],["e",1152921504606847e3]]),X9=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 ho(e){let t={startField:1},n="",r=e,s=r.match(/([bdfhMnrV]+)$/);s&&(n=s[1],r=r.slice(0,-n.length)),n.includes("n")&&(t.numeric=!0),n.includes("r")&&(t.reverse=!0),n.includes("f")&&(t.ignoreCase=!0),n.includes("b")&&(t.ignoreLeading=!0),n.includes("h")&&(t.humanNumeric=!0),n.includes("V")&&(t.versionSort=!0),n.includes("d")&&(t.dictionaryOrder=!0),n.includes("M")&&(t.monthSort=!0);let i=r.split(",");if(i.length===0||i[0]==="")return null;let o=i[0].split("."),a=parseInt(o[0],10);if(Number.isNaN(a)||a<1)return null;if(t.startField=a,o.length>1&&o[1]){let l=parseInt(o[1],10);!Number.isNaN(l)&&l>=1&&(t.startChar=l)}if(i.length>1&&i[1]){let l=i[1],c=l.match(/([bdfhMnrV]+)$/);if(c){let f=c[1];f.includes("n")&&(t.numeric=!0),f.includes("r")&&(t.reverse=!0),f.includes("f")&&(t.ignoreCase=!0),f.includes("b")&&(t.ignoreLeading=!0),f.includes("h")&&(t.humanNumeric=!0),f.includes("V")&&(t.versionSort=!0),f.includes("d")&&(t.dictionaryOrder=!0),f.includes("M")&&(t.monthSort=!0),l=l.slice(0,-f.length)}let u=l.split(".");if(u[0]){let f=parseInt(u[0],10);if(!Number.isNaN(f)&&f>=1&&(t.endField=f),u.length>1&&u[1]){let p=parseInt(u[1],10);!Number.isNaN(p)&&p>=1&&(t.endChar=p)}}}return t}var Ph=I(()=>{"use strict"});var Dh={};ee(Dh,{flagsForFuzzing:()=>tw,sortCommand:()=>ew});var J9,ew,tw,_h=I(()=>{"use strict";ye();Or();ae();Rh();Ph();J9={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]]
|
|
353
|
+
F is a field number (1-indexed)
|
|
354
|
+
C is a character position within the field (1-indexed)
|
|
355
|
+
OPTS can be: b d f h M n r V (per-key modifiers)
|
|
356
|
+
|
|
357
|
+
Examples:
|
|
358
|
+
-k1 sort by first field
|
|
359
|
+
-k2,2 sort by second field only
|
|
360
|
+
-k1.3 sort by first field starting at 3rd character
|
|
361
|
+
-k1,2n sort by fields 1-2 numerically
|
|
362
|
+
-k2 -k1 sort by field 2, then by field 1`},ew={name:"sort",async execute(e,t){if(W(e))return B(J9);let n={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},r=[];for(let c=0;c<e.length;c++){let u=e[c];if(u==="-r"||u==="--reverse")n.reverse=!0;else if(u==="-n"||u==="--numeric-sort")n.numeric=!0;else if(u==="-u"||u==="--unique")n.unique=!0;else if(u==="-f"||u==="--ignore-case")n.ignoreCase=!0;else if(u==="-h"||u==="--human-numeric-sort")n.humanNumeric=!0;else if(u==="-V"||u==="--version-sort")n.versionSort=!0;else if(u==="-d"||u==="--dictionary-order")n.dictionaryOrder=!0;else if(u==="-M"||u==="--month-sort")n.monthSort=!0;else if(u==="-b"||u==="--ignore-leading-blanks")n.ignoreLeadingBlanks=!0;else if(u==="-s"||u==="--stable")n.stable=!0;else if(u==="-c"||u==="--check")n.checkOnly=!0;else if(u==="-o"||u==="--output")n.outputFile=e[++c]||null;else if(u.startsWith("-o"))n.outputFile=u.slice(2)||null;else if(u.startsWith("--output="))n.outputFile=u.slice(9)||null;else if(u==="-t"||u==="--field-separator")n.fieldDelimiter=e[++c]||null;else if(u.startsWith("-t"))n.fieldDelimiter=u.slice(2)||null;else if(u.startsWith("--field-separator="))n.fieldDelimiter=u.slice(18)||null;else if(u==="-k"||u==="--key"){let f=e[++c];if(f){let p=ho(f);p&&n.keys.push(p)}}else if(u.startsWith("-k")){let f=ho(u.slice(2));f&&n.keys.push(f)}else if(u.startsWith("--key=")){let f=ho(u.slice(6));f&&n.keys.push(f)}else{if(u.startsWith("--"))return Q("sort",u);if(u.startsWith("-")&&!u.startsWith("--")){let f=!1;for(let p of u.slice(1))if(p==="r")n.reverse=!0;else if(p==="n")n.numeric=!0;else if(p==="u")n.unique=!0;else if(p==="f")n.ignoreCase=!0;else if(p==="h")n.humanNumeric=!0;else if(p==="V")n.versionSort=!0;else if(p==="d")n.dictionaryOrder=!0;else if(p==="M")n.monthSort=!0;else if(p==="b")n.ignoreLeadingBlanks=!0;else if(p==="s")n.stable=!0;else if(p==="c")n.checkOnly=!0;else{f=!0;break}if(f)return Q("sort",u)}else r.push(u)}}let s=await os(t,r,{cmdName:"sort"});if(!s.ok)return s.error;let o=le(s.content).split(`
|
|
363
|
+
`);o.length>0&&o[o.length-1]===""&&o.pop();let a=Th(n);if(n.checkOnly){let c=r.length>0?r[0]:"-";for(let u=1;u<o.length;u++)if(a(o[u-1],o[u])>0)return{stdout:"",stderr:`sort: ${c}:${u+1}: disorder: ${o[u]}
|
|
364
|
+
`,exitCode:1};return{stdout:"",stderr:"",exitCode:0}}o.sort(a),n.unique&&(o=Oh(o,n));let l=o.length>0?`${o.join(`
|
|
365
|
+
`)}
|
|
366
|
+
`:"";if(n.outputFile){let c=t.fs.resolvePath(t.cwd,n.outputFile);return await t.fs.writeFile(c,l),{stdout:"",stderr:"",exitCode:0}}return{stdout:l,stderr:"",exitCode:0}}},tw={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}});var Fh={};ee(Fh,{flagsForFuzzing:()=>iw,uniqCommand:()=>sw});var nw,rw,sw,iw,Lh=I(()=>{"use strict";ye();ct();Or();ae();nw={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"]},rw={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"}},sw={name:"uniq",async execute(e,t){if(W(e))return B(nw);let n=Ee("uniq",e,rw);if(!n.ok)return n.error;let{count:r,duplicatesOnly:s,uniqueOnly:i,ignoreCase:o}=n.result.flags,a=n.result.positional,l=await os(t,a,{cmdName:"uniq"});if(!l.ok)return l.error;let u=(o?le(l.content):l.content).split(`
|
|
367
|
+
`);if(u.length>0&&u[u.length-1]===""&&u.pop(),u.length===0)return{stdout:"",stderr:"",exitCode:0};let f=[],p=u[0],h=1,d=(y,w)=>o?y.toLowerCase()===w.toLowerCase():y===w;for(let y=1;y<u.length;y++)d(u[y],p)?h++:(f.push({line:p,count:h}),p=u[y],h=1);f.push({line:p,count:h});let m=f;s?m=f.filter(y=>y.count>1):i&&(m=f.filter(y=>y.count===1));let g="";for(let{line:y,count:w}of m)r?g+=`${String(w).padStart(4)} ${y}
|
|
368
|
+
`:g+=`${y}
|
|
369
|
+
`;return o?{stdout:g,stderr:"",exitCode:0}:{stdout:g,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},iw={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Mh={};ee(Mh,{commCommand:()=>aw,flagsForFuzzing:()=>lw});var ow,aw,lw,Uh=I(()=>{"use strict";ye();ae();ow={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"]},aw={name:"comm",async execute(e,t){if(W(e))return B(ow);let n=!1,r=!1,s=!1,i=[];for(let g of e)if(g==="-1")n=!0;else if(g==="-2")r=!0;else if(g==="-3")s=!0;else if(g==="-12"||g==="-21")n=!0,r=!0;else if(g==="-13"||g==="-31")n=!0,s=!0;else if(g==="-23"||g==="-32")r=!0,s=!0;else if(g==="-123"||g==="-132"||g==="-213"||g==="-231"||g==="-312"||g==="-321")n=!0,r=!0,s=!0;else{if(g.startsWith("-")&&g!=="-")return Q("comm",g);i.push(g)}if(i.length!==2)return{stdout:"",stderr:`comm: missing operand
|
|
370
|
+
Try 'comm --help' for more information.
|
|
371
|
+
`,exitCode:1};let o=async g=>{if(g==="-")return le(t.stdin);try{let y=t.fs.resolvePath(t.cwd,g);return await t.fs.readFile(y)}catch{return null}},a=await o(i[0]);if(a===null)return{stdout:"",stderr:`comm: ${i[0]}: No such file or directory
|
|
372
|
+
`,exitCode:1};let l=await o(i[1]);if(l===null)return{stdout:"",stderr:`comm: ${i[1]}: No such file or directory
|
|
373
|
+
`,exitCode:1};let c=a.split(`
|
|
374
|
+
`),u=l.split(`
|
|
375
|
+
`);c.length>0&&c[c.length-1]===""&&c.pop(),u.length>0&&u[u.length-1]===""&&u.pop();let f=0,p=0,h="",d=n?"":" ",m=(n?"":" ")+(r?"":" ");for(;f<c.length||p<u.length;)f>=c.length?(r||(h+=`${d}${u[p]}
|
|
376
|
+
`),p++):p>=u.length?(n||(h+=`${c[f]}
|
|
377
|
+
`),f++):c[f]<u[p]?(n||(h+=`${c[f]}
|
|
378
|
+
`),f++):c[f]>u[p]?(r||(h+=`${d}${u[p]}
|
|
379
|
+
`),p++):(s||(h+=`${m}${c[f]}
|
|
380
|
+
`),f++,p++);return{stdout:h,stderr:"",exitCode:0}}},lw={name:"comm",flags:[{flag:"-1",type:"boolean"},{flag:"-2",type:"boolean"},{flag:"-3",type:"boolean"}],needsArgs:!0,minArgs:2}});var Bh={};ee(Bh,{cutCommand:()=>pw,flagsForFuzzing:()=>hw});function uw(e){let t=[],n=e.split(",");for(let r of n)if(r.includes("-")){let[s,i]=r.split("-");t.push({start:s?parseInt(s,10):1,end:i?parseInt(i,10):null})}else{let s=parseInt(r,10);t.push({start:s,end:s})}return t}function fw(e,t){let n=[];for(let r of t){let s=r.start-1,i=r.end===null?e.length:r.end;for(let o=s;o<i&&o<e.length;o++)o>=0&&!n.includes(e[o])&&n.push(e[o])}return n}var cw,pw,hw,Wh=I(()=>{"use strict";ye();Or();ae();cw={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};pw={name:"cut",async execute(e,t){if(W(e))return B(cw);let n=" ",r=null,s=null,i=!1,o=[];for(let p=0;p<e.length;p++){let h=e[p];if(h==="-d")n=e[++p]||" ";else if(h.startsWith("-d"))n=h.slice(2);else if(h==="-f")r=e[++p];else if(h.startsWith("-f"))r=h.slice(2);else if(h==="-c")s=e[++p];else if(h.startsWith("-c"))s=h.slice(2);else if(h==="-s"||h==="--only-delimited")i=!0;else{if(h.startsWith("--"))return Q("cut",h);if(h.startsWith("-")){let d=!1;for(let m of h.slice(1))if(m==="s")i=!0;else if(!"dfc".includes(m)){d=!0;break}if(d)return Q("cut",h)}else o.push(h)}}if(!r&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
|
|
381
|
+
`,exitCode:1};let a=await os(t,o,{cmdName:"cut"});if(!a.ok)return a.error;let c=(s?le(a.content):a.content).split(`
|
|
382
|
+
`);c.length>0&&c[c.length-1]===""&&c.pop();let u=uw(r||s||"1"),f="";for(let p of c)if(s){let h=Array.from(p),d=[];for(let m of u){let g=m.start-1,y=m.end===null?h.length:m.end;for(let w=g;w<y&&w<h.length;w++)w>=0&&d.push(h[w])}f+=`${d.join("")}
|
|
383
|
+
`}else{if(i&&!p.includes(n))continue;let h=p.split(n),d=fw(h,u);f+=`${d.join(n)}
|
|
384
|
+
`}return s?{stdout:f,stderr:"",exitCode:0}:{stdout:f,stderr:"",exitCode:0,stdoutKind:"bytes",stdoutEncoding:"binary"}}},hw={name:"cut",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-f",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"string"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Hh={};ee(Hh,{flagsForFuzzing:()=>yw,pasteCommand:()=>gw});function zh(e,t){if(e.length===0)return"";if(e.length===1)return e[0];let n=e[0];for(let r=1;r<e.length;r++){let s=(r-1)%t.length;n+=t[s]+e[r]}return n}var dw,mw,gw,yw,jh=I(()=>{"use strict";ye();ct();ae();dw={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},mw={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},gw={name:"paste",async execute(e,t){if(W(e))return B(dw);let n=Ee("paste",e,mw);if(!n.ok)return n.error;let r=n.result.flags.delimiter,s=n.result.flags.serial,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
|
|
385
|
+
`,exitCode:1};let o=le(t.stdin),a=o?o.split(`
|
|
386
|
+
`):[""];a.length>0&&a[a.length-1]===""&&a.pop();let l=i.filter(p=>p==="-").length,c=[],u=0;for(let p of i)if(p==="-"){let h=[];for(let d=u;d<a.length;d+=l)h.push(a[d]);c.push(h),u++}else{let h=t.fs.resolvePath(t.cwd,p);try{let m=(await t.fs.readFile(h)).split(`
|
|
387
|
+
`);m.length>0&&m[m.length-1]===""&&m.pop(),c.push(m)}catch{return{stdout:"",stderr:`paste: ${p}: No such file or directory
|
|
388
|
+
`,exitCode:1}}}let f="";if(s)for(let p of c)p&&(f+=`${zh(p,r)}
|
|
389
|
+
`);else{let p=Math.max(...c.map(h=>h?.length??0));for(let h=0;h<p;h++){let d=[];for(let m of c)d.push(m?.[h]??"");f+=`${zh(d,r)}
|
|
390
|
+
`}}return{stdout:f,stderr:"",exitCode:0}}};yw={name:"paste",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Vh={};ee(Vh,{flagsForFuzzing:()=>Aw,trCommand:()=>Ew});function Gh(e){let t="",n=0;for(;n<e.length;){if(e[n]==="["&&e[n+1]===":"){let r=!1;for(let[s,i]of bw)if(e.slice(n).startsWith(s)){t+=i,n+=s.length,r=!0;break}if(r)continue}if(e[n]==="\\"&&n+1<e.length){let r=e[n+1];r==="n"?t+=`
|
|
391
|
+
`:r==="t"?t+=" ":r==="r"?t+="\r":t+=r,n+=2;continue}if(n+2<e.length&&e[n+1]==="-"){let r=e.charCodeAt(n),s=e.charCodeAt(n+2);if(s-r>65536)throw new Error(`tr: character range too large: '${e[n]}-${e[n+2]}'`);for(let i=r;i<=s;i++)t+=String.fromCharCode(i);n+=3;continue}t+=e[n],n++}return t}var ww,bw,xw,Ew,Aw,qh=I(()=>{"use strict";ye();An();ct();ae();ww={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
|
|
392
|
+
a-z character range
|
|
393
|
+
[:alnum:] all letters and digits
|
|
394
|
+
[:alpha:] all letters
|
|
395
|
+
[:digit:] all digits
|
|
396
|
+
[:lower:] all lowercase letters
|
|
397
|
+
[:upper:] all uppercase letters
|
|
398
|
+
[:space:] all whitespace
|
|
399
|
+
[:blank:] horizontal whitespace
|
|
400
|
+
[:punct:] all punctuation
|
|
401
|
+
[:print:] all printable characters
|
|
402
|
+
[:graph:] all printable characters except space
|
|
403
|
+
[:cntrl:] all control characters
|
|
404
|
+
[:xdigit:] all hexadecimal digits
|
|
405
|
+
\\n, \\t, \\r escape sequences`},bw=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(e,t)=>String.fromCharCode(t)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(e,t)=>String.fromCharCode(33+t)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(e,t)=>String.fromCharCode(32+t)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",`
|
|
406
|
+
\r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);xw={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},Ew={name:"tr",async execute(e,t){if(W(e))return B(ww);let n=Ee("tr",e,xw);if(!n.ok)return n.error;let r=n.result.flags.complement||n.result.flags.complementUpper,s=n.result.flags.delete,i=n.result.flags.squeeze,o=n.result.positional;if(o.length<1)return{stdout:"",stderr:`tr: missing operand
|
|
407
|
+
`,exitCode:1};if(!s&&!i&&o.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
|
|
408
|
+
`,exitCode:1};let a,l;try{a=Gh(o[0]),l=o.length>1?Gh(o[1]):""}catch(p){return{stdout:"",stderr:`${ze(p.message)}
|
|
409
|
+
`,exitCode:1}}let c=le(t.stdin),u=p=>{let h=a.includes(p);return r?!h:h},f="";if(s)for(let p of c)u(p)||(f+=p);else if(i&&o.length===1){let p="";for(let h of c)u(h)&&h===p||(f+=h,p=h)}else{if(r){let p=l.length>0?l[l.length-1]:"";for(let h of c)a.includes(h)?f+=h:f+=p}else{let p=new Map;for(let h=0;h<a.length;h++){let d=h<l.length?l[h]:l[l.length-1];p.set(a[h],d)}for(let h of c)f+=p.get(h)??h}if(i){let p="",h="";for(let d of f)l.includes(d)&&d===h||(p+=d,h=d);f=p}}return{stdout:f,stderr:"",exitCode:0}}},Aw={name:"tr",flags:[{flag:"-c",type:"boolean"},{flag:"-C",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-s",type:"boolean"}],stdinType:"text",needsArgs:!0}});var Zh={};ee(Zh,{flagsForFuzzing:()=>kw,rev:()=>vw});function Cw(e){return Array.from(e).reverse().join("")}var Sw,vw,kw,Kh=I(()=>{"use strict";ye();ae();Sw={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};vw={name:"rev",execute:async(e,t)=>{if(W(e))return B(Sw);let n=[];for(let i of e)if(i==="--"){let o=e.indexOf(i);n.push(...e.slice(o+1));break}else{if(i.startsWith("-")&&i!=="-")return Q("rev",i);n.push(i)}let r="",s=i=>{let o=i.split(`
|
|
410
|
+
`),a=i.endsWith(`
|
|
411
|
+
`)&&o[o.length-1]==="";return a&&o.pop(),o.map(Cw).join(`
|
|
412
|
+
`)+(a?`
|
|
413
|
+
`:"")};if(n.length===0){let i=le(t.stdin)??"";r=s(i)}else for(let i of n)if(i==="-"){let o=le(t.stdin)??"";r+=s(o)}else{let o=t.fs.resolvePath(t.cwd,i),a=await t.fs.readFile(o);if(a===null)return{exitCode:1,stdout:r,stderr:`rev: ${i}: No such file or directory
|
|
414
|
+
`};r+=s(a)}return{exitCode:0,stdout:r,stderr:""}}},kw={name:"rev",flags:[],stdinType:"text",needsFiles:!0}});var Xh={};ee(Xh,{flagsForFuzzing:()=>Ow,nl:()=>Tw});function Iw(e,t,n){let r=String(e);switch(t){case"ln":return r.padEnd(n);case"rn":return r.padStart(n);case"rz":return r.padStart(n,"0");default:return t}}function $w(e,t){switch(t){case"a":return!0;case"t":return e.trim().length>0;case"n":return!1;default:return t}}function Qh(e,t,n){if(e==="")return{output:"",nextNumber:n};let r=e.split(`
|
|
415
|
+
`),s=[],i=n,o=e.endsWith(`
|
|
416
|
+
`)&&r[r.length-1]==="";o&&r.pop();for(let a of r)if($w(a,t.bodyStyle)){let l=Iw(i,t.numberFormat,t.width);s.push(`${l}${t.separator}${a}`),i+=t.increment}else{let l=" ".repeat(t.width);s.push(`${l}${t.separator}${a}`)}return{output:s.join(`
|
|
417
|
+
`)+(o?`
|
|
418
|
+
`:""),nextNumber:i}}var Nw,Tw,Ow,Yh=I(()=>{"use strict";ye();ae();Nw={name:"nl",summary:"number lines of files",usage:"nl [OPTION]... [FILE]...",description:"Write each FILE to standard output, with line numbers added. If no FILE is specified, standard input is read.",options:["-b STYLE Body numbering style: a (all), t (non-empty), n (none)","-n FORMAT Number format: ln (left), rn (right), rz (right zeros)","-w WIDTH Number width (default: 6)","-s SEP Separator after number (default: TAB)","-v START Starting line number (default: 1)","-i INCR Line number increment (default: 1)"],examples:["nl file.txt # Number non-empty lines","nl -ba file.txt # Number all lines","nl -n rz -w 3 file.txt # Right-justified with zeros","nl -s ': ' file.txt # Use ': ' as separator"]};Tw={name:"nl",execute:async(e,t)=>{if(W(e))return B(Nw);let n={bodyStyle:"t",numberFormat:"rn",width:6,separator:" ",startNumber:1,increment:1},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-b"&&s+1<e.length){let l=e[s+1];if(l!=="a"&&l!=="t"&&l!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${l}'
|
|
419
|
+
`};n.bodyStyle=l,s+=2}else if(a.startsWith("-b")){let l=a.slice(2);if(l!=="a"&&l!=="t"&&l!=="n")return{exitCode:1,stdout:"",stderr:`nl: invalid body numbering style: '${l}'
|
|
420
|
+
`};n.bodyStyle=l,s++}else if(a==="-n"&&s+1<e.length){let l=e[s+1];if(l!=="ln"&&l!=="rn"&&l!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${l}'
|
|
421
|
+
`};n.numberFormat=l,s+=2}else if(a.startsWith("-n")){let l=a.slice(2);if(l!=="ln"&&l!=="rn"&&l!=="rz")return{exitCode:1,stdout:"",stderr:`nl: invalid line numbering format: '${l}'
|
|
422
|
+
`};n.numberFormat=l,s++}else if(a==="-w"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${e[s+1]}'
|
|
423
|
+
`};n.width=l,s+=2}else if(a.startsWith("-w")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`nl: invalid line number field width: '${a.slice(2)}'
|
|
424
|
+
`};n.width=l,s++}else if(a==="-s"&&s+1<e.length)n.separator=e[s+1],s+=2;else if(a.startsWith("-s"))n.separator=a.slice(2),s++;else if(a==="-v"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${e[s+1]}'
|
|
425
|
+
`};n.startNumber=l,s+=2}else if(a.startsWith("-v")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid starting line number: '${a.slice(2)}'
|
|
426
|
+
`};n.startNumber=l,s++}else if(a==="-i"&&s+1<e.length){let l=parseInt(e[s+1],10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${e[s+1]}'
|
|
427
|
+
`};n.increment=l,s+=2}else if(a.startsWith("-i")){let l=parseInt(a.slice(2),10);if(Number.isNaN(l))return{exitCode:1,stdout:"",stderr:`nl: invalid line number increment: '${a.slice(2)}'
|
|
428
|
+
`};n.increment=l,s++}else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Q("nl",a);r.push(a),s++}}let i="",o=n.startNumber;if(r.length===0){let a=le(t.stdin)??"";i=Qh(a,n,o).output}else for(let a of r){let l=t.fs.resolvePath(t.cwd,a),c=await t.fs.readFile(l);if(c===null)return{exitCode:1,stdout:i,stderr:`nl: ${a}: No such file or directory
|
|
429
|
+
`};let u=Qh(c,n,o);i+=u.output,o=u.nextNumber}return{exitCode:0,stdout:i,stderr:""}}},Ow={name:"nl",flags:[{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"string"},{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"value",valueHint:"string"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-i",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var ed={};ee(ed,{flagsForFuzzing:()=>Fw,fold:()=>_w});function Pw(e,t,n){return n?new TextEncoder().encode(e).length:e===" "?8-t%8:e==="\b"?-1:1}function Dw(e,t){if(e.length===0)return e;let{width:n,breakAtSpaces:r,countBytes:s}=t,i=[],o="",a=0,l=-1,c=0;for(let u=0;u<e.length;u++){let f=e[u],p=Pw(f,a,s);a+p>n&&o.length>0?r&&l>=0?(i.push(o.slice(0,l+1)),o=o.slice(l+1)+f,a=a-c-1+p,l=-1,c=0):(i.push(o),o=f,a=p,l=-1,c=0):(o+=f,a+=p,(f===" "||f===" ")&&(l=o.length-1,c=a-p))}return o.length>0&&i.push(o),i.join(`
|
|
430
|
+
`)}function Jh(e,t){if(e==="")return"";let n=e.split(`
|
|
431
|
+
`),r=e.endsWith(`
|
|
432
|
+
`)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Dw(i,t)).join(`
|
|
433
|
+
`)+(r?`
|
|
434
|
+
`:"")}var Rw,_w,Fw,td=I(()=>{"use strict";ye();ae();Rw={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};_w={name:"fold",execute:async(e,t)=>{if(W(e))return B(Rw);let n={width:80,breakAtSpaces:!1,countBytes:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-w"&&s+1<e.length){let a=parseInt(e[s+1],10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
|
|
435
|
+
`};n.width=a,s+=2}else if(o.startsWith("-w")&&o.length>2){let a=parseInt(o.slice(2),10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${o.slice(2)}'
|
|
436
|
+
`};n.width=a,s++}else if(o==="-s")n.breakAtSpaces=!0,s++;else if(o==="-b")n.countBytes=!0,s++;else if(o==="-bs"||o==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,s++;else if(o.match(/^-[sb]+w\d+$/)){o.includes("s")&&(n.breakAtSpaces=!0),o.includes("b")&&(n.countBytes=!0);let a=o.replace(/^-[sb]+w/,""),l=parseInt(a,10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${a}'
|
|
437
|
+
`};n.width=l,s++}else if(o.match(/^-[sb]+w$/)&&s+1<e.length){o.includes("s")&&(n.breakAtSpaces=!0),o.includes("b")&&(n.countBytes=!0);let a=parseInt(e[s+1],10);if(Number.isNaN(a)||a<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
|
|
438
|
+
`};n.width=a,s+=2}else if(o==="--"){r.push(...e.slice(s+1));break}else if(o.startsWith("-")&&o!=="-"){let a=o.slice(1),l=!1;for(let c of a)if(c==="s")n.breakAtSpaces=!0;else if(c==="b")n.countBytes=!0;else{l=!0;break}if(l)return Q("fold",o);s++}else r.push(o),s++}let i="";if(r.length===0){let o=le(t.stdin)??"";i=Jh(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`fold: ${o}: No such file or directory
|
|
439
|
+
`};i+=Jh(l,n)}return{exitCode:0,stdout:i,stderr:""}}},Fw={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0}});var rd={};ee(rd,{expand:()=>Bw,flagsForFuzzing:()=>Ww});function mo(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function Mw(e,t){if(t.length===1){let n=t[0];return n-e%n}for(let n of t)if(n>e)return n-e;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n-e}return 1}function Uw(e,t){let{tabStops:n,leadingOnly:r}=t,s="",i=0,o=!0;for(let a of e)if(a===" ")if(r&&!o)s+=a,i++;else{let l=Mw(i,n);s+=" ".repeat(l),i+=l}else a!==" "&&a!==" "&&(o=!1),s+=a,i++;return s}function nd(e,t){if(e==="")return"";let n=e.split(`
|
|
440
|
+
`),r=e.endsWith(`
|
|
441
|
+
`)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Uw(i,t)).join(`
|
|
442
|
+
`)+(r?`
|
|
443
|
+
`:"")}var Lw,Bw,Ww,sd=I(()=>{"use strict";ye();ae();Lw={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]};Bw={name:"expand",execute:async(e,t)=>{if(W(e))return B(Lw);let n={tabStops:[8],leadingOnly:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-t"&&s+1<e.length){let a=mo(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[s+1]}'
|
|
444
|
+
`};n.tabStops=a,s+=2}else if(o.startsWith("-t")&&o.length>2){let a=mo(o.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${o.slice(2)}'
|
|
445
|
+
`};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=mo(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[s+1]}'
|
|
446
|
+
`};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=mo(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${o.slice(7)}'
|
|
447
|
+
`};n.tabStops=a,s++}else if(o==="-i"||o==="--initial")n.leadingOnly=!0,s++;else if(o==="--"){r.push(...e.slice(s+1));break}else{if(o.startsWith("-")&&o!=="-")return Q("expand",o);r.push(o),s++}}let i="";if(r.length===0){let o=le(t.stdin)??"";i=nd(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`expand: ${o}: No such file or directory
|
|
448
|
+
`};i+=nd(l,n)}return{exitCode:0,stdout:i,stderr:""}}},Ww={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var ad={};ee(ad,{flagsForFuzzing:()=>Gw,unexpand:()=>jw});function go(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function id(e,t){if(t.length===1){let n=t[0];return e+(n-e%n)}for(let n of t)if(n>e)return n;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n}return-1}function Hw(e,t){let{tabStops:n,allBlanks:r}=t,s="",i=0,o="",a=0,l=!0,c=()=>{if(o.length===0)return;let u=a+o.length;if(!r&&!l){s+=o,o="";return}let f=a,p="";for(;f<u;){let d=id(f,n);if(d<=u&&d>f)p+=" ",f=d;else break}let h=u-f;h>0&&(p+=" ".repeat(h)),s+=p,o=""};for(let u of e)u===" "?(o.length===0&&(a=i),o+=u,i++):u===" "?(c(),s+=u,i=id(i,n)):(c(),s+=u,i++,l=!1);return c(),s}function od(e,t){if(e==="")return"";let n=e.split(`
|
|
449
|
+
`),r=e.endsWith(`
|
|
450
|
+
`)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>Hw(i,t)).join(`
|
|
451
|
+
`)+(r?`
|
|
452
|
+
`:"")}var zw,jw,Gw,ld=I(()=>{"use strict";ye();ae();zw={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};jw={name:"unexpand",execute:async(e,t)=>{if(W(e))return B(zw);let n={tabStops:[8],allBlanks:!1},r=[],s=0;for(;s<e.length;){let o=e[s];if(o==="-t"&&s+1<e.length){let a=go(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
|
|
453
|
+
`};n.tabStops=a,s+=2}else if(o.startsWith("-t")&&o.length>2){let a=go(o.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(2)}'
|
|
454
|
+
`};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=go(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
|
|
455
|
+
`};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=go(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(7)}'
|
|
456
|
+
`};n.tabStops=a,s++}else if(o==="-a"||o==="--all")n.allBlanks=!0,s++;else if(o==="--"){r.push(...e.slice(s+1));break}else{if(o.startsWith("-")&&o!=="-")return Q("unexpand",o);r.push(o),s++}}let i="";if(r.length===0){let o=le(t.stdin)??"";i=od(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`unexpand: ${o}: No such file or directory
|
|
457
|
+
`};i+=od(l,n)}return{exitCode:0,stdout:i,stderr:""}}},Gw={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var fd={};ee(fd,{flagsForFuzzing:()=>Kw,strings:()=>Zw});function qw(e){return e>=32&&e<=126||e===9}function cd(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function ud(e,t){let n=[],r="",s=0,i=typeof e=="string"?new TextEncoder().encode(e):e;for(let o=0;o<i.length;o++){let a=i[o];if(qw(a))r.length===0&&(s=o),r+=String.fromCharCode(a);else{if(r.length>=t.minLength){let l=cd(s,t.offsetFormat);n.push(`${l}${r}`)}r=""}}if(r.length>=t.minLength){let o=cd(s,t.offsetFormat);n.push(`${o}${r}`)}return n}var Vw,Zw,Kw,pd=I(()=>{"use strict";ye();ae();Vw={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"]};Zw={name:"strings",execute:async(e,t)=>{if(W(e))return B(Vw);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-n"&&s+1<e.length){let l=Number.parseInt(e[s+1],10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
|
|
458
|
+
`};n.minLength=l,s+=2}else if(a.match(/^-n\d+$/)){let l=Number.parseInt(a.slice(2),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(2)}'
|
|
459
|
+
`};n.minLength=l,s++}else if(a.match(/^-\d+$/)){let l=Number.parseInt(a.slice(1),10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(1)}'
|
|
460
|
+
`};n.minLength=l,s++}else if(a==="-t"&&s+1<e.length){let l=e[s+1];if(l!=="o"&&l!=="x"&&l!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${l}'
|
|
461
|
+
`};n.offsetFormat=l,s+=2}else if(a.startsWith("-t")&&a.length===3){let l=a[2];if(l!=="o"&&l!=="x"&&l!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${l}'
|
|
462
|
+
`};n.offsetFormat=l,s++}else if(a==="-a"||a==="--all"||a==="-")a==="-"&&r.push(a),s++;else if(a==="-e"&&s+1<e.length){let l=e[s+1];if(l!=="s"&&l!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${l}'
|
|
463
|
+
`};s+=2}else if(a.startsWith("-e")&&a.length===3){let l=a[2];if(l!=="s"&&l!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${l}'
|
|
464
|
+
`};s++}else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Q("strings",a);r.push(a),s++}}let i="",o=()=>Uint8Array.from(t.stdin??"",a=>a.charCodeAt(0));if(r.length===0){let a=ud(o(),n);i=a.length>0?`${a.join(`
|
|
465
|
+
`)}
|
|
466
|
+
`:""}else for(let a of r){let l;if(a==="-")l=o();else{let u=t.fs.resolvePath(t.cwd,a);try{l=await t.fs.readFileBuffer(u)}catch{return{exitCode:1,stdout:i,stderr:`strings: ${a}: No such file or directory
|
|
467
|
+
`}}}let c=ud(l,n);c.length>0&&(i+=`${c.join(`
|
|
468
|
+
`)}
|
|
469
|
+
`)}return{exitCode:0,stdout:i,stderr:""}}},Kw={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}});var md={};ee(md,{flagsForFuzzing:()=>nb,split:()=>tb});function dd(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let n=Number.parseInt(t[1],10);if(Number.isNaN(n)||n<1)return null;let r=(t[2]||"").toUpperCase(),i=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(r);return i===void 0?null:n*i}function Xw(e,t,n){if(t)return e.toString().padStart(n,"0");let r="abcdefghijklmnopqrstuvwxyz",s="",i=e;for(let o=0;o<n;o++)s=r[i%26]+s,i=Math.floor(i/26);return s}function Yw(e,t){let n=e.split(`
|
|
470
|
+
`),r=e.endsWith(`
|
|
471
|
+
`)&&n[n.length-1]==="";r&&n.pop();let s=[];for(let i=0;i<n.length;i+=t){let o=n.slice(i,i+t),l=i+t>=n.length&&!r?o.join(`
|
|
472
|
+
`):`${o.join(`
|
|
473
|
+
`)}
|
|
474
|
+
`;s.push({content:l,hasContent:!0})}return s}function Jw(e,t){let r=new TextEncoder().encode(e),s=new TextDecoder,i=[];for(let o=0;o<r.length;o+=t){let a=r.slice(o,o+t);i.push({content:s.decode(a),hasContent:a.length>0})}return i}function eb(e,t){let r=new TextEncoder().encode(e),s=new TextDecoder,i=[],o=Math.ceil(r.length/t);for(let a=0;a<t;a++){let l=a*o,c=Math.min(l+o,r.length),u=r.slice(l,c);i.push({content:s.decode(u),hasContent:u.length>0})}return i}var Qw,hd,tb,nb,gd=I(()=>{"use strict";ye();ae();Qw={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, ..."]},hd=1e5;tb={name:"split",execute:async(e,t)=>{if(W(e))return B(Qw);let n={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},r=[],s=0;for(;s<e.length;){let c=e[s];if(c==="-l"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[s+1]}'
|
|
475
|
+
`};n.mode="lines",n.lines=u,s+=2}else if(c.match(/^-l\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${c.slice(2)}'
|
|
476
|
+
`};n.mode="lines",n.lines=u,s++}else if(c==="-b"&&s+1<e.length){let u=dd(e[s+1]);if(u===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[s+1]}'
|
|
477
|
+
`};n.mode="bytes",n.bytes=u,s+=2}else if(c.match(/^-b.+$/)){let u=dd(c.slice(2));if(u===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${c.slice(2)}'
|
|
478
|
+
`};n.mode="bytes",n.bytes=u,s++}else if(c==="-n"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${e[s+1]}'
|
|
479
|
+
`};n.mode="chunks",n.chunks=u,s+=2}else if(c.match(/^-n\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${c.slice(2)}'
|
|
480
|
+
`};n.mode="chunks",n.chunks=u,s++}else if(c==="-a"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[s+1]}'
|
|
481
|
+
`};n.suffixLength=u,s+=2}else if(c.match(/^-a\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${c.slice(2)}'
|
|
482
|
+
`};n.suffixLength=u,s++}else if(c==="-d"||c==="--numeric-suffixes")n.useNumericSuffix=!0,s++;else if(c.startsWith("--additional-suffix="))n.additionalSuffix=c.slice(20),s++;else if(c==="--additional-suffix"&&s+1<e.length)n.additionalSuffix=e[s+1],s+=2;else if(c==="--"){r.push(...e.slice(s+1));break}else{if(c.startsWith("-")&&c!=="-")return Q("split",c);r.push(c),s++}}let i="-",o="x";r.length>=1&&(i=r[0]),r.length>=2&&(o=r[1]);let a;if(i==="-")a=t.stdin??"";else{let c=t.fs.resolvePath(t.cwd,i);try{let u=await fn(t.fs,c);a=u}catch{return{exitCode:1,stdout:"",stderr:`split: ${i}: No such file or directory
|
|
483
|
+
`}}}if(a==="")return{exitCode:0,stdout:"",stderr:""};let l;switch(n.mode){case"lines":l=Yw(a,n.lines);break;case"bytes":l=Jw(a,n.bytes);break;case"chunks":l=eb(a,n.chunks);break;default:return n.mode}if(l.length>hd)return{exitCode:1,stdout:"",stderr:`split: too many output files (${l.length}), limit is ${hd}
|
|
484
|
+
`};for(let c=0;c<l.length;c++){let u=l[c];if(!u.hasContent)continue;let f=Xw(c,n.useNumericSuffix,n.suffixLength),p=`${o}${f}${n.additionalSuffix}`,h=t.fs.resolvePath(t.cwd,p);await t.fs.writeFile(h,u.content,"binary")}return{exitCode:0,stdout:"",stderr:""}}},nb={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}});var wd={};ee(wd,{column:()=>lb,flagsForFuzzing:()=>cb});function yd(e,t,n){return t?n?e.split(t):e.split(t).filter(r=>r.length>0):n?e.split(/[ \t]/):e.split(/[ \t]+/).filter(r=>r.length>0)}function ib(e){let t=[];for(let n of e)for(let r=0;r<n.length;r++){let s=n[r].length;(t[r]===void 0||s>t[r])&&(t[r]=s)}return t}function ob(e,t){if(e.length===0)return"";let n=ib(e),r=[];for(let s of e){let i=[];for(let o=0;o<s.length;o++)o===s.length-1?i.push(s[o]):i.push(s[o].padEnd(n[o]));r.push(i.join(t))}return r.join(`
|
|
485
|
+
`)}function ab(e,t,n){if(e.length===0)return"";let r=Math.max(...e.map(c=>c.length)),s=n.length,i=r+s,o=Math.max(1,Math.floor((t+s)/i)),a=Math.ceil(e.length/o),l=[];for(let c=0;c<a;c++){let u=[];for(let f=0;f<o;f++){let p=f*a+c;p<e.length&&(f===o-1||(f+1)*a+c>=e.length?u.push(e[p]):u.push(e[p].padEnd(r)))}l.push(u.join(n))}return l.join(`
|
|
486
|
+
`)}var rb,sb,lb,cb,bd=I(()=>{"use strict";ye();ct();ae();rb={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},sb={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};lb={name:"column",execute:async(e,t)=>{if(W(e))return B(rb);let n=Ee("column",e,sb);if(!n.ok)return n.error;let{table:r,separator:s,outputSep:i,width:o,noMerge:a}=n.result.flags,l=n.result.positional,c=i??" ",u;if(l.length===0)u=le(t.stdin)??"";else{let m=[];for(let g of l)if(g==="-")m.push(le(t.stdin)??"");else{let y=t.fs.resolvePath(t.cwd,g),w=await t.fs.readFile(y);if(w===null)return{exitCode:1,stdout:"",stderr:`column: ${g}: No such file or directory
|
|
487
|
+
`};m.push(w)}u=m.join("")}if(u===""||u.trim()==="")return{exitCode:0,stdout:"",stderr:""};let f=u.split(`
|
|
488
|
+
`);u.endsWith(`
|
|
489
|
+
`)&&f[f.length-1]===""&&f.pop();let h=f.filter(m=>m.trim().length>0),d;if(r){let m=h.map(g=>yd(g,s,a));d=ob(m,c)}else{let m=[];for(let g of h){let y=yd(g,s,a);m.push(...y)}d=ab(m,o,c)}return d.length>0&&(d+=`
|
|
490
|
+
`),{exitCode:0,stdout:d,stderr:""}}},cb={name:"column",flags:[{flag:"-t",type:"boolean"},{flag:"-s",type:"value",valueHint:"delimiter"},{flag:"-o",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"number"},{flag:"-n",type:"boolean"}],stdinType:"text",needsFiles:!0}});var xd={};ee(xd,{flagsForFuzzing:()=>mb,join:()=>db});function fb(e,t){return t?e.split(t):e.split(/[ \t]+/).filter(n=>n.length>0)}function pb(e,t,n,r){let s=fb(e,t),i=s[n-1]??"";return r&&(i=i.toLowerCase()),{fields:s,joinKey:i,original:e}}function ql(e,t,n){let r=n.separator??" ";if(n.outputFormat){let o=[];for(let{file:a,field:l}of n.outputFormat){let c=a===1?e:t;c&&l===0?o.push(c.joinKey):c&&c.fields[l-1]!==void 0?o.push(c.fields[l-1]):o.push(n.emptyString)}return o.join(r)}let s=[],i=e?.joinKey??t?.joinKey??"";if(s.push(i),e)for(let o=0;o<e.fields.length;o++)o!==n.field1-1&&s.push(e.fields[o]);if(t)for(let o=0;o<t.fields.length;o++)o!==n.field2-1&&s.push(t.fields[o]);return s.join(r)}function hb(e){let t=e.split(","),n=[];for(let r of t){let s=r.trim().match(/^(\d+)\.(\d+)$/);if(!s)return null;let i=Number.parseInt(s[1],10),o=Number.parseInt(s[2],10);if(i!==1&&i!==2)return null;n.push({file:i,field:o})}return n}var ub,db,mb,Ed=I(()=>{"use strict";ye();ae();ub={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"]};db={name:"join",execute:async(e,t)=>{if(W(e))return B(ub);let n={field1:1,field2:1,separator:null,printUnpairable:new Set,onlyUnpairable:new Set,emptyString:"",outputFormat:null,ignoreCase:!1},r=[],s=0;for(;s<e.length;){let p=e[s];if(p==="-1"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(Number.isNaN(h)||h<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
|
|
491
|
+
`};n.field1=h,s+=2}else if(p==="-2"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(Number.isNaN(h)||h<1)return{exitCode:1,stdout:"",stderr:`join: invalid field number: '${e[s+1]}'
|
|
492
|
+
`};n.field2=h,s+=2}else if((p==="-t"||p==="--field-separator")&&s+1<e.length)n.separator=e[s+1],s+=2;else if(p.startsWith("-t")&&p.length>2)n.separator=p.slice(2),s++;else if(p==="-a"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(h!==1&&h!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
|
|
493
|
+
`};n.printUnpairable.add(h),s+=2}else if(p.match(/^-a[12]$/))n.printUnpairable.add(Number.parseInt(p[2],10)),s++;else if(p==="-v"&&s+1<e.length){let h=Number.parseInt(e[s+1],10);if(h!==1&&h!==2)return{exitCode:1,stdout:"",stderr:`join: invalid file number: '${e[s+1]}'
|
|
494
|
+
`};n.onlyUnpairable.add(h),s+=2}else if(p.match(/^-v[12]$/))n.onlyUnpairable.add(Number.parseInt(p[2],10)),s++;else if(p==="-e"&&s+1<e.length)n.emptyString=e[s+1],s+=2;else if(p==="-o"&&s+1<e.length){let h=hb(e[s+1]);if(!h)return{exitCode:1,stdout:"",stderr:`join: invalid field spec: '${e[s+1]}'
|
|
495
|
+
`};n.outputFormat=h,s+=2}else if(p==="-i"||p==="--ignore-case")n.ignoreCase=!0,s++;else if(p==="--"){r.push(...e.slice(s+1));break}else{if(p.startsWith("-")&&p!=="-")return Q("join",p);r.push(p),s++}}if(r.length!==2)return{exitCode:1,stdout:"",stderr:r.length<2?`join: missing file operand
|
|
496
|
+
`:`join: extra operand
|
|
497
|
+
`};let i=[];for(let p of r)if(p==="-")i.push(le(t.stdin)??"");else{let h=t.fs.resolvePath(t.cwd,p),d=await t.fs.readFile(h);if(d===null)return{exitCode:1,stdout:"",stderr:`join: ${p}: No such file or directory
|
|
498
|
+
`};i.push(d)}let o=(p,h)=>{let d=p.split(`
|
|
499
|
+
`);return p.endsWith(`
|
|
500
|
+
`)&&d[d.length-1]===""&&d.pop(),d.filter(m=>m.length>0).map(m=>pb(m,n.separator,h,n.ignoreCase))},a=o(i[0],n.field1),l=o(i[1],n.field2),c=new Map;for(let p of l){let h=c.get(p.joinKey);h?h.push(p):c.set(p.joinKey,[p])}let u=[],f=new Set;for(let p of a){let h=c.get(p.joinKey);if(h&&h.length>0){if(f.add(p.joinKey),n.onlyUnpairable.size===0)for(let d of h)u.push(ql(p,d,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&u.push(ql(p,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let p of l)f.has(p.joinKey)||u.push(ql(null,p,n));return{exitCode:0,stdout:un(u.length>0?`${u.join(`
|
|
501
|
+
`)}
|
|
502
|
+
`:""),stderr:"",stdoutEncoding:"binary"}}},mb={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}});var Ad={};ee(Ad,{flagsForFuzzing:()=>bb,teeCommand:()=>wb});var gb,yb,wb,bb,Sd=I(()=>{"use strict";ye();ct();ae();gb={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},yb={append:{short:"a",long:"append",type:"boolean"}},wb={name:"tee",async execute(e,t){if(W(e))return B(gb);let n=Ee("tee",e,yb);if(!n.ok)return n.error;let{append:r}=n.result.flags,s=n.result.positional,i=t.stdin,o="",a=0;for(let l of s)try{let c=t.fs.resolvePath(t.cwd,l);r?await t.fs.appendFile(c,i,"binary"):await t.fs.writeFile(c,i,"binary")}catch{o+=`tee: ${l}: No such file or directory
|
|
503
|
+
`,a=1}return{stdout:i,stderr:o,exitCode:a,stdoutEncoding:"binary"}}},bb={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}});function gn(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Lt(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let o=0;o<s.length-1;o++){let a=s[o];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let l=`/${a}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(l))return{matches:!1,pruned:!1,printed:!1}}}let i=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let o=i[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(o.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(o))return{matches:!1,pruned:!1,printed:!1}}return{matches:Lt(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:X(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=gn(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=gn(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=gn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=gn(e.left,t);if(n.matches)return n;let r=gn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function ui(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return ui(e.expr);case"and":case"or":return ui(e.left)||ui(e.right)}}function fi(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return fi(e.expr);case"and":case"or":return fi(e.left)||fi(e.right);default:return!1}}function Cd(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=xb(e);if(Eb(e)&&n.length===1){let i=n[0].split("/").filter(o=>o.length>0);if(i.length>=2)for(let o=i.length-2;o>=0;o--){let a=i[o];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let l=i[o+1];if(l&&(l.includes("*")||l.includes("?"))){t.terminalDirName=a;let c=l.match(/^\*(\.[a-zA-Z0-9]+)$/);c&&(t.requiredExtension=c[1])}break}}}return t}function xb(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function Eb(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function vd(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function pi(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return pi(e.expr);case"and":case"or":return pi(e.left)&&pi(e.right)}}function Ur(e,t,n,r,s){switch(e.type){case"name":{let i=e.pattern,o=i.match(/^\*(\.[a-zA-Z0-9]+)$/);if(o){let a=o[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Lt(t,i,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let i=e.pattern,o=i.split("/");for(let l=0;l<o.length-1;l++){let c=o[l];if(c&&c!=="."&&c!==".."&&!c.includes("*")&&!c.includes("?")&&!c.includes("[")){let u=`/${c}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(u))return{matches:!1,pruned:!1,printed:!1}}}let a=i.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let l=a[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(l))return{matches:!1,pruned:!1,printed:!1}}return{matches:Lt(n,i,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let i=e.ignoreCase?"i":"";return{matches:X(e.pattern,i).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let i=Ur(e.expr,t,n,r,s);return{matches:!i.matches,pruned:i.pruned,printed:!1}}case"and":{let i=Ur(e.left,t,n,r,s);if(!i.matches)return{matches:!1,pruned:i.pruned,printed:!1};let o=Ur(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:i.printed||o.printed}}case"or":{let i=Ur(e.left,t,n,r,s);if(i.matches)return i;let o=Ur(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function hi(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return hi(e.expr);case"and":case"or":return hi(e.left)||hi(e.right);default:return!1}}function fr(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return fr(e.expr);case"and":case"or":return fr(e.left)&&fr(e.right)}}function kd(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!fr(e))return Zl(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:gn(e,n).pruned}}function Zl(e,t){switch(e.type){case"or":{if(fr(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(gn(e.left,n).pruned)return{shouldPrune:!0}}return Zl(e.right,t)}case"and":{if(fr(e.left)&&fr(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:gn(e,n).pruned}}if(fr(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return gn(e.left,n).matches?Zl(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}var Nd=I(()=>{"use strict";Qe();bl()});function Id(e,t){let n=[],r=[],s=t;for(;s<e.length;){let o=e[s];if(o==="("||o==="\\("){n.push({type:"lparen"}),s++;continue}if(o===")"||o==="\\)"){n.push({type:"rparen"}),s++;continue}if(o==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(o==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(o==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(o==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(o==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(o==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(o==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
|
|
504
|
+
`,actions:[]}}else if(o==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(o==="-mtime"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("+")?(l="more",c=a.slice(1)):a.startsWith("-")&&(l="less",c=a.slice(1));let u=parseInt(c,10);Number.isNaN(u)||n.push({type:"expr",expr:{type:"mtime",days:u,comparison:l}})}else if(o==="-newer"&&s+1<e.length){let a=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:a}})}else if(o==="-size"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("+")?(l="more",c=a.slice(1)):a.startsWith("-")&&(l="less",c=a.slice(1));let u=c.match(/^(\d+)([ckMGb])?$/);if(u){let f=parseInt(u[1],10),p=u[2]||"b";n.push({type:"expr",expr:{type:"size",value:f,unit:p,comparison:l}})}}else if(o==="-perm"&&s+1<e.length){let a=e[++s],l="exact",c=a;a.startsWith("-")?(l="all",c=a.slice(1)):a.startsWith("/")&&(l="any",c=a.slice(1));let u=parseInt(c,8);Number.isNaN(u)||n.push({type:"expr",expr:{type:"perm",mode:u,matchType:l}})}else if(o==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(o==="-not"||o==="!")n.push({type:"not"});else if(o==="-o"||o==="-or")n.push({type:"op",op:"or"});else if(o==="-a"||o==="-and")n.push({type:"op",op:"and"});else if(o==="-maxdepth"||o==="-mindepth")s++;else if(o!=="-depth")if(o==="-exec"){let a=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)a.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let l=e[s]==="+";r.push({type:"exec",command:a,batchMode:l})}else if(o==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(o==="-print0")r.push({type:"print0"});else if(o==="-printf"&&s+1<e.length){let a=e[++s];r.push({type:"printf",format:a})}else if(o==="-delete")r.push({type:"delete"});else{if(o.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${o}'
|
|
505
|
+
`,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let i=Ab(n);return i.error?{expr:null,pathIndex:s,error:i.error,actions:r}:{expr:i.expr,pathIndex:s,actions:r}}function Ab(e){let t=0;function n(){let a=r();if(!a)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="or"){t++;let c=r();if(!c)return a;a={type:"or",left:a,right:c}}else break}return a}function r(){let a=s();if(!a)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="and"){t++;let c=s();if(!c)return a;a={type:"and",left:a,right:c}}else if(l.type==="expr"||l.type==="not"||l.type==="lparen"){let c=s();if(!c)return a;a={type:"and",left:a,right:c}}else break}return a}function s(){if(t<e.length&&e[t].type==="not"){t++;let a=s();return a?{type:"not",expr:a}:null}return i()}function i(){if(t>=e.length)return null;let a=e[t];if(a.type==="lparen"){t++;let l=n();return t<e.length&&e[t].type==="rparen"&&t++,l}return a.type==="expr"?(t++,a.expr):(a.type==="rparen",null)}return{expr:n()}}var $d=I(()=>{"use strict"});var Od={};ee(Od,{findCommand:()=>Nb,flagsForFuzzing:()=>Ob});function Sb(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Cb(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function Ib(e,t){let n=zi(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[i,o,a]=Xf(n,s);if(s+=a,s>=n.length){r+="%";break}let l=n[s],c;switch(l){case"f":c=t.name,s++;break;case"h":{let u=t.path.lastIndexOf("/");c=u>0?t.path.slice(0,u):".",s++;break}case"p":c=t.path,s++;break;case"P":{let u=t.startingPoint;t.path===u?c="":t.path.startsWith(`${u}/`)?c=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?c=t.path.slice(2):c=t.path,s++;break}case"s":c=String(t.size),s++;break;case"d":c=String(t.depth),s++;break;case"m":c=(t.mode&511).toString(8),s++;break;case"M":c=Ys(t.mode,t.isDirectory),s++;break;case"t":{let u=new Date(t.mtime);c=$b(u),s++;break}case"T":{if(s+1<n.length){let u=n[s+1],f=new Date(t.mtime);c=Tb(f,u),s+=2}else c="%T",s++;break}default:r+=`%${i!==0||o!==-1?`${i}.${o}`:""}${l}`,s++;continue}r+=Wi(c,i,o)}else r+=n[s],s++;return r}function $b(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],i=String(e.getDate()).padStart(2," "),o=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),c=e.getFullYear();return`${r} ${s} ${i} ${o}:${a}:${l} ${c}`}function Tb(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var Td,vb,kb,Nb,Ob,Rd=I(()=>{"use strict";Dr();nl();ae();Xa();Nd();$d();Td=500;vb={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},kb=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),Nb={name:"find",async execute(e,t){if(W(e))return B(vb);let n=[],r=null,s=null,i=!1,o=!1;for(let N=0;N<e.length;N++){let R=e[N];if(R==="-maxdepth"&&N+1<e.length)o=!0,r=parseInt(e[++N],10);else if(R==="-mindepth"&&N+1<e.length)o=!0,s=parseInt(e[++N],10);else if(R==="-depth")o=!0,i=!0;else if(R==="-exec")for(o=!0,N++;N<e.length&&e[N]!==";"&&e[N]!=="+";)N++;else!R.startsWith("-")&&R!==";"&&R!=="+"&&R!=="("&&R!==")"&&R!=="\\("&&R!=="\\)"&&R!=="!"?o||n.push(R):kb.has(R)?(o=!0,N++):(R.startsWith("-")||R==="("||R==="\\("||R==="!")&&(o=!0)}n.length===0&&n.push(".");let{expr:a,error:l,actions:c}=Id(e,0);if(l)return{stdout:"",stderr:l,exitCode:1};let u=c.some(N=>N.type==="print"),f=c.length===0,p=[],h=c.some(N=>N.type==="printf"),d=[],m="",g=0,y=vd(a),w=new Map;for(let N of y){let R=t.fs.resolvePath(t.cwd,N);try{let O=await t.fs.stat(R);w.set(N,O.mtime?.getTime()??Date.now())}catch{}}let b=c.some(N=>{if(N.type!=="printf")return!1;let R=N.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(R)}),x=ui(a)||b,A=fi(a),C=Cd(a),$=hi(a),D=pi(a),v=typeof t.fs.readdirWithFileTypes=="function";for(let N of n){let z=function(q){let te=s===null||q.depth>=s,Se=!1;if(te&&a!==null){let $e=Date.now(),G;if(D)G=Ur(a,q.name,q.relativePath,q.isFile,q.isDirectory);else{let Pe={name:q.name,relativePath:q.relativePath,isFile:q.isFile,isDirectory:q.isDirectory,isEmpty:q.isEmpty,mtime:q.stat?.mtime?.getTime()??Date.now(),size:q.stat?.size??0,mode:q.stat?.mode??420,newerRefTimes:w};G=gn(a,Pe)}te=G.matches,Se=u?G.printed:te,O.evalCalls++,O.evalTime+=Date.now()-$e}else te&&(Se=!0);return Se?{print:!0,printfData:h?{path:q.relativePath,name:q.name,size:q.stat?.size??0,mtime:q.stat?.mtime?.getTime()??Date.now(),mode:q.stat?.mode??420,isDirectory:q.isDirectory,depth:q.depth,startingPoint:N}:null}:{print:!1,printfData:null}};var k=z;N.length>1&&N.endsWith("/")&&(N=N.slice(0,-1));let R=t.fs.resolvePath(t.cwd,N);try{await t.fs.stat(R)}catch{m+=`find: ${N}: No such file or directory
|
|
506
|
+
`,g=1;continue}let O=Sb(),_=Date.now();async function M(q){let{path:j,depth:te,typeInfo:Se}=q;if(O.nodeCount++,te>(r??256))return null;let oe,$e,G;if(Se&&!x)oe=Se.isFile,$e=Se.isDirectory;else{try{let Ir=Date.now();G=await t.fs.stat(j),O.statCalls++,O.statTime+=Date.now()-Ir}catch{return null}if(!G)return null;oe=G.isFile,$e=G.isDirectory}let Pe;j===R?Pe=N.split("/").pop()||N:Pe=j.split("/").pop()||"";let Ye=j===R?N:N==="."?`./${j.slice(R==="/"?R.length:R.length+1)}`:N+j.slice(R.length),at=[],dt=null,st=null,tt=!1;$e&&$&&!i&&(tt=kd(a,{name:Pe,relativePath:Ye,isFile:oe,isDirectory:$e}).shouldPrune,tt&&O.earlyPrunes++);let en=te>=(r??256),tn=C.terminalDirName!==null&&Pe===C.terminalDirName,Qs=!en&&!tn&&!tt;if($e&&((Qs||A||tn)&&!tt)){let Ir=Date.now();if(v&&t.fs.readdirWithFileTypes){if(dt=await t.fs.readdirWithFileTypes(j),st=dt.map(jt=>jt.name),O.readdirCalls++,O.readdirTime+=Date.now()-Ir,Qs)at=dt.map((jt,ln)=>({path:j==="/"?`/${jt.name}`:`${j}/${jt.name}`,depth:te+1,typeInfo:{isFile:jt.isFile,isDirectory:jt.isDirectory},resultIndex:ln}));else if(tn){let jt=C.requiredExtension;at=dt.filter(ln=>ln.isFile&&(!jt||ln.name.endsWith(jt))).map((ln,G7)=>({path:j==="/"?`/${ln.name}`:`${j}/${ln.name}`,depth:te+1,typeInfo:{isFile:ln.isFile,isDirectory:ln.isDirectory},resultIndex:G7}))}}else st=await t.fs.readdir(j),O.readdirCalls++,O.readdirTime+=Date.now()-Ir,Qs&&(at=st.map((jt,ln)=>({path:j==="/"?`/${jt}`:`${j}/${jt}`,depth:te+1,resultIndex:ln})))}let Mi=oe?(G?.size??0)===0:st!==null&&st.length===0,rs=tt;if(!i&&a!==null&&!tt&&$){let Ir=Date.now(),jt={name:Pe,relativePath:Ye,isFile:oe,isDirectory:$e,isEmpty:Mi,mtime:G?.mtime?.getTime()??Date.now(),size:G?.size??0,mode:G?.mode??420,newerRefTimes:w};rs=gn(a,jt).pruned,O.evalCalls++,O.evalTime+=Date.now()-Ir}return{relativePath:Ye,name:Pe,isFile:oe,isDirectory:$e,isEmpty:Mi,stat:G,depth:te,children:rs?[]:at,pruned:rs}}async function ie(){let q={paths:[],printfData:[]};if(i){let G=function(Pe){let Ye={paths:[],printfData:[]},at=Se[Pe];if(!at)return Ye;for(let tt of at.childIndices){let en=G(tt);Ye.paths.push(...en.paths),Ye.printfData.push(...en.printfData)}let{print:dt,printfData:st}=z(at.node);return dt&&(Ye.paths.push(at.node.relativePath),st&&Ye.printfData.push(st)),Ye};var j=G;let Se=[],oe=[{item:{path:R,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],$e=new Map;for(;oe.length>0;){let Pe=Date.now(),Ye=oe.splice(0,Td),at=await Promise.all(Ye.map(dt=>M(dt.item)));O.batchCount++,O.batchTime+=Date.now()-Pe;for(let dt=0;dt<Ye.length;dt++){let st=at[dt],tt=Ye[dt];if(!st)continue;let en=Se.length;if(tt.parentIndex>=0){let tn=$e.get(tt.parentIndex)||[];tn.push(en),$e.set(tt.parentIndex,tn)}Se.push({node:st,parentIndex:tt.parentIndex,childIndices:[]});for(let tn=0;tn<st.children.length;tn++)oe.push({item:st.children[tn],parentIndex:en,childOrderInParent:tn})}}for(let[Pe,Ye]of $e)Pe>=0&&Pe<Se.length&&(Se[Pe].childIndices=Ye);if(Se.length>0){let Pe=G(0);q.paths.push(...Pe.paths),q.printfData.push(...Pe.printfData)}}else{let Pe=function(Ye){let at=Se.get(Ye);at&&(q.paths.push(at.path),at.printfData&&q.printfData.push(at.printfData));let dt=G.get(Ye);if(dt)for(let st of dt)Pe(st)};var te=Pe;let Se=new Map,oe=0,$e=[{item:{path:R,depth:0,resultIndex:0},orderIndex:oe++}],G=new Map;for(;$e.length>0;){let Ye=Date.now(),at=$e.splice(0,Td),dt=await Promise.all(at.map(async({item:st,orderIndex:tt})=>{let en=await M(st);return en?{node:en,orderIndex:tt}:null}));O.batchCount++,O.batchTime+=Date.now()-Ye;for(let st of dt){if(!st)continue;let{node:tt,orderIndex:en}=st,{print:tn,printfData:Qs}=z(tt);if(tn&&Se.set(en,{path:tt.relativePath,printfData:Qs}),tt.children.length>0){let Va=[];for(let Mi of tt.children){let rs=oe++;Va.push(rs),$e.push({item:Mi,orderIndex:rs})}G.set(en,Va)}}}Pe(0)}return q}let me=await ie();if(p.push(...me.paths),d.push(...me.printfData),t.trace){let q=Date.now()-_;Cb(t.trace,O,q),t.trace({category:"find",name:"searchPath",durationMs:q,details:{path:N,resultsFound:me.paths.length}})}}let P="";if(c.length>0)for(let N of c)switch(N.type){case"print":P+=p.length>0?`${p.join(`
|
|
507
|
+
`)}
|
|
508
|
+
`:"";break;case"print0":P+=p.length>0?`${p.join("\0")}\0`:"";break;case"delete":{let R=[...p].sort((O,_)=>_.length-O.length);for(let O of R){let _=t.fs.resolvePath(t.cwd,O);try{await t.fs.rm(_,{recursive:!1})}catch(M){let z=M instanceof Error?M.message:String(M);m+=`find: cannot delete '${O}': ${z}
|
|
509
|
+
`,g=1}}break}case"printf":for(let R of d)P+=Ib(N.format,R);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
510
|
+
`,exitCode:1};if(N.batchMode){let R=[];for(let _ of N.command)_==="{}"?R.push(...p):R.push(_);let O=await t.exec(rn([R[0]]),{cwd:t.cwd,signal:t.signal,args:R.slice(1)});P+=O.stdout,m+=O.stderr,O.exitCode!==0&&(g=O.exitCode)}else for(let R of p){let O=N.command.map(M=>M==="{}"?R:M),_=await t.exec(rn([O[0]]),{cwd:t.cwd,signal:t.signal,args:O.slice(1)});P+=_.stdout,m+=_.stderr,_.exitCode!==0&&(g=_.exitCode)}break}else f&&(P=p.length>0?`${p.join(`
|
|
511
|
+
`)}
|
|
512
|
+
`:"");return{stdout:P,stderr:m,exitCode:g}}};Ob={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0}});var Pd={};ee(Pd,{basenameCommand:()=>Pb,flagsForFuzzing:()=>Db});var Rb,Pb,Db,Dd=I(()=>{"use strict";ae();Rb={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
|
|
513
|
+
basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},Pb={name:"basename",async execute(e,t){if(W(e))return B(Rb);let n=!1,r="",s=[];for(let o=0;o<e.length;o++){let a=e[o];a==="-a"||a==="--multiple"?n=!0:a==="-s"&&o+1<e.length?(r=e[++o],n=!0):a.startsWith("--suffix=")?(r=a.slice(9),n=!0):a.startsWith("-")||s.push(a)}if(s.length===0)return{stdout:"",stderr:`basename: missing operand
|
|
514
|
+
`,exitCode:1};!n&&s.length>=2&&(r=s.pop()??"");let i=[];for(let o of s){let a=o.replace(/\/+$/,""),l=a.split("/").pop()||a;r&&l.endsWith(r)&&(l=l.slice(0,-r.length)),i.push(l)}return{stdout:`${i.join(`
|
|
515
|
+
`)}
|
|
516
|
+
`,stderr:"",exitCode:0}}},Db={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0}});var _d={};ee(_d,{dirnameCommand:()=>Fb,flagsForFuzzing:()=>Lb});var _b,Fb,Lb,Fd=I(()=>{"use strict";ae();_b={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},Fb={name:"dirname",async execute(e,t){if(W(e))return B(_b);let n=e.filter(s=>!s.startsWith("-"));if(n.length===0)return{stdout:"",stderr:`dirname: missing operand
|
|
517
|
+
`,exitCode:1};let r=[];for(let s of n){let i=s.replace(/\/+$/,""),o=i.lastIndexOf("/");o===-1?r.push("."):o===0?r.push("/"):r.push(i.slice(0,o))}return{stdout:`${r.join(`
|
|
518
|
+
`)}
|
|
519
|
+
`,stderr:"",exitCode:0}}},Lb={name:"dirname",flags:[],needsArgs:!0}});var Md={};ee(Md,{flagsForFuzzing:()=>zb,treeCommand:()=>Bb});async function Wb(e,t,n,r,s){let i={output:"",stderr:"",dirCount:0,fileCount:0},o=e.fs.resolvePath(e.cwd,t);try{if(!(await e.fs.stat(o)).isDirectory)return i.output=`${t}
|
|
520
|
+
`,i.fileCount=1,i}catch{return i.stderr=`tree: ${t}: No such file or directory
|
|
521
|
+
`,i}if(i.output=`${t}
|
|
522
|
+
`,n.maxDepth!==null&&s>=n.maxDepth)return i;try{let a=[];if(e.fs.readdirWithFileTypes)a=(await e.fs.readdirWithFileTypes(o)).map(u=>({name:u.name,isDirectory:u.isDirectory}));else{let c=await e.fs.readdir(o);for(let u=0;u<c.length;u+=100){let f=c.slice(u,u+100),p=await Promise.all(f.map(async h=>{let d=o==="/"?`/${h}`:`${o}/${h}`;try{let m=await e.fs.stat(d);return{name:h,isDirectory:m.isDirectory}}catch{return null}}));a.push(...p.filter(h=>h!==null))}}let l=a.filter(c=>!(!n.showHidden&&c.name.startsWith(".")||n.directoriesOnly&&!c.isDirectory));l.sort((c,u)=>c.name.localeCompare(u.name));for(let c=0;c<l.length;c++){let u=l[c],f=o==="/"?`/${u.name}`:`${o}/${u.name}`,p=c===l.length-1,h=p?"`-- ":"|-- ",d=r+(p?" ":"| ");if(u.isDirectory){i.dirCount++;let m=n.fullPath?f:u.name;if(i.output+=`${r+h+m}
|
|
523
|
+
`,n.maxDepth===null||s+1<n.maxDepth){let g=await Ld(e,f,n,d,s+1);i.output+=g.output,i.dirCount+=g.dirCount,i.fileCount+=g.fileCount}}else{i.fileCount++;let m=n.fullPath?f:u.name;i.output+=`${r+h+m}
|
|
524
|
+
`}}}catch{i.stderr=`tree: ${t}: Permission denied
|
|
525
|
+
`}return i}async function Ld(e,t,n,r,s){let i={output:"",stderr:"",dirCount:0,fileCount:0};if(n.maxDepth!==null&&s>=n.maxDepth)return i;try{let o=[];if(e.fs.readdirWithFileTypes)o=(await e.fs.readdirWithFileTypes(t)).map(c=>({name:c.name,isDirectory:c.isDirectory}));else{let l=await e.fs.readdir(t);for(let c=0;c<l.length;c+=100){let u=l.slice(c,c+100),f=await Promise.all(u.map(async p=>{let h=t==="/"?`/${p}`:`${t}/${p}`;try{let d=await e.fs.stat(h);return{name:p,isDirectory:d.isDirectory}}catch{return null}}));o.push(...f.filter(p=>p!==null))}}let a=o.filter(l=>!(!n.showHidden&&l.name.startsWith(".")||n.directoriesOnly&&!l.isDirectory));a.sort((l,c)=>l.name.localeCompare(c.name));for(let l=0;l<a.length;l++){let c=a[l],u=t==="/"?`/${c.name}`:`${t}/${c.name}`,f=l===a.length-1,p=f?"`-- ":"|-- ",h=r+(f?" ":"| ");if(c.isDirectory){i.dirCount++;let d=n.fullPath?u:c.name;i.output+=`${r+p+d}
|
|
526
|
+
`;let m=await Ld(e,u,n,h,s+1);i.output+=m.output,i.dirCount+=m.dirCount,i.fileCount+=m.fileCount}else{i.fileCount++;let d=n.fullPath?u:c.name;i.output+=`${r+p+d}
|
|
527
|
+
`}}}catch{}return i}var Mb,Ub,Bb,zb,Ud=I(()=>{"use strict";ct();is();ae();Mb={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},Ub={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},Bb={name:"tree",async execute(e,t){if(W(e))return B(Mb);let n=Ee("tree",e,Ub);if(!n.ok)return n.error;let r={showHidden:n.result.flags.showHidden,directoriesOnly:n.result.flags.directoriesOnly,maxDepth:n.result.flags.maxDepth??null,fullPath:n.result.flags.fullPath},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0,l=0;for(let c of s){let u=await Wb(t,c,r,"",0);i+=u.output,o+=u.stderr,a+=u.dirCount,l+=u.fileCount}return i+=`
|
|
528
|
+
${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"s"}`),i+=`
|
|
529
|
+
`,{stdout:i,stderr:o,exitCode:o?1:0}}};zb={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var Wd={};ee(Wd,{duCommand:()=>Gb,flagsForFuzzing:()=>qb});async function Bd(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""};if(s>Vb)return i;try{let o=await e.fs.stat(t);if(!o.isDirectory)return i.totalSize=o.size,(r.allFiles||s===0)&&(i.output=yo(o.size,r.humanReadable)+" "+n+`
|
|
530
|
+
`),i;let a=0,l=[];if(e.fs.readdirWithFileTypes){let f=await e.fs.readdirWithFileTypes(t),p=f.filter(d=>d.isFile),h=f.filter(d=>d.isDirectory);for(let d=0;d<p.length;d+=100){let m=p.slice(d,d+100),g=await Promise.all(m.map(async y=>{let w=t==="/"?`/${y.name}`:`${t}/${y.name}`;try{let b=await e.fs.stat(w);return{name:y.name,isDirectory:!1,size:b.size}}catch{return{name:y.name,isDirectory:!1,size:0}}}));l.push(...g)}l.push(...h.map(d=>({name:d.name,isDirectory:!0})))}else{let f=await e.fs.readdir(t);for(let p=0;p<f.length;p+=100){let h=f.slice(p,p+100),d=await Promise.all(h.map(async m=>{let g=t==="/"?`/${m}`:`${t}/${m}`;try{let y=await e.fs.stat(g);return{name:m,isDirectory:y.isDirectory,size:y.isDirectory?void 0:y.size}}catch{return{name:m,isDirectory:!1,size:0}}}));l.push(...d)}}l.sort((f,p)=>f.name.localeCompare(p.name));let c=l.filter(f=>!f.isDirectory);for(let f of c){let p=f.size??0;if(a+=p,r.allFiles&&!r.summarize){let h=n==="."?f.name:`${n}/${f.name}`;i.output+=yo(p,r.humanReadable)+" "+h+`
|
|
531
|
+
`}}let u=l.filter(f=>f.isDirectory);for(let f=0;f<u.length;f+=100){let p=u.slice(f,f+100),h=await Promise.all(p.map(async d=>{let m=t==="/"?`/${d.name}`:`${t}/${d.name}`,g=n==="."?d.name:`${n}/${d.name}`;return{name:d.name,result:await Bd(e,m,g,r,s+1)}}));h.sort((d,m)=>d.name.localeCompare(m.name));for(let{result:d}of h)a+=d.totalSize,r.summarize||(r.maxDepth===null||s+1<=r.maxDepth)&&(i.output+=d.output)}i.totalSize=a,(r.summarize||r.maxDepth===null||s<=r.maxDepth)&&(i.output+=`${yo(a,r.humanReadable)} ${n}
|
|
532
|
+
`)}catch{i.stderr=`du: cannot read directory '${n}': Permission denied
|
|
533
|
+
`}return i}function yo(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var Hb,jb,Gb,Vb,qb,zd=I(()=>{"use strict";ct();is();ae();Hb={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},jb={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},Gb={name:"du",async execute(e,t){if(W(e))return B(Hb);let n=Ee("du",e,jb);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await Bd(t,c,l,r,0);i+=u.output,a+=u.totalSize,o+=u.stderr}catch{o+=`du: cannot access '${l}': No such file or directory
|
|
534
|
+
`}}return r.grandTotal&&s.length>0&&(i+=`${yo(a,r.humanReadable)} total
|
|
535
|
+
`),{stdout:i,stderr:o,exitCode:o?1:0}}},Vb=1e3;qb={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0}});var Kl={};ee(Kl,{envCommand:()=>Kb,flagsForFuzzing:()=>Yb,printenvCommand:()=>Xb,printenvFlagsForFuzzing:()=>Jb});var Zb,Kb,Qb,Xb,Yb,Jb,Ql=I(()=>{"use strict";ye();tr();ae();Zb={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},Kb={name:"env",async execute(e,t){if(W(e))return B(Zb);let n=!1,r=[],s=new Map,i=-1;for(let l=0;l<e.length;l++){let c=e[l];if(c==="-i"||c==="--ignore-environment")n=!0;else if(c==="-u"&&l+1<e.length)r.push(e[++l]);else if(c.startsWith("-u"))r.push(c.slice(2));else if(c.startsWith("--unset="))r.push(c.slice(8));else{if(c.startsWith("--")&&c!=="--")return Q("env",c);if(c.startsWith("-")&&c!=="-"){for(let u of c.slice(1))if(u!=="i"&&u!=="u")return Q("env",`-${u}`);c.includes("i")&&(n=!0)}else if(c.includes("=")&&i===-1){let u=c.indexOf("="),f=c.slice(0,u),p=c.slice(u+1);s.set(f,p)}else{i=l;break}}}let o;if(n)o=new Map(s);else{o=new Map(t.env);for(let l of r)o.delete(l);for(let[l,c]of s)o.set(l,c)}if(i===-1){let l=[];for(let[c,u]of o)l.push(`${c}=${u}`);return{stdout:l.join(`
|
|
536
|
+
`)+(l.length>0?`
|
|
537
|
+
`:""),stderr:"",exitCode:0}}if(!t.exec)return{stdout:"",stderr:`env: command execution not supported in this context
|
|
538
|
+
`,exitCode:1};let a=e.slice(i);return t.exec("command",{cwd:t.cwd,env:It(o),replaceEnv:!0,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a})}},Qb={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},Xb={name:"printenv",async execute(e,t){if(W(e))return B(Qb);let n=e.filter(i=>!i.startsWith("-"));if(n.length===0){let i=[];for(let[o,a]of t.env)i.push(`${o}=${a}`);return{stdout:i.join(`
|
|
539
|
+
`)+(i.length>0?`
|
|
540
|
+
`:""),stderr:"",exitCode:0}}let r=[],s=0;for(let i of n){let o=t.env.get(i);o!==void 0?r.push(o):s=1}return{stdout:r.join(`
|
|
541
|
+
`)+(r.length>0?`
|
|
542
|
+
`:""),stderr:"",exitCode:s}}},Yb={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},Jb={name:"printenv",flags:[]}});var Xl={};ee(Xl,{aliasCommand:()=>t5,flagsForFuzzing:()=>r5,unaliasCommand:()=>n5,unaliasFlagsForFuzzing:()=>s5});var e5,xs,t5,n5,r5,s5,Yl=I(()=>{"use strict";ae();e5={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},xs="BASH_ALIAS_",t5={name:"alias",async execute(e,t){if(W(e))return B(e5);if(e.length===0){let r="";for(let[s,i]of t.env)if(s.startsWith(xs)){let o=s.slice(xs.length);r+=`alias ${o}='${i}'
|
|
543
|
+
`}return{stdout:r,stderr:"",exitCode:0}}let n=e[0]==="--"?e.slice(1):e;for(let r of n){let s=r.indexOf("=");if(s===-1){let i=xs+r;return t.env.get(i)?{stdout:`alias ${r}='${t.env.get(i)}'
|
|
544
|
+
`,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${r}: not found
|
|
545
|
+
`,exitCode:1}}else{let i=r.slice(0,s),o=r.slice(s+1);(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))&&(o=o.slice(1,-1)),t.env.set(xs+i,o)}}return{stdout:"",stderr:"",exitCode:0}}},n5={name:"unalias",async execute(e,t){if(W(e))return B({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...]
|
|
546
|
+
`,exitCode:1};if(e[0]==="-a"){for(let i of t.env.keys())i.startsWith(xs)&&t.env.delete(i);return{stdout:"",stderr:"",exitCode:0}}let n=e[0]==="--"?e.slice(1):e,r=!1,s="";for(let i of n){let o=xs+i;t.env.get(o)?t.env.delete(o):(s+=`unalias: ${i}: not found
|
|
547
|
+
`,r=!0)}return{stdout:"",stderr:s,exitCode:r?1:0}}},r5={name:"alias",flags:[]},s5={name:"unalias",flags:[{flag:"-a",type:"boolean"}]}});var jd={};ee(jd,{flagsForFuzzing:()=>a5,historyCommand:()=>o5});var i5,Hd,o5,a5,Gd=I(()=>{"use strict";ae();i5={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},Hd="BASH_HISTORY",o5={name:"history",async execute(e,t){if(W(e))return B(i5);let n=t.env.get(Hd)||"[]",r;try{r=JSON.parse(n)}catch{r=[]}if(e[0]==="-c")return t.env.set(Hd,"[]"),{stdout:"",stderr:"",exitCode:0};let s=r.length;e[0]&&/^\d+$/.test(e[0])&&(s=Math.min(parseInt(e[0],10),r.length));let i=r.length-s,o="";for(let a=i;a<r.length;a++){let l=(a+1).toString().padStart(5," ");o+=`${l} ${r[a]}
|
|
548
|
+
`}return{stdout:o,stderr:"",exitCode:0}}},a5={name:"history",flags:[{flag:"-c",type:"boolean"}]}});var Vd={};ee(Vd,{flagsForFuzzing:()=>u5,xargsCommand:()=>c5});var l5,c5,u5,qd=I(()=>{"use strict";ye();Dr();ae();l5={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},c5={name:"xargs",async execute(e,t){if(W(e))return B(l5);let n=null,r=null,s=null,i=null,o=!1,a=!1,l=!1,c=0;for(let b=0;b<e.length;b++){let x=e[b];if(x==="-I"&&b+1<e.length)n=e[++b],c=b+1;else if(x==="-d"&&b+1<e.length)r=e[++b].replace(/\\n/g,`
|
|
549
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),c=b+1;else if(x==="-n"&&b+1<e.length)s=parseInt(e[++b],10),c=b+1;else if(x==="-P"&&b+1<e.length)i=parseInt(e[++b],10),c=b+1;else if(x==="-0"||x==="--null")o=!0,c=b+1;else if(x==="-t"||x==="--verbose")a=!0,c=b+1;else if(x==="-r"||x==="--no-run-if-empty")l=!0,c=b+1;else{if(x.startsWith("--"))return Q("xargs",x);if(x.startsWith("-")&&x.length>1){for(let A of x.slice(1))if(!"0tr".includes(A))return Q("xargs",`-${A}`);x.includes("0")&&(o=!0),x.includes("t")&&(a=!0),x.includes("r")&&(l=!0),c=b+1}else if(!x.startsWith("-")){c=b;break}}}let u=e.slice(c);u.length===0&&u.push("echo");let f=le(t.stdin),p;if(o?p=f.split("\0").filter(b=>b.length>0):r!==null?p=f.replace(/\n$/,"").split(r).filter(x=>x.length>0):p=f.split(/\s+/).map(b=>b.trim()).filter(b=>b.length>0),p.length===0)return l?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let h="",d="",m=0,g=b=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(b)?`"${b.replace(/([\\"`$])/g,"\\$1")}"`:b,y=async b=>{if(a){let A=b.map(g).join(" ");d+=`${A}
|
|
550
|
+
`}return t.exec?t.exec(rn([b[0]]),{cwd:t.cwd,signal:t.signal,args:b.slice(1)}):{stdout:`${b.map(g).join(" ")}
|
|
551
|
+
`,stderr:"",exitCode:0}},w=async b=>{if(i!==null&&i>1)for(let x=0;x<b.length;x+=i){let A=b.slice(x,x+i),C=await Promise.all(A.map(y));for(let $ of C)h+=$.stdout,d+=$.stderr,$.exitCode!==0&&(m=$.exitCode)}else for(let x of b){let A=await y(x);h+=A.stdout,d+=A.stderr,A.exitCode!==0&&(m=A.exitCode)}};if(n!==null){let b=p.map(x=>u.map(A=>A.replaceAll(n,x)));await w(b)}else if(s!==null){let b=[];for(let x=0;x<p.length;x+=s){let A=p.slice(x,x+s);b.push([...u,...A])}await w(b)}else{let b=[...u,...p],x=await y(b);h+=x.stdout,d+=x.stderr,m=x.exitCode}return{stdout:h,stderr:d,exitCode:m}}},u5={name:"xargs",flags:[{flag:"-I",type:"value",valueHint:"string"},{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-0",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-r",type:"boolean"}],stdinType:"text"}});var Jl={};ee(Jl,{falseCommand:()=>p5,falseFlagsForFuzzing:()=>d5,flagsForFuzzing:()=>h5,trueCommand:()=>f5});var f5,p5,h5,d5,ec=I(()=>{"use strict";f5={name:"true",async execute(){return{stdout:"",stderr:"",exitCode:0}}},p5={name:"false",async execute(){return{stdout:"",stderr:"",exitCode:1}}},h5={name:"true",flags:[]},d5={name:"false",flags:[]}});var Zd={};ee(Zd,{clearCommand:()=>g5,flagsForFuzzing:()=>y5});var m5,g5,y5,Kd=I(()=>{"use strict";ae();m5={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},g5={name:"clear",async execute(e,t){return W(e)?B(m5):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}},y5={name:"clear",flags:[]}});var tc={};ee(tc,{bashCommand:()=>w5,flagsForFuzzing:()=>x5,shCommand:()=>b5,shFlagsForFuzzing:()=>E5});async function Es(e,t,n,r){if(!r.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
|
|
552
|
+
`,exitCode:1};let s=Fr(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,l)=>{s[String(l+1)]=a});let i=e;if(i.startsWith("#!")){let a=i.indexOf(`
|
|
553
|
+
`);a!==-1&&(i=i.slice(a+1))}return await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin,stdinKind:"bytes",signal:r.signal})}var Qd,w5,b5,x5,E5,nc=I(()=>{"use strict";ye();tr();ae();Qd={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},w5={name:"bash",async execute(e,t){if(W(e))return B(Qd);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",o=e.slice(3);return Es(s,i,o,t)}if(e.length===0){let s=le(t.stdin);return s.trim()?Es(s,"bash",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Es(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
|
|
554
|
+
`,exitCode:127}}}},b5={name:"sh",async execute(e,t){if(W(e))return B({...Qd,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"sh",o=e.slice(3);return Es(s,i,o,t)}if(e.length===0){let s=le(t.stdin);return s.trim()?Es(s,"sh",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Es(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
|
|
555
|
+
`,exitCode:127}}}};x5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},E5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function rc(e,t,n,r,s,i,o,a,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(o)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,p)=>{let h=s(f,n[0],r)[0],d=s(p,n[0],r)[0];return o(h,d)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let p=0,h=e.length;for(;p<h;){let d=p+h>>>1;o(e[d],f)<0?p=d+1:h=d}return p<e.length&&o(e[p],f)===0?p:-p-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let p of e){let h=s(p,n[0],r)[0],d=JSON.stringify(h);u.has(d)||u.set(d,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>o(p.key,h.key)),[f.map(p=>p.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let p=JSON.stringify(s(f,n[0],r)[0]);u.has(p)||u.set(p,[]),u.get(p)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return o(p,h)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return o(p,h)<0?u:f})];case"add":{let u=f=>{let p=f.filter(h=>h!==null);return p.length===0?null:p.every(h=>typeof h=="number")?p.reduce((h,d)=>h+d,0):p.every(h=>typeof h=="string")?p.join(""):p.every(h=>Array.isArray(h))?p.flat():p.every(h=>h&&typeof h=="object"&&!Array.isArray(h))?Fr(...p):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[e]:[];case"map":return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(f=>s(f,n[0],r))];case"map_values":{if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(u=>s(u,n[0],r))];if(e&&typeof e=="object"){let u=Object.create(null);for(let[f,p]of Object.entries(e)){if(!Fe(f))continue;let h=s(p,n[0],r);h.length>0&&He(u,f,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[Wn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[Wn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var Xd=I(()=>{"use strict";tr();Cn()});function sc(e,t,n,r,s,i,o,a){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof a)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof a)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=Math.max(r.limits.maxIterations*100,1e6),c=d=>d.length>=l,u=s(e,n[0],r);if(n.length===1){let d=[];for(let m of u){let g=m;for(let y=0;y<g;y++)if(d.push(y),c(d))return d}return d}let f=s(e,n[1],r);if(n.length===2){let d=[];for(let m of u)for(let g of f){let y=m,w=g;for(let b=y;b<w;b++)if(d.push(b),c(d))return d}return d}let p=s(e,n[2],r),h=[];for(let d of u)for(let m of f)for(let g of p){let y=d,w=m,b=g;if(b!==0){if(b>0){for(let x=y;x<w;x+=b)if(h.push(x),c(h))return h}else for(let x=y;x>w;x+=b)if(h.push(x),c(h))return h}}return h}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(p){if(p instanceof a)throw p;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof a)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof a)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(o))return[l];let p=s(l,n[1],r);if(p.length===0)return[l];l=p[0]}throw new a(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(o);f++){l.push(c);let h=s(c,n[1],r);if(h.length===0)break;c=h[0]}if(l.length>=u)throw new a(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let p=s(c,n[0],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Yd=I(()=>{"use strict"});function ic(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=new Date(e*1e3),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(o,0,1),d=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[o,a,l,c,u,f,p,d]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,d,m=0,g=0,y=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(p,h,d??1,m??0,g??0,y??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(p,h=2)=>String(p).padStart(h,"0");return[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o==="%Y-%m-%dT%H:%M:%SZ"){let l=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(l){let[,c,u,f,p,h,d]=l.map(Number),m=new Date(Date.UTC(c,u-1,f,p,h,d)),g=m.getUTCDay(),y=Date.UTC(c,0,1),w=Math.floor((m.getTime()-y)/(1440*60*1e3));return[[c,u-1,f,p,h,d,g,w]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),p=a.getUTCMinutes(),h=a.getUTCSeconds(),d=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,p,h,d,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=new Date(e);if(Number.isNaN(i.getTime()))throw new Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var Jd=I(()=>{"use strict"});function yn(e){return e!==!1&&e!==null}function As(e,t){return JSON.stringify(e)===JSON.stringify(t)}function di(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function oc(e,t){let n=xt(e);for(let r of Object.keys(t)){if(!Fe(r))continue;let s=Wn(n,r)?Ge(n[r]):null,i=Ge(t[r]);s&&i?He(n,r,oc(s,i)):He(n,r,t[r])}return n}function Ss(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(r!==null&&typeof r=="object"){let s=Object.keys(r);if(s.length===0)return n+1;r=r[s[0]],n++}else return n;return n}function wo(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let a=0;a<Math.min(e.length,t.length);a++){let l=wo(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=Ge(e),o=Ge(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=wo(i[c],o[c]);if(u!==0)return u}}return 0}function bo(e,t){if(As(e,t))return!0;if(typeof e=="string"&&typeof t=="string")return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(s=>e.some(i=>bo(i,s)));let n=Ge(e),r=Ge(t);return n&&r?Object.keys(r).every(s=>Wn(n,s)&&bo(n[s],r[s])):!1}var xo=I(()=>{"use strict";Cn()});function ac(e,t,n){switch(t){case"@base64":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"utf-8").toString("base64")]:[btoa(e)]:[null];case"@base64d":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"base64").toString("utf-8")]:[atob(e)]:[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 i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
|
|
556
|
+
`)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).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=n??A5;return Ss(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}}var A5,em=I(()=>{"use strict";xo();A5=2e3});function lc(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let p=0;p<c;p++)if(!i(e[u+p],a[p])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var tm=I(()=>{"use strict"});function cc(e,t,n,r,s){switch(t){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(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],o=s(e,n[1],r)[0];return[e*i+o]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}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 i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var nm=I(()=>{"use strict"});function uc(e,t,n,r,s,i,o,a){switch(t){case"recurse":{if(n.length===0){let h=[],d=m=>{if(h.push(m),Array.isArray(m))for(let g of m)d(g);else if(m&&typeof m=="object")for(let g of Object.keys(m))d(m[g])};return d(e),h}let l=[],c=n.length>=2?n[1]:null,u=1e4,f=0,p=h=>{if(f++>u||c&&!s(h,c,r).some(i))return;l.push(h);let d=s(h,n[0],r);for(let m of d)m!=null&&p(m)};return p(e),l}case"recurse_down":return a(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=new WeakSet,c=u=>{if(u&&typeof u=="object"){if(l.has(u))return u;l.add(u)}let f;if(Array.isArray(u))f=u.map(c);else if(u&&typeof u=="object"){let h=Object.create(null);for(let[d,m]of Object.entries(u))Fe(d)&&He(h,d,c(m));f=h}else f=u;return s(f,n[0],r)[0]};return[c(e)]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Math.max(...e.map(u=>Array.isArray(u)?u.length:0)),c=[];for(let u=0;u<l;u++)c.push(e.map(f=>Array.isArray(f)?f[u]:null));return[c]}case"combinations":{if(n.length>0){let f=s(e,n[0],r)[0];if(!Array.isArray(e)||f<0)return[];if(f===0)return[[]];let p=[],h=(d,m)=>{if(m===f){p.push([...d]);return}for(let g of e)d.push(g),h(d,m+1),d.pop()};return h([],0),p}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let u of e)if(!Array.isArray(u))return[];let l=[],c=(u,f)=>{if(u===e.length){l.push([...f]);return}let p=e[u];for(let h of p)f.push(h),c(u+1,f),f.pop()};return c(0,[]),l}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var rm=I(()=>{"use strict";Cn()});function fc(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]: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[new TextEncoder().encode(e).length];let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{let i=Ge(e);return i?[Object.entries(i).map(([o,a])=>({key:o,value:a}))]:[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=Ge(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);Fe(u)&&He(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=Ge(e);if(i){let a=Object.entries(i).map(([c,u])=>({key:c,value:u})).flatMap(c=>s(c,n[0],r)),l=Object.create(null);for(let c of a){let u=Ge(c);if(u){let f=u.key??u.name??u.k,p=u.value??u.v;if(f!==void 0){let h=String(f);Fe(h)&&He(l,h,p)}}}return[l]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(n.length>0?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??S5;return Ss(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[ds(JSON.parse(e))]}catch{throw 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 i=Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}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 i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=(a,l)=>{if(a===null||typeof a!="object")i.push([l,a]);else if(Array.isArray(a))if(a.length===0)i.push([l,[]]);else for(let c=0;c<a.length;c++)o(a[c],[...l,c]);else{let c=Object.keys(a);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)o(a[u],[...l,u])}};return o(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),o=null;for(let a of i){if(!Array.isArray(a)||a.length===1&&Array.isArray(a[0])&&a[0].length===0||a.length!==2)continue;let[l,c]=a;if(!Array.isArray(l))continue;let u=l;if(u.length===0){o=c;continue}o===null&&(o=typeof u[0]=="number"?[]:Object.create(null));let f=o;for(let h=0;h<u.length-1;h++){let d=u[h],m=u[h+1];if(Array.isArray(f)&&typeof d=="number"){for(;f.length<=d;)f.push(null);f[d]===null&&(f[d]=typeof m=="number"?[]:Object.create(null)),f=f[d]}else{let g=Ge(f);if(g){let y=String(d);if(!Fe(y))continue;(g[y]===null||g[y]===void 0)&&He(g,y,typeof m=="number"?[]:Object.create(null)),f=g[y]}}}let p=u[u.length-1];if(Array.isArray(f)&&typeof p=="number"){for(;f.length<=p;)f.push(null);f[p]=c}else{let h=Ge(f);if(h){let d=String(p);Fe(d)&&He(h,d,c)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var S5,sm=I(()=>{"use strict";Cn();xo();S5=2e3});function pc(e,t,n,r,s,i,o,a,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let p of u){let h=p,d=e;for(let m of h){if(d==null){d=null;break}if(Array.isArray(d)&&typeof m=="number")d=d[m];else if(typeof m=="string"){let g=Ge(d);if(!g||!Object.hasOwn(g,m)){d=null;break}d=g[m]}else{d=null;break}}f.push(d)}return f}case"setpath":{if(n.length<2)return[null];let f=s(e,n[0],r)[0],h=s(e,n[1],r)[0];return[o(e,f,h)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],p=e;for(let h of f.sort((d,m)=>m.length-d.length))p=a(p,h);return[p]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let p of n)c(e,p,r,[],u);let f=null;for(let p of u){for(let d of p)if(typeof d=="number"&&d<0)throw new Error("Out of bounds negative array index");let h=e;for(let d of p){if(h==null)break;if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(typeof d=="string"){let m=Ge(h);if(!m||!Object.hasOwn(m,d)){h=null;break}h=m[d]}else{h=null;break}}f=o(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let d=0;d<p.length;d++)u.push([...h,d]),f(p[d],[...h,d]);else for(let d of Object.keys(p))u.push([...h,d]),f(p[d],[...h,d])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let m of p)if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=Ge(h);if(!g||!Object.hasOwn(g,m))return!1;h=g[m]}else return!1;return s(h,n[0],r).some(i)}):u}case"leaf_paths":{let u=[],f=(p,h)=>{if(p===null||typeof p!="object")u.push(h);else if(Array.isArray(p))for(let d=0;d<p.length;d++)f(p[d],[...h,d]);else for(let d of Object.keys(p))f(p[d],[...h,d])};return f(e,[]),u}default:return null}}var im=I(()=>{"use strict";Cn()});function hc(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);Fe(f)&&He(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let p=String(f[0]);Fe(p)&&He(c,p,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);Fe(f)&&He(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=Ge(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Wn(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var om=I(()=>{"use strict";Cn()});function dc(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return i.map(o=>e.map(a=>a===null?"":typeof a=="string"?a:String(a)).join(String(o)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g";return X(o,a.includes("g")?a:`${a}g`).split(e)}catch{return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[...X(o,a.includes("g")?a:`${a}g`).matchAll(e)].map(u=>u.length>1?u.slice(1):u[0])}catch{return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[X(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=X(o,`${a}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,p)=>({offset:u?.[p+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=X(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[X(a,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[X(a,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}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"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":return typeof e=="string"?[Array.from(e).map(i=>i.codePointAt(0))]:[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var am=I(()=>{"use strict";Qe()});function mc(e,t){switch(t){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}}var lm=I(()=>{"use strict"});var cm=I(()=>{"use strict";Xd();Yd();Jd();em();tm();nm();rm();sm();im();om();am();lm()});function Eo(e,t,n){if(t.length===0)return n;let[r,...s]=t;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 c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=Eo(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!Fe(r))return e??Object.create(null);let i=Ge(e),o=i?xt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return He(o,r,Eo(a,s,n)),o}function Ao(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!Fe(i))return e;let o=xt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=Ao(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!Fe(s))return e;let i=xt(e);return Object.hasOwn(i,s)&&He(i,s,Ao(i[s],r)),i}return e}var um=I(()=>{"use strict";Cn()});function k5(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??C5,maxDepth:e?.limits?.maxDepth??hm},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function vo(e,t,n){let r=new Map(e.vars);return r.set(t,n),{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}}function mi(e,t,n){switch(t.type){case"var":return vo(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],o=s<n.length?n[s]:null,a=mi(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=Ge(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=Z(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Wn(r,o)?r[o]:null;i.keyVar&&(s=vo(s,i.keyVar,a));let l=mi(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function N5(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=Ge(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function pr(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?pr(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?pr(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n=="number"||typeof n=="string"?[...t,n]:null}if(e.type==="Pipe"){let t=pr(e.left);return t===null?null:gc(t,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 gc(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=pr(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=pr(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=gc(e,t.left);return n===null?null:gc(n,t.right)}return t.type==="Identity"?e:null}function fm(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...Z(e,t.left,n))}catch(s){if(s instanceof K)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...Z(e,t.right,n))}catch(s){if(s instanceof K)throw s;return r}return r}return Z(e,t,n)}function Z(e,t,n){let r=n&&"vars"in n?n:k5(n);switch(r.defenseContextChecked||(lt(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":return(t.base?Z(e,t.base,r):[e]).flatMap(i=>{let o=Ge(i);if(o){if(!Object.hasOwn(o,t.name))return[null];let l=o[t.name];return[l===void 0?null:l]}if(i===null)return[null];let a=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${a} with string "${t.name}"`)});case"Index":return(t.base?Z(e,t.base,r):[e]).flatMap(i=>Z(i,t.index,r).flatMap(a=>{if(typeof a=="number"&&Array.isArray(i)){if(Number.isNaN(a))return[null];let l=Math.trunc(a),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof a=="string"){let l=Ge(i);return!l||!Object.hasOwn(l,a)?[null]:[l[a]]}return[null]}));case"Slice":return(t.base?Z(e,t.base,r):[e]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let o=i.length,a=t.start?Z(e,t.start,r):[0],l=t.end?Z(e,t.end,r):[o];return a.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),d=Number.isNaN(p)?o:Number.isInteger(p)?p:Math.ceil(p),m=pm(h,o),g=pm(d,o);return Array.isArray(i),i.slice(m,g)}))});case"Iterate":return(t.base?Z(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=Z(e,t.left,r),i=pr(t.left),o=[];for(let a of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};o.push(...Z(a,t.right,l))}else o.push(...Z(a,t.right,r))}catch(l){throw l instanceof Cs?l.withPrependedResults(o):l}return o}case"Comma":{let s=Z(e,t.left,r),i=Z(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[Z(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let o=typeof i.key=="string"?[i.key]:Z(e,i.key,r),a=Z(e,i.value,r),l=[];for(let c of s)for(let u of o){if(typeof u!="string"){let f=u===null?"null":Array.isArray(u)?"array":typeof u;throw new Error(`Cannot use ${f} (${JSON.stringify(u)}) as object key`)}if(!Fe(u)){for(let f of a)l.push(xt(c));continue}for(let f of a){let p=xt(c);He(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return Z(e,t.expr,r);case"BinaryOp":return T5(e,t.op,t.left,t.right,r);case"UnaryOp":return Z(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let o=a=>a.length>5?`"${a.slice(0,3)}...`:JSON.stringify(a);throw new Error(`string (${o(i)}) cannot be negated`)}return null}return t.op==="not"?!yn(i):null});case"Cond":return Z(e,t.cond,r).flatMap(i=>{if(yn(i))return Z(e,t.then,r);for(let o of t.elifs)if(Z(e,o.cond,r).some(yn))return Z(e,o.then,r);return t.else?Z(e,t.else,r):[e]});case"Try":try{return Z(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof Co?s.value:s instanceof Error?s.message:String(s);return Z(i,t.catch,r)}return[]}case"Call":return dm(e,t.name,t.args,r);case"VarBind":return Z(e,t.value,r).flatMap(i=>{let o=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:"var",name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let l of a)if(o=mi(r,l,i),o!==null)break;return o===null?[]:Z(e,t.body,o)});case"VarRef":{if(t.name==="$ENV")return[r.env?It(r.env):Object.create(null)];let s=r.vars.get(t.name);return s!==void 0?[s]:[null]}case"Recurse":{let s=[],i=new WeakSet,o=a=>{if(a&&typeof a=="object"){if(i.has(a))return;i.add(a)}if(s.push(a),Array.isArray(a))for(let l of a)o(l);else if(a&&typeof a=="object")for(let l of Object.keys(a))o(a[l])};return o(e),s}case"Optional":try{return Z(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:Z(e,i,r).map(a=>typeof a=="string"?a:JSON.stringify(a)).join("")).join("")];case"UpdateOp":return[I5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=Z(e,t.expr,r),i=Z(e,t.init,r)[0],o=r.limits.maxDepth??hm;for(let a of s){let l;if(t.pattern){if(l=mi(r,t.pattern,a),l===null)continue}else l=vo(r,t.varName,a);if(i=Z(i,t.update,l)[0],Ss(i,o+1)>o)return[null]}return[i]}case"Foreach":{let s=Z(e,t.expr,r),i=Z(e,t.init,r)[0],o=[];for(let a of s)try{let l;if(t.pattern){if(l=mi(r,t.pattern,a),l===null)continue}else l=vo(r,t.varName,a);if(i=Z(i,t.update,l)[0],t.extract){let c=Z(i,t.extract,l);o.push(...c)}else o.push(i)}catch(l){throw l instanceof Cs?l.withPrependedResults(o):l}return o}case"Label":try{return Z(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof Cs&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new Cs(t.name);case"Def":{let s=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;s.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let o={...r,funcs:s};return Z(e,t.body,o)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function pm(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function I5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return Z(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?[...l,...c]:l&&c&&typeof l=="object"&&typeof c=="object"?Sl(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!Fe(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=xt(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return He(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=xt(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return He(f,c.name,u(p)),f}return l}case"Index":{let p=Z(e,c.index,s)[0];if(typeof p=="number"&&Number.isNaN(p))throw new Error("Cannot set array element at NaN index");if(typeof p=="number"&&!Number.isInteger(p)&&(p=Math.trunc(p)),c.base)return o(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let d=[...h],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!Fe(p))return h;let d=xt(h),m=Object.hasOwn(d,p)?d[p]:void 0;return He(d,p,u(m)),d}return h});if(typeof p=="number"){if(p>536870911)throw new Error("Array index too large");if(p<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let d=[...l],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(l==null){let d=[];for(;d.length<=p;)d.push(null);return d[p]=u(null),d}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!Fe(p))return l;let h=xt(l),d=Object.hasOwn(h,p)?h[p]:void 0;return He(h,p,u(d)),h}return l}case"Iterate":{let f=p=>{if(Array.isArray(p))return p.map(h=>u(h));if(p&&typeof p=="object"){let h=Object.create(null);for(let[d,m]of Object.entries(p))Fe(d)&&He(h,d,u(m));return h}return p};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,p=>p);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=Z(e,r,s);return i(l,c[0]??null)})}function $5(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!Fe(o.name))return i;if(o.base){let l=Z(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=xt(i);return He(l,o.name,a),l}return i}case"Index":{if(o.base){let u=Z(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=Z(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Fe(c))return i;let u=xt(i);return He(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!Fe(o.name))return i;if(o.base){let l=Z(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!Fe(o.name))return i;let l=xt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=Z(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=Z(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Fe(c))return i;let u=xt(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(h,d,m){switch(d.type){case"Identity":return m;case"Field":{if(!Fe(d.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=xt(h);return He(g,d.name,m),g}return h}case"Index":{let y=Z(e,d.index,n)[0];if(typeof y=="number"&&Array.isArray(h)){let w=[...h],b=y<0?w.length+y:y;return b>=0&&b<w.length&&(w[b]=m),w}if(typeof y=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!Fe(y))return h;let w=xt(h);return He(w,y,m),w}return h}case"Pipe":{let g=Z(h,d.left,n)[0],y=u(g,d.right,m);return u(h,d.left,y)}default:return h}};var a=u;let l=o.left,c=o.right,f=Z(i,l,n)[0];if(f==null)return i;let p=s(f,c);return u(i,l,p)}default:return i}}return s(e,t)}function T5(e,t,n,r,s){if(t==="and")return Z(e,n,s).flatMap(l=>yn(l)?Z(e,r,s).map(u=>yn(u)):[!1]);if(t==="or")return Z(e,n,s).flatMap(l=>yn(l)?[!0]:Z(e,r,s).map(u=>yn(u)));if(t==="//"){let l=Z(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:Z(e,r,s)}let i=Z(e,n,s),o=Z(e,r,s);return i.flatMap(a=>o.map(l=>{switch(t){case"+":return a===null?l:l===null?a:typeof a=="number"&&typeof l=="number"||typeof a=="string"&&typeof l=="string"?a+l:Array.isArray(a)&&Array.isArray(l)?[...a,...l]:a&&l&&typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)?Sl(a,l):null;case"-":if(typeof a=="number"&&typeof l=="number")return a-l;if(Array.isArray(a)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return a.filter(u=>!c.has(JSON.stringify(u)))}if(typeof a=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(a)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":if(typeof a=="number"&&typeof l=="number")return a*l;if(typeof a=="string"&&typeof l=="number")return a.repeat(l);{let c=Ge(a),u=Ge(l);if(c&&u)return oc(c,u)}return null;case"/":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided because the divisor is zero`);return a/l}return typeof a=="string"&&typeof l=="string"?a.split(l):null;case"%":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(a)&&!Number.isNaN(a)?!Number.isFinite(l)&&!Number.isNaN(l)&&a<0&&l>0?-1:0:a%l}return null;case"==":return As(a,l);case"!=":return!As(a,l);case"<":return di(a,l)<0;case"<=":return di(a,l)<=0;case">":return di(a,l)>0;case">=":return di(a,l)>=0;default:return null}}))}function dm(e,t,n,r){let s=v5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=cc(e,t,n,r,Z);if(i!==null)return i;let o=dc(e,t,n,r,Z);if(o!==null)return o;let a=ic(e,t,n,r,Z);if(a!==null)return a;let l=ac(e,t,r.limits.maxDepth);if(l!==null)return l;let c=mc(e,t);if(c!==null)return c;let u=fc(e,t,n,r,Z);if(u!==null)return u;let f=rc(e,t,n,r,Z,fm,wo,yn,bo,K);if(f!==null)return f;let p=pc(e,t,n,r,Z,yn,Eo,Ao,$5,So);if(p!==null)return p;let h=lc(e,t,n,r,Z,As);if(h!==null)return h;let d=sc(e,t,n,r,Z,fm,yn,K);if(d!==null)return d;let m=uc(e,t,n,r,Z,yn,N5,dm);if(m!==null)return m;let g=hc(e,t,n,r,Z,As);if(g!==null)return g;switch(t){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 y=n.length>0?Z(e,n[0],r)[0]:e;throw new Co(y)}case"env":return[r.env?It(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let y=`${t}/${n.length}`,w=r.funcs?.get(y);if(w){let b=w.closure??r.funcs??new Map,x=new Map(b);x.set(y,w);for(let C=0;C<w.params.length;C++){let $=w.params[C],D=n[C];if(D){let v=Z(e,D,r),P;if(v.length===0)P={type:"Call",name:"empty",args:[]};else if(v.length===1)P={type:"Literal",value:v[0]};else{P={type:"Literal",value:v[v.length-1]};for(let k=v.length-2;k>=0;k--)P={type:"Comma",left:{type:"Literal",value:v[k]},right:P}}x.set(`${$}/0`,{params:[],body:P})}}let A={...r,funcs:x};return Z(e,w.body,A)}throw new Error(`Unknown function: ${t}`)}}}function So(e,t,n,r,s){if(t.type==="Comma"){let a=t;So(e,a.left,n,r,s),So(e,a.right,n,r,s);return}let i=pr(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let a=0;a<e.length;a++)s.push([...r,a]);else if(e&&typeof e=="object")for(let a of Object.keys(e))s.push([...r,a]);return}if(t.type==="Recurse"){let a=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)a(l[u],[...c,u]);else for(let u of Object.keys(l))a(l[u],[...c,u])};a(e,[]);return}if(t.type==="Pipe"){let a=pr(t.left);if(a!==null){let l=Z(e,t.left,n);for(let c of l)So(c,t.right,n,[...r,...a],s);return}}Z(e,t,n).length>0&&s.push(r)}var Cs,Co,C5,hm,v5,mm=I(()=>{"use strict";tr();we();zn();cm();um();Cn();xo();Cs=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},Co=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},C5=1e4,hm=2e3,v5=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 ym(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
|
|
557
|
+
`||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
|
|
558
|
+
`;)s();continue}if(u==="."&&r()==="."){s(),t.push({type:"DOTDOT",pos:c});continue}if(u==="="&&r()==="="){s(),t.push({type:"EQ",pos:c});continue}if(u==="!"&&r()==="="){s(),t.push({type:"NE",pos:c});continue}if(u==="<"&&r()==="="){s(),t.push({type:"LE",pos:c});continue}if(u===">"&&r()==="="){s(),t.push({type:"GE",pos:c});continue}if(u==="/"&&r()==="/"){s(),r()==="="?(s(),t.push({type:"UPDATE_ALT",pos:c})):t.push({type:"ALT",pos:c});continue}if(u==="+"&&r()==="="){s(),t.push({type:"UPDATE_ADD",pos:c});continue}if(u==="-"&&r()==="="){s(),t.push({type:"UPDATE_SUB",pos:c});continue}if(u==="*"&&r()==="="){s(),t.push({type:"UPDATE_MUL",pos:c});continue}if(u==="/"&&r()==="="){s(),t.push({type:"UPDATE_DIV",pos:c});continue}if(u==="%"&&r()==="="){s(),t.push({type:"UPDATE_MOD",pos:c});continue}if(u==="="&&r()!=="="){t.push({type:"ASSIGN",pos:c});continue}if(u==="."){t.push({type:"DOT",pos:c});continue}if(u==="|"){r()==="="?(s(),t.push({type:"UPDATE_PIPE",pos:c})):t.push({type:"PIPE",pos:c});continue}if(u===","){t.push({type:"COMMA",pos:c});continue}if(u===":"){t.push({type:"COLON",pos:c});continue}if(u===";"){t.push({type:"SEMICOLON",pos:c});continue}if(u==="("){t.push({type:"LPAREN",pos:c});continue}if(u===")"){t.push({type:"RPAREN",pos:c});continue}if(u==="["){t.push({type:"LBRACKET",pos:c});continue}if(u==="]"){t.push({type:"RBRACKET",pos:c});continue}if(u==="{"){t.push({type:"LBRACE",pos:c});continue}if(u==="}"){t.push({type:"RBRACE",pos:c});continue}if(u==="?"){t.push({type:"QUESTION",pos:c});continue}if(u==="+"){t.push({type:"PLUS",pos:c});continue}if(u==="-"){t.push({type:"MINUS",pos:c});continue}if(u==="*"){t.push({type:"STAR",pos:c});continue}if(u==="/"){t.push({type:"SLASH",pos:c});continue}if(u==="%"){t.push({type:"PERCENT",pos:c});continue}if(u==="<"){t.push({type:"LT",pos:c});continue}if(u===">"){t.push({type:"GT",pos:c});continue}if(o(u)){let f=u;for(;!i()&&(o(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[n+1]==="+"||e[n+1]==="-")&&(f+=s()),f+=s();t.push({type:"NUMBER",value:Number(f),pos:c});continue}if(u==='"'){let f="";for(;!i()&&r()!=='"';)if(r()==="\\"){if(s(),i())break;let p=s();switch(p){case"n":f+=`
|
|
559
|
+
`;break;case"r":f+="\r";break;case"t":f+=" ";break;case"\\":f+="\\";break;case'"':f+='"';break;case"(":f+="\\(";break;default:f+=p}}else f+=s();i()||s(),t.push({type:"STRING",value:f,pos:c});continue}if(a(u)||u==="$"||u==="@"){let f=u;for(;!i()&&l(r());)f+=s();let p=gm.get(f);p?t.push({type:p,value:f,pos:c}):t.push({type:"IDENT",value:f,pos:c});continue}throw new Error(`Unexpected character '${u}' at position ${c}`)}}return t.push({type:"EOF",pos:n}),t}function wm(e){let t=ym(e);return new yc(t).parse()}var gm,ko,yc,bm=I(()=>{"use strict";gm=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"]]),ko=new Set(gm.values());yc=class e{tokens;pos=0;constructor(t){this.tokens=t}peek(t=0){return this.tokens[this.pos+t]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(t){return this.peek().type===t}match(...t){for(let n of t)if(this.check(n))return this.advance();return null}expect(t,n){if(!this.check(t))throw new Error(`${n} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(t=0){let n=this.peek(t),r=this.peek(t+1);return r.type==="STRING"?!0:r.type==="IDENT"||ko.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||ko.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||ko.has(n.type))&&n.pos===t.pos+1?this.advance().value:null}parse(){let t=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return t}parseExpr(){return this.parsePipe()}parsePattern(){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 t=this.expect("IDENT","Expected variable name in pattern"),n=t.value;if(!n.startsWith("$"))throw new Error(`Variable name must start with $ at position ${t.pos}`);return{type:"var",name:n}}parsePatternField(){if(this.match("LPAREN")){let n=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:n,pattern:r}}let t=this.peek();if(t.type==="IDENT"||ko.has(t.type)){let n=t.value;if(n.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n.slice(1),pattern:r,keyVar:n}}return{key:n.slice(1),pattern:{type:"var",name:n}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n,pattern:r}}return{key:n,pattern:{type:"var",name:`$${n}`}}}throw new Error(`Expected field name in object pattern at position ${t.pos}`)}parsePipe(){let t=this.parseComma();for(;this.match("PIPE");){let n=this.parseComma();t={type:"Pipe",left:t,right:n}}return t}parseComma(){let t=this.parseVarBind();for(;this.match("COMMA");){let n=this.parseVarBind();t={type:"Comma",left:t,right:n}}return t}parseVarBind(){let t=this.parseUpdate();if(this.match("AS")){let n=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 n.type==="var"&&r.length===0?{type:"VarBind",name:n.name,value:t,body:s}:{type:"VarBind",name:n.type==="var"?n.name:"",value:t,body:s,pattern:n.type!=="var"?n:void 0,alternatives:r.length>0?r:void 0}}return t}peekAhead(t){let n=this.pos+t;return n<this.tokens.length?this.tokens[n]:void 0}parseUpdate(){let t=this.parseAlt(),n=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.parseVarBind(),i=n.get(r.type);if(i)return{type:"UpdateOp",op:i,path:t,value:s}}return t}parseAlt(){let t=this.parseOr();for(;this.match("ALT");){let n=this.parseOr();t={type:"BinaryOp",op:"//",left:t,right:n}}return t}parseOr(){let t=this.parseAnd();for(;this.match("OR");){let n=this.parseAnd();t={type:"BinaryOp",op:"or",left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.match("AND");){let n=this.parseNot();t={type:"BinaryOp",op:"and",left:t,right:n}}return t}parseNot(){return this.parseComparison()}parseComparison(){let t=this.parseAddSub(),n=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=n.get(r.type);if(s){let i=this.parseAddSub();t={type:"BinaryOp",op:s,left:t,right:i}}}return t}parseAddSub(){let t=this.parseMulDiv();for(;;)if(this.match("PLUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"+",left:t,right:n}}else if(this.match("MINUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"-",left:t,right:n}}else break;return t}parseMulDiv(){let t=this.parseUnary();for(;;)if(this.match("STAR")){let n=this.parseUnary();t={type:"BinaryOp",op:"*",left:t,right:n}}else if(this.match("SLASH")){let n=this.parseUnary();t={type:"BinaryOp",op:"/",left:t,right:n}}else if(this.match("PERCENT")){let n=this.parseUnary();t={type:"BinaryOp",op:"%",left:t,right:n}}else break;return t}parseUnary(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("QUESTION"))t={type:"Optional",expr:t};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),t={type:"Field",name:this.advance().value,base:t};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))t={type:"Iterate",base:t};else if(this.check("COLON")){this.advance();let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",end:n,base:t}}else{let n=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",start:n,end:r,base:t}}else this.expect("RBRACKET","Expected ']'"),t={type:"Index",index:n,base:t}}else break;return t}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let t=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 n=this.consumeFieldNameAfterDot(t);return n!==null?{type:"Field",name:n}:{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 n=this.advance().value;return n.includes("\\(")?this.parseStringInterpolation(n):{type:"Literal",value:n}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let t=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:t}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let t=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:t}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let t=this.parsePostfix(),n;return this.match("CATCH")&&(n=this.parsePostfix()),{type:"Try",body:t,catch:n}}if(this.match("REDUCE")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let n=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 i=n.type==="var"?n.name:"";return{type:"Reduce",expr:t,varName:i,init:r,update:s,pattern:n.type!=="var"?n:void 0}}if(this.match("FOREACH")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),i;this.match("SEMICOLON")&&(i=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let o=n.type==="var"?n.name:"";return{type:"Foreach",expr:t,varName:o,init:r,update:s,extract:i,pattern:n.type!=="var"?n:void 0}}if(this.match("LABEL")){let t=this.expect("IDENT","Expected label name (e.g., $out)"),n=t.value;if(!n.startsWith("$"))throw new Error(`Label name must start with $ at position ${t.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:n,body:r}}if(this.match("BREAK")){let t=this.expect("IDENT","Expected label name to break to"),n=t.value;if(!n.startsWith("$"))throw new Error(`Break label must start with $ at position ${t.pos}`);return{type:"Break",name:n}}if(this.match("DEF")){let n=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let o=this.expect("IDENT","Expected parameter name");for(r.push(o.value);this.match("SEMICOLON");){let a=this.expect("IDENT","Expected parameter name");r.push(a.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 i=this.parseExpr();return{type:"Def",name:n,params:r,funcBody:s,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let n=this.advance().value;if(n.startsWith("$"))return{type:"VarRef",name:n};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:n,args:r}}return{type:"Call",name:n,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let t=[];if(!this.check("RBRACE"))do{let n,r;if(this.match("LPAREN"))n=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")?(n=s,r=this.parseObjectValue()):(n=s,r={type:"Field",name:s})}else if(this.check("STRING"))n=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);t.push({key:n,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:t}}parseObjectValue(){let t=this.parseVarBind();for(;this.match("PIPE");){let n=this.parseVarBind();t={type:"Pipe",left:t,right:n}}return t}parseIf(){let t=this.parseExpr();this.expect("THEN","Expected 'then'");let n=this.parseExpr(),r=[];for(;this.match("ELIF");){let i=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let o=this.parseExpr();r.push({cond:i,then:o})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:t,then:n,elifs:r,else:s}}parseStringInterpolation(t){let n=[],r="",s=0;for(;s<t.length;)if(t[s]==="\\"&&t[s+1]==="("){r&&(n.push(r),r=""),s+=2;let i=1,o="";for(;s<t.length&&i>0;)t[s]==="("?i++:t[s]===")"&&i--,i>0&&(o+=t[s]),s++;let a=ym(o),l=new e(a);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var xm=I(()=>{"use strict";mm();bm()});var Am={};ee(Am,{flagsForFuzzing:()=>_5,jqCommand:()=>D5});function O5(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
560
|
+
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`}}function R5(e){let t="",n=!1,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(r){t+=i,r=!1;continue}if(i==="\\"){t+=i,r=!0;continue}if(i==='"'){t+=i,n=!n;continue}if(n&&i.charCodeAt(0)<=31){t+=O5(i);continue}t+=i}return t}function wc(e,t,n){return JSON.parse(R5(e.slice(t,n)))}function Em(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&/\s/.test(e[n]);)n++;if(n>=r)break;let s=n,i=e[n];if(i==="{"||i==="["){let o=i,a=i==="{"?"}":"]",l=1,c=!1,u=!1;for(n++;n<r&&l>0;){let f=e[n];u?u=!1:f==="\\"?u=!0:f==='"'?c=!c:c||(f===o?l++:f===a&&l--),n++}if(l!==0)throw new Error(`Unexpected end of JSON input at position ${n} (unclosed ${o})`);t.push(ds(wc(e,s,n)))}else if(i==='"'){let o=!1;for(n++;n<r;){let a=e[n];if(o)o=!1;else if(a==="\\")o=!0;else if(a==='"'){n++;break}n++}t.push(ds(wc(e,s,n)))}else if(i==="-"||i>="0"&&i<="9"){for(;n<r&&/[\d.eE+-]/.test(e[n]);)n++;t.push(ds(wc(e,s,n)))}else if(e.slice(n,n+4)==="true")t.push(!0),n+=4;else if(e.slice(n,n+5)==="false")t.push(!1),n+=5;else if(e.slice(n,n+4)==="null")t.push(null),n+=4;else{let o=e.slice(n,n+10);throw new Error(`Invalid JSON at position ${s}: unexpected '${o.split(/\s/)[0]}'`)}}return t}function gi(e,t,n,r,s,i=0){if(e===null||e===void 0)return"null";if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):"null";if(typeof e=="string")return n?e:JSON.stringify(e);let o=s?" ":" ";if(Array.isArray(e))return e.length===0?"[]":t?`[${e.map(l=>gi(l,!0,!1,r,s)).join(",")}]`:`[
|
|
561
|
+
${e.map(l=>o.repeat(i+1)+gi(l,!1,!1,r,s,i+1)).join(`,
|
|
562
|
+
`)}
|
|
563
|
+
${o.repeat(i)}]`;if(typeof e=="object"){let a=Object.keys(e);return r&&(a=a.sort()),a.length===0?"{}":t?`{${a.map(c=>`${JSON.stringify(c)}:${gi(e[c],!0,!1,r,s)}`).join(",")}}`:`{
|
|
564
|
+
${a.map(c=>{let u=gi(e[c],!1,!1,r,s,i+1);return`${o.repeat(i+1)}${JSON.stringify(c)}: ${u}`}).join(`,
|
|
565
|
+
`)}
|
|
566
|
+
${o.repeat(i)}}`}return String(e)}var P5,D5,_5,Sm=I(()=>{"use strict";ye();An();we();zn();cn();Or();ae();xm();Cn();P5={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE...]",options:["-R, --raw-input read each line as string instead of JSON","-r, --raw-output output strings without quotes","-c, --compact-output compact instead of pretty-printed output","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};D5={name:"jq",async execute(e,t){lt(t.requireDefenseContext,"jq","execution entry");let n=(g,y)=>Rt(t.requireDefenseContext,"jq",g,y);if(W(e))return B(P5);let r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=".",h=!1,d=[];for(let g=0;g<e.length;g++){let y=e[g];if(y==="-R"||y==="--raw-input")s=!0;else if(y==="-r"||y==="--raw-output")r=!0;else if(y==="-c"||y==="--compact-output")i=!0;else if(y==="-e"||y==="--exit-status")o=!0;else if(y==="-s"||y==="--slurp")a=!0;else if(y==="-n"||y==="--null-input")l=!0;else if(y==="-j"||y==="--join-output")c=!0;else if(!(y==="-a"||y==="--ascii")){if(y==="-S"||y==="--sort-keys")u=!0;else if(!(y==="-C"||y==="--color")){if(!(y==="-M"||y==="--monochrome"))if(y==="--tab")f=!0;else if(y==="-")d.push("-");else{if(y.startsWith("--"))return Q("jq",y);if(y.startsWith("-")){for(let w of y.slice(1))if(w==="R")s=!0;else if(w==="r")r=!0;else if(w==="c")i=!0;else if(w==="e")o=!0;else if(w==="s")a=!0;else if(w==="n")l=!0;else if(w==="j")c=!0;else if(w!=="a"){if(w==="S")u=!0;else if(w!=="C"){if(w!=="M")return Q("jq",`-${w}`)}}}else h?d.push(y):(p=y,h=!0)}}}}let m=[];if(!l)if(d.length===0||d.length===1&&d[0]==="-")m.push({source:"stdin",content:le(t.stdin)});else{let g=await n("file read",()=>Tr(t,d,{cmdName:"jq",stopOnError:!0}));if(g.exitCode!==0)return{stdout:"",stderr:g.stderr,exitCode:2};m=g.files.map(y=>({source:y.filename||"stdin",content:le(y.content)}))}try{let g=wm(p),y=[],w={limits:t.limits?{maxIterations:t.limits.maxJqIterations}:void 0,env:t.env,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext};if(l)y=Z(null,g,w);else if(s&&a){let v=m.map(({content:P})=>P).join("");y=Z(v,g,w)}else if(s){let v="";for(let{content:P}of m){let k=v+P,N=0,R=k.indexOf(`
|
|
567
|
+
`,N);for(;R!==-1;)y.push(...Z(k.slice(N,R),g,w)),N=R+1,R=k.indexOf(`
|
|
568
|
+
`,N);v=k.slice(N)}v!==""&&y.push(...Z(v,g,w))}else if(a){let v=[];for(let{content:P}of m){let k=P.trim();k&&v.push(...Em(k))}y=Z(v,g,w)}else for(let{content:v}of m){let P=v.trim();if(!P)continue;let k=Em(P);for(let N of k)y.push(...Z(N,g,w))}let b=y.map(v=>gi(v,i,r,u,f)),x=c?"":`
|
|
569
|
+
`,A=b.join(x),C=t.limits?.maxStringLength;if(C!==void 0&&C>0&&A.length>C)throw new K(`jq: output size limit exceeded (${C} bytes)`,"string_length");let $=o&&(y.length===0||y.every(v=>v==null||v===!1))?1:0;return{stdout:A?c?A:`${A}
|
|
570
|
+
`:"",stderr:"",exitCode:$}}catch(g){if(g instanceof de)throw g;if(g instanceof K)return{stdout:"",stderr:`jq: ${ze(g.message)}
|
|
571
|
+
`,exitCode:K.EXIT_CODE};let y=ze(g.message);return y.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${y}
|
|
572
|
+
`,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${y}
|
|
573
|
+
`,exitCode:5}}}},_5={name:"jq",flags:[{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"--tab",type:"boolean"}],stdinType:"json",needsArgs:!0}});var vm={};ee(vm,{base64Command:()=>M5,flagsForFuzzing:()=>U5});async function Cm(e,t,n){if(t.length===0||t.length===1&&t[0]==="-")return{ok:!0,data:Uint8Array.from(e.stdin,a=>a.charCodeAt(0))};let r=[];for(let a of t){if(a==="-"){r.push(Uint8Array.from(e.stdin,l=>l.charCodeAt(0)));continue}try{let l=e.fs.resolvePath(e.cwd,a),c=await e.fs.readFileBuffer(l);r.push(c)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${a}: No such file or directory
|
|
574
|
+
`,exitCode:1}}}}let s=r.reduce((a,l)=>a+l.length,0),i=new Uint8Array(s),o=0;for(let a of r)i.set(a,o),o+=a.length;return{ok:!0,data:i}}var F5,L5,M5,U5,km=I(()=>{"use strict";ye();ct();ae();F5={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},L5={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};M5={name:"base64",async execute(e,t){if(W(e))return B(F5);let n=Ee("base64",e,L5);if(!n.ok)return n.error;let r=n.result.flags.decode,s=n.result.flags.wrap,i=n.result.positional;try{if(r){let l=await Cm(t,i,"base64");if(!l.ok)return l.error;if(typeof Buffer<"u"){let h=Buffer.from(l.data).toString("utf8").replace(/\s/g,"");return{stdout:Buffer.from(h,"base64").toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let u=String.fromCharCode(...l.data).replace(/\s/g,"");return{stdout:atob(u),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let o=await Cm(t,i,"base64");if(!o.ok)return o.error;let a;if(typeof Buffer<"u"?a=Buffer.from(o.data).toString("base64"):a=btoa(String.fromCharCode(...o.data)),s>0){let l=[];for(let c=0;c<a.length;c+=s)l.push(a.slice(c,c+s));a=l.join(`
|
|
575
|
+
`)+(a.length>0?`
|
|
576
|
+
`:"")}return{stdout:a,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input
|
|
577
|
+
`,exitCode:1}}}},U5={name:"base64",flags:[{flag:"-d",type:"boolean"},{flag:"-w",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Im={};ee(Im,{diffCommand:()=>z5,flagsForFuzzing:()=>H5});import*as Nm from"diff";var B5,W5,z5,H5,$m=I(()=>{"use strict";ye();ct();ae();B5={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},W5={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},z5={name:"diff",async execute(e,t){if(W(e))return B(B5);let n=Ee("diff",e,W5);if(!n.ok)return n.error;let r=n.result.flags.brief,s=n.result.flags.reportSame,i=n.result.flags.ignoreCase,o=n.result.positional;if(n.result.flags.unified,o.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
578
|
+
`,exitCode:2};let a,l,[c,u]=o;try{a=c==="-"?le(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,c))}catch{return{stdout:"",stderr:`diff: ${c}: No such file or directory
|
|
579
|
+
`,exitCode:2}}try{l=u==="-"?le(t.stdin):await t.fs.readFile(t.fs.resolvePath(t.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory
|
|
580
|
+
`,exitCode:2}}let f=a,p=l;return i&&(f=f.toLowerCase(),p=p.toLowerCase()),f===p?s?{stdout:`Files ${c} and ${u} are identical
|
|
581
|
+
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:r?{stdout:`Files ${c} and ${u} differ
|
|
582
|
+
`,stderr:"",exitCode:1}:{stdout:Nm.createTwoFilesPatch(c,u,a,l,"","",{context:3}),stderr:"",exitCode:1}}},H5={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var Tm={};ee(Tm,{dateCommand:()=>K5,flagsForFuzzing:()=>Q5});function G5(e){try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),!0}catch{return!1}}function V5(e,t){let n=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),r=o=>n.find(a=>a.type===o)?.value??"00",s=Number.parseInt(r("hour"),10)%24,i=new Date(`${r("year")}-${r("month")}-${r("day")}T${String(s).padStart(2,"0")}:${r("minute")}:${r("second")}Z`);return Number.isNaN(i.getTime())?null:i}function q5(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/);if(!n)return null;let[,r,s,i,o="00",a="00",l="00"]=n,c=new Date(`${r}-${s}-${i}T${o}:${a}:${l}Z`);if(Number.isNaN(c.getTime()))return null;try{let u=c;for(let f=0;f<3;f++){let p=V5(u,t);if(p===null)return null;let h=p.getTime()-c.getTime();if(h===0)return u;u=new Date(u.getTime()-h)}return u}catch{return null}}function Z5(e,t){if(e.startsWith("@")){let s=e.slice(1);return/^-?\d+$/.test(s)?new Date(Number.parseInt(s,10)*1e3):null}let n=e.toLowerCase().trim();if(n==="now"||n==="today")return new Date;if(n==="yesterday")return new Date(Date.now()-864e5);if(n==="tomorrow")return new Date(Date.now()+864e5);if(t&&!/Z$/i.test(e)&&!/[+-]\d{2}:?\d{2}$/.test(e)){let s=q5(e,t);if(s)return s}let r=new Date(e);return Number.isNaN(r.getTime())?null:r}var j5,K5,Q5,Om=I(()=>{"use strict";ae();Ya();j5={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING, not 'now'","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]};K5={name:"date",async execute(e,t){if(W(e))return B(j5);let n=!1,r=null,s=null,i=!1,o=!1;for(let p=0;p<e.length;p++){let h=e[p];if(h==="-u"||h==="--utc")n=!0;else if(h==="-d"||h==="--date")r=e[++p]??"";else if(h.startsWith("--date="))r=h.slice(7);else if(h==="-I"||h==="--iso-8601")i=!0;else if(h==="-R"||h==="--rfc-email")o=!0;else if(h.startsWith("+"))s=h.slice(1);else{if(h.startsWith("--"))return Q("date",h);if(h.startsWith("-"))for(let d of h.slice(1))if(d==="u")n=!0;else if(d==="I")i=!0;else if(d==="R")o=!0;else return Q("date",`-${d}`)}}let a=t.env.get("TZ");a&&!G5(a)&&(a=void 0);let l=n?"UTC":a??"UTC",c=r!==null?Z5(r,a):new Date;if(!c)return{stdout:"",stderr:`date: invalid date '${r}'
|
|
583
|
+
`,exitCode:1};let u=Math.floor(c.getTime()/1e3),f;return s?f=Rr(s,u,l):i?f=Rr("%Y-%m-%dT%H:%M:%S%z",u,l):o?f=Rr("%a, %d %b %Y %H:%M:%S %z",u,l):f=Rr("%a %b %e %H:%M:%S %Z %Y",u,l),{stdout:`${f}
|
|
584
|
+
`,stderr:"",exitCode:0}}},Q5={name:"date",flags:[{flag:"-d",type:"value",valueHint:"string"},{flag:"-u",type:"boolean"},{flag:"-I",type:"boolean"},{flag:"-R",type:"boolean"}]}});function No(e){let t=e.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!t)return null;let n=parseFloat(t[1]);switch(t[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var bc=I(()=>{"use strict"});var Pm={};ee(Pm,{flagsForFuzzing:()=>J5,sleepCommand:()=>Y5});var X5,Rm,Y5,J5,Dm=I(()=>{"use strict";Xs();bc();ae();X5={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
585
|
+
s - seconds (default)
|
|
586
|
+
m - minutes
|
|
587
|
+
h - hours
|
|
588
|
+
d - days
|
|
589
|
+
|
|
590
|
+
NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},Rm=36e5,Y5={name:"sleep",async execute(e,t){if(W(e))return B(X5);if(e.length===0)return{stdout:"",stderr:`sleep: missing operand
|
|
591
|
+
`,exitCode:1};let n=0;for(let r of e){let s=No(r);if(s===null)return{stdout:"",stderr:`sleep: invalid time interval '${r}'
|
|
592
|
+
`,exitCode:1};n+=s}return n>Rm&&(n=Rm),t.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(t.sleep?await t.sleep(n):t.signal?await new Promise(r=>{let s=()=>{ss(i),r()},i=$r(()=>{t.signal?.removeEventListener("abort",s),r()},n);t.signal?.addEventListener("abort",s,{once:!0})}):await new Promise(r=>$r(r,n)),{stdout:"",stderr:"",exitCode:0})}},J5={name:"sleep",flags:[],needsArgs:!0}});var _m={};ee(_m,{flagsForFuzzing:()=>nx,timeoutCommand:()=>tx});var ex,tx,nx,Fm=I(()=>{"use strict";ye();Dr();Xs();bc();ae();ex={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
593
|
+
|
|
594
|
+
DURATION is a number with optional suffix:
|
|
595
|
+
s - seconds (default)
|
|
596
|
+
m - minutes
|
|
597
|
+
h - hours
|
|
598
|
+
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},tx={name:"timeout",async execute(e,t){if(W(e))return B(ex);let n=0;for(let c=0;c<e.length;c++){let u=e[c];if(u==="--preserve-status")n=c+1;else if(u==="--foreground")n=c+1;else if(u==="-k"||u==="--kill-after")c++,n=c+1;else if(u.startsWith("--kill-after="))n=c+1;else if(u==="-s"||u==="--signal")c++,n=c+1;else if(u.startsWith("--signal="))n=c+1;else{if(u.startsWith("--")&&u!=="--")return Q("timeout",u);if(u.startsWith("-")&&u.length>1&&u!=="--")if(u.startsWith("-k"))n=c+1;else if(u.startsWith("-s"))n=c+1;else return Q("timeout",u);else{n=c;break}}}let r=e.slice(n);if(r.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
599
|
+
`,exitCode:1};let s=r[0],i=No(s);if(i===null)return{stdout:"",stderr:`timeout: invalid time interval '${s}'
|
|
600
|
+
`,exitCode:1};let o=r.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
601
|
+
`,exitCode:1};if(!t.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
602
|
+
`,exitCode:1};let a=new AbortController,l;try{let c=new Promise(p=>{l=$r(()=>{a.abort(),p({timedOut:!0})},i)}),u=t.exec(rn([o[0]]),{cwd:t.cwd,signal:a.signal,stdin:t.stdin,stdinKind:"bytes",args:o.slice(1)}).then(p=>({timedOut:!1,result:p})),f=await Promise.race([c,u]);return f.timedOut?{stdout:"",stderr:"",exitCode:124}:f.result}finally{l!==void 0&&ss(l)}}},nx={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2}});var yR,wR,vs,Io,yi=I(()=>{"use strict";yR=globalThis.SharedArrayBuffer,wR=globalThis.Atomics,vs=performance.now.bind(performance),Io=globalThis.Headers});var Lm={};ee(Lm,{flagsForFuzzing:()=>ix,timeCommand:()=>rx});function sx(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${n.toString().padStart(2,"0")}:${r.toFixed(2).padStart(5,"0")}`:`${n}:${r.toFixed(2).padStart(5,"0")}`}var rx,ix,Mm=I(()=>{"use strict";ye();An();tr();Dr();yi();rx={name:"time",async execute(e,t){let n="%e %M",r=null,s=!1,i=!1,o=0;for(;o<e.length;){let d=e[o];if(d==="-f"||d==="--format"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-f'
|
|
603
|
+
`,exitCode:1};n=e[o],o++}else if(d==="-o"||d==="--output"){if(o++,o>=e.length)return{stdout:"",stderr:`time: missing argument to '-o'
|
|
604
|
+
`,exitCode:1};r=e[o],o++}else if(d==="-a"||d==="--append")s=!0,o++;else if(d==="-v"||d==="--verbose")n=`Command being timed: %C
|
|
605
|
+
Elapsed (wall clock) time: %e seconds
|
|
606
|
+
Maximum resident set size (kbytes): %M`,o++;else if(d==="-p"||d==="--portability")i=!0,o++;else if(d==="--"){o++;break}else if(d.startsWith("-"))o++;else break}let a=e.slice(o);if(a.length===0)return{stdout:"",stderr:"",exitCode:0};let l=vs(),c=a.join(" "),u;try{if(!t.exec)return{stdout:"",stderr:`time: exec not available
|
|
607
|
+
`,exitCode:1};u=await t.exec(rn([a[0]]),{env:It(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a.slice(1)})}catch(d){u={stdout:"",stderr:`time: ${ze(d.message)}
|
|
608
|
+
`,exitCode:127}}let p=(vs()-l)/1e3,h;if(i?h=`real ${p.toFixed(2)}
|
|
609
|
+
user 0.00
|
|
610
|
+
sys 0.00
|
|
611
|
+
`:(h=n.replace(/%e/g,p.toFixed(2)).replace(/%E/g,sx(p)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,c),h.endsWith(`
|
|
612
|
+
`)||(h+=`
|
|
613
|
+
`)),r)try{let d=t.fs.resolvePath(t.cwd,r);if(s&&await t.fs.exists(d)){let m=await t.fs.readFile(d);await t.fs.writeFile(d,m+h)}else await t.fs.writeFile(d,h)}catch(d){let m=ze(d.message);return{stdout:u.stdout,stderr:u.stderr+`time: cannot write to '${r}': ${m}
|
|
614
|
+
`,exitCode:u.exitCode}}else u={...u,stderr:u.stderr+h};return u}};ix={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0}});var Um={};ee(Um,{flagsForFuzzing:()=>ax,seqCommand:()=>ox});var ox,ax,Bm=I(()=>{"use strict";ox={name:"seq",async execute(e){let t=`
|
|
615
|
+
`,n=!1,r=[],s=0;for(;s<e.length;){let d=e[s];if(d==="-s"&&s+1<e.length){t=e[s+1],s+=2;continue}if(d==="-w"){n=!0,s++;continue}if(d==="--"){s++;break}if(d.startsWith("-")&&d!=="-"){if(d.startsWith("-s")&&d.length>2){t=d.slice(2),s++;continue}if((d==="-ws"||d==="-sw")&&(n=!0,s+1<e.length)){t=e[s+1],s+=2;continue}}r.push(d),s++}for(;s<e.length;)r.push(e[s]),s++;if(r.length===0)return{stdout:"",stderr:`seq: missing operand
|
|
616
|
+
`,exitCode:1};let i=1,o=1,a;if(r.length===1?a=parseFloat(r[0]):r.length===2?(i=parseFloat(r[0]),a=parseFloat(r[1])):(i=parseFloat(r[0]),o=parseFloat(r[1]),a=parseFloat(r[2])),Number.isNaN(i)||Number.isNaN(o)||Number.isNaN(a))return{stdout:"",stderr:`seq: invalid floating point argument: '${r.find(m=>Number.isNaN(parseFloat(m)))}'
|
|
617
|
+
`,exitCode:1};if(o===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
|
|
618
|
+
`,exitCode:1};let l=[],c=d=>{let m=String(d),g=m.indexOf(".");return g===-1?0:m.length-g-1},u=Math.max(c(i),c(o),c(a)),f=1e5,p=0;if(o>0)for(let d=i;d<=a+1e-10&&!(p++>f);d+=o)l.push(u>0?d.toFixed(u):String(Math.round(d)));else for(let d=i;d>=a-1e-10&&!(p++>f);d+=o)l.push(u>0?d.toFixed(u):String(Math.round(d)));if(n&&l.length>0){let d=Math.max(...l.map(m=>m.replace("-","").length));for(let m=0;m<l.length;m++){let g=l[m].startsWith("-"),w=(g?l[m].slice(1):l[m]).padStart(d,"0");l[m]=g?`-${w}`:w}}let h=l.join(t);return{stdout:h?`${h}
|
|
619
|
+
`:"",stderr:"",exitCode:0}}},ax={name:"seq",flags:[{flag:"-s",type:"value",valueHint:"string"},{flag:"-w",type:"boolean"}],needsArgs:!0}});var Wm={};ee(Wm,{exprCommand:()=>lx,flagsForFuzzing:()=>ux});function cx(e){if(e.length===1)return e[0];let t=0;function n(){let c=r();for(;t<e.length&&e[t]==="|";){t++;let u=r();if(c!=="0"&&c!=="")return c;c=u}return c}function r(){let c=s();for(;t<e.length&&e[t]==="&";){t++;let u=s();(c==="0"||c===""||u==="0"||u==="")&&(c="0")}return c}function s(){let c=i();for(;t<e.length;){let u=e[t];if(["=","!=","<",">","<=",">="].includes(u)){t++;let f=i(),p=parseInt(c,10),h=parseInt(f,10),d=!Number.isNaN(p)&&!Number.isNaN(h),m;u==="="?m=d?p===h:c===f:u==="!="?m=d?p!==h:c!==f:u==="<"?m=d?p<h:c<f:u===">"?m=d?p>h:c>f:u==="<="?m=d?p<=h:c<=f:m=d?p>=h:c>=f,c=m?"1":"0"}else break}return c}function i(){let c=o();for(;t<e.length;){let u=e[t];if(u==="+"||u==="-"){t++;let f=o(),p=parseInt(c,10),h=parseInt(f,10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");c=String(u==="+"?p+h:p-h)}else break}return c}function o(){let c=a();for(;t<e.length;){let u=e[t];if(u==="*"||u==="/"||u==="%"){t++;let f=a(),p=parseInt(c,10),h=parseInt(f,10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");if((u==="/"||u==="%")&&h===0)throw new Error("division by zero");u==="*"?c=String(p*h):u==="/"?c=String(Math.trunc(p/h)):c=String(p%h)}else break}return c}function a(){let c=l();for(;t<e.length&&e[t]===":";){t++;let u=l(),p=X(`^${u}`).match(c);p?c=p[1]!==void 0?p[1]:String(p[0].length):c="0"}return c}function l(){if(t>=e.length)throw new Error("syntax error");let c=e[t];if(c==="match"){t++;let u=l(),f=l(),h=X(f).match(u);return h?h[1]!==void 0?h[1]:String(h[0].length):"0"}if(c==="substr"){t++;let u=l(),f=parseInt(l(),10),p=parseInt(l(),10);if(Number.isNaN(f)||Number.isNaN(p))throw new Error("non-integer argument");return u.substring(f-1,f-1+p)}if(c==="index"){t++;let u=l(),f=l();for(let p=0;p<u.length;p++)if(f.includes(u[p]))return String(p+1);return"0"}if(c==="length"){t++;let u=l();return String(u.length)}if(c==="("){t++;let u=n();if(t>=e.length||e[t]!==")")throw new Error("syntax error");return t++,u}return t++,c}return n()}var lx,ux,zm=I(()=>{"use strict";An();Qe();lx={name:"expr",async execute(e,t){if(e.length===0)return{stdout:"",stderr:`expr: missing operand
|
|
620
|
+
`,exitCode:2};try{let n=cx(e),r=n==="0"||n===""?1:0;return{stdout:`${n}
|
|
621
|
+
`,stderr:"",exitCode:r}}catch(n){return{stdout:"",stderr:`expr: ${ze(n.message)}
|
|
622
|
+
`,exitCode:2}}}};ux={name:"expr",flags:[],needsArgs:!0}});function px(e){function t(h,d){return h<<d|h>>>32-d}let n=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),r=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],s=e.length*8,i=(e.length%64<56?56:120)-e.length%64,o=new Uint8Array(e.length+i+8);o.set(e),o[e.length]=128;let a=new DataView(o.buffer);a.setUint32(o.length-8,s>>>0,!0),a.setUint32(o.length-4,Math.floor(s/4294967296),!0);let l=1732584193,c=4023233417,u=2562383102,f=271733878;for(let h=0;h<o.length;h+=64){let d=new Uint32Array(16);for(let b=0;b<16;b++)d[b]=a.getUint32(h+b*4,!0);let m=l,g=c,y=u,w=f;for(let b=0;b<64;b++){let x,A;b<16?(x=g&y|~g&w,A=b):b<32?(x=w&g|~w&y,A=(5*b+1)%16):b<48?(x=g^y^w,A=(3*b+5)%16):(x=y^(g|~w),A=7*b%16),x=x+m+n[b]+d[A]>>>0,m=w,w=y,y=g,g=g+t(x,r[b])>>>0}l=l+m>>>0,c=c+g>>>0,u=u+y>>>0,f=f+w>>>0}let p=new Uint8Array(16);return new DataView(p.buffer).setUint32(0,l,!0),new DataView(p.buffer).setUint32(4,c,!0),new DataView(p.buffer).setUint32(8,u,!0),new DataView(p.buffer).setUint32(12,f,!0),Array.from(p).map(h=>h.toString(16).padStart(2,"0")).join("")}async function Hm(e,t){if(e==="md5")return px(t);let n=fx.get(e);if(!n)throw new Error(`Unknown algorithm: ${e}`);let r=await globalThis.crypto.subtle.digest(n,new Uint8Array(t).buffer);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}function ks(e,t,n){let r={name:e,summary:n,usage:`${e} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:e,async execute(s,i){if(W(s))return B(r);let o=!1,a=[];for(let f of s)if(f==="-c"||f==="--check")o=!0;else if(!(f==="-b"||f==="-t"||f==="--binary"||f==="--text")){if(f.startsWith("-")&&f!=="-")return Q(e,f);a.push(f)}a.length===0&&a.push("-");let l=async f=>{if(f==="-")return Uint8Array.from(i.stdin,p=>p.charCodeAt(0));try{return await i.fs.readFileBuffer(i.fs.resolvePath(i.cwd,f))}catch{return null}};if(o){let f=0,p="";for(let h of a){let d=h==="-"?le(i.stdin):await i.fs.readFile(i.fs.resolvePath(i.cwd,h)).catch(()=>null);if(d===null)return{stdout:"",stderr:`${e}: ${h}: No such file or directory
|
|
623
|
+
`,exitCode:1};for(let m of d.split(`
|
|
624
|
+
`)){let g=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!g)continue;let[,y,w]=g,b=await l(w);if(b===null){p+=`${w}: FAILED open or read
|
|
625
|
+
`,f++;continue}let x=await Hm(t,b)===y.toLowerCase();p+=`${w}: ${x?"OK":"FAILED"}
|
|
626
|
+
`,x||f++}}return f>0&&(p+=`${e}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
|
|
627
|
+
`),{stdout:p,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of a){let p=await l(f);if(p===null){c+=`${e}: ${f}: No such file or directory
|
|
628
|
+
`,u=1;continue}c+=`${await Hm(t,p)} ${f}
|
|
629
|
+
`}return{stdout:c,stderr:"",exitCode:u}}}}var fx,$o=I(()=>{"use strict";ye();ae();fx=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var jm={};ee(jm,{flagsForFuzzing:()=>dx,md5sumCommand:()=>hx});var hx,dx,Gm=I(()=>{"use strict";$o();hx=ks("md5sum","md5","compute MD5 message digest"),dx={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Vm={};ee(Vm,{flagsForFuzzing:()=>gx,sha1sumCommand:()=>mx});var mx,gx,qm=I(()=>{"use strict";$o();mx=ks("sha1sum","sha1","compute SHA1 message digest"),gx={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Zm={};ee(Zm,{flagsForFuzzing:()=>wx,sha256sumCommand:()=>yx});var yx,wx,Km=I(()=>{"use strict";$o();yx=ks("sha256sum","sha256","compute SHA256 message digest"),wx={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Qm=Ui(xc=>{xc.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(h?-1:1)*o*Math.pow(2,i-r)};xc.write=function(e,t,n,r,s,i){var o,a,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,d=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=p/l:t+=p*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(t*l-1)*Math.pow(2,s),o=o+f):(a=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+h]=a&255,h+=d,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+h]=o&255,h+=d,o/=256,c-=8);e[n+h-d]|=m*128}});function xx(){if(!(typeof globalThis.TextDecoder>"u"))return To??(To=new globalThis.TextDecoder("utf-8"))}function Ym(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let n=xx();return n?n.decode(e):Ax(e)}case"utf-16le":return Sx(e);case"us-ascii":case"ascii":return Cx(e);case"latin1":case"iso-8859-1":return vx(e);case"windows-1252":return kx(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ec(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function yt(e,t,n){t.push(n),t.length>=Ns&&Ec(e,t)}function Ex(e,t,n){if(n<=65535){yt(e,t,n);return}n-=65536,yt(e,t,55296+(n>>10)),yt(e,t,56320+(n&1023))}function Ax(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let s=e[r];if(s<=127){yt(t,n,s),r++;continue}if(s<194||s>244){yt(t,n,Nn),r++;continue}if(s<=223){if(r+1>=e.length){yt(t,n,Nn),r++;continue}let u=e[r+1];if((u&192)!==128){yt(t,n,Nn),r++;continue}let f=(s&31)<<6|u&63;yt(t,n,f),r+=2;continue}if(s<=239){if(r+2>=e.length){yt(t,n,Nn),r++;continue}let u=e[r+1],f=e[r+2];if(!((u&192)===128&&(f&192)===128&&!(s===224&&u<160)&&!(s===237&&u>=160))){yt(t,n,Nn),r++;continue}let h=(s&15)<<12|(u&63)<<6|f&63;yt(t,n,h),r+=3;continue}if(r+3>=e.length){yt(t,n,Nn),r++;continue}let i=e[r+1],o=e[r+2],a=e[r+3];if(!((i&192)===128&&(o&192)===128&&(a&192)===128&&!(s===240&&i<144)&&!(s===244&&i>143))){yt(t,n,Nn),r++;continue}let c=(s&7)<<18|(i&63)<<12|(o&63)<<6|a&63;Ex(t,n,c),r+=4}return Ec(t,n),t.join("")}function Sx(e){let t=[],n=[],r=e.length,s=0;for(;s+1<r;){let i=e[s]|e[s+1]<<8;if(s+=2,i>=55296&&i<=56319){if(s+1<r){let o=e[s]|e[s+1]<<8;o>=56320&&o<=57343?(yt(t,n,i),yt(t,n,o),s+=2):yt(t,n,Nn)}else yt(t,n,Nn);continue}if(i>=56320&&i<=57343){yt(t,n,Nn);continue}yt(t,n,i)}return s<r&&yt(t,n,Nn),Ec(t,n),t.join("")}function Cx(e){let t=[];for(let n=0;n<e.length;n+=Ns){let r=Math.min(e.length,n+Ns),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i]&127;t.push(String.fromCharCode.apply(null,s))}return t.join("")}function vx(e){let t=[];for(let n=0;n<e.length;n+=Ns){let r=Math.min(e.length,n+Ns),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i];t.push(String.fromCharCode.apply(null,s))}return t.join("")}function kx(e){let t=[],n="";for(let r=0;r<e.length;r++){let s=e[r],i=s>=128&&s<=159?Xm[s]:void 0;n+=i??String.fromCharCode(s),n.length>=Ns&&(t.push(n),n="")}return n&&t.push(n),t.join("")}var Xm,bx,To,Ns,Nn,Jm=I(()=>{Xm={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},bx={};for(let[e,t]of Object.entries(Xm))bx[t]=Number.parseInt(e,10);Ns=32*1024,Nn=65533});function Vt(e){return new DataView(e.buffer,e.byteOffset)}var e0,t0,it,Br,rt,Ac,n0,r0,qt,wi=I(()=>{e0=zf(Qm(),1);Jm();t0={len:1,get(e,t){return Vt(e).getUint8(t)},put(e,t,n){return Vt(e).setUint8(t,n),t+1}},it={len:2,get(e,t){return Vt(e).getUint16(t,!0)},put(e,t,n){return Vt(e).setUint16(t,n,!0),t+2}},Br={len:2,get(e,t){return Vt(e).getUint16(t)},put(e,t,n){return Vt(e).setUint16(t,n),t+2}},rt={len:4,get(e,t){return Vt(e).getUint32(t,!0)},put(e,t,n){return Vt(e).setUint32(t,n,!0),t+4}},Ac={len:4,get(e,t){return Vt(e).getUint32(t)},put(e,t,n){return Vt(e).setUint32(t,n),t+4}},n0={len:4,get(e,t){return Vt(e).getInt32(t)},put(e,t,n){return Vt(e).setInt32(t,n),t+4}},r0={len:8,get(e,t){return Vt(e).getBigUint64(t,!0)},put(e,t,n){return Vt(e).setBigUint64(t,n,!0),t+8}},qt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Ym(r,this.encoding)}}});var Ix,Be,Wr,bi=I(()=>{Ix="End-Of-Stream",Be=class extends Error{constructor(){super(Ix),this.name="EndOfStreamError"}},Wr=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var s0=I(()=>{});var zr,Oo=I(()=>{bi();zr=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,n=!1){let r=await this.read(t,n);return this.peekQueue.push(t.subarray(0,r)),r}async read(t,n=!1){if(t.length===0)return 0;let r=this.readFromPeekBuffer(t);if(this.endOfStream||(r+=await this.readRemainderFromStream(t.subarray(r),n)),r===0&&!n)throw new Be;return r}readFromPeekBuffer(t){let n=t.length,r=0;for(;this.peekQueue.length>0&&n>0;){let s=this.peekQueue.pop();if(!s)throw new Error("peekData should be defined");let i=Math.min(s.length,n);t.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(t,n){let r=0;for(;r<t.length&&!this.endOfStream;){if(this.interrupted)throw new Wr;let s=await this.readFromStream(t.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<t.length)throw new Be;return r}}});var i0=I(()=>{bi();s0();Oo()});var Ro,o0=I(()=>{Oo();Ro=class extends zr{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var xi,Sc=I(()=>{o0();xi=class extends Ro{async readFromStream(t,n){if(t.length===0)return 0;let r=await this.reader.read(new Uint8Array(t.length),{min:n?void 0:t.length});return r.done&&(this.endOfStream=r.done),r.value?(t.set(r.value),r.value.length):0}}});var Is,Cc=I(()=>{bi();Oo();Is=class extends zr{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,n){let r=Math.min(n.length,t.length);return t.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(t,n){if(t.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(t,this.buffer));r<t.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(t.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new Be;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function vc(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Is(t):new xi(t)}catch(t){if(t instanceof TypeError)return new Is(e.getReader());throw t}}var a0=I(()=>{Sc();Cc()});var Hr=I(()=>{bi();i0();Sc();Cc();a0()});var nr,Ei=I(()=>{Hr();nr=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.readBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async peekToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.peekBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(t>n)return this.position+=n,n}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,n){if(!this.supportsRandomAccess()&&n&&n.position!==void 0&&n.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var Tx,Po,l0=I(()=>{Ei();Hr();Tx=256e3,Po=class extends nr{constructor(t,n){super(n),this.streamReader=t,this.fileInfo=n?.fileInfo??{}}async readBuffer(t,n){let r=this.normalizeOptions(t,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(t,n);if(s<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(t.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new Be;return i}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),t.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(t.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof Be)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new Be}return s}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let n=Math.min(Tx,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Do,c0=I(()=>{Hr();Ei();Do=class extends nr{constructor(t,n){super(n),this.uint8Array=t,this.fileInfo={...n?.fileInfo??{},size:t.length}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;return t.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var _o,u0=I(()=>{Hr();Ei();_o=class extends nr{constructor(t,n){super(n),this.blob=t,this.fileInfo={...n?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return t.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function f0(e,t){let n=vc(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Po(n,r)}function p0(e,t){return new Do(e,t)}function h0(e,t){return new _o(e,t)}var d0=I(()=>{Hr();l0();c0();u0();Hr();Ei()});var g0=Ui((CP,m0)=>{var $s=1e3,Ts=$s*60,Os=Ts*60,jr=Os*24,Rx=jr*7,Px=jr*365.25;m0.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Dx(e);if(n==="number"&&isFinite(e))return t.long?Fx(e):_x(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Dx(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Px;case"weeks":case"week":case"w":return n*Rx;case"days":case"day":case"d":return n*jr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Os;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ts;case"seconds":case"second":case"secs":case"sec":case"s":return n*$s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function _x(e){var t=Math.abs(e);return t>=jr?Math.round(e/jr)+"d":t>=Os?Math.round(e/Os)+"h":t>=Ts?Math.round(e/Ts)+"m":t>=$s?Math.round(e/$s)+"s":e+"ms"}function Fx(e){var t=Math.abs(e);return t>=jr?Fo(e,t,jr,"day"):t>=Os?Fo(e,t,Os,"hour"):t>=Ts?Fo(e,t,Ts,"minute"):t>=$s?Fo(e,t,$s,"second"):e+" ms"}function Fo(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var w0=Ui((vP,y0)=>{function Lx(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=g0(),n.destroy=c,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let p=0;p<u.length;p++)f=(f<<5)-f+u.charCodeAt(p),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,p=null,h,d;function m(...g){if(!m.enabled)return;let y=m,w=Number(new Date),b=w-(f||w);y.diff=b,y.prev=f,y.curr=w,f=w,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(C,$)=>{if(C==="%%")return"%";x++;let D=n.formatters[$];if(typeof D=="function"){let v=g[x];C=D.call(y,v),g.splice(x,1),x--}return C}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,d=n.enabled(u)),d),set:g=>{p=g}}),typeof n.init=="function"&&n.init(m),m}function r(u,f){let p=n(this.namespace+(typeof f>"u"?":":f)+u);return p.log=this.log,p}function s(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of f)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function i(u,f){let p=0,h=0,d=-1,m=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(d=h,m=p,h++):(p++,h++);else if(d!==-1)h=d+1,m++,p=m;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}y0.exports=Lx});var b0=Ui((Zt,Lo)=>{Zt.formatArgs=Ux;Zt.save=Bx;Zt.load=Wx;Zt.useColors=Mx;Zt.storage=zx();Zt.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Zt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Mx(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ux(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Lo.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),e.splice(r,0,t)}Zt.log=console.debug||console.log||(()=>{});function Bx(e){try{e?Zt.storage.setItem("debug",e):Zt.storage.removeItem("debug")}catch{}}function Wx(){let e;try{e=Zt.storage.getItem("debug")||Zt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function zx(){try{return localStorage}catch{}}Lo.exports=w0()(Zt);var{formatters:Hx}=Lo.exports;Hx.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Gr,kc,x0,E0,A0,S0=I(()=>{wi();Gr={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},kc={get(e){return{signature:rt.get(e,0),compressedSize:rt.get(e,8),uncompressedSize:rt.get(e,12)}},len:16},x0={get(e){let t=it.get(e,6);return{signature:rt.get(e,0),minVersion:it.get(e,4),dataDescriptor:!!(t&8),compressedMethod:it.get(e,8),compressedSize:rt.get(e,18),uncompressedSize:rt.get(e,22),filenameLength:it.get(e,26),extraFieldLength:it.get(e,28),filename:null}},len:30},E0={get(e){return{signature:rt.get(e,0),nrOfThisDisk:it.get(e,4),nrOfThisDiskWithTheStart:it.get(e,6),nrOfEntriesOnThisDisk:it.get(e,8),nrOfEntriesOfSize:it.get(e,10),sizeOfCd:rt.get(e,12),offsetOfStartOfCd:rt.get(e,16),zipFileCommentLength:it.get(e,20)}},len:22},A0={get(e){let t=it.get(e,8);return{signature:rt.get(e,0),minVersion:it.get(e,6),dataDescriptor:!!(t&8),compressedMethod:it.get(e,10),compressedSize:rt.get(e,20),uncompressedSize:rt.get(e,24),filenameLength:it.get(e,28),extraFieldLength:it.get(e,30),fileCommentLength:it.get(e,32),relativeOffsetOfLocalHeader:rt.get(e,42),filename:null}},len:46}});function v0(e){let t=new Uint8Array(rt.len);return rt.put(t,0,e),t}function Gx(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let o=0;o<r;o++)if(e[s+o]!==t[o]){i=!1;break}if(i)return s}return-1}function Vx(e){let t=e.reduce((s,i)=>s+i.length,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}var C0,Hn,Nc,jx,Mo,Vr,k0=I(()=>{wi();C0=zf(b0(),1);S0();Hn=(0,C0.default)("tokenizer:inflate"),Nc=256*1024,jx=v0(Gr.DataDescriptor),Mo=v0(Gr.EndOfCentralDirectory),Vr=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Nc)}async isZip(){return await this.peekSignature()===Gr.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(rt)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,n=Math.min(16*1024,t.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:t.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===Mo[0]&&r[s+1]===Mo[1]&&r[s+2]===Mo[2]&&r[s+3]===Mo[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Hn("Cannot reading central-directory without random-read support");return}Hn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){Hn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(E0,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(A0);if(o.signature!==Gr.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new qt(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),Hn(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(t),s}this.tokenizer.setPosition(t)}async unzip(t){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,t);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=t(s);r=!!i.stop;let o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Nc;Hn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Nc;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Gx(this.syncBuffer.subarray(0,l),jx);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}Hn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,Vx(a),i.handler)}else i.handler?(Hn(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(Hn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(Hn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(kc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-kc.len}`)}while(!r)}async iterateOverCentralDirectory(t,n){for(let r of t){let s=n(r);if(s.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let i=await this.readLocalFileHeader();if(i){await this.tokenizer.ignore(i.extraFieldLength);let o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,s.handler)}}if(s.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);Hn(`Decompress filename=${t.filename}, compressed-size=${n.length}`);let s=await e.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(t){let n=new ReadableStream({start(i){i.enqueue(t),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(rt);if(t===Gr.LocalFileHeader){let n=await this.tokenizer.readToken(x0);return n.filename=await this.tokenizer.readToken(new qt(n.filenameLength,"utf-8")),n}if(t===Gr.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var Ai,N0=I(()=>{Ai=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await t.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var I0=I(()=>{k0();N0()});function Ic(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}var _P,FP,LP,$0=I(()=>{_P={utf8:new globalThis.TextDecoder("utf8")},FP=new globalThis.TextEncoder,LP=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function T0(e,t){if(t==="utf-16le"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(t==="utf-16be"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...e].map(n=>n.charCodeAt(0))}function O0(e,t=0){let n=Number.parseInt(new qt(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=t;s<t+148;s++)r+=e[s];for(let s=t+156;s<t+512;s++)r+=e[s];return n===r}var R0,P0=I(()=>{wi();R0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var D0,_0,F0=I(()=>{D0=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],_0=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]});function oE(e){let t=e?.streamReader;if(t?.constructor?.name!=="WebStreamByobReader")return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function Rc(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new rr(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function hr(e,t,{maximumLength:n=wn,reason:r="skip"}={}){let s=Rc(t,n,r);await e.ignore(s)}async function Tc(e,t,n,{maximumLength:r=t.length,reason:s="read"}={}){let i=n?.length??t.length,o=Rc(i,r,s);return e.readBuffer(t,{...n,length:o})}async function aE(e,{maximumLength:t=Gn}={}){let s=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),i=[],o=0;try{for(;;){let{done:c,value:u}=await s.read();if(c)break;if(o+=u.length,o>t)throw await s.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);i.push(u)}}finally{s.releaseLock()}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return a}function cE(e,t){if(e.length<Uo)return-1;let n=e.length-Uo;for(let r=0;r<=n;r++)if(rt.get(e,r)===K0&&rt.get(e,r+8)===t+r)return r;return-1}function uE(e){return(e.codePointAt(0)&32)!==0}function fE(e,t){let n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}async function pE(e,{shouldBuffer:t,maximumLength:n=Gn}={}){let{syncBuffer:r}=e,{length:s}=r,i=[],o=0;for(;;){let a=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),l=cE(r.subarray(0,a),o),c=l>=0?0:a===s?Math.min(lE,a-1):0,u=l>=0?l:a-c;if(u===0)break;if(o+=u,o>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let f=new Uint8Array(u);await e.tokenizer.readBuffer(f),i.push(f)}else await e.tokenizer.ignore(u);if(l>=0)break}if(Ut(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),!!t)return fE(i,o)}function hE(e,t){return Ut(e.tokenizer)?Math.max(0,wn-(e.tokenizer.position-t)):Math.max(0,Gn-e.knownSizeDescriptorScannedBytes)}async function dE(e,t,{shouldBuffer:n,maximumDescriptorLength:r=Gn}={}){if(t.dataDescriptor&&t.compressedSize===0)return pE(e,{shouldBuffer:n,maximumLength:r});if(!n){await hr(e.tokenizer,t.compressedSize,{maximumLength:Ut(e.tokenizer)?Gn:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let s=xE(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>s)throw new Error(`ZIP entry compressed data exceeds ${s} bytes`);let i=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(i),i}function mE(e,t){let n=e.getReader(),r=0,s=!1,i=!1,o=async a=>{s||i||(i=!0,await n.cancel(a))};return new ReadableStream({async pull(a){if(r>=t){a.close(),await o();return}let{done:l,value:c}=await n.read();if(l||!c){s=!0,a.close();return}let u=t-r;if(c.length>u){a.enqueue(c.subarray(0,u)),r+=u,a.close(),await o();return}a.enqueue(c),r+=c.length},async cancel(a){await o(a)}})}async function Q0(e,t){return new Oc(t).fromBuffer(e)}function V0(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function jn(e,t,n){n={offset:0,...n};for(let[r,s]of t.entries())if(n.mask){if(s!==(n.mask[r]&e[r+n.offset]))return!1}else if(s!==e[r+n.offset])return!1;return!0}function gE(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Si}function yE(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,s)=>{let i=()=>{n.removeEventListener("abort",o)},o=()=>{let a=n.reason;i(),(async()=>{try{await e.cancel(a)}catch{}})(),s(a)};n.addEventListener("abort",o,{once:!0}),(async()=>{try{let a=await e.read(t);i(),r(a)}catch(a){i(),s(a)}})()}))}function wE(e){return Number.isFinite(e)?Math.max(0,Math.min(qx,Math.trunc(e))):0}function bE(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function Ut(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Ci(e,t,n){return Ut(e)&&e.position-t>n}function xE(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(n,Zx)}function EE(e){if(e instanceof Be||e instanceof rr)return!0;if(!(e instanceof Error))return!1;if(rE.has(e.message)||iE.has(e.code))return!0;for(let t of sE)if(e.message.startsWith(t))return!0;return!1}function q0(e,t=Gn){let n=[e.compressedSize,e.uncompressedSize];for(let r of n)if(!Number.isFinite(r)||r<0||r>t)return!1;return!0}function AE(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function SE(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Z0(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function CE(e){let t=e.indexOf('.main+xml"');if(t===-1){let s="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${s}"`)?s:void 0}let n=e.slice(0,t),r=n.lastIndexOf('"');return n.slice(r+1)}var Si,qx,Gn,L0,Zx,wn,Bo,M0,Kx,Qx,U0,$c,B0,W0,Xx,Yx,Jx,eE,tE,z0,H0,j0,nE,G0,rE,sE,iE,rr,K0,Uo,lE,Oc,VP,qP,X0=I(()=>{wi();d0();I0();$0();P0();F0();Si=4100,qx=Si-2,Gn=1024*1024,L0=1024,Zx=2**31-1,wn=16*1024*1024,Bo=Gn,M0=Gn,Kx=wn,Qx=1,U0=100,$c=wn,B0=64,W0=Bo,Xx=256,Yx=512,Jx=wn,eE=512,tE=512,z0=256,H0=Bo,j0=Bo,nE=Bo,G0=wn,rE=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),sE=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],iE=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),rr=class extends Error{};K0=134695760,Uo=16,lE=Uo-1;Vr.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);let r=await aE(t,{maximumLength:Gn});return n(r)};Vr.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Ci(this.tokenizer,r,wn))throw new rr(`ZIP stream probing exceeds ${wn} bytes`);let s=await this.readLocalFileHeader();if(!s)break;if(n++,n>L0)throw new Error(`ZIP entry count exceeds ${L0}`);let i=e(s);t=!!i.stop,await this.tokenizer.ignore(s.extraFieldLength);let o=await dE(this,s,{shouldBuffer:!!i.handler,maximumDescriptorLength:Math.min(Gn,hE(this,r))});if(i.handler&&await this.inflate(s,o,i.handler),s.dataDescriptor){let a=new Uint8Array(Uo);if(await this.tokenizer.readBuffer(a),rt.get(a,0)!==K0)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(Ci(this.tokenizer,r,wn))throw new rr(`ZIP stream probing exceeds ${wn} bytes`)}while(!t)};Oc=class e{constructor(t){let n=wE(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:n},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return oE(f0(t,this.getTokenizerOptions()))}async parseTokenizer(t,n=0){this.detectionReentryCount=n;let r=t.position;for(let s of this.detectors){let i;try{i=await s.detect(t)}catch(o){if(o instanceof Be||o instanceof rr)return;throw o}if(i)return i;if(r!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let n=t instanceof Uint8Array?t:new Uint8Array(t);if(n?.length>1)return this.fromTokenizer(p0(n,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let n=h0(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){this.options.signal?.throwIfAborted();let n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,n){let r=gE(n?.sampleSize??Si),s,i,o=t.getReader({mode:"byob"});try{let{value:c,done:u}=await yE(o,new Uint8Array(r),this.options.signal);if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof Be))throw f;s=void 0}i=c}finally{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(a);return l.fileType=s,l}async detectGzip(t){if(this.gzipProbeDepth>=Qx)return{ext:"gz",mime:"application/gzip"};let n=new Ai(t),r=mE(n.inflate(),Kx),s=Ut(t),i,o,a,l;if(s){let c=new AbortController;i=setTimeout(()=>{c.abort(new DOMException(`Operation timed out after ${U0} ms`,"TimeoutError"))},U0),o=this.options.signal===void 0?c.signal:AbortSignal.any([this.options.signal,c.signal]),a=new e({...this.options,signal:o}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{l=await(a??this).fromStream(r)}catch(c){if(c?.name==="AbortError"&&o?.reason?.name!=="TimeoutError")throw c}finally{clearTimeout(i),s||this.gzipProbeDepth--}return l?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,n){return jn(this.buffer,t,n)}checkString(t,n){return this.check(T0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(Si),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ut(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=z0?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await hr(t,6,{maximumLength:6,reason:"ID3 header prefix"});let n=await t.readToken(R0),r=Ut(t);if(!Number.isFinite(n)||n<0||r&&(n>$c||t.position+n>$c))return;if(t.position+n>t.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await hr(t,n,{maximumLength:r?$c:t.fileInfo.size,reason:"ID3 payload"})}catch(s){if(s instanceof Be)return;throw s}return this.detectionReentryCount>=z0?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let n,r=AE();try{await new Vr(t).unzip(s=>{SE(r,s.filename);let i=s.filename==="[Content_Types].xml",o=Z0(r);if(!i&&o)return n=o,{stop:!0};switch(s.filename){case"META-INF/mozilla.rsa":return n={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return n={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return q0(s,M0)?{async handler(a){let l=new TextDecoder("utf-8").decode(a).trim();n=V0(l)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,q0(s,M0)?(r.isParsingContentTypes=!0,{async handler(a){let l=new TextDecoder("utf-8").decode(a),c=CE(l);c&&(n=V0(c)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(s.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!EE(s))throw s;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return n??Z0(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),jn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:jn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:jn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:jn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:jn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:jn(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let n=await this.readTiffHeader(!1);if(n)return n}if(this.check([77,77])){let n=await this.readTiffHeader(!0);if(n)return n}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function n(){let l=await t.peekNumber(t0),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let f=new Uint8Array(u+1);return await Tc(t,f,void 0,{maximumLength:f.length,reason:"EBML field"}),f}async function r(){let l=await n(),c=await n();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),f=new DataView(l.buffer),p=new DataView(c.buffer,c.length-u,u);return{id:Ic(f),len:Ic(p)}}async function s(l){let c=0;for(;l>0;){if(c++,c>Xx||Ci(t,o,wn))return;let u=t.position,f=await r();if(f.id===17026){if(f.len>B0)return;let p=Rc(f.len,B0,"EBML DocType");return(await t.readToken(new qt(p))).replaceAll(/\00.*$/g,"")}if(Ut(t)&&(!Number.isFinite(f.len)||f.len<0||f.len>W0)||(await hr(t,f.len,{maximumLength:Ut(t)?W0:t.fileInfo.size,reason:"EBML payload"}),--l,t.position<=u))return}}let i=await r(),o=t.position;switch(await s(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let n=Ac.get(this.buffer,4),r=Br.get(this.buffer,6);if(n>0&&n<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let n=new qt(4,"latin1").get(this.buffer,2);if(n.match("^d*")&&n>=1e3&&n<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new qt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
630
|
+
`,"\r"," "," ","\0"].some(n=>this.checkString(n,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let n={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await t.ignore(8);async function s(){return{length:await t.readToken(n0),type:await t.readToken(new qt(4,"latin1"))}}let i=Ut(t),o=t.position,a=0,l=!1;do{if(a++,a>Yx||Ci(t,o,Jx))break;let c=t.position,u=await s();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return n;case"acTL":return r;default:if(!l&&u.type!=="CgBI")return;if(i&&u.length>H0)return l&&uE(u.type)?n:void 0;try{await hr(t,u.length+4,{maximumLength:i?H0+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!i&&(f instanceof rr||f instanceof Be))return n;throw f}}if(t.position<=c)break}while(t.position+8<t.fileInfo.size);return n}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let n=new qt(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(n){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return n.startsWith("3g")?n.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
631
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let n=!1;try{async function r(){let a=new Uint8Array(16);return await Tc(t,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await t.readToken(r0))}}await hr(t,30,{maximumLength:30,reason:"ASF header prelude"});let s=Ut(t),i=t.position,o=0;for(;t.position+24<t.fileInfo.size&&(o++,!(o>eE||Ci(t,i,wn)));){let a=t.position,l=await r(),c=l.size-24;if(!Number.isFinite(c)||c<0){n=!0;break}if(jn(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await Tc(t,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),jn(u,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(jn(u,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(s&&c>j0){n=!0;break}if(await hr(t,c,{maximumLength:s?j0:t.fileInfo.size,reason:"ASF header payload"}),t.position<=a){n=!0;break}}}catch(r){if(r instanceof Be||r instanceof rr)Ut(t)&&(n=!0);else throw r}return n?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new qt(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let n=new DataView(this.buffer.buffer).getUint32(12,!0);if(n>12&&this.buffer.length>=n+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,n+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&O0(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let n="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:n})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:n})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
632
|
+
`,{offset:2,encoding:n})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async t=>{this.buffer=new Uint8Array(Si);let n=bE(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,n),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,n),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let s=this.scanMpeg(r);if(s)return s}};async readTiffTag(t){let n=await this.tokenizer.readToken(t?Br:it);switch(await this.tokenizer.ignore(10),n){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let n=await this.tokenizer.readToken(t?Br:it);if(!(n>tE)&&!(Ut(this.tokenizer)&&2+n*12>G0))for(let r=0;r<n;++r){let s=await this.readTiffTag(t);if(s)return s}}async readTiffHeader(t){let n={ext:"tif",mime:"image/tiff"},r=(t?Br:it).get(this.buffer,2),s=(t?Ac:rt).get(this.buffer,4);if(r===42){if(s>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(s>=8){let a=(t?Br:it).get(this.buffer,8),l=(t?Br:it).get(this.buffer,10);if(a===28&&l===254||a===31&&l===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ut(this.tokenizer)&&s>nE)return n;let i=Ut(this.tokenizer)?G0:this.tokenizer.fileInfo.size;try{await hr(this.tokenizer,s,{maximumLength:i,reason:"TIFF IFD offset"})}catch(a){if(a instanceof Be)return;throw a}let o;try{o=await this.readTiffIFD(t)}catch(a){if(a instanceof Be)return;throw a}return o??n}if(r===43)return n}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},VP=new Set(D0),qP=new Set(_0)});var Y0={};ee(Y0,{fileCommand:()=>RE,flagsForFuzzing:()=>PE});function IE(e,t){let n=NE.get(e);if(n)return n;let[r,s]=t.split("/"),i=s?.split("+")[0]?.replace(/-/g," ")||e;switch(r){case"image":return`${i.toUpperCase()} image data`;case"audio":return`${i.toUpperCase()} audio`;case"video":return`${i.toUpperCase()} video`;case"font":return`${i} font`;case"model":return`${i} 3D model`;case"application":return s?.includes("zip")||s?.includes("compressed")?`${i} archive data`:s?.includes("executable")?`${i} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function $E(e){let t=e.split("/").pop()||e;if(t.startsWith(".")&&!t.includes(".",1))return t;let n=t.lastIndexOf(".");return n===-1||n===0?"":t.slice(n).toLowerCase()}function TE(e,t){if(e.startsWith("#!")){let c=e.split(`
|
|
633
|
+
`)[0];return c.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:c.includes("node")||c.includes("bun")||c.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:c.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:c.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let n=e.trimStart();if(n.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(n.startsWith("<!DOCTYPE html")||n.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=e.includes(`\r
|
|
634
|
+
`),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let o=$E(t),a=o?kE.get(o):void 0;if(a)return a.mime.startsWith("text/")&&i?{description:`${a.description}${i}`,mime:a.mime}:a;let l=!1;for(let c=0;c<Math.min(e.length,8192);c++)if(e.charCodeAt(c)>127){l=!0;break}return l?{description:`UTF-8 Unicode text${i}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${i}`,mime:"text/plain"}}async function OE(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await Q0(t);if(n)return{description:IE(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return TE(r,e)}var vE,kE,NE,RE,PE,J0=I(()=>{"use strict";X0();ae();vE={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},kE=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),NE=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]);RE={name:"file",async execute(e,t){if(W(e))return B(vE);let n=!1,r=!1,s=[];for(let a of e)if(a.startsWith("--")){if(a==="--brief")n=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return Q("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let l of a.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return Q("file",`-${l}`)}else s.push(a);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
|
|
635
|
+
`,exitCode:1};let i="",o=0;for(let a of s)try{let l=t.fs.resolvePath(t.cwd,a);if((await t.fs.stat(l)).isDirectory){let h=r?"inode/directory":"directory";i+=n?`${h}
|
|
636
|
+
`:`${a}: ${h}
|
|
637
|
+
`;continue}let u=await t.fs.readFileBuffer(l),f=await OE(a,u),p=r?f.mime:f.description;i+=n?`${p}
|
|
638
|
+
`:`${a}: ${p}
|
|
639
|
+
`}catch{i+=n?`cannot open
|
|
640
|
+
`:`${a}: cannot open (No such file or directory)
|
|
641
|
+
`,o=1}return{stdout:i,stderr:"",exitCode:o}}},PE={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var e2={};ee(e2,{flagsForFuzzing:()=>LE,htmlToMarkdownCommand:()=>FE});import DE from"turndown";var _E,FE,LE,t2=I(()=>{"use strict";ye();ae();_E={name:"html-to-markdown",summary:"convert HTML to Markdown (BashEnv extension)",usage:"html-to-markdown [OPTION]... [FILE]",description:["Convert HTML content to Markdown format using the turndown library.","This is a non-standard BashEnv extension command, not available in regular bash.","","Read HTML from FILE or standard input and output Markdown to standard output.","Commonly used with curl to convert web pages:"," curl -s https://example.com | html-to-markdown","","Supported HTML elements:"," - Headings (h1-h6) \u2192 # Markdown headings"," - Paragraphs (p) \u2192 Plain text with blank lines"," - Links (a) \u2192 [text](url)"," - Images (img) \u2192 "," - Bold/Strong \u2192 **text**"," - Italic/Em \u2192 _text_"," - Code (code, pre) \u2192 `inline` or fenced blocks"," - Lists (ul, ol, li) \u2192 - or 1. items"," - Blockquotes \u2192 > quoted text"," - Horizontal rules (hr) \u2192 ---"],options:["-b, --bullet=CHAR bullet character for unordered lists (-, +, or *)","-c, --code=FENCE fence style for code blocks (``` or ~~~)","-r, --hr=STRING string for horizontal rules (default: ---)"," --heading-style=STYLE"," heading style: 'atx' for # headings (default),"," 'setext' for underlined headings (h1/h2 only)"," --help display this help and exit"],examples:["echo '<h1>Hello</h1><p>World</p>' | html-to-markdown","html-to-markdown page.html","curl -s https://example.com | html-to-markdown > page.md"]},FE={name:"html-to-markdown",async execute(e,t){if(W(e))return B(_E);let n="-",r="```",s="---",i="atx",o=[];for(let l=0;l<e.length;l++){let c=e[l];if(c==="-b"||c==="--bullet")n=e[++l]??"-";else if(c.startsWith("--bullet="))n=c.slice(9);else if(c==="-c"||c==="--code")r=e[++l]??"```";else if(c.startsWith("--code="))r=c.slice(7);else if(c==="-r"||c==="--hr")s=e[++l]??"---";else if(c.startsWith("--hr="))s=c.slice(5);else if(c.startsWith("--heading-style=")){let u=c.slice(16);(u==="setext"||u==="atx")&&(i=u)}else if(c==="-")o.push("-");else{if(c.startsWith("--"))return Q("html-to-markdown",c);if(c.startsWith("-"))return Q("html-to-markdown",c);o.push(c)}}let a;if(o.length===0||o.length===1&&o[0]==="-")a=le(t.stdin);else try{let l=t.fs.resolvePath(t.cwd,o[0]);a=await t.fs.readFile(l)}catch{return{stdout:"",stderr:`html-to-markdown: ${o[0]}: No such file or directory
|
|
642
|
+
`,exitCode:1}}if(!a.trim())return{stdout:"",stderr:"",exitCode:0};try{let l=new DE({bulletListMarker:n,codeBlockStyle:"fenced",fence:r,hr:s,headingStyle:i});return l.remove(["script","style","footer"]),{stdout:`${l.turndown(a).trim()}
|
|
643
|
+
`,stderr:"",exitCode:0}}catch(l){return{stdout:"",stderr:`html-to-markdown: conversion error: ${l.message}
|
|
644
|
+
`,exitCode:1}}}},LE={name:"html-to-markdown",flags:[],stdinType:"text"}});var n2={};ee(n2,{flagsForFuzzing:()=>WE,helpCommand:()=>BE});function UE(e){let t=[],n=new Set(e);t.push(`Available commands:
|
|
645
|
+
`);let r=[];for(let[s,i]of ME){let o=i.filter(a=>n.has(a));if(o.length>0){t.push(` ${s}:`),t.push(` ${o.join(", ")}
|
|
646
|
+
`);for(let a of o)n.delete(a)}}for(let s of n)r.push(s);return r.length>0&&(t.push(" Other:"),t.push(` ${r.sort().join(", ")}
|
|
647
|
+
`)),t.push("Use '<command> --help' for details on a specific command."),`${t.join(`
|
|
648
|
+
`)}
|
|
649
|
+
`}var ME,BE,WE,r2=I(()=>{"use strict";Dr();ME=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]);BE={name:"help",async execute(e,t){if(e.includes("--help")||e.includes("-h"))return{stdout:`help - display available commands
|
|
650
|
+
|
|
651
|
+
Usage: help [command]
|
|
652
|
+
|
|
653
|
+
Options:
|
|
654
|
+
-h, --help Show this help message
|
|
655
|
+
|
|
656
|
+
If a command name is provided, shows help for that command.
|
|
657
|
+
Otherwise, lists all available commands.
|
|
658
|
+
`,stderr:"",exitCode:0};if(e.length>0&&t.exec){let r=e[0];return t.exec(rn([r]),{cwd:t.cwd,signal:t.signal,args:["--help"]})}let n=t.getRegisteredCommands?.()??[];return{stdout:UE(n),stderr:"",exitCode:0}}},WE={name:"help",flags:[]}});var s2={};ee(s2,{flagsForFuzzing:()=>GE,whichCommand:()=>jE});var zE,HE,jE,GE,i2=I(()=>{"use strict";ct();ae();zE={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},HE={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},jE={name:"which",async execute(e,t){if(W(e))return B(zE);let n=Ee("which",e,HE);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.silent,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:"",exitCode:1};let a=(t.env.get("PATH")||"/usr/bin:/bin").split(":"),l="",c=!0;for(let u of i){let f=!1;for(let p of a){if(!p)continue;let h=t.fs.resolvePath(p,u);if(await t.fs.exists(h)&&(f=!0,s||(l+=`${h}
|
|
659
|
+
`),!r))break}f||(c=!1)}return{stdout:l,stderr:"",exitCode:c?0:1}}},GE={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0}});var o2={};ee(o2,{flagsForFuzzing:()=>ZE,tac:()=>qE});async function VE(e,t){if(e.length>0&&e[0]!=="-"){let s=t.fs.resolvePath(t.cwd,e[0]);try{let o=(await t.fs.readFile(s)).split(`
|
|
660
|
+
`);o[o.length-1]===""&&o.pop();let a=o.reverse();return{stdout:a.length>0?`${a.join(`
|
|
661
|
+
`)}
|
|
662
|
+
`:"",stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`tac: ${e[0]}: No such file or directory
|
|
663
|
+
`,exitCode:1}}}let n=t.stdin.split(`
|
|
664
|
+
`);n[n.length-1]===""&&n.pop();let r=n.reverse();return{stdout:r.length>0?`${r.join(`
|
|
665
|
+
`)}
|
|
666
|
+
`:"",stderr:"",exitCode:0}}var qE,ZE,a2=I(()=>{"use strict";ye();qE={name:"tac",execute:VE},ZE={name:"tac",flags:[],stdinType:"text",needsFiles:!0}});var l2={};ee(l2,{flagsForFuzzing:()=>XE,hostname:()=>QE});async function KE(e,t){return{stdout:`localhost
|
|
667
|
+
`,stderr:"",exitCode:0}}var QE,XE,c2=I(()=>{"use strict";QE={name:"hostname",execute:KE},XE={name:"hostname",flags:[]}});var u2={};ee(u2,{flagsForFuzzing:()=>eA,whoami:()=>JE});async function YE(e,t){return{stdout:`user
|
|
668
|
+
`,stderr:"",exitCode:0}}var JE,eA,f2=I(()=>{"use strict";JE={name:"whoami",execute:YE},eA={name:"whoami",flags:[]}});var p2={};ee(p2,{flagsForFuzzing:()=>rA,od:()=>nA});async function tA(e,t){let n="octal",r=[],s=[];for(let h=0;h<e.length;h++){let d=e[h];if(d==="-c")r.push("char");else if(d==="-An"||d==="-A"&&e[h+1]==="n")n="none",d==="-A"&&h++;else if(d==="-t"&&e[h+1]){let m=e[++h];m==="x1"?r.push("hex"):m==="c"?r.push("char"):m.startsWith("o")&&r.push("octal")}else(!d.startsWith("-")||d==="-")&&s.push(d)}r.length===0&&r.push("octal");let i=t.stdin;if(s.length>0&&s[0]!=="-"){let h=s[0].startsWith("/")?s[0]:`${t.cwd}/${s[0]}`;try{i=await fn(t.fs,h)}catch{return{stdout:"",stderr:`od: ${s[0]}: No such file or directory
|
|
669
|
+
`,exitCode:1}}}let o=r.includes("char");function a(h){return h===0?" \\0":h===7?" \\a":h===8?" \\b":h===9?" \\t":h===10?" \\n":h===11?" \\v":h===12?" \\f":h===13?" \\r":h>=32&&h<127?` ${String.fromCharCode(h)}`:` ${h.toString(8).padStart(3,"0")}`}function l(h){return o?` ${h.toString(16).padStart(2,"0")}`:` ${h.toString(16).padStart(2,"0")}`}function c(h){return` ${h.toString(8).padStart(3,"0")}`}let u=[];for(let h of i)u.push(h.charCodeAt(0));let f=16,p=[];for(let h=0;h<u.length;h+=f){let d=u.slice(h,h+f);for(let m=0;m<r.length;m++){let g=r[m],y;g==="char"?y=d.map(a):g==="hex"?y=d.map(l):y=d.map(c);let w="";m===0&&n!=="none"?w=`${h.toString(8).padStart(7,"0")} `:(m>0||n==="none")&&(w=n==="none"?"":" "),p.push(w+y.join(""))}}return n!=="none"&&u.length>0&&p.push(u.length.toString(8).padStart(7,"0")),{stdout:p.length>0?`${p.join(`
|
|
670
|
+
`)}
|
|
671
|
+
`:"",stderr:"",exitCode:0}}var nA,rA,h2=I(()=>{"use strict";ye();nA={name:"od",execute:tA},rA={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Ho={};ee(Ho,{flagsForFuzzing:()=>hA,gunzipCommand:()=>fA,gunzipFlagsForFuzzing:()=>dA,gzipCommand:()=>uA,zcatCommand:()=>pA,zcatFlagsForFuzzing:()=>mA});import{constants as Pc,gunzipSync as d2,gzipSync as m2}from"node:zlib";function g2(e){return e.best?Pc.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?Pc.Z_BEST_SPEED:Pc.Z_DEFAULT_COMPRESSION}function y2(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],n=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let i=e[r]|e[r+1]<<8;r+=2+i}let s=null;if(t&8){let i=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(i,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:n>0?new Date(n*1e3):null,headerSize:r}}function w2(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function zo(e){return e.length>=2&&e[0]===31&&e[1]===139}function Wo(e){return Buffer.from(e).toString("latin1")}function b2(e){return e.limits?.maxOutputSize??0}function Dc(e,t){if(t>0){if(w2(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return d2(e,{maxOutputLength:t})}return d2(e)}async function x2(e,t,n,r,s,i){let o=n.suffix,a,l,c,u=b2(e);if(t==="-"||t==="")if(c=Uint8Array.from(e.stdin,f=>f.charCodeAt(0)),s){if(!zo(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
|
|
672
|
+
`,exitCode:1};try{let f=Dc(c,u);return{stdout:Wo(f),stderr:"",exitCode:0}}catch(f){let p=f instanceof Error?f.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${p}
|
|
673
|
+
`,exitCode:1}}}else{let f=g2(n),p=m2(c,{level:f});return{stdout:Wo(p),stderr:"",exitCode:0}}a=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(a)).isDirectory)return n.recursive?await E2(e,a,n,r,s,i):n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
|
|
674
|
+
`,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
675
|
+
`,exitCode:1}}try{c=await e.fs.readFileBuffer(a)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
676
|
+
`,exitCode:1}}if(s){if(!t.endsWith(o))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
|
|
677
|
+
`,exitCode:1};if(!zo(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
678
|
+
`,exitCode:1};let f;try{f=Dc(c,u)}catch(p){let h=p instanceof Error?p.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${h}
|
|
679
|
+
`,exitCode:1}}if(i)return{stdout:Wo(f),stderr:"",exitCode:0};if(n.name){let p=y2(c);p.originalName?l=e.fs.resolvePath(e.cwd,p.originalName):l=a.slice(0,-o.length)}else l=a.slice(0,-o.length);if(!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
|
|
680
|
+
`,exitCode:1}}catch{}if(await e.fs.writeFile(l,f),!n.keep&&!i&&await e.fs.rm(a),n.verbose){let p=c.length>0?((1-c.length/f.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${p}% -- replaced with ${l.split("/").pop()}
|
|
681
|
+
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(o))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t} already has ${o} suffix -- unchanged
|
|
682
|
+
`,exitCode:1};let f=g2(n),p;try{p=m2(c,{level:f})}catch(h){let d=h instanceof Error?h.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${d}
|
|
683
|
+
`,exitCode:1}}if(i)return{stdout:Wo(p),stderr:"",exitCode:0};if(l=a+o,!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
|
|
684
|
+
`,exitCode:1}}catch{}if(await e.fs.writeFile(l,p),!n.keep&&!i&&await e.fs.rm(a),n.verbose){let h=c.length>0?((1-p.length/c.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${h}% -- replaced with ${l.split("/").pop()}
|
|
685
|
+
`,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function E2(e,t,n,r,s,i){let o=await e.fs.readdir(t),a="",l="",c=0;for(let u of o){let f=e.fs.resolvePath(t,u),p=await e.fs.stat(f);if(p.isDirectory){let h=await E2(e,f,n,r,s,i);a+=h.stdout,l+=h.stderr,h.exitCode!==0&&(c=h.exitCode)}else if(p.isFile){let h=n.suffix;if(s&&!u.endsWith(h)||!s&&u.endsWith(h))continue;let d=f.startsWith(`${e.cwd}/`)?f.slice(e.cwd.length+1):f,m=await x2(e,d,n,r,s,i);a+=m.stdout,l+=m.stderr,m.exitCode!==0&&(c=m.exitCode)}}return{stdout:a,stderr:l,exitCode:c}}async function lA(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));else{let f=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
686
|
+
`,exitCode:1}}}if(!zo(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
687
|
+
`,exitCode:1};let i=s.length,o=w2(s),a=o>0?((1-i/o)*100).toFixed(1):"0.0",c=y2(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${i.toString().padStart(10)} ${o.toString().padStart(10)} ${a.padStart(5)}% ${c}
|
|
688
|
+
`,stderr:"",exitCode:0}}async function cA(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
|
|
689
|
+
`,exitCode:1}}}if(!zo(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
|
|
690
|
+
`,exitCode:1};try{return Dc(s,b2(e)),n.verbose?{stdout:"",stderr:`${t}: OK
|
|
691
|
+
`,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(i){let o=i instanceof Error?i.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${o}
|
|
692
|
+
`,exitCode:1}}}async function _c(e,t,n){let r=n==="zcat"?oA:n==="gunzip"?iA:sA;if(W(e))return B(r);let s=Ee(n,e,aA);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let i=s.result.flags,o=s.result.positional,a=n==="gunzip"||n==="zcat"||i.decompress||i.uncompress,l=n==="zcat"||i.stdout||i.toStdout;if(i.list){o.length===0&&(o=["-"]);let p=` compressed uncompressed ratio uncompressed_name
|
|
693
|
+
`,h="",d=0;for(let m of o){let g=await lA(t,m,i,n);p+=g.stdout,h+=g.stderr,g.exitCode!==0&&(d=g.exitCode)}return{stdout:p,stderr:h,exitCode:d}}if(i.test){o.length===0&&(o=["-"]);let p="",h="",d=0;for(let m of o){let g=await cA(t,m,i,n);p+=g.stdout,h+=g.stderr,g.exitCode!==0&&(d=g.exitCode)}return{stdout:p,stderr:h,exitCode:d}}o.length===0&&(o=["-"]);let c="",u="",f=0;for(let p of o){let h=await x2(t,p,i,n,a,l);c+=h.stdout,u+=h.stderr,h.exitCode!==0&&(f=h.exitCode)}return{stdout:c,stderr:u,exitCode:f}}var sA,iA,oA,aA,uA,fA,pA,hA,dA,mA,jo=I(()=>{"use strict";ye();ct();ae();sA={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
|
|
694
|
+
|
|
695
|
+
When no FILE is given, or when FILE is -, read from standard input.
|
|
696
|
+
|
|
697
|
+
With -d, decompress instead.`,options:["-c, --stdout write to standard output, keep original files","-d, --decompress decompress","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not save or restore the original name and timestamp","-N, --name save or restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode","-1, --fast compress faster","-9, --best compress better"," --help display this help and exit"]},iA={name:"gunzip",summary:"decompress files",usage:"gunzip [OPTION]... [FILE]...",description:`Decompress FILEs (by default, in-place).
|
|
698
|
+
|
|
699
|
+
When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},oA={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
|
|
700
|
+
|
|
701
|
+
When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},aA={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};uA={name:"gzip",async execute(e,t){return{...await _c(e,t,"gzip"),stdoutEncoding:"binary"}}},fA={name:"gunzip",async execute(e,t){return{...await _c(e,t,"gunzip"),stdoutEncoding:"binary"}}},pA={name:"zcat",async execute(e,t){return{...await _c(e,t,"zcat"),stdoutEncoding:"binary"}}},hA={name:"gzip",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-1",type:"boolean"},{flag:"-9",type:"boolean"}],stdinType:"binary",needsFiles:!0},dA={name:"gunzip",flags:[{flag:"-c",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-k",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0},mA={name:"zcat",flags:[{flag:"-f",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-v",type:"boolean"}],stdinType:"binary",needsFiles:!0}});function Fc(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),n=>n.charCodeAt(0));if(t==="hex"){let n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.slice(r,r+2),16);return n}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,s=>s.charCodeAt(0));let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r}return gA.encode(e)}function vi(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let n=65536,r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return r}return yA.decode(e)}function Go(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var gA,yA,Lc=I(()=>{"use strict";gA=new TextEncoder,yA=new TextDecoder});function A2(e){let t=e.indexOf("=");if(t>=0){let n=e.slice(0,t),r=e.slice(t+1);return n?`${encodeURIComponent(n)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(e)}function Mc(e){let t=e.indexOf("=");if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1),s,i,o=r.match(/;type=([^;]+)$/);o&&(i=o[1],r=r.slice(0,-o[0].length));let a=r.match(/;filename=([^;]+)/);return a&&(s=a[1],r=r.replace(a[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(s=s??r.slice(1).split("/").pop()),{name:n,value:r,filename:s,contentType:i}}function S2(e,t){let n=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let s of e){let i=s.value;if(i.startsWith("@")||i.startsWith("<")){let a=i.slice(1);i=t.get(a)??""}let o=`--${n}\r
|
|
702
|
+
`;s.filename?(o+=`Content-Disposition: form-data; name="${s.name}"; filename="${s.filename}"\r
|
|
703
|
+
`,s.contentType&&(o+=`Content-Type: ${s.contentType}\r
|
|
704
|
+
`)):o+=`Content-Disposition: form-data; name="${s.name}"\r
|
|
705
|
+
`,o+=`\r
|
|
706
|
+
${i}\r
|
|
707
|
+
`,r.push(o)}return r.push(`--${n}--\r
|
|
708
|
+
`),{body:r.join(""),boundary:n}}var Uc=I(()=>{"use strict"});var C2,v2=I(()=>{"use strict";C2={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data (DATA=@file reads from file, strips newlines)"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data (DATA=@file reads file verbatim)"," --data-urlencode DATA URL-encode and POST data (supports @file and name@file)","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]}});function qr(e,t,n){n.allowFile&&t.startsWith("@")?(e.dataFile={mode:n.binary?"binary":"ascii",path:t.slice(1)},e.data=void 0):(e.data=t,e.dataFile=void 0),n.binary&&(e.dataBinary=!0)}function k2(e,t){if(t.startsWith("@")){e.urlencodeFiles.push({path:t.slice(1)});return}let n=t.indexOf("@"),r=t.indexOf("=");if(n>0&&(r<0||n<r)){e.urlencodeFiles.push({name:t.slice(0,n),path:t.slice(n+1)});return}e.data=(e.data?`${e.data}&`:"")+A2(t)}function N2(e){let t={method:"GET",headers:new Io,dataBinary:!1,urlencodeFiles:[],formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(s==="-X"||s==="--request")t.method=e[++r]??"GET";else if(s.startsWith("-X"))t.method=s.slice(2);else if(s.startsWith("--request="))t.method=s.slice(10);else if(s==="-H"||s==="--header"){let i=e[++r];if(i){let o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(a,l)}}}else if(s.startsWith("--header=")){let i=s.slice(9),o=i.indexOf(":");if(o>0){let a=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(a,l)}}else if(s==="-d"||s==="--data")qr(t,e[++r]??"",{binary:!1,allowFile:!0}),n=!0;else if(s==="--data-raw")qr(t,e[++r]??"",{binary:!1,allowFile:!1}),n=!0;else if(s.startsWith("-d"))qr(t,s.slice(2),{binary:!1,allowFile:!0}),n=!0;else if(s.startsWith("--data="))qr(t,s.slice(7),{binary:!1,allowFile:!0}),n=!0;else if(s.startsWith("--data-raw="))qr(t,s.slice(11),{binary:!1,allowFile:!1}),n=!0;else if(s==="--data-binary")qr(t,e[++r]??"",{binary:!0,allowFile:!0}),n=!0;else if(s.startsWith("--data-binary="))qr(t,s.slice(14),{binary:!0,allowFile:!0}),n=!0;else if(s==="--data-urlencode")k2(t,e[++r]??""),n=!0;else if(s.startsWith("--data-urlencode="))k2(t,s.slice(17)),n=!0;else if(s==="-F"||s==="--form"){let i=e[++r]??"",o=Mc(i);o&&t.formFields.push(o),n=!0}else if(s.startsWith("--form=")){let i=s.slice(7),o=Mc(i);o&&t.formFields.push(o),n=!0}else if(s==="-u"||s==="--user")t.user=e[++r];else if(s.startsWith("-u"))t.user=s.slice(2);else if(s.startsWith("--user="))t.user=s.slice(7);else if(s==="-A"||s==="--user-agent")t.headers.set("User-Agent",e[++r]??"");else if(s.startsWith("-A"))t.headers.set("User-Agent",s.slice(2));else if(s.startsWith("--user-agent="))t.headers.set("User-Agent",s.slice(13));else if(s==="-e"||s==="--referer")t.headers.set("Referer",e[++r]??"");else if(s.startsWith("-e"))t.headers.set("Referer",s.slice(2));else if(s.startsWith("--referer="))t.headers.set("Referer",s.slice(10));else if(s==="-b"||s==="--cookie")t.headers.set("Cookie",e[++r]??"");else if(s.startsWith("-b"))t.headers.set("Cookie",s.slice(2));else if(s.startsWith("--cookie="))t.headers.set("Cookie",s.slice(9));else if(s==="-c"||s==="--cookie-jar")t.cookieJar=e[++r];else if(s.startsWith("--cookie-jar="))t.cookieJar=s.slice(13);else if(s==="-T"||s==="--upload-file")t.uploadFile=e[++r],t.method==="GET"&&(t.method="PUT");else if(s.startsWith("--upload-file="))t.uploadFile=s.slice(14),t.method==="GET"&&(t.method="PUT");else if(s==="-m"||s==="--max-time"){let i=parseFloat(e[++r]??"0");!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(s.startsWith("--max-time=")){let i=parseFloat(s.slice(11));!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(s==="--connect-timeout"){let i=parseFloat(e[++r]??"0");!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(s.startsWith("--connect-timeout=")){let i=parseFloat(s.slice(18));!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(s==="-o"||s==="--output")t.outputFile=e[++r];else if(s.startsWith("--output="))t.outputFile=s.slice(9);else if(s==="-O"||s==="--remote-name")t.useRemoteName=!0;else if(s==="-I"||s==="--head")t.headOnly=!0,t.method="HEAD";else if(s==="-i"||s==="--include")t.includeHeaders=!0;else if(s==="-s"||s==="--silent")t.silent=!0;else if(s==="-S"||s==="--show-error")t.showError=!0;else if(s==="-f"||s==="--fail")t.failSilently=!0;else if(s==="-L"||s==="--location")t.followRedirects=!0;else if(s==="--max-redirs")r++;else if(!s.startsWith("--max-redirs="))if(s==="-w"||s==="--write-out")t.writeOut=e[++r];else if(s.startsWith("--write-out="))t.writeOut=s.slice(12);else if(s==="-v"||s==="--verbose")t.verbose=!0;else{if(s.startsWith("--")&&s!=="--")return Q("curl",s);if(s.startsWith("-")&&s!=="-")for(let i of s.slice(1))switch(i){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return Q("curl",`-${i}`)}else s.startsWith("-")||(t.url=s)}}return n&&t.method==="GET"&&(t.method="POST"),t}var I2=I(()=>{"use strict";yi();ae();Uc()});function Bc(e){return Object.entries(e).map(([t,n])=>`${t}: ${n}`).join(`\r
|
|
709
|
+
`)}function $2(e){try{return new URL(e).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function Wc(e,t){let n=e;return n=n.replace(/%\{http_code\}/g,String(t.status)),n=n.replace(/%\{content_type\}/g,t.headers["content-type"]||""),n=n.replace(/%\{url_effective\}/g,t.url),n=n.replace(/%\{size_download\}/g,String(t.bodyLength)),n=n.replace(/\\n/g,`
|
|
710
|
+
`),n}var T2=I(()=>{"use strict"});var O2={};ee(O2,{curlCommand:()=>vA});async function wA(e,t){if(e.dataFile){let n=t.fs.resolvePath(t.cwd,e.dataFile.path),r=await t.fs.readFile(n);return e.dataFile.mode==="ascii"&&(r=r.replace(/[\r\n]/g,"")),e.data?`${r}&${e.data}`:r}return e.data}async function bA(e,t,n){if(e.urlencodeFiles.length===0)return n;let r=n?[n]:[];for(let s of e.urlencodeFiles){let i=t.fs.resolvePath(t.cwd,s.path),o=await t.fs.readFile(i),a=encodeURIComponent(o);r.push(s.name?`${encodeURIComponent(s.name)}=${a}`:a)}return r.join("&")}async function xA(e,t){if(e.uploadFile){let r=t.fs.resolvePath(t.cwd,e.uploadFile);return{body:await t.fs.readFile(r)}}if(e.formFields.length>0){let r=new Map;for(let o of e.formFields)if(o.value.startsWith("@")||o.value.startsWith("<")){let a=t.fs.resolvePath(t.cwd,o.value.slice(1));try{let l=await t.fs.readFile(a);r.set(o.value.slice(1),l)}catch{r.set(o.value.slice(1),"")}}let{body:s,boundary:i}=S2(e.formFields,r);return{body:s,contentType:`multipart/form-data; boundary=${i}`}}let n=await wA(e,t);return n=await bA(e,t,n),n!==void 0?{body:n}:{}}function EA(e,t){let n=new Io(e.headers);if(e.user){let r=Buffer.from(e.user).toString("base64");n.set("Authorization",`Basic ${r}`)}return t&&!n.has("Content-Type")&&n.set("Content-Type",t),n}async function AA(e,t,n){if(!e.cookieJar)return;let r=t["set-cookie"];if(!r)return;let s=n.fs.resolvePath(n.cwd,e.cookieJar);await n.fs.writeFile(s,r)}function SA(e){return vi(e,"binary")}function CA(e,t,n){let r="";if(e.verbose){r+=`> ${e.method} ${n}
|
|
711
|
+
`;for(let[s,i]of e.headers)r+=`> ${s}: ${i}
|
|
712
|
+
`;r+=`>
|
|
713
|
+
`,r+=`< HTTP/1.1 ${t.status} ${t.statusText}
|
|
714
|
+
`;for(let[s,i]of Object.entries(t.headers))r+=`< ${s}: ${i}
|
|
715
|
+
`;r+=`<
|
|
716
|
+
`}return e.includeHeaders&&!e.verbose&&(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
|
|
717
|
+
`,r+=Bc(t.headers),r+=`\r
|
|
718
|
+
\r
|
|
719
|
+
`),e.headOnly?e.includeHeaders||e.verbose||(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
|
|
720
|
+
`,r+=Bc(t.headers),r+=`\r
|
|
721
|
+
`):r+=SA(t.body),e.writeOut&&(r+=Wc(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.byteLength})),r}var vA,R2=I(()=>{"use strict";Lc();nn();yi();ae();Uc();v2();I2();T2();vA={name:"curl",async execute(e,t){if(W(e))return B(C2);let n=N2(e);if("exitCode"in n)return n;let r=n;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
|
|
722
|
+
`,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
|
|
723
|
+
`,exitCode:1};let s=r.url;s.match(/^https?:\/\//)||(s=`https://${s}`);try{let{body:i,contentType:o}=await xA(r,t),a=EA(r,o),l=await t.fetch(s,{method:r.method,headers:a,body:i,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await AA(r,l.headers,t),r.failSilently&&l.status>=400)return{stdout:"",stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${l.status}
|
|
724
|
+
`:"",exitCode:22};let c=CA(r,l,s);if(r.outputFile||r.useRemoteName){let u=r.outputFile||$2(s),f=t.fs.resolvePath(t.cwd,u);await t.fs.writeFile(f,r.headOnly?"":l.body),r.verbose||(c=""),r.writeOut&&(c=Wc(r.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.byteLength}))}return{stdout:c,stderr:"",exitCode:0}}catch(i){let o=Ke(i),a=1;return o.includes("Network access denied")?a=7:o.includes("HTTP method")&&o.includes("not allowed")?a=3:o.includes("Redirect target not in allow-list")||o.includes("Too many redirects")?a=47:o.includes("aborted")&&(a=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${a}) ${o}
|
|
725
|
+
`:"",exitCode:a}}}}});function Hc(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
|
|
726
|
+
State: R (running)
|
|
727
|
+
Pid: ${t}
|
|
728
|
+
PPid: ${n}
|
|
729
|
+
Uid: ${r} ${r} ${r} ${r}
|
|
730
|
+
Gid: ${s} ${s} ${s} ${s}
|
|
731
|
+
`}var H2,j2,jc=I(()=>{"use strict";H2="5.1.0(1)-release",j2="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT"});var J,Zr=I(()=>{"use strict";J={script(e){return{type:"Script",statements:e}},statement(e,t=[],n=!1,r,s){let i={type:"Statement",pipelines:e,operators:t,background:n};return r&&(i.deferredError=r),s!==void 0&&(i.sourceText=s),i},pipeline(e,t=!1,n=!1,r=!1,s){return{type:"Pipeline",commands:e,negated:t,timed:n,timePosix:r,pipeStderr:s}},simpleCommand(e,t=[],n=[],r=[]){return{type:"SimpleCommand",name:e,args:t,assignments:n,redirections:r}},word(e){return{type:"Word",parts:e}},literal(e){return{type:"Literal",value:e}},singleQuoted(e){return{type:"SingleQuoted",value:e}},doubleQuoted(e){return{type:"DoubleQuoted",parts:e}},escaped(e){return{type:"Escaped",value:e}},parameterExpansion(e,t=null){return{type:"ParameterExpansion",parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:"CommandSubstitution",body:e,legacy:t}},arithmeticExpansion(e){return{type:"ArithmeticExpansion",expression:e}},assignment(e,t,n=!1,r=null){return{type:"Assignment",name:e,value:t,append:n,array:r}},redirection(e,t,n=null,r){let s={type:"Redirection",fd:n,operator:e,target:t};return r&&(s.fdVariable=r),s},hereDoc(e,t,n=!1,r=!1){return{type:"HereDoc",delimiter:e,content:t,stripTabs:n,quoted:r}},ifNode(e,t=null,n=[]){return{type:"If",clauses:e,elseBody:t,redirections:n}},forNode(e,t,n,r=[]){return{type:"For",variable:e,words:t,body:n,redirections:r}},whileNode(e,t,n=[]){return{type:"While",condition:e,body:t,redirections:n}},untilNode(e,t,n=[]){return{type:"Until",condition:e,body:t,redirections:n}},caseNode(e,t,n=[]){return{type:"Case",word:e,items:t,redirections:n}},caseItem(e,t,n=";;"){return{type:"CaseItem",patterns:e,body:t,terminator:n}},subshell(e,t=[]){return{type:"Subshell",body:e,redirections:t}},group(e,t=[]){return{type:"Group",body:e,redirections:t}},functionDef(e,t,n=[],r){return{type:"FunctionDef",name:e,body:t,redirections:n,sourceFile:r}},conditionalCommand(e,t=[],n){return{type:"ConditionalCommand",expression:e,redirections:t,line:n}},arithmeticCommand(e,t=[],n){return{type:"ArithmeticCommand",expression:e,redirections:t,line:n}}}});function V2(e,t){let n=e.length,r=t+3,s=2,i=!1,o=!1;for(;r<n&&s>0;){let a=e[r];if(i){a==="'"&&(i=!1),r++;continue}if(o){if(a==="\\"){r+=2;continue}a==='"'&&(o=!1),r++;continue}if(a==="'"){i=!0,r++;continue}if(a==='"'){o=!0,r++;continue}if(a==="\\"){r+=2;continue}if(a==="("){s++,r++;continue}if(a===")"){if(s--,s===1){let l=r+1;return!(l<n&&e[l]===")")}if(s===0)return!1;r++;continue}if(s===1&&(a==="|"&&r+1<n&&e[r+1]==="|"||a==="&"&&r+1<n&&e[r+1]==="&"||a==="|"&&r+1<n&&e[r+1]!=="|"))return!0;r++}return!1}function Zc(e,t){let n="",r=t,s=i=>i===" "||i===" "||i===`
|
|
732
|
+
`||i===";"||i==="&"||i==="|"||i==="<"||i===">"||i==="("||i===")";for(;r<e.length;){let i=e[r];if(i==="'"){for(r++;r<e.length&&e[r]!=="'";)n+=e[r],r++;r<e.length&&r++;continue}if(i==='"'){for(r++;r<e.length&&e[r]!=='"';)e[r]==="\\"&&r+1<e.length&&r++,n+=e[r],r++;r<e.length&&r++;continue}if(i==="\\"&&r+1<e.length){n+=e[r+1],r+=2;continue}if(s(i))break;n+=i,r++}return{delim:n,endPos:r}}function BA(e,t,n){let r=t+1;for(let{delim:s,stripTabs:i}of n)for(;;){if(r>=e.length)return e.length;let o=e.indexOf(`
|
|
733
|
+
`,r);o===-1&&(o=e.length);let a=e.slice(r,o);if(i&&(a=a.replace(/^\t+/,"")),a===s){r=o+1;break}if(o>=e.length)return e.length;r=o+1}return Math.min(r,e.length)}function q2(e,t,n,r){let s=t+2,i=1,o=s,a=!1,l=!1,c=0,u=!1,f="",p=[],h=0;for(;o<e.length&&i>0;){let y=e[o];if(a)y==="'"&&(a=!1);else if(l)y==="\\"&&o+1<e.length?o++:y==='"'&&(l=!1);else{if(y==="("&&e[o+1]==="("?h++:y===")"&&e[o+1]===")"&&h>0&&h--,h===0&&y==="<"&&e[o+1]==="<"&&e[o+2]!=="<"){let w=o+2,b=!1;for(e[w]==="-"&&(b=!0,w++);e[w]===" "||e[w]===" ";)w++;let{delim:x,endPos:A}=Zc(e,w);if(x.length>0){p.push({delim:x,stripTabs:b}),f="",o=A;continue}}if(y===`
|
|
734
|
+
`&&p.length>0){let w=BA(e,o,p);p.length=0,f="",o=w;continue}y==="'"?(a=!0,f=""):y==='"'?(l=!0,f=""):y==="\\"&&o+1<e.length?(o++,f=""):/[a-zA-Z_]/.test(y)?f+=y:(f==="case"?(c++,u=!1):f==="in"&&c>0?u=!0:f==="esac"&&c>0&&(c--,u=!1),f="",y==="("?o>0&&e[o-1]==="$"?i++:u||i++:y===")"?u?u=!1:i--:y===";"&&c>0&&o+1<e.length&&e[o+1]===";"&&(u=!0))}i>0&&o++}i>0&&r("unexpected EOF while looking for matching `)'");let d=e.slice(s,o),g=n().parse(d);return{part:J.commandSubstitution(g,!1),endIndex:o+1}}function Z2(e,t,n,r,s){let o=t+1,a="";for(;o<e.length&&e[o]!=="`";)if(e[o]==="\\"){let u=e[o+1];u==="$"||u==="`"||u==="\\"||u===`
|
|
735
|
+
`||n&&u==='"'?(u!==`
|
|
736
|
+
`&&(a+=u),o+=2):(a+=e[o],o++)}else a+=e[o],o++;o>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(a);return{part:J.commandSubstitution(c,!0),endIndex:o+1}}var Kc=I(()=>{"use strict";Zr()});function Q2(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let n=e.slice(t[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let i=n.slice(s+1);return i===""||i==="+"}return!1}function X2(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r==="[")t++;else if(r==="]")t--;else{if(t===0&&r==="=")return n;if(t===0&&r==="+"&&e[n+1]==="=")return n+1}}return-1}function GA(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function Y2(e){return e===" "||e===" "||e===`
|
|
737
|
+
`||e===";"||e==="&"||e==="|"||e==="("||e===")"||e==="<"||e===">"}var WA,E,gr,K2,zA,HA,jA,Qo,yr=I(()=>{"use strict";Kc();WA=10485760;(function(e){e.EOF="EOF",e.NEWLINE="NEWLINE",e.SEMICOLON="SEMICOLON",e.AMP="AMP",e.PIPE="PIPE",e.PIPE_AMP="PIPE_AMP",e.AND_AND="AND_AND",e.OR_OR="OR_OR",e.BANG="BANG",e.LESS="LESS",e.GREAT="GREAT",e.DLESS="DLESS",e.DGREAT="DGREAT",e.LESSAND="LESSAND",e.GREATAND="GREATAND",e.LESSGREAT="LESSGREAT",e.DLESSDASH="DLESSDASH",e.CLOBBER="CLOBBER",e.TLESS="TLESS",e.AND_GREAT="AND_GREAT",e.AND_DGREAT="AND_DGREAT",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.DSEMI="DSEMI",e.SEMI_AND="SEMI_AND",e.SEMI_SEMI_AND="SEMI_SEMI_AND",e.DBRACK_START="DBRACK_START",e.DBRACK_END="DBRACK_END",e.DPAREN_START="DPAREN_START",e.DPAREN_END="DPAREN_END",e.IF="IF",e.THEN="THEN",e.ELSE="ELSE",e.ELIF="ELIF",e.FI="FI",e.FOR="FOR",e.WHILE="WHILE",e.UNTIL="UNTIL",e.DO="DO",e.DONE="DONE",e.CASE="CASE",e.ESAC="ESAC",e.IN="IN",e.FUNCTION="FUNCTION",e.SELECT="SELECT",e.TIME="TIME",e.COPROC="COPROC",e.WORD="WORD",e.NAME="NAME",e.NUMBER="NUMBER",e.ASSIGNMENT_WORD="ASSIGNMENT_WORD",e.FD_VARIABLE="FD_VARIABLE",e.COMMENT="COMMENT",e.HEREDOC_CONTENT="HEREDOC_CONTENT"})(E||(E={}));gr=class extends Error{line;column;constructor(t,n,r){super(`line ${n}: ${t}`),this.line=n,this.column=r,this.name="LexerError"}},K2=new Map([["if",E.IF],["then",E.THEN],["else",E.ELSE],["elif",E.ELIF],["fi",E.FI],["for",E.FOR],["while",E.WHILE],["until",E.UNTIL],["do",E.DO],["done",E.DONE],["case",E.CASE],["esac",E.ESAC],["in",E.IN],["function",E.FUNCTION],["select",E.SELECT],["time",E.TIME],["coproc",E.COPROC]]);zA=[[";",";","&",E.SEMI_SEMI_AND],["<","<","<",E.TLESS],["&",">",">",E.AND_DGREAT]],HA=[["[","[",E.DBRACK_START],["]","]",E.DBRACK_END],["(","(",E.DPAREN_START],[")",")",E.DPAREN_END],["&","&",E.AND_AND],["|","|",E.OR_OR],[";",";",E.DSEMI],[";","&",E.SEMI_AND],["|","&",E.PIPE_AMP],[">",">",E.DGREAT],["<","&",E.LESSAND],[">","&",E.GREATAND],["<",">",E.LESSGREAT],[">","|",E.CLOBBER],["&",">",E.AND_GREAT]],jA=new Map([["|",E.PIPE],["&",E.AMP],[";",E.SEMICOLON],["(",E.LPAREN],[")",E.RPAREN],["<",E.LESS],[">",E.GREAT]]);Qo=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];dparenDepth=0;maxHeredocSize;constructor(t,n){this.input=t,this.maxHeredocSize=n?.maxHeredocSize??WA}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n;){if(s.length>0&&r.length>0&&r[r.length-1].type===E.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=n)break;let i=this.nextToken();i&&r.push(i)}return r.push({type:E.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let t=this.input,n=t.length,r=this.pos,s=this.column,i=this.line;for(;r<n;){let o=t[r];if(o===" "||o===" ")r++,s++;else if(o==="\\"&&t[r+1]===`
|
|
738
|
+
`)r+=2,i++,s=1;else break}this.pos=r,this.column=s,this.line=i}nextToken(){let t=this.input,n=this.pos,r=this.line,s=this.column,i=t[n],o=t[n+1],a=t[n+2];if(i==="#"&&this.dparenDepth===0)return this.readComment(n,r,s);if(i===`
|
|
739
|
+
`)return this.pos=n+1,this.line++,this.column=1,{type:E.NEWLINE,value:`
|
|
740
|
+
`,start:n,end:n+1,line:r,column:s};if(i==="<"&&o==="<"&&a==="-")return this.pos=n+3,this.column=s+3,this.registerHeredocFromLookahead(!0),this.makeToken(E.DLESSDASH,"<<-",n,r,s);for(let[c,u,f,p]of zA)if(i===c&&o===u&&a===f)return this.pos=n+3,this.column=s+3,this.makeToken(p,c+u+f,n,r,s);if(i==="<"&&o==="<")return this.pos=n+2,this.column=s+2,this.registerHeredocFromLookahead(!1),this.makeToken(E.DLESS,"<<",n,r,s);if(i==="("&&o==="(")return this.dparenDepth>0?(this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(E.LPAREN,"(",n,r,s)):this.looksLikeNestedSubshells(n+2)||this.dparenClosesWithSpacedParens(n+2)?(this.pos=n+1,this.column=s+1,this.makeToken(E.LPAREN,"(",n,r,s)):(this.pos=n+2,this.column=s+2,this.dparenDepth=1,this.makeToken(E.DPAREN_START,"((",n,r,s));if(i===")"&&o===")")return this.dparenDepth===1?(this.pos=n+2,this.column=s+2,this.dparenDepth=0,this.makeToken(E.DPAREN_END,"))",n,r,s)):this.dparenDepth>1?(this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(E.RPAREN,")",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(E.RPAREN,")",n,r,s));for(let[c,u,f]of HA)if(!(c==="("&&u==="("||c===")"&&u===")")&&!(this.dparenDepth>0&&c===";"&&(f===E.DSEMI||f===E.SEMI_AND||f===E.SEMI_SEMI_AND))&&i===c&&o===u){if(f===E.DBRACK_START||f===E.DBRACK_END){let p=t[n+2];if(p!==void 0&&p!==" "&&p!==" "&&p!==`
|
|
741
|
+
`&&p!==";"&&p!=="&"&&p!=="|"&&p!=="("&&p!==")"&&p!=="<"&&p!==">")break}return this.pos=n+2,this.column=s+2,this.makeToken(f,c+u,n,r,s)}if(i==="("&&this.dparenDepth>0)return this.pos=n+1,this.column=s+1,this.dparenDepth++,this.makeToken(E.LPAREN,"(",n,r,s);if(i===")"&&this.dparenDepth>1)return this.pos=n+1,this.column=s+1,this.dparenDepth--,this.makeToken(E.RPAREN,")",n,r,s);let l=jA.get(i);if(l!==void 0)return this.pos=n+1,this.column=s+1,this.makeToken(l,i,n,r,s);if(i==="{"){let c=this.scanFdVariable(n);return c!==null?(this.pos=c.end,this.column=s+(c.end-n),{type:E.FD_VARIABLE,value:c.varname,start:n,end:c.end,line:r,column:s}):o==="}"?(this.pos=n+2,this.column=s+2,{type:E.WORD,value:"{}",start:n,end:n+2,line:r,column:s,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(n)!==null?this.readWordWithBraceExpansion(n,r,s):this.scanLiteralBraceWord(n)!==null?this.readWordWithBraceExpansion(n,r,s):o!==void 0&&o!==" "&&o!==" "&&o!==`
|
|
742
|
+
`?this.readWord(n,r,s):(this.pos=n+1,this.column=s+1,this.makeToken(E.LBRACE,"{",n,r,s))}return i==="}"?this.isWordCharFollowing(n+1)?this.readWord(n,r,s):(this.pos=n+1,this.column=s+1,this.makeToken(E.RBRACE,"}",n,r,s)):i==="!"?o==="="?(this.pos=n+2,this.column=s+2,this.makeToken(E.WORD,"!=",n,r,s)):(this.pos=n+1,this.column=s+1,this.makeToken(E.BANG,"!",n,r,s)):this.readWord(n,r,s)}looksLikeNestedSubshells(t){let n=this.input,r=n.length,s=t;for(;s<r&&(n[s]===" "||n[s]===" ");)s++;if(s>=r)return!1;let i=n[s];if(i==="(")return this.looksLikeNestedSubshells(s+1);let o=/[a-zA-Z_]/.test(i),a=i==="!"||i==="[";if(!o&&!a)return!1;let l=s;for(;l<r&&/[a-zA-Z0-9_\-.]/.test(n[l]);)l++;if(l===s)return a;let c=l;for(;c<r&&(n[c]===" "||n[c]===" ");)c++;if(c>=r)return!1;let u=n[c];if(u==="="&&n[c+1]!=="="||u===`
|
|
743
|
+
`||"+-*/%&|^".includes(u)&&n[c+1]==="="||l===c&&/[+\-*/%<>&|^!~?:]/.test(u)&&u!=="-"||u===")"&&n[c+1]===")")return!1;if(c>l&&(u==="-"||u==='"'||u==="'"||u==="$"||/[a-zA-Z_/.]/.test(u))){let f=c;for(;f<r&&n[f]!==`
|
|
744
|
+
`;){if(n[f]===")")return!0;f++}return!1}if(u===")"){let f=c+1;for(;f<r&&(n[f]===" "||n[f]===" ");)f++;if(n[f]==="|"&&n[f+1]==="|"||n[f]==="&"&&n[f+1]==="&"||n[f]===";"||n[f]==="|"&&n[f+1]!=="|")return!0}return!1}makeToken(t,n,r,s,i){return{type:t,value:n,start:r,end:this.pos,line:s,column:i}}readComment(t,n,r){let s=this.input,i=s.length,o=this.pos;for(;o<i&&s[o]!==`
|
|
745
|
+
`;)o++;let a=s.slice(t,o);return this.pos=o,this.column=r+(o-t),{type:E.COMMENT,value:a,start:t,end:o,line:n,column:r}}readWord(t,n,r){let s=this.input,i=s.length,o=this.pos,a=o;for(;o<i;){let b=s[o];if(b===" "||b===" "||b===`
|
|
746
|
+
`||b===";"||b==="&"||b==="|"||b==="("||b===")"||b==="<"||b===">"||b==="'"||b==='"'||b==="\\"||b==="$"||b==="`"||b==="{"||b==="}"||b==="~"||b==="*"||b==="?"||b==="[")break;o++}if(o>a){let b=s[o];if(!(b==="("&&o>a&&"@*+?!".includes(s[o-1]))){if(o>=i||b===" "||b===" "||b===`
|
|
747
|
+
`||b===";"||b==="&"||b==="|"||b==="("||b===")"||b==="<"||b===">"){let x=s.slice(a,o);this.pos=o,this.column=r+(o-a);let A=K2.get(x);if(A!==void 0)return{type:A,value:x,start:t,end:o,line:n,column:r};let C=X2(x);return C>0&&Q2(x.slice(0,C))?{type:E.ASSIGNMENT_WORD,value:x,start:t,end:o,line:n,column:r}:/^[0-9]+$/.test(x)?{type:E.NUMBER,value:x,start:t,end:o,line:n,column:r}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(x)?{type:E.NAME,value:x,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}:{type:E.WORD,value:x,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}}}}o=this.pos;let l=this.column,c=this.line,u="",f=!1,p=!1,h=!1,d=!1,m=s[o]==='"'||s[o]==="'",g=!1,y=0;for(;o<i;){let b=s[o];if(!h&&!d){if(b==="("&&u.length>0&&"@*+?!".includes(u[u.length-1])){let x=this.scanExtglobPattern(o);if(x!==null){u+=x.content,o=x.end,l+=x.content.length;continue}}if(b==="["&&y===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){let x=o+1<i?s[o+1]:"";if(x==="^"||x==="!"){u+=b,o++,l++;continue}y=1,u+=b,o++,l++;continue}}else if(b==="["&&y>0){u.length>0&&u[u.length-1]!=="\\"&&y++,u+=b,o++,l++;continue}else if(b==="]"&&y>0){u.length>0&&u[u.length-1]!=="\\"&&y--,u+=b,o++,l++;continue}if(y>0){if(b===`
|
|
748
|
+
`)break;u+=b,o++,l++;continue}if(b===" "||b===" "||b===`
|
|
749
|
+
`||b===";"||b==="&"||b==="|"||b==="("||b===")"||b==="<"||b===">")break}if(b==="$"&&o+1<i&&s[o+1]==="'"&&!h&&!d){for(u+="$'",o+=2,l+=2;o<i&&s[o]!=="'";)s[o]==="\\"&&o+1<i?(u+=s[o]+s[o+1],o+=2,l+=2):(u+=s[o],o++,l++);o<i&&(u+="'",o++,l++);continue}if(b==="$"&&o+1<i&&s[o+1]==='"'&&!h&&!d){o++,l++,d=!0,f=!0,u===""&&(m=!0),o++,l++;continue}if(b==="'"&&!d){if(h)if(h=!1,!m||g)u+=b;else{let x=o+1<i?s[o+1]:"";x&&!Y2(x)&&x!=="'"&&(x==='"'?(g=!0,u+=b,p=!1,f=!1):(g=!0,u+=b))}else h=!0,m&&!g?(p=!0,f=!0):u+=b;o++,l++;continue}if(b==='"'&&!h){if(d)if(d=!1,!m||g)u+=b;else{let x=o+1<i?s[o+1]:"";x&&!Y2(x)&&x!=='"'&&(x==="'"?(g=!0,u+=b,p=!1,f=!1):(g=!0,u+=b))}else d=!0,m&&!g?f=!0:u+=b;o++,l++;continue}if(b==="\\"&&!h&&o+1<i){let x=s[o+1];if(x===`
|
|
750
|
+
`){o+=2,c++,l=1;continue}if(d){if(x==='"'||x==="\\"||x==="$"||x==="`"||x===`
|
|
751
|
+
`){if(x===`
|
|
752
|
+
`){o+=2,l=1,c++;continue}u+=b+x,o+=2,l+=2;continue}}else{x==="\\"||x==='"'||x==="'"||x==="`"||x==="*"||x==="?"||x==="["||x==="]"||x==="("||x===")"||x==="$"||x==="-"||x==="."||x==="^"||x==="+"||x==="{"||x==="}"?u+=b+x:u+=x,o+=2,l+=2;continue}}if(b==="$"&&o+1<i&&s[o+1]==="("&&!h){u+=b,o++,l++,u+=s[o],o++,l++;let x=1,A=!1,C=!1,$=0,D=!1,v="",P=[],k=s[o]==="("&&!this.dollarDparenIsSubshell(o),N=k?1:0;for(;x>0&&o<i;){let R=s[o];if(u+=R,A)R==="'"&&(A=!1);else if(C)R==="\\"&&o+1<i?(u+=s[o+1],o++,l++):R==='"'&&(C=!1);else{if(R==="("&&s[o+1]==="("?N++:R===")"&&s[o+1]===")"&&N>0&&N--,N===0&&R==="<"&&s[o+1]==="<"&&s[o+2]!=="<"){let O=o+2,_=!1;for(s[O]==="-"&&(_=!0,O++);s[O]===" "||s[O]===" ";)O++;let{delim:M,endPos:z}=Zc(s,O);if(M.length>0){u+=s.slice(o+1,z),l+=z-o,P.push({delim:M,stripTabs:_}),o=z;continue}}if(R===`
|
|
753
|
+
`&&P.length>0){c++,l=0;let O=o+1;for(let{delim:_,stripTabs:M}of P)for(;!(O>=i);){let z=s.indexOf(`
|
|
754
|
+
`,O);z===-1&&(z=i);let ie=s.slice(O,z),me=M?ie.replace(/^\t+/,""):ie;u+=s.slice(O,Math.min(z+1,i)),z<i&&c++;let q=z>=i;if(O=z+1,me===_||q)break}P.length=0,l=0,o=Math.min(O,i);continue}if(R==="'")A=!0,v="";else if(R==='"')C=!0,v="";else if(R==="\\"&&o+1<i)u+=s[o+1],o++,l++,v="";else if(R==="$"&&o+1<i&&s[o+1]==="{"){o++,l++,u+=s[o],o++,l++;let O=1,_=!1,M=!1;for(;O>0&&o<i;){let z=s[o];if(z==="\\"&&o+1<i&&!_){u+=z,o++,l++,u+=s[o],o++,l++;continue}u+=z,_?z==="'"&&(_=!1):M?z==='"'&&(M=!1):z==="'"?_=!0:z==='"'?M=!0:z==="{"?O++:z==="}"&&O--,z===`
|
|
755
|
+
`?(c++,l=0):l++,o++}v="";continue}else if(R==="#"&&!k&&(v===""||/\s/.test(s[o-1]||""))){for(;o+1<i&&s[o+1]!==`
|
|
756
|
+
`;)o++,l++,u+=s[o];v=""}else/[a-zA-Z_]/.test(R)?v+=R:(v==="case"?($++,D=!1):v==="in"&&$>0?D=!0:v==="esac"&&$>0&&($--,D=!1),v="",R==="("?o>0&&s[o-1]==="$"?x++:D||x++:R===")"?D?D=!1:x--:R===";"&&$>0&&(o+1<i&&s[o+1]===";"||o+1<i&&s[o+1]==="&")&&(D=!0))}R===`
|
|
757
|
+
`&&(c++,l=0,v=""),o++,l++}continue}if(b==="$"&&o+1<i&&s[o+1]==="["&&!h){u+=b,o++,l++,u+=s[o],o++,l++;let x=1;for(;x>0&&o<i;){let A=s[o];u+=A,A==="["?x++:A==="]"?x--:A===`
|
|
758
|
+
`&&(c++,l=0),o++,l++}continue}if(b==="$"&&o+1<i&&s[o+1]==="{"&&!h){u+=b,o++,l++,u+=s[o],o++,l++;let x=1,A=!1,C=!1,$=c,D=l,v=c,P=l;for(;x>0&&o<i;){let k=s[o];if(k==="\\"&&o+1<i&&s[o+1]===`
|
|
759
|
+
`){o+=2,c++,l=1;continue}if(k==="\\"&&o+1<i&&!A){u+=k,o++,l++,u+=s[o],o++,l++;continue}u+=k,A?k==="'"&&(A=!1):C?k==='"'&&(C=!1):k==="'"?(A=!0,$=c,D=l):k==='"'?(C=!0,v=c,P=l):k==="{"?x++:k==="}"&&x--,k===`
|
|
760
|
+
`&&(c++,l=0),o++,l++}if(A)throw new gr("unexpected EOF while looking for matching `''",$,D);if(C)throw new gr("unexpected EOF while looking for matching `\"'",v,P);continue}if(b==="$"&&o+1<i&&!h){let x=s[o+1];if(x==="#"||x==="?"||x==="$"||x==="!"||x==="@"||x==="*"||x==="-"||x>="0"&&x<="9"){u+=b+x,o+=2,l+=2;continue}}if(b==="`"&&!h){for(u+=b,o++,l++;o<i&&s[o]!=="`";){let x=s[o];u+=x,x==="\\"&&o+1<i&&(u+=s[o+1],o++,l++),x===`
|
|
761
|
+
`&&(c++,l=0),o++,l++}o<i&&(u+=s[o],o++,l++);continue}u+=b,o++,b===`
|
|
762
|
+
`?(c++,l=1):l++}if(this.pos=o,this.column=l,this.line=c,g&&m&&(u=s[t]+u,f=!1,p=!1),h||d){let b=h?"'":'"';throw new gr(`unexpected EOF while looking for matching \`${b}'`,n,r)}if(!m&&u.length>=2){if(u[0]==="'"&&u[u.length-1]==="'"){let b=u.slice(1,-1);!b.includes("'")&&!b.includes('"')&&(u=b,f=!0,p=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let b=u.slice(1,-1),x=!1;for(let A=0;A<b.length;A++){if(b[A]==='"'){x=!0;break}b[A]==="\\"&&A+1<b.length&&A++}x||(u=b,f=!0,p=!1)}}if(u==="")return{type:E.WORD,value:"",start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p};let w=K2.get(u);if(!f&&w!==void 0)return{type:w,value:u,start:t,end:o,line:n,column:r};if(!m){let b=X2(u);if(b>0&&Q2(u.slice(0,b)))return{type:E.ASSIGNMENT_WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}}return/^[0-9]+$/.test(u)?{type:E.NUMBER,value:u,start:t,end:o,line:n,column:r}:GA(u)?{type:E.NAME,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}:{type:E.WORD,value:u,start:t,end:o,line:n,column:r,quoted:f,singleQuoted:p}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let t=this.pendingHeredocs.shift();if(!t)break;let n=this.pos,r=this.line,s=this.column,i="";for(;this.pos<this.input.length;){let o="";for(;this.pos<this.input.length&&this.input[this.pos]!==`
|
|
763
|
+
`;)o+=this.input[this.pos],this.pos++,this.column++;if((t.stripTabs?o.replace(/^\t+/,""):o)===t.delimiter){this.pos<this.input.length&&this.input[this.pos]===`
|
|
764
|
+
`&&(this.pos++,this.line++,this.column=1);break}if(i+=o,i.length>this.maxHeredocSize)throw new gr(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,r,s);this.pos<this.input.length&&this.input[this.pos]===`
|
|
765
|
+
`&&(i+=`
|
|
766
|
+
`,this.pos++,this.line++,this.column=1)}this.tokens.push({type:E.HEREDOC_CONTENT,value:i,start:n,end:this.pos,line:r,column:s})}}addPendingHeredoc(t,n,r){this.pendingHeredocs.push({delimiter:t,stripTabs:n,quoted:r})}registerHeredocFromLookahead(t){let n=this.pos,r=this.column;for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]===" ");)this.pos++,this.column++;let s="",i=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(/[\s;<>&|()]/.test(o))break;if(o==="'"||o==='"'){i=!0;let a=o;for(this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]!==a;)s+=this.input[this.pos],this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]===a&&(this.pos++,this.column++)}else o==="\\"?(i=!0,this.pos++,this.column++,this.pos<this.input.length&&(s+=this.input[this.pos],this.pos++,this.column++)):(s+=o,this.pos++,this.column++)}this.pos=n,this.column=r,s&&this.pendingHeredocs.push({delimiter:s,stripTabs:t,quoted:i})}isWordCharFollowing(t){if(t>=this.input.length)return!1;let n=this.input[t];return!(n===" "||n===" "||n===`
|
|
767
|
+
`||n===";"||n==="&"||n==="|"||n==="("||n===")"||n==="<"||n===">")}readWordWithBraceExpansion(t,n,r){let s=this.input,i=s.length,o=t,a=r;for(;o<i;){let c=s[o];if(c===" "||c===" "||c===`
|
|
768
|
+
`||c===";"||c==="&"||c==="|"||c==="("||c===")"||c==="<"||c===">")break;if(c==="{"){if(this.scanBraceExpansion(o)!==null){let f=1;for(o++,a++;o<i&&f>0;)s[o]==="{"?f++:s[o]==="}"&&f--,o++,a++;continue}o++,a++;continue}if(c==="}"){o++,a++;continue}if(c==="$"&&o+1<i&&s[o+1]==="("){o++,a++,o++,a++;let u=1;for(;u>0&&o<i;)s[o]==="("?u++:s[o]===")"&&u--,o++,a++;continue}if(c==="$"&&o+1<i&&s[o+1]==="{"){o++,a++,o++,a++;let u=1;for(;u>0&&o<i;)s[o]==="{"?u++:s[o]==="}"&&u--,o++,a++;continue}if(c==="`"){for(o++,a++;o<i&&s[o]!=="`";)s[o]==="\\"&&o+1<i?(o+=2,a+=2):(o++,a++);o<i&&(o++,a++);continue}o++,a++}let l=s.slice(t,o);return this.pos=o,this.column=a,{type:E.WORD,value:l,start:t,end:o,line:n,column:r,quoted:!1,singleQuoted:!1}}scanBraceExpansion(t){let n=this.input,r=n.length,s=t+1,i=1,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(l==="{")i++,s++;else if(l==="}")i--,s++;else if(l===","&&i===1)o=!0,s++;else if(l==="."&&s+1<r&&n[s+1]===".")a=!0,s+=2;else{if(l===" "||l===" "||l===`
|
|
769
|
+
`||l===";"||l==="&"||l==="|")return null;s++}}return i===0&&(o||a)?n.slice(t,s):null}scanLiteralBraceWord(t){let n=this.input,r=n.length,s=t+1,i=1;for(;s<r&&i>0;){let o=n[s];if(o==="{")i++,s++;else if(o==="}"){if(i--,i===0)return n.slice(t,s+1);s++}else{if(o===" "||o===" "||o===`
|
|
770
|
+
`||o===";"||o==="&"||o==="|")return null;s++}}return null}scanExtglobPattern(t){let n=this.input,r=n.length,s=t+1,i=1;for(;s<r&&i>0;){let o=n[s];if(o==="\\"&&s+1<r){s+=2;continue}if("@*+?!".includes(o)&&s+1<r&&n[s+1]==="("){s++,i++,s++;continue}if(o==="(")i++,s++;else if(o===")")i--,s++;else{if(o===`
|
|
771
|
+
`)return null;s++}}return i===0?{content:n.slice(t,s),end:s}:null}scanFdVariable(t){let n=this.input,r=n.length,s=t+1,i=s;for(;s<r;){let u=n[s];if(s===i){if(!(u>="a"&&u<="z"||u>="A"&&u<="Z"||u==="_"))return null}else if(!(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||u==="_"))break;s++}if(s===i)return null;let o=n.slice(i,s);if(s>=r||n[s]!=="}"||(s++,s>=r))return null;let a=n[s],l=s+1<r?n[s+1]:"";return a===">"||a==="<"||a==="&"&&(l===">"||l==="<")?{varname:o,end:s}:null}dollarDparenIsSubshell(t){let n=this.input,r=n.length,s=t+1,i=2,o=!1,a=!1,l=!1;for(;s<r&&i>0;){let c=n[s];if(o){c==="'"&&(o=!1),c===`
|
|
772
|
+
`&&(l=!0),s++;continue}if(a){if(c==="\\"){s+=2;continue}c==='"'&&(a=!1),c===`
|
|
773
|
+
`&&(l=!0),s++;continue}if(c==="'"){o=!0,s++;continue}if(c==='"'){a=!0,s++;continue}if(c==="\\"){s+=2;continue}if(c===`
|
|
774
|
+
`&&(l=!0),c==="("){i++,s++;continue}if(c===")"){if(i--,i===1){let u=s+1;if(u<r&&n[u]===")")return!1;let f=u,p=!1;for(;f<r&&(n[f]===" "||n[f]===" "||n[f]===`
|
|
775
|
+
`);)p=!0,f++;if(p&&f<r&&n[f]===")"||l)return!0}if(i===0)return!1;s++;continue}s++}return!1}dparenClosesWithSpacedParens(t){let n=this.input,r=n.length,s=t,i=2,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(o){l==="'"&&(o=!1),s++;continue}if(a){if(l==="\\"){s+=2;continue}l==='"'&&(a=!1),s++;continue}if(l==="'"){o=!0,s++;continue}if(l==='"'){a=!0,s++;continue}if(l==="\\"){s+=2;continue}if(l==="("){i++,s++;continue}if(l===")"){if(i--,i===1){let c=s+1;if(c<r&&n[c]===")")return!1;let u=c,f=!1;for(;u<r&&(n[u]===" "||n[u]===" "||n[u]===`
|
|
776
|
+
`);)f=!0,u++;if(f&&u<r&&n[u]===")")return!0}if(i===0)return!1;s++;continue}if(i===1&&(l==="|"&&s+1<r&&n[s+1]==="|"||l==="&"&&s+1<r&&n[s+1]==="&"||l==="|"&&s+1<r&&n[s+1]!=="|"))return!0;s++}return!1}}});var Qc,Xc,J2,Yc,eg,tg,ng,Ct,Kr=I(()=>{"use strict";yr();Qc=1e6,Xc=1e5,J2=1e6,Yc=200,eg=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),tg=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS]),ng=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),Ct=class extends Error{line;column;token;constructor(t,n,r,s=void 0){super(`Parse error at ${n}:${r}: ${t}`),this.line=n,this.column=r,this.token=s,this.name="ParseException"}}});function et(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
|
|
777
|
+
`){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function ki(e){if(e.includes("#")){let[n,r]=e.split("#"),s=Number.parseInt(n,10);if(s<2||s>64)return Number.NaN;if(s<=36){let o=Number.parseInt(r,s);return o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:o}let i=0;for(let o of r){let a;if(/[0-9]/.test(o))a=o.charCodeAt(0)-48;else if(/[a-z]/.test(o))a=o.charCodeAt(0)-97+10;else if(/[A-Z]/.test(o))a=o.charCodeAt(0)-65+36;else if(o==="@")a=62;else if(o==="_")a=63;else return Number.NaN;if(a>=s)return Number.NaN;if(i=i*s+a,i>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return i}if(e.startsWith("0x")||e.startsWith("0X")){let n=Number.parseInt(e.slice(2),16);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let n=Number.parseInt(e,8);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function rg(e,t,n,r){if(n.slice(r,r+3)!=="$((")return null;let s=r+3,i=1,o=s;for(;s<n.length-1&&i>0;)n[s]==="("&&n[s+1]==="("?(i++,s+=2):n[s]===")"&&n[s+1]===")"?(i--,i>0&&(s+=2)):s++;let a=n.slice(o,s),{expr:l}=e(t,a,0);return s+=2,{expr:{type:"ArithNested",expression:l},pos:s}}function sg(e,t){if(e.slice(t,t+2)!=="$'")return null;let n=t+2,r="";for(;n<e.length&&e[n]!=="'";)if(e[n]==="\\"&&n+1<e.length){let i=e[n+1];switch(i){case"n":r+=`
|
|
778
|
+
`;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"'":r+="'";break;default:r+=i}n+=2}else r+=e[n],n++;e[n]==="'"&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function ig(e,t){if(e.slice(t,t+2)!=='$"')return null;let n=t+2,r="";for(;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]==='"'&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}var Xo,og=I(()=>{"use strict";Xo=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="]});function VA(e){let t="",n=0;for(;n<e.length;)if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function Ne(e,t){let n=VA(t),{expr:r,pos:s}=sn(e,n,0),i=et(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function Kt(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Qt(e,t){return et(e,t)>=e.length}function sn(e,t,n){return qA(e,t,n)}function qA(e,t,n){let{expr:r,pos:s}=Ni(e,t,n);for(s=et(t,s);t[s]===",";){if(s++,Qt(t,s))return Kt(",",s);let{expr:o,pos:a}=Ni(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=et(t,a)}return{expr:r,pos:s}}function Ni(e,t,n){let{expr:r,pos:s}=ZA(e,t,n);if(s=et(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=sn(e,t,s);if(s=et(t,o),t[s]===":"){s++;let{expr:a,pos:l}=sn(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function ZA(e,t,n){let{expr:r,pos:s}=ag(e,t,n);for(;s=et(t,s),t.slice(s,s+2)==="||";){if(s+=2,Qt(t,s))return Kt("||",s);let{expr:o,pos:a}=ag(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function ag(e,t,n){let{expr:r,pos:s}=lg(e,t,n);for(;s=et(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Qt(t,s))return Kt("&&",s);let{expr:o,pos:a}=lg(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function lg(e,t,n){let{expr:r,pos:s}=cg(e,t,n);for(;s=et(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Qt(t,s))return Kt("|",s);let{expr:o,pos:a}=cg(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function cg(e,t,n){let{expr:r,pos:s}=ug(e,t,n);for(;s=et(t,s),t[s]==="^";){if(s++,Qt(t,s))return Kt("^",s);let{expr:o,pos:a}=ug(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function ug(e,t,n){let{expr:r,pos:s}=fg(e,t,n);for(;s=et(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Qt(t,s))return Kt("&",s);let{expr:o,pos:a}=fg(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function fg(e,t,n){let{expr:r,pos:s}=pg(e,t,n);for(;s=et(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=pg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function pg(e,t,n){let{expr:r,pos:s}=Jc(e,t,n);for(;;)if(s=et(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Jc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Jc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Jc(e,t,n){let{expr:r,pos:s}=hg(e,t,n);for(;s=et(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=hg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function hg(e,t,n){let{expr:r,pos:s}=dg(e,t,n);for(;s=et(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=dg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function dg(e,t,n){let{expr:r,pos:s}=Yo(e,t,n);for(;;)if(s=et(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Qt(t,s))return Kt("*",s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Yo(e,t,n){let{expr:r,pos:s}=eu(e,t,n),i=et(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Qt(t,i))return Kt("**",i);let{expr:a,pos:l}=Yo(e,t,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function eu(e,t,n){let r=et(t,n);if(t.slice(r,r+2)==="++"||t.slice(r,r+2)==="--"){let s=t.slice(r,r+2);r+=2;let{expr:i,pos:o}=eu(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=eu(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return QA(e,t,r)}function KA(e,t){let n=e[t];return n==="$"||n==="`"}function QA(e,t,n){let{expr:r,pos:s}=mg(e,t,n,!1),i=[r];for(;KA(t,s);){let{expr:a,pos:l}=mg(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=sn(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=et(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Xo)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=Ni(e,t,s);return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function mg(e,t,n,r=!1){let s=et(t,n),i=rg(sn,e,t,s);if(i)return i;let o=sg(t,s);if(o)return o;let a=ig(t,s);if(a)return a;if(t.slice(s,s+2)==="$("&&t[s+2]!=="("){s+=2;let c=1,u=s;for(;s<t.length&&c>0;)t[s]==="("?c++:t[s]===")"&&c--,c>0&&s++;let f=t.slice(u,s);return s++,{expr:{type:"ArithCommandSubst",command:f},pos:s}}if(t[s]==="`"){s++;let c=s;for(;s<t.length&&t[s]!=="`";)s++;let u=t.slice(c,s);return t[s]==="`"&&s++,{expr:{type:"ArithCommandSubst",command:u},pos:s}}if(t[s]==="("){s++;let{expr:c,pos:u}=sn(e,t,s);return s=et(t,u),t[s]===")"&&s++,{expr:{type:"ArithGroup",expression:c},pos:s}}if(t[s]==="'"){s++;let c="";for(;s<t.length&&t[s]!=="'";)c+=t[s],s++;t[s]==="'"&&s++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:s}}if(t[s]==='"'){s++;let c="";for(;s<t.length&&t[s]!=='"';)t[s]==="\\"&&s+1<t.length?(c+=t[s+1],s+=2):(c+=t[s],s++);t[s]==='"'&&s++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:s};let{expr:f}=sn(e,u,0);return{expr:f,pos:s}}if(/[0-9]/.test(t[s])){let c="",u=!1,f=!1;for(;s<t.length;){let h=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(h))c+=h,s++;else break;else if(h==="#")u=!0,c+=h,s++;else if(c==="0"&&(h==="x"||h==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=h,s++;else if(f&&/[0-9a-fA-F]/.test(h))c+=h,s++;else if(!f&&/[0-9]/.test(h))c+=h,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let h=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)h+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:h,message:`${h}: value too great for base (error token is "${h}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new De(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let h=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:h},pos:t.length}}return{expr:{type:"ArithNumber",value:ki(c)},pos:s}}if(t[s]==="$"&&t[s+1]==="{"){let c=s+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let p=t.slice(c,f),h=f+1;if(t[h]==="#"){let d=h+1;for(;d<t.length&&/[0-9a-zA-Z@_]/.test(t[d]);)d++;let m=t.slice(h+1,d);return{expr:{type:"ArithDynamicBase",baseExpr:p,value:m},pos:d}}if(/[0-9]/.test(t[h])||t[h]==="x"||t[h]==="X"){let d=h;if(t[h]==="x"||t[h]==="X")for(d++;d<t.length&&/[0-9a-fA-F]/.test(t[d]);)d++;else for(;d<t.length&&/[0-9]/.test(t[d]);)d++;let m=t.slice(h,d);return{expr:{type:"ArithDynamicNumber",prefix:p,suffix:m},pos:d}}return s=h,{expr:{type:"ArithBracedExpansion",content:p},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[0-9]/.test(t[s+1])){s++;let c="";for(;s<t.length&&/[0-9]/.test(t[s]);)c+=t[s],s++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[*@#?\-!$]/.test(t[s+1])){let c=t[s+1];return s+=2,{expr:{type:"ArithSpecialVar",name:c},pos:s}}let l=!1;if(t[s]==="$"&&s+1<t.length&&/[a-zA-Z_]/.test(t[s+1])&&(l=!0,s++),s<t.length&&/[a-zA-Z_]/.test(t[s])){let c="";for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)c+=t[s],s++;if(t[s]==="["&&!r){s++;let u;if(t[s]==="'"||t[s]==='"'){let p=t[s];for(s++,u="";s<t.length&&t[s]!==p;)u+=t[s],s++;t[s]===p&&s++,s=et(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:p,pos:h}=sn(e,t,s);f=p,s=h,t[s]==="]"&&s++}if(s=et(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let p of Xo)if(t.slice(s,s+p.length)===p&&t.slice(s,s+p.length+1)!=="=="){s+=p.length;let{expr:h,pos:d}=Ni(e,t,s);return{expr:{type:"ArithAssignment",operator:p,variable:c,subscript:f,stringKey:u,value:h},pos:d}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=et(t,s),!r){for(let u of Xo)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:p}=Ni(e,t,s);return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:p}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
|
|
779
|
+
`;)c++;let u=t.slice(s,c).trim()||"#";return{expr:{type:"ArithSyntaxError",errorToken:u,message:`${u}: syntax error: invalid arithmetic operator (error token is "${u}")`},pos:t.length}}return{expr:{type:"ArithNumber",value:0},pos:s}}var Pt=I(()=>{"use strict";we();og()});function XA(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=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){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=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){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function wg(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function tu(e,t,n,r,s){let i=1,o=n+1;for(;o<t.length&&i>0;)t[o]===r?i++:t[o]===s&&i--,i>0&&o++;return i===0?o:-1}function Qr(e,t,n){let r=n,s=1;for(;r<t.length&&s>0;){let i=t[r];if(i==="\\"&&r+1<t.length){r+=2;continue}if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}i==="{"?s++:i==="}"&&s--,s>0&&r++}return r}function bg(e,t,n){let r=n,s=!1;for(;r<t.length;){let i=t[r];if(i==="/"&&s||i==="}")break;if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1,s=!0;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++,s=!0;continue}i==="\\"?(r+=2,s=!0):(r++,s=!0)}return r}function xg(e,t,n){let r=n,s="";for(;r<t.length;){let i=t[r];if(i==="*"||i==="?")s+=i,r++;else if(i==="["){let o=YA(t,r);o===-1?(s+=i,r++):(s+=t.slice(r,o+1),r=o+1)}else break}return{pattern:s,endIndex:r}}function YA(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){let s=e[n+1];if(s==='"'||s==="'")return-1;n+=2;continue}if(r==="]")return n;if(r==='"'||r==="$"||r==="`")return-1;if(r==="'"){let s=e.indexOf("'",n+1);if(s!==-1){n=s+1;continue}}if(r==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){n=s+2;continue}}if(r==="["&&n+1<e.length&&(e[n+1]==="."||e[n+1]==="=")){let i=`${e[n+1]}]`,o=e.indexOf(i,n+2);if(o!==-1){n=o+2;continue}}n++}return-1}function Eg(e,t,n){let r="",s=n;for(;s<t.length&&t[s]!=="'";){let i=t[s];if(i==="\\"&&s+1<t.length)switch(t[s+1]){case"n":r+=`
|
|
780
|
+
`,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let a=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)a.push(u),l+=2+c.length;else break}a.length>0?(r+=XA(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:J.literal(r),endIndex:s}}function nu(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ne(e,n)}function yg(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function Ag(e,t,n,r){let s=tu(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:yg(i).map(u=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:yg(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function ru(e,t){let n="";for(let r of t.parts)switch(r.type){case"Literal":n+=r.value;break;case"SingleQuoted":n+=`'${r.value}'`;break;case"Escaped":n+=r.value;break;case"DoubleQuoted":n+='"';for(let s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.parameter}}`);n+='"';break;case"ParameterExpansion":n+=`\${${r.parameter}}`;break;case"Glob":n+=r.pattern;break;case"TildeExpansion":n+="~",r.user&&(n+=r.user);break;case"BraceExpansion":{n+="{";let s=[];for(let i of r.items)if(i.type==="Range"){let o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(ru(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function Sg(e,t){return{[E.LESS]:"<",[E.GREAT]:">",[E.DGREAT]:">>",[E.LESSAND]:"<&",[E.GREATAND]:">&",[E.LESSGREAT]:"<>",[E.CLOBBER]:">|",[E.TLESS]:"<<<",[E.AND_GREAT]:"&>",[E.AND_DGREAT]:"&>>",[E.DLESS]:"<",[E.DLESSDASH]:"<"}[t]||">"}var su=I(()=>{"use strict";Zr();Pt();yr()});function Jo(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:tg.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return ng.has(r.type)}return eg.has(n)}function ea(e){let t=null,n;e.check(E.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(E.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=Sg(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return JA(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function JA(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,o=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),n);return e.addPendingHeredoc(a,i,r,o),a}function vg(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Jo(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(eS(e)):i.push(ea(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Jo(e))i.push(ea(e));else if(e.check(E.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let a=e.advance(),l=a.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(E.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(E.LPAREN);let p=iu(e);e.expect(E.RPAREN);let h=p.map(m=>ru(e,m)),d=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(d,!1,!1))}else s.push(e.parseWordFromString(l,a.quoted,a.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function eS(e){let t=e.expect(E.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,o=s.length;if(n[o]==="["){let f=0,p=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=n.slice(p,o),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=iu(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=iu(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return J.assignment(h,null,a,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}function iu(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):tS.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var tS,kg=I(()=>{"use strict";Zr();yr();Kr();su();tS=new Set([E.AMP,E.PIPE,E.PIPE_AMP,E.SEMICOLON,E.AND_AND,E.OR_OR,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND])});function ou(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let a=e.parseCompoundList();e.expect(E.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:a,body:l})}let i=null;e.check(E.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(E.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function au(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return rS(e,t,n.line);e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(E.IN))for(e.advance(),i=[];!e.check(E.SEMICOLON,E.NEWLINE,E.DO,E.EOF)&&e.isWord();)i.push(e.parseWord());e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(E.DO);let o=e.parseCompoundList();e.expect(E.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function rS(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(E.DPAREN_END),o[0].trim()&&(r=Ne(e,o[0].trim())),o[1].trim()&&(s=Ne(e,o[1].trim())),o[2].trim()&&(i=Ne(e,o[2].trim())),e.skipNewlines(),e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(E.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(E.RBRACE)):(e.expect(E.DO),c=e.parseCompoundList(),e.expect(E.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function lu(e,t){e.expect(E.WHILE);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.whileNode(n,r,s)}function cu(e,t){e.expect(E.UNTIL);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.untilNode(n,r,s)}function uu(e,t){e.expect(E.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(E.IN),e.skipNewlines();let r=[];for(;!e.check(E.ESAC,E.EOF);){e.checkIterationLimit();let i=e.getPos(),o=sS(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function sS(e){e.check(E.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(E.PIPE));)e.advance();if(t.length===0)return null;e.expect(E.RPAREN),e.skipNewlines();let n=[];for(;!e.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND,E.ESAC,E.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===E.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(E.LPAREN)&&e.peek(1).type===E.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(E.DSEMI)?(e.advance(),r=";;"):e.check(E.SEMI_AND)?(e.advance(),r=";&"):e.check(E.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),J.caseItem(t,n,r)}function fu(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function pu(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var Ng=I(()=>{"use strict";Zr();Pt();yr()});function Ig(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function $g(e){if(e.check(E.BANG)&&e.peek(1).type===E.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(E.EOF);)if(e.check(E.LPAREN))t++,n+="(",e.advance();else if(e.check(E.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(E.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function du(e){return e.skipNewlines(),lS(e)}function lS(e){let t=Tg(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=Tg(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function Tg(e){let t=hu(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=hu(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function hu(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:hu(e)}):cS(e)}function cS(e){if(e.check(E.LPAREN)){e.advance();let t=du(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if(Ig(e)){let t=e.current(),n=t.value;if(oS.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),Ig(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&aS.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=uS(e):s==="=="||s==="!="?i=$g(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(E.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(E.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=$g(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function uS(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(E.DBRACK_END)||e.check(E.AND_AND)||e.check(E.OR_OR)||e.check(E.NEWLINE)||e.check(E.EOF);for(;!i();){let o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(E.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(E.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(E.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(E.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(E.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(E.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(E.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(E.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(E.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(E.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(E.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(E.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(E.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(E.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(E.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(E.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(E.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(E.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(E.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}var oS,aS,Og=I(()=>{"use strict";yr();oS=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],aS=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function Ii(e){return e.length>0?e:[J.literal("")]}function pS(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function hS(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function dS(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=tu(e,t,s,"[","]");if(a+=t.slice(s,u+1),s=u+1,t[s]==="["){let f=1,p=s;for(;p<t.length&&f>0;)t[p]==="{"?f++:t[p]==="}"&&f--,f>0&&p++;let h=t.slice(n+2,p);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+1}}}if(a===""&&!i&&!o&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new Ct("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=mu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=mu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=mu(e,t,s,a,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let p=t.slice(n,f+1);e.error(`\${${p.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new Ct("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function mu(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let y=Qr(e,t,i),w=t.slice(i,y),b=wr(e,w,!1,!1,!0,!1,s,!1,!1,!0),x=J.word(Ii(b));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:y};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:y};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:y};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:y}}i++;let c=Qr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let y=u[g];if(y==="("||y==="[")p++;else if(y===")"||y==="]")p--;else if(y==="?"&&p===0)h++;else if(y===":"&&p===0)if(h>0)h--;else{f=g;break}}let d=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:nu(e,d),length:m!==null?nu(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=Qr(e,t,i),c=t.slice(i,l),u=wr(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=J.word(Ii(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=Qr(e,t,i),f=t.slice(i,u),p=wr(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:J.word(Ii(p)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=bg(e,t,i);let f=t.slice(i,u),p=wr(e,f,!1,!1,!1),h=J.word(Ii(p)),d=null,m=u;if(t[u]==="/"){let g=u+1,y=Qr(e,t,g),w=t.slice(g,y),b=wr(e,w,!1,!1,!1);d=J.word(Ii(b)),m=y}return{operation:{type:"PatternReplacement",pattern:h,replacement:d,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=Qr(e,t,i),f=t.slice(i,u),p=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function gu(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=Ne(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?dS(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?hS(e,t,n):{part:J.literal("$"),endIndex:s}}function Rg(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=gu(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function mS(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=gu(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:J.doubleQuoted(r),endIndex:s}}function wr(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1){if(r)return[J.singleQuoted(t)];if(n){let d=Rg(e,t);return[J.doubleQuoted(d)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let d=t.slice(1,-1),m=!1;for(let g=0;g<d.length;g++){if(d[g]==='"'){m=!0;break}d[g]==="\\"&&g+1<d.length&&g++}if(!m){let g=Rg(e,d);return[J.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(J.literal(p)),p="")};for(;f<t.length;){let d=t[f];if(d==="\\"&&f+1<t.length){let m=t[f+1];if(l){h(),u.push(J.escaped(m)),f+=2;continue}let g=i?m==="$"||m==="`"||m===`
|
|
781
|
+
`:m==="$"||m==="`"||m==='"'||m==="'"||m===`
|
|
782
|
+
`||c&&m==="}",y=o?"*?[]\\".includes(m):"*?[]\\(){}.^+".includes(m);g?p+=m:y?(h(),u.push(J.escaped(m))):p+=`\\${m}`,f+=2;continue}if(d==="'"&&!o&&!i){h();let m=t.indexOf("'",f+1);if(m===-1){p+=t.slice(f);break}u.push(J.singleQuoted(t.slice(f+1,m))),f=m+1;continue}if(d==='"'&&!i){h();let{part:m,endIndex:g}=mS(e,t,f+1);u.push(m),f=g+1;continue}if(d==="$"&&t[f+1]==="'"){h();let{part:m,endIndex:g}=Eg(e,t,f+2);u.push(m),f=g;continue}if(d==="$"){h();let{part:m,endIndex:g}=gu(e,t,f);m&&u.push(m),f=g;continue}if(d==="`"){h();let{part:m,endIndex:g}=e.parseBacktickSubstitution(t,f);u.push(m),f=g;continue}if(d==="~"){let m=f>0?t[f-1]:"";if(f===0||m==="="||s&&m===":"){let y=wg(e,t,f),w=t[y];if(w===void 0||w==="/"||w===":"){h();let b=t.slice(f+1,y)||null;u.push({type:"TildeExpansion",user:b}),f=y;continue}}}if("@*+?!".includes(d)&&f+1<t.length&&t[f+1]==="("){let m=pS(t,f+1);if(m!==-1){h();let g=t.slice(f,m+1);u.push({type:"Glob",pattern:g}),f=m+1;continue}}if(d==="*"||d==="?"||d==="["){h();let{pattern:m,endIndex:g}=xg(e,t,f);u.push({type:"Glob",pattern:m}),f=g;continue}if(d==="{"&&!s&&!a&&!i){let m=Ag(e,t,f,wr);if(m){h(),u.push(m.part),f=m.endIndex;continue}}p+=d,f++}return h(),u}var Pg=I(()=>{"use strict";Zr();Pt();Kr();su()});function In(e,t){return new pe().parse(e,t)}var pe,ft=I(()=>{"use strict";Zr();Pt();kg();Ng();Og();Pg();yr();Kc();Kr();Kr();pe=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>J2)throw new Ct("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Yc)throw new Ct(`Maximum parser nesting depth exceeded (${Yc})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Qc)throw new Ct(`Input too large: ${t.length} bytes exceeds limit of ${Qc}`,1,1);this._input=t;let r=new Qo(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Xc)throw new Ct(`Too many tokens: ${this.tokens.length} exceeds limit of ${Xc}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(t){return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}check(t,n,r,s,...i){let o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new Ct(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new Ct(t,n.line,n.column,n)}skipNewlines(){for(;this.check(E.NEWLINE,E.COMMENT);)this.check(E.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(E.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(E.SEMICOLON,E.COMMENT)){this.advance();continue}if(t&&this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(E.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.hereDoc(t.delimiter,r,t.stripTabs,t.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(E.EOF,E.NEWLINE,E.SEMICOLON,E.AMP,E.AND_AND,E.OR_OR,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.ASSIGNMENT_WORD||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.LPAREN||t===E.LBRACE||t===E.DPAREN_START||t===E.DBRACK_START||t===E.FUNCTION||t===E.BANG||t===E.TIME||t===E.IN||t===E.LESS||t===E.GREAT||t===E.DLESS||t===E.DGREAT||t===E.LESSAND||t===E.GREATAND||t===E.LESSGREAT||t===E.DLESSDASH||t===E.CLOBBER||t===E.TLESS||t===E.AND_GREAT||t===E.AND_DGREAT}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(E.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,o=this.parseStatement();o&&t.push(o),this.skipSeparators(!1),this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(E.EOF)&&this.advance()}return J.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if((t===E.DO||t===E.DONE||t===E.THEN||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.RBRACE||t===E.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),J.statement([J.pipeline([J.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===E.DSEMI||t===E.SEMI_AND||t===E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===E.PIPE||t===E.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(E.AND_AND,E.OR_OR);){let l=this.advance();r.push(l.type===E.AND_AND?"&&":"||"),this.skipNewlines(),this.isCommandStart()||this.errorExpectedCommand();let c=this.parsePipeline();n.push(c)}this.check(E.AMP)&&(this.advance(),s=!0);let o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}parsePipeline(){let t=!1,n=!1;this.check(E.TIME)&&(this.advance(),t=!0,this.check(E.WORD,E.NAME)&&this.current().value==="-p"&&(this.advance(),n=!0));let r=0;for(;this.check(E.BANG);)this.advance(),r++;let s=r%2===1,i=[],o=[],a=this.parseCommand();for(i.push(a);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===E.PIPE_AMP),this.isCommandStart()||this.errorExpectedCommand();let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){return this.check(E.IF)?ou(this):this.check(E.FOR)?au(this):this.check(E.WHILE)?lu(this):this.check(E.UNTIL)?cu(this):this.check(E.CASE)?uu(this):this.check(E.LPAREN)?fu(this):this.check(E.LBRACE)?pu(this):this.check(E.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(E.DBRACK_START)?this.parseConditionalCommand():this.check(E.FUNCTION)?this.parseFunctionDef():this.check(E.NAME,E.WORD)&&this.peek(1).type===E.LPAREN&&this.peek(2).type===E.RPAREN?this.parseFunctionDef():vg(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===E.EOF)return!1;if(r.type===E.DPAREN_START||r.type===E.LPAREN)t++;else if(r.type===E.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===E.RPAREN&&(t--,t===0&&this.peek(n+1).type===E.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(E.RPAREN),this.expect(E.RPAREN);let n=this.parseOptionalRedirections(),r=J.subshell(t,[]);return J.subshell([J.statement([J.pipeline([r],!1,!1,!1)])],n)}errorExpectedCommand(){this.check(E.EOF)&&this.error("syntax error near unexpected end of input"),this.error(`syntax error near unexpected token \`${this.current().value}'`)}isWord(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.FUNCTION||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.THEN||t===E.DO||t===E.DONE||t===E.ESAC||t===E.IN||t===E.SELECT||t===E.TIME||t===E.COPROC||t===E.BANG}parseWord(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted)}parseWordNoBraceExpansion(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0)}parseWordForRegex(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0,!0)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1){let l=wr(this,t,n,r,s,i,!1,o,a);return J.word(l)}parseCommandSubstitution(t,n){return q2(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return Z2(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return V2(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,o=!0;continue}n+=")";continue}if(this.check(E.DPAREN_START))r++,n+="((",this.advance();else if(this.check(E.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,o=!0,r>0&&(n+="))"),this.advance());else if(this.check(E.LPAREN))s++,n+="(",this.advance();else if(this.check(E.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}o||this.expect(E.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=du(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return J.conditionalCommand(n,r,t.line)}parseFunctionDef(){let t;if(this.check(E.FUNCTION)){if(this.advance(),this.check(E.NAME)||this.check(E.WORD))t=this.advance().value;else{let s=this.current();throw new Ct("Expected function name",s.line,s.column,s)}this.check(E.LPAREN)&&(this.advance(),this.expect(E.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(E.LPAREN),this.expect(E.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return pu(this,{skipRedirections:n});if(this.check(E.LPAREN))return fu(this,{skipRedirections:n});if(this.check(E.IF))return ou(this,{skipRedirections:n});if(this.check(E.FOR))return au(this,{skipRedirections:n});if(this.check(E.WHILE))return lu(this,{skipRedirections:n});if(this.check(E.UNTIL))return cu(this,{skipRedirections:n});if(this.check(E.CASE))return uu(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth(),n=[];for(this.skipNewlines();!this.check(E.EOF,E.FI,E.ELSE,E.ELIF,E.THEN,E.DO,E.DONE,E.ESAC,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return t(),n}parseOptionalRedirections(){let t=[];for(;Jo(this);){this.checkIterationLimit();let n=this.pos;if(t.push(ea(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ne(this,t)}}});function wu(e){return wS.get(e)??""}function Ug(e){let t=[],n="",r=0;for(;r<e.length;){let s=e[r];if(s==="["){for(n+=s,r++,r<e.length&&(e[r]==="!"||e[r]==="^")&&(n+=e[r],r++),r<e.length&&e[r]==="]"&&(n+=e[r],r++);r<e.length&&e[r]!=="]";){if(e[r]==="["&&r+1<e.length&&e[r+1]===":"){let i=e.indexOf(":]",r+2);if(i!==-1){n+=e.slice(r,i+2),r=i+2;continue}}if(e[r]==="\\"&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]==="]"&&(n+=e[r],r++)}else s===":"?(n!==""&&t.push(n),n="",r++):s==="\\"&&r+1<e.length?(n+=s+e[r+1],r+=2):(n+=s,r++)}return n!==""&&t.push(n),t}function Bg(e){let t="^";for(let n=0;n<e.length;n++){let r=e[n];if(r==="*")t+="[^/]*";else if(r==="?")t+="[^/]";else if(r==="["){let s=n+1,i="[";s<e.length&&(e[s]==="^"||e[s]==="!")&&(i+="^",s++),s<e.length&&e[s]==="]"&&(i+="\\]",s++);let o=s;for(;o<e.length;){if(e[o]==="\\"&&o+1<e.length){o+=2;continue}if(e[o]==="["&&o+1<e.length&&e[o+1]===":"){let l=e.indexOf(":]",o+2);if(l!==-1){o=l+2;continue}}if(e[o]==="]")break;o++}let a=s;for(;s<e.length&&e[s]!=="]";){if(e[s]==="["&&s+1<e.length&&e[s+1]===":"){let l=e.indexOf(":]",s+2);if(l!==-1){let c=e.slice(s+2,l),u=wu(c);i+=u,s=l+2;continue}}if(e[s]==="\\"&&s+1<e.length){i+=`\\${e[s+1]}`,s+=2;continue}if(e[s]==="-"){let l=s===a,c=s+1===o;l||c?i+="\\-":i+="-"}else i+=e[s];s++}i+="]",t+=i,n=s}else if(r==="\\"&&n+1<e.length){let s=e[n+1];/[.+^${}()|\\*?[\]]/.test(s)?t+=`\\${s}`:t+=s,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+="$",X(t)}function bu(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function xu(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let o=e[i];if(o==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(o==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=o,i++;continue}if(o==="\\"){n+=o,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}o==="("?(r++,n+=o):o===")"?(r--,n+=o):o==="|"&&r===0?(t.push(n),n=""):n+=o,i++}return t.push(n),t}var wS,Wg=I(()=>{"use strict";Qe();wS=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]])});var zg,br,ta=I(()=>{"use strict";we();Qe();is();Wg();zg=5,br=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(t,n,r,s){this.fs=t,this.cwd=n,typeof s=="boolean"?(this.globstar=s,this.maxOps=1e5):s?(this.globstar=s.globstar??!1,this.nullglob=s.nullglob??!1,this.failglob=s.failglob??!1,this.dotglob=s.dotglob??!1,this.extglob=s.extglob??!1,this.globskipdots=s.globskipdots??!0,this.maxOps=s.maxGlobOperations??1e5):this.maxOps=1e5;let i=r?.get("GLOBIGNORE");i!==void 0&&i!==""&&(this.hasGlobignore=!0,this.globignorePatterns=Ug(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new K(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations")}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(t){return!this.hasGlobignore&&!this.globskipdots?t:t.filter(n=>{let r=n.split("/").pop()||n;if((this.hasGlobignore||this.globskipdots)&&(r==="."||r===".."))return!1;if(this.hasGlobignore){for(let s of this.globignorePatterns)if(this.matchGlobignorePattern(n,s))return!1}return!0})}matchGlobignorePattern(t,n){return Bg(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((o,a)=>(n?.[a]??!1)||!this.isGlobPattern(o)?null:this.expand(o)),s=await Promise.all(r.map(o=>o||Promise.resolve(null))),i=[];for(let o=0;o<t.length;o++){let a=s[o];a===null?i.push(t[o]):a.length>0?i.push(...a):i.push(t[o])}return i}async expand(t){if(this.globstar){let r=t.split("/"),s=0;for(let i of r)if(i==="**"&&(s++,s>zg))throw new K(`Glob pattern has too many ** segments (max ${zg})`,"glob_operations")}let n;if(t.includes("**")&&this.globstar&&this.isGlobstarValid(t))n=await this.expandRecursive(t);else{let r=t.replace(/\*\*+/g,"*");n=await this.expandSimple(r)}return this.filterGlobignore(n)}isGlobstarValid(t){let n=t.split("/");for(let r of n)if(r.includes("**")&&r!=="**")return!1;return!0}hasGlobChars(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandSimple(t){let n=t.startsWith("/"),r=t.split("/").filter(c=>c!==""),s=-1;for(let c=0;c<r.length;c++)if(this.hasGlobChars(r[c])){s=c;break}if(s===-1)return[t];let i,o;if(s===0)n?(i="/",o="/"):(i=this.cwd,o="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,o=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),o=c.join("/"))}let a=r.slice(s);return(await this.expandSegments(i,o,a)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,o=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let a=await this.fs.readdirWithFileTypes(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let p=a.some(d=>d.name==="."),h=a.some(d=>d.name==="..");p||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),h||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let p of c)if(!(p.name.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p.name,s)){let h=t==="/"?`/${p.name}`:`${t}/${p.name}`,d;n===""?d=p.name:n==="/"?d=`/${p.name}`:d=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([d])):p.isDirectory&&l.push(this.expandSegments(h,d,i))}let f=await Promise.all(l);for(let p of f)o.push(...p)}else{this.checkOpsLimit();let a=await this.fs.readdir(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(a.includes(".")||c.push("."),a.includes("..")||c.push(".."));for(let p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,d;n===""?d=p:n==="/"?d=`/${p}`:d=`${n}/${p}`,i.length===0?l.push(Promise.resolve([d])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,d,i)}catch(m){if(m instanceof K)throw m}return[]})())}let f=await Promise.all(l);for(let p of f)o.push(...p)}}catch(a){if(a instanceof K)throw a}return o}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",o=t.slice(r+2).replace(/^\//,"");return o.includes("**")&&this.isGlobstarValid(o)?(await this.walkDirectoryMultiGlobstar(s,o,n),[...new Set(n)].sort()):(await this.walkDirectory(s,o,n),n.sort())}async walkDirectoryMultiGlobstar(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(s):null;if(i){let o=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&o.push(u)}let a=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(a);r.push(...l);for(let c=0;c<o.length;c+=100){let u=o.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let o=await this.fs.readdir(s),a=[];for(let u of o){let f=t==="."?u:`${t}/${u}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&a.push(f)}catch(h){if(h instanceof K)throw h}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<a.length;u+=100){let f=a.slice(u,u+100);await Promise.all(f.map(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof K)throw i}}async walkDirectory(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(s),o=[],a=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?a.push(c):n&&this.matchPattern(l.name,n)&&o.push(c)}r.push(...o);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u,n,r)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(s),o=[];for(let l=0;l<i.length;l+=100){let c=i.slice(l,l+100),u=await Promise.all(c.map(async f=>{let p=t==="."?f:`${t}/${f}`,h=this.fs.resolvePath(this.cwd,p);try{this.checkOpsLimit();let d=await this.fs.stat(h);return{name:f,path:p,isDirectory:d.isDirectory}}catch(d){if(d instanceof K)throw d;return null}}));o.push(...u.filter(f=>f!==null))}for(let l of o)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let a=o.filter(l=>l.isDirectory);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof K)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return X(`^${n}$`)}patternToRegexStr(t){let n="",r=!1;for(let s=0;s<t.length;s++){if(t.slice(s,s+13)==="\0QUOTE_START\0"){r=!0,s+=12;continue}if(t.slice(s,s+11)==="\0QUOTE_END\0"){r=!1,s+=10;continue}let i=t[s];if(r){/[.+^${}()|\\*?[\]]/.test(i)?n+=`\\${i}`:n+=i;continue}if(this.extglob&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<t.length&&t[s+1]==="("){let o=bu(t,s+1);if(o!==-1){let a=t.slice(s+2,o),l=xu(a),c=l.map(f=>this.patternToRegexStr(f)),u=c.length>0?c.join("|"):"(?:)";if(i==="@")n+=`(?:${u})`;else if(i==="*")n+=`(?:${u})*`;else if(i==="+")n+=`(?:${u})+`;else if(i==="?")n+=`(?:${u})?`;else if(i==="!")if(o<t.length-1){let p=l.map(d=>this.computePatternLength(d));if(p.every(d=>d!==null)&&p.every(d=>d===p[0])&&p[0]!==null){let d=p[0];if(d===0)n+="(?:.+)";else{let m=[];d>0&&m.push(`.{0,${d-1}}`),m.push(`.{${d+1},}`),m.push(`(?!(?:${u})).{${d}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=o;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let o=s+1,a="[";o<t.length&&(t[o]==="^"||t[o]==="!")&&(a+="^",o++),o<t.length&&t[o]==="]"&&(a+="\\]",o++);let l=o;for(;l<t.length;){if(t[l]==="\\"&&l+1<t.length){l+=2;continue}if(t[l]==="["&&l+1<t.length&&t[l+1]===":"){let u=t.indexOf(":]",l+2);if(u!==-1){l=u+2;continue}}if(t[l]==="]")break;l++}let c=o;for(;o<t.length&&t[o]!=="]";){if(t[o]==="["&&o+1<t.length&&t[o+1]===":"){let u=t.indexOf(":]",o+2);if(u!==-1){let f=t.slice(o+2,u),p=wu(f);a+=p,o=u+2;continue}}if(t[o]==="\\"&&o+1<t.length){a+=`\\${t[o+1]}`,o+=2;continue}if(t[o]==="-"){let u=o===c,f=o+1===l;u||f?a+="\\-":a+="-"}else a+=t[o];o++}a+="]",n+=a,s=o}else if(i==="\\"&&s+1<t.length){let o=t[s+1];/[.+^${}()|\\*?[\]]/.test(o)?n+=`\\${o}`:n+=o,s++}else/[.+^${}()|]/.test(i)?n+=`\\${i}`:n+=i}return n}computePatternLength(t){let n=0,r=0,s=!1;for(;r<t.length;){if(t.slice(r,r+13)==="\0QUOTE_START\0"){s=!0,r+=13;continue}if(t.slice(r,r+11)==="\0QUOTE_END\0"){s=!1,r+=11;continue}let i=t[r];if(s){n+=1,r++;continue}if((i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&r+1<t.length&&t[r+1]==="("){let o=bu(t,r+1);if(o!==-1){if(i==="@"){let a=t.slice(r+2,o),c=xu(a).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=o+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let o=t.indexOf("]",r+1);if(o!==-1){n+=1,r=o+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}}});function Eu(e){for(let t=0;t<e.length;t++){if(e[t]==="\\"){t++;continue}if(e[t]==="$"){let n=e[t+1];if(n==="{"||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function bS(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n)return!1;for(let r of n)if(r.type==="DoubleQuoted"||r.type==="SingleQuoted")return!0;return!1}function Hg(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n||n.length===0)return!1;for(let r of n)if(r.type!=="DoubleQuoted"&&r.type!=="SingleQuoted")return!1;return!0}function $i(e){let t=!1,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1;for(let l of e){if((l.type==="SingleQuoted"||l.type==="DoubleQuoted")&&(t=!0,l.type==="DoubleQuoted"))for(let c of l.parts)c.type==="ParameterExpansion"&&(c.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!c.operation||c.operation.type==="PatternRemoval"||c.operation.type==="PatternReplacement")&&(s=!0),(c.operation?.type==="VarNamePrefix"||c.operation?.type==="ArrayKeys")&&(o=!0),c.operation?.type==="Indirection"&&(a=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),bS(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(o=!0),l.operation?.type==="Indirection"&&(a=!0)),l.type==="Glob"&&Eu(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:o,hasIndirection:a}}var na=I(()=>{"use strict"});function pt(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),o=Number.parseInt(i,10);!Number.isNaN(o)&&String(o)===i&&r.push(o)}return r.sort((s,i)=>s-i)}function Vn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function $n(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let o=i.slice(n.length);if(o.startsWith("_length"))continue;s.push(o)}return s.sort()}function ra(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Au(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let r,s=n,i=1;if(n.type==="Literal"&&n.value.startsWith("]")){let f=n.value.slice(1);if(f.startsWith("+=")||f.startsWith("="))r=t.pattern.slice(1);else if(f===""){if(e.parts.length<3)return null;let p=e.parts[2];if(p.type!=="Literal"||!p.value.startsWith("=")&&!p.value.startsWith("+="))return null;r=t.pattern.slice(1),s=p,i=2}else return null}else if(t.pattern==="["&&(n.type==="DoubleQuoted"||n.type==="SingleQuoted")){if(e.parts.length<3)return null;let f=e.parts[2];if(f.type!=="Literal"||!f.value.startsWith("]=")&&!f.value.startsWith("]+="))return null;if(n.type==="SingleQuoted")r=n.value;else{r="";for(let p of n.parts)(p.type==="Literal"||p.type==="Escaped")&&(r+=p.value)}s=f,i=2}else if(t.pattern.endsWith("]")){if(n.type!=="Literal"||!n.value.startsWith("=")&&!n.value.startsWith("+="))return null;r=t.pattern.slice(1,-1)}else return null;r=ra(r);let o;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?o=s.value.slice(1):o=s.value;let a=o.startsWith("+=");if(!a&&!o.startsWith("="))return null;let l=[],c=a?2:1,u=o.slice(c);u&&l.push({type:"Literal",value:u});for(let f=i+1;f<e.parts.length;f++){let p=e.parts[f];p.type==="BraceExpansion"?l.push({type:"Literal",value:xS(p)}):l.push(p)}return{key:r,valueParts:l,append:a}}function xS(e){return`{${e.items.map(n=>{if(n.type==="Range"){let r=n.startStr??String(n.start),s=n.endStr??String(n.end),i=`${r}..${s}`;return n.step&&(i+=`..${n.step}`),i}return Ds(n.word)}).join(",")}}`}function Ds(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value;break;case"Glob":t+=n.pattern;break;case"SingleQuoted":t+=n.value;break;case"DoubleQuoted":for(let r of n.parts)(r.type==="Literal"||r.type==="Escaped")&&(t+=r.value);break;case"Escaped":t+=n.value;break;case"BraceExpansion":t+="{",t+=n.items.map(r=>r.type==="Range"?`${r.startStr}..${r.endStr}${r.step?`..${r.step}`:""}`:Ds(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var bn=I(()=>{"use strict"});function wt(e){return e.get("IFS")??`
|
|
783
|
+
`}function Tt(e){return e.get("IFS")===""}function sa(e){let t=wt(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
|
|
784
|
+
`)return!1;return!0}function jg(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
|
|
785
|
+
`?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function ge(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}function AS(e){return ES.includes(e)}function Su(e){let t=new Set,n=new Set;for(let r of e)AS(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function Cu(e,t,n,r){if(t==="")return e===""?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:s,nonWhitespace:i}=Su(t),o=[],a=[],l=0;for(;l<e.length&&s.has(e[l]);)l++;if(l>=e.length)return{words:[],wordStarts:[]};if(i.has(e[l]))for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&!(n!==void 0&&o.length>=n);){let c=l;for(a.push(c);l<e.length;){let u=e[l];if(!r&&u==="\\"){l++,l<e.length&&l++;continue}if(s.has(u)||i.has(u))break;l++}if(o.push(e.substring(c,l)),l>=e.length)break;for(;l<e.length&&s.has(e[l]);)l++;if(l<e.length&&i.has(e[l])){for(l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&i.has(e[l])&&!(n!==void 0&&o.length>=n);)for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++}}return{words:o,wordStarts:a}}function ia(e,t){if(t==="")return{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:n,nonWhitespace:r}=Su(t),s=[],i=0,o=!1,a=!1,l=i;for(;i<e.length&&n.has(e[i]);)i++;if(i>l&&(o=!0),i>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(r.has(e[i]))for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length;){let c=i;for(;i<e.length;){let f=e[i];if(n.has(f)||r.has(f))break;i++}if(s.push(e.substring(c,i)),i>=e.length){a=!1;break}let u=i;for(;i<e.length&&n.has(e[i]);)i++;if(i<e.length&&r.has(e[i])){for(i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length&&r.has(e[i]);)for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++}i>=e.length&&i>u&&(a=!0)}return{words:s,hadLeadingDelimiter:o,hadTrailingDelimiter:a}}function Ve(e,t){return ia(e,t).words}function SS(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Gg(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=Su(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let a=0,l=i-2;for(;l>=0&&e[l]==="\\";)a++,l--;if(a%2===1)break}i--}let o=e.substring(0,i);if(o.length>=1&&s.has(o[o.length-1])){if(!n&&o.length>=2){let l=0,c=o.length-2;for(;c>=0&&o[c]==="\\";)l++,c--;if(l%2===1)return o}let a=o.substring(0,o.length-1);if(!SS(a,s))return a}return o}var ES,on=I(()=>{"use strict";ES=`
|
|
786
|
+
`});function We(e,t){return e.state.namerefs?.has(t)??!1}function ir(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Vg(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function qg(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Zg(e,t){return e.state.invalidNamerefs?.has(t)??!1}function vu(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function oa(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Array.from(e.state.env.keys()).some(a=>a.startsWith(`${s}_`)&&!a.includes("__")),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function Bt(e,t,n=100){if(!We(e,t)||Zg(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!We(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function Xr(e,t){if(We(e,t))return e.state.env.get(t)}function Kg(e,t,n,r=100){if(!We(e,t)||Zg(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!We(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&oa(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}var Tn=I(()=>{"use strict"});function CS(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function ce(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?$n(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):pt(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function or(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?$n(e,t).length>0:pt(e,t).length>0}async function Ie(e,t,n=!0,r=!1){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let o="";return o+="h",e.state.options.errexit&&(o+="e"),e.state.options.noglob&&(o+="f"),e.state.options.nounset&&(o+="u"),e.state.options.verbose&&(o+="v"),e.state.options.xtrace&&(o+="x"),o+="B",e.state.options.noclobber&&(o+="C"),o+="s",o}case"*":{let o=Number.parseInt(e.state.env.get("#")||"0",10);if(o===0)return"";let a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"");return a.join(ge(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return H2;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let o=e.state.funcNameStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Ot("FUNCNAME");return""}case"BASH_LINENO":{let o=e.state.callLineStack?.[0];if(o!==void 0)return String(o);if(n&&e.state.options.nounset)throw new Ot("BASH_LINENO");return""}case"BASH_SOURCE":{let o=e.state.sourceStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Ot("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Nt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let o=s[1],a=s[2];if(We(e,o)){let f=Bt(e,o);if(f&&f!==o){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";o=f}}if(a==="@"||a==="*"){let f=ce(e,o);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(o);return p!==void 0?p:""}if(o==="FUNCNAME"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(o==="BASH_LINENO"){let f=Number.parseInt(a,10);if(!Number.isNaN(f)&&f>=0){let p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}return""}if(o==="BASH_SOURCE"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(o)){let f=ra(a);f=CS(e,f);let p=e.state.env.get(`${o}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new Ot(`${o}[${a}]`);return p||""}let c;if(/^-?\d+$/.test(a))c=Number.parseInt(a,10);else try{let f=new pe,p=Ne(f,a);c=await se(e,p.expression)}catch{let f=e.state.env.get(a);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=ce(e,o),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
|
|
787
|
+
`,"";let d=Math.max(...f.map(([g])=>typeof g=="number"?g:0))+1+c;return d<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
|
|
788
|
+
`,""):e.state.env.get(`${o}_${d}`)||""}let u=e.state.env.get(`${o}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(o);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new Ot(`${o}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let o=e.state.env.get(t);if(o===void 0&&n&&e.state.options.nounset)throw new Ot(t);return o||""}if(We(e,t)){let o=Bt(e,t);if(o===void 0)return"";if(o!==t)return await Ie(e,o,n,r);let a=e.state.env.get(t);if((a===void 0||a==="")&&n&&e.state.options.nounset)throw new Ot(t);return a||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(o=>o.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(or(e,t)){let o=e.state.env.get(`${t}_0`);return o!==void 0?o:""}if(n&&e.state.options.nounset)throw new Ot(t);return""}async function qn(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(We(e,s)){let l=Bt(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return ce(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=ra(i);return e.state.env.has(`${s}_${l}`)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new pe,c=Ne(l,i);a=await se(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=ce(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${a}`)}if(We(e,t)){let s=Bt(e,t);return s===void 0||s===t?e.state.env.has(t):qn(e,s)}return!!(e.state.env.has(t)||or(e,t))}var Xt=I(()=>{"use strict";Pt();ft();jc();Wt();we();bn();on();Tn()});async function Qg(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ie(e,i);n+=o,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ie(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Ie(e,s);n+=i,r+=2;continue}}if(t[r]==='"'){for(n+='"',r++;r<t.length&&t[r]!=='"';)if(t[r]==="$"&&/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ie(e,i);n+=o,r=s}else t[r]==="\\"?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+='"',r++);continue}n+=t[r],r++}return n}async function ku(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await Ie(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await Ie(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}var Xg=I(()=>{"use strict";Xt()});function vS(e,t,n,r,s){let i=n??1;i===0&&(i=1);let o=Math.abs(i),a=[],l=0;r?.match(/^-?0\d/)&&(l=Math.max(l,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(l=Math.max(l,s.replace(/^-/,"").length));let c=u=>{if(l>0){let f=u<0,p=String(Math.abs(u)).padStart(l,"0");return f?`-${p}`:p}return String(u)};if(e<=t)for(let u=e,f=0;u<=t&&f<aa;u+=o,f++)a.push(c(u));else for(let u=e,f=0;u>=t&&f<aa;u-=o,f++)a.push(c(u));return a}function kS(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),o=Math.abs(r),a=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(a&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new as(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<aa;p+=o,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<aa;p-=o,h++)f.push(String.fromCharCode(p));return f}function Nu(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:vS(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:kS(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var aa,Yg=I(()=>{"use strict";we();aa=1e4});function Jg(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!=="SimpleCommand")return null;let s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}var e6=I(()=>{"use strict"});function Zn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Iu(e){let t="",n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Yt(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function _s(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Fs=I(()=>{"use strict"});function Ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ls=I(()=>{"use strict"});function be(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let o=NS(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=IS(a).map(f=>be(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=$S(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=TS(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function NS(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function IS(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function $S(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){if(e[n]==="\\"&&n+1<e.length){n+=2;continue}if(e[n]==="]")return n;if(e[n]==="'"){let r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function TS(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=RS(i),n=s+2;continue}}let r=e[n];r==="\\"?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+="\\\\",n++):r==="-"&&n>0&&n<e.length-1?(t+="-",n++):r==="^"&&n===0?(t+="^",n++):(r==="]"&&n===0?t+="\\]":t+=r,n++)}return t+="]",t}function RS(e){return OS.get(e)??""}var OS,Ms=I(()=>{"use strict";OS=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function ar(e,t,n,r){if(n==="prefix")return X(`^${t}`,"s").replace(e,"");let s=X(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let o=e.slice(i);if(s.test(o))return e.slice(0,i)}return e}function Us(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let a of n){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let o=a=>{for(let l of s){let c=`${l}_`;if(a.startsWith(c)&&a!==l)return!0}return!1};for(let a of n)if(a.startsWith(t))if(a.includes("__")){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(a)){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else o(a)||r.add(a);return[...r].sort()}var Yr=I(()=>{"use strict";Qe()});function PS(e,t){let n=(i,o=2)=>String(i).padStart(o,"0");if(e===""){let i=n(t.getHours()),o=n(t.getMinutes()),a=n(t.getSeconds());return`${i}:${o}:${a}`}let r="",s=0;for(;s<e.length;)if(e[s]==="%"){if(s+1>=e.length){r+="%",s++;continue}let i=e[s+1];switch(i){case"H":r+=n(t.getHours());break;case"M":r+=n(t.getMinutes());break;case"S":r+=n(t.getSeconds());break;case"d":r+=n(t.getDate());break;case"m":r+=n(t.getMonth()+1);break;case"Y":r+=t.getFullYear();break;case"y":r+=n(t.getFullYear()%100);break;case"I":{let o=t.getHours()%12;o===0&&(o=12),r+=n(o);break}case"p":r+=t.getHours()<12?"AM":"PM";break;case"P":r+=t.getHours()<12?"am":"pm";break;case"%":r+="%";break;case"a":{r+=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()];break}case"b":{r+=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()];break}default:r+=`%${i}`}s+=2}else r+=e[s],s++;return r}function Ti(e,t){let n="",r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let y="",w=r+1;for(;w<t.length&&w<r+4&&t[w]>="0"&&t[w]<="7";)y+=t[w],w++;let b=Number.parseInt(y,8)%256;n+=String.fromCharCode(b),r=w;continue}switch(g){case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"e":n+="\x1B",r+=2;break;case"n":n+=`
|
|
789
|
+
`,r+=2;break;case"r":n+="\r",r+=2;break;case"$":n+="$",r+=2;break;case"[":case"]":r+=2;break;case"u":n+=s,r+=2;break;case"h":n+=o,r+=2;break;case"H":n+=i,r+=2;break;case"w":n+=c,r+=2;break;case"W":n+=u,r+=2;break;case"d":{let y=String(f.getDate()).padStart(2," ");n+=`${p[f.getDay()]} ${h[f.getMonth()]} ${y}`,r+=2;break}case"t":{let y=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),b=String(f.getSeconds()).padStart(2,"0");n+=`${y}:${w}:${b}`,r+=2;break}case"T":{let y=f.getHours()%12;y===0&&(y=12);let w=String(y).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n+=`${w}:${b}:${x}`,r+=2;break}case"@":{let y=f.getHours()%12;y===0&&(y=12);let w=String(y).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n+=`${w}:${b} ${x}`,r+=2;break}case"A":{let y=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0");n+=`${y}:${w}`,r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let y=t.indexOf("}",r+3);if(y!==-1){let w=t.slice(r+3,y);n+=PS(w,f),r=y+1}else n+="\\D",r+=2}else n+="\\D",r+=2;break;case"s":n+="bash",r+=2;break;case"v":n+="5.0",r+=2;break;case"V":n+="5.0.0",r+=2;break;case"j":n+="0",r+=2;break;case"l":n+="tty",r+=2;break;case"#":n+=d,r+=2;break;case"!":n+=d,r+=2;break;case"x":n+="\\x",r+=2;break;default:n+=`\\${g}`,r+=2}}else n+=m,r++}return n}var $u=I(()=>{"use strict"});function xr(e){if(e==="")return"''";if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let n="$'";for(let r of e)switch(r){case"'":n+="\\'";break;case"\\":n+="\\\\";break;case`
|
|
790
|
+
`:n+="\\n";break;case"\r":n+="\\r";break;case" ":n+="\\t";break;default:{let s=r.charCodeAt(0);s<32||s===127?n+=`\\${s.toString(8).padStart(3,"0")}`:n+=r}}return`${n}'`}return`'${e}'`}var Tu=I(()=>{"use strict"});function Jt(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function Kn(e,t){return e.state.readonlyVars?.has(t)??!1}function Et(e,t,n="bash"){if(Kn(e,t)){let r=`${n}: ${t}: readonly variable
|
|
791
|
+
`;throw new Ce(1,"",r)}return null}function On(e,t){let n=e.state.exportedVars?.has(t)??!1;if(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t),e.state.localScopes.length>0&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!n){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length<e.state.localScopes.length;)e.state.localExportedVars.push(new Set);e.state.localExportedVars[e.state.localExportedVars.length-1].add(t)}}function la(e,t){e.state.exportedVars?.delete(t)}var Er=I(()=>{"use strict";we()});function Ar(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return"";let n="",r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(i=>i.startsWith(`${t}_`)&&/^[0-9]+$/.test(i.slice(t.length+1))),s=e.state.associativeArrays?.has(t)??!1;return r&&!s&&(n+="a"),s&&(n+="A"),e.state.integerVars?.has(t)&&(n+="i"),We(e,t)&&(n+="n"),Kn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}var ca=I(()=>{"use strict";Tn();Er()});async function t6(e,t,n,r){return e.coverage?.hit("bash:expansion:default_value"),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function n6(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:assign_default"),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let o=await s(e,n.word.parts,r.inDoubleQuotes),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,l,c]=a,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let p=new pe,h=Ne(p,c);u=await se(e,h.expression)}catch{let p=e.state.env.get(c);u=p?Number.parseInt(p,10):0}Number.isNaN(u)&&(u=0)}e.state.env.set(`${l}_${u}`,o);let f=Number.parseInt(e.state.env.get(`${l}__length`)||"0",10);u>=f&&e.state.env.set(`${l}__length`,String(u+1))}else e.state.env.set(t,o);return o}return r.effectiveValue}async function r6(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`,a=n.word?`${t}: ${o}`:o;throw new Nt(a,"",`bash: ${a}
|
|
792
|
+
`)}return r.effectiveValue}async function s6(e,t,n,r){return e.coverage?.hit("bash:expansion:use_alternative"),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):""}async function i6(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let l of n.pattern.parts)if(l.type==="Glob")i+=be(l.pattern,n.greedy,o);else if(l.type==="Literal")i+=be(l.value,n.greedy,o);else if(l.type==="SingleQuoted"||l.type==="Escaped")i+=Ae(l.value);else if(l.type==="DoubleQuoted"){let c=await r(e,l.parts);i+=Ae(c)}else if(l.type==="ParameterExpansion"){let c=await s(e,l);i+=be(c,n.greedy,o)}else{let c=await s(e,l);i+=Ae(c)}if(n.side==="prefix")return X(`^${i}`,"s").replace(t,"");let a=X(`${i}$`,"s");if(n.greedy)return a.replace(t,"");for(let l=t.length;l>=0;l--){let c=t.slice(l);if(a.test(c))return t.slice(0,l)}return t}async function o6(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=be(c.pattern,!0,o);else if(c.type==="Literal")i+=be(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=Ae(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=Ae(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=be(u,!0,o)}else{let u=await s(e,c);i+=Ae(u)}let a=n.replacement?await r(e,n.replacement.parts):"";if(n.anchor==="start"?i=`^${i}`:n.anchor==="end"&&(i=`${i}$`),i==="")return t;let l=n.all?"gs":"s";try{let c=X(i,l);if(n.all){let u="",f=0,p=0,h=e.limits.maxStringLength,d=c.exec(t);for(;d!==null&&!(d[0].length===0&&d.index===t.length);){if(u+=t.slice(f,d.index)+a,f=d.index+d[0].length,d[0].length===0&&f++,p++,p%100===0&&u.length>h)throw new K(`pattern replacement: string length limit exceeded (${h} bytes)`,"string_length");d=c.exec(t)}return u+=t.slice(f),u}return c.replace(t,a)}catch(c){if(c instanceof K)throw c;return t}}function a6(e,t,n){e.coverage?.hit("bash:expansion:length");let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let s=r[1],i=ce(e,s);return i.length>0?String(i.length):e.state.env.get(s)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&or(e,t)){if(t==="FUNCNAME"){let i=e.state.funcNameStack?.[0]||"";return String([...i].length)}if(t==="BASH_LINENO"){let i=e.state.callLineStack?.[0];return String(i!==void 0?[...String(i)].length:0)}let s=e.state.env.get(`${t}_0`)||"";return String([...s].length)}return String([...n].length)}async function l6(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await se(e,r.offset.expression),i=r.length?await se(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let d=1;d<=c;d++)u.push(e.state.env.get(String(d))||"");let f=e.state.env.get("0")||"bash",p,h;if(s<=0)if(p=[f,...u],s<0){if(h=p.length+s,h<0)return""}else h=0;else p=u,h=s-1;if(h<0||h>=p.length)return"";if(i!==void 0){let d=i<0?p.length+i:h+i;return p.slice(h,Math.max(h,d)).join(" ")}return p.slice(h).join(" ")}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let c=o[1];if(e.state.associativeArrays?.has(c))throw new Ce(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
|
|
793
|
+
`);let u=ce(e,c),f=0;if(s<0){if(u.length>0){let p=u[u.length-1][0],d=(typeof p=="number"?p:0)+1+s;if(d<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=d),f<0))return""}}else if(f=u.findIndex(([p])=>typeof p=="number"&&p>=s),f<0)return"";if(i!==void 0){if(i<0)throw new De(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,p])=>p).join(" ")}return u.slice(f).map(([,p])=>p).join(" ")}let a=[...n],l=s;if(l<0&&(l=Math.max(0,a.length+l)),i!==void 0){if(i<0){let c=a.length+i;if(c<l)throw new De(`${t}: substring expression < 0`);return a.slice(l,Math.max(l,c)).join("")}return a.slice(l,l+i).join("")}return a.slice(l).join("")}async function c6(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,o="";for(let f of n.pattern.parts)if(f.type==="Glob")o+=be(f.pattern,!0,i);else if(f.type==="Literal")o+=be(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=Ae(f.value);else if(f.type==="DoubleQuoted"){let p=await r(e,f.parts);o+=Ae(p)}else if(f.type==="ParameterExpansion"){let p=await s(e,f);o+=be(p,!0,i)}let a=X(`^(?:${o})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:a.test(f)?(c+=l(f),u=!0):c+=f;return c}return n.direction==="upper"?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function u6(e,t,n,r,s){e.coverage?.hit("bash:expansion:transform");let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i&&s.operator==="Q")return ce(e,i[1]).map(([,c])=>xr(c)).join(" ");if(i&&s.operator==="a")return Ar(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return Ar(e,o[1]);switch(s.operator){case"Q":return r?"":xr(n);case"P":return Ti(e,n);case"a":return Ar(e,t);case"A":return r?"":`${t}=${xr(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(a,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
|
|
794
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":xr(n);case"u":return n.charAt(0).toUpperCase()+n.slice(1);case"U":return n.toUpperCase();case"L":return n.toLowerCase();default:return n}}async function f6(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),We(e,t))return Xr(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new Nt(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new Nt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new Nt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await Ie(e,l)}function p6(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=ce(e,t.array).map(([s])=>String(s));return t.star?r.join(ge(e.state.env)):r.join(" ")}function h6(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Us(e,t.prefix);return t.star?n.join(ge(e.state.env)):n.join(" ")}function d6(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,o,a]=i,l=ce(e,o);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(a==="*"){let c=ge(e.state.env),u=l.map(([,f])=>f).join(c);return{isEmpty:r?u==="":!1,effectiveValue:u}}return{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:l.map(([,c])=>c).join(" ")}}return{isEmpty:n==="",effectiveValue:n}}var m6=I(()=>{"use strict";Pt();ft();Qe();Wt();we();on();Tn();Ls();Ms();Yr();$u();Tu();Xt();ca()});function g6(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function y6(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function ua(e,t){let n=new pe,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),o=e.state.cwd,a=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let l=await e.executeScript(r),c=l.exitCode;return e.state.env=i,e.state.cwd=o,e.state.suppressVerbose=a,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,l.stdout.replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=o,e.state.bashPid=s,e.state.suppressVerbose=a,l instanceof K)throw l;return l instanceof Ce?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),l.stdout?.replace(/\n+$/,"")??""):""}}function Ou(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=DS(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function DS(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function w6(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await _S(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=y6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function _S(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=y6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}var b6=I(()=>{"use strict";ft();we();Fs()});function x6(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";if(t==="~"||t.startsWith("~/"))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}var E6=I(()=>{"use strict"});async function FS(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=be(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=be(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=Ae(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=Ae(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=be(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=Ae(o)}return s}async function A6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let p="";c.pattern&&(p=await FS(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",d=p;c.anchor==="start"?d=`^${p}`:c.anchor==="end"&&(d=`${p}$`);let m=[];try{let g=X(d,c.all?"g":"");for(let y of f)m.push(g.replace(y,h))}catch{m.push(...f)}if(l){let g=ge(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function S6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,m])=>m);if(u.length===0){let m=e.state.env.get(a);m!==void 0&&f.push(m)}if(f.length===0)return{values:[],quoted:!0};let p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let m of c.pattern.parts)if(m.type==="Glob")p+=be(m.pattern,c.greedy,h);else if(m.type==="Literal")p+=be(m.value,c.greedy,h);else if(m.type==="SingleQuoted"||m.type==="Escaped")p+=Ae(m.value);else if(m.type==="DoubleQuoted"){let g=await n(e,m.parts);p+=Ae(g)}else if(m.type==="ParameterExpansion"){let g=await r(e,m);p+=be(g,c.greedy,h)}else{let g=await r(e,m);p+=Ae(g)}let d=[];for(let m of f)d.push(ar(m,p,c.side,c.greedy));if(l){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}var C6=I(()=>{"use strict";Qe();on();Ls();Ms();Yr();Xt()});async function v6(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="DefaultValue"&&n.parts[0].operation?.type!=="UseAlternative"&&n.parts[0].operation?.type!=="AssignDefault")return null;let r=n.parts[0],s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=ce(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,h])=>h===""),p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=u&&!(p&&f):o=!u||p&&f,!o){if(c.length>0){let d=c.map(([,m])=>m);if(a){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}let h=e.state.env.get(l);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await qn(e,l),u=await Ie(e,l),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(p&&f):o=!c||p&&f,!o)return{values:[u],quoted:!0}}if(o&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let p=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(p){c=p[1],u=p[2]==="*";break}}if(c){let f=ce(e,c);if(f.length>0){let h=f.map(([,d])=>d);if(u||a){let d=ge(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(c);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}return null}async function k6(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let y=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(y){o=m,a=y[1],l=y[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let p=ce(e,a),h=p.map(([,m])=>m);if(p.length===0){let m=e.state.env.get(a);if(m!==void 0)h=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g="",y=e.state.shoptOptions.extglob;if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=be(w.pattern,m.greedy,y);else if(w.type==="Literal")g+=be(w.value,m.greedy,y);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=Ae(w.value);else if(w.type==="DoubleQuoted"){let b=await s(e,w.parts);g+=Ae(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);g+=be(b,m.greedy,y)}else{let b=await r(e,w);g+=Ae(b)}h=h.map(w=>ar(w,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let b of m.pattern.parts)if(b.type==="Glob")g+=be(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")g+=be(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=Ae(b.value);else if(b.type==="DoubleQuoted"){let x=await s(e,b.parts);g+=Ae(x)}else if(b.type==="ParameterExpansion"){let x=await r(e,b);g+=be(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,b);g+=Ae(x)}let y=m.replacement?await s(e,m.replacement.parts):"",w=g;m.anchor==="start"?w=`^${g}`:m.anchor==="end"&&(w=`${g}$`);try{let b=X(w,m.all?"g":"");h=h.map(x=>b.replace(x,y))}catch{}}if(l){let m=ge(e.state.env);return{values:[u+h.join(m)+f],quoted:!0}}return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function N6(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let h=0;h<s.parts.length;h++){let d=s.parts[h];if(d.type==="ParameterExpansion"&&!d.operation){let m=d.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=h,o=m[1],a=m[2]==="*";break}}}if(i===-1)return null;let l="";for(let h=0;h<i;h++)l+=await r(e,s.parts[h]);let c="";for(let h=i+1;h<s.parts.length;h++)c+=await r(e,s.parts[h]);let u=ce(e,o),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(o);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}if(a){let h=ge(e.state.env);return{values:[l+f.join(h)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}var I6=I(()=>{"use strict";Qe();on();Ls();Ms();Yr();Xt()});async function $6(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Substring")return null;let s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new Ce(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
|
|
795
|
+
`);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=ce(e,o),p=0;if(c<0){if(f.length>0){let d=f[f.length-1][0],g=(typeof d=="number"?d:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([y])=>typeof y=="number"&&y>=g),p<0&&(p=f.length)}}else p=f.findIndex(([d])=>typeof d=="number"&&d>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new De(`${o}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,d])=>d)}else h=f.slice(p).map(([,d])=>d);if(h.length===0)return{values:[],quoted:!0};if(a){let d=ge(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}function T6(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="Transform")return null;let r=n.parts[0],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],o=s[2]==="*",a=r.operation,l=ce(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=Ti(e,f);break;case"Q":p=xr(f);break;default:p=f}return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=Ar(e,i),u;switch(a.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>Ti(e,f));break;case"Q":u=l.map(([,f])=>xr(f));break;case"u":u=l.map(([,f])=>f.charAt(0).toUpperCase()+f.slice(1));break;case"U":u=l.map(([,f])=>f.toUpperCase());break;case"L":u=l.map(([,f])=>f.toLowerCase());break;default:u=l.map(([,f])=>f)}if(o){let f=ge(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var O6=I(()=>{"use strict";we();on();$u();Tu();Xt();ca()});function R6(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion")return null;let r=n.parts[0];if(r.operation)return null;let s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(We(e,i)){let l=Xr(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=ce(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function P6(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation)return null;let s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!We(e,s))return null;let i=Xr(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=ce(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}var D6=I(()=>{"use strict";Tn();Xt()});async function _6(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],a=o.operation,l=await Ie(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let d=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=d;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(ge(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=ce(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return LS(e,p,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return MS(e,p,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=Ar(e,u),g=p.map(()=>m);return f?{values:[g.join(ge(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let d=[];for(let[,m]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},y=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let w=await r(e,g,!0);d.push(w)}finally{y!==void 0?e.state.env.set("_indirect_elem_",y):e.state.env.delete("_indirect_elem_")}}return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}if(p.length>0){let d=p.map(([,m])=>m);return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function LS(e,t,n,r,s){let i=s.offset?await se(e,s.offset.expression):0,o=s.length?await se(e,s.length.expression):void 0,a=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],p=(typeof u=="number"?u:0)+1+i;if(p<0)return{values:[],quoted:!0};if(a=t.findIndex(([h])=>typeof h=="number"&&h>=p),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new De(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(ge(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function MS(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&l)&&s.word){let f=await i(e,s.word.parts,!0);return e.state.env.set(`${n}_0`,f),e.state.env.set(`${n}__length`,"1"),{values:[f],quoted:!0}}return r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function F6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let n=t[0],r=n.operation,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],l=(await Ie(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await qn(e,n.parameter),u=await Ie(e,n.parameter)==="",f=r.checkEmpty??!1,p;if(r.type==="UseAlternative"?p=c&&!(f&&u):p=!c||f&&u,p){let h=l[1],d=l[2]==="*",m=ce(e,h);if(m.length>0){let y=m.map(([,w])=>w);return d?{values:[y.join(ge(e.state.env))],quoted:!0}:{values:y,quoted:!0}}let g=e.state.env.get(h);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function L6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await Ie(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Ie(e,n.parameter),f=await qn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,d;if(s.type==="UseAlternative"?d=f&&!(h&&p):d=!f||h&&p,d){let m=c[1],g=c[2]==="*",y=ce(e,m);if(y.length>0){let b=y.map(([,x])=>x);return g?{values:[b.join(ge(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let w=e.state.env.get(m);return w!==void 0?{values:[w],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var M6=I(()=>{"use strict";Wt();we();on();Xt();ca()});function U6(e){let t=Number.parseInt(e.state.env.get("#")||"0",10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||"");return n}async function B6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let w=0;w<s.parts.length;w++){let b=s.parts[w];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="Substring"){i=w,o=b.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),p=[];for(let w=1;w<=f;w++)p.push(e.state.env.get(String(w))||"");let h=e.state.env.get("0")||"bash",d;if(c<=0){let w=[h,...p],b=w.length+c;if(b<0)d=[];else{let x=c<0?b:0;if(u!==void 0){let A=u<0?w.length+u:x+u;d=w.slice(x,Math.max(x,A))}else d=w.slice(x)}}else{let w=c-1;if(w>=p.length)d=[];else if(u!==void 0){let b=u<0?p.length+u:w+u;d=p.slice(w,Math.max(w,b))}else d=p.slice(w)}let m="";for(let w=0;w<i;w++)m+=await r(e,s.parts[w]);let g="";for(let w=i+1;w<s.parts.length;w++)g+=await r(e,s.parts[w]);if(d.length===0){let w=m+g;return{values:w?[w]:[],quoted:!0}}if(o){let w=ge(e.state.env);return{values:[m+d.join(w)+g],quoted:!0}}return d.length===1?{values:[m+d[0]+g],quoted:!0}:{values:[m+d[0],...d.slice(1,-1),d[d.length-1]+g],quoted:!0}}async function W6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternReplacement"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=U6(e),u="";for(let y=0;y<i;y++)u+=await n(e,s.parts[y]);let f="";for(let y=i+1;y<s.parts.length;y++)f+=await n(e,s.parts[y]);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let p="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")p+=be(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")p+=be(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")p+=Ae(y.value);else if(y.type==="DoubleQuoted"){let w=await r(e,y.parts);p+=Ae(w)}else if(y.type==="ParameterExpansion"){let w=await n(e,y);p+=be(w,!0,e.state.shoptOptions.extglob)}else{let w=await n(e,y);p+=Ae(w)}let h=l.replacement?await r(e,l.replacement.parts):"",d=p;l.anchor==="start"?d=`^${p}`:l.anchor==="end"&&(d=`${p}$`);let m=[];try{let y=X(d,l.all?"g":"");for(let w of c)m.push(y.replace(w,h))}catch{m.push(...c)}if(o){let y=ge(e.state.env);return{values:[u+m.join(y)+f],quoted:!0}}return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function z6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let g=0;g<s.parts.length;g++){let y=s.parts[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=g,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=U6(e),u="";for(let g=0;g<i;g++)u+=await n(e,s.parts[g]);let f="";for(let g=i+1;g<s.parts.length;g++)f+=await n(e,s.parts[g]);if(c.length===0){let g=u+f;return{values:g?[g]:[],quoted:!0}}let p="",h=e.state.shoptOptions.extglob;if(l.pattern)for(let g of l.pattern.parts)if(g.type==="Glob")p+=be(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=be(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=Ae(g.value);else if(g.type==="DoubleQuoted"){let y=await r(e,g.parts);p+=Ae(y)}else if(g.type==="ParameterExpansion"){let y=await n(e,g);p+=be(y,l.greedy,h)}else{let y=await n(e,g);p+=Ae(y)}let d=[];for(let g of c)d.push(ar(g,p,l.side,l.greedy));if(o){let g=ge(e.state.env);return{values:[u+d.join(g)+f],quoted:!0}}return d.length===1?{values:[u+d[0]+f],quoted:!0}:{values:[u+d[0],...d.slice(1,-1),d[d.length-1]+f],quoted:!0}}async function H6(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let p=0;p<r.parts.length;p++){let h=r.parts[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")){s=p,i=h.parameter==="*";break}}if(s===-1)return null;let o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let p=0;p<s;p++)l+=await n(e,r.parts[p]);let c="";for(let p=s+1;p<r.parts.length;p++)c+=await n(e,r.parts[p]);if(a===0){if(i)return{values:[l+c],quoted:!0};let p=l+c;return{values:p?[p]:[],quoted:!0}}let u=[];for(let p=1;p<=a;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=ge(e.state.env);return{values:[l+u.join(p)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}var j6=I(()=>{"use strict";Qe();on();Ls();Ms();Yr()});function US(e){return new br(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function fa(e,t){if(e.state.options.noglob)return t;let n=US(e),r=[];for(let s of t)if(Zn(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)r.push(...i);else{if(n.hasFailglob())throw new Ln(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function G6(e,t,n,r){let s=-1,i="",o=!1;for(let w=0;w<t.length;w++){let b=t[w];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternReplacement"){let x=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=w,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(e,i),u=c.map(([,w])=>w);if(c.length===0){let w=e.state.env.get(i);w!==void 0&&(u=[w])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")f+=be(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")f+=be(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")f+=Ae(w.value);else if(w.type==="DoubleQuoted"){let b=await n(e,w.parts);f+=Ae(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);f+=be(b,!0,e.state.shoptOptions.extglob)}else{let b=await r(e,w);f+=Ae(b)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let d=[];try{let w=X(h,l.all?"g":"");for(let b of u)d.push(w.replace(b,p))}catch{d.push(...u)}let m=wt(e.state.env),g=Tt(e.state.env);if(o){let w=ge(e.state.env),b=d.join(w);return g?{values:b?[b]:[],quoted:!1}:{values:Ve(b,m),quoted:!1}}if(g)return{values:d,quoted:!1};let y=[];for(let w of d)w===""?y.push(""):y.push(...Ve(w,m));return{values:y,quoted:!1}}async function V6(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternRemoval"){let b=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){s=y,i=b[1],o=b[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=be(y.pattern,l.greedy,p);else if(y.type==="Literal")f+=be(y.value,l.greedy,p);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=Ae(y.value);else if(y.type==="DoubleQuoted"){let w=await n(e,y.parts);f+=Ae(w)}else if(y.type==="ParameterExpansion"){let w=await r(e,y);f+=be(w,l.greedy,p)}else{let w=await r(e,y);f+=Ae(w)}let h=[];for(let y of u)h.push(ar(y,f,l.side,l.greedy));let d=wt(e.state.env),m=Tt(e.state.env);if(o){let y=ge(e.state.env),w=h.join(y);return m?{values:w?[w]:[],quoted:!1}:{values:Ve(w,d),quoted:!1}}if(m)return{values:h,quoted:!1};let g=[];for(let y of h)y===""?g.push(""):g.push(...Ve(y,d));return{values:g,quoted:!1}}async function q6(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let y=t[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){s=g,i=y.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let g=1;g<=l;g++)c.push(e.state.env.get(String(g))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(a.pattern)for(let g of a.pattern.parts)if(g.type==="Glob")u+=be(g.pattern,a.greedy,f);else if(g.type==="Literal")u+=be(g.value,a.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=Ae(g.value);else if(g.type==="DoubleQuoted"){let y=await n(e,g.parts);u+=Ae(y)}else if(g.type==="ParameterExpansion"){let y=await r(e,g);u+=be(y,a.greedy,f)}else{let y=await r(e,g);u+=Ae(y)}let p=[];for(let g of c)p.push(ar(g,u,a.side,a.greedy));let h=wt(e.state.env),d=Tt(e.state.env);if(i){let g=ge(e.state.env),y=p.join(g);return d?{values:y?[y]:[],quoted:!1}:{values:Ve(y,h),quoted:!1}}if(d)return{values:p,quoted:!1};let m=[];for(let g of p)g===""?m.push(""):m.push(...Ve(g,h));return{values:m,quoted:!1}}async function Z6(e,t,n,r){let s=-1,i=!1;for(let b=0;b<t.length;b++){let x=t[b];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=b,i=x.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let b=1;b<=u;b++)f.push(e.state.env.get(String(b))||"");let p=e.state.env.get("0")||"bash",h;if(l<=0){let b=[p,...f],x=b.length+l;if(x<0)h=[];else{let A=l<0?x:0;if(c!==void 0){let C=c<0?b.length+c:A+c;h=b.slice(A,Math.max(A,C))}else h=b.slice(A)}}else{let b=l-1;if(b>=f.length)h=[];else if(c!==void 0){let x=c<0?f.length+c:b+c;h=f.slice(b,Math.max(b,x))}else h=f.slice(b)}let d="";for(let b=0;b<s;b++)d+=await r(e,t[b]);let m="";for(let b=s+1;b<t.length;b++)m+=await r(e,t[b]);let g=wt(e.state.env),y=Tt(e.state.env);if(h.length===0){let b=d+m;return b?y?{values:[b],quoted:!1}:{values:Ve(b,g),quoted:!1}:{values:[],quoted:!1}}let w;if(i){let b=ge(e.state.env),x=d+h.join(b)+m;y?w=x?[x]:[]:w=Ve(x,g)}else if(y)h.length===1?w=[d+h[0]+m]:w=[d+h[0],...h.slice(1,-1),h[h.length-1]+m];else{w=[];for(let b=0;b<h.length;b++){let x=h[b];if(b===0&&(x=d+x),b===h.length-1&&(x=x+m),x==="")w.push("");else{let A=Ve(x,g);w.push(...A)}}}return{values:await fa(e,w),quoted:!1}}async function K6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].parameter!=="@"&&t[0].parameter!=="*"||t[0].operation)return null;let n=t[0].parameter==="*",r=Number.parseInt(e.state.env.get("#")||"0",10);if(r===0)return{values:[],quoted:!1};let s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=wt(e.state.env),o=Tt(e.state.env),a=sa(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=ge(e.state.env),u=s.join(c);l=Ve(u,i)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=Ve(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=Ve(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fa(e,l),quoted:!1}}async function Q6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],s=n[2]==="*",i=ce(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=wt(e.state.env),l=Tt(e.state.env),c=sa(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=ge(e.state.env),p=o.join(f);u=Ve(p,a)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let p=Ve(f,a);u.push(...p)}}else{u=[];for(let f of o)if(f==="")u.push("");else{let p=Ve(f,a);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fa(e,u),quoted:!1}}function X6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Us(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=wt(e.state.env),i=Tt(e.state.env),o;if(n.star)if(i)o=r;else{let a=ge(e.state.env),l=r.join(a);o=Ve(l,s)}else if(i)o=r;else{o=[];for(let a of r){let l=Ve(a,s);o.push(...l)}}return{values:o,quoted:!1}}function Y6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=ce(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=wt(e.state.env),o=Tt(e.state.env),a;if(n.star)if(o)a=s;else{let l=ge(e.state.env),c=s.join(l);a=Ve(c,i)}else if(o)a=s;else{a=[];for(let l of s){let c=Ve(l,i);a.push(...c)}}return{values:a,quoted:!1}}async function J6(e,t,n){let r=-1;for(let p=0;p<t.length;p++){let h=t[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")&&!h.operation){r=p;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let p=1;p<=s;p++)i.push(e.state.env.get(String(p))||"");let o="";for(let p=0;p<r;p++)o+=await n(e,t[p]);let a="";for(let p=r+1;p<t.length;p++)a+=await n(e,t[p]);let l=wt(e.state.env),c=Tt(e.state.env),u=sa(e.state.env);if(s===0){let p=o+a;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let d=i[h];h===0&&(d=o+d),h===i.length-1&&(d=d+a),p.push(d)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let d=Ve(h,l);f.push(...d)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let d=Ve(h,l);f.push(...d)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fa(e,f),quoted:!1}}var ey=I(()=>{"use strict";Qe();ta();we();on();Ls();Fs();Ms();Yr();Xt()});async function ry(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=$i(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return BS(e,p,s);let h=await WS(e,r,a,c,u,n);if(h!==null)return h;let d=await HS(e,r,n);if(d!==null)return d;let m=await jS(e,r,n);if(m!==null)return m;let g=await VS(e,r,n.expandPart);if(g!==null)return ny(e,g);if((i||o||l)&&!Tt(e.state.env)){let w=wt(e.state.env),b=n.buildIfsCharClassPattern(w),x=await n.smartWordSplit(e,r,w,b,n.expandPart);return ny(e,x)}let y=await n.expandWordAsync(e,t);return qS(e,t,r,y,s,n.expandWordForGlobbing)}async function BS(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&Zn(s,e.state.shoptOptions.extglob)){let i=await pa(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function WS(e,t,n,r,s,i){if(n){let o=R6(e,t);if(o!==null)return o}{let o=P6(e,t);if(o!==null)return o}{let o=await v6(e,t);if(o!==null)return o}{let o=await k6(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await N6(e,t,n,i.expandPart);if(o!==null)return o}{let o=await $6(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=T6(e,t);if(o!==null)return o}{let o=await A6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await S6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=zS(e,t);if(o!==null)return o}{let o=await _6(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await F6(e,t);if(o!==null)return o}{let o=await L6(e,t);if(o!==null)return o}return null}function zS(e,t){let n=t[0];if(n.type!=="DoubleQuoted")return null;if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="VarNamePrefix"){let r=n.parts[0].operation,s=Us(e,r.prefix);return r.star?{values:[s.join(ge(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=ce(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(ge(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function HS(e,t,n){{let r=await B6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await W6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await z6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await H6(e,t,n.expandPart);if(r!==null)return r}return null}async function jS(e,t,n){{let r=await G6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await V6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await q6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Z6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await K6(e,t);if(r!==null)return r}{let r=await Q6(e,t);if(r!==null)return r}{let r=X6(e,t);if(r!==null)return r}{let r=Y6(e,t);if(r!==null)return r}{let r=await J6(e,t,n.expandPart);if(r!==null)return r}return null}function ty(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!=="ParameterExpansion"||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:"array",name:r[1],atIndex:t,isStar:r[2]==="*"};if(n.parameter==="@"||n.parameter==="*")return{type:"positional",atIndex:t,isStar:n.parameter==="*"}}return null}async function GS(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=ce(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=ge(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function VS(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(ty(l)){r=!0;break}if(!r)return null;let s=wt(e.state.env),i=Tt(e.state.env),o=[];for(let l of t){let c=ty(l);if(c&&l.type==="DoubleQuoted"){let u=await GS(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)a.push(...l);else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function ny(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Zn(r,e.state.shoptOptions.extglob)){let s=await pa(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function pa(e,t){let n=new br(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new Ln(t);return n.hasNullglob()?[]:[t]}async function qS(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(Zn(a,e.state.shoptOptions.extglob)){let c=await pa(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=Iu(r);if(!Tt(e.state.env)){let c=wt(e.state.env);return{values:Ve(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&Zn(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(Zn(a,e.state.shoptOptions.extglob)){let l=await pa(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=Iu(r);if(!Tt(e.state.env)){let l=wt(e.state.env);return{values:Ve(a,l),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}var sy=I(()=>{"use strict";ta();we();on();na();C6();I6();O6();D6();Fs();M6();Yr();j6();ey();Xt()});async function oy(e,t){let n=t.operation;if(!n||n.type!=="DefaultValue"&&n.type!=="AssignDefault"&&n.type!=="UseAlternative")return null;let r=n.word;if(!r||r.parts.length===0)return null;let s=await qn(e,t.parameter),o=await Ie(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?r.parts:null}function ZS(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function KS(e,t){if(t.type!=="ParameterExpansion")return null;let n=await oy(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>ZS(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function QS(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?Eu(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&Hg(e))}async function ay(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let p=t[0],h=await oy(e,p);if(h&&h.length>0&&h.length>1&&h.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&h.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return iy(e,h,n,r,s)}let i=[],o=!1;for(let p of t){let h=QS(p),d=p.type==="DoubleQuoted"||p.type==="SingleQuoted",m=h?await KS(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:d,mixedDefaultParts:m??void 0}),h&&(o=!0)}if(!o){let p=i.map(h=>h.value).join("");return p?[p]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&a.push(l),a.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&a.push(l),l=p.value,u=!1,f=!1):(l+=p.value,f=!1):(l+=p.value,f=p.isQuoted&&p.value==="");else if(p.mixedDefaultParts){let h=await iy(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],a.push(l),c=!0;for(let d=1;d<h.length-1;d++)a.push(h[d]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:d,hadTrailingDelimiter:m}=ia(p.value,n);if(f&&d&&l===""&&(a.push(""),c=!0),h.length===0)m&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=m;else{l+=h[0],a.push(l),c=!0;for(let g=1;g<h.length-1;g++)a.push(h[g]);l=h[h.length-1],u=m}f=!1}return l!==""?a.push(l):a.length===0&&c&&a.push(""),a}function XS(e,t){return e.length>0&&t.includes(e[0])}async function iy(e,t,n,r,s){let i=[];for(let u of t){let p=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),h=await s(e,u);i.push({value:h,isSplittable:p})}let o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&o.push(a),a=u.value,c=!1):a+=u.value;else{XS(u.value,n)&&a!==""&&(o.push(a),a="",l=!0);let{words:p,hadTrailingDelimiter:h}=ia(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)a+=p[0],l=!0,c=h;else{a+=p[0],o.push(a),l=!0;for(let d=1;d<p.length-1;d++)o.push(p[d]);a=p[p.length-1],c=h}}return a!==""?o.push(a):o.length===0&&l&&o.push(""),o}var ly=I(()=>{"use strict";Xt();on();na()});function cy(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function uy(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var fy=I(()=>{"use strict"});var Lu={};ee(Lu,{escapeGlobChars:()=>Yt,escapeRegexChars:()=>_s,expandRedirectTarget:()=>Jr,expandWord:()=>re,expandWordForPattern:()=>_u,expandWordForRegex:()=>Du,expandWordWithGlob:()=>Pn,getArrayElements:()=>ce,getVariable:()=>Ie,hasQuotedMultiValueAt:()=>Oi,isArray:()=>or,isWordFullyQuoted:()=>Pu});function Sr(e,t,n){if(e.length>t)throw new K(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function Rn(e,t,n=!1){let r=[];for(let s of t)r.push(await an(e,s,n));return r.join("")}function YS(e){return uy(e)}function Pu(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!YS(t))return!1;return!0}function JS(e,t,n=!1){let r=cy(t);if(r!==null)return r;switch(t.type){case"TildeExpansion":return n?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return Ou(e,t.pattern);default:return null}}async function re(e,t){return Fu(e,t)}async function Du(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(`\\${r.value}`);else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await Rn(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await an(e,r);n.push(_s(s))}else n.push(await an(e,r));return n.join("")}async function _u(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Yt(r.value));else if(r.type==="DoubleQuoted"){let s=await Rn(e,r.parts);n.push(Yt(s))}else n.push(await an(e,r));return n.join("")}async function py(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Yt(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await Rn(e,r.parts);n.push(Yt(s))}else r.type==="Glob"?g6(r.pattern)?n.push(await w6(e,r.pattern)):n.push(Ou(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await an(e,r));return n.join("")}function da(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&da(t.parts))return!0;return!1}async function hy(e,t,n={count:0}){if(n.count>Ru)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],o=!1,a="";for(let u of s.items)if(u.type==="Range"){let f=Nu(u.start,u.end,u.step,u.startStr,u.endStr);if(f.expanded)for(let p of f.expanded)n.count++,i.push(p);else{o=!0,a=f.literal;break}}else{let f=await hy(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let d of p)typeof d=="string"?h.push(d):h.push(await an(e,d));i.push(h.join(""))}}if(o){for(let u of r)n.count++,u.push(a);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>Ru)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>Ru)return c.length>0?c:r;c.push([...u,f])}r=c}else for(let i of r)n.count++,i.push(s);return r}async function dy(e,t){let n=t.parts;if(!da(n))return[await re(e,t)];let r=await hy(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await an(e,a));s.push(x6(e,o.join("")))}return s}function eC(){return{expandWordAsync:Fu,expandWordForGlobbing:py,expandWordWithBracesAsync:dy,expandWordPartsAsync:Rn,expandPart:an,expandParameterAsync:ha,hasBraceExpansion:da,evaluateArithmetic:se,buildIfsCharClassPattern:jg,smartWordSplit:ay}}async function Pn(e,t){return ry(e,t,eC())}function tC(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Oi(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function Jr(e,t){if(Oi(e,t))return{error:`bash: $@: ambiguous redirect
|
|
796
|
+
`};let n=t.parts,{hasQuoted:r}=$i(n);if(da(n)&&(await dy(e,t)).length>1)return{error:`bash: ${n.map(h=>h.type==="Literal"?h.value:h.type==="BraceExpansion"?`{${h.items.map(m=>{if(m.type==="Range"){let g=m.step?`..${m.step}`:"";return`${m.startStr??m.start}..${m.endStr??m.end}${g}`}return m.word.parts.map(g=>g.type==="Literal"?g.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect
|
|
797
|
+
`};let s=await Fu(e,t),{hasParamExpansion:i,hasCommandSub:o}=$i(n);if((i||o)&&!r&&!Tt(e.state.env)){let f=wt(e.state.env);if(Ve(s,f).length>1)return{error:`bash: $${tC(n)}: ambiguous redirect
|
|
798
|
+
`}}if(r||e.state.options.noglob)return{target:s};let l=await py(e,t);if(!Zn(l,e.state.shoptOptions.extglob))return{target:s};let c=new br(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),u=await c.expand(l);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${s}
|
|
799
|
+
`}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
|
|
800
|
+
`}}async function Fu(e,t){let n=t.parts,r=n.length;if(r===1){let o=await an(e,n[0]);return Sr(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await an(e,n[o]));let i=s.join("");return Sr(i,e.limits.maxStringLength,"word expansion"),i}async function an(e,t,n=!1){if(t.type==="ParameterExpansion")return ha(e,t,n);let r=JS(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await an(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=Jg(t.body);if(s)try{let p=await re(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,d=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let m=d.replace(/\n+$/,"");return Sr(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(p instanceof K)throw p;return e.state.lastExitCode=1,e.state.env.set("?","1"),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new K(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=e.substitutionDepth;e.substitutionDepth=i+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=e.state.cwd,f=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.cwd=u,e.state.suppressVerbose=f,e.state.lastExitCode=h,e.state.env.set("?",String(h)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr),e.state.bashPid=l,e.substitutionDepth=a;let d=p.stdout.replace(/\n+$/,"");return Sr(d,e.limits.maxStringLength,"command substitution"),d}catch(p){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=f,p instanceof K)throw p;if(p instanceof Ce){e.state.lastExitCode=p.exitCode,e.state.env.set("?",String(p.exitCode)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=p.stdout.replace(/\n+$/,"");return Sr(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let o=await Qg(e,s),a=new pe,l=Ne(a,o);return String(await se(e,l.expression,!0))}return String(await se(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=Nu(i.start,i.end,i.step,i.startStr,i.endStr);if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await re(e,i.word));return s.join(" ")}default:return""}}async function ha(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,p,h]=i;if(e.state.associativeArrays?.has(p)||h.includes("$(")||h.includes("`")||h.includes("${")){let m=await ku(e,h);r=`${p}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&We(e,r)){let p=Bt(e,r);if(p&&p!==r){let h=p.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(h){let[,d,m]=h;if(e.state.associativeArrays?.has(d)||m.includes("$(")||m.includes("`")||m.includes("${")){let y=await ku(e,m);r=`${d}[${y}]`}}}}let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await Ie(e,r,!o);if(!s)return a;let l=!await qn(e,r),{isEmpty:c,effectiveValue:u}=d6(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return t6(e,s,f,Rn);case"AssignDefault":return n6(e,r,s,f,Rn);case"ErrorIfUnset":return r6(e,r,s,f,Rn);case"UseAlternative":return s6(e,s,f,Rn);case"PatternRemoval":{let p=await i6(e,a,s,Rn,an);return Sr(p,e.limits.maxStringLength,"pattern removal"),p}case"PatternReplacement":{let p=await o6(e,a,s,Rn,an);return Sr(p,e.limits.maxStringLength,"pattern replacement"),p}case"Length":return a6(e,r,a);case"LengthSliceError":throw new Nt(r);case"BadSubstitution":throw new Nt(s.text);case"Substring":return l6(e,r,a,s);case"CaseModification":{let p=await c6(e,a,s,Rn,ha);return Sr(p,e.limits.maxStringLength,"case modification"),p}case"Transform":return u6(e,r,a,l,s);case"Indirection":return f6(e,r,a,l,s,ha,n);case"ArrayKeys":return p6(e,s);case"VarNamePrefix":return h6(e,s);default:return a}}var Ru,zt=I(()=>{"use strict";Pt();ft();ta();Wt();we();na();Xg();Yg();e6();Fs();m6();b6();E6();Xt();sy();ly();on();Tn();fy();Fs();Xt();Ru=1e5});function nC(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new De("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new De("division by 0");return e%t;case"**":if(t<0)throw new De("exponent less than 0");return e**t;case"<<":return e<<t;case">>":return e>>t;case"<":return e<t?1:0;case"<=":return e<=t?1:0;case">":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function my(e,t,n){switch(n){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<<t;case">>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function rC(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function sC(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=e.state.env.get(`${t}_0`);return r!==void 0?r:await Ie(e,t)}function iC(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let n=e.trim();if(!n)return 0;try{let r=new pe,{expr:s,pos:i}=sn(r,n,0);if(i<n.length){let o=n.slice(i).trim().split(/\s+/)[0];throw new De(`${n}: syntax error in expression (error token is "${o}")`)}return s.type==="ArithNumber"?s.value:t||0}catch(r){if(r instanceof De)throw r;let s=n.split(/\s+/).slice(1)[0]||n;throw new De(`${n}: syntax error in expression (error token is "${s}")`)}}async function Mu(e,t){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let r=t.trim();if(!r)return 0;let s=new pe,{expr:i,pos:o}=sn(s,r,0);if(o<r.length){let a=r.slice(o).trim(),l=a.split(/\s+/)[0]||a;throw new De(`syntax error in expression (error token is "${l}")`,"","")}return await se(e,i)}async function Uu(e,t,n=new Set,r=0){if(r>100)throw new De("maximum variable indirection depth exceeded");if(n.has(t))return 0;n.add(t);let s=await sC(e,t);if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s.trim()))return i;let o=s.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await Uu(e,o,n,r+1);let a=new pe,{expr:l,pos:c}=sn(a,o,0);if(c<o.length){let u=o.slice(c).trim(),f=u.split(/\s+/)[0]||u;throw new De(`${o}: syntax error in expression (error token is "${f}")`)}return await se(e,l)}async function ma(e,t){if(t.startsWith("#")){let f=t.slice(1),p=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(p){let d=p[1],m=ce(e,d);return String(m.length)}let h=e.state.env.get(f)||"";return String(h.length)}if(t.startsWith("!")){let f=t.slice(1),p=e.state.env.get(f)||"";return e.state.env.get(p)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let p=t.indexOf(f);p>0&&(r===-1||p<r)&&(r=p,s=f)}if(r===-1)return await Ie(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function se(e,t,n=!1){switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new De("value too great for base");return t.value;case"ArithVariable":return await Uu(e,t.name);case"ArithSpecialVar":{let s=(await Ie(e,t.name)).trim();if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s))return i;let o=new pe,{expr:a}=sn(o,s,0);return await se(e,a)}case"ArithNested":return await se(e,t.expression);case"ArithCommandSubst":{if(e.execFn){let r=await e.execFn(t.command,{signal:e.state.signal});r.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+r.stderr);let s=r.stdout.trim();return Number.parseInt(s,10)||0}return 0}case"ArithBracedExpansion":{let r=await ma(e,t.content);return Number.parseInt(r,10)||0}case"ArithDynamicBase":{let r=await ma(e,t.baseExpr),s=Number.parseInt(r,10);if(s<2||s>64)return 0;let i=`${s}#${t.value}`;return ki(i)}case"ArithDynamicNumber":{let s=await ma(e,t.prefix)+t.suffix;return ki(s)}case"ArithArrayElement":{let r=e.state.associativeArrays?.has(t.array),s=async i=>{let o=e.state.env.get(i);return o!==void 0?await Mu(e,o):0};if(t.stringKey!==void 0)return await s(`${t.array}_${t.stringKey}`);if(r&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await s(`${t.array}_${t.index.name}`);if(r&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let i=await Ie(e,t.index.name);return await s(`${t.array}_${i}`)}if(t.index){let i=await se(e,t.index,n);if(i<0){let l=ce(e,t.array),c=e.state.currentLine;if(l.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
|
|
801
|
+
`,0;let f=Math.max(...l.map(([p])=>typeof p=="number"?p:0))+1+i;if(f<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
|
|
802
|
+
`,0;i=f}let o=`${t.array}_${i}`,a=e.state.env.get(o);if(a!==void 0)return Mu(e,a);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return Mu(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new Ot(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new De("double subscript","","");case"ArithNumberSubscript":throw new De(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new De(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new De(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await se(e,t.left,n)||await se(e,t.right,n)?1:0;if(t.operator==="&&")return await se(e,t.left,n)&&await se(e,t.right,n)?1:0;let r=await se(e,t.left,n),s=await se(e,t.right,n);return nC(r,s,t.operator)}case"ArithUnary":{let r=await se(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await Ie(e,s),10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),o;if(t.operand.stringKey!==void 0)o=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)o=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await Ie(e,t.operand.index.name);o=`${s}_${c}`}else if(t.operand.index){let c=await se(e,t.operand.index,n);o=`${s}_${c}`}else return r;let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Bs(e,i,n);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Bs(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await Ie(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await se(e,t.operand.subscript,n),o=`${s}_${i}`,a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}return r}return rC(r,t.operator)}case"ArithTernary":return await se(e,t.condition,n)?await se(e,t.consequent,n):await se(e,t.alternate,n);case"ArithAssignment":{let r=t.variable,s=r;if(t.stringKey!==void 0)s=`${r}_${t.stringKey}`;else if(t.subscript){let l=e.state.associativeArrays?.has(r);if(l&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)s=`${r}_${t.subscript.name}`;else if(l&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix){let c=await Ie(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await se(e,t.subscript,n);s=`${r}_${c}`}else{let c=await se(e,t.subscript,n);if(c<0){let u=ce(e,r);u.length>0&&(c=Math.max(...u.map(([p])=>typeof p=="number"?p:0))+1+c)}s=`${r}_${c}`}}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await se(e,t.value,n),a=my(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithGroup":return await se(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Bs(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Uu(e,r):Number.parseInt(r,10)||0}case"ArithDynamicAssignment":{let r="";if(t.target.type==="ArithConcat")for(let l of t.target.parts)r+=await Bs(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await Ie(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=r;if(t.subscript){let l=await se(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await se(e,t.value,n),a=my(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let a of t.nameExpr.parts)r+=await Bs(e,a,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await Ie(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await se(e,t.subscript,n),i=`${r}_${s}`,o=e.state.env.get(i);return o!==void 0?iC(o):0}default:return 0}}async function Bs(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await se(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await Ie(e,t.name):t.name;case"ArithSpecialVar":return await Ie(e,t.name);case"ArithBracedExpansion":return await ma(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Bs(e,s,n);return r}default:return String(await se(e,t,n))}}var Wt=I(()=>{"use strict";Pt();ft();we();zt()});function N7(){throw new Error("node:dns is not available in browser environments")}var I7=I(()=>{"use strict"});Xs();cn();var zc=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(qf(),Vf))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Qf(),Kf))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(r1(),n1))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(a1(),o1))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(c1(),l1))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(h1(),p1))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(m1(),d1))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(y1(),g1))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(b1(),w1))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(E1(),x1))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(S1(),A1))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(k1(),v1))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(I1(),N1))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(T1(),$1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(D1(),P1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(F1(),_1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(U1(),M1))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(W1(),B1))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(eo(),Ji))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(eo(),Ji))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(eo(),Ji))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(Dp(),Pp))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(Vp(),Gp))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(vh(),Ch))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(_h(),Dh))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(Lh(),Fh))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(Uh(),Mh))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(Wh(),Bh))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(jh(),Hh))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(qh(),Vh))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(Kh(),Zh))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Yh(),Xh))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(td(),ed))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(sd(),rd))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(ld(),ad))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(gd(),md))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(bd(),wd))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(Ed(),xd))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(Sd(),Ad))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(Rd(),Od))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(Dd(),Pd))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>(Fd(),_d))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(Ud(),Md))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(zd(),Wd))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(Gd(),jd))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(qd(),Vd))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(ec(),Jl))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(ec(),Jl))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(Kd(),Zd))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(nc(),tc))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(nc(),tc))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(Sm(),Am))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(km(),vm))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>($m(),Im))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(Om(),Tm))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(Dm(),Pm))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>(Fm(),_m))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(Mm(),Lm))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(Bm(),Um))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(zm(),Wm))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(Gm(),jm))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(qm(),Vm))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(Km(),Zm))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(J0(),Y0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(t2(),e2))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(r2(),n2))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(i2(),s2))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(a2(),o2))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(c2(),l2))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(f2(),u2))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(h2(),p2))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).zcatCommand}],kA=[],NA=[],D2=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(R2(),O2))).curlCommand}],P2=new Map;function Vo(e){return{name:e.name,async execute(t,n){let r=P2.get(e.name);return r||(r=await bt.runTrustedAsync(()=>e.load()),P2.set(e.name,r)),n.coverage,r.execute(t,n)}}}function IA(){return zc.map(e=>e.name)}function $A(){return D2.map(e=>e.name)}function _2(e){return(e?zc.filter(n=>e.includes(n.name)):zc).map(Vo)}function F2(){return D2.map(Vo)}function L2(){return kA.map(Vo)}function M2(){return NA.map(Vo)}function U2(e){return"load"in e&&typeof e.load=="function"}function TA(e,t){return{name:e,trusted:!0,execute:t}}function B2(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}ye();ye();Lc();function ke(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function ut(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function qo(e){let t=ke(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Zo(e,t){if(t.startsWith("/"))return ke(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return ke(n)}function dr(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ko(e,t){if(t.startsWith("/"))return ke(t);let n=qo(e);return ke(dr(n,t))}var Rs=new TextEncoder;function RA(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var sr=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[n,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(n,r):RA(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}ensureParentDirs(t){let n=qo(t);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,n,r,s){ut(t,"write");let i=ke(t);this.ensureParentDirs(i);let o=Go(r),a=Fc(n,o);this.data.set(i,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){ut(t,"write");let s=ke(t);this.ensureParentDirs(s),this.data.set(s,{type:"file",lazy:n,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await n.lazy(),i={type:"file",content:typeof r=="string"?Rs.encode(r):r,mode:n.mode,mtime:n.mtime};return this.data.set(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=Go(n);return vi(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return vi(n,"binary")}async readFileBuffer(t){ut(t,"open");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let s=await this.materializeLazy(n,r);return s.content instanceof Uint8Array?s.content:Rs.encode(s.content)}return r.content instanceof Uint8Array?r.content:Rs.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){ut(t,"append");let s=ke(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Go(r),a=Fc(n,o);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(s,l));let c="content"in l&&l.content instanceof Uint8Array?l.content:Rs.encode("content"in l?l.content:""),u=new Uint8Array(c.length+a.length);u.set(c),u.set(a,c.length),this.data.set(s,{type:"file",content:u,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,n,r)}async exists(t){if(t.includes("\0"))return!1;try{let n=this.resolvePathWithSymlinks(t);return this.data.has(n)}catch{return!1}}async stat(t){ut(t,"stat");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Rs.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(t){ut(t,"lstat");let n=this.resolveIntermediateSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Rs.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let n=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];s=`${s}/${a}`;let l=this.data.get(s),c=0,u=40;for(;l&&l.type==="symlink"&&c<u;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(s),s=Ko(s,l.target),l=this.data.get(s),c++}if(c>=u)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let n=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let o of r){s=`${s}/${o}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=Ko(s,a.target),a=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return s}async mkdir(t,n){this.mkdirSync(t,n)}mkdirSync(t,n){ut(t,"mkdir");let r=ke(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let s=qo(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){ut(t,"scandir");let n=ke(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);s.add(n),n=Ko(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=n==="/"?"/":`${n}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(i)){let c=a.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!o.has(u)&&o.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,n){ut(t,"rm");let r=ke(t),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(s.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let o of i){let a=dr(r,o);await this.rm(a,n)}}}this.data.delete(r)}async cp(t,n,r){ut(t,"cp"),ut(n,"cp");let s=ke(t),i=ke(n),o=this.data.get(s);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=dr(s,l),u=dr(i,l);await this.cp(c,u,r)}}}async mv(t,n){await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){return Zo(t,n)}async chmod(t,n){ut(t,"chmod");let r=ke(t),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);s.mode=n}async symlink(t,n){ut(n,"symlink");let r=ke(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,n){ut(t,"link"),ut(n,"link");let r=ke(t),s=ke(n),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(s),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){ut(t,"readlink");let n=ke(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){ut(t,"realpath");let n=this.resolvePathWithSymlinks(t);if(!this.data.has(n))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return n}async utimes(t,n,r){ut(t,"utimes");let s=ke(t),i=this.resolvePathWithSymlinks(s),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};jc();function PA(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function DA(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function _A(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function FA(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${j2}
|
|
803
|
+
`),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
|
|
804
|
+
`),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>Hc(t)):e.writeFileSync("/proc/self/status",Hc(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function G2(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){PA(e)&&(DA(e,t),_A(e),FA(e,n))}An();tr();we();var LA=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],MA=["braceexpand","hashall","interactive-comments"];function Gc(e){let t=[],n=[...MA.map(r=>({name:r,enabled:!0})),...LA.map(r=>({name:r,enabled:e[r]}))].sort((r,s)=>r.name.localeCompare(s.name));for(let r of n)r.enabled&&t.push(r.name);return t.join(":")}function Ps(e){e.state.env.set("SHELLOPTS",Gc(e.state.options))}var UA=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Vc(e){let t=[];for(let n of UA)e[n]&&t.push(n);return t.join(":")}function qc(e){e.state.env.set("BASHOPTS",Vc(e.state.shoptOptions))}ye();tr();Kr();cn();ft();Kr();var yS="BASH_ALIAS_";function Dg(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function _g(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Fg(e,t){return e.env.get(`${yS}${t}`)}function yu(e,t,n){if(!t.name||!Dg(t.name))return t;let r=_g(t.name);if(!r)return t;let s=Fg(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new pe,o=s,a=s.endsWith(" ");if(!a)for(let f of t.args){let p=Mg(f);o+=` ${p}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof Ct)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return Lg(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return Lg(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(Dg(f)){let p=_g(f);if(p&&Fg(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},d=yu(e,h,n);d!==h&&(u={...u,name:d.name,args:[...d.args]})}}}return u}catch(i){throw n.delete(r),i}}function Lg(e,t){let n=t;for(let o of e.args){let a=Mg(o);n+=` ${a}`}let r=new pe,s=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${n.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:s,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Mg(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${n.value}'`;break;case"DoubleQuoted":t+=`"${n.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${n.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${n.expression}))`;break;case"Glob":t+=n.pattern;break;default:break}return t}Wt();zt();bn();async function gy(e,t){let n=t.parts.map(u=>u.type==="Literal"?u.value:"\0").join(""),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(")"))return null;let s=r[1],i=[],o=!1,a="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!o){let p=f.indexOf("=(");p!==-1&&(o=!0,f=f.slice(p+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(a||l)&&(i.push(a),a="",l=!1):h&&(a+=h)}}else if(o)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=Ds({type:"Word",parts:[u]});else{(a||l)&&(i.push(a),a="",l=!1);let p=await Pn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await re(e,{type:"Word",parts:[u]});a+=f}(a||l)&&i.push(a);let c=i.map(u=>/^\[.+\]=/.test(u)?u:u===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(u)&&!u.startsWith("'")&&!u.startsWith('"')?`'${u.replace(/'/g,"'\\''")}'`:u);return`${s}=(${c.join(" ")})`}async function yy(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let y=g.value.indexOf("+=");if(y!==-1){let b=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)){n=m,r=y,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=y,s=!0;break}}let w=g.value.indexOf("=");if(w!==-1&&(w===0||g.value[w-1]!=="+")){let b=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=w;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await re(e,{type:"Word",parts:[m]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await re(e,p):"";return`${f}${s?"+=":"="}${h}`}var oC=["tar","yq","xan","sqlite3","python3","python"];function wy(e){return oC.includes(e)}ye();An();zn();cn();we();we();var ve=Object.freeze({stdout:"",stderr:"",exitCode:0});function xe(e=""){return{stdout:e,stderr:"",exitCode:0}}function U(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function H(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function ht(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Qn(e,t,n="",r=""){throw new K(e,t,n,r)}function Dt(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new K(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function Bu(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Mn;return H("",`bash: break: only meaningful in a loop
|
|
805
|
+
`,0)}if(t.length>1)throw new pn(1,"",`bash: break: too many arguments
|
|
806
|
+
`);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r))throw new pn(128,"",`bash: break: ${t[0]}: numeric argument required
|
|
807
|
+
`);if(r<1)throw new gt(1,"",`bash: break: loop count out of range
|
|
808
|
+
`);n=r}throw new gt(n)}async function Wu(e,t){let n,r=!1,s=!1,i=0;for(;i<t.length;)if(t[i]==="--"){i++;break}else if(t[i]==="-L")s=!1,i++;else if(t[i]==="-P")s=!0,i++;else if(t[i].startsWith("-")&&t[i]!=="-")i++;else break;let o=t.slice(i);if(o.length>1)return U(`bash: cd: too many arguments
|
|
809
|
+
`,2);if(o.length===0||o[0]==="~"?n=e.state.env.get("HOME")||"/":o[0]==="-"?(n=e.state.previousDir,r=!0):n=o[0],!n.startsWith("/")&&!n.startsWith("./")&&!n.startsWith("../")&&n!=="."&&n!==".."){let f=e.state.env.get("CDPATH");if(f){let p=f.split(":").filter(h=>h);for(let h of p){let d=h.startsWith("/")?`${h}/${n}`:`${e.state.cwd}/${h}/${n}`;try{if((await e.fs.stat(d)).isDirectory){n=d,r=!0;break}}catch{}}}}let l=(n.startsWith("/")?n:`${e.state.cwd}/${n}`).split("/").filter(f=>f&&f!=="."),c="";for(let f of l)if(f==="..")c=c.split("/").slice(0,-1).join("/")||"/";else{c=c?`${c}/${f}`:`/${f}`;try{if(!(await e.fs.stat(c)).isDirectory)return U(`bash: cd: ${n}: Not a directory
|
|
810
|
+
`)}catch{return U(`bash: cd: ${n}: No such file or directory
|
|
811
|
+
`)}}let u=c||"/";if(s)try{u=await e.fs.realpath(u)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=u,e.state.env.set("PWD",e.state.cwd),e.state.env.set("OLDPWD",e.state.previousDir),xe(r?`${u}
|
|
812
|
+
`:"")}ft();Pt();ft();Qe();Wt();zt();bn();function zu(e,t){return e.fs.resolvePath(e.state.cwd,t)}var aC=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function ga(e){return aC.includes(e)}async function ya(e,t,n){let r=zu(e,n);switch(t){case"-e":case"-a":return e.fs.exists(r);case"-f":return await e.fs.exists(r)?(await e.fs.stat(r)).isFile:!1;case"-d":return await e.fs.exists(r)?(await e.fs.stat(r)).isDirectory:!1;case"-r":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&256)!==0:!1;case"-w":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&128)!==0:!1;case"-x":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&64)!==0:!1;case"-s":return await e.fs.exists(r)?(await e.fs.stat(r)).size>0:!1;case"-L":case"-h":try{return(await e.fs.lstat(r)).isSymbolicLink}catch{return!1}case"-k":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&512)!==0:!1;case"-g":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&1024)!==0:!1;case"-u":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&2048)!==0:!1;case"-G":case"-O":return e.fs.exists(r);case"-b":return!1;case"-c":return["/dev/null","/dev/zero","/dev/random","/dev/urandom","/dev/tty","/dev/stdin","/dev/stdout","/dev/stderr"].includes(r);case"-p":return!1;case"-S":return!1;case"-t":return!1;case"-N":return e.fs.exists(r);default:return!1}}var lC=["-nt","-ot","-ef"];function wa(e){return lC.includes(e)}async function ba(e,t,n,r){let s=zu(e,n),i=zu(e,r);switch(t){case"-nt":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime>a.mtime}catch{return!1}case"-ot":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime<a.mtime}catch{return!1}case"-ef":try{if(!await e.fs.exists(s)||!await e.fs.exists(i))return!1;let o=e.fs.resolvePath(e.state.cwd,s),a=e.fs.resolvePath(e.state.cwd,i);return o===a}catch{return!1}default:return!1}}var cC=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function xa(e){return cC.has(e)}function Ea(e,t,n){switch(e){case"-eq":return t===n;case"-ne":return t!==n;case"-lt":return t<n;case"-le":return t<=n;case"-gt":return t>n;case"-ge":return t>=n}}function Ri(e){return e==="="||e==="=="||e==="!="}function Aa(e,t,n,r=!1,s=!1,i=!1){if(r){let a=Ws(t,n,s,i);return e==="!="?!a:a}if(s){let a=t.toLowerCase()===n.toLowerCase();return e==="!="?!a:a}let o=t===n;return e==="!="?!o:o}var uC=new Set(["-z","-n"]);function Sa(e){return uC.has(e)}function Ca(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}Pt();ft();Wt();bn();async function va(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let r=n[1],s=n[2];if(e.state.associativeArrays?.has(r)){let a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),e.state.env.has(`${r}_${a}`)}let o;try{let a=new pe,l=Ne(a,s);o=await se(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=pt(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
|
|
813
|
+
`,!1;if(o=Math.max(...a)+1+o,o<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
|
|
814
|
+
`,!1}return e.state.env.has(`${r}_${o}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?$n(e,t).length>0:pt(e,t).length>0}async function Cr(e,t){switch(t.type){case"CondBinary":{let n=await re(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await re(e,t.right);s=_s(i)}else s=await Du(e,t.right);else Ri(t.operator)&&!r?s=await _u(e,t.right):s=await re(e,t.right);if(Ri(t.operator)){let i=e.state.shoptOptions.nocasematch;return Aa(t.operator,n,s,!r,i,!0)}if(xa(t.operator))return Ea(t.operator,await xy(e,n),await xy(e,s));if(wa(t.operator))return ba(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=dC(s),l=X(o,i?"i":"").match(n);if(Vn(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)e.state.env.set(`BASH_REMATCH_${c}`,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await re(e,t.operand);return ga(t.operator)?ya(e,t.operator,n):Sa(t.operator)?Ca(t.operator,n):t.operator==="-v"?await va(e,n):t.operator==="-o"?ju(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await re(e,t.operand.expression.word)})`!=="":!await Cr(e,t.operand);case"CondAnd":return await Cr(e,t.left)?await Cr(e,t.right):!1;case"CondOr":return await Cr(e,t.left)?!0:await Cr(e,t.right);case"CondGroup":return await Cr(e,t.expression);case"CondWord":return await re(e,t.word)!=="";default:return!1}}async function Pi(e,t){if(t.length===0)return H("","",1);if(t.length===1)return ht(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?U(`test: '(' without matching ')'
|
|
815
|
+
`,2):ga(r)?ht(await ya(e,r,s)):Sa(r)?ht(Ca(r,s)):r==="!"?ht(!s):r==="-v"?ht(await va(e,s)):r==="-o"?ht(ju(e,s)):r==="="||r==="=="||r==="!="||r==="<"||r===">"||r==="-eq"||r==="-ne"||r==="-lt"||r==="-le"||r==="-gt"||r==="-ge"||r==="-nt"||r==="-ot"||r==="-ef"?U(`test: ${r}: unary operator expected
|
|
816
|
+
`,2):H("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if(Ri(s))return ht(Aa(s,r,i));if(xa(s)){let o=ka(r),a=ka(i);return!o.valid||!a.valid?H("","",2):ht(Ea(s,o.value,a.value))}if(wa(s))return ht(await ba(e,s,r,i));switch(s){case"-a":return ht(r!==""&&i!=="");case"-o":return ht(r!==""||i!=="");case">":return ht(r>i);case"<":return ht(r<i)}if(r==="!"){let o=await Pi(e,[s,i]);return H("",o.stderr,o.exitCode===0?1:o.exitCode===1?0:o.exitCode)}if(r==="("&&i===")")return ht(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Pi(e,t.slice(1));return H("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Pi(e,[t[1],t[2]])}let n=await Ay(e,t,0);return n.pos<t.length?U(`test: too many arguments
|
|
817
|
+
`,2):ht(n.value)}async function Ay(e,t,n){return fC(e,t,n)}async function fC(e,t,n){let{value:r,pos:s}=await by(e,t,n);for(;t[s]==="-o";){let i=await by(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function by(e,t,n){let{value:r,pos:s}=await Hu(e,t,n);for(;t[s]==="-a";){let i=await Hu(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Hu(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Hu(e,t,n+1);return{value:!r,pos:s}}return pC(e,t,n)}async function pC(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await Ay(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if(Ri(s)){let i=r,o=t[n+2]??"";return{value:Aa(s,i,o),pos:n+3}}if(xa(s)){let i=ka(r),o=ka(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ea(s,i.value,o.value),pos:n+3}}if(wa(s)){let i=r,o=t[n+2]??"";return{value:await ba(e,s,i,o),pos:n+3}}if(ga(r)){let i=t[n+1]??"";return{value:await ya(e,r,i),pos:n+2}}if(Sa(r)){let i=t[n+1]??"";return{value:Ca(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await va(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:ju(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Ws(e,t,n=!1,r=!1){let s=`^${Sy(t,r)}$`;return X(s,n?"is":"s").test(e)}function Sy(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Cy(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=vy(o),l=a.map(u=>Sy(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=a.map(h=>ky(h,t));if(f.every(h=>h!==null)&&f.every(h=>h===f[0])&&f[0]!==null){let h=f[0];if(h===0)n+="(?:.+)";else{let d=[];h>0&&d.push(`.{0,${h-1}}`),d.push(`.{${h+1},}`),d.push(`(?!(?:${c})).{${h}}`),n+=`(?:${d.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){let o=e.slice(r+1,i);o.startsWith("!")?n+=`[^${o.slice(1)}]`:n+=e.slice(r,i+1),r=i}else n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function Cy(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function vy(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function ky(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Cy(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=vy(o).map(c=>ky(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function ju(e,t){let r=new Map([["errexit",()=>e.state.options.errexit===!0],["nounset",()=>e.state.options.nounset===!0],["pipefail",()=>e.state.options.pipefail===!0],["xtrace",()=>e.state.options.xtrace===!0],["e",()=>e.state.options.errexit===!0],["u",()=>e.state.options.nounset===!0],["x",()=>e.state.options.xtrace===!0]]).get(t);return r?r():!1}async function xy(e,t){if(t=t.trim(),t==="")return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return Ey(t);try{let n=new pe,r=Ne(n,t);return await se(e,r.expression)}catch{return Ey(t)}}function hC(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function Ey(e){if(e=e.trim(),e==="")return 0;let t=!1;e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let s=Number.parseInt(r[1],10);s>=2&&s<=64?n=hC(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function ka(e){if(e=e.trim(),e==="")return{value:0,valid:!0};let t=!1;if(e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function dC(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]==="["){let r=mC(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function mC(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);o+=gC(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let p=e.slice(n+2,f);o+=p,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function gC(e){return new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]).get(e)??""}zt();Pt();ft();Wt();Er();function Xn(e){let t=[],n="",r=!1,s=!1,i=!1,o=!1;for(let a of e){if(i){n+=a,i=!1,o=!0;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){r||(o=!0),r=!r;continue}if(a==='"'&&!r){s||(o=!0),s=!s;continue}if((a===" "||a===" "||a===`
|
|
818
|
+
`)&&!r&&!s){o&&(t.push(n),n="",o=!1);continue}n+=a,o=!0}return o&&t.push(n),t}function Na(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!=="["){n++;continue}n++;let r="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)r+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&e[n]!=="]"&&e[n]!=="=";)r+=e[n],n++;for(;n<e.length&&e[n]!=="]";)n++;if(e[n]==="]"&&n++,e[n]!=="=")continue;n++;let s="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)e[n]==="\\"&&n+1<e.length&&n++,s+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;t.push([r,s])}return t}function Ny(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:Xn(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes("=")){let r=e.indexOf("=");return{name:e.slice(0,r),isArray:!1,value:e.slice(r+1)}}return{name:e,isArray:!1}}async function yC(e,t){try{let n=new pe,r=Ne(n,t);return await se(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Iy(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=Et(e,r);if(u)return u}if(s&&i){for(let u=0;u<i.length;u++)e.state.env.set(`${r}_${u}`,i[u]);e.state.env.set(`${r}__length`,String(i.length))}else if(a!==void 0&&o!==void 0){let u=await yC(e,a);e.state.env.set(`${r}_${u}`,o);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else o!==void 0&&e.state.env.set(r,o);return l&&Jt(e,r),null}function vr(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function zs(e,t){return e.state.localVarDepth?.get(t)}function Ia(e,t){e.state.localVarDepth?.delete(t)}function $y(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function $a(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function Ty(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}we();zt();var Gu=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function Oy(e){return Gu.has(e)}var Vu=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Hs=new Set([":","true","false","cd","export","unset","exit","local","set","break","continue","return","eval","shift","getopts","compgen","complete","compopt","pushd","popd","dirs","source",".","read","mapfile","readarray","declare","typeset","readonly","let","command","shopt","exec","test","[","echo","printf","pwd","alias","unalias","type","hash","ulimit","umask","trap","times","wait","kill","jobs","fg","bg","disown","suspend","fc","history","help","enable","builtin","caller"]);zt();async function kr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
|
|
819
|
+
`;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
|
|
820
|
+
`}catch{}return null}function Yn(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>127)return"utf8";return"binary"}function wC(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}async function Ta(e,t){let n=new Map;for(let r=0;r<t.length;r++){let s=t[r];if(s.target.type==="HereDoc")continue;if(s.operator===">&"||s.operator==="<&"){if(Oi(e,s.target))return{targets:n,error:`bash: $@: ambiguous redirect
|
|
821
|
+
`};n.set(r,await re(e,s.target))}else{let o=await Jr(e,s.target);if("error"in o)return{targets:n,error:o.error};n.set(r,o.target)}}return{targets:n}}function bC(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd,n=e.limits.maxFileDescriptors;if(t>=n)throw new Error(`bash: cannot allocate file descriptor: too many open files (max ${n})`);return e.state.nextFd++,t}async function Oa(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===">&"||n.operator==="<&")&&n.target.type==="Word"&&await re(e,n.target)==="-"){let i=e.state.env.get(n.fdVariable);if(i!==void 0){let o=Number.parseInt(i,10);Number.isNaN(o)||e.state.fileDescriptors.delete(o)}continue}let r=bC(e);if(e.state.env.set(n.fdVariable,String(r)),n.target.type==="Word"){let s=await re(e,n.target);if(n.operator===">&"||n.operator==="<&"){let i=Number.parseInt(s,10);if(!Number.isNaN(i)){let o=e.state.fileDescriptors.get(i);o!==void 0&&(Dt(e),e.state.fileDescriptors.set(r,o));continue}}if(n.operator===">"||n.operator===">>"||n.operator===">|"||n.operator==="&>"||n.operator==="&>>"){let i=e.fs.resolvePath(e.state.cwd,s);(n.operator===">"||n.operator===">|"||n.operator==="&>")&&await e.fs.writeFile(i,"","binary"),Dt(e),e.state.fileDescriptors.set(r,`__file__:${i}`)}else if(n.operator==="<<<")Dt(e),e.state.fileDescriptors.set(r,`${s}
|
|
822
|
+
`);else if(n.operator==="<"||n.operator==="<>")try{let i=e.fs.resolvePath(e.state.cwd,s),o=await e.fs.readFile(i);Dt(e),e.state.fileDescriptors.set(r,o)}catch{return H("",`bash: ${s}: No such file or directory
|
|
823
|
+
`,1)}}}return null}async function Dn(e,t){for(let n of t){if(n.target.type==="HereDoc")continue;let r=n.operator===">&";if(n.operator!==">"&&n.operator!==">|"&&n.operator!=="&>"&&!r)continue;let s;if(r){if(s=await re(e,n.target),s==="-"||!Number.isNaN(Number.parseInt(s,10))||n.fd!=null)continue}else{let a=await Jr(e,n.target);if("error"in a)return H("",a.error,1);s=a.target}let i=e.fs.resolvePath(e.state.cwd,s),o=n.operator===">|";if(i.includes("\0"))return H("",`bash: ${s}: No such file or directory
|
|
824
|
+
`,1);try{let a=await e.fs.stat(i);if(a.isDirectory)return H("",`bash: ${s}: Is a directory
|
|
825
|
+
`,1);if(e.state.options.noclobber&&!o&&!a.isDirectory&&s!=="/dev/null")return H("",`bash: ${s}: cannot overwrite existing file
|
|
826
|
+
`,1)}catch{}if(s!=="/dev/null"&&s!=="/dev/stdout"&&s!=="/dev/stderr"&&s!=="/dev/full"&&await e.fs.writeFile(i,"","binary"),s==="/dev/full")return H("",`bash: /dev/full: No space left on device
|
|
827
|
+
`,1)}return null}async function Ry(e,t,n){for(let r=0;r<t.length;r++){let s=t[r];if(s.target.type==="HereDoc")continue;let i=s.operator===">&";if(s.operator!==">"&&s.operator!==">|"&&s.operator!=="&>"&&!i)continue;let o,a=n?.get(r);if(a!==void 0)o=a;else if(i)o=await re(e,s.target);else{let u=await Jr(e,s.target);if("error"in u)return H("",u.error,1);o=u.target}if(i&&(o==="-"||!Number.isNaN(Number.parseInt(o,10))||s.fd!=null))continue;let l=e.fs.resolvePath(e.state.cwd,o);if(l.includes("\0"))return H("",`bash: ${o}: No such file or directory
|
|
828
|
+
`,1);let c=await kr(e,l,o,{checkNoclobber:!0,isClobber:s.operator===">|"});if(c)return H("",c,1)}return null}async function Ze(e,t,n,r){let{stdout:s,stderr:i,exitCode:o}=t,a=s,l=i,u=t.stdoutKind==="bytes"||t.stdoutKind===void 0&&t.stdoutEncoding==="binary"?"binary":"utf8",f=g=>u,p=async g=>{let y=r?.get(g);if(y!==void 0)return y;let w=await Jr(e,n[g].target);return"error"in w?(i+=w.error,o=1,s="",null):w.target};for(let g=0;g<n.length;g++){let y=n[g];if(y.target.type==="HereDoc")continue;let w,b=r?.get(g);if(b!==void 0)w=b;else if(y.operator===">&"||y.operator==="<&"){if(Oi(e,y.target)){i+=`bash: $@: ambiguous redirect
|
|
829
|
+
`,o=1,s="";continue}w=await re(e,y.target)}else{let A=await Jr(e,y.target);if("error"in A){i+=A.error,o=1,s="";continue}w=A.target}if(!y.fdVariable){if(w.includes("\0")){i+=`bash: ${w.replace(/\0/g,"")}: No such file or directory
|
|
830
|
+
`,o=1,s="";continue}switch(y.operator){case">":case">|":{let x=y.fd??1,A=y.operator===">|";if(x===1){if(w==="/dev/stdout")break;if(w==="/dev/stderr"){i+=s,s="";break}if(w==="/dev/full"){i+=`bash: echo: write error: No space left on device
|
|
831
|
+
`,o=1,s="";break}let C=e.fs.resolvePath(e.state.cwd,w),$=await kr(e,C,w,{checkNoclobber:!0,isClobber:A});if($){i+=$,o=1,s="";break}let D=n[g-1];if(D&&(D.operator===">&"||D.operator==="<&")&&(D.fd??1)===2){let P=r?.get(g-1)??await re(e,D.target);if(P==="1"||P==="&1"){await e.fs.writeFile(C,a,f(a)),s=l,i="";break}}let v=n[g+1];if(v&&(v.operator===">&"||v.operator==="<&")&&(v.fd??1)===2){let P=r?.get(g+1)??await re(e,v.target);if(P==="1"||P==="&1"){let k=s+i;await e.fs.writeFile(C,k,f(k)),s="",i="",g++;break}}await e.fs.writeFile(C,s,f(s)),s=""}else if(x===2){if(w==="/dev/stderr")break;if(w==="/dev/stdout"){s+=i,i="";break}if(w==="/dev/full"){i+=`bash: echo: write error: No space left on device
|
|
832
|
+
`,o=1;break}if(w==="/dev/null")i="";else{let C=e.fs.resolvePath(e.state.cwd,w),$=await kr(e,C,w,{checkNoclobber:!0,isClobber:A});if($){i+=$,o=1;break}await e.fs.writeFile(C,i,Yn(i)),i=""}}break}case">>":{let x=y.fd??1;if(x===1){if(w==="/dev/stdout")break;if(w==="/dev/stderr"){i+=s,s="";break}if(w==="/dev/full"){i+=`bash: echo: write error: No space left on device
|
|
833
|
+
`,o=1,s="";break}let A=e.fs.resolvePath(e.state.cwd,w),C=await kr(e,A,w,{});if(C){i+=C,o=1,s="";break}await e.fs.appendFile(A,s,f(s)),s=""}else if(x===2){if(w==="/dev/stderr")break;if(w==="/dev/stdout"){s+=i,i="";break}if(w==="/dev/full"){i+=`bash: echo: write error: No space left on device
|
|
834
|
+
`,o=1;break}let A=e.fs.resolvePath(e.state.cwd,w),C=await kr(e,A,w,{});if(C){i+=C,o=1;break}await e.fs.appendFile(A,i,Yn(i)),i=""}break}case">&":case"<&":{let x=y.fd??1;if(w==="-"){if(x===1){let A=n[g-1];if(A&&(A.operator===">&"||A.operator==="<&")&&(A.fd??1)===2){let C=r?.get(g-1)??await re(e,A.target);s=C==="1"||C==="&1"?l:""}else s=""}else x===2&&(i="");break}if(w.endsWith("-")){let A=w.slice(0,-1),C=Number.parseInt(A,10);if(!Number.isNaN(C)){let $=e.state.fileDescriptors?.get(C);$!==void 0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(x,$),C>=3&&e.state.fileDescriptors?.delete(C)):C===1||C===2?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(x,`__dupout__:${C}`)):C===0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(x,`__dupin__:${C}`)):C>=3&&(i+=`bash: ${C}: Bad file descriptor
|
|
835
|
+
`,o=1)}break}if(w==="2"||w==="&2")x===1&&(i=s+i,s="");else if(w==="1"||w==="&1")s+=i,i="";else{let A=Number.parseInt(w,10);if(Number.isNaN(A)){if(y.operator===">&"){let C=e.fs.resolvePath(e.state.cwd,w),$=await kr(e,C,w,{checkNoclobber:!0});if($){i=$,o=1,s="";break}if(y.fd==null){let D=s+i;await e.fs.writeFile(C,D,f(D)),s="",i=""}else x===1?(await e.fs.writeFile(C,s,f(s)),s=""):x===2&&(await e.fs.writeFile(C,i,Yn(i)),i="")}}else{let C=e.state.fileDescriptors?.get(A);if(C?.startsWith("__file__:")){let $=C.slice(9);x===1?(await e.fs.appendFile($,s,f(s)),s=""):x===2&&(await e.fs.appendFile($,i,Yn(i)),i="")}else if(C?.startsWith("__rw__:")){let $=wC(C);$&&(x===1?(await e.fs.appendFile($.path,s,f(s)),s=""):x===2&&(await e.fs.appendFile($.path,i,Yn(i)),i=""))}else if(C?.startsWith("__dupout__:")){let $=Number.parseInt(C.slice(11),10);if($!==1)if($===2)x===1&&(i=s+i,s="");else{let D=e.state.fileDescriptors?.get($);if(D?.startsWith("__file__:")){let v=D.slice(9);x===1?(await e.fs.appendFile(v,s,f(s)),s=""):x===2&&(await e.fs.appendFile(v,i,Yn(i)),i="")}}}else C?.startsWith("__dupin__:")?(i+=`bash: ${A}: Bad file descriptor
|
|
836
|
+
`,o=1,s=""):A>=3&&(i+=`bash: ${A}: Bad file descriptor
|
|
837
|
+
`,o=1,s="")}}break}case"&>":{if(w==="/dev/full"){i=`bash: echo: write error: No space left on device
|
|
838
|
+
`,o=1,s="";break}let x=e.fs.resolvePath(e.state.cwd,w),A=await kr(e,x,w,{checkNoclobber:!0});if(A){i=A,o=1,s="";break}let C=n[g+1];if(C&&(C.operator===">"||C.operator===">|"||C.operator===">>")&&(C.fd??1)===1){let D=await p(g+1);if(D!==null){let v=e.fs.resolvePath(e.state.cwd,D);await e.fs.writeFile(x,i,Yn(i)),C.operator===">>"?await e.fs.appendFile(v,s,f(s)):await e.fs.writeFile(v,s,f(s)),s="",i="",g++;break}}let $=s+i;await e.fs.writeFile(x,$,f($)),s="",i="";break}case"&>>":{if(w==="/dev/full"){i=`bash: echo: write error: No space left on device
|
|
839
|
+
`,o=1,s="";break}let x=e.fs.resolvePath(e.state.cwd,w),A=await kr(e,x,w,{});if(A){i=A,o=1,s="";break}let C=n[g+1];if(C&&(C.operator===">"||C.operator===">|"||C.operator===">>")&&(C.fd??1)===1){let D=await p(g+1);if(D!==null){let v=e.fs.resolvePath(e.state.cwd,D);await e.fs.appendFile(x,i,Yn(i)),C.operator===">>"?await e.fs.appendFile(v,s,f(s)):await e.fs.writeFile(v,s,f(s)),s="",i="",g++;break}}let $=s+i;await e.fs.appendFile(x,$,f($)),s="",i="";break}}}}let h=e.state.fileDescriptors?.get(1);if(h){if(h==="__dupout__:2")i+=s,s="";else if(h.startsWith("__file__:")){let g=h.slice(9);await e.fs.appendFile(g,s,f(s)),s=""}else if(h.startsWith("__file_append__:")){let g=h.slice(16);await e.fs.appendFile(g,s,f(s)),s=""}}let d=e.state.fileDescriptors?.get(2);if(d){if(d==="__dupout__:1")s+=i,i="";else if(d.startsWith("__file__:")){let g=d.slice(9);await e.fs.appendFile(g,i,Yn(i)),i=""}else if(d.startsWith("__file_append__:")){let g=d.slice(16);await e.fs.appendFile(g,i,Yn(i)),i=""}}let m=H(s,i,o);return t.stdoutKind&&(m.stdoutKind=t.stdoutKind),t.stdoutEncoding==="binary"&&(m.stdoutEncoding="binary"),m}function Py(e,t){if(e.state.options.posix&&Gu.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
|
|
840
|
+
`;throw new Ce(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),ve}async function xC(e,t){let n="";for(let r of t)if((r.operator==="<<"||r.operator==="<<-")&&r.target.type==="HereDoc"){let s=r.target,i=await re(e,s.content);s.stripTabs&&(i=i.split(`
|
|
841
|
+
`).map(a=>a.replace(/^\t+/,"")).join(`
|
|
842
|
+
`)),(r.fd??0)===0&&(n=i)}else if(r.operator==="<<<"&&r.target.type==="Word")n=`${await re(e,r.target)}
|
|
843
|
+
`;else if(r.operator==="<"&&r.target.type==="Word"){let s=await re(e,r.target),i=e.fs.resolvePath(e.state.cwd,s);try{n=await e.fs.readFile(i)}catch{}}return n}async function Ra(e,t,n,r="",s){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,Qn(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,"recursion")),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let i=new Map;for(let c=0;c<n.length;c++)i.set(String(c+1),e.state.env.get(String(c+1))),e.state.env.set(String(c+1),n[c]);i.set("@",e.state.env.get("@")),i.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let o=()=>{let c=e.state.localScopes.length-1,u=e.state.localScopes.pop();if(u)for(let[f,p]of u)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);if(Ty(e,c),e.state.fullyUnsetLocals)for(let[f,p]of e.state.fullyUnsetLocals.entries())p===c&&e.state.fullyUnsetLocals.delete(f);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let f=e.state.localExportedVars.pop();if(f)for(let p of f)e.state.exportedVars?.delete(p)}for(let[f,p]of i)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:a,error:l}=await Ta(e,t.redirections);if(l)return o(),H("",l,1);try{let c=await xC(e,t.redirections),u=r||c,f=await e.executeCommand(t.body,u);return o(),Ze(e,f,t.redirections,a)}catch(c){if(o(),c instanceof St){let u=H(c.stdout,c.stderr,c.exitCode);return Ze(e,u,t.redirections,a)}throw c}}var _y=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],Zu=[".",":","[","alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","declare","dirs","disown","echo","enable","eval","exec","exit","export","false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return","set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","wait"],EC=["autocd","assoc_expand_once","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","dotglob","execfail","expand_aliases","extdebug","extglob","extquote","failglob","force_fignore","globasciiranges","globstar","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lastpipe","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","nocaseglob","nocasematch","nullglob","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath","xpg_echo"],AC=Zu;async function Ku(e,t){let n=[],r=null,s="",i="",o=null,a=!1,l=!1,c=!1,u=null,f=null,p=null,h=[],d=["alias","arrayvar","binding","builtin","command","directory","disabled","enabled","export","file","function","group","helptopic","hostname","job","keyword","running","service","setopt","shopt","signal","stopped","user","variable"];for(let x=0;x<t.length;x++){let A=t[x];if(A==="-v")n.push("variable");else if(A==="-e")n.push("export");else if(A==="-f")n.push("file");else if(A==="-d")n.push("directory");else if(A==="-k")n.push("keyword");else if(A==="-A"){if(x++,x>=t.length)return U(`compgen: -A: option requires an argument
|
|
844
|
+
`,2);let C=t[x];if(!d.includes(C))return U(`compgen: ${C}: invalid action name
|
|
845
|
+
`,2);n.push(C)}else if(A==="-W"){if(x++,x>=t.length)return U(`compgen: -W: option requires an argument
|
|
846
|
+
`,2);r=t[x]}else if(A==="-P"){if(x++,x>=t.length)return U(`compgen: -P: option requires an argument
|
|
847
|
+
`,2);s=t[x]}else if(A==="-S"){if(x++,x>=t.length)return U(`compgen: -S: option requires an argument
|
|
848
|
+
`,2);i=t[x]}else if(A==="-o"){if(x++,x>=t.length)return U(`compgen: -o: option requires an argument
|
|
849
|
+
`,2);let C=t[x];if(C==="plusdirs")a=!0;else if(C==="dirnames")l=!0;else if(C==="default")c=!0;else if(!(C==="filenames"||C==="nospace"||C==="bashdefault"||C==="noquote"))return U(`compgen: ${C}: invalid option name
|
|
850
|
+
`,2)}else if(A==="-F"){if(x++,x>=t.length)return U(`compgen: -F: option requires an argument
|
|
851
|
+
`,2);f=t[x]}else if(A==="-C"){if(x++,x>=t.length)return U(`compgen: -C: option requires an argument
|
|
852
|
+
`,2);p=t[x]}else if(A==="-X"){if(x++,x>=t.length)return U(`compgen: -X: option requires an argument
|
|
853
|
+
`,2);u=t[x]}else if(A==="-G"){if(x++,x>=t.length)return U(`compgen: -G: option requires an argument
|
|
854
|
+
`,2)}else if(A==="--"){h.push(...t.slice(x+1));break}else A.startsWith("-")||h.push(A)}o=h[0]??null;let m=[];if(l){let x=await qu(e,o);m.push(...x)}if(c){let x=await Dy(e,o);m.push(...x)}for(let x of n)if(x==="variable"){let A=SC(e,o);m.push(...A)}else if(x==="export"){let A=CC(e,o);m.push(...A)}else if(x==="function"){let A=vC(e,o);m.push(...A)}else if(x==="builtin"){let A=kC(o);m.push(...A)}else if(x==="keyword"){let A=NC(o);m.push(...A)}else if(x==="alias"){let A=IC(e,o);m.push(...A)}else if(x==="shopt"){let A=$C(o);m.push(...A)}else if(x==="helptopic"){let A=TC(o);m.push(...A)}else if(x==="directory"){let A=await qu(e,o);m.push(...A)}else if(x==="file"){let A=await Dy(e,o);m.push(...A)}else if(x==="user"){let A=OC(o);m.push(...A)}else if(x==="command"){let A=await RC(e,o);m.push(...A)}if(r!==null)try{let x=await PC(e,r),A=DC(e,x);for(let C of A)(o===null||C.startsWith(o))&&m.push(C)}catch{return H("","",1)}if(a){let x=await qu(e,o);for(let A of x)m.includes(A)||m.push(A)}let g="";if(f!==null){let x=e.state.functions.get(f);if(x){let A=new Map;A.set("COMP_WORDS__length",e.state.env.get("COMP_WORDS__length")),e.state.env.set("COMP_WORDS__length","0"),A.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),A.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),A.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let C=new Map;for(let D of e.state.env.keys())(D==="COMPREPLY"||D.startsWith("COMPREPLY_")||D==="COMPREPLY__length")&&(C.set(D,e.state.env.get(D)),e.state.env.delete(D));let $=["compgen",h[0]??"",""];try{let D=await Ra(e,x,$,"");if(D.exitCode!==0)return js(e,A),js(e,C),H("",D.stderr,1);g=D.stdout;let v=_C(e);m.push(...v)}catch{return js(e,A),js(e,C),H("","",1)}js(e,A),js(e,C)}}if(p!==null)try{let x=In(p),A=await e.executeScript(x);if(A.exitCode!==0)return H("",A.stderr,A.exitCode);if(A.stdout){let C=A.stdout.split(`
|
|
855
|
+
`);for(let $ of C)$.length>0&&m.push($)}}catch(x){if(x.name==="ParseException")return U(`compgen: -C: ${x.message}
|
|
856
|
+
`,2);throw x}let y=m;if(u!==null){let x=u.startsWith("!"),A=x?u.slice(1):u;y=m.filter(C=>{let $=Ws(C,A,!1,!0);return x?$:!$})}if(y.length===0&&o!==null)return H(g,"",1);let w=y.map(x=>`${s}${x}${i}`).join(`
|
|
857
|
+
`),b=g+(w?`${w}
|
|
858
|
+
`:"");return xe(b)}function SC(e,t){let n=new Set;for(let s of e.state.env.keys()){if(s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length"))continue;let i=s.split("_")[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?n.add(s):i&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&e.state.env.has(`${i}__length`)&&n.add(i)}let r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function CC(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r=r.filter(s=>s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length")?!1:e.state.env.has(s)),r.sort()}function vC(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(r=>r.startsWith(t))),n.sort()}function kC(e){let t=[...Zu];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function NC(e){let t=[..._y];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function IC(e,t){let n=[];for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);n.push(i)}let r=n;return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function $C(e){let t=[...EC];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function TC(e){let t=[...AC];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}async function qu(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let o=t.lastIndexOf("/");if(o!==-1){let a=t.slice(0,o)||"/";s=t.slice(o+1),a.startsWith("/")?r=a:r=`${e.state.cwd}/${a}`}}let i=await e.fs.readdir(r);for(let o of i){let a=`${r}/${o}`;try{if((await e.fs.stat(a)).isDirectory&&(!s||o.startsWith(s)))if(t?.includes("/")){let c=t.lastIndexOf("/"),u=t.slice(0,c+1);n.push(u+o)}else n.push(o)}catch{}}}catch{}return n.sort()}async function Dy(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let o=t.lastIndexOf("/");if(o!==-1){let a=t.slice(0,o)||"/";s=t.slice(o+1),a.startsWith("/")?r=a:r=`${e.state.cwd}/${a}`}}let i=await e.fs.readdir(r);for(let o of i)if(!s||o.startsWith(s))if(t?.includes("/")){let a=t.lastIndexOf("/"),l=t.slice(0,a+1);n.push(l+o)}else n.push(o)}catch{}return n.sort()}function OC(e){return["root","nobody"]}async function RC(e,t){let n=new Set;for(let i of Zu)n.add(i);for(let i of e.state.functions.keys())n.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&n.add(i.slice(11));for(let i of _y)n.add(i);let r=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of r.split(":"))if(i)try{let o=await e.fs.readdir(i);for(let a of o)n.add(a)}catch{}let s=Array.from(n);return t!==null&&(s=s.filter(i=>i.startsWith(t))),s.sort()}async function PC(e,t){let r=new pe().parseWordFromString(t,!1,!1);return await re(e,r)}function DC(e,t){let n=e.state.env.get("IFS")??`
|
|
859
|
+
`;if(n.length===0)return[t];let r=new Set(n.split("")),s=[],i="",o=0;for(;o<t.length;){let a=t[o];if(a==="\\"&&o+1<t.length){let l=t[o+1];i+=l,o+=2}else r.has(a)?(i.length>0&&(s.push(i),i=""),o++):(i+=a,o++)}return i.length>0&&s.push(i),s}function js(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function _C(e){let t=[];if(e.state.env.get("COMPREPLY__length")!==void 0){let s=ce(e,"COMPREPLY");for(let[,i]of s)t.push(i)}else{let s=e.state.env.get("COMPREPLY");s!==void 0&&t.push(s)}return t}var FC=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function Xu(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=!1,i,o,a,l=[],c=[],u=[];for(let f=0;f<t.length;f++){let p=t[f];if(p==="-p")n=!0;else if(p==="-r")r=!0;else if(p==="-D")s=!0;else if(p==="-W"){if(f++,f>=t.length)return U(`complete: -W: option requires an argument
|
|
860
|
+
`,2);i=t[f]}else if(p==="-F"){if(f++,f>=t.length)return U(`complete: -F: option requires an argument
|
|
861
|
+
`,2);o=t[f]}else if(p==="-o"){if(f++,f>=t.length)return U(`complete: -o: option requires an argument
|
|
862
|
+
`,2);let h=t[f];if(!FC.includes(h))return U(`complete: ${h}: invalid option name
|
|
863
|
+
`,2);l.push(h)}else if(p==="-A"){if(f++,f>=t.length)return U(`complete: -A: option requires an argument
|
|
864
|
+
`,2);c.push(t[f])}else if(p==="-C"){if(f++,f>=t.length)return U(`complete: -C: option requires an argument
|
|
865
|
+
`,2);a=t[f]}else if(p==="-G"){if(f++,f>=t.length)return U(`complete: -G: option requires an argument
|
|
866
|
+
`,2)}else if(p==="-P"){if(f++,f>=t.length)return U(`complete: -P: option requires an argument
|
|
867
|
+
`,2)}else if(p==="-S"){if(f++,f>=t.length)return U(`complete: -S: option requires an argument
|
|
868
|
+
`,2)}else if(p==="-X"){if(f++,f>=t.length)return U(`complete: -X: option requires an argument
|
|
869
|
+
`,2)}else if(p==="--"){u.push(...t.slice(f+1));break}else p.startsWith("-")||u.push(p)}if(r){if(u.length===0)return e.state.completionSpecs.clear(),xe("");for(let f of u)e.state.completionSpecs.delete(f);return xe("")}if(n)return u.length===0?Qu(e):Qu(e,u);if(t.length===0||u.length===0&&!i&&!o&&!a&&l.length===0&&c.length===0&&!s)return Qu(e);if(o&&u.length===0&&!s)return U(`complete: -F: option requires a command name
|
|
870
|
+
`,2);if(s){let f={isDefault:!0};return i!==void 0&&(f.wordlist=i),o!==void 0&&(f.function=o),a!==void 0&&(f.command=a),l.length>0&&(f.options=l),c.length>0&&(f.actions=c),e.state.completionSpecs.set("__default__",f),xe("")}for(let f of u){let p=Object.create(null);i!==void 0&&(p.wordlist=i),o!==void 0&&(p.function=o),a!==void 0&&(p.command=a),l.length>0&&(p.options=l),c.length>0&&(p.actions=c),e.state.completionSpecs.set(f,p)}return xe("")}function Qu(e,t){let n=e.state.completionSpecs;if(!n||n.size===0){if(t&&t.length>0){let i="";for(let o of t)i+=`complete: ${o}: no completion specification
|
|
871
|
+
`;return H("",i,1)}return xe("")}let r=[],s=t||Array.from(n.keys());for(let i of s){if(i==="__default__")continue;let o=n.get(i);if(!o){if(t)return H(r.join(`
|
|
872
|
+
`)+(r.length>0?`
|
|
873
|
+
`:""),`complete: ${i}: no completion specification
|
|
874
|
+
`,1);continue}let a="complete";if(o.options)for(let l of o.options)a+=` -o ${l}`;if(o.actions)for(let l of o.actions)a+=` -A ${l}`;o.wordlist!==void 0&&(o.wordlist.includes(" ")||o.wordlist.includes("'")?a+=` -W '${o.wordlist}'`:a+=` -W ${o.wordlist}`),o.function!==void 0&&(a+=` -F ${o.function}`),o.isDefault&&(a+=" -D"),a+=` ${i}`,r.push(a)}return r.length===0?xe(""):xe(`${r.join(`
|
|
875
|
+
`)}
|
|
876
|
+
`)}var Fy=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function Yu(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=[],i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a];if(l==="-D")n=!0;else if(l==="-E")r=!0;else if(l==="-o"){if(a++,a>=t.length)return U(`compopt: -o: option requires an argument
|
|
877
|
+
`,2);let c=t[a];if(!Fy.includes(c))return U(`compopt: ${c}: invalid option name
|
|
878
|
+
`,2);s.push(c)}else if(l==="+o"){if(a++,a>=t.length)return U(`compopt: +o: option requires an argument
|
|
879
|
+
`,2);let c=t[a];if(!Fy.includes(c))return U(`compopt: ${c}: invalid option name
|
|
880
|
+
`,2);i.push(c)}else if(l==="--"){o.push(...t.slice(a+1));break}else!l.startsWith("-")&&!l.startsWith("+")&&o.push(l)}if(n){let a=e.state.completionSpecs.get("__default__")??{isDefault:!0},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.completionSpecs.set("__default__",a),xe("")}if(r){let a=e.state.completionSpecs.get("__empty__")??{},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.completionSpecs.set("__empty__",a),xe("")}if(o.length>0){for(let a of o){let l=e.state.completionSpecs.get(a)??{},c=new Set(l.options??[]);for(let u of s)c.add(u);for(let u of i)c.delete(u);l.options=c.size>0?Array.from(c):void 0,e.state.completionSpecs.set(a,l)}return xe("")}return U(`compopt: not currently executing completion function
|
|
881
|
+
`,1)}we();function Ju(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Mn;return H("",`bash: continue: only meaningful in a loop
|
|
882
|
+
`,0)}if(t.length>1)throw new pn(1,"",`bash: continue: too many arguments
|
|
883
|
+
`);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r))throw new pn(128,"",`bash: continue: ${t[0]}: numeric argument required
|
|
884
|
+
`);if(r<1)throw new gt(1,"",`bash: continue: loop count out of range
|
|
885
|
+
`);n=r}throw new kt(n)}Pt();ft();Wt();bn();Tn();Er();function ot(e,t){let n=e.state.env.get("HOME")||"/home/user";return t.split(":").map(i=>i==="~"?n:i==="~root"?"/root":i.startsWith("~/")?n+i.slice(1):i.startsWith("~root/")?`/root${i.slice(5)}`:i).join(":")}bn();Tn();function ef(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function tf(e){let t="$'";for(let n=0;n<e.length;n++){let r=e[n],s=e.charCodeAt(n);s===7?t+="\\a":s===8?t+="\\b":s===9?t+="\\t":s===10?t+="\\n":s===11?t+="\\v":s===12?t+="\\f":s===13?t+="\\r":s===27?t+="\\e":s===39?t+="\\'":s===92?t+="\\\\":s<32||s===127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return t+="'",t}function Pa(e){return ef(e)?tf(e):/^[a-zA-Z0-9_/.:\-@%+,=]*$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function es(e){return ef(e)?tf(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function nf(e){return ef(e)?tf(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ly(e,t){let n="";return e.state.integerVars?.has(t)&&(n+="i"),e.state.lowercaseVars?.has(t)&&(n+="l"),We(e,t)&&(n+="n"),e.state.readonlyVars?.has(t)&&(n+="r"),e.state.uppercaseVars?.has(t)&&(n+="u"),e.state.exportedVars?.has(t)&&(n+="x"),n===""?"--":`-${n}`}function rf(e){return e===""?"''":/[\s'\\]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function My(e,t){let n="",r="",s=!1;for(let i of t){let o=Ly(e,i);if(e.state.associativeArrays?.has(i)){let u=$n(e,i);if(u.length===0)n+=`declare -A ${i}=()
|
|
886
|
+
`;else{let f=u.map(p=>{let h=e.state.env.get(`${i}_${p}`)??"",d=rf(h);return`['${p}']=${d}`});n+=`declare -A ${i}=(${f.join(" ")})
|
|
887
|
+
`}continue}let l=pt(e,i);if(l.length>0){let u=l.map(f=>{let p=e.state.env.get(`${i}_${f}`)??"";return`[${f}]=${es(p)}`});n+=`declare -a ${i}=(${u.join(" ")})
|
|
888
|
+
`;continue}if(e.state.env.has(`${i}__length`)){n+=`declare -a ${i}=()
|
|
889
|
+
`;continue}let c=e.state.env.get(i);if(c!==void 0)n+=`declare ${o} ${i}=${nf(c)}
|
|
890
|
+
`;else{let u=e.state.declaredVars?.has(i),f=e.state.localVarDepth?.has(i);u||f?n+=`declare ${o} ${i}
|
|
891
|
+
`:(r+=`bash: declare: ${i}: not found
|
|
892
|
+
`,s=!0)}}return H(n,r,s?1:0)}function Uy(e,t){let{filterExport:n,filterReadonly:r,filterNameref:s,filterIndexedArray:i,filterAssocArray:o}=t,a=n||r||s||i||o,l="",c=new Set;for(let f of e.state.env.keys()){if(f.startsWith("BASH_"))continue;if(f.endsWith("__length")){let h=f.slice(0,-8);c.add(h);continue}let p=f.lastIndexOf("_");if(p>0){let h=f.slice(0,p),d=f.slice(p+1);if(/^\d+$/.test(d)||e.state.associativeArrays?.has(h)){c.add(h);continue}}c.add(f)}if(e.state.localVarDepth)for(let f of e.state.localVarDepth.keys())c.add(f);if(e.state.associativeArrays)for(let f of e.state.associativeArrays)c.add(f);let u=Array.from(c).sort();for(let f of u){let p=Ly(e,f),h=e.state.associativeArrays?.has(f),d=pt(e,f),m=!h&&(d.length>0||e.state.env.has(`${f}__length`));if(a&&(o&&!h||i&&!m||n&&!e.state.exportedVars?.has(f)||r&&!e.state.readonlyVars?.has(f)||s&&!We(e,f)))continue;if(h){let y=$n(e,f);if(y.length===0)l+=`declare -A ${f}=()
|
|
893
|
+
`;else{let w=y.map(b=>{let x=e.state.env.get(`${f}_${b}`)??"",A=rf(x);return`['${b}']=${A}`});l+=`declare -A ${f}=(${w.join(" ")})
|
|
894
|
+
`}continue}if(d.length>0){let y=d.map(w=>{let b=e.state.env.get(`${f}_${w}`)??"";return`[${w}]=${es(b)}`});l+=`declare -a ${f}=(${y.join(" ")})
|
|
895
|
+
`;continue}if(e.state.env.has(`${f}__length`)){l+=`declare -a ${f}=()
|
|
896
|
+
`;continue}let g=e.state.env.get(f);g!==void 0&&(l+=`declare ${p} ${f}=${nf(g)}
|
|
897
|
+
`)}return xe(l)}function By(e){let t="",n=Array.from(e.state.associativeArrays??[]).sort();for(let r of n){let s=$n(e,r);if(s.length===0)t+=`declare -A ${r}=()
|
|
898
|
+
`;else{let i=s.map(o=>{let a=e.state.env.get(`${r}_${o}`)??"",l=rf(a);return`['${o}']=${l}`});t+=`declare -A ${r}=(${i.join(" ")})
|
|
899
|
+
`}}return xe(t)}function Wy(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);e.state.associativeArrays?.has(o)||n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);/^\d+$/.test(a)&&(e.state.associativeArrays?.has(o)||n.add(o))}}let r=Array.from(n).sort();for(let s of r){let i=pt(e,s);if(i.length===0)t+=`declare -a ${s}=()
|
|
900
|
+
`;else{let o=i.map(a=>{let l=e.state.env.get(`${s}_${a}`)??"";return`[${a}]=${es(l)}`});t+=`declare -a ${s}=(${o.join(" ")})
|
|
901
|
+
`}}return xe(t)}function zy(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);if(/^\d+$/.test(a)||e.state.associativeArrays?.has(o)){n.add(o);continue}}n.add(s)}let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||pt(e,s).length>0||e.state.env.has(`${s}__length`))continue;let a=e.state.env.get(s);a!==void 0&&(t+=`${s}=${Pa(a)}
|
|
902
|
+
`)}return xe(t)}function sf(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Di(e,t){return e.state.integerVars?.has(t)??!1}function of(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function LC(e,t){return e.state.lowercaseVars?.has(t)??!1}function af(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function MC(e,t){return e.state.uppercaseVars?.has(t)??!1}function Gs(e,t,n){return LC(e,t)?n.toLowerCase():MC(e,t)?n.toUpperCase():n}async function Hy(e,t){try{let n=new pe,r=Ne(n,t),s=await se(e,r.expression);return String(s)}catch{return"0"}}function UC(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!=="[")return null;let s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function lf(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=[];for(let v=0;v<t.length;v++){let P=t[v];if(P==="-a")n=!0;else if(P==="-A")r=!0;else if(P==="-r")s=!0;else if(P==="-x")i=!0;else if(P==="-p")o=!0;else if(P==="-n")a=!0;else if(P==="+n")l=!0;else if(P==="+a")c=!0;else if(P==="+x")u=!0;else if(P==="--"){y.push(...t.slice(v+1));break}else if(P.startsWith("+")){for(let k of P.slice(1))if(k==="n")l=!0;else if(k==="a")c=!0;else if(k==="x")u=!0;else if(k!=="r"){if(k!=="i"){if(!(k==="f"||k==="F"))return H("",`bash: typeset: +${k}: invalid option
|
|
903
|
+
`,2)}}}else if(P==="-i")f=!0;else if(P==="-l")p=!0;else if(P==="-u")h=!0;else if(P==="-f")d=!0;else if(P==="-F")m=!0;else if(P==="-g")g=!0;else if(P.startsWith("-"))for(let k of P.slice(1))if(k==="a")n=!0;else if(k==="A")r=!0;else if(k==="r")s=!0;else if(k==="x")i=!0;else if(k==="p")o=!0;else if(k==="n")a=!0;else if(k==="i")f=!0;else if(k==="l")p=!0;else if(k==="u")h=!0;else if(k==="f")d=!0;else if(k==="F")m=!0;else if(k==="g")g=!0;else return H("",`bash: typeset: -${k}: invalid option
|
|
904
|
+
`,2);else y.push(P)}let b=e.state.localScopes.length>0&&!g,x=v=>{if(!b)return;let P=e.state.localScopes[e.state.localScopes.length-1];P.has(v)||P.set(v,e.state.env.get(v))},A=v=>{if(!b)return;let P=e.state.localScopes[e.state.localScopes.length-1];P.has(v)||P.set(v,e.state.env.get(v));let k=`${v}_`;for(let R of e.state.env.keys())R.startsWith(k)&&!R.includes("__")&&(P.has(R)||P.set(R,e.state.env.get(R)));let N=`${v}__length`;e.state.env.has(N)&&!P.has(N)&&P.set(N,e.state.env.get(N))},C=v=>{b&&vr(e,v)};if(m){if(y.length===0){let k=Array.from(e.state.functions.keys()).sort(),N="";for(let R of k)N+=`declare -f ${R}
|
|
905
|
+
`;return xe(N)}let v=!0,P="";for(let k of y)e.state.functions.has(k)?P+=`${k}
|
|
906
|
+
`:v=!1;return H(P,"",v?0:1)}if(d){if(y.length===0){let P="",k=Array.from(e.state.functions.keys()).sort();for(let N of k)P+=`${N} ()
|
|
907
|
+
{
|
|
908
|
+
# function body
|
|
909
|
+
}
|
|
910
|
+
`;return xe(P)}let v=!0;for(let P of y)e.state.functions.has(P)||(v=!1);return H("","",v?0:1)}if(o&&y.length>0)return My(e,y);if(o&&y.length===0)return Uy(e,{filterExport:i,filterReadonly:s,filterNameref:a,filterIndexedArray:n,filterAssocArray:r});if(y.length===0&&r&&!o)return By(e);if(y.length===0&&n&&!o)return Wy(e);if(y.length===0&&!o)return zy(e);let $="",D=0;for(let v of y){let P=v.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(P&&!c){let O=P[1],_=P[2];if(r&&pt(e,O).length>0){$+=`bash: declare: ${O}: cannot convert indexed to associative array
|
|
911
|
+
`,D=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(O)){$+=`bash: declare: ${O}: cannot convert associative to indexed array
|
|
912
|
+
`,D=1;continue}if(A(O),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(O)),Vn(e,O),e.state.env.delete(O),e.state.env.delete(`${O}__length`),r&&_.includes("[")){let M=Na(_);for(let[z,ie]of M){let me=ot(e,ie);e.state.env.set(`${O}_${z}`,me)}}else if(r){let M=Xn(_);for(let z=0;z<M.length;z+=2){let ie=M[z],me=z+1<M.length?ot(e,M[z+1]):"";e.state.env.set(`${O}_${ie}`,me)}}else{let M=Xn(_);if(M.some(ie=>/^\[[^\]]+\]=/.test(ie))){let ie=0;for(let me of M){let q=me.match(/^\[([^\]]+)\]=(.*)$/);if(q){let j=q[1],te=q[2],Se=ot(e,te),oe;if(/^-?\d+$/.test(j))oe=Number.parseInt(j,10);else try{let $e=new pe,G=Ne($e,j);oe=await se(e,G.expression)}catch{oe=0}e.state.env.set(`${O}_${oe}`,Se),ie=oe+1}else{let j=ot(e,me);e.state.env.set(`${O}_${ie}`,j),ie++}}}else{for(let ie=0;ie<M.length;ie++)e.state.env.set(`${O}_${ie}`,M[ie]);e.state.env.set(`${O}__length`,String(M.length))}}C(O),s&&Jt(e,O),i&&On(e,O);continue}if(l){let O=v.includes("=")?v.slice(0,v.indexOf("=")):v;if(Vg(e,O),!v.includes("="))continue}if(u){let O=v.includes("=")?v.slice(0,v.indexOf("=")):v;if(la(e,O),!v.includes("="))continue}let k=UC(v);if(k){let{name:O,indexExpr:_,value:M}=k,z=Et(e,O);if(z)return z;A(O);let ie;try{let q=new pe,j=Ne(q,_);ie=await se(e,j.expression)}catch{let q=parseInt(_,10);ie=Number.isNaN(q)?0:q}e.state.env.set(`${O}_${ie}`,M);let me=parseInt(e.state.env.get(`${O}__length`)??"0",10);ie>=me&&e.state.env.set(`${O}__length`,String(ie+1)),C(O),s&&Jt(e,O),i&&On(e,O);continue}let N=v.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(N&&!c){let O=N[1],_=N[2],M=Et(e,O);if(M)return M;A(O);let z=Xn(_);if(e.state.associativeArrays?.has(O)){let ie=Na(_);for(let[me,q]of ie){let j=ot(e,q);e.state.env.set(`${O}_${me}`,j)}}else{let ie=pt(e,O),me=0,q=e.state.env.get(O);ie.length===0&&q!==void 0?(e.state.env.set(`${O}_0`,q),e.state.env.delete(O),me=1):ie.length>0&&(me=Math.max(...ie)+1);for(let te=0;te<z.length;te++)e.state.env.set(`${O}_${me+te}`,ot(e,z[te]));let j=me+z.length;e.state.env.set(`${O}__length`,String(j))}C(O),s&&Jt(e,O),i&&On(e,O);continue}let R=v.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(R){let O=R[1],_=ot(e,R[2]),M=Et(e,O);if(M)return M;x(O),f&&sf(e,O),p&&of(e,O),h&&af(e,O);let ie=pt(e,O).length>0||e.state.associativeArrays?.has(O);if(Di(e,O)){let me=e.state.env.get(O)??"0",q=parseInt(me,10)||0,j=parseInt(await Hy(e,_),10)||0;_=String(q+j),e.state.env.set(O,_)}else if(ie){_=Gs(e,O,_);let me=`${O}_0`,q=e.state.env.get(me)??"";e.state.env.set(me,q+_)}else{_=Gs(e,O,_);let me=e.state.env.get(O)??"";e.state.env.set(O,me+_)}C(O),s&&Jt(e,O),i&&On(e,O),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(O));continue}if(v.includes("=")){let O=v.indexOf("="),_=v.slice(0,O),M=v.slice(O+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(_)){$+=`bash: typeset: \`${_}': not a valid identifier
|
|
913
|
+
`,D=1;continue}let z=Et(e,_);if(z)return z;if(x(_),a){if(M!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(M)){$+=`bash: declare: \`${M}': invalid variable name for name reference
|
|
914
|
+
`,D=1;continue}e.state.env.set(_,M),ir(e,_),M!==""&&oa(e,M)&&vu(e,_),C(_),s&&Jt(e,_),i&&On(e,_);continue}if(f&&sf(e,_),p&&of(e,_),h&&af(e,_),Di(e,_)&&(M=await Hy(e,M)),M=Gs(e,_,M),We(e,_)){let ie=Bt(e,_);ie&&ie!==_?e.state.env.set(ie,M):e.state.env.set(_,M)}else e.state.env.set(_,M);C(_),s&&Jt(e,_),i&&On(e,_),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(_))}else{let O=v;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(O)){$+=`bash: typeset: \`${O}': not a valid identifier
|
|
915
|
+
`,D=1;continue}if(n||r?A(O):x(O),a){ir(e,O);let M=e.state.env.get(O);M!==void 0&&M!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(M)?qg(e,O):M&&oa(e,M)&&vu(e,O),C(O),s&&Jt(e,O),i&&On(e,O);continue}if(f&&sf(e,O),p&&of(e,O),h&&af(e,O),r){if(pt(e,O).length>0){$+=`bash: declare: ${O}: cannot convert indexed to associative array
|
|
916
|
+
`,D=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(O)}let _=Array.from(e.state.env.keys()).some(M=>M.startsWith(`${O}_`)&&!M.startsWith(`${O}__length`));!e.state.env.has(O)&&!_&&(n||r?e.state.env.set(`${O}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(O))),C(O),s&&Jt(e,O),i&&On(e,O)}}return H("",$,D)}async function cf(e,t){let n=!1,r=!1,s=!1,i=[];for(let o=0;o<t.length;o++){let a=t[o];if(a==="-a")n=!0;else if(a==="-A")r=!0;else if(a==="-p")s=!0;else if(a==="--"){i.push(...t.slice(o+1));break}else a.startsWith("-")||i.push(a)}if(i.length===0){let o="",a=Array.from(e.state.readonlyVars||[]).sort();for(let l of a){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -r ${l}="${u}"
|
|
917
|
+
`}}return xe(o)}for(let o of i){let a=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(a){let f=a[1],p=a[2],h=Et(e,f);if(h)return h;let d=Xn(p);if(e.state.associativeArrays?.has(f)){let m=Na(p);for(let[g,y]of m){let w=ot(e,y);e.state.env.set(`${f}_${g}`,w)}}else{let m=pt(e,f),g=0,y=e.state.env.get(f);m.length===0&&y!==void 0?(e.state.env.set(`${f}_0`,y),e.state.env.delete(f),g=1):m.length>0&&(g=Math.max(...m)+1);for(let b=0;b<d.length;b++)e.state.env.set(`${f}_${g+b}`,ot(e,d[b]));let w=g+d.length;e.state.env.set(`${f}__length`,String(w))}Jt(e,f);continue}let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(l){let f=l[1],p=ot(e,l[2]),h=Et(e,f);if(h)return h;let d=e.state.env.get(f)??"";e.state.env.set(f,d+p),Jt(e,f);continue}let c=Ny(o);if(c.value===void 0&&!c.isArray){Jt(e,c.name);continue}let u=await Iy(e,c,{makeReadonly:!0});if(u)return u}return ve}function uf(e){return e.state.directoryStack??=[],e.state.directoryStack}function Vs(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function BC(e){let t=e.split("/").filter(r=>r&&r!=="."),n=[];for(let r of t)r===".."?n.pop():n.push(r);return`/${n.join("/")}`}async function ff(e,t){let n=uf(e),r;for(let a=0;a<t.length;a++){let l=t[a];if(l==="--"){if(a+1<t.length){if(r!==void 0)return U(`bash: pushd: too many arguments
|
|
918
|
+
`,2);r=t[a+1],a++}}else{if(l.startsWith("-")&&l!=="-")return U(`bash: pushd: ${l}: invalid option
|
|
919
|
+
`,2);if(r!==void 0)return U(`bash: pushd: too many arguments
|
|
920
|
+
`,2);r=l}}if(r===void 0){if(n.length<1)return U(`bash: pushd: no other directory
|
|
921
|
+
`,1);let a=n.shift();if(!a)return U(`bash: pushd: no other directory
|
|
922
|
+
`,1);let l=e.state.cwd;n.unshift(l),e.state.previousDir=l,e.state.cwd=a,e.state.env.set("PWD",a),e.state.env.set("OLDPWD",l);let c=e.state.env.get("HOME")||"",u=`${[a,...n].map(f=>Vs(f,c)).join(" ")}
|
|
923
|
+
`;return xe(u)}let s;if(r.startsWith("/"))s=r;else if(r===".."){let a=e.state.cwd.split("/").filter(l=>l);a.pop(),s=`/${a.join("/")}`}else r==="."?s=e.state.cwd:r.startsWith("~")?s=(e.state.env.get("HOME")||"/")+r.slice(1):s=`${e.state.cwd}/${r}`;s=BC(s);try{if(!(await e.fs.stat(s)).isDirectory)return U(`bash: pushd: ${r}: Not a directory
|
|
924
|
+
`,1)}catch{return U(`bash: pushd: ${r}: No such file or directory
|
|
925
|
+
`,1)}n.unshift(e.state.cwd),e.state.previousDir=e.state.cwd,e.state.cwd=s,e.state.env.set("PWD",s),e.state.env.set("OLDPWD",e.state.previousDir);let i=e.state.env.get("HOME")||"",o=`${[s,...n].map(a=>Vs(a,i)).join(" ")}
|
|
926
|
+
`;return xe(o)}function pf(e,t){let n=uf(e);for(let o of t)if(o!=="--")return o.startsWith("-")&&o!=="-"?U(`bash: popd: ${o}: invalid option
|
|
927
|
+
`,2):U(`bash: popd: too many arguments
|
|
928
|
+
`,2);if(n.length===0)return U(`bash: popd: directory stack empty
|
|
929
|
+
`,1);let r=n.shift();if(!r)return U(`bash: popd: directory stack empty
|
|
930
|
+
`,1);e.state.previousDir=e.state.cwd,e.state.cwd=r,e.state.env.set("PWD",r),e.state.env.set("OLDPWD",e.state.previousDir);let s=e.state.env.get("HOME")||"",i=`${[r,...n].map(o=>Vs(o,s)).join(" ")}
|
|
931
|
+
`;return xe(i)}function hf(e,t){let n=uf(e),r=!1,s=!1,i=!1,o=!1;for(let u of t)if(u!=="--")if(u.startsWith("-"))for(let f of u.slice(1))if(f==="c")r=!0;else if(f==="l")s=!0;else if(f==="p")i=!0;else if(f==="v")i=!0,o=!0;else return U(`bash: dirs: -${f}: invalid option
|
|
932
|
+
`,2);else return U(`bash: dirs: too many arguments
|
|
933
|
+
`,1);if(r)return e.state.directoryStack=[],ve;let a=[e.state.cwd,...n],l=e.state.env.get("HOME")||"",c;return o?(c=a.map((u,f)=>{let p=s?u:Vs(u,l);return` ${f} ${p}`}).join(`
|
|
934
|
+
`),c+=`
|
|
935
|
+
`):i?c=a.map(u=>s?u:Vs(u,l)).join(`
|
|
936
|
+
`)+`
|
|
937
|
+
`:c=a.map(u=>s?u:Vs(u,l)).join(" ")+`
|
|
938
|
+
`,xe(c)}ft();we();async function Da(e,t,n){let r=t;if(r.length>0){let a=r[0];if(a==="--")r=r.slice(1);else if(a.startsWith("-")&&a!=="-"&&a.length>1)return U(`bash: eval: ${a}: invalid option
|
|
939
|
+
eval: usage: eval [arg ...]
|
|
940
|
+
`,2)}if(r.length===0)return ve;let s=r.join(" ");if(s.trim()==="")return ve;let i=e.state.groupStdin,o=n??e.state.groupStdin;o!==void 0&&(e.state.groupStdin=o);try{let a=In(s);return await e.executeScript(a)}catch(a){if(a instanceof gt||a instanceof kt||a instanceof St||a instanceof Ce)throw a;if(a.name==="ParseException")return U(`bash: eval: ${a.message}
|
|
941
|
+
`);if(a.message?.startsWith("Unsupported shell syntax:"))return U(`bash: eval: ${a.message}
|
|
942
|
+
`,2);throw a}finally{e.state.groupStdin=i}}we();function df(e,t){let n,r="";if(t.length===0)n=e.state.lastExitCode;else{let s=t[0],i=Number.parseInt(s,10);s===""||Number.isNaN(i)||!/^-?\d+$/.test(s)?(r=`bash: exit: ${s}: numeric argument required
|
|
943
|
+
`,n=2):t.length>1?(r=`bash: exit: too many arguments
|
|
944
|
+
`,n=1):n=(i%256+256)%256}throw new Ce(n,"",r)}Er();function mf(e,t){let n=!1,r=[];for(let o of t)o==="-n"?n=!0:o==="-p"||o==="--"||r.push(o);if(r.length===0&&!n){let o="",a=e.state.exportedVars??new Set,l=Array.from(a).sort();for(let c of l){let u=e.state.env.get(c);if(u!==void 0){let f=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -x ${c}="${f}"
|
|
945
|
+
`}}return xe(o)}if(n){for(let o of r){let a,l;if(o.includes("=")){let c=o.indexOf("=");a=o.slice(0,c),l=ot(e,o.slice(c+1)),e.state.env.set(a,l)}else a=o;la(e,a)}return ve}let s="",i=0;for(let o of r){let a,l,c=!1,u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(u)a=u[1],l=ot(e,u[2]),c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=ot(e,o.slice(f+1))}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){s+=`bash: export: \`${o}': not a valid identifier
|
|
946
|
+
`,i=1;continue}if(l!==void 0)if(c){let f=e.state.env.get(a)??"";e.state.env.set(a,f+l)}else e.state.env.set(a,l);else e.state.env.has(a)||e.state.env.set(a,"");On(e,a)}return H("",s,i)}function _a(e,t){if(t.length<2)return U(`bash: getopts: usage: getopts optstring name [arg ...]
|
|
947
|
+
`);let n=t[0],r=t[1],s=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),i=n.startsWith(":"),o=i?n.slice(1):n,a;if(t.length>2)a=t.slice(2);else{let m=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let g=1;g<=m;g++)a.push(e.state.env.get(String(g))||"")}let l=Number.parseInt(e.state.env.get("OPTIND")||"1",10);l<1&&(l=1);let c=Number.parseInt(e.state.env.get("__GETOPTS_CHARINDEX")||"0",10);if(e.state.env.set("OPTARG",""),l>a.length)return s||e.state.env.set(r,"?"),e.state.env.set("OPTIND",String(a.length+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:1,stdout:"",stderr:""};let u=a[l-1];if(!u||u==="-"||!u.startsWith("-"))return s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};if(u==="--")return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};let f=c===0?1:c,p=u[f];if(!p)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),_a(e,t);let h=o.indexOf(p);if(h===-1){let m="";return i?e.state.env.set("OPTARG",p):m=`bash: illegal option -- ${p}
|
|
948
|
+
`,s||e.state.env.set(r,"?"),f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0")),{exitCode:s?2:0,stdout:"",stderr:m}}if(h+1<o.length&&o[h+1]===":")if(f+1<u.length)e.state.env.set("OPTARG",u.slice(f+1)),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0");else{if(l>=a.length){let m="";return i?(e.state.env.set("OPTARG",p),s||e.state.env.set(r,":")):(m=`bash: option requires an argument -- ${p}
|
|
949
|
+
`,s||e.state.env.set(r,"?")),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:0,stdout:"",stderr:m}}e.state.env.set("OPTARG",a[l]),e.state.env.set("OPTIND",String(l+2)),e.state.env.set("__GETOPTS_CHARINDEX","0")}else f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"));return s||e.state.env.set(r,p),{exitCode:s?2:0,stdout:"",stderr:""}}async function gf(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,s=!1,i=!1,o=!1,a="",l=[],c=0;for(;c<t.length;){let d=t[c];if(d==="--"){c++,l.push(...t.slice(c));break}if(d==="-r")n=!0,c++;else if(d==="-d")r=!0,c++;else if(d==="-l")s=!0,c++;else if(d==="-t")o=!0,c++;else if(d==="-p"){if(i=!0,c++,c>=t.length)return U(`bash: hash: -p: option requires an argument
|
|
950
|
+
`,1);a=t[c],c++}else if(d.startsWith("-")&&d.length>1){for(let m of d.slice(1))if(m==="r")n=!0;else if(m==="d")r=!0;else if(m==="l")s=!0;else if(m==="t")o=!0;else return m==="p"?U(`bash: hash: -p: option requires an argument
|
|
951
|
+
`,1):U(`bash: hash: -${m}: invalid option
|
|
952
|
+
`,1);c++}else l.push(d),c++}if(n)return e.state.hashTable.clear(),ve;if(r){if(l.length===0)return U(`bash: hash: -d: option requires an argument
|
|
953
|
+
`,1);let d=!1,m="";for(let g of l)e.state.hashTable.has(g)?e.state.hashTable.delete(g):(m+=`bash: hash: ${g}: not found
|
|
954
|
+
`,d=!0);return d?U(m,1):ve}if(o){if(l.length===0)return U(`bash: hash: -t: option requires an argument
|
|
955
|
+
`,1);let d="",m=!1,g="";for(let y of l){let w=e.state.hashTable.get(y);w?l.length>1?d+=`${y} ${w}
|
|
956
|
+
`:d+=`${w}
|
|
957
|
+
`:(g+=`bash: hash: ${y}: not found
|
|
958
|
+
`,m=!0)}return m?{exitCode:1,stdout:d,stderr:g}:xe(d)}if(i){if(l.length===0)return U(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
|
|
959
|
+
`,1);let d=l[0];return e.state.hashTable.set(d,a),ve}if(l.length===0){if(e.state.hashTable.size===0)return xe(`hash: hash table empty
|
|
960
|
+
`);let d="";if(s)for(let[m,g]of e.state.hashTable)d+=`builtin hash -p ${g} ${m}
|
|
961
|
+
`;else{d=`hits command
|
|
962
|
+
`;for(let[,m]of e.state.hashTable)d+=` 1 ${m}
|
|
963
|
+
`}return xe(d)}let u=!1,f="",h=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let d of l){if(d.includes("/")){f+=`bash: hash: ${d}: cannot use / in name
|
|
964
|
+
`,u=!0;continue}let m=!1;for(let g of h){if(!g)continue;let y=`${g}/${d}`;if(await e.fs.exists(y)){e.state.hashTable.set(d,y),m=!0;break}}m||(f+=`bash: hash: ${d}: not found
|
|
965
|
+
`,u=!0)}return u?U(f,1):ve}Qe();var jy=new Map([[":",[": [arguments]",`Null command.
|
|
966
|
+
No effect; the command does nothing.
|
|
967
|
+
Exit Status:
|
|
968
|
+
Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell.
|
|
969
|
+
Read and execute commands from FILENAME in the current shell.
|
|
970
|
+
The entries in $PATH are used to find the directory containing FILENAME.
|
|
971
|
+
Exit Status:
|
|
972
|
+
Returns the status of the last command executed in FILENAME.`]],["[",["[ arg... ]",`Evaluate conditional expression.
|
|
973
|
+
This is a synonym for the "test" builtin, but the last argument must
|
|
974
|
+
be a literal \`]', to match the opening \`['.`]],["alias",["alias [-p] [name[=value] ... ]",`Define or display aliases.
|
|
975
|
+
Without arguments, \`alias' prints the list of aliases in the reusable
|
|
976
|
+
form \`alias NAME=VALUE' on standard output.
|
|
977
|
+
Exit Status:
|
|
978
|
+
alias returns true unless a NAME is supplied for which no alias has been
|
|
979
|
+
defined.`]],["bg",["bg [job_spec ...]",`Move jobs to the background.
|
|
980
|
+
Place the jobs identified by each JOB_SPEC in the background, as if they
|
|
981
|
+
had been started with \`&'.`]],["break",["break [n]",`Exit for, while, or until loops.
|
|
982
|
+
Exit a FOR, WHILE or UNTIL loop. If N is specified, break N enclosing
|
|
983
|
+
loops.
|
|
984
|
+
Exit Status:
|
|
985
|
+
The exit status is 0 unless N is not greater than or equal to 1.`]],["builtin",["builtin [shell-builtin [arg ...]]",`Execute shell builtins.
|
|
986
|
+
Execute SHELL-BUILTIN with arguments ARGs without performing command
|
|
987
|
+
lookup. This is useful when you wish to reimplement a shell builtin
|
|
988
|
+
as a shell function, but need to execute the builtin within the function.
|
|
989
|
+
Exit Status:
|
|
990
|
+
Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is
|
|
991
|
+
not a shell builtin.`]],["caller",["caller [expr]",`Return the context of the current subroutine call.
|
|
992
|
+
Without EXPR, returns "$line $filename". With EXPR, returns
|
|
993
|
+
"$line $subroutine $filename"; this extra information can be used to
|
|
994
|
+
provide a stack trace.
|
|
995
|
+
Exit Status:
|
|
996
|
+
Returns 0 unless the shell is not executing a subroutine call or
|
|
997
|
+
EXPR is invalid.`]],["cd",["cd [-L|-P] [dir]",`Change the shell working directory.
|
|
998
|
+
Change the current directory to DIR. The default DIR is the value of the
|
|
999
|
+
HOME shell variable.
|
|
1000
|
+
|
|
1001
|
+
The variable CDPATH defines the search path for the directory containing
|
|
1002
|
+
DIR. Alternative directory names in CDPATH are separated by a colon (:).
|
|
1003
|
+
A null directory name is the same as the current directory. If DIR begins
|
|
1004
|
+
with a slash (/), then CDPATH is not used.
|
|
1005
|
+
|
|
1006
|
+
If the directory is not found, and the shell option \`cdable_vars' is set,
|
|
1007
|
+
the word is assumed to be a variable name. If that variable has a value,
|
|
1008
|
+
its value is used for DIR.
|
|
1009
|
+
|
|
1010
|
+
Options:
|
|
1011
|
+
-L force symbolic links to be followed
|
|
1012
|
+
-P use the physical directory structure without following symbolic
|
|
1013
|
+
links
|
|
1014
|
+
|
|
1015
|
+
The default is to follow symbolic links, as if \`-L' were specified.
|
|
1016
|
+
|
|
1017
|
+
Exit Status:
|
|
1018
|
+
Returns 0 if the directory is changed; non-zero otherwise.`]],["command",["command [-pVv] command [arg ...]",`Execute a simple command or display information about commands.
|
|
1019
|
+
Runs COMMAND with ARGS suppressing shell function lookup, or display
|
|
1020
|
+
information about the specified COMMANDs.
|
|
1021
|
+
|
|
1022
|
+
Options:
|
|
1023
|
+
-p use a default value for PATH that is guaranteed to find all of
|
|
1024
|
+
the standard utilities
|
|
1025
|
+
-v print a description of COMMAND similar to the \`type' builtin
|
|
1026
|
+
-V print a more verbose description of each COMMAND
|
|
1027
|
+
|
|
1028
|
+
Exit Status:
|
|
1029
|
+
Returns exit status of COMMAND, or failure if COMMAND is not found.`]],["compgen",["compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]",`Display possible completions depending on the options.
|
|
1030
|
+
Intended to be used from within a shell function generating possible
|
|
1031
|
+
completions. If the optional WORD argument is supplied, matches against
|
|
1032
|
+
WORD are generated.
|
|
1033
|
+
Exit Status:
|
|
1034
|
+
Returns success unless an invalid option is supplied or an error occurs.`]],["complete",["complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]",`Specify how arguments are to be completed.
|
|
1035
|
+
For each NAME, specify how arguments are to be completed.
|
|
1036
|
+
Exit Status:
|
|
1037
|
+
Returns success unless an invalid option is supplied or an error occurs.`]],["continue",["continue [n]",`Resume for, while, or until loops.
|
|
1038
|
+
Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop.
|
|
1039
|
+
If N is specified, resumes the Nth enclosing loop.
|
|
1040
|
+
Exit Status:
|
|
1041
|
+
The exit status is 0 unless N is not greater than or equal to 1.`]],["declare",["declare [-aAfFgilnrtux] [-p] [name[=value] ...]",`Set variable values and attributes.
|
|
1042
|
+
Declare variables and give them attributes. If no NAMEs are given,
|
|
1043
|
+
display the attributes and values of all variables.
|
|
1044
|
+
|
|
1045
|
+
Options:
|
|
1046
|
+
-a to make NAMEs indexed arrays (if supported)
|
|
1047
|
+
-A to make NAMEs associative arrays (if supported)
|
|
1048
|
+
-i to make NAMEs have the \`integer' attribute
|
|
1049
|
+
-l to convert the value of each NAME to lower case on assignment
|
|
1050
|
+
-n make NAME a reference to the variable named by its value
|
|
1051
|
+
-r to make NAMEs readonly
|
|
1052
|
+
-t to make NAMEs have the \`trace' attribute
|
|
1053
|
+
-u to convert the value of each NAME to upper case on assignment
|
|
1054
|
+
-x to make NAMEs export
|
|
1055
|
+
|
|
1056
|
+
Exit Status:
|
|
1057
|
+
Returns success unless an invalid option is supplied or a variable
|
|
1058
|
+
assignment error occurs.`]],["dirs",["dirs [-clpv] [+N] [-N]",`Display directory stack.
|
|
1059
|
+
Display the list of currently remembered directories. Directories
|
|
1060
|
+
find their way onto the list with the \`pushd' command; you can get
|
|
1061
|
+
back up through the list with the \`popd' command.
|
|
1062
|
+
Exit Status:
|
|
1063
|
+
Returns success unless an invalid option is supplied or an error occurs.`]],["disown",["disown [-h] [-ar] [jobspec ...]",`Remove jobs from current shell.
|
|
1064
|
+
Without any JOBSPECs, remove the current job.`]],["echo",["echo [-neE] [arg ...]",`Write arguments to the standard output.
|
|
1065
|
+
Display the ARGs, separated by a single space character and followed by a
|
|
1066
|
+
newline, on the standard output.
|
|
1067
|
+
|
|
1068
|
+
Options:
|
|
1069
|
+
-n do not append a newline
|
|
1070
|
+
-e enable interpretation of the following backslash escapes
|
|
1071
|
+
-E explicitly suppress interpretation of backslash escapes
|
|
1072
|
+
|
|
1073
|
+
Exit Status:
|
|
1074
|
+
Returns success unless a write error occurs.`]],["enable",["enable [-a] [-dnps] [-f filename] [name ...]",`Enable and disable shell builtins.
|
|
1075
|
+
Enables and disables builtin shell commands.
|
|
1076
|
+
Exit Status:
|
|
1077
|
+
Returns success unless NAME is not a shell builtin or an error occurs.`]],["eval",["eval [arg ...]",`Execute arguments as a shell command.
|
|
1078
|
+
Combine ARGs into a single string, use the result as input to the shell,
|
|
1079
|
+
and execute the resulting commands.
|
|
1080
|
+
Exit Status:
|
|
1081
|
+
Returns exit status of command or success if command is null.`]],["exec",["exec [-cl] [-a name] [command [arguments ...]] [redirection ...]",`Replace the shell with the given command.
|
|
1082
|
+
Execute COMMAND, replacing this shell with the specified program.
|
|
1083
|
+
ARGUMENTS become the arguments to COMMAND. If COMMAND is not specified,
|
|
1084
|
+
any redirections take effect in the current shell.
|
|
1085
|
+
Exit Status:
|
|
1086
|
+
Returns success unless COMMAND is not found or a redirection error occurs.`]],["exit",["exit [n]",`Exit the shell.
|
|
1087
|
+
Exits the shell with a status of N. If N is omitted, the exit status
|
|
1088
|
+
is that of the last command executed.`]],["export",["export [-fn] [name[=value] ...] or export -p",`Set export attribute for shell variables.
|
|
1089
|
+
Marks each NAME for automatic export to the environment of subsequently
|
|
1090
|
+
executed commands. If VALUE is supplied, assign VALUE before exporting.
|
|
1091
|
+
|
|
1092
|
+
Options:
|
|
1093
|
+
-f refer to shell functions
|
|
1094
|
+
-n remove the export property from each NAME
|
|
1095
|
+
-p display a list of all exported variables and functions
|
|
1096
|
+
|
|
1097
|
+
Exit Status:
|
|
1098
|
+
Returns success unless an invalid option is given or NAME is invalid.`]],["false",["false",`Return an unsuccessful result.
|
|
1099
|
+
Exit Status:
|
|
1100
|
+
Always fails.`]],["fc",["fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]",`Display or execute commands from the history list.
|
|
1101
|
+
Exit Status:
|
|
1102
|
+
Returns success or status of executed command.`]],["fg",["fg [job_spec]",`Move job to the foreground.
|
|
1103
|
+
Place the job identified by JOB_SPEC in the foreground, making it the
|
|
1104
|
+
current job.`]],["getopts",["getopts optstring name [arg]",`Parse option arguments.
|
|
1105
|
+
Getopts is used by shell procedures to parse positional parameters
|
|
1106
|
+
as options.
|
|
1107
|
+
|
|
1108
|
+
OPTSTRING contains the option letters to be recognized; if a letter
|
|
1109
|
+
is followed by a colon, the option is expected to have an argument,
|
|
1110
|
+
which should be separated from it by white space.
|
|
1111
|
+
Exit Status:
|
|
1112
|
+
Returns success if an option is found; fails if the end of options is
|
|
1113
|
+
encountered or an error occurs.`]],["hash",["hash [-lr] [-p pathname] [-dt] [name ...]",`Remember or display program locations.
|
|
1114
|
+
Determine and remember the full pathname of each command NAME.
|
|
1115
|
+
Exit Status:
|
|
1116
|
+
Returns success unless NAME is not found or an invalid option is given.`]],["help",["help [-s] [pattern ...]",`Display information about builtin commands.
|
|
1117
|
+
Displays brief summaries of builtin commands. If PATTERN is
|
|
1118
|
+
specified, gives detailed help on all commands matching PATTERN,
|
|
1119
|
+
otherwise the list of help topics is printed.
|
|
1120
|
+
|
|
1121
|
+
Options:
|
|
1122
|
+
-s output only a short usage synopsis for each topic matching
|
|
1123
|
+
PATTERN
|
|
1124
|
+
|
|
1125
|
+
Exit Status:
|
|
1126
|
+
Returns success unless PATTERN is not found.`]],["history",["history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]",`Display or manipulate the history list.
|
|
1127
|
+
Display the history list with line numbers, prefixing each modified
|
|
1128
|
+
entry with a \`*'.
|
|
1129
|
+
Exit Status:
|
|
1130
|
+
Returns success unless an invalid option is given or an error occurs.`]],["jobs",["jobs [-lnprs] [jobspec ...] or jobs -x command [args]",`Display status of jobs.
|
|
1131
|
+
Lists the active jobs.
|
|
1132
|
+
Exit Status:
|
|
1133
|
+
Returns success unless an invalid option is given or an error occurs.`]],["kill",["kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]",`Send a signal to a job.
|
|
1134
|
+
Send the processes identified by PID or JOBSPEC the signal named by
|
|
1135
|
+
SIGSPEC or SIGNUM.
|
|
1136
|
+
Exit Status:
|
|
1137
|
+
Returns success unless an invalid option is given or an error occurs.`]],["let",["let arg [arg ...]",`Evaluate arithmetic expressions.
|
|
1138
|
+
Evaluate each ARG as an arithmetic expression. Evaluation is done in
|
|
1139
|
+
fixed-width integers with no check for overflow, though division by 0
|
|
1140
|
+
is trapped and flagged as an error.
|
|
1141
|
+
Exit Status:
|
|
1142
|
+
If the last ARG evaluates to 0, let returns 1; 0 is returned otherwise.`]],["local",["local [option] name[=value] ...",`Define local variables.
|
|
1143
|
+
Create a local variable called NAME, and give it VALUE. OPTION can
|
|
1144
|
+
be any option accepted by \`declare'.
|
|
1145
|
+
|
|
1146
|
+
Local can only be used within a function; it makes the variable NAME
|
|
1147
|
+
have a visible scope restricted to that function and its children.
|
|
1148
|
+
Exit Status:
|
|
1149
|
+
Returns success unless an invalid option is supplied, a variable
|
|
1150
|
+
assignment error occurs, or the shell is not executing a function.`]],["logout",["logout [n]",`Exit a login shell.
|
|
1151
|
+
Exits a login shell with exit status N. Returns an error if not executed
|
|
1152
|
+
in a login shell.`]],["mapfile",["mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]",`Read lines from the standard input into an indexed array variable.
|
|
1153
|
+
Read lines from the standard input into the indexed array variable ARRAY,
|
|
1154
|
+
or from file descriptor FD if the -u option is supplied.
|
|
1155
|
+
|
|
1156
|
+
Options:
|
|
1157
|
+
-d delim Use DELIM to terminate lines, instead of newline
|
|
1158
|
+
-n count Copy at most COUNT lines
|
|
1159
|
+
-O origin Begin assigning to ARRAY at index ORIGIN
|
|
1160
|
+
-s count Discard the first COUNT lines read
|
|
1161
|
+
-t Remove a trailing DELIM from each line read (default newline)
|
|
1162
|
+
-u fd Read lines from file descriptor FD instead of standard input
|
|
1163
|
+
|
|
1164
|
+
Exit Status:
|
|
1165
|
+
Returns success unless an invalid option is given or ARRAY is readonly.`]],["popd",["popd [-n] [+N | -N]",`Remove directories from stack.
|
|
1166
|
+
Removes entries from the directory stack.
|
|
1167
|
+
Exit Status:
|
|
1168
|
+
Returns success unless an invalid argument is supplied or the directory
|
|
1169
|
+
change fails.`]],["printf",["printf [-v var] format [arguments]",`Formats and prints ARGUMENTS under control of the FORMAT.
|
|
1170
|
+
|
|
1171
|
+
Options:
|
|
1172
|
+
-v var assign the output to shell variable VAR rather than
|
|
1173
|
+
display it on the standard output
|
|
1174
|
+
|
|
1175
|
+
FORMAT is a character string which contains three types of objects: plain
|
|
1176
|
+
characters, which are simply copied to standard output; character escape
|
|
1177
|
+
sequences, which are converted and copied to the standard output; and
|
|
1178
|
+
format specifications, each of which causes printing of the next successive
|
|
1179
|
+
argument.
|
|
1180
|
+
Exit Status:
|
|
1181
|
+
Returns success unless an invalid option is given or a write or assignment
|
|
1182
|
+
error occurs.`]],["pushd",["pushd [-n] [+N | -N | dir]",`Add directories to stack.
|
|
1183
|
+
Adds a directory to the top of the directory stack, or rotates
|
|
1184
|
+
the stack, making the new top of the stack the current working
|
|
1185
|
+
directory.
|
|
1186
|
+
Exit Status:
|
|
1187
|
+
Returns success unless an invalid argument is supplied or the directory
|
|
1188
|
+
change fails.`]],["pwd",["pwd [-LP]",`Print the name of the current working directory.
|
|
1189
|
+
|
|
1190
|
+
Options:
|
|
1191
|
+
-L print the value of $PWD if it names the current working
|
|
1192
|
+
directory
|
|
1193
|
+
-P print the physical directory, without any symbolic links
|
|
1194
|
+
|
|
1195
|
+
By default, \`pwd' behaves as if \`-L' were specified.
|
|
1196
|
+
Exit Status:
|
|
1197
|
+
Returns 0 unless an invalid option is given or the current directory
|
|
1198
|
+
cannot be read.`]],["read",["read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]",`Read a line from the standard input and split it into fields.
|
|
1199
|
+
Reads a single line from the standard input, or from file descriptor FD
|
|
1200
|
+
if the -u option is supplied. The line is split into fields as with word
|
|
1201
|
+
splitting, and the first word is assigned to the first NAME, the second
|
|
1202
|
+
word to the second NAME, and so on, with any leftover words assigned to
|
|
1203
|
+
the last NAME.
|
|
1204
|
+
Exit Status:
|
|
1205
|
+
The return code is zero, unless end-of-file is encountered, read times out,
|
|
1206
|
+
or an invalid file descriptor is supplied as the argument to -u.`]],["readarray",["readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]","Read lines from a file into an array variable.\n A synonym for `mapfile'."]],["readonly",["readonly [-aAf] [name[=value] ...] or readonly -p",`Mark shell variables as unchangeable.
|
|
1207
|
+
Mark each NAME as read-only; the values of these NAMEs may not be
|
|
1208
|
+
changed by subsequent assignment.
|
|
1209
|
+
Exit Status:
|
|
1210
|
+
Returns success unless an invalid option is given or NAME is invalid.`]],["return",["return [n]",`Return from a shell function.
|
|
1211
|
+
Causes a function or sourced script to exit with the return value
|
|
1212
|
+
specified by N. If N is omitted, the return status is that of the
|
|
1213
|
+
last command executed within the function or script.
|
|
1214
|
+
Exit Status:
|
|
1215
|
+
Returns N, or failure if the shell is not executing a function or script.`]],["set",["set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]",`Set or unset values of shell options and positional parameters.
|
|
1216
|
+
Change the value of shell attributes and positional parameters, or
|
|
1217
|
+
display the names and values of shell variables.
|
|
1218
|
+
|
|
1219
|
+
Options:
|
|
1220
|
+
-e Exit immediately if a command exits with a non-zero status.
|
|
1221
|
+
-u Treat unset variables as an error when substituting.
|
|
1222
|
+
-x Print commands and their arguments as they are executed.
|
|
1223
|
+
-o option-name
|
|
1224
|
+
Set the variable corresponding to option-name
|
|
1225
|
+
|
|
1226
|
+
Exit Status:
|
|
1227
|
+
Returns success unless an invalid option is given.`]],["shift",["shift [n]",`Shift positional parameters.
|
|
1228
|
+
Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is
|
|
1229
|
+
not given, it is assumed to be 1.
|
|
1230
|
+
Exit Status:
|
|
1231
|
+
Returns success unless N is negative or greater than $#.`]],["shopt",["shopt [-pqsu] [-o] [optname ...]",`Set and unset shell options.
|
|
1232
|
+
Change the setting of each shell option OPTNAME. Without any option
|
|
1233
|
+
arguments, list each supplied OPTNAME, or all shell options if no
|
|
1234
|
+
OPTNAMEs are given, with an indication of whether or not each is set.
|
|
1235
|
+
|
|
1236
|
+
Options:
|
|
1237
|
+
-o restrict OPTNAMEs to those defined for use with \`set -o'
|
|
1238
|
+
-p print each shell option with an indication of its status
|
|
1239
|
+
-q suppress output
|
|
1240
|
+
-s enable (set) each OPTNAME
|
|
1241
|
+
-u disable (unset) each OPTNAME
|
|
1242
|
+
|
|
1243
|
+
Exit Status:
|
|
1244
|
+
Returns success if OPTNAME is enabled; fails if an invalid option is
|
|
1245
|
+
given or OPTNAME is disabled.`]],["source",["source filename [arguments]",`Execute commands from a file in the current shell.
|
|
1246
|
+
Read and execute commands from FILENAME in the current shell.
|
|
1247
|
+
The entries in $PATH are used to find the directory containing FILENAME.
|
|
1248
|
+
Exit Status:
|
|
1249
|
+
Returns the status of the last command executed in FILENAME.`]],["suspend",["suspend [-f]",`Suspend shell execution.
|
|
1250
|
+
Suspend the execution of this shell until it receives a SIGCONT signal.`]],["test",["test [expr]",`Evaluate conditional expression.
|
|
1251
|
+
Exits with a status of 0 (true) or 1 (false) depending on
|
|
1252
|
+
the evaluation of EXPR. Expressions may be unary or binary.
|
|
1253
|
+
Exit Status:
|
|
1254
|
+
Returns success if EXPR evaluates to true; fails if EXPR evaluates to
|
|
1255
|
+
false or an invalid argument is given.`]],["times",["times",`Display process times.
|
|
1256
|
+
Prints the accumulated user and system times for the shell and all of its
|
|
1257
|
+
child processes.
|
|
1258
|
+
Exit Status:
|
|
1259
|
+
Always succeeds.`]],["trap",["trap [-lp] [[arg] signal_spec ...]",`Trap signals and other events.
|
|
1260
|
+
Defines and activates handlers to be run when the shell receives signals
|
|
1261
|
+
or other conditions.
|
|
1262
|
+
Exit Status:
|
|
1263
|
+
Returns success unless a SIGSPEC is invalid or an invalid option is given.`]],["true",["true",`Return a successful result.
|
|
1264
|
+
Exit Status:
|
|
1265
|
+
Always succeeds.`]],["type",["type [-afptP] name [name ...]",`Display information about command type.
|
|
1266
|
+
For each NAME, indicate how it would be interpreted if used as a
|
|
1267
|
+
command name.
|
|
1268
|
+
|
|
1269
|
+
Options:
|
|
1270
|
+
-a display all locations containing an executable named NAME
|
|
1271
|
+
-f suppress shell function lookup
|
|
1272
|
+
-P force a PATH search for each NAME, even if it is an alias,
|
|
1273
|
+
builtin, or function, and returns the name of the disk file
|
|
1274
|
+
that would be executed
|
|
1275
|
+
-p returns either the name of the disk file that would be executed,
|
|
1276
|
+
or nothing if \`type -t NAME' would not return \`file'
|
|
1277
|
+
-t output a single word which is one of \`alias', \`keyword',
|
|
1278
|
+
\`function', \`builtin', \`file' or \`', if NAME is an alias,
|
|
1279
|
+
shell reserved word, shell function, shell builtin, disk file,
|
|
1280
|
+
or not found, respectively
|
|
1281
|
+
|
|
1282
|
+
Exit Status:
|
|
1283
|
+
Returns success if all of the NAMEs are found; fails if any are not found.`]],["typeset",["typeset [-aAfFgilnrtux] [-p] name[=value] ...","Set variable values and attributes.\n A synonym for `declare'."]],["ulimit",["ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]",`Modify shell resource limits.
|
|
1284
|
+
Provides control over the resources available to the shell and processes
|
|
1285
|
+
it creates, on systems that allow such control.
|
|
1286
|
+
Exit Status:
|
|
1287
|
+
Returns success unless an invalid option is supplied or an error occurs.`]],["umask",["umask [-p] [-S] [mode]",`Display or set file mode mask.
|
|
1288
|
+
Sets the user file-creation mask to MODE. If MODE is omitted, prints
|
|
1289
|
+
the current value of the mask.
|
|
1290
|
+
Exit Status:
|
|
1291
|
+
Returns success unless MODE is invalid or an invalid option is given.`]],["unalias",["unalias [-a] name [name ...]",`Remove each NAME from the list of defined aliases.
|
|
1292
|
+
Exit Status:
|
|
1293
|
+
Returns success unless a NAME is not an existing alias.`]],["unset",["unset [-f] [-v] [-n] [name ...]",`Unset values and attributes of shell variables and functions.
|
|
1294
|
+
For each NAME, remove the corresponding variable or function.
|
|
1295
|
+
|
|
1296
|
+
Options:
|
|
1297
|
+
-f treat each NAME as a shell function
|
|
1298
|
+
-v treat each NAME as a shell variable
|
|
1299
|
+
-n treat each NAME as a name reference and unset the variable itself
|
|
1300
|
+
rather than the variable it references
|
|
1301
|
+
|
|
1302
|
+
Without options, unset first tries to unset a variable, and if that fails,
|
|
1303
|
+
tries to unset a function.
|
|
1304
|
+
Exit Status:
|
|
1305
|
+
Returns success unless an invalid option is given or a NAME is read-only.`]],["wait",["wait [-fn] [id ...]",`Wait for job completion and return exit status.
|
|
1306
|
+
Waits for each process identified by an ID, which may be a process ID or a
|
|
1307
|
+
job specification, and reports its termination status.
|
|
1308
|
+
Exit Status:
|
|
1309
|
+
Returns the status of the last ID; fails if ID is invalid or an invalid
|
|
1310
|
+
option is given.`]]]),Gy=[...jy.keys()].sort();function yf(e,t){let n=!1,r=[],s=0;for(;s<t.length;){let l=t[s];if(l==="--"){for(s++;s<t.length;)r.push(t[s]),s++;break}if(l.startsWith("-")&&l.length>1){for(let c=1;c<l.length;c++){let u=l[c];if(u==="s")n=!0;else return U(`bash: help: -${u}: invalid option
|
|
1311
|
+
`,2)}s++}else r.push(l),s++}if(r.length===0)return zC();let i="",o=!1,a="";for(let l of r){let c=WC(l);if(c.length===0){a+=`bash: help: no help topics match \`${l}'. Try \`help help' or \`man -k ${l}' or \`info ${l}'.
|
|
1312
|
+
`,o=!0;continue}for(let u of c){let f=jy.get(u);if(!f)continue;let[p,h]=f;n?i+=`${u}: ${p}
|
|
1313
|
+
`:i+=`${u}: ${p}
|
|
1314
|
+
${h}
|
|
1315
|
+
`}}return{exitCode:o?1:0,stdout:i,stderr:a}}function WC(e){let t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),n=X(`^${t}$`);return Gy.filter(r=>n.test(r))}function zC(){let e=[];e.push("just-bash shell builtins"),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push("");let t=36,n=Gy.slice(),r=Math.ceil(n.length/2);for(let s=0;s<r;s++){let i=n[s]||"",o=n[s+r]||"",a=i.padEnd(t);e.push(o?`${a}${o}`:i)}return xe(`${e.join(`
|
|
1316
|
+
`)}
|
|
1317
|
+
`)}ft();Wt();function HC(e){let t=[],n="",r=0;for(let s of e){for(let i of s)i==="("?r++:i===")"&&r--;n?n+=` ${s}`:n=s,r===0&&(t.push(n),n="")}return n&&t.push(n),t}async function wf(e,t){if(t.length===0)return U(`bash: let: expression expected
|
|
1318
|
+
`);let n=HC(t),r=0;for(let s of n)try{let o=In(`(( ${s} ))`).statements[0];if(o&&o.pipelines.length>0&&o.pipelines[0].commands.length>0){let a=o.pipelines[0].commands[0];a.type==="ArithmeticCommand"&&(r=await se(e,a.expression.expression))}}catch(i){return U(`bash: let: ${s}: ${i.message}
|
|
1319
|
+
`)}return H("","",r===0?1:0)}Pt();ft();Wt();bn();Tn();Er();async function bf(e,t){if(e.state.localScopes.length===0)return U(`bash: local: can only be used in a function
|
|
1320
|
+
`);let n=e.state.localScopes[e.state.localScopes.length-1],r="",s=0,i=!1,o=!1,a=!1,l=[];for(let c of t)if(c==="-n")i=!0;else if(c==="-a")o=!0;else if(c==="-p")a=!0;else if(c.startsWith("-")&&!c.includes("="))for(let u of c.slice(1))u==="n"?i=!0:u==="a"?o=!0:u==="p"&&(a=!0);else l.push(c);if(l.length===0){let c="",u=Array.from(n.keys()).filter(f=>!f.includes("_")||!f.match(/_\d+$/)).filter(f=>!f.includes("__length")).sort();for(let f of u){let p=e.state.env.get(f);p!==void 0&&(c+=`${f}=${p}
|
|
1321
|
+
`)}return H(c,"",0)}for(let c of l){let u,f,p=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(p){u=p[1];let y=p[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
|
|
1322
|
+
`,s=1;continue}if(Et(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let x=`${u}_`;for(let A of e.state.env.keys())A.startsWith(x)&&!A.includes("__")&&(n.has(A)||n.set(A,e.state.env.get(A)))}let w=`${u}_`;for(let x of e.state.env.keys())x.startsWith(w)&&!x.includes("__")&&e.state.env.delete(x);let b=Xn(y);for(let x=0;x<b.length;x++)e.state.env.set(`${u}_${x}`,b[x]);e.state.env.set(`${u}__length`,String(b.length)),vr(e,u),i&&ir(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let y=h[2];if(Et(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let $=`${u}_`;for(let v of e.state.env.keys())v.startsWith($)&&!v.includes("__")&&(n.has(v)||n.set(v,e.state.env.get(v)));let D=`${u}__length`;e.state.env.has(D)&&!n.has(D)&&n.set(D,e.state.env.get(D))}let w=Xn(y),b=pt(e,u),x=0,A=e.state.env.get(u);b.length===0&&A!==void 0?(e.state.env.set(`${u}_0`,A),e.state.env.delete(u),x=1):b.length>0&&(x=Math.max(...b)+1);for(let $=0;$<w.length;$++)e.state.env.set(`${u}_${x+$}`,ot(e,w[$]));let C=x+w.length;e.state.env.set(`${u}__length`,String(C)),vr(e,u),i&&ir(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){u=d[1];let y=ot(e,d[2]);Et(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let w=e.state.env.get(u)??"";e.state.env.set(u,w+y),vr(e,u),i&&ir(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(m){u=m[1];let y=m[2],w=ot(e,m[3]);if(Et(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let A=`${u}_`;for(let $ of e.state.env.keys())$.startsWith(A)&&!$.includes("__")&&(n.has($)||n.set($,e.state.env.get($)));let C=`${u}__length`;e.state.env.has(C)&&!n.has(C)&&n.set(C,e.state.env.get(C))}let b;try{let A=new pe,C=Ne(A,y);b=await se(e,C.expression)}catch{let A=parseInt(y,10);b=Number.isNaN(A)?0:A}e.state.env.set(`${u}_${b}`,w);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);b>=x&&e.state.env.set(`${u}__length`,String(b+1)),vr(e,u),i&&ir(e,u);continue}if(c.includes("=")){let y=c.indexOf("=");u=c.slice(0,y),f=ot(e,c.slice(y+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
|
|
1323
|
+
`,s=1;continue}let g=n.has(u);if(f!==void 0){let y=e.state.env.get(u);if(e.state.tempEnvBindings){let w=e.state.accessedTempEnvVars?.has(u),b=e.state.mutatedTempEnvVars?.has(u);if(!w&&!b)for(let x=e.state.tempEnvBindings.length-1;x>=0;x--){let A=e.state.tempEnvBindings[x];if(A.has(u)){y=A.get(u);break}}}$y(e,u,y)}if(!g){let y=e.state.env.get(u);if(e.state.tempEnvBindings)for(let w=e.state.tempEnvBindings.length-1;w>=0;w--){let b=e.state.tempEnvBindings[w];if(b.has(u)){y=b.get(u);break}}if(n.set(u,y),o){let w=`${u}_`;for(let x of e.state.env.keys())x.startsWith(w)&&!x.includes("__")&&(n.has(x)||n.set(x,e.state.env.get(x)));let b=`${u}__length`;e.state.env.has(b)&&!n.has(b)&&n.set(b,e.state.env.get(b))}}if(o&&f===void 0){let y=`${u}_`;for(let w of e.state.env.keys())w.startsWith(y)&&!w.includes("__")&&e.state.env.delete(w);e.state.env.set(`${u}__length`,"0")}else if(f!==void 0){if(Et(e,u,"bash"),i&&f!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(f)){r+=`bash: local: \`${f}': invalid variable name for name reference
|
|
1324
|
+
`,s=1;continue}e.state.env.set(u,f),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(u))}else{let y=e.state.tempEnvBindings?.some(w=>w.has(u));!g&&!y&&e.state.env.delete(u)}vr(e,u),i&&ir(e,u)}return H("",r,s)}bn();function xf(e,t,n){let r=`
|
|
1325
|
+
`,s=0,i=0,o=0,a=!1,l="MAPFILE",c=0;for(;c<t.length;){let w=t[c];w==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
|
|
1326
|
+
`,c+=2):w==="-n"&&c+1<t.length?(s=Number.parseInt(t[c+1],10)||0,c+=2):w==="-O"&&c+1<t.length?(i=Number.parseInt(t[c+1],10)||0,c+=2):w==="-s"&&c+1<t.length?(o=Number.parseInt(t[c+1],10)||0,c+=2):w==="-t"?(a=!0,c++):w==="-u"||w==="-C"||w==="-c"?c+=2:(w.startsWith("-")||(l=w),c++)}let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let f=[],p=u,h=0,d=0,m=e.limits?.maxArrayElements??1e5;for(;p.length>0;){let w=p.indexOf(r);if(w===-1){if(p.length>0){if(d<o)d++;else if(s===0||h<s){if(i+h>=m)return H("",`mapfile: array element limit exceeded (${m})
|
|
1327
|
+
`,1);let A=p,C=A.indexOf("\0");C!==-1&&(A=A.substring(0,C)),f.push(A),h++}}break}let b=p.substring(0,w),x=b.indexOf("\0");if(x!==-1&&(b=b.substring(0,x)),!a&&r!=="\0"&&(b+=r),p=p.substring(w+r.length),d<o){d++;continue}if(s>0&&h>=s)break;if(i+h>=m)return H("",`mapfile: array element limit exceeded (${m})
|
|
1328
|
+
`,1);f.push(b),h++}i===0&&Vn(e,l);for(let w=0;w<f.length;w++)e.state.env.set(`${l}_${i+w}`,f[w]);let g=parseInt(e.state.env.get(`${l}__length`)||"0",10),y=i+f.length;return e.state.env.set(`${l}__length`,String(Math.max(g,y))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),H("","",0)}bn();on();function jC(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}function GC(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function Ef(e,t,n,r=-1){let s=!1,i=`
|
|
1329
|
+
`,o="",a=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,d=!1,m=(k,N)=>{let R=1;for(;R<k.length;){let O=k[R];if(O==="r")s=!0,R++;else if(O==="s")R++;else{if(O==="d")return R+1<k.length?(i=k.substring(R+1),{nextArgIndex:N+1}):N+1<t.length?(i=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(O==="n"){if(R+1<k.length){let _=k.substring(R+1);return a=Number.parseInt(_,10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:N+1}}else if(N+1<t.length)return a=Number.parseInt(t[N+1],10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(O==="N"){if(R+1<k.length){let _=k.substring(R+1);return l=Number.parseInt(_,10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:N+1}}else if(N+1<t.length)return l=Number.parseInt(t[N+1],10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else{if(O==="a")return R+1<k.length?(c=k.substring(R+1),{nextArgIndex:N+1}):N+1<t.length?(c=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(O==="p")return R+1<k.length?(o=k.substring(R+1),{nextArgIndex:N+1}):N+1<t.length?(o=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(O==="u"){if(R+1<k.length){let _=k.substring(R+1);return u=Number.parseInt(_,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+1}}else if(N+1<t.length)return u=Number.parseInt(t[N+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(O==="t"){if(R+1<k.length){let _=k.substring(R+1);return f=Number.parseFloat(_),Number.isNaN(f)&&(f=0),{nextArgIndex:N+1}}else if(N+1<t.length)return f=Number.parseFloat(t[N+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(O==="e"||O==="i"||O==="P"){if(O==="i"&&N+1<t.length)return{nextArgIndex:N+2};R++}else R++}}}return{nextArgIndex:N+1}};for(;h<t.length;){let k=t[h];if(k.startsWith("-")&&k.length>1&&k!=="--"){let N=m(k,h);if(N.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(N.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=N.nextArgIndex}else if(k==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(k),h++}if(d)return H("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)Vn(e,c);else{for(let k of p)e.state.env.set(k,"");p.length===0&&e.state.env.set("REPLY","")}return H("","",0)}if(f<0&&f!==-1)return H("","",1);let g=n;u>=0?e.state.fileDescriptors?g=e.state.fileDescriptors.get(u)||"":g="":!g&&e.state.groupStdin!==void 0&&(g=e.state.groupStdin);let y=i===""?"\0":i,w="",b=0,x=!0,A=k=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(k));else if(r>=0&&e.state.fileDescriptors){let N=e.state.fileDescriptors.get(r);if(N?.startsWith("__rw__:")){let R=jC(N);if(R){let O=R.position+k;e.state.fileDescriptors.set(r,GC(R.path,O,R.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(k))};if(l>=0){let k=Math.min(l,g.length);w=g.substring(0,k),b=k,x=k>=l,A(b);let N=p[0]||"REPLY";e.state.env.set(N,w);for(let R=1;R<p.length;R++)e.state.env.set(p[R],"");return H("","",x?0:1)}else if(a>=0){let k=0,N=0,R=!1;for(;N<g.length&&k<a;){let O=g[N];if(O===y){b=N+1,R=!0;break}if(!s&&O==="\\"&&N+1<g.length){let _=g[N+1];if(_===y&&y===`
|
|
1330
|
+
`){N+=2,b=N;continue}if(_===y){N+=2,k++,w+=_,b=N;continue}w+=_,N+=2,k++,b=N}else w+=O,N++,k++,b=N}x=k>=a||R,A(b)}else{b=0;let k=0;for(;k<g.length;){let N=g[k];if(N===y){b=k+y.length,x=!0;break}if(!s&&N==="\\"&&k+1<g.length){let R=g[k+1];if(R===`
|
|
1331
|
+
`){k+=2;continue}if(R===y){w+=R,k+=2;continue}w+=N,w+=R,k+=2;continue}w+=N,k++}if(k>=g.length&&(x=!1,b=k,w.length===0&&g.length===0)){for(let N of p)e.state.env.set(N,"");return c&&Vn(e,c),H("","",1)}A(b)}y===`
|
|
1332
|
+
`&&w.endsWith(`
|
|
1333
|
+
`)&&(w=w.slice(0,-1));let C=k=>s?k:k.replace(/\\(.)/g,"$1");if(p.length===1&&p[0]==="REPLY")return e.state.env.set("REPLY",C(w)),H("","",x?0:1);let $=wt(e.state.env);if(c){let{words:k}=Cu(w,$,void 0,s),N=e.limits?.maxArrayElements??1e5;if(k.length>N)return H("",`read: array element limit exceeded (${N})
|
|
1334
|
+
`,1);Vn(e,c);for(let R=0;R<k.length;R++)e.state.env.set(`${c}_${R}`,C(k[R]));return H("","",x?0:1)}let D=p.length,{words:v,wordStarts:P}=Cu(w,$,D,s);for(let k=0;k<p.length;k++){let N=p[k];if(k<p.length-1)e.state.env.set(N,C(v[k]??""));else if(k<P.length){let R=w.substring(P[k]);R=Gg(R,$,s),R=C(R),e.state.env.set(N,R)}else e.state.env.set(N,"")}return H("","",x?0:1)}we();function Af(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return U("bash: return: can only 'return' from a function or sourced script (can only `return' from a function or sourced script)\n");let n=e.state.lastExitCode;if(t.length>0){let r=t[0],s=Number.parseInt(r,10);if(r===""||Number.isNaN(s)||!/^-?\d+$/.test(r))return U(`bash: return: ${r}: numeric argument required
|
|
1335
|
+
`,2);n=(s%256+256)%256}throw new St(n)}we();bn();var _i=`set: usage: set [-eux] [+eux] [-o option] [+o option]
|
|
1336
|
+
Options:
|
|
1337
|
+
-e Exit immediately if a command exits with non-zero status
|
|
1338
|
+
+e Disable -e
|
|
1339
|
+
-u Treat unset variables as an error when substituting
|
|
1340
|
+
+u Disable -u
|
|
1341
|
+
-x Print commands and their arguments as they are executed
|
|
1342
|
+
+x Disable -x
|
|
1343
|
+
-o errexit Same as -e
|
|
1344
|
+
+o errexit Disable errexit
|
|
1345
|
+
-o nounset Same as -u
|
|
1346
|
+
+o nounset Disable nounset
|
|
1347
|
+
-o pipefail Return status of last failing command in pipeline
|
|
1348
|
+
+o pipefail Disable pipefail
|
|
1349
|
+
-o xtrace Same as -x
|
|
1350
|
+
+o xtrace Disable xtrace
|
|
1351
|
+
`,Vy=new Map([["e","errexit"],["u","nounset"],["x","xtrace"],["v","verbose"],["f","noglob"],["C","noclobber"],["a","allexport"],["n","noexec"],["h",null],["b",null],["m",null],["B",null],["H",null],["P",null],["T",null],["E",null],["p",null]]),Fa=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["noclobber","noclobber"],["noglob","noglob"],["allexport","allexport"],["noexec","noexec"],["posix","posix"],["vi","vi"],["emacs","emacs"],["notify",null],["monitor",null],["braceexpand",null],["histexpand",null],["physical",null],["functrace",null],["errtrace",null],["privileged",null],["hashall",null],["ignoreeof",null],["interactive-comments",null],["keyword",null],["onecmd",null]]),Ky=["errexit","nounset","pipefail","verbose","xtrace","posix","allexport","noclobber","noglob","noexec","vi","emacs"],Qy=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"];function Sf(e,t,n){t!==null&&(n&&(t==="vi"?e.state.options.emacs=!1:t==="emacs"&&(e.state.options.vi=!1)),e.state.options[t]=n,Ps(e))}function VC(e,t){return t+1<e.length&&!e[t+1].startsWith("-")&&!e[t+1].startsWith("+")}function qC(e,t){let n=pt(e,t);if(n.length===0)return`${t}=()`;let r=n.map(s=>{let i=e.state.env.get(`${t}_${s}`)??"";return`[${s}]=${es(i)}`});return`${t}=(${r.join(" ")})`}function ZC(e){return/^[a-zA-Z0-9_]+$/.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function KC(e,t){let n=$n(e,t);if(n.length===0)return`${t}=()`;let r=n.map(s=>{let i=e.state.env.get(`${t}_${s}`)??"";return`[${ZC(s)}]=${es(i)}`});return`${t}=(${r.join(" ")} )`}function QC(e){let t=new Set,n=e.state.associativeArrays??new Set;for(let r of e.state.env.keys()){let s=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(s){let i=s[1];n.has(i)||t.add(i)}}return t}function XC(e){return e.state.associativeArrays??new Set}function qy(e){let t=Ky.map(r=>`${r.padEnd(16)}${e.state.options[r]?"on":"off"}`),n=Qy.map(r=>`${r.padEnd(16)}off`);return`${[...t,...n].sort().join(`
|
|
1352
|
+
`)}
|
|
1353
|
+
`}function Zy(e){let t=Ky.map(r=>`set ${e.state.options[r]?"-o":"+o"} ${r}`),n=Qy.map(r=>`set +o ${r}`);return`${[...t,...n].sort().join(`
|
|
1354
|
+
`)}
|
|
1355
|
+
`}function vf(e,t){if(t.includes("--help"))return xe(_i);if(t.length===0){let i=QC(e),o=XC(e),a=u=>{for(let f of o){let p=`${f}_`,h=`${f}__length`;if(u!==h&&u.startsWith(p)){if(u.slice(p.length).startsWith("_length"))continue;return!0}}return!1},l=[];for(let[u,f]of e.state.env){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)||i.has(u)||o.has(u))continue;let p=u.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(p&&i.has(p[1]))continue;let h=u.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);h&&i.has(h[1])||a(u)||h&&o.has(h[1])||l.push([u,f])}let c=[];for(let[u,f]of l.sort(([p],[h])=>p<h?-1:p>h?1:0))c.push(`${u}=${Pa(f)}`);for(let u of[...i].sort((f,p)=>f<p?-1:f>p?1:0))c.push(qC(e,u));for(let u of[...o].sort((f,p)=>f<p?-1:f>p?1:0))c.push(KC(e,u));return c.sort((u,f)=>{let p=u.split("=")[0],h=f.split("=")[0];return p<h?-1:p>h?1:0}),xe(c.length>0?`${c.join(`
|
|
1356
|
+
`)}
|
|
1357
|
+
`:"")}let n=[],r=()=>n.length>0?xe(n.join("")):ve,s=0;for(;s<t.length;){let i=t[s];if((i==="-o"||i==="+o")&&VC(t,s)){let o=t[s+1];if(!Fa.has(o)){let a=`bash: set: ${o}: invalid option name
|
|
1358
|
+
${_i}`;if(e.state.options.posix)throw new Ft(1,"",a);return U(a,2)}Sf(e,Fa.get(o)??null,i==="-o"),s+=2;continue}if(i==="-o"){n.push(qy(e)),s++;continue}if(i==="+o"){n.push(Zy(e)),s++;continue}if(i.length>1&&(i[0]==="-"||i[0]==="+")&&i[1]!=="-"){let o=i[0]==="-",a=0;for(let l=1;l<i.length;l++){let c=i[l];if(c==="o"){let u=s+1+a;if(u<t.length&&!t[u].startsWith("-")&&!t[u].startsWith("+")){let p=t[u];if(!Fa.has(p)){let h=`bash: set: ${p}: invalid option name
|
|
1359
|
+
${_i}`;if(e.state.options.posix)throw new Ft(1,"",h);return U(h,2)}Sf(e,Fa.get(p)??null,o),a++;continue}n.push(o?qy(e):Zy(e));continue}if(!Vy.has(c)){let u=`bash: set: ${i[0]}${c}: invalid option
|
|
1360
|
+
${_i}`;if(e.state.options.posix)throw new Ft(1,"",u);return U(u,2)}Sf(e,Vy.get(c)??null,o)}s+=1+a;continue}if(i==="--")return Cf(e,t.slice(s+1)),r();if(i==="-"){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Ps(e),s+1<t.length)return Cf(e,t.slice(s+1)),r();s++;continue}if(i==="+"){s++;continue}if(i.startsWith("-")||i.startsWith("+")){let o=`bash: set: ${i}: invalid option
|
|
1361
|
+
${_i}`;if(e.state.options.posix)throw new Ft(1,"",o);return U(o,2)}return Cf(e,t.slice(s)),r()}return r()}function Cf(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let r=0;r<t.length;r++)e.state.env.set(String(r+1),t[r]);e.state.env.set("#",String(t.length)),e.state.env.set("@",t.join(" ")),e.state.env.set("*",t.join(" "))}we();function kf(e,t){let n=1;if(t.length>1)return U(`bash: shift: too many arguments
|
|
1362
|
+
`);if(t.length>0){let o=Number.parseInt(t[0],10);if(Number.isNaN(o)){let a=`bash: shift: ${t[0]}: numeric argument required
|
|
1363
|
+
`;if(e.state.options.posix)throw new Ft(1,"",a);return U(a)}if(o<0){let a=`bash: shift: shift count out of range
|
|
1364
|
+
`;if(e.state.options.posix)throw new Ft(1,"",a);return U(a)}n=o}let r=Number.parseInt(e.state.env.get("#")||"0",10);if(n>r){let o=`bash: shift: shift count out of range
|
|
1365
|
+
`;if(e.state.options.posix)throw new Ft(1,"",o);return U(o)}if(n===0)return ve;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),ve}ft();we();async function Nf(e,t,n=""){let r=t;if(r.length>0&&r[0]==="--"&&(r=r.slice(1)),r.length===0)return H("",`bash: source: filename argument required
|
|
1366
|
+
`,2);let s=r[0],i=null,o=null;if(s.includes("/")){let p=e.fs.resolvePath(e.state.cwd,s);try{o=await e.fs.readFile(p),i=p}catch{}}else{let h=(e.state.env.get("PATH")||"").split(":").filter(d=>d);for(let d of h){let m=e.fs.resolvePath(e.state.cwd,`${d}/${s}`);try{if((await e.fs.stat(m)).isDirectory)continue;o=await e.fs.readFile(m),i=m;break}catch{}}if(o===null){let d=e.fs.resolvePath(e.state.cwd,s);try{o=await e.fs.readFile(d),i=d}catch{}}}if(o===null)return U(`bash: ${s}: No such file or directory
|
|
1367
|
+
`);let a=new Map;if(r.length>1){for(let h=1;h<=9;h++)a.set(String(h),e.state.env.get(String(h)));a.set("#",e.state.env.get("#")),a.set("@",e.state.env.get("@"));let p=r.slice(1);e.state.env.set("#",String(p.length)),e.state.env.set("@",p.join(" "));for(let h=0;h<p.length&&h<9;h++)e.state.env.set(String(h+1),p[h]);for(let h=p.length+1;h<=9;h++)e.state.env.delete(String(h))}let l=e.state.currentSource,c=n!=="",u=e.state.groupStdin,f=()=>{if(e.state.sourceDepth--,e.state.currentSource=l,c&&(e.state.groupStdin=u),r.length>1)for(let[p,h]of a)h===void 0?e.state.env.delete(p):e.state.env.set(p,h)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new K(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=s,c&&(e.state.groupStdin=n);try{let p=In(o),h=await e.executeScript(p);return f(),h}catch(p){if(f(),p instanceof Ce)throw p;if(p instanceof St)return H(p.stdout,p.stderr,p.exitCode);if(p.name==="ParseException")return U(`bash: ${s}: ${p.message}
|
|
1368
|
+
`);throw p}}Pt();ft();Wt();Xt();zt();Tn();Er();function Xy(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function YC(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function Yy(e,t){if(YC(t))return null;try{let n=new pe,r=Ne(n,t);return await se(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function Jy(e,t){if(e.state.localVarStack?.has(t)){let r=$a(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),If(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||Ia(e,t),!0}}return!1}function If(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function e7(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new pe().parseWordFromString(n,!0,!1);return re(e,s)}if(t.includes("$")){let r=new pe().parseWordFromString(t,!1,!1);return re(e,r)}return t}async function $f(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let p=c[1],h=c[2];if(h==="@"||h==="*"){let b=ce(e,p);for(let[x]of b)e.state.env.delete(`${p}_${x}`);e.state.env.delete(p);continue}let d=e.state.associativeArrays?.has(p);if(d){let b=await e7(e,h);e.state.env.delete(`${p}_${b}`);continue}let m=or(e,p),g=e.state.declaredVars?.has(p);if((e.state.env.has(p)||g)&&!m&&!d){r+=`bash: unset: ${p}: not an array variable
|
|
1369
|
+
`,s=1;continue}let w=await Yy(e,h);if(w===null&&m){r+=`bash: unset: ${h}: not a valid identifier
|
|
1370
|
+
`,s=1;continue}if(w===null)continue;if(w<0){let b=ce(e,p),x=b.length,A=e.state.currentLine;if(x===0){r+=`bash: line ${A}: unset: [${w}]: bad array subscript
|
|
1371
|
+
`,s=1;continue}let C=x+w;if(C<0){r+=`bash: line ${A}: unset: [${w}]: bad array subscript
|
|
1372
|
+
`,s=1;continue}let $=b[C][0];e.state.env.delete(`${p}_${$}`);continue}e.state.env.delete(`${p}_${w}`);continue}if(!Xy(i)){r+=`bash: unset: ${i}: not a valid identifier
|
|
1373
|
+
`,s=1;continue}let u=i;if(We(e,i)){let p=Bt(e,i);p&&p!==i&&(u=p)}if(Kn(e,u)){r+=`bash: unset: ${u}: cannot unset: readonly variable
|
|
1374
|
+
`,s=1;continue}let f=zs(e,u);if(f!==void 0&&f!==e.state.callDepth)Jy(e,u);else if(e.state.fullyUnsetLocals?.has(u))e.state.env.delete(u);else if(f!==void 0){let p=e.state.accessedTempEnvVars?.has(u),h=e.state.mutatedTempEnvVars?.has(u);if((p||h)&&e.state.localVarStack?.has(u)){let d=$a(e,u);d?d.value===void 0?e.state.env.delete(u):e.state.env.set(u,d.value):e.state.env.delete(u)}else e.state.env.delete(u)}else If(e,u)||e.state.env.delete(u);e.state.exportedVars?.delete(u);continue}let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let c=o[1],u=o[2];if(u==="@"||u==="*"){let m=ce(e,c);for(let[g]of m)e.state.env.delete(`${c}_${g}`);e.state.env.delete(c);continue}let f=e.state.associativeArrays?.has(c);if(f){let m=await e7(e,u);e.state.env.delete(`${c}_${m}`);continue}let p=or(e,c);if(e.state.env.has(c)&&!p&&!f){r+=`bash: unset: ${c}: not an array variable
|
|
1375
|
+
`,s=1;continue}let d=await Yy(e,u);if(d===null&&p){r+=`bash: unset: ${u}: not a valid identifier
|
|
1376
|
+
`,s=1;continue}if(d===null)continue;if(d<0){let m=ce(e,c),g=m.length,y=e.state.currentLine;if(g===0){r+=`bash: line ${y}: unset: [${d}]: bad array subscript
|
|
1377
|
+
`,s=1;continue}let w=g+d;if(w<0){r+=`bash: line ${y}: unset: [${d}]: bad array subscript
|
|
1378
|
+
`,s=1;continue}let b=m[w][0];e.state.env.delete(`${c}_${b}`);continue}e.state.env.delete(`${c}_${d}`);continue}if(!Xy(i)){r+=`bash: unset: ${i}: not a valid identifier
|
|
1379
|
+
`,s=1;continue}let a=i;if(We(e,i)){let c=Bt(e,i);c&&c!==i&&(a=c)}if(Kn(e,a)){r+=`bash: unset: ${a}: cannot unset: readonly variable
|
|
1380
|
+
`,s=1;continue}let l=zs(e,a);if(l!==void 0&&l!==e.state.callDepth)Jy(e,a);else if(e.state.fullyUnsetLocals?.has(a))e.state.env.delete(a);else if(l!==void 0){let c=e.state.accessedTempEnvVars?.has(a),u=e.state.mutatedTempEnvVars?.has(a);if((c||u)&&e.state.localVarStack?.has(a)){let f=$a(e,a);f?f.value===void 0?e.state.env.delete(a):e.state.env.set(a,f.value):e.state.env.delete(a)}else e.state.env.delete(a)}else If(e,a)||e.state.env.delete(a);e.state.exportedVars?.delete(a),e.state.functions.delete(i)}return H("",r,s)}var Tf=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],JC=["autocd","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","execfail","extdebug","extquote","force_fignore","globasciiranges","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath"];function La(e){return Tf.includes(e)}function ev(e){return JC.includes(e)}function t7(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=[],l=0;for(;l<t.length;){let p=t[l];if(p==="--"){l++;break}if(p.startsWith("-")&&p.length>1){for(let h=1;h<p.length;h++){let d=p[h];switch(d){case"s":n=!0;break;case"u":r=!0;break;case"p":s=!0;break;case"q":i=!0;break;case"o":o=!0;break;default:return{exitCode:2,stdout:"",stderr:`shopt: -${d}: invalid option
|
|
1381
|
+
`}}}l++}else break}for(;l<t.length;)a.push(t[l]),l++;if(o)return tv(e,a,n,r,s,i);if(n&&r)return{exitCode:1,stdout:"",stderr:`shopt: cannot set and unset shell options simultaneously
|
|
1382
|
+
`};if(a.length===0){if(n||r){let h=[];for(let d of Tf){let m=e.state.shoptOptions[d];n&&m?h.push(s?`shopt -s ${d}`:`${d} on`):r&&!m&&h.push(s?`shopt -u ${d}`:`${d} off`)}return{exitCode:0,stdout:h.length>0?`${h.join(`
|
|
1383
|
+
`)}
|
|
1384
|
+
`:"",stderr:""}}let p=[];for(let h of Tf){let d=e.state.shoptOptions[h];p.push(s?`shopt ${d?"-s":"-u"} ${h}`:`${h} ${d?"on":"off"}`)}return{exitCode:0,stdout:`${p.join(`
|
|
1385
|
+
`)}
|
|
1386
|
+
`,stderr:""}}let c=!1,u="",f=[];for(let p of a){if(!La(p)&&!ev(p)){u+=`shopt: ${p}: invalid shell option name
|
|
1387
|
+
`,c=!0;continue}if(n)La(p)&&(e.state.shoptOptions[p]=!0,qc(e));else if(r)La(p)&&(e.state.shoptOptions[p]=!1,qc(e));else if(La(p)){let h=e.state.shoptOptions[p];i?h||(c=!0):s?(f.push(`shopt ${h?"-s":"-u"} ${p}`),h||(c=!0)):(f.push(`${p} ${h?"on":"off"}`),h||(c=!0))}else i?c=!0:s?(f.push(`shopt -u ${p}`),c=!0):(f.push(`${p} off`),c=!0)}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(`
|
|
1388
|
+
`)}
|
|
1389
|
+
`:"",stderr:u}}function tv(e,t,n,r,s,i){let o=new Map([["errexit","errexit"],["pipefail","pipefail"],["nounset","nounset"],["xtrace","xtrace"],["verbose","verbose"],["posix","posix"],["allexport","allexport"],["noclobber","noclobber"],["noglob","noglob"],["noexec","noexec"],["vi","vi"],["emacs","emacs"]]),a=["braceexpand","errtrace","functrace","hashall","histexpand","history","ignoreeof","interactive-comments","keyword","monitor","nolog","notify","onecmd","physical","privileged"],l=[...o.keys(),...a].sort();if(t.length===0){let p=[];for(let h of l){let d=a.includes(h),m=o.get(h),g=d||!m?!1:e.state.options[m];n&&!g||r&&g||p.push(s?`set ${g?"-o":"+o"} ${h}`:`${h} ${g?"on":"off"}`)}return{exitCode:0,stdout:p.length>0?`${p.join(`
|
|
1390
|
+
`)}
|
|
1391
|
+
`:"",stderr:""}}let c=!1,u="",f=[];for(let p of t){let h=o.has(p),d=a.includes(p);if(!h&&!d){u+=`shopt: ${p}: invalid option name
|
|
1392
|
+
`,c=!0;continue}if(d){n||r||(i?c=!0:s?(f.push(`set +o ${p}`),c=!0):(f.push(`${p} off`),c=!0));continue}let m=o.get(p);if(m)if(n)m==="vi"?e.state.options.emacs=!1:m==="emacs"&&(e.state.options.vi=!1),e.state.options[m]=!0,Ps(e);else if(r)e.state.options[m]=!1,Ps(e);else{let g=e.state.options[m];i?g||(c=!0):s?(f.push(`set ${g?"-o":"+o"} ${p}`),g||(c=!0)):(f.push(`${p} ${g?"on":"off"}`),g||(c=!0))}}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(`
|
|
1393
|
+
`)}
|
|
1394
|
+
`:"",stderr:u}}async function n7(e,t,n){if(t.includes("/")){let o=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(o))return{error:"not_found",path:o};let a=o.split("/").pop()||t,l=e.commands.get(a);try{let c=await e.fs.stat(o);return c.isDirectory?{error:"permission_denied",path:o}:l?{cmd:l,path:o}:(c.mode&73)!==0?{script:!0,path:o}:{error:"permission_denied",path:o}}catch{return{error:"not_found",path:o}}}if(!n&&e.state.hashTable){let o=e.state.hashTable.get(t);if(o)if(await e.fs.exists(o)){let a=e.commands.get(t);if(a)return{cmd:a,path:o};try{let l=await e.fs.stat(o);if(!l.isDirectory&&(l.mode&73)!==0)return{script:!0,path:o}}catch{}}else e.state.hashTable.delete(t)}let s=(n??e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let o of s){if(!o)continue;let l=`${o.startsWith("/")?o:e.fs.resolvePath(e.state.cwd,o)}/${t}`;if(await e.fs.exists(l))try{let c=await e.fs.stat(l);if(c.isDirectory)continue;let u=(c.mode&73)!==0,f=e.commands.get(t),p=o==="/bin"||o==="/usr/bin";if(f&&p)return{cmd:f,path:l};if(u){if(f&&!p)return{script:!0,path:l};if(!f)return{script:!0,path:l}}}catch{}}if(!await e.fs.exists("/usr/bin")){let o=e.commands.get(t);if(o)return{cmd:o,path:`/usr/bin/${t}`}}return null}async function Ma(e,t){let n=[];if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(i))try{let o=await e.fs.stat(i);o.isDirectory||(o.mode&73)!==0&&n.push(t)}catch{}return n}let s=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let i of s){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}n.push(i.startsWith("/")?a:`${i}/${t}`)}}return n}zn();function nv(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function Xe(e,t,n,r){return((...s)=>{lt(t,n,`${r} call`);let i=e(...s);return nv(i)?i.then(o=>(lt(t,n,`${r} post-await`),o),o=>{throw lt(t,n,`${r} post-await`),o}):(lt(t,n,`${r} return`),i)})}function rv(e,t,n){let r={readFile:Xe(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:Xe(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:Xe(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:Xe(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:Xe(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:Xe(e.exists.bind(e),t,n,"fs.exists"),stat:Xe(e.stat.bind(e),t,n,"fs.stat"),mkdir:Xe(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:Xe(e.readdir.bind(e),t,n,"fs.readdir"),rm:Xe(e.rm.bind(e),t,n,"fs.rm"),cp:Xe(e.cp.bind(e),t,n,"fs.cp"),mv:Xe(e.mv.bind(e),t,n,"fs.mv"),resolvePath:Xe(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:Xe(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:Xe(e.chmod.bind(e),t,n,"fs.chmod"),symlink:Xe(e.symlink.bind(e),t,n,"fs.symlink"),link:Xe(e.link.bind(e),t,n,"fs.link"),readlink:Xe(e.readlink.bind(e),t,n,"fs.readlink"),lstat:Xe(e.lstat.bind(e),t,n,"fs.lstat"),realpath:Xe(e.realpath.bind(e),t,n,"fs.realpath"),utimes:Xe(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=Xe(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),r}function Of(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:rv(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=Xe(e.exec,e.requireDefenseContext,n,"exec")),e.fetch&&(r.fetch=Xe(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(r.sleep=Xe(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(r.getRegisteredCommands=Xe(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),r}we();nn();async function s7(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))if(g==="t")s=!0;else if(g==="p")i=!0;else if(g==="P")o=!0;else if(g==="a")a=!0;else if(g==="f")l=!0;else return H("",`type: -${g}: unsupported option
|
|
1395
|
+
`,2);else c.push(m);let u="",f="",p=0,h=!1,d=!1;for(let m of c){let g=!1;if(o){if(a){let $=await r(m);if($.length>0){for(let D of $)u+=`${D}
|
|
1396
|
+
`;h=!0,g=!0}}else{let $=await n(m);$&&(u+=`${$}
|
|
1397
|
+
`,h=!0,g=!0)}g||(d=!0);continue}let y=!l&&e.state.functions.has(m);if(a&&y){if(!i)if(s)u+=`function
|
|
1398
|
+
`;else{let $=e.state.functions.get(m),D=$?r7(m,$):`${m} is a shell function
|
|
1399
|
+
`;u+=D}g=!0}let w=e.state.env.get(`BASH_ALIAS_${m}`);if(w!==void 0&&(a||!g)&&(i||(s?u+=`alias
|
|
1400
|
+
`:u+=`${m} is aliased to \`${w}'
|
|
1401
|
+
`),g=!0,!a)||Vu.has(m)&&(a||!g)&&(i||(s?u+=`keyword
|
|
1402
|
+
`:u+=`${m} is a shell keyword
|
|
1403
|
+
`),g=!0,!a)||e.commands.has(m)&&(a||!g)&&(i||(s?u+=`registered
|
|
1404
|
+
`:u+=`${m} is a registered command
|
|
1405
|
+
`),g=!0,!a))continue;if(!a&&y&&!g){if(!i)if(s)u+=`function
|
|
1406
|
+
`;else{let $=e.state.functions.get(m),D=$?r7(m,$):`${m} is a shell function
|
|
1407
|
+
`;u+=D}g=!0;continue}if(!(Hs.has(m)&&(a||!g)&&(i||(s?u+=`builtin
|
|
1408
|
+
`:u+=`${m} is a shell builtin
|
|
1409
|
+
`),g=!0,!a))){if(a){let $=await r(m);for(let D of $)i?u+=`${D}
|
|
1410
|
+
`:s?u+=`file
|
|
1411
|
+
`:u+=`${m} is ${D}
|
|
1412
|
+
`,h=!0,g=!0}else if(!g){let $=await n(m);$&&(i?u+=`${$}
|
|
1413
|
+
`:s?u+=`file
|
|
1414
|
+
`:u+=`${m} is ${$}
|
|
1415
|
+
`,h=!0,g=!0)}if(!g&&(d=!0,!s&&!i)){let $=!0;if(m.includes("/")){let D=e.fs.resolvePath(e.state.cwd,m);await e.fs.exists(D)&&($=!1)}$&&(f+=`bash: type: ${m}: not found
|
|
1416
|
+
`)}}}return i?p=d&&!h?1:0:p=d?1:0,H(u,f,p)}function r7(e,t){return`${e} is a shell function
|
|
1417
|
+
`}async function i7(e,t,n,r){let s="",i="",o=0;for(let a of t){if(!a){o=1;continue}let l=e.state.env.get(`BASH_ALIAS_${a}`);if(l!==void 0)r?s+=`${a} is an alias for "${l}"
|
|
1418
|
+
`:s+=`alias ${a}='${l}'
|
|
1419
|
+
`;else if(Vu.has(a))r?s+=`${a} is a shell keyword
|
|
1420
|
+
`:s+=`${a}
|
|
1421
|
+
`;else if(Hs.has(a))r?s+=`${a} is a shell builtin
|
|
1422
|
+
`:s+=`${a}
|
|
1423
|
+
`;else if(e.commands.has(a))r?s+=`${a} is a registered command
|
|
1424
|
+
`:s+=`${a}
|
|
1425
|
+
`;else if(e.state.functions.has(a))r?s+=`${a} is a function
|
|
1426
|
+
`:s+=`${a}
|
|
1427
|
+
`;else if(a.includes("/")){let c=e.fs.resolvePath(e.state.cwd,a),u=!1;if(await e.fs.exists(c))try{let f=await e.fs.stat(c);f.isDirectory||(f.mode&73)!==0&&(r?s+=`${a} is ${a}
|
|
1428
|
+
`:s+=`${a}
|
|
1429
|
+
`,u=!0)}catch{}u||(r&&(i+=`${a}: not found
|
|
1430
|
+
`),o=1)}else{let c=await Rf(e,a);c?r?s+=`${a} is ${c}
|
|
1431
|
+
`:s+=`${c}
|
|
1432
|
+
`:(r&&(i+=`${a}: not found
|
|
1433
|
+
`),o=1)}}return H(s,i,o)}async function Rf(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{if((await e.fs.stat(s)).isDirectory)return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{if((await e.fs.stat(o)).isDirectory)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}var sv=new Set(["awk","cat","cut","grep","head","jq","mapfile","read","readarray","sed","sort","tail","tee","tr","uniq","wc","xargs"]);function Pf(e){return sv.has(e)}async function o7(e,t,n,r,s,i,o,a){let{ctx:l,runCommand:c}=e;if(l.coverage&&Hs.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return mf(l,n);if(t==="unset")return $f(l,n);if(t==="exit")return df(l,n);if(t==="local")return bf(l,n);if(t==="set")return vf(l,n);if(t==="break")return Bu(l,n);if(t==="continue")return Ju(l,n);if(t==="return")return Af(l,n);if(t==="eval"&&l.state.options.posix)return Da(l,n,s);if(t==="shift")return kf(l,n);if(t==="getopts")return _a(l,n);if(t==="compgen")return Ku(l,n);if(t==="complete")return Xu(l,n);if(t==="compopt")return Yu(l,n);if(t==="pushd")return await ff(l,n);if(t==="popd")return pf(l,n);if(t==="dirs")return hf(l,n);if(t==="source"||t===".")return Nf(l,n,s);if(t==="read")return Ef(l,n,s,a);if(t==="mapfile"||t==="readarray")return xf(l,n,s);if(t==="declare"||t==="typeset")return lf(l,n);if(t==="readonly")return cf(l,n);if(l.commands.has(t))return null;if(!i){let u=l.state.functions.get(t);if(u)return Ra(l,u,n,s)}if(t==="eval")return Da(l,n,s);if(t==="cd")return await Wu(l,n);if(t===":"||t==="true")return ve;if(t==="false")return ht(!1);if(t==="let")return wf(l,n);if(t==="command")return iv(e,n,s);if(t==="builtin")return ov(e,n,s);if(t==="shopt")return t7(l,n);if(t==="exec"){if(n.length===0)return ve;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="jobs")return l.jobControl?.jobs?l.jobControl.jobs(n):ve;if(t==="wait")return l.jobControl?.wait?l.jobControl.wait(n):ve;if(t==="type")return await s7(l,n,u=>Rf(l,u),u=>Ma(l,u));if(t==="hash")return gf(l,n);if(t==="help")return yf(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return U("[: missing `]'\n",2);u=n.slice(0,-1)}return Pi(l,u)}return null}async function iv(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return ve;let i=!1,o=!1,a=!1,l=t;for(;l.length>0&&l[0].startsWith("-");){let f=l[0];if(f==="--"){l=l.slice(1);break}for(let p of f.slice(1))p==="p"?i=!0:p==="V"?o=!0:p==="v"&&(a=!0);l=l.slice(1)}if(l.length===0)return ve;if(a||o)return await i7(r,l,a,o);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function ov(e,t,n){let{runCommand:r}=e;if(t.length===0)return ve;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return ve;let i=s[0];if(!Hs.has(i))return U(`bash: builtin: ${i}: not a shell builtin
|
|
1434
|
+
`);let[,...o]=s;return r(i,o,[],n,!0,!1,-1)}async function a7(e,t,n,r,s){let{ctx:i,buildExportedEnv:o,executeUserScript:a}=e;if(i.hostSpawn){let y=i.commands.get(t);if(y){let A=o(),C=r===""&&i.state.groupStdin!==void 0,$=r||i.state.groupStdin||"",D={fs:i.fs,cwd:i.state.cwd,env:i.state.env,exportedEnv:A,stdin:$,limits:i.limits,exec:i.execFn,fetch:i.fetch,getRegisteredCommands:()=>Array.from(i.commands.keys()),sleep:i.sleep,trace:i.trace,fileDescriptors:i.state.fileDescriptors,xpgEcho:i.state.shoptOptions.xpg_echo,coverage:i.coverage,signal:i.state.signal,requireDefenseContext:i.requireDefenseContext,jsBootstrapCode:i.jsBootstrapCode,invokeTool:i.invokeTool},v=Of(D,t);try{let P=()=>Rt(i.requireDefenseContext,"command",`${t} execution`,()=>y.execute(n,v));return y.trusted?await bt.runTrustedAsync(()=>P()):await P()}catch(P){if(P instanceof K||P instanceof de)throw P;return U(`${t}: ${ze(Ke(P))}
|
|
1435
|
+
`)}finally{C&&(y.consumesStdin||Pf(t))&&(i.state.groupStdin="")}}let w=o(),b=r===""&&i.state.groupStdin!==void 0,x=r||i.state.groupStdin||"";try{return await i.hostSpawn(t,n,{cwd:i.state.cwd,env:w,stdin:x,stdinProvided:r!==""||b||i.state.pipelineStdinProvided,redirections:i.currentRedirections})}finally{b&&Pf(t)&&(i.state.groupStdin="")}}let c=await n7(i,t,s?"/usr/bin:/bin":void 0);if(!c)return wy(t)?U(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
|
|
1436
|
+
`,127):U(`bash: ${t}: command not found
|
|
1437
|
+
`,127);if("error"in c)return c.error==="permission_denied"?U(`bash: ${t}: Permission denied
|
|
1438
|
+
`,126):U(`bash: ${t}: No such file or directory
|
|
1439
|
+
`,127);if("script"in c)return t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,c.path)),await a(c.path,n,r);let{cmd:u,path:f}=c;t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,f));let p=r===""&&i.state.groupStdin!==void 0,h=r||i.state.groupStdin||"",d=o(),m={fs:i.fs,cwd:i.state.cwd,env:i.state.env,exportedEnv:d,stdin:h,limits:i.limits,exec:i.execFn,fetch:i.fetch,getRegisteredCommands:()=>Array.from(i.commands.keys()),sleep:i.sleep,trace:i.trace,fileDescriptors:i.state.fileDescriptors,xpgEcho:i.state.shoptOptions.xpg_echo,coverage:i.coverage,signal:i.state.signal,requireDefenseContext:i.requireDefenseContext,jsBootstrapCode:i.jsBootstrapCode,invokeTool:i.invokeTool},g=Of(m,t);try{let y=()=>Rt(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,g));return u.trusted?await bt.runTrustedAsync(()=>y()):await y()}catch(y){if(y instanceof K||y instanceof de)throw y;return U(`${t}: ${ze(Ke(y))}
|
|
1440
|
+
`)}finally{p&&(u.consumesStdin||Pf(t))&&(i.state.groupStdin="")}}Wt();we();zt();async function Df(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r="",s="",i=0;try{for(let o of t){let a=await e.executeStatement(o);r+=a.stdout,s+=a.stderr,i=a.exitCode}}finally{e.state.inCondition=n}return{stdout:r,stderr:s,exitCode:i}}we();nn();function Fi(e,t,n,r){if(e instanceof gt)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"break",stdout:t,stderr:n};if(e instanceof kt)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"continue",stdout:t,stderr:n};if(e instanceof St||e instanceof pn||e instanceof _t||e instanceof Ce||e instanceof K)return e.prependOutput(t,n),{action:"rethrow",stdout:t,stderr:n,error:e};let s=Ke(e);return{action:"error",stdout:t,stderr:`${n}${s}
|
|
1441
|
+
`,exitCode:1}}we();nn();async function Ua(e,t,n="",r=""){let s=n,i=r,o=0;try{for(let a of t){let l=await e.executeStatement(a);s+=l.stdout,i+=l.stderr,o=l.exitCode}}catch(a){if(Bi(a)||a instanceof _t||a instanceof Ce||a instanceof K||a instanceof Mn)throw a.prependOutput(s,i),a;return{stdout:s,stderr:`${i}${Ke(a)}
|
|
1442
|
+
`,exitCode:1}}return{stdout:s,stderr:i,exitCode:o}}async function l7(e,t){let n=await Dn(e,t.redirections);if(n)return n;let r="",s="",i=!1,o="";for(let c of t.redirections)if((c.operator==="<<"||c.operator==="<<-")&&c.target.type==="HereDoc"){let u=c.target,f=await re(e,u.content);u.stripTabs&&(f=f.split(`
|
|
1443
|
+
`).map(p=>p.replace(/^\t+/,"")).join(`
|
|
1444
|
+
`)),o=f,i=!0}else if(c.operator==="<<<"&&c.target.type==="Word")o=`${await re(e,c.target)}
|
|
1445
|
+
`,i=!0;else if(c.operator==="<"&&c.target.type==="Word")try{let u=await re(e,c.target),f=e.fs.resolvePath(e.state.cwd,u);o=await e.fs.readFile(f),i=!0}catch{let u=await re(e,c.target);return U(`bash: ${u}: No such file or directory
|
|
1446
|
+
`)}let a=e.state.groupStdin;i&&(e.state.groupStdin=o);let l;try{for(let c of t.clauses){let u=await Df(e,c.condition);if(r+=u.stdout,s+=u.stderr,u.exitCode===0)return l=await Ua(e,c.body,r,s),Ze(e,l,t.redirections)}t.elseBody?l=await Ua(e,t.elseBody,r,s):l=H(r,s,0)}finally{i&&(e.state.groupStdin=a)}return Ze(e,l,t.redirections)}async function c7(e,t){let n=await Dn(e,t.redirections);if(n)return n;let r="",s="",i=0,o=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return U(`bash: \`${t.variable}': not a valid identifier
|
|
1447
|
+
`);let a=[];if(t.words===null)a=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)a=[];else try{for(let c of t.words){let u=await Pn(e,c);a.push(...u.values)}}catch(c){if(c instanceof Ln)return{stdout:"",stderr:c.stderr,exitCode:1};throw c}e.state.loopDepth++;try{for(let c of a){o++,o>e.limits.maxLoopIterations&&Qn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s),e.state.env.set(t.variable,c);try{for(let u of t.body){let f=await e.executeStatement(u);r+=f.stdout,s+=f.stderr,i=f.exitCode}}catch(u){let f=Fi(u,r,s,e.state.loopDepth);if(r=f.stdout,s=f.stderr,f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error"){let p=H(r,s,f.exitCode??1);return Ze(e,p,t.redirections)}throw f.error}}}finally{e.state.loopDepth--}let l=H(r,s,i);return Ze(e,l,t.redirections)}async function u7(e,t){let n=await Dn(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let s="",i="",o=0,a=0;t.init&&await se(e,t.init.expression),e.state.loopDepth++;try{for(;a++,a>e.limits.maxLoopIterations&&Qn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s,i),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await se(e,t.condition.expression)===0));){try{for(let c of t.body){let u=await e.executeStatement(c);s+=u.stdout,i+=u.stderr,o=u.exitCode}}catch(c){let u=Fi(c,s,i,e.state.loopDepth);if(s=u.stdout,i=u.stderr,u.action==="break")break;if(u.action==="continue"){t.update&&await se(e,t.update.expression);continue}if(u.action==="error"){let f=H(s,i,u.exitCode??1);return Ze(e,f,t.redirections)}throw u.error}t.update&&await se(e,t.update.expression)}}finally{e.state.loopDepth--}let l=H(s,i,o);return Ze(e,l,t.redirections)}async function f7(e,t,n=""){let r="",s="",i=0,o=0,a=n;for(let c of t.redirections)if((c.operator==="<<"||c.operator==="<<-")&&c.target.type==="HereDoc"){let u=c.target,f=await re(e,u.content);u.stripTabs&&(f=f.split(`
|
|
1448
|
+
`).map(p=>p.replace(/^\t+/,"")).join(`
|
|
1449
|
+
`)),a=f}else if(c.operator==="<<<"&&c.target.type==="Word")a=`${await re(e,c.target)}
|
|
1450
|
+
`;else if(c.operator==="<"&&c.target.type==="Word")try{let u=await re(e,c.target),f=e.fs.resolvePath(e.state.cwd,u);a=await e.fs.readFile(f)}catch{let u=await re(e,c.target);return U(`bash: ${u}: No such file or directory
|
|
1451
|
+
`)}let l=e.state.groupStdin;a&&(e.state.groupStdin=a),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&Qn(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s);let c=0,u=!1,f=!1,p=e.state.inCondition;e.state.inCondition=!0;try{for(let h of t.condition){let d=await e.executeStatement(h);r+=d.stdout,s+=d.stderr,c=d.exitCode}}catch(h){if(h instanceof gt){if(r+=h.stdout,s+=h.stderr,h.levels>1&&e.state.loopDepth>1)throw h.levels--,h.stdout=r,h.stderr=s,e.state.inCondition=p,h;u=!0}else if(h instanceof kt){if(r+=h.stdout,s+=h.stderr,h.levels>1&&e.state.loopDepth>1)throw h.levels--,h.stdout=r,h.stderr=s,e.state.inCondition=p,h;f=!0}else throw e.state.inCondition=p,h}finally{e.state.inCondition=p}if(u)break;if(!f){if(c!==0)break;try{for(let h of t.body){let d=await e.executeStatement(h);r+=d.stdout,s+=d.stderr,i=d.exitCode}}catch(h){let d=Fi(h,r,s,e.state.loopDepth);if(r=d.stdout,s=d.stderr,d.action==="break")break;if(d.action==="continue")continue;if(d.action==="error")return H(r,s,d.exitCode??1);throw d.error}}}}finally{e.state.loopDepth--,e.state.groupStdin=l}return H(r,s,i)}async function p7(e,t){let n="",r="",s=0,i=0;e.state.loopDepth++;try{for(;;){i++,i>e.limits.maxLoopIterations&&Qn(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n,r);let o=await Df(e,t.condition);if(n+=o.stdout,r+=o.stderr,o.exitCode===0)break;try{for(let a of t.body){let l=await e.executeStatement(a);n+=l.stdout,r+=l.stderr,s=l.exitCode}}catch(a){let l=Fi(a,n,r,e.state.loopDepth);if(n=l.stdout,r=l.stderr,l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return H(n,r,l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return H(n,r,s)}async function h7(e,t){let n=await Dn(e,t.redirections);if(n)return n;let r="",s="",i=0,o=await re(e,t.word),a=!1;for(let c=0;c<t.items.length;c++){let u=t.items[c],f=a;if(!a)for(let p of u.patterns){let h=await re(e,p);Pu(p)&&(h=Yt(h));let d=e.state.shoptOptions.nocasematch,m=e.state.shoptOptions.extglob;if(Ws(o,h,d,m)){f=!0;break}}if(f){let p=await Ua(e,u.body,r,s);if(r=p.stdout,s=p.stderr,i=p.exitCode,u.terminator===";;")break;u.terminator===";&"?a=!0:a=!1}else a=!1}let l=H(r,s,i);return Ze(e,l,t.redirections)}we();zt();function _f(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type!=="Literal"?!1:t.includes(n.value)}function d7(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}ft();zt();var m7="+ ";async function g7(e){let t=e.state.env.get("PS4");if(t===void 0)return m7;if(t==="")return"";try{let r=new pe().parseWordFromString(t,!1,!1);return await re(e,r)}catch{return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution
|
|
1452
|
+
`,t||m7}}function av(e){return e.map(t=>lv(t)).join(" ")}function lv(e){if(e==="")return"''";if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let n=/[\x00-\x1f\x7f]/.test(e),r=e.includes(`
|
|
1453
|
+
`),s=e.includes(" "),i=e.includes("\\"),o=e.includes("'");if(n||r||s||i){let l="";for(let c of e){let u=c.charCodeAt(0);c===`
|
|
1454
|
+
`?l+="\\n":c===" "?l+="\\t":c==="\\"?l+="\\\\":c==="'"?l+="'":c==='"'?l+='"':u<32||u===127?u<256?l+=`\\x${u.toString(16).padStart(2,"0")}`:l+=`\\u${u.toString(16).padStart(4,"0")}`:l+=c}return`$'${l}'`}return o?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function y7(e,t,n){if(!e.state.options.xtrace)return"";let r=await g7(e),s=[t,...n],i=av(s);return`${r}${i}
|
|
1455
|
+
`}async function w7(e,t,n){return e.state.options.xtrace?`${await g7(e)}${t}=${n}
|
|
1456
|
+
`:""}ye();yi();we();function cv(e){return e.type==="SimpleCommand"&&e.name===null&&e.assignments.length>0&&e.args.length===0}async function b7(e,t,n){let r=t.timed?vs():0,s="",i=ve,o=0,a=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],d=p===t.commands.length-1,m=p===0;c&&(e.state.lastArg="",m||(e.state.groupStdin=void 0));let y=c&&(!d||!e.state.shoptOptions.lastpipe&&!cv(h))?new Map(e.state.env):null,w,b=e.state.pipelineStdinProvided;e.state.pipelineStdinProvided=c&&!m;try{w=await n(h,s)}catch(x){if(x instanceof Nt){if(t.commands.length===1)throw x;w={stdout:x.stdout,stderr:x.stderr,exitCode:1}}else if(x instanceof Ce&&t.commands.length>1)w={stdout:x.stdout,stderr:x.stderr,exitCode:x.exitCode};else if(x instanceof _t&&t.commands.length>1)w={stdout:x.stdout,stderr:x.stderr,exitCode:x.exitCode};else throw y&&(e.state.env=y),x}finally{e.state.pipelineStdinProvided=b}y&&(e.state.env=y),a.push(w.exitCode),w.exitCode!==0&&(o=w.exitCode),d?i=w:(t.pipeStderr?.[p]??!1?s=un(w.stderr)+Qa(w):(s=Qa(w),l+=w.stderr),i={stdout:"",stderr:"",exitCode:w.exitCode})}if(l&&(i={...i,stderr:l+i.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand"){for(let p of e.state.env.keys())p.startsWith("PIPESTATUS_")&&e.state.env.delete(p);for(let p=0;p<a.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(a[p]));e.state.env.set("PIPESTATUS__length",String(a.length))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(vs()-r)/1e3,d=Math.floor(h/60),m=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
|
|
1457
|
+
user 0.00
|
|
1458
|
+
sys 0.00
|
|
1459
|
+
`:g=`
|
|
1460
|
+
real ${`${d}m${m.toFixed(3)}s`}
|
|
1461
|
+
user 0m0.000s
|
|
1462
|
+
sys 0m0.000s
|
|
1463
|
+
`,i={...i,stderr:i.stderr+g}}return c&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),i}Pt();ft();Wt();we();zt();bn();Tn();Er();async function x7(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await uv(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let o=s.value?await re(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:H("",`bash: ${i}: bad array subscript
|
|
1464
|
+
`,1)};let l=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let u=await mv(e,t,l[1],l[2],o,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(u.continueToNext)continue}let c=await yv(e,t,i,o,s.append,n);if(c.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:c.error};r+=c.xtraceOutput,c.continueToNext}return{continueToNext:!1,xtraceOutput:r,tempAssignments:n}}async function uv(e,t,n,r,s,i){let o="";if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:"",error:H("",`bash: ${n}: cannot assign list to array member
|
|
1465
|
+
`,1)};if(We(e,n)){let u=Xr(e,n);if(u===void 0||u==="")throw new Ce(1,"","");let f=Bt(e,n);if(f&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(f))return{continueToNext:!1,xtraceOutput:"",error:H("",`bash: ${n}: cannot assign list to array member
|
|
1466
|
+
`,1)}}if(Kn(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
|
|
1467
|
+
`,{continueToNext:!0,xtraceOutput:o};let u=Et(e,n);if(u)return{continueToNext:!1,xtraceOutput:"",error:u}}let a=e.state.associativeArrays?.has(n),l=fv(r),c=()=>{let u=`${n}_`;for(let f of e.state.env.keys())f.startsWith(u)&&!f.includes("__")&&e.state.env.delete(f);e.state.env.delete(n)};if(a&&l?await pv(e,t,n,r,s,c,u=>{o+=u}):l?await hv(e,n,r,s,c):await dv(e,n,r,s,c),t.name){i.set(n,e.state.env.get(n));let f=`(${r.map(p=>Ds(p)).join(" ")})`;e.state.env.set(n,f)}return{continueToNext:!0,xtraceOutput:o}}function fv(e){return e.some(t=>{if(t.parts.length>=2){let n=t.parts[0],r=t.parts[1];if(n.type!=="Glob"||!n.pattern.startsWith("["))return!1;if(n.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(t.parts.length<3)return!1;let s=t.parts[2];return s.type!=="Literal"?!1:s.value.startsWith("]=")||s.value.startsWith("]+=")}return r.type!=="Literal"?!1:r.value.startsWith("]")?r.value.startsWith("]=")||r.value.startsWith("]+="):n.pattern.endsWith("]")?r.value.startsWith("=")||r.value.startsWith("+="):!1}return!1})}async function pv(e,t,n,r,s,i,o){let a=[];for(let l of r){let c=Au(l);if(c){let{key:u,valueParts:f,append:p}=c,h;f.length>0?h=await re(e,{type:"Word",parts:f}):h="",h=ot(e,h),a.push({type:"keyed",key:u,value:h,append:p})}else{let u=await re(e,l);a.push({type:"invalid",expandedValue:u})}}s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=e.state.env.get(`${n}_${l.key}`)??"";e.state.env.set(`${n}_${l.key}`,c+l.value)}else e.state.env.set(`${n}_${l.key}`,l.value);else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
|
|
1468
|
+
`)}}async function hv(e,t,n,r,s){let i=[];for(let a of n){let l=Au(a);if(l){let{key:c,valueParts:u,append:f}=l,p;u.length>0?p=await re(e,{type:"Word",parts:u}):p="",p=ot(e,p),i.push({type:"keyed",indexExpr:c,value:p,append:f})}else{let c=await Pn(e,a);i.push({type:"non-keyed",values:c.values})}}r||s();let o=0;for(let a of i)if(a.type==="keyed"){let l;try{let c=new pe,u=Ne(c,a.indexExpr);l=await se(e,u.expression,!1)}catch{if(/^-?\d+$/.test(a.indexExpr))l=Number.parseInt(a.indexExpr,10);else{let c=e.state.env.get(a.indexExpr);l=c?Number.parseInt(c,10):0,Number.isNaN(l)&&(l=0)}}if(a.append){let c=e.state.env.get(`${t}_${l}`)??"";e.state.env.set(`${t}_${l}`,c+a.value)}else e.state.env.set(`${t}_${l}`,a.value);o=l+1}else for(let l of a.values)e.state.env.set(`${t}_${o++}`,l)}async function dv(e,t,n,r,s){let i=[];for(let a of n){let l=await Pn(e,a);i.push(...l.values)}let o=0;if(r){let a=ce(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(e.state.env.set(`${t}_0`,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)e.state.env.set(`${t}_${o+a}`,i[a]);r||e.state.env.set(`${t}__length`,String(i.length))}async function mv(e,t,n,r,s,i,o){let a=n;if(We(e,n)){let f=Bt(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:H("",`bash: \`${f}': not a valid identifier
|
|
1469
|
+
`,1)};a=f}}if(Kn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=Et(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await E7(e,a,r);else{let f=await gv(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=`${a}_${f.index}`}let u=i?(e.state.env.get(c)||"")+s:s;if(t.name)o.set(c,e.state.env.get(c)),e.state.env.set(c,u);else{let f=zs(e,a);if(f!==void 0&&f===e.state.callDepth&&e.state.localScopes.length>0){let p=e.state.localScopes[e.state.localScopes.length-1];p.has(c)||p.set(c,e.state.env.get(c))}e.state.env.set(c,u)}return{continueToNext:!0,xtraceOutput:""}}async function E7(e,t,n){let r;if(n.startsWith("'")&&n.endsWith("'"))r=n.slice(1,-1);else if(n.startsWith('"')&&n.endsWith('"')){let s=n.slice(1,-1),o=new pe().parseWordFromString(s,!0,!1);r=await re(e,o)}else if(n.includes("$")){let i=new pe().parseWordFromString(n,!1,!1);r=await re(e,i)}else r=n;return`${t}_${r}`}async function gv(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new pe,o=Ne(i,r);s=await se(e,o.expression,!1)}catch(i){if(i instanceof De){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
|
|
1470
|
+
`;if(i.fatal)throw new Ce(1,"",l);return{index:0,error:H("",l,1)}}let o=e.state.env.get(n);s=o?Number.parseInt(o,10):0}Number.isNaN(s)&&(s=0)}if(s<0){let i=ce(e,t);if(i.length===0){let a=e.state.currentLine;return{index:0,error:H("",`bash: line ${a}: ${t}[${n}]: bad array subscript
|
|
1471
|
+
`,1)}}if(s=Math.max(...i.map(([a])=>typeof a=="number"?a:0))+1+s,s<0){let a=e.state.currentLine;return{index:0,error:H("",`bash: line ${a}: ${t}[${n}]: bad array subscript
|
|
1472
|
+
`,1)}}}return{index:s}}async function yv(e,t,n,r,s,i){let o="",a=n,l=null;if(We(e,n)){let f=Kg(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:H("",`bash: ${n}: circular name reference
|
|
1473
|
+
`,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};a=f;let p=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);p&&(l={arrayName:p[1],subscriptExpr:p[2]},a=p[1])}if(Kn(e,a)){if(t.name)return o+=`bash: ${a}: readonly variable
|
|
1474
|
+
`,{continueToNext:!0,xtraceOutput:o};let f=Et(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Di(e,a))try{let f=new pe;if(s){let h=`(${e.state.env.get(a)||"0"}) + (${r})`,d=Ne(f,h);c=String(await se(e,d.expression))}else{let p=Ne(f,r);c=String(await se(e,p.expression))}}catch{c="0"}else{let{isArray:f}=await Promise.resolve().then(()=>(zt(),Lu)),p=f(e,a)?`${a}_0`:a;c=s?(e.state.env.get(p)||"")+r:r}c=Gs(e,a,c),o+=await w7(e,a,c);let u=a;if(l)u=await wv(e,l);else{let{isArray:f}=await Promise.resolve().then(()=>(zt(),Lu));f(e,a)&&(u=`${a}_0`)}return t.name?(i.set(u,e.state.env.get(u)),e.state.env.set(u,c)):(e.state.env.set(u,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function wv(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return E7(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new pe,a=Ne(o,r);i=await se(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=ce(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return`${n}_${i}`}ft();we();zt();nn();async function A7(e,t,n,r){let s=await Dn(e,t.redirections);if(s)return s;let i=new Map(e.state.env),o=e.state.cwd,a={...e.state.options},l=new Map(e.state.functions),c=e.state.localScopes,u=e.state.localVarStack,f=e.state.localVarDepth,p=e.state.fullyUnsetLocals;if(e.state.localScopes=c.map(v=>new Map(v)),u){e.state.localVarStack=new Map;for(let[v,P]of u.entries())e.state.localVarStack.set(v,P.map(k=>({...k})))}f&&(e.state.localVarDepth=new Map(f)),p&&(e.state.fullyUnsetLocals=new Map(p));let h=e.state.loopDepth,d=e.state.parentHasLoopContext;e.state.parentHasLoopContext=h>0,e.state.loopDepth=0;let m=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let y=n,w=!1;for(let v of t.redirections)if((v.operator==="<<"||v.operator==="<<-")&&v.target.type==="HereDoc"){let P=v.target,k=await re(e,P.content);P.stripTabs&&(k=k.split(`
|
|
1475
|
+
`).map(N=>N.replace(/^\t+/,"")).join(`
|
|
1476
|
+
`)),y=k,w=!0}else if(v.operator==="<<<"&&v.target.type==="Word")y=`${await re(e,v.target)}
|
|
1477
|
+
`,w=!0;else if(v.operator==="<"&&v.target.type==="Word")try{let P=await re(e,v.target),k=e.fs.resolvePath(e.state.cwd,P);y=await e.fs.readFile(k),w=!0}catch{let P=await re(e,v.target);return H("",`bash: ${P}: No such file or directory
|
|
1478
|
+
`,1)}let b=e.state.groupStdin;(y||w)&&(e.state.groupStdin=y);let x="",A="",C=0,$=()=>{e.state.env=i,e.state.cwd=o,e.state.options=a,e.state.functions=l,e.state.localScopes=c,e.state.localVarStack=u,e.state.localVarDepth=f,e.state.fullyUnsetLocals=p,e.state.loopDepth=h,e.state.parentHasLoopContext=d,e.state.groupStdin=b,e.state.bashPid=g,e.state.lastArg=m};try{for(let v of t.body){let P=await r(v);x+=P.stdout,A+=P.stderr,C=P.exitCode}}catch(v){if($(),v instanceof K)throw v;if(v instanceof Mn){x+=v.stdout,A+=v.stderr;let k=H(x,A,0);return Ze(e,k,t.redirections)}if(v instanceof gt||v instanceof kt){x+=v.stdout,A+=v.stderr;let k=H(x,A,0);return Ze(e,k,t.redirections)}if(v instanceof Ce){x+=v.stdout,A+=v.stderr;let k=H(x,A,v.exitCode);return Ze(e,k,t.redirections)}if(v instanceof St){x+=v.stdout,A+=v.stderr;let k=H(x,A,v.exitCode);return Ze(e,k,t.redirections)}if(v instanceof _t){let k=H(x+v.stdout,A+v.stderr,v.exitCode);return Ze(e,k,t.redirections)}let P=H(x,`${A}${Ke(v)}
|
|
1479
|
+
`,1);return Ze(e,P,t.redirections)}$();let D=H(x,A,C);return Ze(e,D,t.redirections)}async function S7(e,t,n,r){let s="",i="",o=0,a=await Oa(e,t.redirections);if(a)return a;let l=n;for(let f of t.redirections)if((f.operator==="<<"||f.operator==="<<-")&&f.target.type==="HereDoc"){let p=f.target,h=await re(e,p.content);p.stripTabs&&(h=h.split(`
|
|
1480
|
+
`).map(m=>m.replace(/^\t+/,"")).join(`
|
|
1481
|
+
`));let d=f.fd??0;d!==0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),Dt(e),e.state.fileDescriptors.set(d,h)):l=h}else if(f.operator==="<<<"&&f.target.type==="Word")l=`${await re(e,f.target)}
|
|
1482
|
+
`;else if(f.operator==="<"&&f.target.type==="Word")try{let p=await re(e,f.target),h=e.fs.resolvePath(e.state.cwd,p);l=await e.fs.readFile(h)}catch{let p=await re(e,f.target);return H("",`bash: ${p}: No such file or directory
|
|
1483
|
+
`,1)}let c=e.state.groupStdin;l&&(e.state.groupStdin=l);try{for(let f of t.body){let p=await r(f);s+=p.stdout,i+=p.stderr,o=p.exitCode}}catch(f){if(e.state.groupStdin=c,f instanceof K)throw f;if(Bi(f)||f instanceof _t||f instanceof Ce)throw f.prependOutput(s,i),f;return H(s,`${i}${Ke(f)}
|
|
1484
|
+
`,1)}e.state.groupStdin=c;let u=H(s,i,o);return Ze(e,u,t.redirections)}async function C7(e,t,n,r,s){let i;try{i=await e.fs.readFile(t)}catch{return U(`bash: ${t}: No such file or directory
|
|
1485
|
+
`,127)}if(i.startsWith("#!")){let g=i.indexOf(`
|
|
1486
|
+
`);g!==-1&&(i=i.slice(g+1))}let o=new Map(e.state.env),a=e.state.cwd,l={...e.state.options},c=e.state.loopDepth,u=e.state.parentHasLoopContext,f=e.state.lastArg,p=e.state.bashPid,h=e.state.groupStdin,d=e.state.currentSource;e.state.parentHasLoopContext=c>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,r&&(e.state.groupStdin=r),e.state.currentSource=t,e.state.env.set("0",t),e.state.env.set("#",String(n.length)),e.state.env.set("@",n.join(" ")),e.state.env.set("*",n.join(" "));for(let g=0;g<n.length&&g<9;g++)e.state.env.set(String(g+1),n[g]);for(let g=n.length+1;g<=9;g++)e.state.env.delete(String(g));let m=()=>{e.state.env=o,e.state.cwd=a,e.state.options=l,e.state.loopDepth=c,e.state.parentHasLoopContext=u,e.state.lastArg=f,e.state.bashPid=p,e.state.groupStdin=h,e.state.currentSource=d};try{let y=new pe().parse(i),w=await s(y);return m(),w}catch(g){if(m(),g instanceof Ce||g instanceof K)throw g;if(g.name==="ParseException")return U(`bash: ${t}: ${g.message}
|
|
1487
|
+
`);throw g}}function Ba(e){return e?e.parts.some(v7):!1}function v7(e){if(e.type==="CommandSubstitution")return!0;if(e.type==="DoubleQuoted")return e.parts.some(v7);if(e.type==="ParameterExpansion"){let t=e.operation;if(t&&"word"in t)return Ba(t.word);if(t&&"replacement"in t)return Ba(t.replacement)}return!1}var Li=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,execFn:t.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:t.fetch,sleep:t.sleep,trace:t.trace,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext??!1,jsBootstrapCode:t.jsBootstrapCode,invokeTool:t.invokeTool,rejectTimedPipelines:t.rejectTimedPipelines??!1,hostSpawn:t.hostSpawn,hostResolveCommand:t.hostResolveCommand,jobControl:t.jobControl}}assertDefenseContext(t){if(!this.ctx.requireDefenseContext||bt.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new de(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:bt.getCurrentExecutionId()})}buildExportedEnv(){let t=this.ctx.state.exportedVars,n=this.ctx.state.tempExportedVars,r=new Set;if(t)for(let i of t)r.add(i);if(n)for(let i of n)r.add(i);if(r.size===0)return Object.create(null);let s=Object.create(null);for(let i of r){let o=this.ctx.state.env.get(i);o!==void 0&&(s[i]=o)}return s}async executeScript(t){this.assertDefenseContext("execution");let n="",r="",s=0,i=this.ctx.limits.maxOutputSize,o=(a,l)=>{n.length+r.length+a.length+l.length>i&&Qn(`total output size exceeded (>${i} bytes), increase executionLimits.maxOutputSize`,"output_size"),n+=a,r+=l};for(let a of t.statements)try{let l=await this.executeStatement(a);o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}catch(l){if(l instanceof Ce)throw l.prependOutput(n,r),l;if(l instanceof Ft)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:It(this.ctx.state.env)};if(l instanceof pn)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:It(this.ctx.state.env)};if(l instanceof K)throw l;if(l instanceof _t)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:It(this.ctx.state.env)};if(l instanceof Ot)return o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:It(this.ctx.state.env)};if(l instanceof Nt)throw l.prependOutput(n,r),l;if(l instanceof De){if(l.message.includes("substring expression < 0"))throw l.prependOutput(n,r),l;o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof as){o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof gt||l instanceof kt){if(this.ctx.state.loopDepth>0)throw l.prependOutput(n,r),l;o(l.stdout,l.stderr);continue}throw l instanceof St&&l.prependOutput(n,r),l}return{stdout:n,stderr:r,exitCode:s,env:It(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return C7(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new ls;if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&Qn(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,"commands"),t.deferredError)throw new Ct(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return ve;if(t.background&&this.ctx.jobControl?.startBackground){let c=await this.ctx.jobControl.startBackground(t);if(c)return c}this.ctx.state.errexitSafe=!1;let n="",r="";this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&(r+=`${t.sourceText}
|
|
1488
|
+
`);let s=0,i=-1,o=!1;for(let c=0;c<t.pipelines.length;c++){let u=t.pipelines[c],f=c>0?t.operators[c-1]:null;if(f==="&&"&&s!==0||f==="||"&&s===0)continue;let p=await this.executePipeline(u);n+=p.stdout,r+=p.stderr,s=p.exitCode,i=c,o=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let a=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=a||o||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!o&&!this.ctx.state.inCondition&&!l)throw new _t(s,n,r);return H(n,r,s)}async executePipeline(t){if(t.timed&&this.ctx.rejectTimedPipelines)throw new Error("Unsupported shell syntax: timed pipelines");return b7(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return l7(this.ctx,t);case"For":return c7(this.ctx,t);case"CStyleFor":return u7(this.ctx,t);case"While":return f7(this.ctx,t,n);case"Until":return p7(this.ctx,t);case"Case":return h7(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Py(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return ve}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof Ln)return U(r.stderr);throw r}}async executeSimpleCommandInner(t,n){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let C=t,$=100;for(;$>0;){let D=this.expandAlias(C);if(D===C)break;C=D,$--}this.aliasExpansionStack.clear(),C!==t&&(t=C)}this.ctx.state.expansionStderr="";let r=await x7(this.ctx,t);if(r.error)return r.error;let s=r.tempAssignments,i=r.xtraceOutput;if(!t.name){if(t.redirections.length>0){let D=await Dn(this.ctx,t.redirections);if(D)return D;let v=H("",i,0);return Ze(this.ctx,v,t.redirections)}this.ctx.state.lastArg="";let C=(this.ctx.state.expansionStderr||"")+i;this.ctx.state.expansionStderr="";let $=t.assignments.some(D=>Ba(D.value)||D.array?.some(v=>Ba(v)));return H("",C,$?this.ctx.state.lastExitCode:0)}let o=t.name&&_f(t.name,["local","declare","typeset","export","readonly"]),a=Array.from(s.keys());if(a.length>0&&!o){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let C of a)this.ctx.state.tempExportedVars.add(C)}let l=await Oa(this.ctx,t.redirections);if(l){for(let[C,$]of s)$===void 0?this.ctx.state.env.delete(C):this.ctx.state.env.set(C,$);return l}let c=-1;for(let C of t.redirections){if((C.operator==="<<"||C.operator==="<<-")&&C.target.type==="HereDoc"){let $=C.target,D=await re(this.ctx,$.content);$.stripTabs&&(D=D.split(`
|
|
1489
|
+
`).map(P=>P.replace(/^\t+/,"")).join(`
|
|
1490
|
+
`)),D=un(D);let v=C.fd??0;v!==0?(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Dt(this.ctx),this.ctx.state.fileDescriptors.set(v,D)):n=D;continue}if(C.operator==="<<<"&&C.target.type==="Word"){n=un(`${await re(this.ctx,C.target)}
|
|
1491
|
+
`);continue}if(C.operator==="<"&&C.target.type==="Word")try{let $=await re(this.ctx,C.target),D=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);n=await fn(this.ctx.fs,D)}catch{let $=await re(this.ctx,C.target);for(let[D,v]of s)v===void 0?this.ctx.state.env.delete(D):this.ctx.state.env.set(D,v);return U(`bash: ${$}: No such file or directory
|
|
1492
|
+
`)}if(C.operator==="<&"&&C.target.type==="Word"){let $=await re(this.ctx,C.target),D=Number.parseInt($,10);if(!Number.isNaN(D)&&this.ctx.state.fileDescriptors){let v=this.ctx.state.fileDescriptors.get(D);if(v!==void 0)if(v.startsWith("__rw__:")){let P=d7(v);P&&(n=P.content.slice(P.position),c=D)}else v.startsWith("__file__:")||v.startsWith("__file_append__:")||(n=v)}}}let u=await re(this.ctx,t.name),f=[],p=[];if(_f(t.name,["local","declare","typeset","export","readonly"])&&(u==="local"||u==="declare"||u==="typeset"||u==="export"||u==="readonly"))for(let C of t.args){let $=await gy(this.ctx,C);if($)f.push($),p.push(!0);else{let D=await yy(this.ctx,C);if(D!==null)f.push(D),p.push(!0);else{let v=await Pn(this.ctx,C);for(let P of v.values)f.push(P),p.push(v.quoted)}}}else for(let C of t.args){let $=await Pn(this.ctx,C);for(let D of $.values)f.push(D),p.push($.quoted)}if(!u){if(t.name.parts.every($=>$.type==="CommandSubstitution"||$.type==="ParameterExpansion"||$.type==="ArithmeticExpansion")){if(f.length>0){let $=f.shift();return p.shift(),await this.runCommand($,f,p,n,!1,!1,c)}return H("","",this.ctx.state.lastExitCode)}return U(`bash: : command not found
|
|
1493
|
+
`,127)}if(u==="exec"&&(f.length===0||f[0]==="--")){for(let C of t.redirections){if(C.target.type==="HereDoc"||C.fdVariable)continue;let $=await re(this.ctx,C.target),D=C.fd??(C.operator==="<"||C.operator==="<>"?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),C.operator){case">":case">|":{let v=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);await this.ctx.fs.writeFile(v,"","utf8"),Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__file__:${v}`);break}case">>":{let v=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__file_append__:${v}`);break}case"<":{let v=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);try{let P=await this.ctx.fs.readFile(v);Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,P)}catch{return U(`bash: ${$}: No such file or directory
|
|
1494
|
+
`)}break}case"<>":{let v=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);try{let P=await this.ctx.fs.readFile(v);Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__rw__:${v.length}:${v}:0:${P}`)}catch{await this.ctx.fs.writeFile(v,"","utf8"),Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__rw__:${v.length}:${v}:0:`)}break}case">&":{if($==="-")this.ctx.state.fileDescriptors.delete(D);else if($.endsWith("-")){let v=$.slice(0,-1),P=Number.parseInt(v,10);if(!Number.isNaN(P)){let k=this.ctx.state.fileDescriptors.get(P);k!==void 0?this.ctx.state.fileDescriptors.set(D,k):this.ctx.state.fileDescriptors.set(D,`__dupout__:${P}`),this.ctx.state.fileDescriptors.delete(P)}}else{let v=Number.parseInt($,10);Number.isNaN(v)||(Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__dupout__:${v}`))}break}case"<&":{if($==="-")this.ctx.state.fileDescriptors.delete(D);else if($.endsWith("-")){let v=$.slice(0,-1),P=Number.parseInt(v,10);if(!Number.isNaN(P)){let k=this.ctx.state.fileDescriptors.get(P);k!==void 0?this.ctx.state.fileDescriptors.set(D,k):this.ctx.state.fileDescriptors.set(D,`__dupin__:${P}`),this.ctx.state.fileDescriptors.delete(P)}}else{let v=Number.parseInt($,10);Number.isNaN(v)||(Dt(this.ctx),this.ctx.state.fileDescriptors.set(D,`__dupin__:${v}`))}break}}}for(let[C,$]of s)$===void 0?this.ctx.state.env.delete(C):this.ctx.state.env.set(C,$);if(this.ctx.state.tempExportedVars)for(let C of s.keys())this.ctx.state.tempExportedVars.delete(C);return ve}if(this.ctx.state.extraArgs){f.push(...this.ctx.state.extraArgs);for(let C=0;C<this.ctx.state.extraArgs.length;C++)p.push(!0);this.ctx.state.extraArgs=void 0}let d=await y7(this.ctx,u,f);s.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(s)));let m=ve,g=null,y,w=this.ctx.currentRedirections;try{let C=!0;if(t.redirections.length>0){let $=await Ta(this.ctx,t.redirections);if($.error)m=U($.error),C=!1;else{y=$.targets;let D=await Ry(this.ctx,t.redirections,y);D?(m=D,C=!1):this.ctx.currentRedirections=bv(t.redirections,y)}}C&&(m=await this.runCommand(u,f,p,n,!1,!1,c))}catch(C){if(C instanceof gt||C instanceof kt)g=C,m=ve;else throw C}finally{this.ctx.currentRedirections=w}let b=i+d;if(b&&(m={...m,stderr:b+m.stderr}),m=await Ze(this.ctx,m,t.redirections,y),g)throw g;if(f.length>0){let C=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(C)){let $=C.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);$&&(C=$[1])}this.ctx.state.lastArg=C}else this.ctx.state.lastArg=u;let x=Oy(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!x)for(let[C,$]of s)this.ctx.state.fullyUnsetLocals?.has(C)||($===void 0?this.ctx.state.env.delete(C):this.ctx.state.env.set(C,$));if(this.ctx.state.tempExportedVars)for(let C of s.keys())this.ctx.state.tempExportedVars.delete(C);return s.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(m={...m,stderr:this.ctx.state.expansionStderr+m.stderr},this.ctx.state.expansionStderr=""),m}async runCommand(t,n,r,s,i=!1,o=!1,a=-1){let l={ctx:this.ctx,runCommand:(u,f,p,h,d,m,g)=>this.runCommand(u,f,p,h,d,m,g),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(u,f,p)=>this.executeUserScript(u,f,p)},c=await o7(l,t,n,r,s,i,o,a);return c!==null?c:a7(l,t,n,s,o)}aliasExpansionStack=new Set;expandAlias(t){return yu(this.ctx.state,t,this.aliasExpansionStack)}async findCommandInPath(t){return Ma(this.ctx,t)}async executeSubshell(t,n=""){return A7(this.ctx,t,n,r=>this.executeStatement(r))}async executeGroup(t,n=""){return S7(this.ctx,t,n,r=>this.executeStatement(r))}async executeArithmeticCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Dn(this.ctx,t.redirections);if(n)return n;try{let r=await se(this.ctx,t.expression.expression),s=ht(r!==0);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),Ze(this.ctx,s,t.redirections)}catch(r){let s=U(`bash: arithmetic expression: ${r.message}
|
|
1495
|
+
`);return Ze(this.ctx,s,t.redirections)}}async executeConditionalCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Dn(this.ctx,t.redirections);if(n)return n;try{let r=await Cr(this.ctx,t.expression),s=ht(r);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),Ze(this.ctx,s,t.redirections)}catch(r){let s=r instanceof De?1:2,i=U(`bash: conditional expression: ${r.message}
|
|
1496
|
+
`,s);return Ze(this.ctx,i,t.redirections)}}};function bv(e,t){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.get(r);i!==void 0&&n.push({fd:s.fd,operator:s.operator,target:i})}return n}we();var At={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function k7(e){return e?{maxCallDepth:e.maxCallDepth??At.maxCallDepth,maxCommandCount:e.maxCommandCount??At.maxCommandCount,maxLoopIterations:e.maxLoopIterations??At.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??At.maxAwkIterations,maxSedIterations:e.maxSedIterations??At.maxSedIterations,maxJqIterations:e.maxJqIterations??At.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??At.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??At.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??At.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??At.maxGlobOperations,maxStringLength:e.maxStringLength??At.maxStringLength,maxArrayElements:e.maxArrayElements??At.maxArrayElements,maxHeredocSize:e.maxHeredocSize??At.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??At.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??At.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??At.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??At.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??At.maxSourceDepth}:{...At}}I7();cn();Xs();function Ff(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function xv(e){let t=Ff(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function $7(e){if(e.includes("\\"))return!0;let t=e.toLowerCase();return t.includes("%2f")||t.includes("%5c")}function Ev(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function Lf(e,t){let n=Ff(e);if(!n)return!1;let r=xv(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&$7(n.pathname)?!1:Ev(n.pathname,r.pathPrefix)}function T7(e){return typeof e=="string"?e:e.url}function O7(e,t){return!t||t.length===0?!1:t.some(n=>Lf(e,T7(n)))}function Mf(e){let t=Av(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=R7(t);if(n)return Wa(n);let r=Cv(t);return r?vv(r):!1}function Av(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function Sv(e){if(!e)return null;let t=10,n=e;if(n.startsWith("0x")||n.startsWith("0X")?(t=16,n=n.slice(2)):n.length>1&&n.startsWith("0")&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function R7(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>Sv(l));if(n.some(l=>l===null))return null;let r=n;if(t.length===1){let l=r[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,c]=r;return l>255||c>16777215?null:[l,c>>>16&255,c>>>8&255,c&255]}if(t.length===3){let[l,c,u]=r;return l>255||c>255||u>65535?null:[l,c,u>>>8&255,u&255]}let[s,i,o,a]=r;return s>255||i>255||o>255||a>255?null:[s,i,o,a]}function Cv(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),y=R7(g);if(!y)return null;n=y,t=t.slice(0,m)}let r=t.includes("::")?t.split("::").length-1:0;if(r>1)return null;let[s,i]=t.split("::"),o=s?s.split(":").filter(Boolean):[],a=i?i.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,c=o.map(l),u=a.map(l);if(c.some(m=>m===null)||u.some(m=>m===null))return null;let f=n?2:0,p=c.length+u.length+f,h=0;if(r===1){if(h=8-p,h<0)return null}else if(p!==8)return null;let d=[...c,...new Array(h).fill(0),...u];return n&&(d.push(n[0]<<8|n[1]),d.push(n[2]<<8|n[3])),d.length===8?d:null}function Wa(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function vv(e){if(e.every(s=>s===0)||e.slice(0,7).every(s=>s===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Wa(s)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Wa(s)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let s=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return Wa(s)}return!1}function P7(e){let t=[];for(let n of e){if(typeof n!="string"&&(n===null||typeof n!="object"||!("url"in n)||typeof n.url!="string")){t.push('Invalid allow-list entry: must be a string URL or an object with a "url" string property');continue}let r=T7(n);if(!Ff(r)){t.push(`Invalid URL in allow-list: "${r}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(r);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${r}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${r}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&$7(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${r}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${r}"`)}return t}var za=null,Uf=null,D7=!1;function kv(){if(D7||(!za||!Uf))return;D7=!0;let e=za,t=Uf.lookup;function n(...r){let s=r[0],i=e.getStore();if(typeof s!="string"||!i||i.hostname.toLowerCase()!==s.toLowerCase())return t.apply(this,r);let o={},a;if(r.length===2)a=r[1];else if(r.length>=3){let c=r[1];typeof c=="number"?o={family:c}:c&&typeof c=="object"&&(o=c),a=r[2]}if(typeof a!="function")return t.apply(this,r);let l=a;if(o.family!==void 0&&o.family!==0&&o.family!==i.family){let c=new Error(`ENOTFOUND ${s}`);c.code="ENOTFOUND",c.errno=-3008,c.syscall="getaddrinfo",c.hostname=s,process.nextTick(()=>l(c));return}process.nextTick(()=>{o.all?l(null,[{address:i.address,family:i.family}]):l(null,i.address,i.family)})}Object.defineProperty(Uf,"lookup",{value:n,writable:!0,configurable:!0})}function _7(e,t){return kv(),za?za.run(e,t):t()}var _n=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},qs=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Zs=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Ha=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},Ks=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};function Nv(e){return new Promise((t,n)=>{N7(e,{all:!0},(r,s)=>{r?n(r):t(s)})})}var Iv=20,$v=3e4,Tv=10485760,Ov=["GET","HEAD"],Rv=new Set(["GET","HEAD","OPTIONS"]),Pv=new Set([301,302,303,307,308]);function Bf(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let h=P7(t);if(h.length>0)throw new Error(`Invalid network allow-list:
|
|
1497
|
+
${h.join(`
|
|
1498
|
+
`)}`)}let n=[];for(let h of t)typeof h=="object"&&h.transform&&h.transform.length>0&&n.push(h);function r(h){if(n.length===0)return null;let d=null;for(let m of n)if(Lf(h,m.url)&&m.transform){d||(d=new Headers);for(let g of m.transform)for(let[y,w]of Object.entries(g.headers))d.set(y,w)}return d}let s=e.maxRedirects??Iv,i=e.timeoutMs??$v,o=e.maxResponseSize??Tv,a=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Ov,l=e.denyPrivateRanges??(typeof process<"u"&&!0),c=e._dnsResolve??Nv;async function u(h){if(!e.dangerouslyAllowFullInternetAccess&&!O7(h,t))throw new _n(h);if(l)try{let d=new URL(h);if(Mf(d.hostname))throw new _n(h,"private/loopback IP address blocked");let m=d.hostname;if(/[a-zA-Z]/.test(m))try{let y=await c(m);for(let{address:b}of y)if(Mf(b))throw new _n(h,"hostname resolves to private/loopback IP address");let w=y[0];if(w)return{hostname:m,address:w.address,family:w.family===6?6:4}}catch(y){if(y instanceof _n)throw y;let w=y?.code;if(!(w==="ENOTFOUND"||w==="ENODATA"))throw new _n(h,"DNS resolution failed for private IP check")}}catch(d){if(d instanceof _n)throw d}return null}function f(h){if(e.dangerouslyAllowFullInternetAccess)return;let d=h.toUpperCase();if(!a.includes(d))throw new Ha(d,a)}async function p(h,d={}){let m=d.method?.toUpperCase()??"GET",g=await u(h);f(m);let y=h,w=0,b=d.followRedirects??!0,x=d.timeoutMs!==void 0?Math.min(d.timeoutMs,i):i;for(;;){let A=new AbortController,C=$r(()=>A.abort(),x);try{let $=await bt.runTrustedAsync(()=>{let D=r(y),v=Dv(d.headers,D),P={method:m,headers:v,signal:A.signal,redirect:"manual"};return d.body&&!Rv.has(m)&&(P.body=d.body),g?_7(g,()=>fetch(y,P)):fetch(y,P)});if(Pv.has($.status)&&b){let D=$.headers.get("location");if(!D)return await F7($,y,o);let v=new URL(D,y).href;try{g=await u(v)}catch{throw new Zs(v)}if(w++,w>s)throw new qs(s);y=v;continue}return await F7($,y,o)}finally{ss(C)}}}return p}function Dv(e,t){if(!e&&!t)return;if(!t)return e;let n=e instanceof Headers?new Headers(e):new Headers(e);for(let[r,s]of t)n.set(r,s);return n}async function F7(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>n)throw new Ks(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),o=[],a=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(u){if(a+=u.byteLength,a>n)throw i.cancel(),new Ks(n);o.push(u)}}s=new Uint8Array(a);let l=0;for(let c of o)s.set(c,l),l+=c.byteLength}else{let i=await e.arrayBuffer();if(n>0&&i.byteLength>n)throw new Ks(n);s=new Uint8Array(i)}return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}yr();ft();cn();function L7(e){return ns(e)}function ns(e){return e.statements.map(M7).join(`
|
|
1499
|
+
`)}function M7(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(_v(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function _v(e){let t=[];e.timed&&t.push(e.timePosix?"time -p":"time"),e.negated&&t.push("!");let n=[];for(let s=0;s<e.commands.length;s++)if(n.push(U7(e.commands[s])),s<e.commands.length-1){let i=e.pipeStderr?.[s];n.push(i?"|&":"|")}return(t.length>0?`${t.join(" ")} `:"")+n.join(" ")}function U7(e){switch(e.type){case"SimpleCommand":return Fv(e);case"If":return Gv(e);case"For":return Vv(e);case"CStyleFor":return qv(e);case"While":return Zv(e);case"Until":return Kv(e);case"Case":return Qv(e);case"Subshell":return Yv(e);case"Group":return Jv(e);case"ArithmeticCommand":return ek(e);case"ConditionalCommand":return tk(e);case"FunctionDef":return nk(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function Fv(e){let t=[];for(let n of e.assignments)t.push(Lv(n));e.name&&t.push(Ht(e.name));for(let n of e.args)t.push(Ht(n));for(let n of e.redirections)t.push(z7(n));return t.join(" ")}function Lv(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(Ht).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${Ht(e.value)}`:`${e.name}${t}`}function Ht(e){return e.parts.map(t=>ja(t,!1)).join("")}function Nr(e){return e.parts.map(t=>ja(t,!0)).join("")}function ja(e,t){switch(e.type){case"Literal":return t?Uv(e.value):Mv(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>ja(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B7(e);case"CommandSubstitution":return e.legacy?`\`${ns(e.body)}\``:`$(${ns(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${ns(e.body)})`:`>(${ns(e.body)})`;case"BraceExpansion":return Hv(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let n=e;throw new Error(`Unsupported word part type: ${n.type}`)}}}function Mv(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function Uv(e){return e.replace(/[$`"\\]/g,"\\$&")}function Bv(e,t){return e.parts.map(n=>Wv(n,t)).join("")}function Wv(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B7(e);case"CommandSubstitution":return e.legacy?`\`${ns(e.body)}\``:`$(${ns(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;default:return ja(e,!1)}}function B7(e){return e.operation?`\${${W7(e.parameter,e.operation)}}`:zv(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function zv(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function W7(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${Nr(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${Nr(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?Nr(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${Nr(t.word)}`;case"Substring":{let n=qe(t.offset.expression);return t.length?`${e}:${n}:${qe(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${Nr(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${Nr(t.replacement)}`:"";return`${e}${n}${Nr(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?Nr(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${W7(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let n=t;throw new Error(`Unsupported parameter operation type: ${n.type}`)}}}function Hv(e){return`{${e.items.map(jv).join(",")}}`}function jv(e){if(e.type==="Word")return Ht(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step!==void 0?`${t}..${n}..${e.step}`:`${t}..${n}`}function z7(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=Bv(n.content,n.quoted);return`${t}${e.operator}${r}
|
|
1500
|
+
${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${Ht(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${Ht(e.target)}`:`${t}${e.operator} ${Ht(e.target)}`}function Fn(e){return e.length===0?"":` ${e.map(z7).join(" ")}`}function xn(e){return e.map(M7).join(`
|
|
1501
|
+
`)}function Gv(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],s=n===0?"if":"elif";t.push(`${s} ${xn(r.condition)}; then
|
|
1502
|
+
${xn(r.body)}`)}return e.elseBody&&t.push(`else
|
|
1503
|
+
${xn(e.elseBody)}`),`${t.join(`
|
|
1504
|
+
`)}
|
|
1505
|
+
fi${Fn(e.redirections)}`}function Vv(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(Ht).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
|
|
1506
|
+
${xn(e.body)}
|
|
1507
|
+
done${Fn(e.redirections)}`}function qv(e){let t=e.init?qe(e.init.expression):"",n=e.condition?qe(e.condition.expression):"",r=e.update?qe(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
|
|
1508
|
+
${xn(e.body)}
|
|
1509
|
+
done${Fn(e.redirections)}`}function Zv(e){return`while ${xn(e.condition)}; do
|
|
1510
|
+
${xn(e.body)}
|
|
1511
|
+
done${Fn(e.redirections)}`}function Kv(e){return`until ${xn(e.condition)}; do
|
|
1512
|
+
${xn(e.body)}
|
|
1513
|
+
done${Fn(e.redirections)}`}function Qv(e){let t=e.items.map(Xv).join(`
|
|
1514
|
+
`);return`case ${Ht(e.word)} in
|
|
1515
|
+
${t}
|
|
1516
|
+
esac${Fn(e.redirections)}`}function Xv(e){let t=e.patterns.map(Ht).join(" | "),n=xn(e.body);return n?`${t})
|
|
1517
|
+
${n}
|
|
1518
|
+
${e.terminator}`:`${t})
|
|
1519
|
+
${e.terminator}`}function Yv(e){return`(${xn(e.body)})${Fn(e.redirections)}`}function Jv(e){return`{ ${xn(e.body)}; }${Fn(e.redirections)}`}function ek(e){return`((${qe(e.expression.expression)}))${Fn(e.redirections)}`}function tk(e){return`[[ ${ts(e.expression)} ]]${Fn(e.redirections)}`}function nk(e){let t=U7(e.body);return`${e.name}() ${t}${Fn(e.redirections)}`}function qe(e){switch(e.type){case"ArithNumber":return String(e.value);case"ArithVariable":return e.hasDollarPrefix?`$${e.name}`:e.name;case"ArithSpecialVar":return`$${e.name}`;case"ArithBinary":return`${qe(e.left)} ${e.operator} ${qe(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${qe(e.operand)}`:`${qe(e.operand)}${e.operator}`;case"ArithTernary":return`${qe(e.condition)} ? ${qe(e.consequent)} : ${qe(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${qe(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${qe(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${qe(e.target)}[${qe(e.subscript)}]`:qe(e.target)} ${e.operator} ${qe(e.value)}`;case"ArithDynamicElement":return`${qe(e.nameExpr)}[${qe(e.subscript)}]`;case"ArithGroup":return`(${qe(e.expression)})`;case"ArithNested":return`$((${qe(e.expression)}))`;case"ArithCommandSubst":return`$(${e.command})`;case"ArithBracedExpansion":return`\${${e.content}}`;case"ArithArrayElement":return e.stringKey!==void 0?`${e.array}[${e.stringKey}]`:e.index?`${e.array}[${qe(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(qe).join("");case"ArithDoubleSubscript":return`${e.array}[${qe(e.index)}]`;case"ArithNumberSubscript":return`${e.number}[${e.errorToken}]`;case"ArithSyntaxError":return e.errorToken;case"ArithSingleQuote":return`'${e.content}'`;default:{let t=e;throw new Error(`Unsupported arithmetic expression type: ${t.type}`)}}}function ts(e){switch(e.type){case"CondBinary":return`${Ht(e.left)} ${e.operator} ${Ht(e.right)}`;case"CondUnary":return`${e.operator} ${Ht(e.operand)}`;case"CondNot":return`! ${ts(e.operand)}`;case"CondAnd":return`${ts(e.left)} && ${ts(e.right)}`;case"CondOr":return`${ts(e.left)} || ${ts(e.right)}`;case"CondGroup":return`( ${ts(e.expression)} )`;case"CondWord":return Ht(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var Wf=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;invokeToolFn;transformPlugins=[];state;constructor(t={}){let n=t.fs??new sr(t.files);this.fs=n,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),s=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
|
|
1520
|
+
`],["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"],["PWD",r],["OLDPWD",r],["OPTIND","1"],...Object.entries(t.env??{})]);if(this.limits=k7({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}}),t.fetch?this.secureFetch=t.fetch:t.network&&(this.secureFetch=Bf(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth??!0,this.coverageWriter=t.coverage,this.state={env:s,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,virtualPid:t.processInfo?.pid??1,virtualPpid:t.processInfo?.ppid??0,virtualUid:t.processInfo?.uid??1e3,virtualGid:t.processInfo?.gid??1e3,bashPid:t.processInfo?.pid??1,nextVirtualPid:(t.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set(["HOME","PATH","PWD","OLDPWD",...Object.keys(t.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},this.state.env.set("SHELLOPTS",Gc(this.state.options)),this.state.env.set("BASHOPTS",Vc(this.state.shoptOptions)),G2(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&n instanceof sr)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of _2(t.commands))this.registerCommand(o);if(t.fetch||t.network)for(let o of F2())this.registerCommand(o);if(t.python)for(let o of L2())this.registerCommand(o);let i=typeof t.javascript=="object"?t.javascript:Object.create(null);if(t.javascript||i.invokeTool){for(let o of M2())this.registerCommand(o);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(t.customCommands)for(let o of t.customCommands)U2(o)?this.registerCommand(B2(o)):this.registerCommand({...o,trusted:o.trusted??!0})}registerCommand(t){this.commands.set(t.name,t);let n=this.fs;if(typeof n.writeFileSync=="function"){let r=`#!/bin/bash
|
|
1521
|
+
# Built-in command: ${t.name}
|
|
1522
|
+
`;try{n.writeFileSync(`/bin/${t.name}`,r)}catch{}try{n.writeFileSync(`/usr/bin/${t.name}`,r)}catch{}}}logResult(t){return this.logger&&(t.stdout&&this.logger.debug("stdout",{output:t.stdout}),t.stderr&&this.logger.info("stderr",{output:t.stderr}),this.logger.info("exit",{exitCode:t.exitCode})),t.stdout=j7(t.stdout),t.stderr=j7(t.stderr),t}async exec(t,n){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:"",stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
|
|
1523
|
+
`,exitCode:1,env:dn(this.state.env,n?.env)};if(!t.trim())return{stdout:"",stderr:"",exitCode:0,env:dn(this.state.env,n?.env)};this.logger?.info("exec",{command:t});let r=n?.cwd??this.state.cwd,s,i=r;if(n?.cwd)if(n.env&&"PWD"in n.env)s=n.env.PWD;else if(n?.env&&!("PWD"in n.env))try{s=await this.fs.realpath(r),i=s}catch{s=r}else s=r;let o=n?.replaceEnv?new Map:new Map(this.state.env);if(n?.env)for(let[f,p]of Object.entries(n.env))o.set(f,p);s!==void 0&&o.set("PWD",s);let a={...this.state,env:o,cwd:i,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:sk(n?.stdin,n?.stdinKind),signal:n?.signal,extraArgs:n?.args},l=t;n?.rawScript||(l=H7(t));let c=this.defenseInDepthConfig?bt.getInstance(this.defenseInDepthConfig):null,u=c?.activate();try{let f=async()=>{let p=In(l,{maxHeredocSize:this.limits.maxHeredocSize}),h;if(this.transformPlugins.length>0){let w=Object.create(null);for(let b of this.transformPlugins){let x=b.transform({ast:p,metadata:w});p=x.ast,x.metadata&&(w=Fr(w,x.metadata))}h=w}let d={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:c?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},y=await new Li(d,a).executeScript(p);return h&&(y.metadata=h),this.logResult(y)};return u?await u.run(f):await f()}catch(f){if(f instanceof Ce)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:dn(this.state.env,n?.env)});if(f instanceof Ft)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:f.exitCode,env:dn(this.state.env,n?.env)});if(f instanceof De)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:1,env:dn(this.state.env,n?.env)});if(f instanceof ls)return this.logResult({stdout:f.stdout,stderr:f.stderr,exitCode:124,env:dn(this.state.env,n?.env)});if(f instanceof K)return this.logResult({stdout:f.stdout,stderr:ze(f.stderr),exitCode:K.EXIT_CODE,env:dn(this.state.env,n?.env)});if(f instanceof de)return this.logResult({stdout:"",stderr:`bash: security violation: ${ze(f.message)}
|
|
1524
|
+
`,exitCode:1,env:dn(this.state.env,n?.env)});if(f.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${ze(f.message)}
|
|
1525
|
+
`,exitCode:2,env:dn(this.state.env,n?.env)});if(f instanceof gr)return this.logResult({stdout:"",stderr:`bash: ${ze(f.message)}
|
|
1526
|
+
`,exitCode:2,env:dn(this.state.env,n?.env)});if(f instanceof RangeError)return this.logResult({stdout:"",stderr:`bash: ${ze(f.message)}
|
|
1527
|
+
`,exitCode:1,env:dn(this.state.env,n?.env)});throw f}finally{u?.deactivate()}}async readFile(t){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,t))}async writeFile(t,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,t),n)}getCwd(){return this.state.cwd}getEnv(){return It(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){let n=H7(t),r=In(n,{maxHeredocSize:this.limits.maxHeredocSize}),s=Object.create(null);for(let i of this.transformPlugins){let o=i.transform({ast:r,metadata:s});r=o.ast,o.metadata&&(s=Fr(s,o.metadata))}return{script:L7(r),ast:r,metadata:s}}};function H7(e){let t=e.split(`
|
|
1528
|
+
`),n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(r.length>0){let l=r[r.length-1];if((l.stripTabs?i.replace(/^\t+/,""):i)===l.delimiter){n.push(i.trimStart()),r.pop();continue}n.push(i);continue}let o=i.trimStart();n.push(o);let a=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let l of o.matchAll(a)){let c=l[1]==="-",u=l[3];r.push({delimiter:u,stripTabs:c})}}return n.join(`
|
|
1529
|
+
`)}var rk=new TextDecoder("utf-8",{fatal:!0});function j7(e){if(!e)return e;let t=!1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s>255)return e;s>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);try{return rk.decode(n)}catch{return e}}function sk(e,t){if(e!==void 0)return t==="bytes"?e:un(e)}ye();var Ga=class{baseFs;mounts=new Map;constructor(t){if(this.baseFs=t?.base??new sr,t?.mounts)for(let{mountPoint:n,filesystem:r}of t.mounts)this.mount(n,r)}mount(t,n){this.validateMountPath(t);let r=ke(t);this.validateMount(r),this.mounts.set(r,{mountPoint:r,filesystem:n})}unmount(t){let n=ke(t);if(!this.mounts.has(n))throw new Error(`No filesystem mounted at '${t}'`);this.mounts.delete(n)}getMounts(){return Array.from(this.mounts.values()).map(t=>({mountPoint:t.mountPoint,filesystem:t.filesystem}))}isMountPoint(t){let n=ke(t);return this.mounts.has(n)}validateMountPath(t){let n=t.split("/");for(let r of n)if(r==="."||r==="..")throw new Error(`Invalid mount point '${t}': contains '.' or '..' segments`)}validateMount(t){if(t==="/")throw new Error("Cannot mount at root '/'");for(let n of this.mounts.keys())if(n!==t){if(t.startsWith(`${n}/`))throw new Error(`Cannot mount at '${t}': inside existing mount '${n}'`);if(n.startsWith(`${t}/`))throw new Error(`Cannot mount at '${t}': would contain existing mount '${n}'`)}}routePath(t){ut(t,"access");let n=ke(t),r=null,s=0;for(let i of this.mounts.values()){let o=i.mountPoint;if(n===o)return{fs:i.filesystem,relativePath:"/"};n.startsWith(`${o}/`)&&o.length>s&&(r=i,s=o.length)}if(r){let i=n.slice(s);return{fs:r.filesystem,relativePath:i||"/"}}return{fs:this.baseFs,relativePath:n}}getChildMountPoints(t){let n=ke(t),r=n==="/"?"/":`${n}/`,s=[];for(let i of this.mounts.keys())if(i.startsWith(r)){let a=i.slice(r.length).split("/")[0];a&&!s.includes(a)&&s.push(a)}return s}async readFile(t,n){let{fs:r,relativePath:s}=this.routePath(t);return r.readFile(s,n)}async readFileBytes(t){let{fs:n,relativePath:r}=this.routePath(t);return fn(n,r)}async readFileBuffer(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readFileBuffer(r)}async writeFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.writeFile(i,n,r)}async appendFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.appendFile(i,n,r)}async exists(t){let n=ke(t);if(this.mounts.has(n)||this.getChildMountPoints(n).length>0)return!0;let{fs:s,relativePath:i}=this.routePath(t);return s.exists(i)}async stat(t){let n=ke(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.stat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.stat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.stat(o)}async lstat(t){let n=ke(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.lstat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.lstat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.lstat(o)}async mkdir(t,n){let r=ke(t);if(this.mounts.has(r)){if(n?.recursive)return;throw new Error(`EEXIST: directory already exists, mkdir '${t}'`)}if(this.getChildMountPoints(r).length>0&&n?.recursive)return;let{fs:i,relativePath:o}=this.routePath(t);return i.mkdir(o,n)}async readdir(t){let n=ke(t),r=new Set,s=null,{fs:i,relativePath:o}=this.routePath(t);try{let l=await i.readdir(o);for(let c of l)r.add(c)}catch(l){let c=l.code,u=l.message||"";if(c!=="ENOENT"&&!u.includes("ENOENT"))throw l;s=l}let a=this.getChildMountPoints(n);for(let l of a)r.add(l);if(r.size===0&&s&&!this.mounts.has(n))throw s;return Array.from(r).sort()}async rm(t,n){let r=ke(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot remove '${t}'`);if(this.getChildMountPoints(r).length>0)throw new Error(`EBUSY: contains mount points, cannot remove '${t}'`);let{fs:i,relativePath:o}=this.routePath(t);return i.rm(o,n)}async cp(t,n,r){let s=this.routePath(t),i=this.routePath(n);return s.fs===i.fs?s.fs.cp(s.relativePath,i.relativePath,r):this.crossMountCopy(t,n,r)}async mv(t,n){let r=ke(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${t}'`);let s=this.routePath(t),i=this.routePath(n);if(s.fs===i.fs)return s.fs.mv(s.relativePath,i.relativePath);await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}resolvePath(t,n){return Zo(t,n)}getAllPaths(){let t=new Set;for(let n of this.baseFs.getAllPaths())t.add(n);for(let n of this.mounts.keys()){let r=n.split("/").filter(Boolean),s="";for(let o of r)s=`${s}/${o}`,t.add(s);let i=this.mounts.get(n);if(i)for(let o of i.filesystem.getAllPaths())o==="/"?t.add(n):t.add(`${n}${o}`)}return Array.from(t).sort()}async chmod(t,n){let r=ke(t),s=this.mounts.get(r);if(s)return s.filesystem.chmod("/",n);let{fs:i,relativePath:o}=this.routePath(t);return i.chmod(o,n)}async symlink(t,n){let{fs:r,relativePath:s}=this.routePath(n);return r.symlink(t,s)}async link(t,n){let r=this.routePath(t),s=this.routePath(n);if(r.fs!==s.fs)throw new Error(`EXDEV: cross-device link not permitted, link '${t}' -> '${n}'`);return r.fs.link(r.relativePath,s.relativePath)}async readlink(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readlink(r)}async realpath(t){let n=ke(t);if(this.mounts.get(n))return n;let{fs:s,relativePath:i}=this.routePath(t),o=await s.realpath(i);for(let[a,l]of this.mounts)if(n===a||n.startsWith(`${a}/`))return o==="/"?a:`${a}${o}`;return o}async crossMountCopy(t,n,r){let s=await this.lstat(t);if(s.isFile){let i=await this.readFileBuffer(t);await this.writeFile(n,i),await this.chmod(n,s.mode)}else if(s.isDirectory){if(!r?.recursive)throw new Error(`cp: ${t} is a directory (not copied)`);await this.mkdir(n,{recursive:!0});let i=await this.readdir(t);for(let o of i){let a=dr(t,o),l=dr(n,o);await this.crossMountCopy(a,l,r)}}else if(s.isSymbolicLink){let i=await this.readlink(t);await this.symlink(i,n)}}async utimes(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.utimes(i,n,r)}};export{Wf as Bash,sr as InMemoryFs,Ga as MountableFs,_n as NetworkAccessDeniedError,Zs as RedirectNotAllowedError,qs as TooManyRedirectsError,TA as defineCommand,IA as getCommandNames,$A as getNetworkCommandNames};
|
|
1530
|
+
/*! Bundled license information:
|
|
1531
|
+
|
|
1532
|
+
re2js/build/index.esm.js:
|
|
1533
|
+
(*!
|
|
1534
|
+
* re2js
|
|
1535
|
+
* RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
|
|
1536
|
+
*
|
|
1537
|
+
* @version v1.4.0
|
|
1538
|
+
* @author Alexey Vasiliev
|
|
1539
|
+
* @homepage https://github.com/le0pard/re2js#readme
|
|
1540
|
+
* @repository github:le0pard/re2js
|
|
1541
|
+
* @license MIT
|
|
1542
|
+
*)
|
|
1543
|
+
|
|
1544
|
+
ieee754/index.js:
|
|
1545
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
1546
|
+
*/
|