@jerryan/just-bash 3.9.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/README.md +2 -2
- package/dist/AGENTS.md +2 -2
- package/dist/abort-signals.d.ts +10 -0
- package/dist/bin/chunks/awk2-LCV2AUIX.js +3 -0
- package/dist/bin/{shell/chunks/base64-TQ5KOCNW.js → chunks/base64-OLYCF2PC.js} +1 -1
- package/dist/bin/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
- package/dist/bin/{shell/chunks/chmod-GX5SYTRL.js → chunks/chmod-V5F4BXZ2.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-V4S4A7M6.js → chunks/chunk-2TEF4USR.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-GBKR5KTT.js → chunks/chunk-3ASHUC7C.js} +13 -13
- package/dist/bin/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
- package/dist/bin/chunks/chunk-4NYJ4ZTO.js +17 -0
- package/dist/bin/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
- package/dist/bin/chunks/chunk-5NWK7A4R.js +13 -0
- package/dist/bin/{shell/chunks/chunk-YXPSX3SI.js → chunks/chunk-623Q77WZ.js} +1 -1
- package/dist/bin/chunks/chunk-6NG4ULJM.js +7 -0
- package/dist/bin/{shell/chunks/chunk-QFOXSCOD.js → chunks/chunk-726WDFMQ.js} +1 -1
- package/dist/bin/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-VTAMGD42.js → chunks/chunk-APEQNYAO.js} +1 -1
- package/dist/bin/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/chunks/chunk-BFLKIASG.js +7 -0
- package/dist/bin/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
- package/dist/bin/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
- package/dist/bin/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-GR4ZHKXI.js → chunks/chunk-C2BLJ3AE.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-KMYJMEON.js → chunks/chunk-C45GTJTD.js} +1 -1
- package/dist/bin/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
- package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
- package/dist/bin/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-E54Z6VIE.js → chunks/chunk-ERYPQAZE.js} +5 -5
- package/dist/bin/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
- package/dist/bin/chunks/chunk-HFVQCXYX.js +10 -0
- package/dist/bin/chunks/chunk-HSWCKN2X.js +14 -0
- package/dist/bin/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
- package/dist/bin/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
- package/dist/bin/chunks/chunk-IX6QY5JW.js +5 -0
- package/dist/bin/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
- package/dist/bin/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
- package/dist/bin/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
- package/dist/bin/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
- package/dist/bin/chunks/chunk-KXSDVBJA.js +12 -0
- package/dist/bin/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
- package/dist/bin/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
- package/dist/bin/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
- package/dist/bin/chunks/chunk-O3PNT72D.js +3 -0
- package/dist/bin/chunks/chunk-OGOISDGZ.js +3 -0
- package/dist/bin/chunks/chunk-OSW4MDDH.js +21 -0
- package/dist/bin/{shell/chunks/chunk-ABP4OLJV.js → chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
- package/dist/bin/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
- package/dist/bin/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6KHZX4HU.js → chunks/chunk-PLLMJHMV.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QELDDRV5.js} +1 -1
- package/dist/bin/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-H7PD6FLC.js → chunks/chunk-RE7Z53A3.js} +1 -1
- package/dist/bin/chunks/chunk-SCQRBEQW.js +275 -0
- package/dist/bin/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
- package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/{shell/chunks/chunk-QJWFCA7P.js → chunks/chunk-UU42WPB7.js} +1 -1
- package/dist/bin/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
- package/dist/bin/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/chunks/chunk-WLQ2KWS3.js +10 -0
- package/dist/bin/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
- package/dist/bin/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
- package/dist/bin/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
- package/dist/bin/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
- package/dist/bin/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
- package/dist/bin/{shell/chunks/curl-NHNZ46BU.js → chunks/curl-HZ5SBTVY.js} +11 -11
- package/dist/bin/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
- package/dist/bin/{shell/chunks/diff-DM47S5PT.js → chunks/diff-YLVT27CZ.js} +1 -1
- package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
- package/dist/bin/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
- package/dist/bin/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
- package/dist/bin/chunks/find-3QDGII35.js +3 -0
- package/dist/bin/chunks/flag-coverage-AGEO3F6X.js +3 -0
- package/dist/bin/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
- package/dist/bin/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
- package/dist/bin/{shell/chunks/head-QKVY3SIO.js → chunks/head-ABLEKDMV.js} +1 -1
- package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
- package/dist/bin/{shell/chunks/jq-YS4PR46D.js → chunks/jq-5SOTL7D7.js} +1 -1
- package/dist/bin/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
- package/dist/bin/chunks/js-exec-worker.js +1 -0
- package/dist/bin/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
- package/dist/bin/chunks/mkdir-KDEZTR53.js +3 -0
- package/dist/bin/chunks/mktemp-OYQYUB5H.js +3 -0
- package/dist/bin/{shell/chunks/mv-EOOP2TO3.js → chunks/mv-35V6IA5V.js} +1 -1
- package/dist/bin/{shell/chunks/od-2GXD4D5K.js → chunks/od-TD5LZDUM.js} +1 -1
- package/dist/bin/{shell/chunks/paste-DWWA3JTW.js → chunks/paste-QJG6BYAP.js} +1 -1
- package/dist/bin/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
- package/dist/bin/{shell/chunks/readlink-EJ3IKLWW.js → chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/chunks/rg-B2DVJQVY.js +3 -0
- package/dist/bin/chunks/rm-HCMKNRM2.js +3 -0
- package/dist/bin/{shell/chunks/rmdir-PRNISPBA.js → chunks/rmdir-WGVUYGPF.js} +1 -1
- package/dist/bin/{shell/chunks/sed-SY63U2YX.js → chunks/sed-66XZQ75T.js} +1 -1
- package/dist/bin/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
- package/dist/bin/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
- package/dist/bin/{shell/chunks/split-HIFKSV2A.js → chunks/split-OK6JHDWZ.js} +1 -1
- package/dist/bin/chunks/sqlite3-57ACN7ES.js +3 -0
- package/dist/bin/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
- package/dist/bin/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
- package/dist/bin/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
- package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/chunks/timeout-XMTXHNFF.js +3 -0
- package/dist/bin/{shell/chunks/tr-PVFO6FRY.js → chunks/tr-ETPC3LHV.js} +1 -1
- package/dist/bin/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/chunks/worker.js +5 -0
- package/dist/bin/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
- package/dist/bin/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
- package/dist/bin/chunks/yes-2EQTNSIB.js +3 -0
- package/dist/bin/chunks/yq-T6S3IDKY.js +3 -0
- package/dist/bin/just-bash.js +299 -293
- package/dist/bin/shell/chunks/awk2-LCV2AUIX.js +3 -0
- package/dist/bin/{chunks/base64-TQ5KOCNW.js → shell/chunks/base64-OLYCF2PC.js} +1 -1
- package/dist/bin/shell/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/shell/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
- package/dist/bin/{chunks/chmod-GX5SYTRL.js → shell/chunks/chmod-V5F4BXZ2.js} +1 -1
- package/dist/bin/{chunks/chunk-V4S4A7M6.js → shell/chunks/chunk-2TEF4USR.js} +1 -1
- package/dist/bin/{chunks/chunk-GBKR5KTT.js → shell/chunks/chunk-3ASHUC7C.js} +13 -13
- package/dist/bin/shell/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
- package/dist/bin/shell/chunks/chunk-4NYJ4ZTO.js +17 -0
- package/dist/bin/shell/chunks/{chunk-M3Z5NZXT.js → chunk-572NXISH.js} +1 -1
- package/dist/bin/shell/chunks/chunk-5NWK7A4R.js +13 -0
- package/dist/bin/{chunks/chunk-YXPSX3SI.js → shell/chunks/chunk-623Q77WZ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-6NG4ULJM.js +7 -0
- package/dist/bin/{chunks/chunk-QFOXSCOD.js → shell/chunks/chunk-726WDFMQ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-DRPHNXG7.js → chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-MBREBDZQ.js → chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3ROYEBJI.js → chunk-AJ3CSZ34.js} +1 -1
- package/dist/bin/{chunks/chunk-VTAMGD42.js → shell/chunks/chunk-APEQNYAO.js} +1 -1
- package/dist/bin/shell/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/shell/chunks/chunk-BFLKIASG.js +7 -0
- package/dist/bin/shell/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-T6OIISUC.js → chunk-BZJ77YQD.js} +1 -1
- package/dist/bin/{chunks/chunk-GR4ZHKXI.js → shell/chunks/chunk-C2BLJ3AE.js} +1 -1
- package/dist/bin/{chunks/chunk-KMYJMEON.js → shell/chunks/chunk-C45GTJTD.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
- package/dist/bin/{chunks/chunk-E54Z6VIE.js → shell/chunks/chunk-ERYPQAZE.js} +5 -5
- package/dist/bin/shell/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
- package/dist/bin/shell/chunks/chunk-HFVQCXYX.js +10 -0
- package/dist/bin/shell/chunks/chunk-HSWCKN2X.js +14 -0
- package/dist/bin/shell/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-IX6QY5JW.js +5 -0
- package/dist/bin/shell/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-6JEDM6CZ.js → chunk-KH6YLKPE.js} +1 -1
- package/dist/bin/shell/chunks/chunk-KXSDVBJA.js +12 -0
- package/dist/bin/shell/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-L345YZ6R.js → chunk-LVT5R45K.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PTUQEN6I.js → chunk-M345X45Z.js} +7 -7
- package/dist/bin/shell/chunks/{chunk-6FGMEZZP.js → chunk-NDS7PYKD.js} +1 -1
- package/dist/bin/shell/chunks/chunk-O3PNT72D.js +3 -0
- package/dist/bin/shell/chunks/chunk-OGOISDGZ.js +3 -0
- package/dist/bin/shell/chunks/chunk-OSW4MDDH.js +21 -0
- package/dist/bin/{chunks/chunk-ABP4OLJV.js → shell/chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-O2BCKSMK.js → chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{chunks/chunk-6KHZX4HU.js → shell/chunks/chunk-PLLMJHMV.js} +1 -1
- package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QELDDRV5.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
- package/dist/bin/{chunks/chunk-H7PD6FLC.js → shell/chunks/chunk-RE7Z53A3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-SCQRBEQW.js +275 -0
- package/dist/bin/shell/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
- package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/shell/chunks/{chunk-VPSBWWXM.js → chunk-UFAYH3WW.js} +7 -6
- package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/{chunks/chunk-QJWFCA7P.js → shell/chunks/chunk-UU42WPB7.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
- package/dist/bin/shell/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/shell/chunks/chunk-WLQ2KWS3.js +10 -0
- package/dist/bin/shell/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
- package/dist/bin/shell/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
- package/dist/bin/shell/chunks/{cp-YLP7ULVT.js → cp-XJWV46T5.js} +1 -1
- package/dist/bin/{chunks/curl-NHNZ46BU.js → shell/chunks/curl-HZ5SBTVY.js} +11 -11
- package/dist/bin/shell/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
- package/dist/bin/{chunks/diff-DM47S5PT.js → shell/chunks/diff-YLVT27CZ.js} +1 -1
- package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/shell/chunks/{du-DH76GZJ3.js → du-YNAJTGCR.js} +1 -1
- package/dist/bin/shell/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
- package/dist/bin/shell/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
- package/dist/bin/shell/chunks/find-3QDGII35.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-AGEO3F6X.js +3 -0
- package/dist/bin/shell/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-UQZL4R74.js → gzip-W5CL2E2W.js} +1 -1
- package/dist/bin/{chunks/head-QKVY3SIO.js → shell/chunks/head-ABLEKDMV.js} +1 -1
- package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
- package/dist/bin/{chunks/jq-YS4PR46D.js → shell/chunks/jq-5SOTL7D7.js} +1 -1
- package/dist/bin/shell/chunks/{js-exec-ZAAIZQWI.js → js-exec-LISDW7YC.js} +2 -2
- package/dist/bin/shell/chunks/{ls-5Z45FV4U.js → ls-EEX3YIOF.js} +1 -1
- package/dist/bin/shell/chunks/mkdir-KDEZTR53.js +3 -0
- package/dist/bin/shell/chunks/mktemp-OYQYUB5H.js +3 -0
- package/dist/bin/{chunks/mv-EOOP2TO3.js → shell/chunks/mv-35V6IA5V.js} +1 -1
- package/dist/bin/{chunks/od-2GXD4D5K.js → shell/chunks/od-TD5LZDUM.js} +1 -1
- package/dist/bin/{chunks/paste-DWWA3JTW.js → shell/chunks/paste-QJG6BYAP.js} +1 -1
- package/dist/bin/shell/chunks/{python3-TJ6DCPIA.js → python3-P6MZ44HK.js} +5 -5
- package/dist/bin/{chunks/readlink-EJ3IKLWW.js → shell/chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/shell/chunks/rg-B2DVJQVY.js +3 -0
- package/dist/bin/shell/chunks/rm-HCMKNRM2.js +3 -0
- package/dist/bin/{chunks/rmdir-PRNISPBA.js → shell/chunks/rmdir-WGVUYGPF.js} +1 -1
- package/dist/bin/{chunks/sed-SY63U2YX.js → shell/chunks/sed-66XZQ75T.js} +1 -1
- package/dist/bin/shell/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
- package/dist/bin/shell/chunks/{sleep-MOJQBZMY.js → sleep-4O22Z4DI.js} +1 -1
- package/dist/bin/{chunks/split-HIFKSV2A.js → shell/chunks/split-OK6JHDWZ.js} +1 -1
- package/dist/bin/shell/chunks/sqlite3-57ACN7ES.js +3 -0
- package/dist/bin/shell/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
- package/dist/bin/shell/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
- package/dist/bin/shell/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
- package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/shell/chunks/timeout-XMTXHNFF.js +3 -0
- package/dist/bin/{chunks/tr-PVFO6FRY.js → shell/chunks/tr-ETPC3LHV.js} +1 -1
- package/dist/bin/shell/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/shell/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
- package/dist/bin/shell/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
- package/dist/bin/shell/chunks/yes-2EQTNSIB.js +3 -0
- package/dist/bin/shell/chunks/yq-T6S3IDKY.js +3 -0
- package/dist/bin/shell/shell.js +369 -363
- package/dist/browser.d.ts +1 -1
- package/dist/bundle/browser.js +746 -726
- package/dist/bundle/chunks/awk2-TLK6FCHV.js +2 -0
- package/dist/bundle/chunks/{base64-MHVQ5XHI.js → base64-GUZMZ645.js} +1 -1
- package/dist/bundle/chunks/builtin-manifest-7MJJDZ2T.js +2 -0
- package/dist/bundle/chunks/{cat-VZBWBIJB.js → cat-LG4YGKUE.js} +1 -1
- package/dist/bundle/chunks/{chmod-TEY5MD2W.js → chmod-XUKPG2M4.js} +1 -1
- package/dist/bundle/chunks/{chunk-E2F4A3CM.js → chunk-2A4OZBCS.js} +5 -5
- package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
- package/dist/bundle/chunks/chunk-37UJACD6.js +9 -0
- package/dist/bundle/chunks/{chunk-H3A45X3W.js → chunk-3LGQ6XEC.js} +1 -1
- package/dist/bundle/chunks/{chunk-P57S6Z6R.js → chunk-3ZY5QX3G.js} +1 -1
- package/dist/bundle/chunks/{chunk-45QZRGYF.js → chunk-4VU4IF3W.js} +7 -6
- package/dist/bundle/chunks/{chunk-SIOONII3.js → chunk-52W2IWA7.js} +1 -1
- package/dist/bundle/chunks/chunk-5IB57TIJ.js +274 -0
- package/dist/bundle/chunks/chunk-5J4S2LP5.js +2 -0
- package/dist/bundle/chunks/{chunk-PCPW54JH.js → chunk-5LDRJ22P.js} +1 -1
- package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-654CJKE3.js} +1 -1
- package/dist/bundle/chunks/{chunk-EZNS4GF7.js → chunk-67ODVGSB.js} +1 -1
- package/dist/bundle/chunks/{chunk-6QF3PCMO.js → chunk-6HQQON3N.js} +1 -1
- package/dist/bundle/chunks/chunk-6L6OYVLY.js +2 -0
- package/dist/bundle/chunks/{chunk-U57DSHID.js → chunk-6P2DITXT.js} +1 -1
- package/dist/bundle/chunks/chunk-74IR77AZ.js +11 -0
- package/dist/bundle/chunks/{chunk-S3ENGQML.js → chunk-7DVD6YCI.js} +1 -1
- package/dist/bundle/chunks/{chunk-HXWB4Z5X.js → chunk-7II7XIVI.js} +1 -1
- package/dist/bundle/chunks/{chunk-AYSZ5MAE.js → chunk-A3C4Z3Q3.js} +1 -1
- package/dist/bundle/chunks/chunk-A6SU3BZX.js +6 -0
- package/dist/bundle/chunks/{chunk-6HO6HX7V.js → chunk-AMXNXHXK.js} +1 -1
- package/dist/bundle/chunks/{chunk-QJ7OXJAZ.js → chunk-BLG7RWH4.js} +1 -1
- package/dist/bundle/chunks/chunk-BMBITA6Y.js +2 -0
- package/dist/bundle/chunks/{chunk-XQ2ZZFO6.js → chunk-BQTWRHZR.js} +2 -2
- package/dist/bundle/chunks/{chunk-WE7BJ7YU.js → chunk-BZ2OMW2T.js} +1 -1
- package/dist/bundle/chunks/{chunk-S6DNKKUL.js → chunk-CM4T4GB4.js} +1 -1
- package/dist/bundle/chunks/{chunk-CH7SUFFO.js → chunk-CORCIYJD.js} +1 -1
- package/dist/bundle/chunks/{chunk-LGIJSCWH.js → chunk-EQDVNHQS.js} +1 -1
- package/dist/bundle/chunks/{chunk-U4K5ZDWK.js → chunk-EZEO6MFE.js} +1 -1
- package/dist/bundle/chunks/{chunk-SE23TEGG.js → chunk-EZT6M2HG.js} +1 -1
- package/dist/bundle/chunks/{chunk-4MJ7VJG4.js → chunk-H7UVJSZR.js} +1 -1
- package/dist/bundle/chunks/{chunk-5EI7WSRV.js → chunk-HYQGYXGZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-IPKSYZ3R.js} +1 -1
- package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-KJBPGFZD.js} +1 -1
- package/dist/bundle/chunks/chunk-L7NEGEOJ.js +16 -0
- package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-MJEJ7QEY.js} +1 -1
- package/dist/bundle/chunks/{chunk-QJFYYEFV.js → chunk-N36I27VM.js} +1 -1
- package/dist/bundle/chunks/chunk-N5L7E4EL.js +6 -0
- package/dist/bundle/chunks/{chunk-6QAM55HM.js → chunk-NFODJFHN.js} +1 -1
- package/dist/bundle/chunks/{chunk-IXFQXNL4.js → chunk-NFW4YKDO.js} +1 -1
- package/dist/bundle/chunks/{chunk-HCKTU6IR.js → chunk-NOX3PCUH.js} +1 -1
- package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
- package/dist/bundle/chunks/{chunk-4KZT23KR.js → chunk-O5BHWBYH.js} +1 -1
- package/dist/bundle/chunks/{chunk-DVSA72LH.js → chunk-QTL2XC4B.js} +1 -1
- package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
- package/dist/bundle/chunks/{chunk-BLPYR4TN.js → chunk-RVBBGZ22.js} +1 -1
- package/dist/bundle/chunks/{chunk-PS2RJNZZ.js → chunk-SXQJYLP7.js} +1 -1
- package/dist/bundle/chunks/{chunk-MWL2I5BV.js → chunk-T7OAZEXT.js} +1 -1
- package/dist/bundle/chunks/{chunk-O452S4KX.js → chunk-URIKBXSE.js} +1 -1
- package/dist/bundle/chunks/{chunk-6BSOPPZH.js → chunk-UVQC75LS.js} +7 -7
- package/dist/bundle/chunks/chunk-VCREDMWH.js +4 -0
- package/dist/bundle/chunks/{chunk-DDPD7SIB.js → chunk-VQ6EUBJ3.js} +1 -1
- package/dist/bundle/chunks/chunk-VQEB6E2M.js +13 -0
- package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
- package/dist/bundle/chunks/{chunk-XXBIOG4R.js → chunk-WDY2TNMK.js} +1 -1
- package/dist/bundle/chunks/chunk-XT7EK6BR.js +9 -0
- package/dist/bundle/chunks/{chunk-BS6EJR2R.js → chunk-XUTEQMTL.js} +5 -5
- package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
- package/dist/bundle/chunks/{chunk-FSKXIFYT.js → chunk-Y6UHNLT5.js} +1 -1
- package/dist/bundle/chunks/chunk-YUITEK6N.js +12 -0
- package/dist/bundle/chunks/chunk-YZCPEJRE.js +20 -0
- package/dist/bundle/chunks/chunk-ZIQS5QAW.js +5 -0
- package/dist/bundle/chunks/chunk-ZUEPJPYA.js +2 -0
- package/dist/bundle/chunks/{column-QJI65SH2.js → column-T4LGMRJG.js} +1 -1
- package/dist/bundle/chunks/{cp-UR762VVT.js → cp-ZDDVNITX.js} +1 -1
- package/dist/bundle/chunks/{curl-K4WT7UPN.js → curl-RCRD36LD.js} +11 -11
- package/dist/bundle/chunks/{cut-FMDNVWQN.js → cut-35WER2E2.js} +1 -1
- package/dist/bundle/chunks/{diff-R7TXVVLN.js → diff-Z3XOLW44.js} +1 -1
- package/dist/bundle/chunks/{du-EQKH3UNA.js → du-YBSJVBXP.js} +1 -1
- package/dist/bundle/chunks/{expr-A5XITHQD.js → expr-KSNRNE7V.js} +1 -1
- package/dist/bundle/chunks/{file-6AYYTULJ.js → file-XH37HMGV.js} +1 -1
- package/dist/bundle/chunks/find-3AONTPPM.js +2 -0
- package/dist/bundle/chunks/flag-coverage-6YGO7STE.js +2 -0
- package/dist/bundle/chunks/{grep-Q2O5EIXQ.js → grep-WW5KJPUG.js} +1 -1
- package/dist/bundle/chunks/{gzip-KC5ENBD2.js → gzip-ISZXQNJJ.js} +1 -1
- package/dist/bundle/chunks/{head-6UIPFWVJ.js → head-VYXZQLPZ.js} +1 -1
- package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-PE6BPRPA.js → html-to-markdown-4LXS3A44.js} +1 -1
- package/dist/bundle/chunks/{jq-UKAA3QWU.js → jq-3IVOWP3G.js} +1 -1
- package/dist/bundle/chunks/{js-exec-MUZRDUJ3.js → js-exec-T2WEE4KG.js} +2 -2
- package/dist/bundle/chunks/js-exec-worker.js +1 -0
- package/dist/bundle/chunks/{ls-WH5S4PPL.js → ls-FC3CSHKE.js} +1 -1
- package/dist/bundle/chunks/mkdir-DPFWDY25.js +2 -0
- package/dist/bundle/chunks/mktemp-SW2AHXZW.js +2 -0
- package/dist/bundle/chunks/{mv-WE7DBLEK.js → mv-PWCFXEF2.js} +1 -1
- package/dist/bundle/chunks/{od-Z4AIL3P4.js → od-VJ6PBBEI.js} +1 -1
- package/dist/bundle/chunks/{paste-ZNHNSRBW.js → paste-TIQETHSO.js} +1 -1
- package/dist/bundle/chunks/{python3-W4UMQJAQ.js → python3-6JEP7ZZK.js} +5 -5
- package/dist/bundle/chunks/{readlink-JSRKXLLQ.js → readlink-7XGQ3PL7.js} +1 -1
- package/dist/bundle/chunks/rg-2OPJ5V3D.js +2 -0
- package/dist/bundle/chunks/rm-AZZM5DCE.js +2 -0
- package/dist/bundle/chunks/{rmdir-3WTXMVKI.js → rmdir-YXYSZD4X.js} +1 -1
- package/dist/bundle/chunks/{sed-6G32B25J.js → sed-HYSBLGO5.js} +1 -1
- package/dist/bundle/chunks/{seq-B6KDLMYQ.js → seq-M2S4FRN4.js} +1 -1
- package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-YC4HFEGC.js} +1 -1
- package/dist/bundle/chunks/{split-HUKVGJTW.js → split-UOPIWKKE.js} +1 -1
- package/dist/bundle/chunks/sqlite3-XCROTL6G.js +2 -0
- package/dist/bundle/chunks/{stat-LXFZND2P.js → stat-I3FPUTR7.js} +1 -1
- package/dist/bundle/chunks/{tail-UBGSN4JF.js → tail-WK3WACZK.js} +1 -1
- package/dist/bundle/chunks/{tar-LE7LAAIX.js → tar-VZYMNZV2.js} +1 -1
- package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
- package/dist/bundle/chunks/timeout-UDR5J2MP.js +2 -0
- package/dist/bundle/chunks/{tr-UI2LA3GA.js → tr-VI5PIA4A.js} +1 -1
- package/dist/bundle/chunks/{which-UWVKETYW.js → which-BP5YY5BR.js} +1 -1
- package/dist/bundle/chunks/worker.js +5 -0
- package/dist/bundle/chunks/{xan-UIL24CGT.js → xan-DL576EIT.js} +1 -1
- package/dist/bundle/chunks/xan-view-GJVN6IHX.js +2 -0
- package/dist/bundle/chunks/yes-OVJMX6NM.js +2 -0
- package/dist/bundle/chunks/yq-KYPU4LQP.js +2 -0
- package/dist/bundle/index.cjs +1079 -1059
- package/dist/bundle/index.js +345 -339
- package/dist/commands/mktemp/mktemp.d.ts +4 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/which/which.d.ts +10 -0
- package/dist/commands/yes/yes.d.ts +4 -0
- package/dist/custom-commands.d.ts +12 -0
- package/dist/fs/create-exclusive.d.ts +30 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
- package/dist/fs/interface.d.ts +37 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +18 -1
- package/dist/fs/overlay-fs/overlay-fs.d.ts +19 -1
- package/dist/fs/path-utils.d.ts +0 -4
- package/dist/fs/read-write-fs/read-write-fs.d.ts +22 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
- package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
- package/dist/interpreter/expansion/variable.d.ts +1 -1
- package/dist/interpreter/helpers/loop.d.ts +32 -0
- package/dist/limits.d.ts +0 -3
- package/dist/network/dns-pin.d.ts +1 -32
- package/dist/network/fetch.d.ts +1 -1
- package/dist/security/trusted-globals.d.ts +8 -0
- package/dist/types.d.ts +6 -0
- package/package.json +3 -4
- package/dist/bin/chunks/awk2-NTRVFXRA.js +0 -3
- package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/chunks/chunk-BB5VTPMQ.js +0 -16
- package/dist/bin/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/chunks/chunk-F2PYTUMR.js +0 -9
- package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/chunks/chunk-I57EACSL.js +0 -3
- package/dist/bin/chunks/chunk-ONF4KUYV.js +0 -13
- package/dist/bin/chunks/chunk-PRVPFKTC.js +0 -276
- package/dist/bin/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bin/chunks/chunk-U5JLGI56.js +0 -21
- package/dist/bin/chunks/dist-5MWO25Y4.js +0 -141
- package/dist/bin/chunks/find-MHC4QV6H.js +0 -3
- package/dist/bin/chunks/flag-coverage-LLAQBVIG.js +0 -3
- package/dist/bin/chunks/mkdir-YJ3SOVRP.js +0 -3
- package/dist/bin/chunks/rg-WHVR3YDT.js +0 -3
- package/dist/bin/chunks/rm-B4LVIG7A.js +0 -3
- package/dist/bin/chunks/sqlite3-CXQTZRPZ.js +0 -3
- package/dist/bin/chunks/timeout-RQOWSWYG.js +0 -3
- package/dist/bin/chunks/yq-CWBZMGUV.js +0 -3
- package/dist/bin/shell/chunks/awk2-NTRVFXRA.js +0 -3
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/shell/chunks/chunk-BB5VTPMQ.js +0 -16
- package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +0 -9
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/shell/chunks/chunk-I57EACSL.js +0 -3
- package/dist/bin/shell/chunks/chunk-ONF4KUYV.js +0 -13
- package/dist/bin/shell/chunks/chunk-PRVPFKTC.js +0 -276
- package/dist/bin/shell/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bin/shell/chunks/chunk-U5JLGI56.js +0 -21
- package/dist/bin/shell/chunks/dist-5MWO25Y4.js +0 -141
- package/dist/bin/shell/chunks/find-MHC4QV6H.js +0 -3
- package/dist/bin/shell/chunks/flag-coverage-LLAQBVIG.js +0 -3
- package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +0 -3
- package/dist/bin/shell/chunks/rg-WHVR3YDT.js +0 -3
- package/dist/bin/shell/chunks/rm-B4LVIG7A.js +0 -3
- package/dist/bin/shell/chunks/sqlite3-CXQTZRPZ.js +0 -3
- package/dist/bin/shell/chunks/timeout-RQOWSWYG.js +0 -3
- package/dist/bin/shell/chunks/yq-CWBZMGUV.js +0 -3
- package/dist/bundle/chunks/awk2-VS5QVYHU.js +0 -2
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +0 -3
- package/dist/bundle/chunks/chunk-35MBA3VY.js +0 -12
- package/dist/bundle/chunks/chunk-3OBCZP7T.js +0 -12
- package/dist/bundle/chunks/chunk-4CC3OZPU.js +0 -2
- package/dist/bundle/chunks/chunk-A257L6QO.js +0 -7
- package/dist/bundle/chunks/chunk-ATGOUOX2.js +0 -15
- package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
- package/dist/bundle/chunks/chunk-FTET43KM.js +0 -2
- package/dist/bundle/chunks/chunk-GRUZ4SBY.js +0 -275
- package/dist/bundle/chunks/chunk-LRFR25IP.js +0 -8
- package/dist/bundle/chunks/chunk-RWQWFXMH.js +0 -10
- package/dist/bundle/chunks/chunk-Y6JBSHCM.js +0 -20
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
- package/dist/bundle/chunks/find-RLKBCGJR.js +0 -2
- package/dist/bundle/chunks/flag-coverage-YQGACUSN.js +0 -2
- package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +0 -2
- package/dist/bundle/chunks/rg-JKB7DR66.js +0 -2
- package/dist/bundle/chunks/rm-IGPLE632.js +0 -2
- package/dist/bundle/chunks/sqlite3-DQNCWDG5.js +0 -2
- package/dist/bundle/chunks/timeout-37GM7IIL.js +0 -2
- package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +0 -2
- package/dist/bundle/chunks/yq-ZRNZKDLE.js +0 -2
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-BB5VTPMQ.js";import"./chunk-BIJXTWZ4.js";import"./chunk-IOKQFPM6.js";import"./chunk-3MRB66F4.js";import"./chunk-K27FY3ES.js";import"./chunk-YXPSX3SI.js";import"./chunk-YERKK5B3.js";import"./chunk-I57EACSL.js";import"./chunk-MBREBDZQ.js";import"./chunk-HWK7KFGB.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as findCommand,b as flagsForFuzzing};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as yr}from"./chunk-M3Z5NZXT.js";import{b as Ar}from"./chunk-PRVPFKTC.js";import{b as $r}from"./chunk-ANX7U57Q.js";import"./chunk-V4U26ZWL.js";import"./chunk-KP2UH5CJ.js";import{c as Sr}from"./chunk-6JEDM6CZ.js";import"./chunk-3DWQCLNP.js";import{b as wr}from"./chunk-PQ2INDRF.js";import{b as xr}from"./chunk-DYIBFLS3.js";import{b as vr}from"./chunk-RVPTAYDS.js";import{b as kr}from"./chunk-TYBXHT6W.js";import{b as qr}from"./chunk-AJF3OBTR.js";import{b as Cr}from"./chunk-2ETT4ELS.js";import{b as br}from"./chunk-OUQKFRVR.js";import{d as Ir,e as Mr,f as jr}from"./chunk-QJWFCA7P.js";import"./chunk-QES5OSUC.js";import{b as tr}from"./chunk-6TUILMPB.js";import{b as lr}from"./chunk-CC2AQ6B7.js";import{b as ur}from"./chunk-QMPZXXEK.js";import{b as pr}from"./chunk-CNVNOT67.js";import{b as er}from"./chunk-LXFMIXGA.js";import{b as dr}from"./chunk-WFVCEB5T.js";import{b as cr}from"./chunk-KG2KXL4Y.js";import"./chunk-2YLY6FJA.js";import{b as hr}from"./chunk-H7PD6FLC.js";import{c as or,d as ar}from"./chunk-KI54R2QB.js";import{b as sr}from"./chunk-KUMHQGUR.js";import{c as ir,d as gr}from"./chunk-MYTNZ7MA.js";import{b as mr}from"./chunk-V4S4A7M6.js";import"./chunk-ONF4KUYV.js";import{b as Fr}from"./chunk-FPWHWWXO.js";import{b as zr}from"./chunk-GBKR5KTT.js";import{b as fr}from"./chunk-LJQIAFWS.js";import{b as nr}from"./chunk-L345YZ6R.js";import"./chunk-B2DRBHGQ.js";import{b as R}from"./chunk-YJ5OCPSK.js";import{b as U}from"./chunk-Q2GOPGDA.js";import{b as V}from"./chunk-PXP4YYZA.js";import{b as W}from"./chunk-DRPHNXG7.js";import{c as X,d as Y}from"./chunk-YUZRUF5F.js";import{c as Z,d as _}from"./chunk-DJAX3ZRG.js";import{b as N}from"./chunk-PZQVSQX6.js";import{b as rr}from"./chunk-SDGPS6XI.js";import{b as G}from"./chunk-SC5TEGMM.js";import{b as H}from"./chunk-5SKEZPTU.js";import{b as J}from"./chunk-OYXHOZZ4.js";import{b as K}from"./chunk-KMYJMEON.js";import{b as L}from"./chunk-N26Y42L6.js";import{b as O}from"./chunk-4JF56A3P.js";import{b as P}from"./chunk-AGKL4LDL.js";import{b as Q}from"./chunk-BB5VTPMQ.js";import{b as y}from"./chunk-FHMIEBRM.js";import{b as A}from"./chunk-7FGDUBSN.js";import{b as $}from"./chunk-GOWX7VPU.js";import{b as S}from"./chunk-B6WWC6K3.js";import{b as T}from"./chunk-MVBK66TR.js";import{b as B}from"./chunk-YIANER7Y.js";import{b as D}from"./chunk-HDWHYM2T.js";import{b as E}from"./chunk-Q3LE3Y66.js";import{b as w}from"./chunk-3FQBUEB6.js";import{b as x}from"./chunk-45DUHCXR.js";import{b as v}from"./chunk-HZGHQZSY.js";import"./chunk-BIJXTWZ4.js";import{d as k,e as q,f as C}from"./chunk-U5JLGI56.js";import"./chunk-IOKQFPM6.js";import{b}from"./chunk-VPSBWWXM.js";import"./chunk-47IFMQYS.js";import"./chunk-3MRB66F4.js";import"./chunk-QFOXSCOD.js";import{b as I}from"./chunk-PTUQEN6I.js";import{b as M}from"./chunk-ZVG47PYA.js";import{b as j}from"./chunk-FONAGXRJ.js";import{b as t}from"./chunk-F2PYTUMR.js";import{b as l}from"./chunk-6JUPBMCR.js";import{b as u}from"./chunk-RTN6X652.js";import{b as p}from"./chunk-KNTDFP7X.js";import{b as e}from"./chunk-T6OIISUC.js";import{b as d}from"./chunk-G4AUMZUY.js";import{b as c}from"./chunk-ABP4OLJV.js";import{b as h}from"./chunk-VTAMGD42.js";import"./chunk-6KHZX4HU.js";import"./chunk-3PCPQIUD.js";import"./chunk-TW2IJRUF.js";import"./chunk-QKJAAJ7J.js";import"./chunk-K27FY3ES.js";import"./chunk-MROECM42.js";import"./chunk-42AMF6EE.js";import"./chunk-YXPSX3SI.js";import{b as i}from"./chunk-CMTQFWZK.js";import{b as g}from"./chunk-NXUXZWS5.js";import"./chunk-2UV6ZFHK.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import{b as m}from"./chunk-WAJVRK5B.js";import"./chunk-HW2VJKFH.js";import"./chunk-YERKK5B3.js";import{b as F}from"./chunk-6FGMEZZP.js";import"./chunk-I57EACSL.js";import"./chunk-7JZKVC3F.js";import{b as z}from"./chunk-CN4JKMTR.js";import{b as f}from"./chunk-3ROYEBJI.js";import"./chunk-MBREBDZQ.js";import"./chunk-HWK7KFGB.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-NE4R2FVV.js";import{b as n}from"./chunk-QL33F2W6.js";import"./chunk-I4IRHQDW.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-CN4JKMTR.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-NE4R2FVV.js";import"./chunk-I4IRHQDW.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{b as flagsForFuzzing,a as mkdirCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-VPSBWWXM.js";import"./chunk-47IFMQYS.js";import"./chunk-3MRB66F4.js";import"./chunk-QFOXSCOD.js";import"./chunk-YXPSX3SI.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-I57EACSL.js";import"./chunk-MBREBDZQ.js";import"./chunk-HWK7KFGB.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{b as flagsForFuzzing,a as rgCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-F2PYTUMR.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-NE4R2FVV.js";import"./chunk-I4IRHQDW.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{b as flagsForFuzzing,a as rmCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b,c}from"./chunk-6JEDM6CZ.js";import"./chunk-3DWQCLNP.js";import"./chunk-QKJAAJ7J.js";import"./chunk-42AMF6EE.js";import"./chunk-HWI42GQO.js";import"./chunk-MBREBDZQ.js";import"./chunk-HWK7KFGB.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-I4IRHQDW.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-6TUILMPB.js";import"./chunk-B2DRBHGQ.js";import"./chunk-3MRB66F4.js";import"./chunk-3PCPQIUD.js";import"./chunk-QKJAAJ7J.js";import"./chunk-HWI42GQO.js";import"./chunk-CPKBPQ2C.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{b as flagsForFuzzing,a as timeoutCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-PRVPFKTC.js";import"./chunk-KP2UH5CJ.js";import"./chunk-ONF4KUYV.js";import"./chunk-47IFMQYS.js";import"./chunk-MROECM42.js";import"./chunk-42AMF6EE.js";import"./chunk-YXPSX3SI.js";import"./chunk-HWI42GQO.js";import"./chunk-YERKK5B3.js";import"./chunk-I57EACSL.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{b as flagsForFuzzing,a as yqCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-ZVG47PYA.js";import"./chunk-MROECM42.js";import"./chunk-42AMF6EE.js";import"./chunk-YXPSX3SI.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-YERKK5B3.js";import"./chunk-I57EACSL.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as awkCommand2,b as flagsForFuzzing};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
function i(...s){let e=[...new Set(s.filter(n=>n!==void 0))];if(e.length===0)return{signal:void 0,cleanup(){}};if(e.length===1)return{signal:e[0],cleanup(){}};let r=new AbortController,o=[];for(let n of e){if(n.aborted){r.abort(n.reason);break}let t=()=>r.abort(n.reason);n.addEventListener("abort",t,{once:!0}),o.push([n,t])}return{signal:r.signal,cleanup(){for(let[n,t]of o)n.removeEventListener("abort",t)}}}export{i as a};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as P,c as O,d as T,e as k}from"./chunk-MBREBDZQ.js";import{f as F}from"./chunk-HWK7KFGB.js";import{l as v,m as w}from"./chunk-FUT3X2GJ.js";import{c as S}from"./chunk-OHFB3M3X.js";import{a as E}from"./chunk-NE4R2FVV.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as $,b as C}from"./chunk-MUFNRCMY.js";var H={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"]},I={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"}},q={name:"cp",async execute(u,e){if(C(u))return $(H);let s=E("cp",u,I);if(!s.ok)return s.error;let d=s.result.flags.recursive||s.result.flags.recursiveUpper,A=s.result.flags.noClobber,N=s.result.flags.preserve,R=s.result.flags.verbose,p=s.result.positional;if(p.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
4
|
-
`,exitCode:1};let m=p.pop()??"",g=p,l=e.fs.resolvePath(e.cwd,m),y="",n="",i=0,h=new T({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp"}),f=!1;try{f=(await e.fs.stat(l)).isDirectory}catch{}if(g.length>1&&!f)return{stdout:"",stderr:`cp: target '${m}' is not a directory
|
|
5
|
-
`,exitCode:1};for(let t of g)try{let o=e.fs.resolvePath(e.cwd,t),a=await e.fs.stat(o),r=l;if(f){let c=t.split("/").pop()||t;r=l==="/"?`/${c}`:`${l}/${c}`}if(a.isDirectory&&!d){n+=`cp: -r not specified; omitting directory '${t}'
|
|
6
|
-
`,i=1;continue}if(a.isDirectory){let c=await O(e.fs,o,r,h);if(F(o,r)||c==="inside"){n+=`cp: cannot copy '${t}' into itself, '${r}'
|
|
7
|
-
`,i=1;continue}if(c==="unknown"){n+=`cp: cannot safely determine whether '${r}' is inside '${t}'
|
|
8
|
-
`,i=1;continue}}if(A)try{await e.fs.stat(r);continue}catch{}let b=await P(e.fs,o,r);if(b==="same"){n+=`cp: '${t}' and '${r}' are the same file
|
|
9
|
-
`,i=1;continue}if(b==="unknown"){n+=`cp: cannot safely determine whether '${t}' and '${r}' are the same file
|
|
10
|
-
`,i=1;continue}a.isDirectory&&await k({fs:e.fs,root:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await e.fs.cp(o,r,{recursive:d}),R&&(y+=`'${t}' -> '${r}'
|
|
11
|
-
`)}catch(o){if(o instanceof v||o instanceof w)throw o;let a=D(o);S(o,"ENOENT")?n+=`cp: cannot stat '${t}': No such file or directory
|
|
12
|
-
`:n+=`cp: cannot copy '${t}': ${a}
|
|
13
|
-
`,i=1}return{stdout:y,stderr:n,exitCode:i}}},J={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};export{q as a,J as b};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as we}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-IOKQFPM6.js";import{a as le}from"./chunk-3MRB66F4.js";import{a as be}from"./chunk-K27FY3ES.js";import{a as ae}from"./chunk-YXPSX3SI.js";import{b as ue,c as de,d as he}from"./chunk-YERKK5B3.js";import{d as ge}from"./chunk-MBREBDZQ.js";import{l as ie}from"./chunk-FUT3X2GJ.js";import{a as re}from"./chunk-CPKBPQ2C.js";import{a as me,b as ye}from"./chunk-MUFNRCMY.js";function z(e,t){switch(e.type){case"name":{let n=e.pattern,s=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let a=s[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,s=t.relativePath,a=n.split("/");for(let u=0;u<a.length-1;u++){let r=a[u];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let i=`/${r}/`;if(e.ignoreCase){if(!s.toLowerCase().includes(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.includes(i))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let u=o[1];if(e.ignoreCase){if(!s.toLowerCase().endsWith(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.endsWith(u))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(s,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:ae(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 s=(Date.now()-t.mtime)/(1e3*60*60*24),a;return e.comparison==="more"?a=s>e.days:e.comparison==="less"?a=s<e.days:a=Math.floor(s)===e.days,{matches:a,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 s;return e.comparison==="more"?s=t.size>n:e.comparison==="less"?s=t.size<n:e.unit==="b"?s=Math.ceil(t.size/512)===e.value:s=t.size===n,{matches:s,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,s=e.mode&511,a;return e.matchType==="exact"?a=n===s:e.matchType==="all"?a=(n&s)===s:a=(n&s)!==0,{matches:a,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let n=z(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=z(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let s=z(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:n.printed||s.printed,actions:[...n.actions??[],...s.actions??[]]}}case"or":{let n=z(e.left,t);if(n.matches)return n;let s=z(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:s.printed,actions:[...n.actions??[],...s.actions??[]]}}}}function Z(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!1;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return Z(e.expr);case"and":case"or":return Z(e.left)||Z(e.right)}}function J(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return J(e.expr);case"and":case"or":return J(e.left)||J(e.right);default:return!1}}function Se(e){let t=[],n=s=>{s&&(s.type==="newer"?t.push(s.refPath):s.type==="not"?n(s.expr):(s.type==="and"||s.type==="or")&&(n(s.left),n(s.right)))};return n(e),t}function V(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return V(e.expr);case"and":case"or":return V(e.left)&&V(e.right)}}function B(e,t,n,s,a){switch(e.type){case"name":{let o=e.pattern,u=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(u){let r=u[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,u=o.split("/");for(let i=0;i<u.length-1;i++){let l=u[i];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let p=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let i=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:ae(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:s,pruned:!1,printed:!1}:e.fileType==="d"?{matches:a,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let o=B(e.expr,t,n,s,a);return{matches:!o.matches,pruned:o.pruned,printed:!1,actions:o.actions}}case"and":{let o=B(e.left,t,n,s,a);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1,actions:o.actions};let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:o.printed||u.printed,actions:[...o.actions??[],...u.actions??[]]}}case"or":{let o=B(e.left,t,n,s,a);if(o.matches)return o;let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:u.printed,actions:[...o.actions??[],...u.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function _(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right);default:return!1}}function L(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return L(e.expr);case"and":case"or":return L(e.left)&&L(e.right)}}function Te(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!L(e))return oe(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:z(e,n).pruned}}function oe(e,t){switch(e.type){case"or":{if(L(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(z(e.left,n).pruned)return{shouldPrune:!0}}return oe(e.right,t)}case"and":{if(L(e.left)&&L(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:z(e,n).pruned}}if(L(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 z(e.left,n).matches?oe(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function Ce(e,t){let n=[],s=t,a=r=>({expr:null,pathIndex:s,error:`find: missing argument to \`${r}'
|
|
4
|
-
`}),o=(r,i)=>({expr:null,pathIndex:s,error:`find: invalid argument \`${i}' to \`${r}'
|
|
5
|
-
`});for(;s<e.length;){let r=e[s];if(r==="("||r==="\\("){n.push({type:"lparen"}),s++;continue}if(r===")"||r==="\\)"){n.push({type:"rparen"}),s++;continue}if(r==="-name"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s]}})}else if(r==="-iname"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}})}else if(r==="-path"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s]}})}else if(r==="-ipath"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}})}else if(r==="-regex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}})}else if(r==="-iregex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}})}else if(r==="-type"){if(s+1>=e.length)return a(r);let i=e[++s];if(i==="f"||i==="d")n.push({type:"expr",expr:{type:"type",fileType:i}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${i}
|
|
6
|
-
`}}else if(r==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(r==="-mtime"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;if(i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1)),!/^\d+$/.test(p))return o(r,i);let I=Number(p);if(!Number.isSafeInteger(I))return o(r,i);n.push({type:"expr",expr:{type:"mtime",days:I,comparison:l}})}else if(r==="-newer"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:i}})}else if(r==="-size"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1));let I=p.match(/^(\d+)([ckMGb])?$/);if(!I)return o(r,i);let N=Number(I[1]);if(!Number.isSafeInteger(N))return o(r,i);let P=I[2]||"b",j=P==="G"?1024**3:P==="M"?1024**2:P==="k"?1024:P==="b"?512:1;if(!Number.isSafeInteger(N*j))return o(r,i);n.push({type:"expr",expr:{type:"size",value:N,unit:P,comparison:l}})}else if(r==="-perm"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;if(i.startsWith("-")?(l="all",p=i.slice(1)):i.startsWith("/")&&(l="any",p=i.slice(1)),!/^[0-7]{1,4}$/.test(p))return o(r,i);let I=Number.parseInt(p,8);n.push({type:"expr",expr:{type:"perm",mode:I,matchType:l}})}else if(r==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(r==="-not"||r==="!")n.push({type:"not"});else if(r==="-o"||r==="-or")n.push({type:"op",op:"or"});else if(r==="-a"||r==="-and")n.push({type:"op",op:"and"});else if(r==="-maxdepth"||r==="-mindepth"){if(s+1>=e.length)return a(r);s++}else if(r!=="-depth")if(r==="-exec"){let i=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)i.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n"};if(i.length===0)return a("-exec");let l=e[s]==="+";if(l&&(i.at(-1)!=="{}"||i.filter(p=>p==="{}").length!==1))return o("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:i,batchMode:l}}})}else if(r==="-print")n.push({type:"expr",expr:{type:"action",action:{type:"print"}}});else if(r==="-print0")n.push({type:"expr",expr:{type:"action",action:{type:"print0"}}});else if(r==="-printf"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"action",action:{type:"printf",format:i}}})}else if(r==="-delete")n.push({type:"expr",expr:{type:"action",action:{type:"delete"}}});else return r.startsWith("-")?{expr:null,pathIndex:s,error:`find: unknown predicate '${r}'
|
|
7
|
-
`}:{expr:null,pathIndex:s,error:`find: paths must precede expression: \`${r}'
|
|
8
|
-
`};s++}if(n.length===0)return{expr:null,pathIndex:s};let u=Ie(n);return u.error?{expr:null,pathIndex:s,error:u.error}:{expr:u.expr,pathIndex:s}}function Ie(e){let t=0,n;function s(){let i=a();if(!i)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="or"){t++;let p=a();if(!p)return n="find: expected an expression after `-o'\n",null;i={type:"or",left:i,right:p}}else break}return i}function a(){let i=o();if(!i)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="and"){t++;let p=o();if(!p)return n="find: expected an expression after `-a'\n",null;i={type:"and",left:i,right:p}}else if(l.type==="expr"||l.type==="not"||l.type==="lparen"){let p=o();if(!p)return i;i={type:"and",left:i,right:p}}else break}return i}function o(){if(t<e.length&&e[t].type==="not"){t++;let i=o();return i?{type:"not",expr:i}:(n="find: expected an expression after `!'\n",null)}return u()}function u(){if(t>=e.length)return null;let i=e[t];if(i.type==="lparen"){t++;let l=s();return!l||t>=e.length||e[t].type!=="rparen"?(n="find: missing closing `)'\n",null):(t++,l)}return i.type==="expr"?(t++,i.expr):(i.type==="rparen",null)}let r=s();return!n&&t<e.length&&(n=e[t].type==="rparen"?"find: unexpected `)'\n":`find: invalid expression
|
|
9
|
-
`),!n&&r&&X(r)&&(n="find: refusing to evaluate `-delete' under negation\n"),{expr:n?null:r,error:n}}function X(e,t=!1){return e.type==="action"?t&&e.action.type==="delete":e.type==="not"?X(e.expr,!t):e.type==="and"||e.type==="or"?X(e.left,t)||X(e.right,t):!1}var ve=500;function Fe(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function ze(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}})}var Re={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"]},Xe={name:"find",async execute(e,t){if(ye(e))return me(Re);let n=[],s=null,a=null,o=!1,u=e.length;for(let c=0;c<e.length;c++){let f=e[c];if(f.startsWith("-")||f==="("||f==="\\("||f===")"||f==="\\)"||f==="!"){u=c;break}n.push(f)}n.length===0&&n.push(".");for(let c=u;c<e.length;c++){let f=e[c];if(f==="-exec")for(c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else if(f==="-maxdepth"||f==="-mindepth"){let d=e[c+1];if(d===void 0||!/^\d+$/.test(d))return{stdout:"",stderr:d===void 0?`find: missing argument to \`${f}'
|
|
10
|
-
`:`find: invalid argument \`${d}' to \`${f}'
|
|
11
|
-
`,exitCode:1};let D=Number(d);if(!Number.isSafeInteger(D))return{stdout:"",stderr:`find: invalid argument \`${d}' to \`${f}'
|
|
12
|
-
`,exitCode:1};f==="-maxdepth"?s=D:a=D,c++}else f==="-depth"&&(o=!0)}let{expr:r,error:i}=Ce(e,u);if(i)return{stdout:"",stderr:i,exitCode:1};let l=ee(r),p=l.length>0;l.some(c=>c.type==="delete")&&(o=!0);let I=[],N=0,P=t.executionScope?new be(t.executionScope,"find"):void 0,j=[],ce=[],Q=0,A=new ge({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),G=c=>{if(P)P.append("stdout",c);else{let f=re(c);if(f>t.limits.maxOutputSize-Q)throw new ie(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&j.push(c),Q+=f}},U=c=>{if(P)P.append("stderr",c);else{let f=re(c);if(f>t.limits.maxOutputSize-Q)throw new ie(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&ce.push(c),Q+=f}},De=Se(r),te=new Map;for(let c of De){let f=t.fs.resolvePath(t.cwd,c);try{let d=await t.fs.stat(f);te.set(c,d.mtime?.getTime()??Date.now())}catch{}}let Me=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Ee=Z(r)||Me,Pe=J(r),fe=_(r),xe=V(r),$e=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let R=function(h){if(!(a===null||h.depth>=a))return[];let v=!0,S=[];if(r!==null){let m=Date.now(),g;if(xe)g=B(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let b={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:te};g=z(r,b)}v=g.matches,S=g.actions??[],d.evalCalls++,d.evalTime+=Date.now()-m}if(!p&&v&&(S=[{type:"print"}]),S.length===0)return[];let M={path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c};A.checkpoint(S.length);let y=[];for(let m of S)y.push({action:m,path:h.relativePath,printfData:M});return y};var Le=R;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{U(`find: ${c}: No such file or directory
|
|
13
|
-
`),N=1;continue}let d=Fe(),D=Date.now();async function x(h){let{path:w,depth:v,typeInfo:S}=h;if(A.visit(v),d.nodeCount++,v>(s??t.limits.maxTraversalDepth))return null;let M,y,m;if(S&&!Ee)M=S.isFile,y=S.isDirectory;else{try{let O=Date.now();m=await t.fs.lstat(w),d.statCalls++,d.statTime+=Date.now()-O}catch{return null}if(!m)return null;M=m.isFile,y=m.isDirectory}let g;w===f?g=c.split("/").pop()||c:g=w.split("/").pop()||"";let b=w===f?c:c==="."?`./${w.slice(f==="/"?f.length:f.length+1)}`:c+w.slice(f.length),E=[],T=null,C=null,$=!1;y&&fe&&!o&&($=Te(r,{name:g,relativePath:b,isFile:M,isDirectory:y}).shouldPrune,$&&d.earlyPrunes++);let H=!(v>=(s??t.limits.maxTraversalDepth))&&!$;if(y&&((H||Pe)&&!$)){let O=Date.now();if($e&&t.fs.readdirWithFileTypes){T=await t.fs.readdirWithFileTypes(w),A.checkpoint(),A.discover(T.length),C=[];for(let F of T)C.push(F.name);if(d.readdirCalls++,d.readdirTime+=Date.now()-O,H)for(let F=0;F<T.length;F++){let W=T[F];E.push({path:w==="/"?`/${W.name}`:`${w}/${W.name}`,depth:v+1,typeInfo:{isFile:W.isFile,isDirectory:W.isDirectory},resultIndex:F})}}else if(C=await t.fs.readdir(w),A.checkpoint(),A.discover(C.length),d.readdirCalls++,d.readdirTime+=Date.now()-O,H)for(let F=0;F<C.length;F++){let W=C[F];E.push({path:w==="/"?`/${W}`:`${w}/${W}`,depth:v+1,resultIndex:F})}}let K=M?(m?.size??0)===0:C!==null&&C.length===0,q=$;if(!o&&r!==null&&!$&&fe){let O=Date.now(),F={name:g,relativePath:b,isFile:M,isDirectory:y,isEmpty:K,mtime:m?.mtime?.getTime()??Date.now(),size:m?.size??0,mode:m?.mode??420,newerRefTimes:te};q=z(r,F).pruned,d.evalCalls++,d.evalTime+=Date.now()-O}return{relativePath:b,name:g,isFile:M,isDirectory:y,isEmpty:K,stat:m,depth:v,children:q?[]:E,pruned:q}}async function ke(){let h={effects:[]};if(o){let w=[],v=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map,M=0;for(;M<v.length;){let y=Date.now(),m=Math.min(v.length,M+ve),g=v.slice(M,m);M=m;let b=await Promise.all(g.map(E=>x(E.item)));d.batchCount++,d.batchTime+=Date.now()-y;for(let E=0;E<g.length;E++){let T=b[E],C=g[E];if(!T)continue;let $=w.length;if(C.parentIndex>=0){let k=S.get(C.parentIndex)||[];k.push($),S.set(C.parentIndex,k)}w.push({node:T,parentIndex:C.parentIndex,childIndices:[]});for(let k=0;k<T.children.length;k++)v.push({item:T.children[k],parentIndex:$,childOrderInParent:k})}}for(let[y,m]of S)y>=0&&y<w.length&&(w[y].childIndices=m);if(w.length>0){let y=[{index:0,visited:!1}];for(;y.length>0;){A.checkpoint();let m=y.pop();if(!m)break;let g=w[m.index];if(g){if(m.visited){for(let b of R(g.node))h.effects.push(b);continue}y.push({index:m.index,visited:!0});for(let b=g.childIndices.length-1;b>=0;b--)y.push({index:g.childIndices[b],visited:!1})}}}}else{let w=new Map,v=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:v++}],M=new Map,y=0;for(;y<S.length;){let g=Date.now(),b=Math.min(S.length,y+ve),E=S.slice(y,b);y=b;let T=await Promise.all(E.map(async({item:C,orderIndex:$})=>{let k=await x(C);return k?{node:k,orderIndex:$}:null}));d.batchCount++,d.batchTime+=Date.now()-g;for(let C of T){if(!C)continue;let{node:$,orderIndex:k}=C,H=R($);if(H.length>0&&w.set(k,H),$.children.length>0){let se=[];for(let K of $.children){let q=v++;se.push(q),S.push({item:K,orderIndex:q})}M.set(k,se)}}}let m=[0];for(;m.length>0;){A.checkpoint();let g=m.pop();if(g===void 0)break;let b=w.get(g);if(b)for(let T of b)h.effects.push(T);let E=M.get(g);if(E)for(let T=E.length-1;T>=0;T--)m.push(E[T])}}return h}let pe=await ke();for(let h of pe.effects)I.push(h);if(t.trace){let h=Date.now()-D;ze(t.trace,d,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:pe.effects.length}})}}let ne=new Map;for(let c of I){let{action:f,path:d}=c;switch(f.type){case"print":G(`${d}
|
|
14
|
-
`);break;case"print0":G(`${d}\0`);break;case"printf":G(Ne(f.format,c.printfData));break;case"delete":{let D=t.fs.resolvePath(t.cwd,d);try{await t.fs.rm(D,{recursive:!1})}catch(x){let R=x instanceof Error?x.message:String(x);U(`find: cannot delete '${d}': ${R}
|
|
15
|
-
`),N=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
16
|
-
`,exitCode:1};if(f.batchMode){let R=ne.get(f)??[];R.push(d),ne.set(f,R);break}let D=f.command.map(R=>R==="{}"?d:R),x=await t.exec(le([D[0]]),{cwd:t.cwd,signal:t.signal,args:D.slice(1)});P?P.appendResult(x):(G(x.stdout),U(x.stderr)),x.exitCode!==0&&(N=x.exitCode);break}}}for(let[c,f]of ne){if(c.type!=="exec"||!t.exec||f.length===0)continue;let d=[];for(let x of c.command)x==="{}"?d.push(...f):d.push(x);let D=await t.exec(le([d[0]]),{cwd:t.cwd,signal:t.signal,args:d.slice(1)});P?P.appendResult(D):(G(D.stdout),U(D.stderr)),D.exitCode!==0&&(N=D.exitCode)}return P?.build(N)??{stdout:j.join(""),stderr:ce.join(""),exitCode:N}}};function ee(e){return e?e.type==="action"?[e.action]:e.type==="not"?ee(e.expr):e.type==="and"||e.type==="or"?[...ee(e.left),...ee(e.right)]:[]:[]}function Ne(e,t){let n=he(e),s="",a=0;for(;a<n.length;)if(n[a]==="%"&&a+1<n.length){if(a++,n[a]==="%"){s+="%",a++;continue}let[o,u,r]=de(n,a);if(a+=r,a>=n.length){s+="%";break}let i=n[a],l;switch(i){case"f":l=t.name,a++;break;case"h":{let p=t.path.lastIndexOf("/");l=p>0?t.path.slice(0,p):".",a++;break}case"p":l=t.path,a++;break;case"P":{let p=t.startingPoint;t.path===p?l="":t.path.startsWith(`${p}/`)?l=t.path.slice(p.length+1):p==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,a++;break}case"s":l=String(t.size),a++;break;case"d":l=String(t.depth),a++;break;case"m":l=(t.mode&511).toString(8),a++;break;case"M":l=we(t.mode,t.isDirectory),a++;break;case"t":{let p=new Date(t.mtime);l=Ae(p),a++;break}case"T":{if(a+1<n.length){let p=n[a+1],I=new Date(t.mtime);l=We(I,p),a+=2}else l="%T",a++;break}default:s+=`%${o!==0||u!==-1?`${o}.${u}`:""}${i}`,a++;continue}s+=ue(l,o,u)}else s+=n[a],a++;return s}function Ae(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=t[e.getDay()],a=n[e.getMonth()],o=String(e.getDate()).padStart(2," "),u=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),l=e.getFullYear();return`${s} ${a} ${o} ${u}:${r}:${i} ${l}`}function We(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 et={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};export{Xe as a,et as b};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{c as i}from"./chunk-OHFB3M3X.js";import{a as m}from"./chunk-PBOVSFTJ.js";import{a as c}from"./chunk-NE4R2FVV.js";import{a as l}from"./chunk-I4IRHQDW.js";var k={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},h={name:"mkdir",async execute(f,s){let r=c("mkdir",f,k);if(!r.ok)return r.error;let g=r.result.flags.recursive,p=r.result.flags.verbose,n=r.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
4
|
-
`,exitCode:1};let a="",t="",d=0;for(let e of n)try{let o=s.fs.resolvePath(s.cwd,e);await s.fs.mkdir(o,{recursive:g}),p&&(a+=`mkdir: created directory '${e}'
|
|
5
|
-
`)}catch(o){let u=l(o);i(o,"ENOENT")?t+=`mkdir: cannot create directory '${e}': No such file or directory
|
|
6
|
-
`:i(o,"EEXIST")?t+=`mkdir: cannot create directory '${e}': File exists
|
|
7
|
-
`:t+=`mkdir: cannot create directory '${e}': ${m(u)}
|
|
8
|
-
`,d=1}return{stdout:a,stderr:t,exitCode:d}}},$={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{h as a,$ as b};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{c as i}from"./chunk-OHFB3M3X.js";import{a as d}from"./chunk-PBOVSFTJ.js";import{a as u}from"./chunk-NE4R2FVV.js";import{a as g}from"./chunk-I4IRHQDW.js";var b={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"}},C={name:"rm",async execute(v,s){let e=u("rm",v,b);if(!e.ok)return e.error;let l=e.result.flags.recursive||e.result.flags.recursiveUpper,n=e.result.flags.force,y=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return n?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
4
|
-
`,exitCode:1};let f="",t="",a=0;for(let r of c)try{let o=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(o)).isDirectory&&!l){t+=`rm: cannot remove '${r}': Is a directory
|
|
5
|
-
`,a=1;continue}await s.fs.rm(o,{recursive:l,force:n}),y&&(f+=`removed '${r}'
|
|
6
|
-
`)}catch(o){let m=g(o),p=i(o,"ENOENT");if(n&&p)continue;p?t+=`rm: cannot remove '${r}': No such file or directory
|
|
7
|
-
`:i(o,"ENOTEMPTY")?t+=`rm: cannot remove '${r}': Directory not empty
|
|
8
|
-
`:t+=`rm: cannot remove '${r}': ${d(m)}
|
|
9
|
-
`,a=1}return{stdout:f,stderr:t,exitCode:a}}},w={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{C as a,w as b};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import*as M from"node:async_hooks";import*as $ from"node:module";var v;function T(){return v||w(),v}function w(){let a=[{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","NODE_ENV","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"},...["on","once","addListener","prependListener","prependOnceListener"].map(t=>({prop:t,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{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&&a.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&&a.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&&a.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{}let e=a.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}});return v??=new Set(e.map(({violationType:t})=>t)),e}var j=performance.timeOrigin,V=performance.now.bind(performance);function k(){return Math.floor(j+V())}var E=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);function D(a){let e=a?.find(t=>E.has(t));if(e)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${e}" protection`)}var R=`
|
|
4
|
-
|
|
5
|
-
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`;function O(a,e,t){let i=t&&!E.has(e)?`
|
|
6
|
-
|
|
7
|
-
If this access is required by trusted host-runtime code, add "${e}" to defenseInDepth.excludeViolationTypes.`:"";return a+R+i}var f=typeof __BROWSER__<"u"&&__BROWSER__;function S(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var P=null,m=null,A=null;if(!f)try{P=M.AsyncLocalStorage,m=$,A=m.Module??m.default??null}catch{}var d=class extends Error{violation;constructor(e,t){super(O(e,t.type,t.type==="error_prepare_stack_trace"||T().has(t.type))),this.violation=t,this.name="SecurityViolationError"}},p=!f&&P?new P:null,L=1e3;function G(a,e,...t){return p.run(a,()=>e(...t))}var N={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};function I(){return!f&&typeof m?.registerHooks=="function"}function C(a){let e=typeof a=="boolean"?{enabled:a}:a??{};if(D(e.excludeViolationTypes),e.enabled!==void 0&&e.enabled!==!0&&e.enabled!==!1&&e.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let t={...N,...e},i=t.enabled==="auto"?"auto":t.enabled?"enabled":"disabled",r={...t,enabled:i!=="disabled",requested:i};return r.excludeViolationTypes&&(r.excludeViolationTypes=[...new Set(r.excludeViolationTypes)].sort()),r}function H(a,e){if(a.enabled!==e.enabled||a.auditMode!==e.auditMode||a.processLifetimeIntrinsicHardening!==e.processLifetimeIntrinsicHardening||a.onViolation!==e.onViolation)return!1;let t=a.excludeViolationTypes??[],i=e.excludeViolationTypes??[];return t.length===i.length&&t.every((r,o)=>r===i[o])}var B=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=C(e);if(!a.instance)a.instance=new a(t);else{let i=a.instance.config;if(!H(t,i))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return p?p?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(p)return p?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}static isTrustedContext(e){return!e||e.forceUntrusted?!1:e.trusted===!0||a.isTrustedScopeActive(e.executionId)}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}static bindCurrentContext(e){if(!p)return e;let t=p.getStore(),i=t?.sandboxActive===!0?t.executionId:void 0;if(!i)return e;let o=a.instance?.getCachedContext(i)??{sandboxActive:!0,executionId:i},n=t?.forceUntrusted?{...o,forceUntrusted:!0}:o;return((...s)=>{let c=a.instance;if(!(c&&!c.isExecutionIdActive(i)&&(c.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!c.config.auditMode)))return G(n,e,...s)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let e=I();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!p||f?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":e?"full":"best-effort",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":e?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(e){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=C({...this.config,...e})}activate(){if(!f&&this.config.enabled&&!p)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(f||!this.config.enabled){let i=S(),r=!1;return{run:o=>r?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):o(),deactivate:()=>{r=!0},executionId:i}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(i){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,i}this.activationTime=Date.now()}let e=S(),t=!1;return{run:i=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),p.run({sandboxActive:!0,executionId:e},i)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}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(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},()=>{a.enterTrustedScope(i);try{let r=e();return typeof r=="object"&&r!==null&&"finally"in r&&typeof r.finally=="function"?r.finally(()=>{a.leaveTrustedScope(i)}):(a.leaveTrustedScope(i),r)}catch(r){throw a.leaveTrustedScope(i),r}})}static async runTrustedAsync(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},async()=>{a.enterTrustedScope(i);try{return await e()}finally{a.leaveTrustedScope(i)}})}static async runUntrustedAsync(e){if(!p)return e();let t=p.getStore();return t?p.run({...t,trusted:!1,forceUntrusted:!0},e):e()}shouldBlock(){if(f||this.config.auditMode||!p)return!1;let e=p?.getStore();return!(e?.sandboxActive!==!0||a.isTrustedContext(e))}shouldAudit(){if(!this.config.auditMode||!p)return!1;let e=p.getStore();return e?.sandboxActive===!0&&!a.isTrustedContext(e)}recordViolation(e,t,i){let r={timestamp:k(),type:e,message:i,path:t,stack:new Error().stack,executionId:p?.getStore()?.executionId};if(this.violations.length<L&&this.violations.push(r),this.config.onViolation)try{this.config.onViolation(r)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return r}createBlockingProxy(e,t,i){let r=this;return new Proxy(e,{apply(o,n,s){if(r.shouldBlock()){let c=`${t} is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} called (audit mode)`),Reflect.apply(o,n,s)},construct(o,n,s){if(r.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,s)}})}createBlockingObjectProxy(e,t,i,r){let o=this;return new Proxy(e,{get(n,s,c){if(o.shouldBlock()){if(r&&typeof s=="string"&&r.has(s))return Reflect.get(n,s,c);let l=`${t}.${String(s)}`,u=`${l} is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}if(o.shouldAudit()){let l=`${t}.${String(s)}`;o.recordViolation(i,l,`${l} accessed (audit mode)`)}return Reflect.get(n,s,c)},set(n,s,c,l){if(o.shouldBlock()){let u=`${t}.${String(s)}`,h=`${u} modification is blocked during script execution`,y=o.recordViolation(i,u,h);throw new d(h,y)}return t==="process.env"&&s==="DEBUG"?Reflect.set(n,s,c):Reflect.set(n,s,c,l)},ownKeys(n){if(o.shouldBlock()){let s=`${t} enumeration is blocked during script execution`,c=o.recordViolation(i,t,s);throw new d(s,c)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} descriptor access is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.getOwnPropertyDescriptor(n,s)},has(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} existence check is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.has(n,s)},deleteProperty(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} deletion is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){if(o.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=o.recordViolation(i,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(n,s)},defineProperty(n,s,c){if(o.shouldBlock()){let l=`${t}.${String(s)}`,u=`${l} defineProperty is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}return Reflect.defineProperty(n,s,c)}})}createReadonlyObjectProxy(e,t,i){let r=this,o=n=>{let s=`${t} ${n} is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)};return new Proxy(e,{set(n,s,c,l){return r.shouldBlock()&&o("modification"),Reflect.set(n,s,c,l)},defineProperty(n,s,c){return r.shouldBlock()&&o("defineProperty"),Reflect.defineProperty(n,s,c)},deleteProperty(n,s){return r.shouldBlock()&&o("deletion"),Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){return r.shouldBlock()&&o("setPrototypeOf"),Reflect.setPrototypeOf(n,s)},preventExtensions(n){return r.shouldBlock()&&o("preventExtensions"),Reflect.preventExtensions(n)}})}applyPatches(){this.patchFailures=[];let e=w(),t=new Set(this.config.excludeViolationTypes??[]),i=new Set(["process_send","process_channel","process_stdout","process_stderr"]),r=[];for(let s of e)if(!t.has(s.violationType)&&!i.has(s.violationType)){if(s.strategy==="freeze"){r.push(s);continue}this.applyPatch(s)}this.protectConstructorChain(),t.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),I()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let o=["Function.prototype.constructor","Module._load","Module._resolveFilename"],n=this.patchFailures.filter(s=>o.includes(s));if(n.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${n.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(r);for(let s of r)this.applyPatch(s,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(e){let t=new Set,i=(n,s)=>{let c=Object.getOwnPropertyDescriptor(n,s);!c||!("value"in c)||c.writable!==!0||c.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:c}),Object.defineProperty(n,s,{...c,writable:!1}))};for(let{target:n,prop:s}of e){let c=n[s];if(!(typeof c!="object"||c===null)){t.add(c);for(let l of Reflect.ownKeys(c))i(c,l)}}let r=[];for(let n of[Array,Map,Set,RegExp,Promise])r.push([n,Symbol.species]);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])r.push([n,Symbol.iterator]);r.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])r.push([RegExp.prototype,n]);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])r.push([n,Symbol.toStringTag]);for(let[n,s]of r)t.add(n),i(n,s);let o=(n,s,c)=>{let l=Object.getOwnPropertyDescriptor(n,s);if(!l||!("value"in l)||typeof l.value!="function"||l.configurable!==!0)return;let u=l.value,h=this,y=function(...b){let g=b[0];if(h.shouldBlock()&&typeof g=="object"&&g!==null&&t.has(g)){let x=`${c}.${s}`,_=`${x} is blocked for protected intrinsics during script execution`,F=h.recordViolation("prototype_mutation",x,_);throw new d(_,F)}return Reflect.apply(u,this,b)};this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:l}),Object.defineProperty(n,s,{...l,value:y,writable:!1})};for(let n of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])o(Object,n,"Object");for(let n of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])o(Reflect,n,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let i=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return i},set(r){if(e.shouldBlock()){let o="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",o);throw new d(o,n)}e.shouldAudit()&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),i=r},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let o=function(...n){return p.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,n);if(this.kind==="fulfilled")return n[0];throw n[0]}return Reflect.apply(this.cb,void 0,n)})};var t=o;let i=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:i});let r=i?.value;if(typeof r!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(s,c){if(!p)return Reflect.apply(r,this,[s,c]);let l=p.getStore(),u=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!u)return Reflect.apply(r,this,[s,c]);let h=e.getCachedContext(u),y=l?.forceUntrusted?{...h,forceUntrusted:!0}:h,b=(g,x)=>typeof g!="function"?g:o.bind({box:e,executionId:u,captured:y,cb:g,kind:x});return Reflect.apply(r,this,[b(s,"fulfilled"),b(c,"rejected")])},writable:!0,configurable:!0})}catch(i){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",i instanceof Error?i.message:i)}}patchPrototypeConstructor(e,t,i){let r=this;try{let o=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:o});let n=o?.value;Object.defineProperty(e,"constructor",{get(){if(r.shouldBlock()){let s=`${t} access is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} accessed (audit mode)`),n},set(s){if(r.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(o){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,o instanceof Error?o.message:o)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let i=t?.value;i!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let r="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new d(o,n)}Object.defineProperty(process,"mainModule",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let i=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let r="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new d(o,n)}Object.defineProperty(process,"execPath",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,i)=>{try{let r=Object.getOwnPropertyDescriptor(t,i);if(r?.configurable){if("value"in r){Object.defineProperty(t,i,{...r,configurable:!1,writable:!1});return}Object.defineProperty(t,i,{...r,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag)}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let i=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:i}),Object.defineProperty(Proxy,"revocable",{value:function(o,n){if(e.shouldBlock()){let s="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",s);throw new d(s,c)}return e.shouldAudit()&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(o,n)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=m;if(!e)throw new Error("node:module is unavailable");let t=new Set;for(let o of e.builtinModules??[]){let n=o.startsWith("node:")?o.slice(5):o;t.add(n);let s=n.indexOf("/");s>0&&t.add(n.slice(0,s))}let i=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 n=o.startsWith("node:")?o.slice(5):o;if(!n)return!1;if(typeof e.isBuiltin=="function"&&e.isBuiltin(n)||t.has(n))return!0;let s=n.indexOf("/");return s>0&&t.has(n.slice(0,s))},r=o=>{let n=p?.getStore();return o.config.auditMode===!0&&n?.sandboxActive===!0&&!a.isTrustedContext(n)};if(typeof e.registerHooks=="function"){e.registerHooks({resolve(o,n,s){let c=a.instance;if(!c)return s(o,n);if((o.startsWith("data:")||o.startsWith("blob:"))&&c.shouldBlock()){let l=`import(${o.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}if(i(o)){let l=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(c.shouldBlock()){let h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}r(c)&&c.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return s(o,n)}}),a.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(e){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(e,t){if(f)return;let i=`Module.${e}`;try{let r=A,o=r?.[e];if(!r||typeof o!="function")throw new Error("node:module Module class or method is unavailable");let n=Object.getOwnPropertyDescriptor(r,e);if(!n)throw new Error("method has no own property descriptor");if(n.configurable===!1&&n.writable===!1)throw new Error("method is non-configurable and non-writable");let s=this.createBlockingProxy(o,i,t);this.originalDescriptors.push({target:r,prop:e,descriptor:n}),Object.defineProperty(r,e,{...n,value:s});let c=Object.getOwnPropertyDescriptor(r,e);if(r[e]!==s||c?.value!==s)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(i)}}applyPatch(e,t=!1){let{target:i,prop:r,violationType:o,strategy:n}=e;try{let s=i[r];if(s===void 0)return;let c=Object.getOwnPropertyDescriptor(i,r);if(this.originalDescriptors.push({target:i,prop:r,descriptor:c}),n==="freeze"){if(typeof s=="object"&&s!==null){t&&Object.freeze(s);let l=this.getPathForTarget(i,r),u=this.createReadonlyObjectProxy(s,l,o);Object.defineProperty(i,r,{...c,value:u})}}else{let l=this.getPathForTarget(i,r),u=typeof s=="function"?this.createBlockingProxy(s,l,o):this.createBlockingObjectProxy(s,l,o,e.allowedKeys);Object.defineProperty(i,r,{value:u,writable:!0,configurable:!0})}}catch(s){let c=this.getPathForTarget(i,r);this.patchFailures.push(c),console.debug(`[DefenseInDepthBox] Could not patch ${c}:`,s instanceof Error?s.message:s)}}restorePatches(){for(let e=this.temporaryIntrinsicDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.temporaryIntrinsicDescriptors[e];try{Object.defineProperty(t,i,r)}catch(o){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(i)}:`,o instanceof Error?o.message:o)}}this.temporaryIntrinsicDescriptors=[];for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.originalDescriptors[e];try{r?Object.defineProperty(t,i,r):delete t[i]}catch(o){let n=this.getPathForTarget(t,i);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{d as a,B as b};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as s}from"./chunk-OHFB3M3X.js";var a=40,f=493,d=420,x=511;function o(n){if(!n||n==="/")return"/";let t=n.endsWith("/")&&n!=="/"?n.slice(0,-1):n;t.startsWith("/")||(t=`/${t}`);let r=t.split("/").filter(i=>i&&i!=="."),e=[];for(let i of r)i===".."?e.pop():e.push(i);return`/${e.join("/")}`||"/"}function m(n,t){let r=o(n),e=o(t);return e===r||r==="/"||e.startsWith(`${r}/`)}function $(n,t){if(n.includes("\0"))throw new s("ENOENT",`path contains null byte, ${t} '${n}'`)}function c(n){let t=o(n);if(t==="/")return"/";let r=t.lastIndexOf("/");return r===0?"/":t.slice(0,r)}function p(n,t){if(t.startsWith("/"))return o(t);let r=n==="/"?`/${t}`:`${n}/${t}`;return o(r)}function E(n){return n.replace(/\\/g,"/")}function l(n,t){return n==="/"?`/${t}`:`${n}/${t}`}function D(n,t){if(t.startsWith("/"))return o(t);let r=c(n);return o(l(r,t))}export{a,f as b,d as c,x as d,o as e,m as f,$ as g,c as h,p as i,E as j,l as k,D as l};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{l as o}from"./chunk-FUT3X2GJ.js";import{a as u}from"./chunk-CPKBPQ2C.js";function n(s,t){if(!Number.isSafeInteger(s)||s<0)throw new o(`${t}: invalid bounded allocation count`,"array_elements")}function c(s){return new o(`${s}: invalid bounded allocation count`,"array_elements")}function f(s,t,e){n(s,e),n(t,e);let i=s+t;if(!Number.isSafeInteger(i))throw c(e);return i}function p(s,t,e){if(n(s,e),n(t,e),s!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/s))throw c(e);return s*t}function m(s,t,e,i){let r=new a(e,i);for(let h=0;h<s.length;h++)h>0&&r.append(t),r.append(s[h]);return r.build()}var a=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,e,i=void 0,r=0){this.maxBytes=t,this.label=e,this.createLimitError=i,this.reservedBytes=r,n(t,e),n(r,e),r>t&&this.fail()}fail(){throw this.createLimitError?.()??new o(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(t){n(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let e=u(t);return this.reserve(e),t&&this.chunks.push(t),this.usedBytes+=e,this}repeat(t,e){n(e,this.label);let i=u(t);return i!==0&&e>Math.floor(this.remainingBytes/i)&&this.fail(),this.append(t.repeat(e))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}};export{f as a,p as b,m as c,a as d};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as k,b as E,c as _,d as Te,e as S,g as C,h as ce}from"./chunk-47IFMQYS.js";import{a as ue,c as Me}from"./chunk-MROECM42.js";import{a as Ie}from"./chunk-42AMF6EE.js";import{a as j}from"./chunk-YXPSX3SI.js";import{d as G}from"./chunk-I57EACSL.js";import{l as g}from"./chunk-FUT3X2GJ.js";import{a as x}from"./chunk-CPKBPQ2C.js";function I(e){return e!==!1&&e!==null}function J(e,n){return JSON.stringify(e)===JSON.stringify(n)}function Y(e,n){return typeof e=="number"&&typeof n=="number"?e-n:typeof e=="string"&&typeof n=="string"?e.localeCompare(n):0}function xe(e,n,t={}){let r=t.maxDepth??2e3,s=C(e),o=[{target:s,source:n,depth:0}];for(;o.length>0;){let p=o.pop();if(!p)break;if(p.depth>r)throw new g(`query depth limit exceeded (${r})`,"recursion");for(let u of Object.keys(p.source)){if(t.visit?.(),!k(u))continue;let f=_(p.target,u)?S(p.target[u]):null,i=S(p.source[u]);if(f&&i){let c=C(f);E(p.target,u,c),o.push({target:c,source:i,depth:p.depth+1})}else E(p.target,u,p.source[u])}}return s}function B(e,n=3e3){if(e===null||typeof e!="object")return 0;if(n<=1)return n;let t=(i,c)=>({value:i,keys:Array.isArray(i)?void 0:Object.keys(i),nextChild:0,pathDepth:c,maxChildDepth:0}),r=i=>i.keys!==void 0?i.keys.length:i.value.length,s=i=>{if(i.keys){let c=i.keys[i.nextChild++];return i.value[c]}return i.value[i.nextChild++]},o=new WeakMap,p=new WeakMap,u=e,f=[t(u,1)];for(o.set(u,"visiting");f.length>0;){let i=f[f.length-1];if(i.nextChild<r(i)){let a=s(i);if(a===null||typeof a!="object")continue;let l=o.get(a);if(l==="visiting")return n;if(l==="done"){let b=p.get(a)??0;if(i.pathDepth+b>=n)return n;i.maxChildDepth=Math.max(i.maxChildDepth,b);continue}let y=i.pathDepth+1;if(y>=n)return n;let m=a;o.set(a,"visiting"),f.push(t(m,y));continue}let c=i.maxChildDepth+1;p.set(i.value,c),o.set(i.value,"done"),f.pop();let h=f.at(-1);if(h)h.maxChildDepth=Math.max(h.maxChildDepth,c);else return c}return 0}function Z(e,n){let t=u=>u===null?0:typeof u=="boolean"?1:typeof u=="number"?2:typeof u=="string"?3:Array.isArray(u)?4:typeof u=="object"?5:6,r=t(e),s=t(n);if(r!==s)return r-s;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="string"&&typeof n=="string")return e.localeCompare(n);if(typeof e=="boolean"&&typeof n=="boolean")return(e?1:0)-(n?1:0);if(Array.isArray(e)&&Array.isArray(n)){for(let u=0;u<Math.min(e.length,n.length);u++){let f=Z(e[u],n[u]);if(f!==0)return f}return e.length-n.length}let o=S(e),p=S(n);if(o&&p){let u=Object.keys(o).sort(),f=Object.keys(p).sort();for(let i=0;i<Math.min(u.length,f.length);i++){let c=u[i].localeCompare(f[i]);if(c!==0)return c}if(u.length!==f.length)return u.length-f.length;for(let i of u){let c=Z(o[i],p[i]);if(c!==0)return c}}return 0}function v(e,n){if(J(e,n))return!0;if(typeof e=="string"&&typeof n=="string")return e.includes(n);if(Array.isArray(e)&&Array.isArray(n))return n.every(s=>e.some(o=>v(o,s)));let t=S(e),r=S(n);return t&&r?Object.keys(r).every(s=>_(t,s)&&v(t[s],r[s])):!1}function z(e,n,t=1){let r=e.limits.maxArrayElements;if(t<0||n>r-t)throw new g(`query result element limit exceeded (${r})`,"array_elements")}function pe(e,n,t,r,s,o,p,u,f,i){switch(n){case"sort":return Array.isArray(e)?[[...e].sort(p)]:[null];case"sort_by":return!Array.isArray(e)||t.length===0?[null]:[[...e].sort((h,a)=>{let l=s(h,t[0],r)[0],y=s(a,t[0],r)[0];return p(l,y)})];case"bsearch":{if(!Array.isArray(e)){let h=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${h} (${JSON.stringify(e)}) cannot be searched from`)}return t.length===0?[null]:s(e,t[0],r).map(h=>{let a=0,l=e.length;for(;a<l;){let y=a+l>>>1;p(e[y],h)<0?a=y+1:l=y}return a<e.length&&p(e[a],h)===0?a:-a-1})}case"unique_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let a of e){let l=s(a,t[0],r)[0],y=JSON.stringify(l);c.has(y)||c.set(y,{item:a,key:l})}let h=[...c.values()];return h.sort((a,l)=>p(a.key,l.key)),[h.map(a=>a.item)]}case"group_by":{if(!Array.isArray(e)||t.length===0)return[null];let c=new Map;for(let h of e){let a=JSON.stringify(s(h,t[0],r)[0]);c.has(a)||c.set(a,[]),c.get(a)?.push(h)}return[[...c.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((c,h)=>p(c,h)>0?c:h)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,h)=>{let a=s(c,t[0],r)[0],l=s(h,t[0],r)[0];return p(a,l)>0?c:h})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((c,h)=>p(c,h)<0?c:h)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||t.length===0?[null]:[e.reduce((c,h)=>{let a=s(c,t[0],r)[0],l=s(h,t[0],r)[0];return p(a,l)<0?c:h})];case"add":{let c=h=>{let a=h.filter(l=>l!==null);return a.length===0?null:a.every(l=>typeof l=="number")?a.reduce((l,y)=>l+y,0):a.every(l=>typeof l=="string")?a.join(""):a.every(l=>Array.isArray(l))?a.flat():a.every(l=>l&&typeof l=="object"&&!Array.isArray(l))?Me(...a):null};if(t.length>=1){let h=s(e,t[0],r);return[c(h)]}return Array.isArray(e)?[c(e)]:[null]}case"any":{if(t.length>=2){try{let c=o(e,t[0],r);for(let h of c)if(s(h,t[1],r).some(u))return[!0]}catch(c){if(c instanceof i)throw c}return[!1]}return t.length===1?Array.isArray(e)?[e.some(c=>u(s(c,t[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(u)]:[!1]}case"all":{if(t.length>=2){try{let c=o(e,t[0],r);for(let h of c)if(!s(h,t[1],r).some(u))return[!1]}catch(c){if(c instanceof i)throw c}return[!0]}return t.length===1?Array.isArray(e)?[e.every(c=>u(s(c,t[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(u)]:[!0]}case"select":return t.length===0?[e]:s(e,t[0],r).some(u)?[e]:[];case"map":{if(t.length===0||!Array.isArray(e))return[null];z(r,0,e.length);let c=[];for(let h of e){let a=s(h,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}case"map_values":{if(t.length===0)return[null];if(Array.isArray(e)){z(r,0,e.length);let c=[];for(let h of e){let a=s(h,t[0],r);z(r,c.length,a.length);for(let l of a)c.push(l)}return[c]}if(e&&typeof e=="object"){let c=Object.create(null),h=Object.keys(e);z(r,0,h.length);for(let a of h){if(!k(a))continue;let l=e[a],y=s(l,t[0],r);y.length>0&&E(c,a,y[0])}return[c]}return[null]}case"has":{if(t.length===0)return[!1];let h=s(e,t[0],r)[0];return Array.isArray(e)&&typeof h=="number"?[h>=0&&h<e.length]:e&&typeof e=="object"&&typeof h=="string"?[Object.hasOwn(e,h)]:[!1]}case"in":{if(t.length===0)return[!1];let h=s(e,t[0],r)[0];return Array.isArray(h)&&typeof e=="number"?[e>=0&&e<h.length]:h&&typeof h=="object"&&typeof e=="string"?[Object.hasOwn(h,e)]:[!1]}case"contains":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(e,c[0])]}case"inside":{if(t.length===0)return[!1];let c=s(e,t[0],r);return[f(c[0],e)]}default:return null}}function he(e,n,t,r,s,o,p,u){switch(n){case"first":if(t.length>0)try{let f=o(e,t[0],r);return f.length>0?[f[0]]:[]}catch(f){if(f instanceof u)throw f;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(t.length>0){let f=s(e,t[0],r);return f.length>0?[f[f.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(t.length<1)return[null];let f=s(e,t[0],r);if(t.length>1){for(let c of f)if(c<0)throw new Error("nth doesn't support negative indices");let i;try{i=o(e,t[1],r)}catch(c){if(c instanceof u)throw c;i=[]}return f.flatMap(c=>{let h=c;return h<i.length?[i[h]]:[]})}return Array.isArray(e)?f.flatMap(i=>{let c=i;if(c<0)throw new Error("nth doesn't support negative indices");return c<e.length?[e[c]]:[null]}):[null]}case"range":{if(t.length===0)return[];let f=r.limits.maxArrayElements,i=(y,m)=>{if(y.length>=f)throw new u(`query result element limit exceeded (${f})`,"array_elements");y.push(m)},c=s(e,t[0],r);if(t.length===1){let y=[];for(let m of c){let b=m;for(let A=0;A<b;A++)i(y,A)}return y}let h=s(e,t[1],r);if(t.length===2){let y=[];for(let m of c)for(let b of h){let A=m,w=b;for(let N=A;N<w;N++)i(y,N)}return y}let a=s(e,t[2],r),l=[];for(let y of c)for(let m of h)for(let b of a){let A=y,w=m,N=b;if(N!==0)if(N>0)for(let O=A;O<w;O+=N)i(l,O);else for(let O=A;O>w;O+=N)i(l,O)}return l}case"limit":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("limit doesn't support negative count");if(c===0)return[];let h;try{h=o(e,t[1],r)}catch(a){if(a instanceof u)throw a;h=[]}return h.slice(0,c)});case"isempty":{if(t.length<1)return[!0];try{return[o(e,t[0],r).length===0]}catch(f){if(f instanceof u)throw f;return[!0]}}case"isvalid":{if(t.length<1)return[!0];try{return[s(e,t[0],r).length>0]}catch(f){if(f instanceof u)throw f;return[!1]}}case"skip":return t.length<2?[]:s(e,t[0],r).flatMap(i=>{let c=i;if(c<0)throw new Error("skip doesn't support negative count");return s(e,t[1],r).slice(c)});case"until":{if(t.length<2)return[e];let f=e,i=r.limits.maxIterations;for(let c=0;c<i;c++){if(s(f,t[0],r).some(p))return[f];let a=s(f,t[1],r);if(a.length===0)return[f];f=a[0]}throw new u(`jq until: too many iterations (${i}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(t.length<2)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let h=0;h<c&&s(i,t[0],r).some(p);h++){f.push(i);let l=s(i,t[1],r);if(l.length===0)break;i=l[0]}if(f.length>=c)throw new u(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}case"repeat":{if(t.length===0)return[e];let f=[],i=e,c=r.limits.maxIterations;for(let h=0;h<c;h++){f.push(i);let a=s(i,t[0],r);if(a.length===0)break;i=a[0]}if(f.length>=c)throw new u(`jq repeat: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations");return f}default:return null}}var je="%Y-%m-%dT%H:%M:%SZ";function ae(e,n){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${n} timestamp is outside the supported range`);return new Date(e*1e3)}function Pe(e){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!n)return null;let[,t,r,s,o,p,u]=n.map(Number),f=Date.UTC(t,r-1,s,o,p,u);if(!Number.isFinite(f))return null;let i=new Date(f);return i.getUTCFullYear()!==t||i.getUTCMonth()!==r-1||i.getUTCDate()!==s||i.getUTCHours()!==o||i.getUTCMinutes()!==p||i.getUTCSeconds()!==u?null:i}function le(e,n,t,r,s){switch(n){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let o=ae(e,"gmtime"),p=o.getUTCFullYear(),u=o.getUTCMonth(),f=o.getUTCDate(),i=o.getUTCHours(),c=o.getUTCMinutes(),h=o.getUTCSeconds(),a=o.getUTCDay(),l=Date.UTC(p,0,1),y=Math.floor((o.getTime()-l)/(1440*60*1e3));return[[p,u,f,i,c,h,a,y]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[o,p,u,f=0,i=0,c=0]=e;if(typeof o!="number"||typeof p!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(o,p,u??1,f??0,i??0,c??0);return[Math.floor(h/1e3)]}case"strftime":{if(t.length===0)return[null];let p=s(e,t[0],r)[0];if(typeof p!="string")throw new Error("strftime/1 requires a string format");let u;if(typeof e=="number")u=ae(e,"strftime");else if(Array.isArray(e)){let[a,l,y,m=0,b=0,A=0]=e;if(typeof a!="number"||typeof l!="number")throw new Error("strftime/1 requires parsed datetime inputs");u=new Date(Date.UTC(a,l,y??1,m??0,b??0,A??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],c=(a,l=2)=>String(a).padStart(l,"0");return[p.replace(/%Y/g,String(u.getUTCFullYear())).replace(/%m/g,c(u.getUTCMonth()+1)).replace(/%d/g,c(u.getUTCDate())).replace(/%H/g,c(u.getUTCHours())).replace(/%M/g,c(u.getUTCMinutes())).replace(/%S/g,c(u.getUTCSeconds())).replace(/%A/g,f[u.getUTCDay()]).replace(/%B/g,i[u.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(t.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let p=s(e,t[0],r)[0];if(typeof p!="string")throw new Error("strptime/1 requires a string format");if(p!==je)throw new Error(`strptime format is not supported: ${p}`);let u=Pe(e);if(u){let f=u.getUTCFullYear(),i=u.getUTCMonth(),c=u.getUTCDate(),h=u.getUTCHours(),a=u.getUTCMinutes(),l=u.getUTCSeconds(),y=u.getUTCDay(),m=Date.UTC(f,0,1),b=Math.floor((u.getTime()-m)/(1440*60*1e3));return[[f,i,c,h,a,l,y,b]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let o=Pe(e);if(!o)throw new Error(`date "${e}" does not match format "${je}"`);return[Math.floor(o.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[ae(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var ze=2e3;function We(e){let n=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),o="";for(let p=r;p<s;p++)o+=String.fromCharCode(e[p]);n.push(o)}return n.join("")}function Xe(e){let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}function ye(e,n,t){switch(n){case"@base64":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"utf-8").toString("base64")];let r=new TextEncoder().encode(e);return[btoa(We(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=Xe(atob(e));return[new TextDecoder("utf-8",{fatal:!1}).decode(r)]}return[null];case"@uri":return typeof e=="string"?[encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof e=="string"?[decodeURIComponent(e)]:[null];case"@csv":return Array.isArray(e)?[e.map(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let o=String(s);return o.includes(",")||o.includes('"')||o.includes(`
|
|
4
|
-
`)||o.includes("\r")?`"${o.replace(/"/g,'""')}"`:o}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=t??ze;return B(e,r+1)>r?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}function me(e,n,t,r,s,o){switch(n){case"index":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){if(u===""&&e==="")return null;let f=e.indexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let i=0;i<=e.length-u.length;i++){let c=!0;for(let h=0;h<u.length;h++)if(!o(e[i+h],u[h])){c=!1;break}if(c)return i}return null}let f=e.findIndex(i=>o(i,u));return f>=0?f:null}return null});case"rindex":return t.length===0?[null]:s(e,t[0],r).map(u=>{if(typeof e=="string"&&typeof u=="string"){let f=e.lastIndexOf(u);return f>=0?f:null}if(Array.isArray(e)){if(Array.isArray(u)){for(let f=e.length-u.length;f>=0;f--){let i=!0;for(let c=0;c<u.length;c++)if(!o(e[f+c],u[c])){i=!1;break}if(i)return f}return null}for(let f=e.length-1;f>=0;f--)if(o(e[f],u))return f;return null}return null});case"indices":return t.length===0?[[]]:s(e,t[0],r).map(u=>{let f=[];if(typeof e=="string"&&typeof u=="string"){let i=e.indexOf(u);for(;i!==-1;)f.push(i),i=e.indexOf(u,i+1)}else if(Array.isArray(e))if(Array.isArray(u)){let i=u.length;if(i===0)for(let c=0;c<=e.length;c++)f.push(c);else for(let c=0;c<=e.length-i;c++){let h=!0;for(let a=0;a<i;a++)if(!o(e[c+a],u[a])){h=!1;break}h&&f.push(c)}}else for(let i=0;i<e.length;i++)o(e[i],u)&&f.push(i);return f});default:return null}}function de(e,n,t,r,s){switch(n){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=o[0],f=p[0];return typeof u!="number"||typeof f!="number"?[null]:[u**f]}case"atan2":{if(t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=o[0],f=p[0];return typeof u!="number"||typeof f!="number"?[null]:[Math.atan2(u,f)]}case"hypot":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.hypot(e,o)]}case"fma":{if(typeof e!="number"||t.length<2)return[null];let o=s(e,t[0],r)[0],p=s(e,t[1],r)[0];return[e*o+p]}case"copysign":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.sign(o)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e-Math.round(e/o)*o]}case"fdim":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(0,e-o)]}case"fmax":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.max(e,o)]}case"fmin":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[Math.min(e,o)]}case"ldexp":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"scalbn":case"scalbln":{if(typeof e!="number"||t.length===0)return[null];let o=s(e,t[0],r)[0];return[e*2**o]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let o=Math.floor(Math.log2(Math.abs(e)));return[e/2**o]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let o=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**o,o]]}return[null];case"modf":if(typeof e=="number"){let o=Math.trunc(e);return[[e-o,o]]}return[null];default:return null}}function V(e){let n=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:n}}function H(e){throw new g(e,"array_elements")}function ge(e,n){let t=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&t>Math.floor(n/r)&&H(`query combination limit exceeded (${n})`),t*=r}return t}function be(e,n,t,r,s,o,p,u){switch(n){case"recurse":{let f=[],i=V(r),c=t.length>=2?t[1]:null,h=[{value:e,depth:0}],a=0;for(;h.length>0;){let l=h.pop();if(!l)break;if(++a>i.maxIterations)throw new g(`query iteration limit exceeded (${i.maxIterations})`,"iterations");if(l.depth>i.maxDepth)throw new g(`query depth limit exceeded (${i.maxDepth})`,"recursion");if(c&&!s(l.value,c,r).some(o))continue;f.length>=i.maxResults&&H(`query result element limit exceeded (${i.maxResults})`),f.push(l.value);let y=[];t.length===0?Array.isArray(l.value)?y=l.value:l.value&&typeof l.value=="object"&&(y=Object.keys(l.value).map(m=>l.value[m])):y=s(l.value,t[0],r).filter(m=>m!=null),h.length>i.maxResults-y.length&&H(`query traversal queue limit exceeded (${i.maxResults})`);for(let m=y.length-1;m>=0;m--)h.push({value:y[m],depth:l.depth+1})}return f}case"recurse_down":return u(e,"recurse",t,r);case"walk":{if(t.length===0)return[e];let f=V(r),i=new WeakSet,c=new WeakMap,h=[{value:e,depth:0,expanded:!1}],a=e,l=0;for(;h.length>0;){let y=h.pop();if(!y)break;if(++l>f.maxIterations)throw new g(`query iteration limit exceeded (${f.maxIterations})`,"iterations");if(y.depth>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let m=y.value!==null&&typeof y.value=="object"?y.value:null;if(!y.expanded&&m){if(i.has(m))continue;i.add(m),h.push({...y,expanded:!0});let w=S(y.value),N=Array.isArray(y.value)?y.value:Object.keys(w??{}).map(O=>w?.[O]);h.length>f.maxResults-N.length&&H(`query traversal queue limit exceeded (${f.maxResults})`);for(let O=N.length-1;O>=0;O--)h.push({value:N[O],depth:y.depth+1,expanded:!1});continue}let b=y.value;if(Array.isArray(y.value))b=y.value.map(w=>w!==null&&typeof w=="object"?c.get(w)??w:w);else if(m){let w=Object.create(null),N=S(y.value);for(let O of Object.keys(N??{})){if(!k(O))continue;let $=N?.[O];E(w,O,$!==null&&typeof $=="object"?c.get($)??$:$)}b=w}let A=s(b,t[0],r)[0];m&&c.set(m,A),y.depth===0&&(a=A)}return[a]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let f=V(r),i=0;for(let h of e)Array.isArray(h)&&(i=Math.max(i,h.length));ge([e.length,i],f.maxResults);let c=[];for(let h=0;h<i;h++)c.push(e.map(a=>Array.isArray(a)?a[h]:null));return[c]}case"combinations":{if(t.length>0){let y=s(e,t[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(y)||!Number.isSafeInteger(y)||y<0)throw new Error("combinations length must be a finite non-negative integer");let m=V(r);if(y>m.maxDepth||y>m.maxResults)throw new g(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(y===0)return m.maxResults<1&&H("query combination limit exceeded (0)"),[[]];let b=ge(Array.from({length:y},()=>e.length),m.maxResults);if(b===0)return[];let A=[],w=new Array(y).fill(0);for(let N=0;N<b;N++){A.push(w.map(O=>e[O]));for(let O=y-1;O>=0&&(w[O]++,!(w[O]<e.length));O--)w[O]=0}return A}if(!Array.isArray(e))return[];if(e.length===0)return V(r).maxResults<1&&H("query combination limit exceeded (0)"),[[]];for(let l of e)if(!Array.isArray(l))return[];let f=V(r),i=e;if(i.length>f.maxDepth)throw new g(`query depth limit exceeded (${f.maxDepth})`,"recursion");let c=ge(i.map(l=>l.length),f.maxResults);if(c===0)return[];let h=[],a=new Array(i.length).fill(0);for(let l=0;l<c;l++){h.push(a.map((y,m)=>i[m][y]));for(let y=i.length-1;y>=0&&(a[y]++,!(a[y]<i[y].length));y--)a[y]=0}return h}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let f=r.currentPath;if(f.length===0)return[];let i=t.length>0?s(e,t[0],r)[0]:1;if(i>=0){if(i>f.length)return[];let c=f.slice(0,f.length-i);return[p(r.root,c)]}else{let c=-i-1;if(c>=f.length)return[e];let h=f.slice(0,c);return[p(r.root,h)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let f=r.currentPath,i=[];for(let c=f.length-1;c>=0;c--)i.push(p(r.root,f.slice(0,c)));return[i]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Ae=2e3;function T(e){return e.limits.maxArrayElements}function ee(e,n){let t=T(e);if(n>=t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ge(e,n){let t=n.limits.maxDepth??Ae;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements")}else if(typeof s!="string")throw new Error("stream path components must be strings or integers")}function we(e,n,t,r,s){switch(n){case"keys":return Array.isArray(e)?[e.map((o,p)=>p)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((o,p)=>p)]: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[x(e)];let o=e===null?"null":Array.isArray(e)?"array":typeof e,p=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${p}) only strings have UTF-8 byte length`)}case"to_entries":{let o=S(e);if(o){let p=Object.keys(o);if(p.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");return[p.map(u=>{let f=Object.create(null);return E(f,"key",u),E(f,"value",o[u]),f})]}return[null]}case"from_entries":if(Array.isArray(e)){let o=Object.create(null);for(let p of e){let u=S(p);if(u){let f=u.key??u.Key??u.name??u.Name??u.k,i=u.value??u.Value??u.v;if(f!==void 0){let c=String(f);k(c)&&E(o,c,i)}}}return[o]}return[null];case"with_entries":{if(t.length===0)return[e];let o=S(e);if(o){let p=Object.keys(o);if(p.length>T(r))throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");let u=[];for(let i of p){let c=Object.create(null);E(c,"key",i),E(c,"value",o[i]);let h=s(c,t[0],r);if(u.length>T(r)-h.length)throw new g(`query result element limit exceeded (${T(r)})`,"array_elements");for(let a of h)u.push(a)}let f=Object.create(null);for(let i of u){let c=S(i);if(c){let h=c.key??c.name??c.k,a=c.value??c.v;if(h!==void 0){let l=String(h);k(l)&&E(f,l,a)}}}return[f]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(t.length>0?s(e,t[0],r):[Number.POSITIVE_INFINITY]).map(p=>{let u=p;if(u<0)throw new Error("flatten depth must not be negative");return e.flat(u)}):[null];case"unique":if(Array.isArray(e)){let o=new Set,p=[];for(let u of e){let f=JSON.stringify(u);o.has(f)||(o.add(f),p.push(u))}return[p]}return[null];case"tojson":case"tojsonstream":{let o=r.limits.maxDepth??Ae;return B(e,o+1)>o?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let o=e.trim().toLowerCase();if(o==="nan")return[Number.NaN];if(o==="inf"||o==="infinity")return[Number.POSITIVE_INFINITY];if(o==="-inf"||o==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[Te(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(p){throw p instanceof g?p:new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let o=Number(e);if(Number.isNaN(o))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[o]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let o=e===null?"null":Array.isArray(e)?"array":typeof e,p=o==="array"||o==="object"?JSON.stringify(e):String(e);throw new Error(`${o} (${p}) cannot be parsed as a boolean`)}case"tostream":{let o=[],p=r.limits.maxDepth??Ae,u=[{value:e,path:[]}],f=new WeakSet,i=0;for(;u.length>0;){let c=u.pop();if(!c)break;if(++i>r.limits.maxIterations)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(c.path.length>p)throw new g(`query depth limit exceeded (${p})`,"recursion");let h=c.value;if(h===null||typeof h!="object")ee(r,o.length),o.push([c.path,h]);else if(Array.isArray(h)){if(f.has(h))throw new g("cyclic value cannot be converted to a stream","recursion");if(f.add(h),h.length===0)ee(r,o.length),o.push([c.path,[]]);else{if(u.length>T(r)-h.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let a=h.length-1;a>=0;a--)u.push({value:h[a],path:[...c.path,a]})}}else{if(f.has(h))throw new g("cyclic value cannot be converted to a stream","recursion");f.add(h);let a=Object.keys(h);if(a.length===0)ee(r,o.length),o.push([c.path,Object.create(null)]);else{if(u.length>T(r)-a.length)throw new g(`query traversal queue limit exceeded (${T(r)})`,"array_elements");for(let l=a.length-1;l>=0;l--){let y=a[l];u.push({value:h[y],path:[...c.path,y]})}}}}return ee(r,o.length),o.push([[]]),o}case"fromstream":{if(t.length===0)return[e];let o=s(e,t[0],r);if(o.length>T(r))throw new g(`query stream item limit exceeded (${T(r)})`,"array_elements");let p=null,u=0;for(let f of o){if(!Array.isArray(f)||f.length===1&&Array.isArray(f[0])&&f[0].length===0||f.length!==2)continue;let[i,c]=f;if(!Array.isArray(i))continue;if(Ge(i,r),i.length===0){p=c;continue}p===null&&(p=typeof i[0]=="number"?[]:Object.create(null));let h=p;for(let l=0;l<i.length-1;l++){let y=i[l],m=i[l+1];if(Array.isArray(h)&&typeof y=="number"){let b=y+1-h.length;if(b>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,b);h.length<=y;)h.push(null);h[y]===null&&(h[y]=typeof m=="number"?[]:Object.create(null)),h=h[y]}else{let b=S(h);if(b){let A=String(y);if(!k(A))continue;(b[A]===null||b[A]===void 0)&&E(b,A,typeof m=="number"?[]:Object.create(null)),h=b[A]}}}let a=i[i.length-1];if(Array.isArray(h)&&typeof a=="number"){let l=a+1-h.length;if(l>r.limits.maxIterations-u)throw new g(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(u+=Math.max(0,l);h.length<=a;)h.push(null);h[a]=c}else{let l=S(h);if(l){let y=String(a);k(y)&&E(l,y,c)}}}return[p]}case"truncate_stream":{let o=typeof e=="number"?Math.floor(e):0;if(t.length===0)return[];let p=[],u=s(e,t[0],r);for(let f of u)if(Array.isArray(f)){if(f.length===1&&Array.isArray(f[0])){let i=f[0];i.length>o&&p.push([i.slice(o)]);continue}if(f.length===2&&Array.isArray(f[0])){let i=f[0],c=f[1];i.length>o&&p.push([i.slice(o),c])}}return p}default:return null}}function $e(e,n){if(!Array.isArray(e))throw new Error("path must be an array");let t=n.limits.maxDepth;if(e.length>t)throw new g(`query depth limit exceeded (${t})`,"recursion");let r=n.limits.maxArrayElements,s=0;for(let o of e)if(typeof o=="number"){if(!Number.isSafeInteger(o)||o<0||o>=r)throw new g(`query array index limit exceeded (${r})`,"array_elements");let p=o+1;if(s>r-p)throw new g(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=p}else if(typeof o!="string")throw new Error("path components must be strings or integers");return R(n,s+e.length),e}function Le(e,n,t){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let o=s.pop();if(!o)break;if(R(n),o.path.length>n.limits.maxDepth)throw new g(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(!(o.value!==null&&typeof o.value=="object")){(t||!o.isRoot)&&(D(n,r.length),r.push(o.path));continue}!t&&!o.isRoot&&(D(n,r.length),r.push(o.path));let u=Array.isArray(o.value)?o.value.map((f,i)=>[i,f]):Object.keys(o.value).map(f=>[f,o.value[f]]);D(n,r.length,s.length+u.length);for(let f=u.length-1;f>=0;f--){let[i,c]=u[f],h=[...o.path,i];s.push({value:c,path:h,isRoot:!1})}}return r}function Ee(e,n,t,r,s,o,p,u,f,i){switch(n){case"getpath":{if(t.length===0)return[null];let c=s(e,t[0],r),h=[];for(let a of c){let l=a,y=e;for(let m of l){if(y==null){y=null;break}if(Array.isArray(y)&&typeof m=="number")y=y[m];else if(typeof m=="string"){let b=S(y);if(!b||!Object.hasOwn(b,m)){y=null;break}y=b[m]}else{y=null;break}}h.push(y)}return h}case"setpath":{if(t.length<2)return[null];let c=s(e,t[0],r),h=$e(c[0],r),l=s(e,t[1],r)[0];return[p(e,h,l)]}case"delpaths":{if(t.length===0)return[e];let h=s(e,t[0],r)[0],a=e;for(let l of h.sort((y,m)=>m.length-y.length))a=u(a,l);return[a]}case"path":{if(t.length===0)return[[]];let c=[];return i(e,t[0],r,[],c),c}case"del":return t.length===0?[e]:[f(e,t[0],r)];case"pick":{if(t.length===0)return[null];let c=[];for(let a of t)i(e,a,r,[],c);let h=null;for(let a of c){for(let y of a)if(typeof y=="number"&&y<0)throw new Error("Out of bounds negative array index");$e(a,r);let l=e;for(let y of a){if(l==null)break;if(Array.isArray(l)&&typeof y=="number")l=l[y];else if(typeof y=="string"){let m=S(l);if(!m||!Object.hasOwn(m,y)){l=null;break}l=m[y]}else{l=null;break}}h=p(h,a,l)}return[h]}case"paths":{let c=Le(e,r,!1);return t.length>0?c.filter(h=>{let a=e;for(let y of h)if(Array.isArray(a)&&typeof y=="number")a=a[y];else if(typeof y=="string"){let m=S(a);if(!m||!Object.hasOwn(m,y))return!1;a=m[y]}else return!1;return s(a,t[0],r).some(o)}):c}case"leaf_paths":return Le(e,r,!0);default:return null}}function ke(e,n,t,r,s,o){switch(n){case"IN":{if(t.length===0)return[!1];if(t.length===1){let i=s(e,t[0],r);for(let c of i)if(o(e,c))return[!0];return[!1]}let p=s(e,t[0],r),u=s(e,t[1],r),f=new Set(u.map(i=>JSON.stringify(i)));for(let i of p)if(f.has(JSON.stringify(i)))return[!0];return[!1]}case"INDEX":{if(t.length===0)return[Object.create(null)];if(t.length===1){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let h=String(c);k(h)&&E(i,h,c)}return[i]}if(t.length===2){let f=s(e,t[0],r),i=Object.create(null);for(let c of f){let h=s(c,t[1],r);if(h.length>0){let a=String(h[0]);k(a)&&E(i,a,c)}}return[i]}let p=s(e,t[0],r),u=Object.create(null);for(let f of p){let i=s(f,t[1],r),c=s(f,t[2],r);if(i.length>0&&c.length>0){let h=String(i[0]);k(h)&&E(u,h,c[0])}}return[u]}case"JOIN":{if(t.length<2)return[null];let p=S(s(e,t[0],r)[0]);if(!p)return[null];if(!Array.isArray(e))return[null];let u=[];for(let f of e){let i=s(f,t[1],r),c=i.length>0?String(i[0]):"",h=_(p,c)?p[c]:null;u.push([f,h])}return[u]}default:return null}}function Be(e){return e.limits.maxArrayElements}function _e(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function U(e,n){let t=Be(e);if(!Number.isSafeInteger(n)||n<0||n>t)throw new g(`query result element limit exceeded (${t})`,"array_elements")}function Ze(e,n,t){if(e==="")return n===""?0:1;if(n==="")return e.length;let r=1,s=0;for(;;){let o=e.indexOf(n,s);if(o<0||(r++,r>t))return r;s=o+n.length}}function Se(e,n,t,r,s){switch(n){case"join":{if(!Array.isArray(e))return[null];let o=t.length>0?s(e,t[0],r):[""];for(let p of e)if(Array.isArray(p)||p!==null&&typeof p=="object")throw new Error("cannot join: contains arrays or objects");return U(r,o.length),o.map(p=>{let u=String(p),f=0;for(let i=0;i<e.length;i++){let c=e[i]===null?"":typeof e[i]=="string"?e[i]:String(e[i]);if(f+=x(c),i>0&&(f+=x(u)),f>_e(r))throw new g(`query string size limit exceeded (${_e(r)} bytes)`,"string_length")}return e.map(i=>i===null?"":typeof i=="string"?i:String(i)).join(u)})}case"split":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);return U(r,Ze(e,p,Be(r))),[e.split(p)]}case"splits":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"g",f=j(p,u.includes("g")?u:`${u}g`),i=1;for(let h of f.matchAll(e))i+=Math.max(1,h.length),U(r,i);let c=f.split(e);return U(r,c.length),c}catch(u){if(u instanceof g)throw u;return[]}}case"scan":{if(typeof e!="string"||t.length===0)return[];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",f=j(p,u.includes("g")?u:`${u}g`),i=[];for(let c of f.matchAll(e))U(r,i.length+1),c.length>1?(U(r,c.length-1),i.push(c.slice(1))):i.push(c[0]);return i}catch(u){if(u instanceof g)throw u;return[]}}case"test":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"";return[j(p,u).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(p,`${u}d`).exec(e);if(!i)return[];let c=i.indices;return[{offset:i.index,length:i[0].length,string:i[0],captures:i.slice(1).map((h,a)=>({offset:c?.[a+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||t.length===0)return[null];let o=s(e,t[0],r),p=String(o[0]);try{let u=t.length>1?String(s(e,t[1],r)[0]):"",i=j(p,u).match(e);return!i||!i.groups?[Object.create(null)]:[i.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=String(o[0]),f=String(p[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"";return[j(u,i).replace(e,f)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||t.length<2)return[null];let o=s(e,t[0],r),p=s(e,t[1],r),u=String(o[0]),f=String(p[0]);try{let i=t.length>2?String(s(e,t[2],r)[0]):"g",c=i.includes("g")?i:`${i}g`;return[j(u,c).replace(e,f)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,o=>String.fromCharCode(o.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,o=>String.fromCharCode(o.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);return[e.startsWith(p)?e.slice(p.length):e]}case"rtrimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);return p===""?[e]:[e.endsWith(p)?e.slice(0,-p.length):e]}case"trimstr":{if(typeof e!="string"||t.length===0)return[e];let o=s(e,t[0],r),p=String(o[0]);if(p==="")return[e];let u=e;return u.startsWith(p)&&(u=u.slice(p.length)),u.endsWith(p)&&(u=u.slice(0,-p.length)),[u]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.startsWith(String(o[0]))]}case"endswith":{if(typeof e!="string"||t.length===0)return[!1];let o=s(e,t[0],r);return[e.endsWith(String(o[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let o=0;for(let p of e)o++,U(r,o);return[Array.from(e).map(p=>p.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(u=>{if(typeof u=="string")throw new Error(`string (${JSON.stringify(u)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof u!="number"||Number.isNaN(u))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let f=Math.trunc(u);return f<0||f>1114111||f>=55296&&f<=57343?String.fromCodePoint(65533):String.fromCodePoint(f)}).join("")];default:return null}}function Oe(e,n){switch(n){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function te(e,n,t){if(n.length===0)return t;let[r,...s]=n;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let i=Array.isArray(e)?[...e]:[];for(;i.length<=r;)i.push(null);return i[r]=te(i[r],s,t),i}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!k(r))return e??Object.create(null);let o=S(e),p=o?C(o):Object.create(null),u=Object.hasOwn(p,r)?p[r]:void 0;return E(p,r,te(u,s,t)),p}function re(e,n){if(n.length===0)return null;if(n.length===1){let s=n[0];if(Array.isArray(e)&&typeof s=="number"){let o=[...e];return o.splice(s,1),o}if(e&&typeof e=="object"&&!Array.isArray(e)){let o=String(s);if(!k(o))return e;let p=C(e);return delete p[o],p}return e}let[t,...r]=n;if(Array.isArray(e)&&typeof t=="number"){let s=[...e];return s[t]=re(s[t],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(t);if(!k(s))return e;let o=C(e);return Object.hasOwn(o,s)&&E(o,s,re(o[s],r)),o}return e}var Q=class e extends Error{label;partialResults;constructor(n,t=[]){super(`break ${n}`),this.label=n,this.partialResults=t,this.name="BreakError"}withPrependedResults(n){return new e(this.label,[...n,...this.partialResults])}},ie=class extends Error{value;constructor(n){super(typeof n=="string"?n:JSON.stringify(n)),this.value=n,this.name="JqError"}},ve=1e4,Ue=10*1024*1024,Ke=2e3,et=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function F(e,n){return new g(e,n)}function R(e,n=1){if(!Number.isSafeInteger(n)||n<0||e.budget.operations>e.limits.maxIterations-n)throw F(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=n}function D(e,n,t=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(t)||n<0||t<0||n>r-t)throw F(`query result element limit exceeded (${r})`,"array_elements")}function q(e,n,t){D(e,n.length,t.length);for(let r of t)n.push(r)}function M(e,n,t){let r=[];for(let s of n){R(e);let o=t(s);q(e,r,o)}return r}function tt(e){let n=new Map;if(e?.namedArgs)for(let[t,r]of e.namedArgs)n.set(`$${t}`,r);return{vars:n,limits:{maxIterations:e?.limits?.maxIterations??ve,maxDepth:e?.limits?.maxDepth??Ke,maxStringLength:e?.limits?.maxStringLength??Ue,maxOutputSize:e?.limits?.maxOutputSize??Ue,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,namedArgs:e?.namedArgs,positionalArgs:e?.positionalArgs,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function se(e,n,t){let r=new Map(e.vars);return r.set(n,t),{vars:r,limits:e.limits,env:e.env,namedArgs:e.namedArgs,positionalArgs:e.positionalArgs,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function W(e,n,t){switch(n.type){case"var":return se(e,n.name,t);case"array":{if(!Array.isArray(t))return null;let r=e;for(let s=0;s<n.elements.length;s++){let o=n.elements[s],p=s<t.length?t[s]:null,u=W(r,o,p);if(u===null)return null;r=u}return r}case"object":{let r=S(t);if(!r)return null;let s=e;for(let o of n.fields){let p;if(typeof o.key=="string")p=o.key;else{let i=d(t,o.key,e);if(i.length===0)return null;p=String(i[0])}let u=_(r,p)?r[p]:null;o.keyVar&&(s=se(s,o.keyVar,u));let f=W(s,o.pattern,u);if(f===null)return null;s=f}return s}}}function rt(e,n){let t=e;for(let r of n)if(t&&typeof t=="object")if(Array.isArray(t))if(typeof r=="number")t=t[r];else return;else{let s=S(t);if(s&&typeof r=="string"&&Object.hasOwn(s,r))t=s[r];else return}else return;return t}function P(e){if(e.type==="Identity")return[];if(e.type==="Field"){let n=e.base?P(e.base):[];return n===null?null:[...n,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let n=e.base?P(e.base):[];if(n===null)return null;let t=e.index.value;return typeof t=="number"||typeof t=="string"?[...n,t]:null}if(e.type==="Pipe"){let n=P(e.left);return n===null?null:Ne(n,e.right)}if(e.type==="Call"){if(e.name==="parent"||e.name==="root")return null;if(e.name==="first"&&e.args.length===0)return[0];if(e.name==="last"&&e.args.length===0)return[-1]}return null}function Ne(e,n){if(n.type==="Call"){if(n.name==="parent"){let t=1;if(n.args.length>0&&n.args[0].type==="Literal"){let r=n.args[0].value;typeof r=="number"&&(t=r)}if(t>=0)return e.slice(0,Math.max(0,e.length-t));{let r=-t-1;return e.slice(0,Math.min(r,e.length))}}if(n.name==="root")return[]}if(n.type==="Field"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Index"&&n.index.type==="Literal"){let t=P(n);if(t!==null)return[...e,...t]}if(n.type==="Pipe"){let t=Ne(e,n.left);return t===null?null:Ne(t,n.right)}return n.type==="Identity"?e:null}function qe(e,n,t){if(n.type==="Comma"){let r=[];try{let s=d(e,n.left,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=d(e,n.right,t);q(t,r,s)}catch(s){if(s instanceof g)throw s;return r}return r}return d(e,n,t)}function d(e,n,t){let r=t&&"vars"in t?t:tt(t);if(r.defenseContextChecked||(Ie(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),R(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,F(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=nt(e,n,r);return D(r,0,s.length),s}finally{r.budget.callDepth--}}function nt(e,n,t){switch(t.coverage?.hit(`jq:node:${n.type}`),n.type){case"Identity":return[e];case"Field":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{let o=S(s);if(o){if(!Object.hasOwn(o,n.name))return[null];let u=o[n.name];return[u===void 0?null:u]}if(s===null)return[null];let p=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${p} with string "${n.name}"`)})}case"Index":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{let o=d(s,n.index,t);return M(t,o,p=>{if(typeof p=="number"&&Array.isArray(s)){if(Number.isNaN(p))return[null];let u=Math.trunc(p),f=u<0?s.length+u:u;return f>=0&&f<s.length?[s[f]]:[null]}if(typeof p=="string"){let u=S(s);return!u||!Object.hasOwn(u,p)?[null]:[u[p]]}return[null]})})}case"Slice":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>{if(s===null)return[null];if(!Array.isArray(s)&&typeof s!="string")throw new Error(`Cannot slice ${typeof s} (${JSON.stringify(s)})`);let o=s.length,p=n.start?d(e,n.start,t):[0],u=n.end?d(e,n.end,t):[o];return D(t,0,p.length*u.length),M(t,p,f=>u.map(i=>{let c=f,h=i,a=Number.isNaN(c)?0:Number.isInteger(c)?c:Math.floor(c),l=Number.isNaN(h)?o:Number.isInteger(h)?h:Math.ceil(h),y=Fe(a,o),m=Fe(l,o);return Array.isArray(s),s.slice(y,m)}))})}case"Iterate":{let r=n.base?d(e,n.base,t):[e];return M(t,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=d(e,n.left,t),s=P(n.left),o=[];for(let p of r)try{if(s!==null){let u={...t,currentPath:[...t.currentPath??[],...s]},f=d(p,n.right,u);q(t,o,f)}else{let u=d(p,n.right,t);q(t,o,u)}}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Comma":{let r=d(e,n.left,t),s=d(e,n.right,t);return D(t,r.length,s.length),[...r,...s]}case"Literal":return[n.value];case"Array":return n.elements?[d(e,n.elements,t)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of n.entries){let o=typeof s.key=="string"?[s.key]:d(e,s.key,t),p=d(e,s.value,t),u=[],f=o.filter(h=>typeof h=="string"&&k(h)).length,i=f+(o.length-f),c=r.length*i*p.length;D(t,0,c);for(let h of r)for(let a of o){if(typeof a!="string"){let l=a===null?"null":Array.isArray(a)?"array":typeof a;throw new Error(`Cannot use ${l} (${JSON.stringify(a)}) as object key`)}if(!k(a)){for(let l of p)u.push(C(h));continue}for(let l of p){let y=C(h);E(y,a,l),u.push(y)}}r.length=0,q(t,r,u)}return r}case"Paren":return d(e,n.expr,t);case"BinaryOp":return ot(e,n.op,n.left,n.right,t);case"UnaryOp":return d(e,n.operand,t).map(s=>{if(n.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let o=p=>p.length>5?`"${p.slice(0,3)}...`:JSON.stringify(p);throw new Error(`string (${o(s)}) cannot be negated`)}return null}return n.op==="not"?!I(s):null});case"Cond":{let r=d(e,n.cond,t);return M(t,r,s=>{if(I(s))return d(e,n.then,t);for(let o of n.elifs)if(d(e,o.cond,t).some(I))return d(e,o.then,t);return n.else?d(e,n.else,t):[e]})}case"Try":try{return d(e,n.body,t)}catch(r){if(r instanceof g)throw r;if(n.catch){let s=r instanceof ie?r.value:r instanceof Error?r.message:String(r);return d(s,n.catch,t)}return[]}case"Call":return Je(e,n.name,n.args,t);case"VarBind":{let r=d(e,n.value,t);return M(t,r,s=>{let o=null,p=[];if(n.pattern?p.push(n.pattern):n.name&&p.push({type:"var",name:n.name}),n.alternatives)for(let u of n.alternatives)p.push(u);for(let u of p)if(o=W(t,u,s),o!==null)break;return o===null?[]:d(e,n.body,o)})}case"VarRef":{if(n.name==="$ENV")return[t.env?ue(t.env):Object.create(null)];if(n.name==="$ARGS"){let s=Object.create(null);if(t.namedArgs)for(let[p,u]of t.namedArgs)Object.defineProperty(s,p,{value:u,enumerable:!0,writable:!0,configurable:!0});let o=Object.create(null);return o.positional=t.positionalArgs?[...t.positionalArgs]:[],o.named=s,[o]}let r=t.vars.get(n.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,o=[{val:e,depth:0}];for(;o.length>0;){let p=o.pop();if(!p)break;let{val:u,depth:f}=p;if(R(t),f>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(u&&typeof u=="object"){if(s.has(u))continue;s.add(u)}if(D(t,r.length),r.push(u),Array.isArray(u))for(let i=u.length-1;i>=0;i--)o.push({val:u[i],depth:f+1});else if(u&&typeof u=="object"){let i=Object.keys(u);for(let c=i.length-1;c>=0;c--)o.push({val:u[i[c]],depth:f+1})}}return r}case"Optional":try{return d(e,n.expr,t)}catch(r){if(r instanceof g)throw r;return[]}case"StringInterp":{let r=new G(t.limits.maxStringLength,"query string interpolation",()=>new g(`string size limit exceeded (${t.limits.maxStringLength} bytes)`,"string_length"));for(let s of n.parts){if(typeof s=="string"){r.append(s);continue}let o=d(e,s,t);for(let p of o){if(R(t),B(p,t.limits.maxDepth+1)>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");r.append(typeof p=="string"?p:JSON.stringify(p))}}return[r.build()]}case"UpdateOp":return[it(e,n.path,n.op,n.value,t)];case"Reduce":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=t.limits.maxDepth??Ke;for(let p of r){let u;if(n.pattern){if(u=W(t,n.pattern,p),u===null)continue}else u=se(t,n.varName,p);if(s=d(s,n.update,u)[0],B(s,o+1)>o)return[null]}return[s]}case"Foreach":{let r=d(e,n.expr,t),s=d(e,n.init,t)[0],o=[];for(let p of r)try{let u;if(n.pattern){if(u=W(t,n.pattern,p),u===null)continue}else u=se(t,n.varName,p);if(s=d(s,n.update,u)[0],n.extract){let f=d(s,n.extract,u);q(t,o,f)}else D(t,o.length),o.push(s)}catch(u){throw u instanceof Q?u.withPrependedResults(o):u}return o}case"Label":try{return d(e,n.body,{...t,labels:new Set([...t.labels??[],n.name])})}catch(r){if(r instanceof Q&&r.label===n.name)return r.partialResults;throw r}case"Break":throw new Q(n.name);case"Def":{let r=new Map(t.funcs??[]),s=`${n.name}/${n.params.length}`;r.set(s,{params:n.params,body:n.funcBody,closure:new Map(t.funcs??[])});let o={...t,funcs:r};return d(e,n.body,o)}default:{let r=n;throw new Error(`Unknown AST node type: ${r.type}`)}}}function Fe(e,n){return e<0?Math.max(0,n+e):Math.min(e,n)}function it(e,n,t,r,s){function o(f,i){switch(t){case"=":return i;case"|=":return d(f,r,s)[0]??null;case"+=":return typeof f=="number"&&typeof i=="number"||typeof f=="string"&&typeof i=="string"?f+i:Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"?ce(f,i):i;case"-=":return typeof f=="number"&&typeof i=="number"?f-i:f;case"*=":return typeof f=="number"&&typeof i=="number"?f*i:f;case"/=":return typeof f=="number"&&typeof i=="number"?f/i:f;case"%=":return typeof f=="number"&&typeof i=="number"?f%i:f;case"//=":return f===null||f===!1?i:f;default:return i}}function p(f,i,c){switch(i.type){case"Identity":return c(f);case"Field":{if(!k(i.name))return f;if(i.base)return p(f,i.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let a=C(h),l=Object.hasOwn(a,i.name)?a[i.name]:void 0;return E(a,i.name,c(l)),a}return h});if(f&&typeof f=="object"&&!Array.isArray(f)){let h=C(f),a=Object.hasOwn(h,i.name)?h[i.name]:void 0;return E(h,i.name,c(a)),h}return f}case"Index":{let a=d(e,i.index,s)[0];if(typeof a=="number"&&Number.isNaN(a))throw new Error("Cannot set array element at NaN index");if(typeof a=="number"&&!Number.isFinite(a))throw new Error("array index must be finite");if(typeof a=="number"&&!Number.isInteger(a)&&(a=Math.trunc(a)),i.base)return p(f,i.base,l=>{if(typeof a=="number"&&Array.isArray(l)){let y=[...l],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=l.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(typeof a=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(a))return l;let y=C(l),m=Object.hasOwn(y,a)?y[a]:void 0;return E(y,a,c(m)),y}return l});if(typeof a=="number"){if(!Number.isSafeInteger(a)||a>536870911)throw new Error("Array index too large");if(a<0&&(!f||!Array.isArray(f)))throw new Error("Out of bounds negative array index");if(Array.isArray(f)){let y=[...f],m=a<0?y.length+a:a;if(m>=0){D(s,0,m+1),y.length<=m&&(y.length=m+1);for(let b=f.length;b<m;b++)y[b]=null;y[m]=c(y[m])}return y}if(f==null){D(s,0,a+1);let y=new Array(a+1).fill(null);return y[a]=c(null),y}return f}if(typeof a=="string"&&f&&typeof f=="object"&&!Array.isArray(f)){if(!k(a))return f;let l=C(f),y=Object.hasOwn(l,a)?l[a]:void 0;return E(l,a,c(y)),l}return f}case"Iterate":{let h=a=>{if(Array.isArray(a)){D(s,0,a.length);let l=[];for(let y of a)R(s),l.push(c(y));return l}if(a&&typeof a=="object"){let l=Object.create(null);for(let[y,m]of Object.entries(a))k(y)&&E(l,y,c(m));return l}return a};return i.base?p(f,i.base,h):h(f)}case"Pipe":{let h=p(f,i.left,a=>a);return p(h,i.right,c)}default:return c(f)}}return p(e,n,f=>{if(t==="|=")return o(f,f);let i=d(e,r,s);return o(f,i[0]??null)})}function st(e,n,t){function r(o,p,u){switch(p.type){case"Identity":return u;case"Field":{if(!k(p.name))return o;if(p.base){let f=d(o,p.base,t)[0],i=r(f,{type:"Field",name:p.name},u);return r(o,p.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){let f=C(o);return E(f,p.name,u),f}return o}case"Index":{if(p.base){let c=d(o,p.base,t)[0],h=r(c,{type:"Index",index:p.index},u);return r(o,p.base,h)}let i=d(e,p.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],h=i<0?c.length+i:i;return h>=0&&h<c.length&&(c[h]=u),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return E(c,i,u),c}return o}default:return o}}function s(o,p){switch(p.type){case"Identity":return null;case"Field":{if(!k(p.name))return o;if(p.base){let f=d(o,p.base,t)[0];if(f==null)return o;let i=s(f,{type:"Field",name:p.name});return r(o,p.base,i)}if(o&&typeof o=="object"&&!Array.isArray(o)){if(!k(p.name))return o;let f=C(o);return delete f[p.name],f}return o}case"Index":{if(p.base){let c=d(o,p.base,t)[0];if(c==null)return o;let h=s(c,{type:"Index",index:p.index});return r(o,p.base,h)}let i=d(e,p.index,t)[0];if(typeof i=="number"&&Array.isArray(o)){let c=[...o],h=i<0?c.length+i:i;return h>=0&&h<c.length&&c.splice(h,1),c}if(typeof i=="string"&&o&&typeof o=="object"&&!Array.isArray(o)){if(!k(i))return o;let c=C(o);return delete c[i],c}return o}case"Iterate":return Array.isArray(o)?[]:o&&typeof o=="object"?Object.create(null):o;case"Pipe":{let c=function(l,y,m){switch(y.type){case"Identity":return m;case"Field":{if(!k(y.name))return l;if(l&&typeof l=="object"&&!Array.isArray(l)){let b=C(l);return E(b,y.name,m),b}return l}case"Index":{let A=d(e,y.index,t)[0];if(typeof A=="number"&&Array.isArray(l)){let w=[...l],N=A<0?w.length+A:A;return N>=0&&N<w.length&&(w[N]=m),w}if(typeof A=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!k(A))return l;let w=C(l);return E(w,A,m),w}return l}case"Pipe":{let b=d(l,y.left,t)[0],A=c(b,y.right,m);return c(l,y.left,A)}default:return l}};var u=c;let f=p.left,i=p.right,h=d(o,f,t)[0];if(h==null)return o;let a=s(h,i);return c(o,f,a)}default:return o}}return s(e,n)}function ot(e,n,t,r,s){if(n==="and"){let f=d(e,t,s);return M(s,f,i=>{if(!I(i))return[!1];let c=d(e,r,s);return M(s,c,h=>[I(h)])})}if(n==="or"){let f=d(e,t,s);return M(s,f,i=>{if(I(i))return[!0];let c=d(e,r,s);return M(s,c,h=>[I(h)])})}if(n==="//"){let i=d(e,t,s).filter(c=>c!=null&&c!==!1);return i.length>0?i:d(e,r,s)}let o=d(e,t,s),p=d(e,r,s),u=o.length*p.length;return D(s,0,u),R(s,u),o.flatMap(f=>p.map(i=>{switch(n){case"+":if(f===null)return i;if(i===null)return f;if(typeof f=="number"&&typeof i=="number")return f+i;if(typeof f=="string"&&typeof i=="string"){let c=s.limits.maxStringLength;if(x(f)+x(i)>c)throw new g(`string size limit exceeded (${c} bytes)`,"string_length");return f+i}return Array.isArray(f)&&Array.isArray(i)?(D(s,f.length,i.length),[...f,...i]):f&&i&&typeof f=="object"&&typeof i=="object"&&!Array.isArray(f)&&!Array.isArray(i)?ce(f,i):null;case"-":if(typeof f=="number"&&typeof i=="number")return f-i;if(Array.isArray(f)&&Array.isArray(i)){let c=new Set(i.map(h=>JSON.stringify(h)));return f.filter(h=>!c.has(JSON.stringify(h)))}if(typeof f=="string"&&typeof i=="string"){let c=h=>h.length>10?`"${h.slice(0,10)}...`:JSON.stringify(h);throw new Error(`string (${c(f)}) and string (${c(i)}) cannot be subtracted`)}return null;case"*":if(typeof f=="number"&&typeof i=="number")return f*i;if(typeof f=="string"&&typeof i=="number"){if(!Number.isFinite(i))throw new Error(`invalid string repetition count: ${i}`);let c=Math.trunc(i);if(c<0)return null;let h=x(f),a=s.limits.maxStringLength;if(h>0&&c>Math.floor(a/h))throw new g(`string size limit exceeded (${a} bytes)`,"string_length");return f.repeat(c)}{let c=S(f),h=S(i);if(c&&h)return xe(c,h,{maxDepth:s.limits.maxDepth,visit:()=>R(s)})}return null;case"/":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided because the divisor is zero`);return f/i}return typeof f=="string"&&typeof i=="string"?f.split(i):null;case"%":if(typeof f=="number"&&typeof i=="number"){if(i===0)throw new Error(`number (${f}) and number (${i}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(f)&&!Number.isNaN(f)?!Number.isFinite(i)&&!Number.isNaN(i)&&f<0&&i>0?-1:0:f%i}return null;case"==":return J(f,i);case"!=":return!J(f,i);case"<":return Y(f,i)<0;case"<=":return Y(f,i)<=0;case">":return Y(f,i)>0;case">=":return Y(f,i)>=0;default:return null}}))}function Je(e,n,t,r){let s=et.get(n);if(s)return typeof e=="number"?[s(e)]:[null];let o=de(e,n,t,r,d);if(o!==null)return o;let p=Se(e,n,t,r,d);if(p!==null)return p;let u=le(e,n,t,r,d);if(u!==null)return u;let f=ye(e,n,r.limits.maxDepth);if(f!==null)return f;let i=Oe(e,n);if(i!==null)return i;let c=we(e,n,t,r,d);if(c!==null)return c;let h=pe(e,n,t,r,d,qe,Z,I,v,g);if(h!==null)return h;let a=Ee(e,n,t,r,d,I,te,re,st,ne);if(a!==null)return a;let l=me(e,n,t,r,d,J);if(l!==null)return l;let y=he(e,n,t,r,d,qe,I,g);if(y!==null)return y;let m=be(e,n,t,r,d,I,rt,Je);if(m!==null)return m;let b=ke(e,n,t,r,d,J);if(b!==null)return b;switch(n){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let A=t.length>0?d(e,t[0],r)[0]:e;throw new ie(A)}case"env":return[r.env?ue(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let A=`${n}/${t.length}`,w=r.funcs?.get(A);if(w){let N=w.closure??r.funcs??new Map,O=new Map(N);O.set(A,w);for(let X=0;X<w.params.length;X++){let Ye=w.params[X],Re=t[X];if(Re){let L=d(e,Re,r),K;if(L.length===0)K={type:"Call",name:"empty",args:[]};else if(L.length===1)K={type:"Literal",value:L[0]};else{K={type:"Literal",value:L[L.length-1]};for(let fe=L.length-2;fe>=0;fe--)K={type:"Comma",left:{type:"Literal",value:L[fe]},right:K}}O.set(`${Ye}/0`,{params:[],body:K})}}let $={...r,funcs:O};return d(e,w.body,$)}throw new Error(`Unknown function: ${n}`)}}}function ne(e,n,t,r,s){if(R(t),r.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");let o=f=>{if(f.length>t.limits.maxDepth)throw F(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");D(t,s.length),s.push(f)};if(n.type==="Comma"){let f=n;ne(e,f.left,t,r,s),ne(e,f.right,t,r,s);return}let p=P(n);if(p!==null){o([...r,...p]);return}if(n.type==="Iterate"){if(Array.isArray(e))for(let f=0;f<e.length;f++)R(t),o([...r,f]);else if(e&&typeof e=="object")for(let f of Object.keys(e))R(t),o([...r,f]);return}if(n.type==="Recurse"){let f=[{value:e,path:[]}];for(;f.length>0;){let i=f.pop();if(!i)break;if(R(t),o([...r,...i.path]),i.value&&typeof i.value=="object"){let c=Array.isArray(i.value)?i.value.map((h,a)=>[a,h]):Object.keys(i.value).map(h=>[h,i.value[h]]);D(t,0,f.length+c.length);for(let h=c.length-1;h>=0;h--){let[a,l]=c[h];f.push({value:l,path:[...i.path,a]})}}}return}if(n.type==="Pipe"){let f=P(n.left);if(f!==null){let i=d(e,n.left,t);for(let c of i)ne(c,n.right,t,[...r,...f],s);return}}d(e,n,t).length>0&&o(r)}var Ve=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),oe=new Set(Ve.values());function He(e){let n=[],t=0,r=(i=0)=>e[t+i],s=()=>e[t++],o=()=>t>=e.length,p=i=>i>="0"&&i<="9",u=i=>i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="_",f=i=>u(i)||p(i);for(;!o();){let i=t,c=s();if(!(c===" "||c===" "||c===`
|
|
5
|
-
`||c==="\r")){if(c==="#"){for(;!o()&&r()!==`
|
|
6
|
-
`;)s();continue}if(c==="."&&r()==="."){s(),n.push({type:"DOTDOT",pos:i});continue}if(c==="="&&r()==="="){s(),n.push({type:"EQ",pos:i});continue}if(c==="!"&&r()==="="){s(),n.push({type:"NE",pos:i});continue}if(c==="<"&&r()==="="){s(),n.push({type:"LE",pos:i});continue}if(c===">"&&r()==="="){s(),n.push({type:"GE",pos:i});continue}if(c==="/"&&r()==="/"){s(),r()==="="?(s(),n.push({type:"UPDATE_ALT",pos:i})):n.push({type:"ALT",pos:i});continue}if(c==="+"&&r()==="="){s(),n.push({type:"UPDATE_ADD",pos:i});continue}if(c==="-"&&r()==="="){s(),n.push({type:"UPDATE_SUB",pos:i});continue}if(c==="*"&&r()==="="){s(),n.push({type:"UPDATE_MUL",pos:i});continue}if(c==="/"&&r()==="="){s(),n.push({type:"UPDATE_DIV",pos:i});continue}if(c==="%"&&r()==="="){s(),n.push({type:"UPDATE_MOD",pos:i});continue}if(c==="="&&r()!=="="){n.push({type:"ASSIGN",pos:i});continue}if(c==="."){n.push({type:"DOT",pos:i});continue}if(c==="|"){r()==="="?(s(),n.push({type:"UPDATE_PIPE",pos:i})):n.push({type:"PIPE",pos:i});continue}if(c===","){n.push({type:"COMMA",pos:i});continue}if(c===":"){n.push({type:"COLON",pos:i});continue}if(c===";"){n.push({type:"SEMICOLON",pos:i});continue}if(c==="("){n.push({type:"LPAREN",pos:i});continue}if(c===")"){n.push({type:"RPAREN",pos:i});continue}if(c==="["){n.push({type:"LBRACKET",pos:i});continue}if(c==="]"){n.push({type:"RBRACKET",pos:i});continue}if(c==="{"){n.push({type:"LBRACE",pos:i});continue}if(c==="}"){n.push({type:"RBRACE",pos:i});continue}if(c==="?"){n.push({type:"QUESTION",pos:i});continue}if(c==="+"){n.push({type:"PLUS",pos:i});continue}if(c==="-"){n.push({type:"MINUS",pos:i});continue}if(c==="*"){n.push({type:"STAR",pos:i});continue}if(c==="/"){n.push({type:"SLASH",pos:i});continue}if(c==="%"){n.push({type:"PERCENT",pos:i});continue}if(c==="<"){n.push({type:"LT",pos:i});continue}if(c===">"){n.push({type:"GT",pos:i});continue}if(p(c)){let h=c;for(;!o()&&(p(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[t+1]==="+"||e[t+1]==="-")&&(h+=s()),h+=s();n.push({type:"NUMBER",value:Number(h),pos:i});continue}if(c==='"'){let h="",a=0;for(;!o();){let l=r();if(a===0&&l==='"')break;if(a===0&&l==="\\"){if(s(),o())break;let y=s();switch(y){case"n":h+=`
|
|
7
|
-
`;break;case"r":h+="\r";break;case"t":h+=" ";break;case"\\":h+="\\";break;case'"':h+='"';break;case"(":h+="\\(",a=1;break;default:h+=y}continue}if(a>0){if(l==='"'){for(h+=s();!o();){let y=r();if(y==="\\"){h+=s(),o()||(h+=s());continue}if(h+=s(),y==='"')break}continue}l==="("?a++:l===")"&&a--,h+=s();continue}h+=s()}o()||s(),n.push({type:"STRING",value:h,pos:i});continue}if(u(c)||c==="$"||c==="@"){let h=c;for(;!o()&&f(r());)h+=s();let a=Ve.get(h);a?n.push({type:a,value:h,pos:i}):n.push({type:"IDENT",value:h,pos:i});continue}throw new Error(`Unexpected character '${c}' at position ${i}`)}}return n.push({type:"EOF",pos:t}),n}var Ce=class e{maxDepth;tokens;pos=0;depth;constructor(n,t,r=0){this.maxDepth=t,this.tokens=n,this.depth=r}peek(n=0){return this.tokens[this.pos+n]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(n){return this.peek().type===n}match(...n){for(let t of n)if(this.check(t))return this.advance();return null}expect(n,t){if(!this.check(n))throw new Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(n){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return n()}finally{this.depth--}}isFieldNameAfterDot(n=0){let t=this.peek(n),r=this.peek(n+1);return r.type==="STRING"?!0:r.type==="IDENT"||oe.has(r.type)?r.pos===t.pos+1:!1}isIdentLike(){let n=this.peek().type;return n==="IDENT"||oe.has(n)}consumeFieldNameAfterDot(n){let t=this.peek();return t.type==="STRING"?this.advance().value:(t.type==="IDENT"||oe.has(t.type))&&t.pos===n.pos+1?this.advance().value:null}parse(){let n=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return n}parseExpr(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePipe()}finally{this.depth--}}parsePattern(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePatternInner()}finally{this.depth--}}parsePatternInner(){if(this.match("LBRACKET")){let r=[];if(!this.check("RBRACKET"))for(r.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)r.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:r}}if(this.match("LBRACE")){let r=[];if(!this.check("RBRACE"))for(r.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)r.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:r}}let n=this.expect("IDENT","Expected variable name in pattern"),t=n.value;if(!t.startsWith("$"))throw new Error(`Variable name must start with $ at position ${n.pos}`);return{type:"var",name:t}}parsePatternField(){if(this.match("LPAREN")){let t=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:t,pattern:r}}let n=this.peek();if(n.type==="IDENT"||oe.has(n.type)){let t=n.value;if(t.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t.slice(1),pattern:r,keyVar:t}}return{key:t.slice(1),pattern:{type:"var",name:t}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:t,pattern:r}}return{key:t,pattern:{type:"var",name:`$${t}`}}}throw new Error(`Expected field name in object pattern at position ${n.pos}`)}parsePipe(){let n=this.parseComma();for(;this.match("PIPE");){let t=this.parseComma();n={type:"Pipe",left:n,right:t}}return n}parseComma(){let n=this.parseVarBind();for(;this.match("COMMA");){let t=this.parseVarBind();n={type:"Comma",left:n,right:t}}return n}parseVarBind(){let n=this.parseUpdate();if(this.match("AS")){let t=this.parsePattern(),r=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),r.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let s=this.parseExpr();return t.type==="var"&&r.length===0?{type:"VarBind",name:t.name,value:n,body:s}:{type:"VarBind",name:t.type==="var"?t.name:"",value:n,body:s,pattern:t.type!=="var"?t:void 0,alternatives:r.length>0?r:void 0}}return n}peekAhead(n){let t=this.pos+n;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let n=this.parseAlt(),t=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),r=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(r){let s=this.withDepth(()=>this.parseVarBind()),o=t.get(r.type);if(o)return{type:"UpdateOp",op:o,path:n,value:s}}return n}parseAlt(){let n=this.parseOr();for(;this.match("ALT");){let t=this.parseOr();n={type:"BinaryOp",op:"//",left:n,right:t}}return n}parseOr(){let n=this.parseAnd();for(;this.match("OR");){let t=this.parseAnd();n={type:"BinaryOp",op:"or",left:n,right:t}}return n}parseAnd(){let n=this.parseNot();for(;this.match("AND");){let t=this.parseNot();n={type:"BinaryOp",op:"and",left:n,right:t}}return n}parseNot(){return this.parseComparison()}parseComparison(){let n=this.parseAddSub(),t=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=t.get(r.type);if(s){let o=this.parseAddSub();n={type:"BinaryOp",op:s,left:n,right:o}}}return n}parseAddSub(){let n=this.parseMulDiv();for(;;)if(this.match("PLUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"+",left:n,right:t}}else if(this.match("MINUS")){let t=this.parseMulDiv();n={type:"BinaryOp",op:"-",left:n,right:t}}else break;return n}parseMulDiv(){let n=this.parseUnary();for(;;)if(this.match("STAR")){let t=this.parseUnary();n={type:"BinaryOp",op:"*",left:n,right:t}}else if(this.match("SLASH")){let t=this.parseUnary();n={type:"BinaryOp",op:"/",left:n,right:t}}else if(this.match("PERCENT")){let t=this.parseUnary();n={type:"BinaryOp",op:"%",left:n,right:t}}else break;return n}parseUnary(){let n=0;for(;this.match("MINUS");)if(n++,this.depth+n>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let t=this.parsePostfix();for(;n-- >0;)t={type:"UnaryOp",op:"-",operand:t};return t}parsePostfix(){let n=this.parsePrimary();for(;;)if(this.match("QUESTION"))n={type:"Optional",expr:n};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),n={type:"Field",name:this.advance().value,base:n};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))n={type:"Iterate",base:n};else if(this.check("COLON")){this.advance();let t=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",end:t,base:n}}else{let t=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),n={type:"Slice",start:t,end:r,base:n}}else this.expect("RBRACKET","Expected ']'"),n={type:"Index",index:t,base:n}}else break;return n}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let n=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:s}}let r=this.parseExpr();if(this.match("COLON")){let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:s}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}let t=this.consumeFieldNameAfterDot(n);return t!==null?{type:"Field",name:t}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let t=this.advance().value;return t.includes("\\(")?this.parseStringInterpolation(t):{type:"Literal",value:t}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let n=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:n}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let n=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:n}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let n=this.withDepth(()=>this.parsePostfix()),t;return this.match("CATCH")&&(t=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:n,catch:t}}if(this.match("REDUCE")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let o=t.type==="var"?t.name:"";return{type:"Reduce",expr:n,varName:o,init:r,update:s,pattern:t.type!=="var"?t:void 0}}if(this.match("FOREACH")){let n=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let t=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),o;this.match("SEMICOLON")&&(o=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let p=t.type==="var"?t.name:"";return{type:"Foreach",expr:n,varName:p,init:r,update:s,extract:o,pattern:t.type!=="var"?t:void 0}}if(this.match("LABEL")){let n=this.expect("IDENT","Expected label name (e.g., $out)"),t=n.value;if(!t.startsWith("$"))throw new Error(`Label name must start with $ at position ${n.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:t,body:r}}if(this.match("BREAK")){let n=this.expect("IDENT","Expected label name to break to"),t=n.value;if(!t.startsWith("$"))throw new Error(`Break label must start with $ at position ${n.pos}`);return{type:"Break",name:t}}if(this.match("DEF")){let t=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let p=this.expect("IDENT","Expected parameter name");for(r.push(p.value);this.match("SEMICOLON");){let u=this.expect("IDENT","Expected parameter name");r.push(u.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let s=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let o=this.parseExpr();return{type:"Def",name:t,params:r,funcBody:s,body:o}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let t=this.advance().value;if(t.startsWith("$"))return{type:"VarRef",name:t};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:t,args:r}}return{type:"Call",name:t,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parseObjectConstructionInner()}finally{this.depth--}}parseObjectConstructionInner(){let n=[];if(!this.check("RBRACE"))do{let t,r;if(this.match("LPAREN"))t=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else if(this.isIdentLike()){let s=this.advance().value;this.match("COLON")?(t=s,r=this.parseObjectValue()):(t=s,r={type:"Field",name:s})}else if(this.check("STRING"))t=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);n.push({key:t,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:n}}parseObjectValue(){let n=this.parseVarBind();for(;this.match("PIPE");){let t=this.parseVarBind();n={type:"Pipe",left:n,right:t}}return n}parseIf(){let n=this.parseExpr();this.expect("THEN","Expected 'then'");let t=this.parseExpr(),r=[];for(;this.match("ELIF");){let o=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let p=this.parseExpr();r.push({cond:o,then:p})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:n,then:t,elifs:r,else:s}}parseStringInterpolation(n){let t=[],r="",s=0;for(;s<n.length;)if(n[s]==="\\"&&n[s+1]==="("){r&&(t.push(r),r=""),s+=2;let o=1,p="";for(;s<n.length&&o>0;){let i=n[s];if(i==='"'){for(p+=i,s++;s<n.length;){let c=n[s];if(c==="\\"){p+=c,s++,s<n.length&&(p+=n[s],s++);continue}if(p+=c,s++,c==='"')break}continue}i==="("?o++:i===")"&&o--,o>0&&(p+=i),s++}let u=He(p),f=new e(u,this.maxDepth,this.depth);t.push(f.parse())}else r+=n[s],s++;return r&&t.push(r),{type:"StringInterp",parts:t}}};function pr(e,n={}){let t=n.maxDepth??256,r=n.maxTokens??1e5,s=n.maxSourceLength??1048576;if(e.length>s)throw new Error(`query source length limit exceeded (${s} characters)`);if(e.length+1>r)throw new Error(`query token limit exceeded (${r})`);let o=He(e);return new Ce(o,t).parse()}function gr(e,n,t={}){let r=new G(n,"query JSON output",()=>new g(`output size limit exceeded (${n} bytes)`,t.limitKind??"output_size"));return De(r,e,t,0),r.build()}function De(e,n,t,r){if(n==null){e.append("null");return}if(typeof n=="boolean"){e.append(String(n));return}if(typeof n=="number"){e.append(Number.isFinite(n)?String(n):"null");return}if(typeof n=="string"){t.raw&&r===0?e.append(n):Qe(e,n);return}let s=t.compact??!1,o=t.indent??2,p=t.useTab?" ":" ".repeat(o);if(Array.isArray(n)){e.append("[");for(let f=0;f<n.length;f++)e.append(s?f===0?"":",":f===0?`
|
|
8
|
-
`:`,
|
|
9
|
-
`),s||e.repeat(p,r+1),De(e,n[f],t,r+1);!s&&n.length>0&&e.append(`
|
|
10
|
-
`).repeat(p,r),e.append("]");return}let u=Object.keys(n);t.sortKeys&&(u=u.sort()),e.append("{");for(let f=0;f<u.length;f++){let i=u[f];e.append(s?f===0?"":",":f===0?`
|
|
11
|
-
`:`,
|
|
12
|
-
`),s||e.repeat(p,r+1),Qe(e,i),e.append(s?":":": "),De(e,n[i],t,r+1)}!s&&u.length>0&&e.append(`
|
|
13
|
-
`).repeat(p,r),e.append("}")}function Qe(e,n){e.append('"');let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r),o="";s===34?o='\\"':s===92?o="\\\\":s===8?o="\\b":s===9?o="\\t":s===10?o="\\n":s===12?o="\\f":s===13?o="\\r":s<32&&(o=`\\u${s.toString(16).padStart(4,"0")}`),o&&(e.append(n.slice(t,r)).append(o),t=r+1)}e.append(n.slice(t)).append('"')}export{B as a,d as b,pr as c,gr as d};
|