@jerryan/just-bash 3.10.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.
Files changed (382) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +2 -2
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/abort-signals.d.ts +10 -0
  5. package/dist/bin/chunks/awk2-LCV2AUIX.js +3 -0
  6. package/dist/bin/{shell/chunks/base64-TQ5KOCNW.js → chunks/base64-OLYCF2PC.js} +1 -1
  7. package/dist/bin/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  8. package/dist/bin/{shell/chunks/chmod-S4ARARR4.js → chunks/chmod-V5F4BXZ2.js} +1 -1
  9. package/dist/bin/chunks/{chunk-V4S4A7M6.js → chunk-2TEF4USR.js} +1 -1
  10. package/dist/bin/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  11. package/dist/bin/chunks/chunk-4NYJ4ZTO.js +17 -0
  12. package/dist/bin/{shell/chunks/chunk-M3Z5NZXT.js → chunks/chunk-572NXISH.js} +1 -1
  13. package/dist/bin/chunks/chunk-5NWK7A4R.js +13 -0
  14. package/dist/bin/{shell/chunks/chunk-YXPSX3SI.js → chunks/chunk-623Q77WZ.js} +1 -1
  15. package/dist/bin/chunks/chunk-6NG4ULJM.js +7 -0
  16. package/dist/bin/chunks/{chunk-QFOXSCOD.js → chunk-726WDFMQ.js} +1 -1
  17. package/dist/bin/chunks/{chunk-4JPWP5WS.js → chunk-AJ3CSZ34.js} +1 -1
  18. package/dist/bin/{shell/chunks/chunk-VTAMGD42.js → chunks/chunk-APEQNYAO.js} +1 -1
  19. package/dist/bin/chunks/chunk-BFLKIASG.js +7 -0
  20. package/dist/bin/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  21. package/dist/bin/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  22. package/dist/bin/chunks/{chunk-K65FCSAT.js → chunk-BZJ77YQD.js} +1 -1
  23. package/dist/bin/{shell/chunks/chunk-GR4ZHKXI.js → chunks/chunk-C2BLJ3AE.js} +1 -1
  24. package/dist/bin/{shell/chunks/chunk-R7THHH4J.js → chunks/chunk-C45GTJTD.js} +1 -1
  25. package/dist/bin/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  26. package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  27. package/dist/bin/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  28. package/dist/bin/chunks/{chunk-E54Z6VIE.js → chunk-ERYPQAZE.js} +5 -5
  29. package/dist/bin/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  30. package/dist/bin/{shell/chunks/chunk-E2O6S35K.js → chunks/chunk-HFVQCXYX.js} +1 -1
  31. package/dist/bin/chunks/{chunk-IRCAXXH6.js → chunk-HSWCKN2X.js} +1 -1
  32. package/dist/bin/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  33. package/dist/bin/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  34. package/dist/bin/chunks/chunk-IX6QY5JW.js +5 -0
  35. package/dist/bin/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  36. package/dist/bin/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  37. package/dist/bin/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  38. package/dist/bin/{shell/chunks/chunk-GKJD4ULC.js → chunks/chunk-KH6YLKPE.js} +1 -1
  39. package/dist/bin/{shell/chunks/chunk-Z3TCELKN.js → chunks/chunk-KXSDVBJA.js} +1 -1
  40. package/dist/bin/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  41. package/dist/bin/{shell/chunks/chunk-L345YZ6R.js → chunks/chunk-LVT5R45K.js} +1 -1
  42. package/dist/bin/{shell/chunks/chunk-PTUQEN6I.js → chunks/chunk-M345X45Z.js} +7 -7
  43. package/dist/bin/chunks/{chunk-MWQMHODV.js → chunk-NDS7PYKD.js} +1 -1
  44. package/dist/bin/chunks/chunk-O3PNT72D.js +3 -0
  45. package/dist/bin/chunks/chunk-OGOISDGZ.js +3 -0
  46. package/dist/bin/chunks/chunk-OSW4MDDH.js +21 -0
  47. package/dist/bin/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  48. package/dist/bin/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  49. package/dist/bin/{shell/chunks/chunk-O2BCKSMK.js → chunks/chunk-PEJXCXSY.js} +1 -1
  50. package/dist/bin/{shell/chunks/chunk-6KHZX4HU.js → chunks/chunk-PLLMJHMV.js} +1 -1
  51. package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QELDDRV5.js} +1 -1
  52. package/dist/bin/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  53. package/dist/bin/{shell/chunks/chunk-H7PD6FLC.js → chunks/chunk-RE7Z53A3.js} +1 -1
  54. package/dist/bin/chunks/chunk-SCQRBEQW.js +275 -0
  55. package/dist/bin/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  56. package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
  57. package/dist/bin/{shell/chunks/chunk-UNCYBFWT.js → chunks/chunk-UFAYH3WW.js} +1 -1
  58. package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
  59. package/dist/bin/{shell/chunks/chunk-HARVZWUX.js → chunks/chunk-UU42WPB7.js} +1 -1
  60. package/dist/bin/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  61. package/dist/bin/{shell/chunks/chunk-F4ACJZIY.js → chunks/chunk-WLQ2KWS3.js} +1 -1
  62. package/dist/bin/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  63. package/dist/bin/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  64. package/dist/bin/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  65. package/dist/bin/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  66. package/dist/bin/chunks/{cp-WRBRHVVD.js → cp-XJWV46T5.js} +1 -1
  67. package/dist/bin/chunks/{curl-NHNZ46BU.js → curl-HZ5SBTVY.js} +11 -11
  68. package/dist/bin/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  69. package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
  70. package/dist/bin/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  71. package/dist/bin/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  72. package/dist/bin/chunks/{find-T3JZPTUX.js → find-3QDGII35.js} +1 -1
  73. package/dist/bin/chunks/flag-coverage-AGEO3F6X.js +3 -0
  74. package/dist/bin/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  75. package/dist/bin/chunks/{gzip-EXJSFNCU.js → gzip-W5CL2E2W.js} +1 -1
  76. package/dist/bin/{shell/chunks/head-QKVY3SIO.js → chunks/head-ABLEKDMV.js} +1 -1
  77. package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
  78. package/dist/bin/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  79. package/dist/bin/{shell/chunks/jq-YS4PR46D.js → chunks/jq-5SOTL7D7.js} +1 -1
  80. package/dist/bin/chunks/{js-exec-PLUMFEX6.js → js-exec-LISDW7YC.js} +1 -1
  81. package/dist/bin/chunks/js-exec-worker.js +1 -0
  82. package/dist/bin/{shell/chunks/ls-LOCOWLZ3.js → chunks/ls-EEX3YIOF.js} +1 -1
  83. package/dist/bin/chunks/mkdir-KDEZTR53.js +3 -0
  84. package/dist/bin/chunks/mktemp-OYQYUB5H.js +3 -0
  85. package/dist/bin/chunks/{mv-NAMOL2HF.js → mv-35V6IA5V.js} +1 -1
  86. package/dist/bin/chunks/{od-2GXD4D5K.js → od-TD5LZDUM.js} +1 -1
  87. package/dist/bin/{shell/chunks/paste-DWWA3JTW.js → chunks/paste-QJG6BYAP.js} +1 -1
  88. package/dist/bin/chunks/{python3-J5GXF27H.js → python3-P6MZ44HK.js} +1 -1
  89. package/dist/bin/{shell/chunks/rg-XF5U7GS2.js → chunks/rg-B2DVJQVY.js} +1 -1
  90. package/dist/bin/chunks/rm-HCMKNRM2.js +3 -0
  91. package/dist/bin/{shell/chunks/rmdir-W73C4GEA.js → chunks/rmdir-WGVUYGPF.js} +1 -1
  92. package/dist/bin/{shell/chunks/sed-SY63U2YX.js → chunks/sed-66XZQ75T.js} +1 -1
  93. package/dist/bin/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  94. package/dist/bin/{shell/chunks/sleep-MOJQBZMY.js → chunks/sleep-4O22Z4DI.js} +1 -1
  95. package/dist/bin/chunks/{split-2VXPZJJ4.js → split-OK6JHDWZ.js} +1 -1
  96. package/dist/bin/chunks/sqlite3-57ACN7ES.js +3 -0
  97. package/dist/bin/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  98. package/dist/bin/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  99. package/dist/bin/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  100. package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  101. package/dist/bin/chunks/timeout-XMTXHNFF.js +3 -0
  102. package/dist/bin/{shell/chunks/tr-PVFO6FRY.js → chunks/tr-ETPC3LHV.js} +1 -1
  103. package/dist/bin/chunks/worker.js +5 -0
  104. package/dist/bin/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  105. package/dist/bin/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  106. package/dist/bin/chunks/yes-2EQTNSIB.js +3 -0
  107. package/dist/bin/chunks/yq-T6S3IDKY.js +3 -0
  108. package/dist/bin/just-bash.js +291 -286
  109. package/dist/bin/shell/chunks/awk2-LCV2AUIX.js +3 -0
  110. package/dist/bin/{chunks/base64-TQ5KOCNW.js → shell/chunks/base64-OLYCF2PC.js} +1 -1
  111. package/dist/bin/shell/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
  112. package/dist/bin/{chunks/chmod-S4ARARR4.js → shell/chunks/chmod-V5F4BXZ2.js} +1 -1
  113. package/dist/bin/shell/chunks/{chunk-V4S4A7M6.js → chunk-2TEF4USR.js} +1 -1
  114. package/dist/bin/shell/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
  115. package/dist/bin/shell/chunks/chunk-4NYJ4ZTO.js +17 -0
  116. package/dist/bin/{chunks/chunk-M3Z5NZXT.js → shell/chunks/chunk-572NXISH.js} +1 -1
  117. package/dist/bin/shell/chunks/chunk-5NWK7A4R.js +13 -0
  118. package/dist/bin/{chunks/chunk-YXPSX3SI.js → shell/chunks/chunk-623Q77WZ.js} +1 -1
  119. package/dist/bin/shell/chunks/chunk-6NG4ULJM.js +7 -0
  120. package/dist/bin/shell/chunks/{chunk-QFOXSCOD.js → chunk-726WDFMQ.js} +1 -1
  121. package/dist/bin/shell/chunks/{chunk-4JPWP5WS.js → chunk-AJ3CSZ34.js} +1 -1
  122. package/dist/bin/{chunks/chunk-VTAMGD42.js → shell/chunks/chunk-APEQNYAO.js} +1 -1
  123. package/dist/bin/shell/chunks/chunk-BFLKIASG.js +7 -0
  124. package/dist/bin/shell/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
  125. package/dist/bin/shell/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
  126. package/dist/bin/shell/chunks/{chunk-K65FCSAT.js → chunk-BZJ77YQD.js} +1 -1
  127. package/dist/bin/{chunks/chunk-GR4ZHKXI.js → shell/chunks/chunk-C2BLJ3AE.js} +1 -1
  128. package/dist/bin/{chunks/chunk-R7THHH4J.js → shell/chunks/chunk-C45GTJTD.js} +1 -1
  129. package/dist/bin/shell/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
  130. package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
  131. package/dist/bin/shell/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
  132. package/dist/bin/shell/chunks/{chunk-E54Z6VIE.js → chunk-ERYPQAZE.js} +5 -5
  133. package/dist/bin/shell/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
  134. package/dist/bin/{chunks/chunk-E2O6S35K.js → shell/chunks/chunk-HFVQCXYX.js} +1 -1
  135. package/dist/bin/shell/chunks/{chunk-IRCAXXH6.js → chunk-HSWCKN2X.js} +1 -1
  136. package/dist/bin/shell/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
  137. package/dist/bin/shell/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
  138. package/dist/bin/shell/chunks/chunk-IX6QY5JW.js +5 -0
  139. package/dist/bin/shell/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
  140. package/dist/bin/shell/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
  141. package/dist/bin/shell/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
  142. package/dist/bin/{chunks/chunk-GKJD4ULC.js → shell/chunks/chunk-KH6YLKPE.js} +1 -1
  143. package/dist/bin/{chunks/chunk-Z3TCELKN.js → shell/chunks/chunk-KXSDVBJA.js} +1 -1
  144. package/dist/bin/shell/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
  145. package/dist/bin/{chunks/chunk-L345YZ6R.js → shell/chunks/chunk-LVT5R45K.js} +1 -1
  146. package/dist/bin/{chunks/chunk-PTUQEN6I.js → shell/chunks/chunk-M345X45Z.js} +7 -7
  147. package/dist/bin/shell/chunks/{chunk-MWQMHODV.js → chunk-NDS7PYKD.js} +1 -1
  148. package/dist/bin/shell/chunks/chunk-O3PNT72D.js +3 -0
  149. package/dist/bin/shell/chunks/chunk-OGOISDGZ.js +3 -0
  150. package/dist/bin/shell/chunks/chunk-OSW4MDDH.js +21 -0
  151. package/dist/bin/shell/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
  152. package/dist/bin/shell/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
  153. package/dist/bin/{chunks/chunk-O2BCKSMK.js → shell/chunks/chunk-PEJXCXSY.js} +1 -1
  154. package/dist/bin/{chunks/chunk-6KHZX4HU.js → shell/chunks/chunk-PLLMJHMV.js} +1 -1
  155. package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QELDDRV5.js} +1 -1
  156. package/dist/bin/shell/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
  157. package/dist/bin/{chunks/chunk-H7PD6FLC.js → shell/chunks/chunk-RE7Z53A3.js} +1 -1
  158. package/dist/bin/shell/chunks/chunk-SCQRBEQW.js +275 -0
  159. package/dist/bin/shell/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
  160. package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
  161. package/dist/bin/{chunks/chunk-UNCYBFWT.js → shell/chunks/chunk-UFAYH3WW.js} +1 -1
  162. package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
  163. package/dist/bin/{chunks/chunk-HARVZWUX.js → shell/chunks/chunk-UU42WPB7.js} +1 -1
  164. package/dist/bin/shell/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
  165. package/dist/bin/{chunks/chunk-F4ACJZIY.js → shell/chunks/chunk-WLQ2KWS3.js} +1 -1
  166. package/dist/bin/shell/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
  167. package/dist/bin/shell/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
  168. package/dist/bin/shell/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
  169. package/dist/bin/shell/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
  170. package/dist/bin/shell/chunks/{cp-WRBRHVVD.js → cp-XJWV46T5.js} +1 -1
  171. package/dist/bin/shell/chunks/{curl-NHNZ46BU.js → curl-HZ5SBTVY.js} +11 -11
  172. package/dist/bin/shell/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
  173. package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
  174. package/dist/bin/shell/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
  175. package/dist/bin/shell/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
  176. package/dist/bin/shell/chunks/{find-T3JZPTUX.js → find-3QDGII35.js} +1 -1
  177. package/dist/bin/shell/chunks/flag-coverage-AGEO3F6X.js +3 -0
  178. package/dist/bin/shell/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
  179. package/dist/bin/shell/chunks/{gzip-EXJSFNCU.js → gzip-W5CL2E2W.js} +1 -1
  180. package/dist/bin/{chunks/head-QKVY3SIO.js → shell/chunks/head-ABLEKDMV.js} +1 -1
  181. package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
  182. package/dist/bin/shell/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
  183. package/dist/bin/{chunks/jq-YS4PR46D.js → shell/chunks/jq-5SOTL7D7.js} +1 -1
  184. package/dist/bin/shell/chunks/{js-exec-PLUMFEX6.js → js-exec-LISDW7YC.js} +1 -1
  185. package/dist/bin/{chunks/ls-LOCOWLZ3.js → shell/chunks/ls-EEX3YIOF.js} +1 -1
  186. package/dist/bin/shell/chunks/mkdir-KDEZTR53.js +3 -0
  187. package/dist/bin/shell/chunks/mktemp-OYQYUB5H.js +3 -0
  188. package/dist/bin/shell/chunks/{mv-NAMOL2HF.js → mv-35V6IA5V.js} +1 -1
  189. package/dist/bin/shell/chunks/{od-2GXD4D5K.js → od-TD5LZDUM.js} +1 -1
  190. package/dist/bin/{chunks/paste-DWWA3JTW.js → shell/chunks/paste-QJG6BYAP.js} +1 -1
  191. package/dist/bin/shell/chunks/{python3-J5GXF27H.js → python3-P6MZ44HK.js} +1 -1
  192. package/dist/bin/{chunks/rg-XF5U7GS2.js → shell/chunks/rg-B2DVJQVY.js} +1 -1
  193. package/dist/bin/shell/chunks/rm-HCMKNRM2.js +3 -0
  194. package/dist/bin/{chunks/rmdir-W73C4GEA.js → shell/chunks/rmdir-WGVUYGPF.js} +1 -1
  195. package/dist/bin/{chunks/sed-SY63U2YX.js → shell/chunks/sed-66XZQ75T.js} +1 -1
  196. package/dist/bin/shell/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
  197. package/dist/bin/{chunks/sleep-MOJQBZMY.js → shell/chunks/sleep-4O22Z4DI.js} +1 -1
  198. package/dist/bin/shell/chunks/{split-2VXPZJJ4.js → split-OK6JHDWZ.js} +1 -1
  199. package/dist/bin/shell/chunks/sqlite3-57ACN7ES.js +3 -0
  200. package/dist/bin/shell/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
  201. package/dist/bin/shell/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
  202. package/dist/bin/shell/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
  203. package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
  204. package/dist/bin/shell/chunks/timeout-XMTXHNFF.js +3 -0
  205. package/dist/bin/{chunks/tr-PVFO6FRY.js → shell/chunks/tr-ETPC3LHV.js} +1 -1
  206. package/dist/bin/shell/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
  207. package/dist/bin/shell/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
  208. package/dist/bin/shell/chunks/yes-2EQTNSIB.js +3 -0
  209. package/dist/bin/shell/chunks/yq-T6S3IDKY.js +3 -0
  210. package/dist/bin/shell/shell.js +337 -332
  211. package/dist/browser.d.ts +1 -1
  212. package/dist/bundle/browser.js +741 -730
  213. package/dist/bundle/chunks/awk2-TLK6FCHV.js +2 -0
  214. package/dist/bundle/chunks/{base64-MHVQ5XHI.js → base64-GUZMZ645.js} +1 -1
  215. package/dist/bundle/chunks/{cat-VZBWBIJB.js → cat-LG4YGKUE.js} +1 -1
  216. package/dist/bundle/chunks/{chmod-KMFNCMRX.js → chmod-XUKPG2M4.js} +1 -1
  217. package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
  218. package/dist/bundle/chunks/{chunk-O5OYOY3C.js → chunk-37UJACD6.js} +1 -1
  219. package/dist/bundle/chunks/{chunk-MMXJJCAE.js → chunk-3LGQ6XEC.js} +1 -1
  220. package/dist/bundle/chunks/{chunk-P57S6Z6R.js → chunk-3ZY5QX3G.js} +1 -1
  221. package/dist/bundle/chunks/{chunk-5KOWUQOZ.js → chunk-4VU4IF3W.js} +1 -1
  222. package/dist/bundle/chunks/{chunk-SIOONII3.js → chunk-52W2IWA7.js} +1 -1
  223. package/dist/bundle/chunks/chunk-5IB57TIJ.js +274 -0
  224. package/dist/bundle/chunks/chunk-5J4S2LP5.js +2 -0
  225. package/dist/bundle/chunks/{chunk-PCPW54JH.js → chunk-5LDRJ22P.js} +1 -1
  226. package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-654CJKE3.js} +1 -1
  227. package/dist/bundle/chunks/{chunk-EZNS4GF7.js → chunk-67ODVGSB.js} +1 -1
  228. package/dist/bundle/chunks/{chunk-6QF3PCMO.js → chunk-6HQQON3N.js} +1 -1
  229. package/dist/bundle/chunks/{chunk-U57DSHID.js → chunk-6P2DITXT.js} +1 -1
  230. package/dist/bundle/chunks/{chunk-THDUQVY3.js → chunk-74IR77AZ.js} +1 -1
  231. package/dist/bundle/chunks/{chunk-S3ENGQML.js → chunk-7DVD6YCI.js} +1 -1
  232. package/dist/bundle/chunks/{chunk-HXWB4Z5X.js → chunk-7II7XIVI.js} +1 -1
  233. package/dist/bundle/chunks/{chunk-AYSZ5MAE.js → chunk-A3C4Z3Q3.js} +1 -1
  234. package/dist/bundle/chunks/chunk-A6SU3BZX.js +6 -0
  235. package/dist/bundle/chunks/{chunk-5NUTFEEG.js → chunk-AMXNXHXK.js} +1 -1
  236. package/dist/bundle/chunks/{chunk-QJ7OXJAZ.js → chunk-BLG7RWH4.js} +1 -1
  237. package/dist/bundle/chunks/{chunk-XQ2ZZFO6.js → chunk-BQTWRHZR.js} +2 -2
  238. package/dist/bundle/chunks/{chunk-6IFH67ZB.js → chunk-BZ2OMW2T.js} +1 -1
  239. package/dist/bundle/chunks/{chunk-CH7SUFFO.js → chunk-CORCIYJD.js} +1 -1
  240. package/dist/bundle/chunks/{chunk-LGIJSCWH.js → chunk-EQDVNHQS.js} +1 -1
  241. package/dist/bundle/chunks/{chunk-U4K5ZDWK.js → chunk-EZEO6MFE.js} +1 -1
  242. package/dist/bundle/chunks/{chunk-4CDTAUYP.js → chunk-EZT6M2HG.js} +1 -1
  243. package/dist/bundle/chunks/{chunk-4MJ7VJG4.js → chunk-H7UVJSZR.js} +1 -1
  244. package/dist/bundle/chunks/{chunk-5EI7WSRV.js → chunk-HYQGYXGZ.js} +1 -1
  245. package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-IPKSYZ3R.js} +1 -1
  246. package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-KJBPGFZD.js} +1 -1
  247. package/dist/bundle/chunks/chunk-L7NEGEOJ.js +16 -0
  248. package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-MJEJ7QEY.js} +1 -1
  249. package/dist/bundle/chunks/{chunk-QJFYYEFV.js → chunk-N36I27VM.js} +1 -1
  250. package/dist/bundle/chunks/chunk-N5L7E4EL.js +6 -0
  251. package/dist/bundle/chunks/{chunk-IXFQXNL4.js → chunk-NFW4YKDO.js} +1 -1
  252. package/dist/bundle/chunks/{chunk-PASYAXFP.js → chunk-NOX3PCUH.js} +1 -1
  253. package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
  254. package/dist/bundle/chunks/{chunk-4KZT23KR.js → chunk-O5BHWBYH.js} +1 -1
  255. package/dist/bundle/chunks/{chunk-DVSA72LH.js → chunk-QTL2XC4B.js} +1 -1
  256. package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
  257. package/dist/bundle/chunks/{chunk-BLPYR4TN.js → chunk-RVBBGZ22.js} +1 -1
  258. package/dist/bundle/chunks/{chunk-PS2RJNZZ.js → chunk-SXQJYLP7.js} +1 -1
  259. package/dist/bundle/chunks/{chunk-FXAKF2QS.js → chunk-T7OAZEXT.js} +1 -1
  260. package/dist/bundle/chunks/{chunk-O452S4KX.js → chunk-URIKBXSE.js} +1 -1
  261. package/dist/bundle/chunks/{chunk-6BSOPPZH.js → chunk-UVQC75LS.js} +7 -7
  262. package/dist/bundle/chunks/chunk-VCREDMWH.js +4 -0
  263. package/dist/bundle/chunks/{chunk-DDPD7SIB.js → chunk-VQ6EUBJ3.js} +1 -1
  264. package/dist/bundle/chunks/{chunk-4OKRFRMS.js → chunk-VQEB6E2M.js} +1 -1
  265. package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
  266. package/dist/bundle/chunks/{chunk-XXBIOG4R.js → chunk-WDY2TNMK.js} +1 -1
  267. package/dist/bundle/chunks/{chunk-H4AFUSSQ.js → chunk-XT7EK6BR.js} +1 -1
  268. package/dist/bundle/chunks/{chunk-BS6EJR2R.js → chunk-XUTEQMTL.js} +5 -5
  269. package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
  270. package/dist/bundle/chunks/chunk-YUITEK6N.js +12 -0
  271. package/dist/bundle/chunks/chunk-YZCPEJRE.js +20 -0
  272. package/dist/bundle/chunks/chunk-ZUEPJPYA.js +2 -0
  273. package/dist/bundle/chunks/{column-QJI65SH2.js → column-T4LGMRJG.js} +1 -1
  274. package/dist/bundle/chunks/{cp-P2D2L6PC.js → cp-ZDDVNITX.js} +1 -1
  275. package/dist/bundle/chunks/{curl-K4WT7UPN.js → curl-RCRD36LD.js} +11 -11
  276. package/dist/bundle/chunks/{cut-FMDNVWQN.js → cut-35WER2E2.js} +1 -1
  277. package/dist/bundle/chunks/{expr-A5XITHQD.js → expr-KSNRNE7V.js} +1 -1
  278. package/dist/bundle/chunks/{file-6AYYTULJ.js → file-XH37HMGV.js} +1 -1
  279. package/dist/bundle/chunks/{find-IUWEB4XQ.js → find-3AONTPPM.js} +1 -1
  280. package/dist/bundle/chunks/flag-coverage-6YGO7STE.js +2 -0
  281. package/dist/bundle/chunks/{grep-Q2O5EIXQ.js → grep-WW5KJPUG.js} +1 -1
  282. package/dist/bundle/chunks/{gzip-VUJBDHZ5.js → gzip-ISZXQNJJ.js} +1 -1
  283. package/dist/bundle/chunks/{head-6UIPFWVJ.js → head-VYXZQLPZ.js} +1 -1
  284. package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
  285. package/dist/bundle/chunks/{html-to-markdown-PE6BPRPA.js → html-to-markdown-4LXS3A44.js} +1 -1
  286. package/dist/bundle/chunks/{jq-UKAA3QWU.js → jq-3IVOWP3G.js} +1 -1
  287. package/dist/bundle/chunks/{js-exec-6RW7WZCG.js → js-exec-T2WEE4KG.js} +1 -1
  288. package/dist/bundle/chunks/js-exec-worker.js +1 -0
  289. package/dist/bundle/chunks/{ls-ECKG2XHZ.js → ls-FC3CSHKE.js} +1 -1
  290. package/dist/bundle/chunks/mkdir-DPFWDY25.js +2 -0
  291. package/dist/bundle/chunks/mktemp-SW2AHXZW.js +2 -0
  292. package/dist/bundle/chunks/{mv-IF55A2UD.js → mv-PWCFXEF2.js} +1 -1
  293. package/dist/bundle/chunks/{od-Z4AIL3P4.js → od-VJ6PBBEI.js} +1 -1
  294. package/dist/bundle/chunks/{paste-ZNHNSRBW.js → paste-TIQETHSO.js} +1 -1
  295. package/dist/bundle/chunks/{python3-XHTOW7VA.js → python3-6JEP7ZZK.js} +1 -1
  296. package/dist/bundle/chunks/{rg-E6H2HACA.js → rg-2OPJ5V3D.js} +1 -1
  297. package/dist/bundle/chunks/rm-AZZM5DCE.js +2 -0
  298. package/dist/bundle/chunks/{rmdir-WKKBLZ54.js → rmdir-YXYSZD4X.js} +1 -1
  299. package/dist/bundle/chunks/{sed-6G32B25J.js → sed-HYSBLGO5.js} +1 -1
  300. package/dist/bundle/chunks/{seq-B6KDLMYQ.js → seq-M2S4FRN4.js} +1 -1
  301. package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-YC4HFEGC.js} +1 -1
  302. package/dist/bundle/chunks/{split-NEU2K2YN.js → split-UOPIWKKE.js} +1 -1
  303. package/dist/bundle/chunks/sqlite3-XCROTL6G.js +2 -0
  304. package/dist/bundle/chunks/{stat-LXFZND2P.js → stat-I3FPUTR7.js} +1 -1
  305. package/dist/bundle/chunks/{tail-UBGSN4JF.js → tail-WK3WACZK.js} +1 -1
  306. package/dist/bundle/chunks/{tar-LE7LAAIX.js → tar-VZYMNZV2.js} +1 -1
  307. package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
  308. package/dist/bundle/chunks/timeout-UDR5J2MP.js +2 -0
  309. package/dist/bundle/chunks/{tr-UI2LA3GA.js → tr-VI5PIA4A.js} +1 -1
  310. package/dist/bundle/chunks/worker.js +5 -0
  311. package/dist/bundle/chunks/{xan-UIL24CGT.js → xan-DL576EIT.js} +1 -1
  312. package/dist/bundle/chunks/xan-view-GJVN6IHX.js +2 -0
  313. package/dist/bundle/chunks/yes-OVJMX6NM.js +2 -0
  314. package/dist/bundle/chunks/yq-KYPU4LQP.js +2 -0
  315. package/dist/bundle/index.cjs +1079 -1068
  316. package/dist/bundle/index.js +336 -331
  317. package/dist/commands/mktemp/mktemp.d.ts +4 -0
  318. package/dist/commands/registry.d.ts +1 -1
  319. package/dist/commands/yes/yes.d.ts +4 -0
  320. package/dist/custom-commands.d.ts +7 -0
  321. package/dist/fs/create-exclusive.d.ts +30 -0
  322. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
  323. package/dist/fs/interface.d.ts +37 -0
  324. package/dist/fs/mountable-fs/mountable-fs.d.ts +18 -1
  325. package/dist/fs/overlay-fs/overlay-fs.d.ts +19 -1
  326. package/dist/fs/read-write-fs/read-write-fs.d.ts +22 -1
  327. package/dist/index.d.cts +1 -1
  328. package/dist/index.d.ts +1 -1
  329. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
  330. package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
  331. package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
  332. package/dist/interpreter/expansion/variable.d.ts +1 -1
  333. package/dist/interpreter/helpers/loop.d.ts +32 -0
  334. package/dist/network/dns-pin.d.ts +1 -32
  335. package/dist/network/fetch.d.ts +1 -1
  336. package/dist/security/trusted-globals.d.ts +8 -0
  337. package/package.json +3 -4
  338. package/dist/bin/chunks/awk2-NTRVFXRA.js +0 -3
  339. package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
  340. package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
  341. package/dist/bin/chunks/chunk-I57EACSL.js +0 -3
  342. package/dist/bin/chunks/chunk-NSI6LMDS.js +0 -16
  343. package/dist/bin/chunks/chunk-ONF4KUYV.js +0 -13
  344. package/dist/bin/chunks/chunk-PRVPFKTC.js +0 -276
  345. package/dist/bin/chunks/chunk-U5JLGI56.js +0 -21
  346. package/dist/bin/chunks/dist-5MWO25Y4.js +0 -141
  347. package/dist/bin/chunks/flag-coverage-LVKHEUTL.js +0 -3
  348. package/dist/bin/chunks/mkdir-VHLJ3E65.js +0 -3
  349. package/dist/bin/chunks/rm-L4RHENMV.js +0 -3
  350. package/dist/bin/chunks/sqlite3-3S5HIA5W.js +0 -3
  351. package/dist/bin/chunks/timeout-RQOWSWYG.js +0 -3
  352. package/dist/bin/chunks/yq-CWBZMGUV.js +0 -3
  353. package/dist/bin/shell/chunks/awk2-NTRVFXRA.js +0 -3
  354. package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
  355. package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
  356. package/dist/bin/shell/chunks/chunk-I57EACSL.js +0 -3
  357. package/dist/bin/shell/chunks/chunk-NSI6LMDS.js +0 -16
  358. package/dist/bin/shell/chunks/chunk-ONF4KUYV.js +0 -13
  359. package/dist/bin/shell/chunks/chunk-PRVPFKTC.js +0 -276
  360. package/dist/bin/shell/chunks/chunk-U5JLGI56.js +0 -21
  361. package/dist/bin/shell/chunks/dist-5MWO25Y4.js +0 -141
  362. package/dist/bin/shell/chunks/flag-coverage-LVKHEUTL.js +0 -3
  363. package/dist/bin/shell/chunks/mkdir-VHLJ3E65.js +0 -3
  364. package/dist/bin/shell/chunks/rm-L4RHENMV.js +0 -3
  365. package/dist/bin/shell/chunks/sqlite3-3S5HIA5W.js +0 -3
  366. package/dist/bin/shell/chunks/timeout-RQOWSWYG.js +0 -3
  367. package/dist/bin/shell/chunks/yq-CWBZMGUV.js +0 -3
  368. package/dist/bundle/chunks/awk2-VS5QVYHU.js +0 -2
  369. package/dist/bundle/chunks/chunk-35MBA3VY.js +0 -12
  370. package/dist/bundle/chunks/chunk-4WRO2G22.js +0 -15
  371. package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
  372. package/dist/bundle/chunks/chunk-FTET43KM.js +0 -2
  373. package/dist/bundle/chunks/chunk-GRUZ4SBY.js +0 -275
  374. package/dist/bundle/chunks/chunk-Y6JBSHCM.js +0 -20
  375. package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
  376. package/dist/bundle/chunks/flag-coverage-SZ4AUPRQ.js +0 -2
  377. package/dist/bundle/chunks/mkdir-YL7XGMD7.js +0 -2
  378. package/dist/bundle/chunks/rm-CWLMERIO.js +0 -2
  379. package/dist/bundle/chunks/sqlite3-KJ5NMKBM.js +0 -2
  380. package/dist/bundle/chunks/timeout-37GM7IIL.js +0 -2
  381. package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +0 -2
  382. package/dist/bundle/chunks/yq-ZRNZKDLE.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{m as a}from"./chunk-TVCZIH6M.js";function l(...i){let n=[...new Set(i.filter(e=>e!==void 0))];if(n.length===0)return{signal:void 0,cleanup(){}};if(n.length===1)return{signal:n[0],cleanup(){}};let t=new AbortController,r=[];for(let e of n){if(e.aborted){t.abort(e.reason);break}let o=()=>t.abort(e.reason);e.addEventListener("abort",o,{once:!0}),r.push([e,o])}return{signal:t.signal,cleanup(){for(let[e,o]of r)e.removeEventListener("abort",o)}}}async function c(i,n,t){if(!n)return i;if(n.aborted)throw i.catch(()=>{}),new a("",t);let r;try{return await Promise.race([i,new Promise((e,o)=>{r=()=>o(new a("",t)),n.addEventListener("abort",r,{once:!0})})])}finally{r&&n.removeEventListener("abort",r)}}export{l as a,c as b};
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as _}from"./chunk-YEYSCLSJ.js";import{b as p}from"./chunk-AYSZ5MAE.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as S,b as C}from"./chunk-QAYAQNCG.js";var E={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},F={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};function a(t,e,u,i){if(t>e)throw new g(`base64: ${u} limit exceeded (${e} bytes)`,i)}function k(t){let e=[];for(let i=0;i<t.length;i+=32768)e.push(String.fromCharCode(...t.subarray(i,i+32768)));return e.join("")}function B(t){if(t.length===0)return 0;let e=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.ceil(t.length/4)*3-e)}async function x(t,e,u){let i=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),o=t.stdin;if(e.length===0||e.length===1&&e[0]==="-")return a(o.length,i,"input size","string_length"),{ok:!0,data:Uint8Array.from(o,n=>n.charCodeAt(0))};let c=[],s=0;for(let n of e){if(n==="-"){a(s+o.length,i,"input size","string_length"),c.push(Uint8Array.from(o,r=>r.charCodeAt(0))),s+=o.length;continue}try{let r=t.fs.resolvePath(t.cwd,n),l=await t.fs.stat(r);a(s+l.size,i,"input size","string_length");let f=await t.fs.readFileBuffer(r);a(s+f.length,i,"input size","string_length"),_(t,f.length,u),c.push(f),s+=f.length}catch(r){return p(r),{ok:!1,error:{stdout:"",stderr:`${u}: ${n}: No such file or directory
2
+ import{a as _}from"./chunk-YEYSCLSJ.js";import{b as p}from"./chunk-A3C4Z3Q3.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as S,b as C}from"./chunk-QAYAQNCG.js";var E={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},F={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};function a(t,e,u,i){if(t>e)throw new g(`base64: ${u} limit exceeded (${e} bytes)`,i)}function k(t){let e=[];for(let i=0;i<t.length;i+=32768)e.push(String.fromCharCode(...t.subarray(i,i+32768)));return e.join("")}function B(t){if(t.length===0)return 0;let e=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.ceil(t.length/4)*3-e)}async function x(t,e,u){let i=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),o=t.stdin;if(e.length===0||e.length===1&&e[0]==="-")return a(o.length,i,"input size","string_length"),{ok:!0,data:Uint8Array.from(o,n=>n.charCodeAt(0))};let c=[],s=0;for(let n of e){if(n==="-"){a(s+o.length,i,"input size","string_length"),c.push(Uint8Array.from(o,r=>r.charCodeAt(0))),s+=o.length;continue}try{let r=t.fs.resolvePath(t.cwd,n),l=await t.fs.stat(r);a(s+l.size,i,"input size","string_length");let f=await t.fs.readFileBuffer(r);a(s+f.length,i,"input size","string_length"),_(t,f.length,u),c.push(f),s+=f.length}catch(r){return p(r),{ok:!1,error:{stdout:"",stderr:`${u}: ${n}: No such file or directory
3
3
  `,exitCode:1}}}}let d=new Uint8Array(s),h=0;for(let n of c)d.set(n,h),h+=n.length;return{ok:!0,data:d}}var T={name:"base64",async execute(t,e){if(C(t))return S(E);let u=L("base64",t,F);if(!u.ok)return u.error;let i=u.result.flags.decode,o=u.result.flags.wrap,c=u.result.positional;if(!Number.isSafeInteger(o)||o<0)return{stdout:"",stderr:`base64: invalid wrap size
4
4
  `,exitCode:1};try{if(i){let r=await x(e,c,"base64");if(!r.ok)return r.error;if(typeof Buffer<"u"){let y=Buffer.from(r.data).toString("utf8").replace(/\s/g,""),z=B(y);a(z,e.limits.maxStringLength,"decoded size","string_length"),a(z,e.limits.maxOutputSize,"output size","output_size");let w=Buffer.from(y,"base64");return a(w.length,e.limits.maxOutputSize,"output size","output_size"),{stdout:w.toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let f=k(r.data).replace(/\s/g,""),m=B(f);a(m,e.limits.maxStringLength,"decoded size","string_length"),a(m,e.limits.maxOutputSize,"output size","output_size");let b=atob(f);return a(b.length,e.limits.maxOutputSize,"output size","output_size"),{stdout:b,stderr:"",exitCode:0,stdoutEncoding:"binary"}}let s=await x(e,c,"base64");if(!s.ok)return s.error;let d=Math.ceil(s.data.length/3)*4,h=o>0&&d>0?Math.ceil(d/o):0;if(h>e.limits.maxArrayElements)throw new g(`base64: wrapped line limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a(d,e.limits.maxStringLength,"encoded size","string_length"),a(d+h,e.limits.maxOutputSize,"output size","output_size");let n;if(typeof Buffer<"u"?n=Buffer.from(s.data).toString("base64"):n=btoa(k(s.data)),o>0){let r=[];for(let l=0;l<n.length;l+=o)r.push(n.slice(l,l+o));n=r.join(`
5
5
  `)+(n.length>0?`
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as s,b as i}from"./chunk-ZBUZKIPX.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
2
+ import{a as s,b as i}from"./chunk-A6SU3BZX.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{d as B}from"./chunk-FTET43KM.js";import{l as y}from"./chunk-TVCZIH6M.js";import{a as C,d as I}from"./chunk-GN6CQ3J4.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as v,b as E}from"./chunk-QAYAQNCG.js";var H={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},M={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};function $(t,e,i,l){return e?i?t.split(e,l):t.split(e,l).filter(n=>n.length>0):i?t.split(/[ \t]/,l):t.split(/[ \t]+/,l).filter(n=>n.length>0)}function T(t){let e=[];for(let i of t)for(let l=0;l<i.length;l++){let n=i[l].length;(e[l]===void 0||n>e[l])&&(e[l]=n)}return e}function W(t,e,i){if(t.length===0)return"";let l=T(t),n=new B(i,"column",void 0,1);for(let c=0;c<t.length;c++){let r=t[c];c>0&&n.append(`
2
+ import{e as B}from"./chunk-ZUEPJPYA.js";import{l as y}from"./chunk-TVCZIH6M.js";import{a as C,d as I}from"./chunk-GN6CQ3J4.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as v,b as E}from"./chunk-QAYAQNCG.js";var H={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},M={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};function $(t,e,i,l){return e?i?t.split(e,l):t.split(e,l).filter(n=>n.length>0):i?t.split(/[ \t]/,l):t.split(/[ \t]+/,l).filter(n=>n.length>0)}function T(t){let e=[];for(let i of t)for(let l=0;l<i.length;l++){let n=i[l].length;(e[l]===void 0||n>e[l])&&(e[l]=n)}return e}function W(t,e,i){if(t.length===0)return"";let l=T(t),n=new B(i,"column",void 0,1);for(let c=0;c<t.length;c++){let r=t[c];c>0&&n.append(`
3
3
  `);for(let o=0;o<r.length;o++)o>0&&n.append(e),n.append(r[o]),o<r.length-1&&n.repeat(" ",l[o]-r[o].length)}return n.build()}function z(t,e,i,l){if(t.length===0)return"";let n=0;for(let s of t)n=Math.max(n,s.length);let c=i.length,r=n+c,o=Math.max(1,Math.floor((e+c)/r)),b=Math.ceil(t.length/o),d=new B(l,"column",void 0,1);for(let s=0;s<b;s++){s>0&&d.append(`
4
4
  `);let u=!1;for(let h=0;h<o;h++){let a=h*b+s;a<t.length&&(h===o-1||(h+1)*b+s>=t.length?(u&&d.append(i),d.append(t[a])):(u&&d.append(i),d.append(t[a]),d.repeat(" ",n-t[a].length)),u=!0)}}return d.build()}var R={name:"column",execute:async(t,e)=>{if(E(t))return v(H);let i=L("column",t,M);if(!i.ok)return i.error;let{table:l,separator:n,outputSep:c,width:r,noMerge:o}=i.result.flags,b=i.result.positional,d=c??" ",s=Math.min(e.limits.maxInputBytes,e.limits.maxStringLength),u=e.limits.maxArrayElements,h=Math.min(e.limits.maxStringLength,e.limits.maxOutputSize);if(!Number.isFinite(r)||!Number.isSafeInteger(r)||r<=0||r>10*1024*1024)return{exitCode:1,stdout:"",stderr:`column: invalid width: ${r}
5
5
  `};let a;if(b.length===0)a=I(e.stdin)??"";else{let f=[],m=0;for(let g of b)if(g==="-"){let p=I(e.stdin)??"";if(m+=C(p),m>s)throw new y(`column: input size limit exceeded (${s} bytes)`,"string_length");f.push(p)}else{let p=e.fs.resolvePath(e.cwd,g),w=await e.fs.readFile(p);if(w===null)return{exitCode:1,stdout:"",stderr:`column: ${g}: No such file or directory
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as E}from"./chunk-AYSZ5MAE.js";import{d as T}from"./chunk-FTET43KM.js";import{l as m}from"./chunk-TVCZIH6M.js";import{a as u,d as I}from"./chunk-GN6CQ3J4.js";import{a as S}from"./chunk-QIQMJJZ4.js";import{a as B,b as F}from"./chunk-QAYAQNCG.js";var $={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},C={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},M={name:"paste",async execute(n,e){if(F(n))return B($);let l=S("paste",n,C);if(!l.ok)return l.error;let r=l.result.flags.delimiter,h=l.result.flags.serial,p=l.result.positional;if(p.length>e.limits.maxArrayElements)throw new m(`paste: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(u(r)>e.limits.maxStringLength)throw new m(`paste: delimiter size limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
2
+ import{b as E}from"./chunk-A3C4Z3Q3.js";import{e as T}from"./chunk-ZUEPJPYA.js";import{l as m}from"./chunk-TVCZIH6M.js";import{a as u,d as I}from"./chunk-GN6CQ3J4.js";import{a as S}from"./chunk-QIQMJJZ4.js";import{a as B,b as F}from"./chunk-QAYAQNCG.js";var $={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},C={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},M={name:"paste",async execute(n,e){if(F(n))return B($);let l=S("paste",n,C);if(!l.ok)return l.error;let r=l.result.flags.delimiter,h=l.result.flags.serial,p=l.result.positional;if(p.length>e.limits.maxArrayElements)throw new m(`paste: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(u(r)>e.limits.maxStringLength)throw new m(`paste: delimiter size limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
3
3
  `,exitCode:1};let g=I(e.stdin),o=g?g.split(`
4
4
  `):[""];o.length>0&&o[o.length-1]===""&&o.pop();let A=p.filter(t=>t==="-").length,f=[],y=0,x=u(g),L=t=>{if(t.length>e.limits.maxArrayElements-y)throw new m(`paste: line limit exceeded (${e.limits.maxArrayElements})`,"array_elements");y+=t.length,e.executionScope?.consumeWork(t.length,"paste lines")},w=0;for(let t of p)if(t==="-"){let i=[];for(let s=w;s<o.length;s+=A)i.push(o[s]);L(i),f.push(i),w++}else{let i=e.fs.resolvePath(e.cwd,t);try{let s=await e.fs.readFile(i),d=u(s);if(d>e.limits.maxInputBytes-x)throw new m(`paste: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");x+=d,e.executionScope?.consumeInput(d,"paste");let a=s.split(`
5
5
  `);a.length>0&&a[a.length-1]===""&&a.pop(),L(a),f.push(a)}catch(s){return E(s),{stdout:"",stderr:`paste: ${t}: No such file or directory
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as r}from"./chunk-4KZT23KR.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
2
+ import{a as r}from"./chunk-O5BHWBYH.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as O,c as N,d as T,e as k}from"./chunk-CM4T4GB4.js";import{f as P}from"./chunk-BMBITA6Y.js";import{l as $,m as C}from"./chunk-TVCZIH6M.js";import{c as p}from"./chunk-T5ZEIOJ3.js";import{a as F}from"./chunk-QIQMJJZ4.js";import{a as D}from"./chunk-W5DWRFSU.js";import{a as E,b as S}from"./chunk-QAYAQNCG.js";var H={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},I={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},j={name:"mv",async execute(v,e){if(S(v))return E(H);let i=F("mv",v,I);if(!i.ok)return i.error;let g=i.result.flags.force,u=i.result.flags.noClobber,A=i.result.flags.verbose,d=i.result.positional;if(u&&(g=!1),d.length<2)return{stdout:"",stderr:`mv: missing destination file operand
2
+ import{b as O,c as N,d as T,e as k}from"./chunk-CM4T4GB4.js";import{f as P}from"./chunk-BMBITA6Y.js";import{l as $,m as C}from"./chunk-TVCZIH6M.js";import{c as p}from"./chunk-T5ZEIOJ3.js";import{a as D}from"./chunk-W5DWRFSU.js";import{a as F}from"./chunk-QIQMJJZ4.js";import{a as E,b as S}from"./chunk-QAYAQNCG.js";var H={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},I={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},j={name:"mv",async execute(v,e){if(S(v))return E(H);let i=F("mv",v,I);if(!i.ok)return i.error;let g=i.result.flags.force,u=i.result.flags.noClobber,A=i.result.flags.verbose,d=i.result.positional;if(u&&(g=!1),d.length<2)return{stdout:"",stderr:`mv: missing destination file operand
3
3
  `,exitCode:1};let a=d.pop()??"",h=d,f=e.fs.resolvePath(e.cwd,a),b="",s="",l=0,y=new T({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"mv"}),m=!1;try{m=(await e.fs.stat(f)).isDirectory}catch{}if(h.length>1&&!m)return{stdout:"",stderr:`mv: target '${a}' is not a directory
4
4
  `,exitCode:1};for(let t of h)try{let o=e.fs.resolvePath(e.cwd,t),c=await e.fs.stat(o),n=f;if(m){let r=t.split("/").pop()||t;n=f==="/"?`/${r}`:`${f}/${r}`}if(c.isDirectory){let r=await N(e.fs,o,n,y);if(P(o,n)||r==="inside"){s+=`mv: cannot move '${t}' into itself, '${n}'
5
5
  `,l=1;continue}if(r==="unknown"){s+=`mv: cannot safely determine whether '${n}' is inside '${t}'
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as k}from"./chunk-6RK4AAB7.js";import{b as v}from"./chunk-AYSZ5MAE.js";import{a as y,b,d as S}from"./chunk-FTET43KM.js";import{l as h}from"./chunk-TVCZIH6M.js";import{a as w,d as $}from"./chunk-GN6CQ3J4.js";import{c as L}from"./chunk-NCUTH6QL.js";var g=class extends S{constructor(t){super(t,"xan")}};var C=L(k(),1);var V=class{ctx;site;rows=0;cells=0;constructor(t,i){this.ctx=t,this.site=i}consumeWork(t=1){this.ctx.executionScope?.consumeWork(t,this.site)}addRow(t){this.addRows(1,t)}addRows(t,i){let r=b(t,i,this.site);if(!Number.isSafeInteger(t)||t<0||!Number.isSafeInteger(i)||i<0||i>this.ctx.limits.maxArrayElements||t>Math.min(this.ctx.limits.maxCsvRows,this.ctx.limits.maxArrayElements)-this.rows||r>this.ctx.limits.maxCsvCells-this.cells)throw new h(`${this.site}: derived CSV result limit exceeded`,"array_elements");this.consumeWork(b(t,y(1,i,this.site),this.site)),this.rows+=t,this.cells+=r}};function I(){return Object.create(null)}function j(n,t,i){n[t]=i}function W(n){let t=I();for(let i of Object.keys(n)){let r=n[i];(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null)&&(t[i]=r)}return t}function z(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=n.trim(),o=C.default.parse(m,{preview:1,skipEmptyLines:!0}).data[0]??[];if(o.length>r)throw new h(`xan: CSV column limit exceeded (${r})`,"array_elements");let p=0,s;if(C.default.parse(m,{header:!0,dynamicTyping:!0,skipEmptyLines:!0,step:(e,l)=>{let u=Object.keys(e.data);if(d.length===0&&e.meta.fields){if(e.meta.fields.length>r){s=new h(`xan: CSV column limit exceeded (${r})`,"array_elements"),l.abort();return}o=[...e.meta.fields]}if(d.length>=a||u.length>f-p){s=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),l.abort();return}p+=u.length,d.push(W(e.data))}}),s)throw s;return{headers:o,data:d}}function H(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=0,c;if(C.default.parse(n.trim(),{header:!1,dynamicTyping:!1,skipEmptyLines:!0,step:(o,p)=>{let s=o.data;if(d.length>=a||s.length>r||s.length>f-m){c=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:s.length>r?`xan: CSV column limit exceeded (${r})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),p.abort();return}m+=s.length,d.push(s)}}),c)throw c;return d}function P(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i,n)}function q(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i)}function G(n,t,i){return E(n.length,void 0,(r,a)=>n[r][a],t,i,r=>n[r].length)}function E(n,t,i,r,a,f=()=>t??0){let d=r?.limits.maxOutputSize??Number.MAX_SAFE_INTEGER,m=new S(d,"xan CSV output",r?()=>new h(`xan: output size limit exceeded (${d} bytes)`,"output_size"):void 0),c=p=>{let s=p==null?"":String(p),e=0;for(let x=0;x<s.length;x++)s.charCodeAt(x)===34&&e++;let l=e>0||s.includes("\r")||s.includes(`
2
+ import{a as k}from"./chunk-6RK4AAB7.js";import{b as v}from"./chunk-A3C4Z3Q3.js";import{a as y,b,e as S}from"./chunk-ZUEPJPYA.js";import{l as h}from"./chunk-TVCZIH6M.js";import{a as w,d as $}from"./chunk-GN6CQ3J4.js";import{c as L}from"./chunk-NCUTH6QL.js";var g=class extends S{constructor(t){super(t,"xan")}};var C=L(k(),1);var V=class{ctx;site;rows=0;cells=0;constructor(t,i){this.ctx=t,this.site=i}consumeWork(t=1){this.ctx.executionScope?.consumeWork(t,this.site)}addRow(t){this.addRows(1,t)}addRows(t,i){let r=b(t,i,this.site);if(!Number.isSafeInteger(t)||t<0||!Number.isSafeInteger(i)||i<0||i>this.ctx.limits.maxArrayElements||t>Math.min(this.ctx.limits.maxCsvRows,this.ctx.limits.maxArrayElements)-this.rows||r>this.ctx.limits.maxCsvCells-this.cells)throw new h(`${this.site}: derived CSV result limit exceeded`,"array_elements");this.consumeWork(b(t,y(1,i,this.site),this.site)),this.rows+=t,this.cells+=r}};function I(){return Object.create(null)}function j(n,t,i){n[t]=i}function W(n){let t=I();for(let i of Object.keys(n)){let r=n[i];(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null)&&(t[i]=r)}return t}function z(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=n.trim(),o=C.default.parse(m,{preview:1,skipEmptyLines:!0}).data[0]??[];if(o.length>r)throw new h(`xan: CSV column limit exceeded (${r})`,"array_elements");let p=0,s;if(C.default.parse(m,{header:!0,dynamicTyping:!0,skipEmptyLines:!0,step:(e,l)=>{let u=Object.keys(e.data);if(d.length===0&&e.meta.fields){if(e.meta.fields.length>r){s=new h(`xan: CSV column limit exceeded (${r})`,"array_elements"),l.abort();return}o=[...e.meta.fields]}if(d.length>=a||u.length>f-p){s=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),l.abort();return}p+=u.length,d.push(W(e.data))}}),s)throw s;return{headers:o,data:d}}function H(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=0,c;if(C.default.parse(n.trim(),{header:!1,dynamicTyping:!1,skipEmptyLines:!0,step:(o,p)=>{let s=o.data;if(d.length>=a||s.length>r||s.length>f-m){c=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:s.length>r?`xan: CSV column limit exceeded (${r})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),p.abort();return}m+=s.length,d.push(s)}}),c)throw c;return d}function P(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i,n)}function q(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i)}function G(n,t,i){return E(n.length,void 0,(r,a)=>n[r][a],t,i,r=>n[r].length)}function E(n,t,i,r,a,f=()=>t??0){let d=r?.limits.maxOutputSize??Number.MAX_SAFE_INTEGER,m=new S(d,"xan CSV output",r?()=>new h(`xan: output size limit exceeded (${d} bytes)`,"output_size"):void 0),c=p=>{let s=p==null?"":String(p),e=0;for(let x=0;x<s.length;x++)s.charCodeAt(x)===34&&e++;let l=e>0||s.includes("\r")||s.includes(`
3
3
  `)||s.includes(",")||s.includes("\uFEFF")||s.startsWith(" ")||s.endsWith(" ");m.reserve(y(w(s),y(e,l?2:0,"xan CSV output"),"xan CSV output"));let u=e>0?s.replace(/"/g,'""'):s;m.append(l?`"${u}"`:u)},o=(p,s)=>{for(let e=0;e<s;e++)e>0&&m.append(","),c(i(p,e));m.append(`
4
4
  `)};if(a){for(let p=0;p<a.length;p++)p>0&&m.append(","),c(a[p]);m.append(`
5
5
  `)}for(let p=0;p<n;p++)r?.executionScope?.throwIfAborted("xan CSV output"),o(p,t??f(p));return m.build()}async function R(n,t){let i=n.find(d=>!d.startsWith("-")),r;if(!i||i==="-")r=$(t.stdin);else try{let d=t.fs.resolvePath(t.cwd,i);r=await t.fs.readFile(d)}catch(d){return v(d),{headers:[],data:[],error:{stdout:"",stderr:`xan: ${i}: No such file or directory
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as u,b as O,c as W}from"./chunk-FTET43KM.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as y}from"./chunk-GN6CQ3J4.js";var k={name:"seq",async execute(r,p){let m=`
2
+ import{a as u,b as O,d as W}from"./chunk-ZUEPJPYA.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as y}from"./chunk-GN6CQ3J4.js";var k={name:"seq",async execute(r,p){let m=`
3
3
  `,x=!1,i=[],e=0;for(;e<r.length;){let t=r[e];if(t==="-s"&&e+1<r.length){m=r[e+1],e+=2;continue}if(t==="-w"){x=!0,e++;continue}if(t==="--"){e++;break}if(t.startsWith("-")&&t!=="-"){if(t.startsWith("-s")&&t.length>2){m=t.slice(2),e++;continue}if((t==="-ws"||t==="-sw")&&(x=!0,e+1<r.length)){m=r[e+1],e+=2;continue}}i.push(t),e++}for(;e<r.length;)i.push(r[e]),e++;if(i.length===0)return{stdout:"",stderr:`seq: missing operand
4
4
  `,exitCode:1};let d=1,a=1,l;if(i.length===1?l=parseFloat(i[0]):i.length===2?(d=parseFloat(i[0]),l=parseFloat(i[1])):(d=parseFloat(i[0]),a=parseFloat(i[1]),l=parseFloat(i[2])),!Number.isFinite(d)||!Number.isFinite(a)||!Number.isFinite(l))return{stdout:"",stderr:`seq: invalid floating point argument: '${i.find(o=>!Number.isFinite(parseFloat(o)))}'
5
5
  `,exitCode:1};if(a===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as t}from"./chunk-ZBUZKIPX.js";import{l as n,m as r,n as i}from"./chunk-TVCZIH6M.js";function e(o){return o instanceof n||o instanceof r||o instanceof t||o instanceof i}function E(o){if(e(o))throw o}export{e as a,E as b};
2
+ import{a as t}from"./chunk-A6SU3BZX.js";import{l as n,m as r,n as i}from"./chunk-TVCZIH6M.js";function e(o){return o instanceof n||o instanceof r||o instanceof t||o instanceof i}function E(o){if(e(o))throw o}export{e as a,E as b};
@@ -0,0 +1,6 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ 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=`
3
+
4
+ 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)?`
5
+
6
+ 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),a.trustedExecutionDepth.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 await 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,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as E}from"./chunk-AYSZ5MAE.js";import{a as h}from"./chunk-CM4T4GB4.js";import{l as $}from"./chunk-TVCZIH6M.js";import{a as k}from"./chunk-GN6CQ3J4.js";import{a as C,b as L,c as F}from"./chunk-QAYAQNCG.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
2
+ import{b as E}from"./chunk-A3C4Z3Q3.js";import{a as h}from"./chunk-CM4T4GB4.js";import{l as $}from"./chunk-TVCZIH6M.js";import{a as k}from"./chunk-GN6CQ3J4.js";import{a as C,b as L,c as F}from"./chunk-QAYAQNCG.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
3
3
  `};i.mode="lines",i.lines=l,n+=2}else if(s.match(/^-l\d+$/)){let l=x(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s.slice(2)}'
4
4
  `};i.mode="lines",i.lines=l,n++}else if(s==="-b"&&n+1<e.length){let l=N(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[n+1]}'
5
5
  `};i.mode="bytes",i.bytes=l,n+=2}else if(s.match(/^-b.+$/)){let l=N(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s.slice(2)}'
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{c as E}from"./chunk-YEYSCLSJ.js";import{d as W}from"./chunk-FTET43KM.js";import{l as h}from"./chunk-TVCZIH6M.js";import{d as N}from"./chunk-GN6CQ3J4.js";import{a as v,b as L,c as b}from"./chunk-QAYAQNCG.js";var k={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function M(r,o){let l=[],a=r.split(",");if(a.length>o)throw new h(`cut: range count limit exceeded (${o})`,"array_elements");for(let s of a)if(s.includes("-")){let[i,u]=s.split("-"),t=i?Number(i):1,f=u?Number(u):null;if(!Number.isSafeInteger(t)||t<1||f!==null&&(!Number.isSafeInteger(f)||f<t))throw new h("cut: invalid range","array_elements");l.push({start:t,end:f})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new h("cut: invalid range","array_elements");l.push({start:i,end:i})}return l}function B(r,o){let l=[],a=new Set;for(let s of o){let i=s.start-1,u=s.end===null?r.length:s.end;for(let t=i;t<u&&t<r.length;t++)t>=0&&!a.has(t)&&(a.add(t),l.push(r[t]))}return l}var R={name:"cut",async execute(r,o){if(L(r))return v(k);let l=" ",a=null,s=null,i=!1,u=[];for(let n=0;n<r.length;n++){let e=r[n];if(e==="-d")l=r[++n]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")a=r[++n];else if(e.startsWith("-f"))a=e.slice(2);else if(e==="-c")s=r[++n];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")i=!0;else{if(e.startsWith("--"))return b("cut",e);if(e.startsWith("-")){let d=!1;for(let c of e.slice(1))if(c==="s")i=!0;else if(!"dfc".includes(c)){d=!0;break}if(d)return b("cut",e)}else u.push(e)}}if(!a&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
2
+ import{c as E}from"./chunk-YEYSCLSJ.js";import{e as W}from"./chunk-ZUEPJPYA.js";import{l as h}from"./chunk-TVCZIH6M.js";import{d as N}from"./chunk-GN6CQ3J4.js";import{a as v,b as L,c as b}from"./chunk-QAYAQNCG.js";var k={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function M(r,o){let l=[],a=r.split(",");if(a.length>o)throw new h(`cut: range count limit exceeded (${o})`,"array_elements");for(let s of a)if(s.includes("-")){let[i,u]=s.split("-"),t=i?Number(i):1,f=u?Number(u):null;if(!Number.isSafeInteger(t)||t<1||f!==null&&(!Number.isSafeInteger(f)||f<t))throw new h("cut: invalid range","array_elements");l.push({start:t,end:f})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new h("cut: invalid range","array_elements");l.push({start:i,end:i})}return l}function B(r,o){let l=[],a=new Set;for(let s of o){let i=s.start-1,u=s.end===null?r.length:s.end;for(let t=i;t<u&&t<r.length;t++)t>=0&&!a.has(t)&&(a.add(t),l.push(r[t]))}return l}var R={name:"cut",async execute(r,o){if(L(r))return v(k);let l=" ",a=null,s=null,i=!1,u=[];for(let n=0;n<r.length;n++){let e=r[n];if(e==="-d")l=r[++n]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")a=r[++n];else if(e.startsWith("-f"))a=e.slice(2);else if(e==="-c")s=r[++n];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")i=!0;else{if(e.startsWith("--"))return b("cut",e);if(e.startsWith("-")){let d=!1;for(let c of e.slice(1))if(c==="s")i=!0;else if(!"dfc".includes(c)){d=!0;break}if(d)return b("cut",e)}else u.push(e)}}if(!a&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
3
3
  `,exitCode:1};let t=await E(o,u,{cmdName:"cut"});if(!t.ok)return t.error;let m=(s?N(t.content):t.content).split(`
4
4
  `);m.length>0&&m[m.length-1]===""&&m.pop();let x=M(a||s||"1",o.limits.maxArrayElements),g=new W(Math.min(o.limits.maxOutputSize,o.limits.maxStringLength),"cut"),S=0,I=n=>{if(!Number.isSafeInteger(n)||n<0||n>o.limits.maxLoopIterations-S)throw new h(`cut: range expansion limit exceeded (${o.limits.maxLoopIterations})`,"iterations");S+=n,o.executionScope?.consumeWork(n,"cut range expansion")};for(let n of m)if(s){let e=Array.from(n),d=[];for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y));for(let p=y;p<w&&p<e.length;p++)p>=0&&d.push(e[p])}g.append(`${d.join("")}
5
5
  `)}else{if(i&&!n.includes(l))continue;let e=n.split(l);for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y))}let d=B(e,x);g.append(`${d.join(l)}
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-S3ENGQML.js";import{b as V,d as Qe}from"./chunk-35MBA3VY.js";import{d as Ge,f as Xe,g as oe}from"./chunk-UUIYAOD4.js";import{a as Z}from"./chunk-4KZT23KR.js";import{b as Ye}from"./chunk-YEYSCLSJ.js";import{b as q}from"./chunk-AYSZ5MAE.js";import{a as W,c as se,d as re}from"./chunk-FTET43KM.js";import{l as E}from"./chunk-TVCZIH6M.js";import{a as K,d as Y}from"./chunk-GN6CQ3J4.js";import{a as J,b as ne}from"./chunk-QAYAQNCG.js";var G=class{input;pos=0;tokens=[];maxSourceLength;maxTokens;constructor(t,n={}){this.input=t,this.maxSourceLength=n.maxSourceLength??1024*1024,this.maxTokens=n.maxTokens??1e5}tokenize(){if(this.input.length>this.maxSourceLength)throw new E(`xan: expression length limit exceeded (${this.maxSourceLength})`,"string_length");for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let t=this.nextToken();t&&(this.assertTokenCapacity(),this.tokens.push(t))}return this.assertTokenCapacity(),this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}assertTokenCapacity(){if(this.tokens.length>=this.maxTokens)throw new E(`xan: expression token limit exceeded (${this.maxTokens})`,"array_elements")}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.input[this.pos];if(t===" "||t===" "||t===`
2
+ import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-7DVD6YCI.js";import{b as V,d as Qe}from"./chunk-YUITEK6N.js";import{d as Ge,f as Xe,g as oe}from"./chunk-UUIYAOD4.js";import{a as Z}from"./chunk-O5BHWBYH.js";import{b as Ye}from"./chunk-YEYSCLSJ.js";import{b as q}from"./chunk-A3C4Z3Q3.js";import{a as W,d as se,e as re}from"./chunk-ZUEPJPYA.js";import{l as E}from"./chunk-TVCZIH6M.js";import{a as K,d as Y}from"./chunk-GN6CQ3J4.js";import{a as J,b as ne}from"./chunk-QAYAQNCG.js";var G=class{input;pos=0;tokens=[];maxSourceLength;maxTokens;constructor(t,n={}){this.input=t,this.maxSourceLength=n.maxSourceLength??1024*1024,this.maxTokens=n.maxTokens??1e5}tokenize(){if(this.input.length>this.maxSourceLength)throw new E(`xan: expression length limit exceeded (${this.maxSourceLength})`,"string_length");for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let t=this.nextToken();t&&(this.assertTokenCapacity(),this.tokens.push(t))}return this.assertTokenCapacity(),this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}assertTokenCapacity(){if(this.tokens.length>=this.maxTokens)throw new E(`xan: expression token limit exceeded (${this.maxTokens})`,"array_elements")}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.input[this.pos];if(t===" "||t===" "||t===`
3
3
  `||t==="\r")this.pos++;else if(t==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
4
4
  `;)this.pos++;else break}}nextToken(){let t=this.pos,n=this.input[this.pos];if(n>="0"&&n<="9")return this.readNumber();if(n==='"'||n==="'"||n==="`")return this.readString(n);if(n==="b"&&this.pos+1<this.input.length){let o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(n==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:t}):(this.pos++,{type:"/",value:"/",pos:t}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:t};if(this.match("=>"))return{type:"=>",value:"=>",pos:t};if(this.match("**"))return{type:"**",value:"**",pos:t};if(this.match("++"))return{type:"++",value:"++",pos:t};if(this.match("//"))return{type:"//",value:"//",pos:t};if(this.match("=="))return{type:"==",value:"==",pos:t};if(this.match("!="))return{type:"!=",value:"!=",pos:t};if(this.match("<="))return{type:"<=",value:"<=",pos:t};if(this.match(">="))return{type:">=",value:">=",pos:t};if(this.match("&&"))return{type:"&&",value:"&&",pos:t};if(this.match("||"))return{type:"||",value:"||",pos:t};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(n);if(r!==void 0)return this.pos++,{type:r,value:n,pos:t};if(this.isIdentStart(n))return this.readIdentifier();throw new Error(`Unexpected character '${n}' at position ${this.pos}`)}match(t){if(this.input.slice(this.pos,this.pos+t.length)===t){if(/^[a-zA-Z]/.test(t)){let n=this.input[this.pos+t.length];if(n&&this.isIdentChar(n))return!1}return this.pos+=t.length,!0}return!1}isIdentStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentChar(t){return this.isIdentStart(t)||t>="0"&&t<="9"}readNumber(){let t=this.pos,n=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!n&&!s)n=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,n=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(t,this.pos).replace(/_/g,"");return{type:n?"float":"int",value:r,pos:t}}readString(t){let n=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===t)return this.pos++,{type:"string",value:s,pos:n};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
5
5
  `;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${n}`)}readRegex(){let t=this.pos;this.pos++;let n="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:n+(s?`/${s}`:""),pos:t}}r==="\\"?(n+=r,this.pos++,this.pos<this.input.length&&(n+=this.input[this.pos],this.pos++)):(n+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${t}`)}readIdentifier(){let t=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let n=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(n=!0,this.pos++);let s=this.input.slice(t,n?this.pos-1:this.pos);n&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!n?{type:i,value:o,pos:t}:{type:"ident",value:s,pos:t}}};function z(e){return{maxSourceLength:e.limits.maxStringLength,maxTokens:e.limits.maxQueryTokens,maxAstNodes:e.limits.maxQueryElements,maxOperations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth}}var D={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},ee=class{pos=0;tokens;depth=0;operations=0;astNodes=0;limits;constructor(t,n={}){this.tokens=t,this.limits={maxSourceLength:n.maxSourceLength??1024*1024,maxTokens:n.maxTokens??1e5,maxDepth:n.maxDepth??100,maxOperations:n.maxOperations??1e5,maxAstNodes:n.maxAstNodes??1e5};let s=0;for(let r of t)this.useOperation(),r.type==="("||r.type==="["||r.type==="{"?(s++,s>this.limits.maxDepth&&this.throwDepthLimit()):(r.type===")"||r.type==="]"||r.type==="}")&&(s=Math.max(0,s-1))}parse(){let t=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return t}parseExpr(t){return this.withDepth(()=>this.parseExprInner(t))}parseExprInner(t){let n=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<t)break;n=this.parseInfix(n,r)}return n}useOperation(t=1){if(t>this.limits.maxOperations-this.operations)throw new E(`xan: expression parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=t}withDepth(t){this.depth>=this.limits.maxDepth&&this.throwDepthLimit(),this.depth++;try{return t()}finally{this.depth--}}throwDepthLimit(){throw new E(`xan: expression parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}addAstNode(){if(this.astNodes>=this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements");this.astNodes++}parsePrefix(){let t=this.peek();switch(t.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(t.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(t.value)};case"string":return this.advance(),{type:"string",value:t.value};case"regex":{this.advance();let n=t.value.split("/"),s=n.length>1?n[n.length-1]:"";return{type:"regex",pattern:n.slice(0,-1).join("/")||t.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let n=t.value,s=n.endsWith("?"),r=s?n.slice(0,-1):n;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let n=this.pos;if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=[this.peek().value];this.advance();let o=!0;for(;this.peek().type===",";)if(this.advance(),this.peek().type==="ident")r.push(this.peek().value),this.advance();else{o=!1;break}if(o&&this.peek().type===")"&&this.peekAt(1).type==="=>"){this.advance(),this.advance();let i=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:r,body:i},r)}this.pos=n}let s=this.parseExpr(0);return this.expect(")"),s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let n=this.parseExpr(D.UNARY);return n.type==="int"?{type:"int",value:-n.value}:n.type==="float"?{type:"float",value:-n.value}:{type:"func",name:"neg",args:[{expr:n}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(D.UNARY)}]};default:throw new Error(`Unexpected token: ${t.type} (${t.value})`)}}parseFunctionCall(t){this.expect("(");let n=[];if(this.peek().type!==")")do{n.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);n.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:t.toLowerCase(),args:n}}parseList(){this.expect("[");let t=[];if(this.peek().type!=="]")do t.length>0&&this.peek().type===","&&this.advance(),t.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:t}}parseMap(){this.expect("{");let t=[];if(this.peek().type!=="}")do{t.length>0&&this.peek().type===","&&this.advance();let n;if(this.peek().type==="ident")n=this.peek().value,this.advance();else if(this.peek().type==="string")n=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);t.push({key:n,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:t}}parseInfix(t,n){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(n+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:t},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(n);return this.handlePipe(t,i)}if(s.type===".")return this.advance(),this.handleDot(t);if(s.type==="[")return this.advance(),this.handleIndexing(t);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(t,n){if(n.type==="identifier")return{type:"func",name:n.name,args:[{expr:t}]};if(n.type==="func"){let s=this.countUnderscores(n);return s===0?n:s===1?this.fillUnderscore(n,t):{type:"pipeline",exprs:[t,n]}}return this.countUnderscores(n)===1?this.fillUnderscore(n,t):n}handleDot(t){let n=this.peek();if(n.type==="ident"){let s=n.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:t}),r}return{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}if(n.type==="int"){let s=Number.parseInt(n.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"int",value:s}}]}}if(n.type==="string"){let s=n.value;return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${n.type}`)}handleIndexing(t){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:{type:"int",value:0}},{expr:s}]}}let n=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t},{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:n},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:t},{expr:n}]}}countUnderscores(t){let n=[t],s=0;for(;n.length>0;){this.useOperation();let r=n.pop();if(!r)break;if(r.type==="underscore")s++;else if(r.type==="func")for(let o of r.args)n.push(o.expr);else if(r.type==="list")n.push(...r.elements);else if(r.type==="map")for(let o of r.entries)n.push(o.value);if(n.length>this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements")}return s}fillUnderscore(t,n){return this.withDepth(()=>this.fillUnderscoreInner(t,n))}fillUnderscoreInner(t,n){return this.useOperation(),t.type==="underscore"?n:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.fillUnderscore(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.fillUnderscore(s.value,n)}))}:t}bindLambdaArgs(t,n){return{...t,body:this.bindLambdaArgsInExpr(t.body,n)}}bindLambdaArgsInExpr(t,n){return this.withDepth(()=>this.bindLambdaArgsInExprInner(t,n))}bindLambdaArgsInExprInner(t,n){return this.useOperation(),t.type==="identifier"&&n.includes(t.name)?{type:"lambdaBinding",name:t.name}:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.bindLambdaArgsInExpr(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,n)}))}:t}getInfixPrec(t){switch(t){case"|":return D.PIPE;case"||":case"or":return D.OR;case"&&":case"and":return D.AND;case"==":case"!=":case"eq":case"ne":return D.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return D.COMPARISON;case"+":case"-":case"++":return D.ADDITIVE;case"*":case"/":case"//":case"%":return D.MULTIPLICATIVE;case"**":return D.POWER;case".":case"[":return D.POSTFIX;default:return-1}}isRightAssoc(t){return t==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}peekAt(t){return this.tokens[this.pos+t]||{type:"eof",value:"",pos:0}}advance(){return this.useOperation(),this.addAstNode(),this.tokens[this.pos++]}expect(t){let n=this.peek();if(n.type!==t)throw new Error(`Expected ${t}, got ${n.type}`);return this.advance()}};function X(e,t={}){let n=[],r=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize(),o=0,i=()=>r[o]||{type:"eof",value:"",pos:0},p=()=>r[o++];for(;i().type!=="eof";){if(i().type===","&&n.length>0){p();continue}let h=[],m=0,c=o;for(;i().type!=="eof";){let l=i();if((l.type===","||l.type==="as")&&m===0)break;(l.type==="("||l.type==="["||l.type==="{")&&m++,(l.type===")"||l.type==="]"||l.type==="}")&&m--,h.push(p())}h.push({type:"eof",value:"",pos:0});let d=new ee(h,t).parse(),u;if(i().type==="as")if(p(),i().type==="("){p();let l=[];for(;i().type!==")"&&i().type!=="eof";)if((i().type==="ident"||i().type==="string")&&(l.push(i().value),p()),i().type===",")p();else if(i().type!==")"&&i().type!=="eof")throw new Error(`Expected tuple alias, got ${i().type}`);if(i().type!==")")throw new Error("Expected ')' after tuple alias");p(),u=l}else if(i().type==="ident"||i().type==="string")u=i().value,p();else throw new Error(`Expected name after 'as', got ${i().type}`);else u=e.slice(r[c].pos,r[o-1]?.pos||e.length).trim(),d.type==="identifier"&&(u=d.name);n.push({expr:d,name:u})}return n}function B(e,t={}){let s=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize();return new ee(s,t).parse()}function R(e,t){return t.length===0?O(e,[]):t.length===1?{type:"Pipe",left:t[0],right:O(e,[])}:{type:"Pipe",left:t[0],right:O(e,t.slice(1))}}var le={add:e=>L("+",e[0],e[1]),sub:e=>L("-",e[0],e[1]),mul:e=>L("*",e[0],e[1]),div:e=>L("/",e[0],e[1]),mod:e=>L("%",e[0],e[1]),idiv:e=>O("floor",[L("/",e[0],e[1])]),pow:e=>R("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>L("==",e[0],e[1]),"!=":e=>L("!=",e[0],e[1]),"<":e=>L("<",e[0],e[1]),"<=":e=>L("<=",e[0],e[1]),">":e=>L(">",e[0],e[1]),">=":e=>L(">=",e[0],e[1]),eq:e=>L("==",M(e[0]),M(e[1])),ne:e=>L("!=",M(e[0]),M(e[1])),lt:e=>L("<",M(e[0]),M(e[1])),le:e=>L("<=",M(e[0]),M(e[1])),gt:e=>L(">",M(e[0]),M(e[1])),ge:e=>L(">=",M(e[0]),M(e[1])),and:e=>L("and",e[0],e[1]),or:e=>L("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>R("length",e),length:e=>R("length",e),upper:e=>R("ascii_upcase",e),lower:e=>R("ascii_downcase",e),trim:e=>R("trim",e),ltrim:e=>e.length===0?O("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?O("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("rtrimstr",[{type:"Literal",value:" "}])},split:e=>R("split",e),join:e=>e.length===1?O("join",[{type:"Literal",value:""}]):R("join",e),concat:e=>L("+",e[0],e[1]),startswith:e=>R("startswith",e),endswith:e=>R("endswith",e),contains:e=>R("contains",e),replace:e=>R("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:L("+",e[1],e[2])},abs:e=>R("fabs",e),floor:e=>R("floor",e),ceil:e=>R("ceil",e),round:e=>R("round",e),sqrt:e=>R("sqrt",e),log:e=>R("log",e),log10:e=>R("log10",e),log2:e=>R("log2",e),exp:e=>R("exp",e),sin:e=>R("sin",e),cos:e=>R("cos",e),tan:e=>R("tan",e),asin:e=>R("asin",e),acos:e=>R("acos",e),atan:e=>R("atan",e),min:e=>R("min",e),max:e=>R("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>O("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>O("select",e),empty:()=>O("empty",[]),count:()=>O("length",[]),sum:e=>e.length===0?O("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:O("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},type:"type",isnull:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:null}):L("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:""}):L("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?O("tonumber",[]):O("tonumber",e),tostring:e=>e.length===0?O("tostring",[]):O("tostring",e),if:e=>st(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let t=e[e.length-1];for(let n=e.length-2;n>=0;n--){let s=e[n],r=L("and",L("!=",s,{type:"Literal",value:null}),L("!=",s,{type:"Literal",value:""}));t=st(r,s,t)}return t},index:()=>({type:"Field",name:"_row_index"}),now:()=>O("now",[]),fmt:e=>O("tostring",e),format:e=>O("tostring",e)};Object.setPrototypeOf(le,null);function L(e,t,n){return{type:"BinaryOp",op:e,left:t,right:n}}function O(e,t){return{type:"Call",name:e,args:t}}var mt="then";function st(e,t,n){let s=Xe({type:"Cond",cond:e,elifs:[],else:n||{type:"Literal",value:null}});return s[mt]=t,s}function M(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function U(e,t=!0,n={}){let s={nodes:0,operations:0,maxNodes:n.maxAstNodes??1e5,maxOperations:n.maxOperations??1e5,maxDepth:n.maxDepth??100};return rt(e,t,s,0)}function rt(e,t,n,s){if(s>=n.maxDepth)throw new E(`xan: expression conversion depth limit exceeded (${n.maxDepth})`,"recursion");if(++n.nodes>n.maxNodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(++n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations");let r=o=>rt(o,t,n,s+1);switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return t?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{if(e.args.length>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");let o=e.args.map(p=>r(p.expr));if(e.name==="coalesce"){let p=Math.max(0,o.length-1)*7;if(p>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(n.nodes+=p,n.operations+=o.length,n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations")}let i=Object.hasOwn(le,e.name)?le[e.name]:void 0;return typeof i=="function"?i(o):O(typeof i=="string"?i:e.name,o)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((o,i,p)=>{let h=r(i);return p===0?h:{type:"Comma",left:o,right:h}},null)};case"map":return{type:"Object",entries:e.entries.map(o=>({key:o.key,value:r(o.value)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?r(e.start):void 0,end:e.end?r(e.end):void 0};case"lambda":return r(e.body);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){return e<2?0:Math.ceil(e*Math.log2(e))}function ue(e,t={}){let n=t.maxArrayElements??1e5,s=t.maxStringLength??10*1024*1024,r=t.maxIterations??1e5,o=t.maxDepth??100;if(K(e)>s)throw new E(`xan: aggregation expression length limit exceeded (${s} bytes)`,"string_length");let i=[],p=0,h=0,m=()=>{if(t.consumeWork?.(),++h>r)throw new E(`xan: aggregation parser operation limit exceeded (${r})`,"iterations")};for(;p<e.length;){for(m();p<e.length&&(e[p]===" "||e[p]===",");)p++;if(p>=e.length)break;let c=p;for(;p<e.length&&/\w/.test(e[p]);)p++;let a=e.slice(c,p);for(;p<e.length&&e[p]===" ";)p++;if(e[p]!=="(")break;p++;let d=1,u=p;for(;p<e.length&&d>0;){if(m(),e[p]==="("?d++:e[p]===")"&&d--,d>o)throw new E(`xan: aggregation parser depth limit exceeded (${o})`,"recursion");d>0&&p++}let l=e.slice(u,p).trim();for(p++;p<e.length&&e[p]===" ";)p++;let f="";if(e.slice(p,p+3).toLowerCase()==="as "){for(p+=3;p<e.length&&e[p]===" ";)p++;let x=p;for(;p<e.length&&/\w/.test(e[p]);)p++;f=e.slice(x,p)}if(f||(f=l?`${a}(${l})`:`${a}()`),i.length>=n)throw new E(`xan: aggregation specification limit exceeded (${n})`,"array_elements");i.push({func:a,expr:l,alias:f})}return i}function ft(e){return/^\w+$/.test(e)}function ht(e,t,n){let s=V(e,t,n);return s.length>0?s[0]:null}function ce(e,t,n={},s={}){let{func:r,expr:o}=t,i=s.maxArrayElements??1e5,p=s.maxStringLength??10*1024*1024,h=s.maxIterations??1e5,m={maxSourceLength:p,maxTokens:i,maxAstNodes:i,maxOperations:h,maxDepth:s.maxDepth??100};if(e.length>i)throw new E(`xan: aggregation input limit exceeded (${i})`,"array_elements");if(r==="count"&&!o)return e.length;let c=ft(o),a=c?null:U(B(o,m),!0,m),d;if(c)d=f=>f[o];else{if(a===null)throw new Error("xan: missing compiled aggregation expression");d=f=>ht(f,a,n)}if(r==="all"||r==="any"){let f=0;for(let x of e){if(s.consumeWork?.(),++f>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let g=!!d(x);if(r==="all"&&!g)return!1;if(r==="any"&&g)return!0}return r==="all"}let u=[],l=0;for(let f of e){if(s.consumeWork?.(),++l>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let x=d(f);if(x!=null){if(u.length>=i)throw new E(`xan: aggregation value limit exceeded (${i})`,"array_elements");u.push(x)}}switch(r){case"count":{if(c)return u.length;let f=0;for(let x of u)s.consumeWork?.(),x&&f++;return f}case"sum":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return f}case"mean":case"avg":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return u.length>0?f/u.length:0}case"min":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.min(f,g)}return f}case"max":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.max(f,g)}return f}case"first":return u.length>0?u[0]:null;case"last":return u.length>0?u[u.length-1]:null;case"median":{let f=[];for(let g of u){s.consumeWork?.();let y=typeof g=="number"?g:Number.parseFloat(String(g));Number.isNaN(y)||f.push(y)}if(s.consumeWork?.(Q(f.length)),f.sort((g,y)=>g-y),f.length===0)return null;let x=Math.floor(f.length/2);return f.length%2===0?(f[x-1]+f[x])/2:f[x]}case"mode":{let f=new Map;for(let y of u){s.consumeWork?.();let w=String(y);f.set(w,(f.get(w)||0)+1)}let x=0,g=null;for(let[y,w]of f)s.consumeWork?.(),w>x&&(x=w,g=y);return g}case"cardinality":{let f=new Set;for(let x of u)s.consumeWork?.(),f.add(String(x));return f.size}case"values":return ot(u,!1,p,s);case"distinct_values":return ot(u,!0,p,s);default:return null}}function it(e,t,n={},s={}){let r=F();for(let o of t)b(r,o.alias,ce(e,o,n,s));return r}function ot(e,t,n,s){let r=[],o=t?new Set:null,i=0;for(let p of e){s.consumeWork?.();let h=String(p);if(o?.has(h))continue;o?.add(h);let m=K(h)+(r.length>0?1:0);if(m>n-i)throw new E(`xan: aggregation string limit exceeded (${n} bytes)`,"string_length");r.push(h),i+=m}return t&&(s.consumeWork?.(Q(r.length)),r.sort()),r.join("|")}function lt(e,t){return{maxArrayElements:e.limits.maxArrayElements,maxStringLength:e.limits.maxStringLength,maxIterations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth,consumeWork:(n=1)=>t.consumeWork(n)}}function at(e,t,n){let s=e.size-(t&&e.has("")?1:0);return n>0?Math.min(s,n):s}async function pe(e,t){let n="",s=[];for(let d of e)d.startsWith("-")||(n?s.push(d):n=d);if(!n)return{stdout:"",stderr:`xan agg: no aggregation expression
@@ -61,7 +61,7 @@ import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k
61
61
  `,exitCode:1};i=o[0].headers}let m=[];for(let{headers:c,data:a}of o)for(let d of a){let u=F();for(let l of i)b(u,l,c.includes(l)?d[l]:"");m.push(u)}return{stdout:C(i,m,t),stderr:"",exitCode:0}}async function Be(e,t){let n="",s=[],r=!1,o=!1,i=[];for(let u=0;u<e.length;u++){let l=e[u];(l==="-s"||l==="--select")&&u+1<e.length?s=e[++u].split(","):l==="-v"||l==="--invert"?r=!0:l==="-i"||l==="--ignore-case"?o=!0:l==="-r"||l==="--regex"||l.startsWith("-")||(n?i.push(l):n=l)}if(!n)return{stdout:"",stderr:`xan search: no pattern specified
62
62
  `,exitCode:1};let{headers:p,data:h,error:m}=await k(i,t);if(m)return m;let c=s.length>0?s:p,a;try{a=Z(n,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${n}'
63
63
  `,exitCode:1}}let d=h.filter(u=>{let l=c.some(f=>{let x=u[f];return x!=null&&a.test(String(x))});return r?!l:l});return{stdout:C(p,d,t),stderr:"",exitCode:0}}async function He(e,t){let n="",s=[];for(let l of e)l.startsWith("-")||(n?s.push(l):n=l);if(!n)return{stdout:"",stderr:`xan flatmap: no expression specified
64
- `,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-FOCYCKZQ.js");return n(e,t)}var dt=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),St=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...dt]),pt={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
64
+ `,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-GJVN6IHX.js");return n(e,t)}var dt=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),St=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...dt]),pt={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
65
65
  It provides a simple, ergonomic interface for common data operations.
66
66
 
67
67
  COMMANDS:
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as w}from"./chunk-WZQNMEQW.js";import{b as m}from"./chunk-AYSZ5MAE.js";import{d as v}from"./chunk-FTET43KM.js";import{e as B}from"./chunk-CM4T4GB4.js";import{l as z}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as F,b as E}from"./chunk-QAYAQNCG.js";import{constants as C,gunzipSync as _,gzipSync as A}from"node:zlib";var D={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
2
+ import{a as w}from"./chunk-WZQNMEQW.js";import{b as m}from"./chunk-A3C4Z3Q3.js";import{e as v}from"./chunk-ZUEPJPYA.js";import{e as B}from"./chunk-CM4T4GB4.js";import{l as z}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as F,b as E}from"./chunk-QAYAQNCG.js";import{constants as C,gunzipSync as _,gzipSync as A}from"node:zlib";var D={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
3
3
 
4
4
  When no FILE is given, or when FILE is -, read from standard input.
5
5
 
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as _}from"./chunk-WZQNMEQW.js";import{a as $e}from"./chunk-TDD4NFYE.js";import{a as D}from"./chunk-4KZT23KR.js";import{b as le}from"./chunk-ZBUZKIPX.js";import{a as q}from"./chunk-GN6CQ3J4.js";import{a as Se,b as Be,c as fe}from"./chunk-QAYAQNCG.js";var nt="file",it="link",st="symlink",Le="directory",at={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},ot={0:nt,1:it,2:st,3:"character-device",4:"block-device",5:Le,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},ct=new Uint8Array(512),V=new Uint8Array(0),I=new TextEncoder,Q=new TextDecoder;function P(e,t,r,n){n&&I.encodeInto(n,e.subarray(t,t+r))}function j(e,t,r,n){if(n===void 0)return;let i=n.toString(8).padStart(r-1,"0");I.encodeInto(i,e.subarray(t,t+r-1))}function F(e,t,r){let n=e.indexOf(0,t),i=n===-1||n>t+r?t+r:n;return Q.decode(e.subarray(t,i))}function me(e,t,r){let n=0,i=t+r;for(let s=t;s<i;s++){let a=e[s];if(a===0)break;a!==32&&(n=n*8+(a-48))}return n}function Y(e,t,r){if(e[t]&128){let n=0;n=e[t]&127;for(let i=1;i<r;i++)n=n*256+e[t+i];if(!Number.isSafeInteger(n))throw new Error("TAR number too large");return n}return me(e,t,r)}var M=e=>e.type==="directory"||e.type==="symlink"||e.type==="link"||e.type==="character-device"||e.type==="block-device"||e.type==="fifo";async function Ne(e){if(e==null)return V;if(e instanceof Uint8Array)return e;if(typeof e=="string")return I.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}var Te=(e,t)=>{let r=e.split("/").filter(Boolean);return t>=r.length?"":r.slice(t).join("/")};function he(e,t){let{strip:r,filter:n,map:i}=t;if(!r&&!n&&!i)return e;let s={...e};if(r&&r>0){let o=Te(s.name,r);if(!o)return null;if(s.name=s.type==="directory"&&!o.endsWith("/")?`${o}/`:o,s.linkname){let c=s.linkname.startsWith("/");if(c||s.type==="link"){let l=Te(s.linkname,r);s.linkname=c?`/${l}`||"/":l}}}if(n?.(s)===!1)return null;let a=i?i(s):s;return a&&(!a.name||!a.name.trim()||a.name==="."||a.name==="/")?null:a}var K=256;function lt(){let e=new Array(K),t=e.length-1,r=0,n=0,i=0,s=o=>{let c=e[r];o===c.length?(e[r]=V,r=r+1&t):e[r]=c.subarray(o),i-=o,i===0&&e.length>K&&(e=new Array(K),t=K-1,r=0,n=0)};function a(o,c){if(c){let y=0,d=Math.min(o,i);for(;d>0;){let m=e[r],p=Math.min(d,m.length),b=p===m.length?m:m.subarray(0,p);if(s(p),d-=p,y+=p,!c(b))break}return y}if(i<o)return null;if(o===0)return V;let l=e[r];if(l.length>=o){let y=l.length===o?l:l.subarray(0,o);return s(o),y}let f=new Uint8Array(o),u=0,h=o;for(;h>0;){let y=e[r],d=Math.min(h,y.length);f.set(d===y.length?y:y.subarray(0,d),u),u+=d,h-=d,s(d)}return f}return{push:o=>{if(o.length===0)return;let c=n+1&t;if(c===r){let l=e.length,f=l*2,u=new Array(f),h=n-r+l&l-1;if(r<n)for(let y=0;y<h;y++)u[y]=e[r+y];else if(h>0){let y=l-r;for(let d=0;d<y;d++)u[d]=e[r+d];for(let d=0;d<n;d++)u[y+d]=e[d]}e=u,t=f-1,r=0,n=h,c=n+1&t}e[n]=o,n=c,i+=o.length},available:()=>i,peek:o=>{if(i<o)return null;if(o===0)return V;let c=e[r];if(c.length>=o)return c.length===o?c:c.subarray(0,o);let l=new Uint8Array(o),f=0,u=r;for(;f<o;){let h=e[u],y=Math.min(o-f,h.length);y===h.length?l.set(h,f):l.set(h.subarray(0,y),f),f+=y,u=u+1&t}return l},discard:o=>{if(o>i)throw new Error("Too many bytes consumed");if(o===0)return;let c=o;for(;c>0;){let l=e[r],f=Math.min(c,l.length);s(f),c-=f}},pull:a}}var de=32,ft=48;function ut(e){let t=me(e,148,8),r=0;for(let n=0;n<e.length;n++)n>=148&&n<156?r+=de:r+=e[n];return t===r}function dt(e){e.fill(de,148,156);let t=0;for(let r of e)t+=r;for(let r=153;r>=148;r--)e[r]=(t&7)+ft,t>>=3;e[154]=0,e[155]=de}var mt=256;function ht(e){let t={};I.encode(e.name).length>100&&Ue(e.name)===null&&(t.path=e.name),e.linkname&&I.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&I.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&I.encode(e.gname).length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let r=Object.entries(t);if(r.length===0)return null;let n=I.encode(r.map(([i,s])=>{let a=`${i}=${s}
2
+ import{a as _}from"./chunk-WZQNMEQW.js";import{a as $e}from"./chunk-TDD4NFYE.js";import{a as D}from"./chunk-O5BHWBYH.js";import{b as le}from"./chunk-A6SU3BZX.js";import{a as q}from"./chunk-GN6CQ3J4.js";import{a as Se,b as Be,c as fe}from"./chunk-QAYAQNCG.js";var nt="file",it="link",st="symlink",Le="directory",at={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},ot={0:nt,1:it,2:st,3:"character-device",4:"block-device",5:Le,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},ct=new Uint8Array(512),V=new Uint8Array(0),I=new TextEncoder,Q=new TextDecoder;function P(e,t,r,n){n&&I.encodeInto(n,e.subarray(t,t+r))}function j(e,t,r,n){if(n===void 0)return;let i=n.toString(8).padStart(r-1,"0");I.encodeInto(i,e.subarray(t,t+r-1))}function F(e,t,r){let n=e.indexOf(0,t),i=n===-1||n>t+r?t+r:n;return Q.decode(e.subarray(t,i))}function me(e,t,r){let n=0,i=t+r;for(let s=t;s<i;s++){let a=e[s];if(a===0)break;a!==32&&(n=n*8+(a-48))}return n}function Y(e,t,r){if(e[t]&128){let n=0;n=e[t]&127;for(let i=1;i<r;i++)n=n*256+e[t+i];if(!Number.isSafeInteger(n))throw new Error("TAR number too large");return n}return me(e,t,r)}var M=e=>e.type==="directory"||e.type==="symlink"||e.type==="link"||e.type==="character-device"||e.type==="block-device"||e.type==="fifo";async function Ne(e){if(e==null)return V;if(e instanceof Uint8Array)return e;if(typeof e=="string")return I.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}var Te=(e,t)=>{let r=e.split("/").filter(Boolean);return t>=r.length?"":r.slice(t).join("/")};function he(e,t){let{strip:r,filter:n,map:i}=t;if(!r&&!n&&!i)return e;let s={...e};if(r&&r>0){let o=Te(s.name,r);if(!o)return null;if(s.name=s.type==="directory"&&!o.endsWith("/")?`${o}/`:o,s.linkname){let c=s.linkname.startsWith("/");if(c||s.type==="link"){let l=Te(s.linkname,r);s.linkname=c?`/${l}`||"/":l}}}if(n?.(s)===!1)return null;let a=i?i(s):s;return a&&(!a.name||!a.name.trim()||a.name==="."||a.name==="/")?null:a}var K=256;function lt(){let e=new Array(K),t=e.length-1,r=0,n=0,i=0,s=o=>{let c=e[r];o===c.length?(e[r]=V,r=r+1&t):e[r]=c.subarray(o),i-=o,i===0&&e.length>K&&(e=new Array(K),t=K-1,r=0,n=0)};function a(o,c){if(c){let y=0,d=Math.min(o,i);for(;d>0;){let m=e[r],p=Math.min(d,m.length),b=p===m.length?m:m.subarray(0,p);if(s(p),d-=p,y+=p,!c(b))break}return y}if(i<o)return null;if(o===0)return V;let l=e[r];if(l.length>=o){let y=l.length===o?l:l.subarray(0,o);return s(o),y}let f=new Uint8Array(o),u=0,h=o;for(;h>0;){let y=e[r],d=Math.min(h,y.length);f.set(d===y.length?y:y.subarray(0,d),u),u+=d,h-=d,s(d)}return f}return{push:o=>{if(o.length===0)return;let c=n+1&t;if(c===r){let l=e.length,f=l*2,u=new Array(f),h=n-r+l&l-1;if(r<n)for(let y=0;y<h;y++)u[y]=e[r+y];else if(h>0){let y=l-r;for(let d=0;d<y;d++)u[d]=e[r+d];for(let d=0;d<n;d++)u[y+d]=e[d]}e=u,t=f-1,r=0,n=h,c=n+1&t}e[n]=o,n=c,i+=o.length},available:()=>i,peek:o=>{if(i<o)return null;if(o===0)return V;let c=e[r];if(c.length>=o)return c.length===o?c:c.subarray(0,o);let l=new Uint8Array(o),f=0,u=r;for(;f<o;){let h=e[u],y=Math.min(o-f,h.length);y===h.length?l.set(h,f):l.set(h.subarray(0,y),f),f+=y,u=u+1&t}return l},discard:o=>{if(o>i)throw new Error("Too many bytes consumed");if(o===0)return;let c=o;for(;c>0;){let l=e[r],f=Math.min(c,l.length);s(f),c-=f}},pull:a}}var de=32,ft=48;function ut(e){let t=me(e,148,8),r=0;for(let n=0;n<e.length;n++)n>=148&&n<156?r+=de:r+=e[n];return t===r}function dt(e){e.fill(de,148,156);let t=0;for(let r of e)t+=r;for(let r=153;r>=148;r--)e[r]=(t&7)+ft,t>>=3;e[154]=0,e[155]=de}var mt=256;function ht(e){let t={};I.encode(e.name).length>100&&Ue(e.name)===null&&(t.path=e.name),e.linkname&&I.encode(e.linkname).length>100&&(t.linkpath=e.linkname),e.uname&&I.encode(e.uname).length>32&&(t.uname=e.uname),e.gname&&I.encode(e.gname).length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let r=Object.entries(t);if(r.length===0)return null;let n=I.encode(r.map(([i,s])=>{let a=`${i}=${s}
3
3
  `,o=I.encode(a).length+1,c=o+String(o).length;return c=o+String(c).length,`${c} ${a}`}).join(""));return{paxHeader:Pe({name:Q.decode(I.encode(`PaxHeader/${e.name}`).slice(0,100)),size:n.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:n}}function Ue(e){let t=I.encode(e).length;if(t<=100||t>mt)return null;for(let r=e.length-1;r>0;r--){if(e[r]!=="/")continue;let n=e.slice(0,r),i=e.slice(r+1);if(I.encode(n).length<=155&&I.encode(i).length<=100)return{prefix:n,name:i}}return null}function Pe(e){let t=new Uint8Array(512),r=M(e)?0:e.size??0,n=e.name,i="";if(!e.pax?.path){let s=Ue(n);s&&(n=s.name,i=s.prefix)}return P(t,0,100,n),j(t,100,8,e.mode??(e.type==="directory"?493:420)),j(t,108,8,e.uid??0),j(t,116,8,e.gid??0),j(t,124,12,r),j(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),P(t,156,1,at[e.type??"file"]),P(t,157,100,e.linkname),P(t,257,6,"ustar\0"),P(t,263,2,"00"),P(t,265,32,e.uname),P(t,297,32,e.gname),P(t,345,155,i),dt(t),t}function pt(e,t){if(t&&!ut(e))throw new Error("Invalid tar header checksum.");let r=F(e,156,1),n={name:F(e,0,100),mode:me(e,100,8),uid:Y(e,108,8),gid:Y(e,116,8),size:Y(e,124,12),mtime:new Date(Y(e,136,12)*1e3),type:ot[r]||"file",linkname:F(e,157,100)},i=F(e,257,6);return i.trim()==="ustar"&&(n.uname=F(e,265,32),n.gname=F(e,297,32)),i==="ustar"&&(n.prefix=F(e,345,155)),n}var Ie={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>/^\d+$/.test(e)&&Number.isSafeInteger(+e)?+e:NaN],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function gt(e){let t=Object.create(null),r=Object.create(null),n=!1,i=0;for(;i<e.length;){let s=e.indexOf(32,i);if(s===-1)break;let a=parseInt(Q.decode(e.subarray(i,s)),10);if(!(a>0))break;let o=i+a,c=Q.decode(e.subarray(s+1,o-1)),l=c.indexOf("=");if(l>0){let f=c.slice(0,l),u=c.slice(l+1);if(r[f]=u,n=!0,Object.hasOwn(Ie,f)){let[h,y]=Ie[f],d=y(u);(typeof d=="string"||!Number.isNaN(d))&&(t[h]=d)}}i=o}return n&&(t.pax=r),t}function Oe(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function yt(e){switch(e){case"pax-global-header":case"pax-header":return gt;case"gnu-long-name":return t=>({name:F(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:F(t,0,t.length)});default:return}}function wt(e){let t=Pe(e),r=ht(e);if(!r)return[t];let n=-r.paxBody.length&511,i=n>0?[ct.subarray(0,n)]:[];return[r.paxHeader,r.paxBody,...i,t]}var ue=0,H=1,xt=8*1024*1024,J=new Error("Tar archive is truncated.");function pe(e={}){let t=e.strict??!1,{available:r,peek:n,push:i,discard:s,pull:a}=lt(),o=ue,c=!1,l=!1,f=!1,u=null,h={},y={},d={isEntryActive:()=>o===H,isBodyComplete:()=>!u||u.remaining===0,canFinish:()=>!u||r()>=u.remaining+u.padding,bodyBytes:()=>u&&u.remaining>0?Math.min(u.remaining,r()):0,write(m){if(c)throw new Error("Archive already ended.");i(m)},end(){c=!0},readHeader(){if(o!==ue)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(r()<512){if(c){if(r()>0&&t)throw J;l=!0;return}return null}let m=n(512);if(Fe(m)){if(r()<512*2){if(c){if(t)throw J;l=!0;return}return null}if(Fe(n(512*2).subarray(512))){s(512*2),l=!0,f=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let p;try{p=pt(m,t)}catch(z){if(t)throw z;s(512);continue}let b=yt(p.type);if(b){if(p.size>xt)throw new Error("Tar metadata entry exceeds maximum size.");let z=p.size+(-p.size&511);if(r()<512+z){if(c&&t)throw J;return null}s(512);let C=b(a(z).subarray(0,p.size));y.pax&&(y={});let A=p.type==="pax-global-header"?h:y;for(let W in C)A[W]=C[W];continue}s(512);let w=p;p.prefix&&(w.name=`${p.prefix}/${w.name}`),Oe(w,h),Oe(w,y);let S=w.size;return M(w)?(S=0,w.size=0):w.name.endsWith("/")&&w.type==="file"&&(w.type=Le,w.size=0),y={},u={header:w,remaining:S,padding:-S&511},o=H,w}},streamBody(m){if(o!==H||!u||u.remaining===0)return 0;let p=Math.min(u.remaining,r());if(p===0)return 0;let b=a(p,m);return u.remaining-=b,b},skipPadding(){if(o!==H||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return r()<u.padding?!1:(s(u.padding),u=null,o=ue,!0)},skipEntry(){if(o!==H||!u)return!0;let m=Math.min(u.remaining,r());return m>0&&(s(m),u.remaining-=m),u.remaining>0?!1:d.skipPadding()},validateEOF(){if(t){if(!f)throw J;if(r()>0&&a(r()).some(m=>m!==0))throw new Error("Invalid EOF.")}}};return d}function Fe(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let r=0;r<t.length;r++)if(t[r]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}var bt=new Uint8Array(512*2);function Re(e,t,r){let n=null,i=0,s=!1,a=o=>{let c=new Error(o);throw t(c),c};return{add(o){s&&a("No new tar entries after finalize."),n!==null&&a("Previous entry must be completed before adding a new one");let c=M(o)?0:o.size;(!Number.isSafeInteger(c)||c<0)&&a("Invalid tar entry size.");try{let l=wt({...o,size:c});for(let f of l)e(f);n={...o,size:c},i=0}catch(l){t(l)}},write(o){n||a("No active tar entry."),s&&a("Cannot write data after finalize.");let c=i+o.length;c>n.size&&a(`"${n.name}" exceeds given size of ${n.size} bytes.`);try{i=c,e(o)}catch(l){t(l)}},endEntry(){n||a("No active entry to end."),s&&a("Cannot end entry after finalize.");try{i!==n.size&&a(`Size mismatch for "${n.name}".`);let o=-n.size&511;o>0&&e(new Uint8Array(o)),n=null,i=0}catch(o){throw t(o),o}},finalize(){s&&a("Archive has already been finalized"),n!==null&&a("Cannot finalize while an entry is still active");try{e(bt),s=!0,r&&r()}catch(o){t(o)}}}}function De(){return new CompressionStream("gzip")}function We(){return new DecompressionStream("gzip")}function zt(){let e,t;return{readable:new ReadableStream({start(r){e=r,t=Re(r.enqueue.bind(r),r.error.bind(r),r.close.bind(r))}}),controller:{add(r){let n=M(r);return t.add(r),n&&t.endEntry(),new WritableStream({write(i){t.write(i)},close(){n||t.endEntry()},abort(i){e.error(i)}})},finalize(){t.finalize()},error(r){e.error(r)}}}}async function _e(e){let t=[],r=e.getReader(),n=0;try{for(;;){let{done:a,value:o}=await r.read();if(a)break;t.push(o),n+=o.length}let i=new Uint8Array(n),s=0;for(let a of t)i.set(a,s),s+=a.length;return i}finally{r.releaseLock()}}var Me=e=>e.pipeTo(new WritableStream);function vt(e={}){let t=pe(e),r=e.strict??!1,n=null,i=null,s=!1,a=!1,o=!1,c=!1,l=()=>{try{i?.close()}catch{}i=null},f=d=>{if(!c){c=!0;try{i?.error(d)}catch{}i=null;try{n.error(d)}catch{}n=null}},u=()=>{if(!c){c=!0,l();try{n.close()}catch{}n=null}},h=()=>{if(r)throw new Error("Tar archive is truncated.");u()},y=()=>{if(!(s||c||!n)){s=!0;try{for(;;){if(a){o&&(t.validateEOF(),u());break}if(t.isEntryActive()){if(o&&!t.canFinish()){h();break}if(i){if((i.desiredSize??1)<=0)break;if(t.streamBody(d=>(i.enqueue(d),(i.desiredSize??1)>0))===0&&!t.isBodyComplete()){o&&h();break}}else if(!t.skipEntry()){o&&h();break}if(t.isBodyComplete()&&(l(),!t.skipPadding())){o&&h();break}}else{if((n.desiredSize??0)<0)break;let d=t.readHeader();if(d===null){o&&u();break}if(d===void 0){if(o){t.validateEOF(),u();break}a=!0;break}n.enqueue({header:d,body:new ReadableStream({start(m){d.size===0?m.close():i=m},pull:y,cancel(){i=null,y()}})})}}}catch(d){throw f(d),d}finally{s=!1}}};return{readable:new ReadableStream({start(d){n=d},pull:y,cancel(d){d!==void 0?f(d):u()}},{highWaterMark:2}),writable:new WritableStream({write(d){try{if(a&&r&&d.some(m=>m!==0))throw new Error("Invalid EOF.");t.write(d),y()}catch(m){throw f(m),m}},close(){try{o=!0,t.end(),y()}catch(d){throw f(d),d}},abort(d){f(d)}})}}async function je(e){let{readable:t,controller:r}=zt();return await(async()=>{for(let n of e){let i=r.add(n.header),s="body"in n?n.body:n.data;if(!s){await i.close();continue}if(s instanceof ReadableStream)await s.pipeTo(i);else if(s instanceof Blob)await s.stream().pipeTo(i);else try{let a=await Ne(s);if(a.length>0){let o=i.getWriter();await o.write(a),await o.close()}else await i.close()}catch{throw new TypeError(`Unsupported content type for entry "${n.header.name}".`)}}})().then(()=>r.finalize()).catch(n=>r.error(n)),_e(t)}async function He(e,t={}){if(!(e instanceof ReadableStream))return kt(e instanceof Uint8Array?e:new Uint8Array(e),t);let r=[],n=e.pipeThrough(vt(t));for await(let i of n){let s;try{s=he(i.header,t)}catch(a){throw await i.body.cancel(),a}if(s===null){await Me(i.body);continue}M(s)?(await Me(i.body),r.push({header:s})):r.push({header:s,data:await _e(i.body)})}return r}function kt(e,t){let r=pe(t),n=t.strict??!1,i=[];for(r.write(e),r.end();;){let s=r.readHeader();if(s===void 0)break;if(s===null){if(n)throw new Error("Tar archive is truncated.");break}let a=he(s,t);if(a===null){let h=r.skipEntry();if(!h&&n)throw new Error("Tar archive is truncated.");if(!h)break;continue}if(M(a)){let h=r.skipEntry();if(!h&&n)throw new Error("Tar archive is truncated.");if(i.push({header:a}),!h)break;continue}let o=s.size;if(o<0||!r.canFinish()){if(n)throw new Error("Tar archive is truncated.");o=r.bodyBytes()}let c=new Uint8Array(o),l=0;r.streamBody(h=>(c.set(h,l),l+=h.length,!0));let f=r.isBodyComplete(),u=!0;if(f&&(u=r.skipPadding(),!u&&n))throw new Error("Tar archive is truncated.");if(i.push({header:a,data:c}),!f||!u)break}return r.validateEOF(),i}import Lt from"seek-bzip";var Ct=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t<<24;for(let n=0;n<8;n++)r=r&2147483648?r<<1^79764919:r<<1;e[t]=r>>>0}return e})();function At(e,t){return(e<<8^Ct[(e>>>24^t)&255])>>>0}var ge=class{maxOutputBytes;buffer=[];current=0;bitCount=0;constructor(t=Number.MAX_SAFE_INTEGER){if(this.maxOutputBytes=t,!Number.isSafeInteger(t)||t<0)throw new Error("Invalid bzip2 output limit")}pushByte(t){if(this.buffer.length>=this.maxOutputBytes)throw new Error(`bzip2 output exceeds limit (${this.maxOutputBytes} bytes)`);this.buffer.push(t)}writeBits(t,r){for(let n=t-1;n>=0;n--)this.current=this.current<<1|r>>>n&1,this.bitCount++,this.bitCount===8&&(this.pushByte(this.current),this.current=0,this.bitCount=0)}writeBit(t){this.current=this.current<<1|t&1,this.bitCount++,this.bitCount===8&&(this.pushByte(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.pushByte(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function Et(e){let t=[],r=0;for(;r<e.length;){let n=e[r],i=1;for(;r+i<e.length&&e[r+i]===n&&i<255;)i++;i>=4?(t.push(n,n,n,n),t.push(i-4),r+=i):(t.push(n),r++)}return new Uint8Array(t)}function St(e){let t=e.length;if(t===0)return{transformed:new Uint8Array(0),pointer:0};let r=Bt(e),n=new Uint8Array(t),i=0;for(let s=0;s<t;s++)r[s]===0?(i=s,n[s]=e[t-1]):n[s]=e[r[s]-1];return{transformed:n,pointer:i}}function Bt(e){let t=e.length,r=new Int32Array(t),n=new Int32Array(t);for(let i=0;i<t;i++)r[i]=i,n[i]=e[i];for(let i=1;i<t;i*=2){let s=n.slice();r.sort((a,o)=>s[a]!==s[o]?s[a]-s[o]:s[(a+i)%t]-s[(o+i)%t]),n[r[0]]=0;for(let a=1;a<t;a++)s[r[a]]===s[r[a-1]]&&s[(r[a]+i)%t]===s[(r[a-1]+i)%t]?n[r[a]]=n[r[a-1]]:n[r[a]]=n[r[a-1]]+1;if(n[r[t-1]]===t-1)break}return r}function $t(e,t){let r=[];for(let a=0;a<256;a++)t[a]&&r.push(a);let n=new Array(256).fill(-1);for(let a=0;a<r.length;a++)n[r[a]]=a;let i=new Uint16Array(e.length),s=r.slice();for(let a=0;a<e.length;a++){let o=e[a],c=0;for(;s[c]!==o;)c++;if(i[a]=c,c>0){let l=s[c];for(let f=c;f>0;f--)s[f]=s[f-1];s[0]=l}}return{encoded:i,length:e.length}}function Tt(e,t,r){let s=r+1,a=[],o=0;for(;o<t;)if(e[o]===0){let l=0;for(;o<t&&e[o]===0;)l++,o++;let f=l;for(;f>0;)f--,f&1?a.push(1):a.push(0),f>>>=1}else a.push(e[o]+1),o++;a.push(s);let c=new Uint16Array(a.length);for(let l=0;l<a.length;l++)c[l]=a[l];return{symbols:c,length:a.length,eob:s}}function Xe(e,t,r){if(t<=1){let l=new Array(e.length).fill(0);for(let f=0;f<e.length;f++)e[f]>0&&(l[f]=1);return{codeLengths:l,maxLen:1,minLen:1}}let n=[];for(let l=0;l<e.length;l++)e[l]>0&&n.push({freq:e[l],symbol:l,left:null,right:null});if(n.length===0)return{codeLengths:new Array(e.length).fill(0),maxLen:0,minLen:0};if(n.length===1){let l=new Array(e.length).fill(0);return l[n[0].symbol]=1,{codeLengths:l,maxLen:1,minLen:1}}for(;n.length>1;){n.sort((u,h)=>u.freq-h.freq);let l=n.shift(),f=n.shift();n.push({freq:l.freq+f.freq,symbol:-1,left:l,right:f})}let i=new Array(e.length).fill(0);function s(l,f){if(!l.left&&!l.right){i[l.symbol]=f;return}l.left&&s(l.left,f+1),l.right&&s(l.right,f+1)}s(n[0],0);let a=!0;for(;a;){a=!1;for(let l=0;l<i.length;l++)i[l]>r&&(i[l]=r,a=!0);if(a){let l=0;for(let f=0;f<i.length;f++)i[f]>0&&(l+=1/(1<<i[f]));if(l>1)for(let f=1;f<r&&l>1;f++)for(let u=0;u<i.length&&l>1;u++)i[u]===f&&(i[u]++,l-=1/(1<<f)-1/(1<<f+1));a=!1;for(let f=0;f<i.length;f++)if(i[f]>r){a=!0;break}}}let o=r,c=0;for(let l=0;l<i.length;l++)i[l]>0&&(i[l]<o&&(o=i[l]),i[l]>c&&(c=i[l]));return{codeLengths:i,maxLen:c,minLen:o}}function It(e,t){let r=new Array(t).fill(0),n=e.slice(0,t),i=Math.max(...n,0),s=new Array(i+1).fill(0);for(let c=0;c<t;c++)n[c]>0&&s[n[c]]++;let a=new Array(i+1).fill(0),o=0;for(let c=1;c<=i;c++)o=o+s[c-1]<<1,a[c]=o;for(let c=0;c<t;c++)n[c]>0&&(r[c]=a[n[c]]++);return{codes:r,lengths:n}}function Ot(e,t,r){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,r),e.writeBit(0);let n=Et(t),{transformed:i,pointer:s}=St(n);e.writeBits(24,s);let a=new Array(256).fill(!1);for(let g=0;g<i.length;g++)a[i[g]]=!0;let o=new Array(16).fill(!1);for(let g=0;g<16;g++)for(let x=0;x<16;x++)if(a[g*16+x]){o[g]=!0;break}for(let g=0;g<16;g++)e.writeBit(o[g]?1:0);for(let g=0;g<16;g++)if(o[g])for(let x=0;x<16;x++)e.writeBit(a[g*16+x]?1:0);let c=0;for(let g=0;g<256;g++)a[g]&&c++;let{encoded:l,length:f}=$t(i,a),{symbols:u,length:h}=Tt(l,f,c),y=c+2,d=50,m=Math.ceil(h/d),p;h<200?p=2:h<600?p=3:h<1200?p=4:h<2400?p=5:p=6,p>m&&(p=Math.max(2,m));let b=[];for(let g=0;g<p;g++)b.push(new Array(y).fill(0));let w=new Int32Array(m);for(let g=0;g<m;g++)w[g]=g%p;for(let g=0;g<m;g++){let x=g*d,v=Math.min(x+d,h),T=w[g];for(let E=x;E<v;E++)b[T][u[E]]++}function S(g){for(let x=0;x<y;x++)g[x]<1&&(g[x]=1)}let z=[];for(let g=0;g<p;g++)S(b[g]),z.push(Xe(b[g],y,20));for(let g=0;g<4;g++){for(let x=0;x<p;x++)b[x].fill(0);for(let x=0;x<m;x++){let v=x*d,T=Math.min(v+d,h),E=0,Z=1/0;for(let U=0;U<p;U++){let oe=0;for(let ce=v;ce<T;ce++)oe+=z[U].codeLengths[u[ce]]||20;oe<Z&&(Z=oe,E=U)}w[x]=E;for(let U=v;U<T;U++)b[E][u[U]]++}for(let x=0;x<p;x++)S(b[x]),z[x]=Xe(b[x],y,20)}e.writeBits(3,p),e.writeBits(15,m);let C=[],A=[];for(let g=0;g<p;g++)A.push(g);for(let g=0;g<m;g++){let x=w[g],v=0;for(;A[v]!==x;)v++;if(C.push(v),v>0){let T=A[v];for(let E=v;E>0;E--)A[E]=A[E-1];A[0]=T}}for(let g=0;g<m;g++){for(let x=0;x<C[g];x++)e.writeBit(1);e.writeBit(0)}for(let g=0;g<p;g++){let x=z[g].codeLengths,v=x[0];e.writeBits(5,v);for(let T=0;T<y;T++){let E=x[T];for(;v<E;)e.writeBit(1),e.writeBit(0),v++;for(;v>E;)e.writeBit(1),e.writeBit(1),v--;e.writeBit(0)}}for(let g=0;g<p;g++){let{codes:x,lengths:v}=It(z[g].codeLengths,y);z[g]=Object.assign(z[g],{_codes:x,_lengths:v})}let W=0,G=0;for(let g=0;g<h;g++){(G===0||G>=d)&&(g>0&&W++,G=0);let x=w[W],v=z[x],T=u[g],E=v._lengths[T],Z=v._codes[T];E>0&&e.writeBits(E,Z),G++}}var Ft=10*1024*1024;function Ge(e,t=9,r=Ft,n=Number.MAX_SAFE_INTEGER){if(t<1||t>9)throw new Error("Block size level must be 1-9");if(e.length>r)throw new Error(`Input too large for bzip2 compression (${e.length} bytes, max ${r})`);let i=t*1e5,s=new ge(n);s.writeBits(8,66),s.writeBits(8,90),s.writeBits(8,104),s.writeBits(8,48+t);let a=0,o=0;for(;o<e.length;){let c=Math.min(o+i,e.length),l=e.subarray(o,c),f=4294967295;for(let u=0;u<l.length;u++)f=At(f,l[u]);f=~f>>>0,a=(a<<1|a>>>31)>>>0,a=(a^f)>>>0,Ot(s,l,f),o=c}return s.writeBits(24,1536581),s.writeBits(24,3690640),s.writeBits(32,a),s.finish()}var ee=null,te=null;async function Ze(){if(ee)return ee;if(te)throw te;try{return ee=await le.runTrustedAsync(()=>import("node-liblzma")),ee}catch{throw te=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),te}}var re=null,ne=null;async function qe(){if(re)return re;if(ne)throw ne;try{return re=await le.runTrustedAsync(()=>import("@mongodb-js/zstd")),re}catch{throw ne=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),ne}}var ye=1024*1024*1024,$=512,Nt=1e6;function X(e,t){let r=e??t;if(!Number.isSafeInteger(r)||r<=0)throw new Error("Archive limits must be positive safe integers");return r}function O(e){return{maxArchiveSize:X(e?.maxArchiveSize,ye),maxEntries:X(e?.maxEntries,Nt),maxEntrySize:X(e?.maxEntrySize,ye),maxCompressedSize:X(e?.maxCompressedSize,e?.maxArchiveSize??ye),maxExpansionRatio:X(e?.maxExpansionRatio,1e4),signal:e?.signal,executionScope:e?.executionScope,allowTrustedWholeBufferCodecs:e?.allowTrustedWholeBufferCodecs??!0}}function Ut(e,t){if(e.length>t.maxEntries)throw new Error(`Too many archive entries (max ${t.maxEntries})`);let r=i=>{if(!Number.isSafeInteger(i)||i<0||i>t.maxArchiveSize-n)throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);n+=i},n=$*2;for(let i of e){t.signal?.throwIfAborted();let s=i.isDirectory||i.isSymlink?0:typeof i.content=="string"?q(i.content):i.content?.length??0;if(s>t.maxEntrySize)throw new Error(`Archive entry too large (max ${t.maxEntrySize} bytes)`);let a=i.isDirectory&&!i.name.endsWith("/")?`${i.name}/`:i.name,o=q(a),c=q(i.linkTarget??"");if(o>t.maxArchiveSize||c>t.maxArchiveSize)throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);let l=0;if(o>100&&(l+=o+64),c>100&&(l+=c+64),!Number.isSafeInteger(l))throw new Error(`Archive too large (max ${t.maxArchiveSize} bytes)`);let f=Math.ceil(s/$)*$;if(r($+f),l>0){let u=Math.ceil(l/$)*$;r($+u)}}return n}function ie(e,t,r){return e.executionScope?.reserveBytes(t,r,`tar: ${t}`)}function Pt(e){let t=e.subarray(124,136);if((t[0]&128)!==0){let i=t[0]&127;for(let s=1;s<t.length;s++)if(i=i*256+t[s],!Number.isSafeInteger(i))return;return i}let r=new TextDecoder("ascii").decode(t).replace(/\0.*$/,"").trim();if(r==="")return 0;if(!/^[0-7]+$/.test(r))return;let n=Number.parseInt(r,8);return Number.isSafeInteger(n)?n:void 0}function Rt(e,t){let r=0,n=0;for(;r+$<=e.length;){t.signal?.throwIfAborted();let i=e.subarray(r,r+$);if(i.every(o=>o===0))return;if(n++,n>t.maxEntries)return`Too many entries (max ${t.maxEntries})`;let s=Pt(i);if(s===void 0)return"Invalid tar archive format";if(s>t.maxEntrySize)return`Archive entry too large (max ${t.maxEntrySize} bytes)`;let a=Math.ceil(s/$)*$;if(!Number.isSafeInteger(a)||(r+=$+a,r>e.length))return"Invalid tar archive format"}return r===e.length?void 0:"Invalid tar archive format"}function Mt(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let r=e.name;e.isDirectory&&!r.endsWith("/")&&(r+="/");let n;e.content!==void 0&&(typeof e.content=="string"?n=new TextEncoder().encode(e.content):n=e.content);let i=e.isDirectory||e.isSymlink?0:n?.length??0;return{header:{name:r,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:i,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:n}}async function R(e,t){let r=O(t),n=Ut(e,r),i=ie(r,"archive construction",n);try{let s=e.map(Mt),a=await je(s);if(r.signal?.throwIfAborted(),a.length>r.maxArchiveSize)throw new Error(`Archive too large (max ${r.maxArchiveSize} bytes)`);return a}finally{i?.release()}}async function Ye(e,t){let r=O(t),n=await R(e,r),i=ie(r,"gzip input",n.byteLength),s=new _({maxInputBytes:r.maxArchiveSize,maxOutputBytes:r.maxCompressedSize,signal:r.signal,label:"gzip archive"});s.acceptInput(n.length);let c=new ReadableStream({start(h){h.enqueue(n),h.close()}}).pipeThrough(De()).getReader(),l=[],f=[],u=0;try{for(;;){let{done:y,value:d}=await c.read();if(y)break;try{s.acceptOutput(d.length);let m=ie(r,"gzip chunks",d.byteLength);m&&f.push(m)}catch(m){throw await c.cancel(),m}u+=d.length,l.push(d)}let h=ie(r,"gzip result",u);try{let y=new Uint8Array(u),d=0;for(let m of l)y.set(m,d),d+=m.length;return y}finally{h?.release()}}finally{for(let h of f)h.release();i?.release()}}async function L(e,t){let r=O(t);if(e.length>r.maxArchiveSize)return{entries:[],error:`Archive too large (max ${r.maxArchiveSize} bytes)`};if(e.length<$||e.length%$!==0)return{entries:[],error:"Invalid tar archive format"};let n=Rt(e,r);if(n)return{entries:[],error:n};try{let i=await He(e),s=[];for(let a of i){if(r.signal?.throwIfAborted(),s.length>=r.maxEntries)return{entries:[],error:`Too many entries (max ${r.maxEntries})`};let o=a.data??new Uint8Array(0);if(a.header.size>r.maxEntrySize||o.length>r.maxEntrySize)return{entries:[],error:`Archive entry too large (max ${r.maxEntrySize} bytes)`};let c="file";switch(a.header.type){case"directory":c="directory";break;case"symlink":c="symlink";break;case"link":c="hardlink";break;case"file":c="file";break;default:c="other"}s.push({name:a.header.name,mode:a.header.mode??420,uid:a.header.uid??0,gid:a.header.gid??0,size:a.header.size,mtime:a.header.mtime??new Date,type:c,linkTarget:a.header.linkname||void 0,content:o})}return{entries:s}}catch(i){let s=i instanceof Error?i.message:"Unknown error";return{entries:[],error:s}}}async function we(e,t){let r=O(t);if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=new _({maxInputBytes:r.maxCompressedSize,maxOutputBytes:r.maxArchiveSize,maxExpansionRatio:r.maxExpansionRatio,signal:r.signal,label:"gzip archive"});n.acceptInput(e.length);let a=new ReadableStream({start(u){u.enqueue(e),u.close()}}).pipeThrough(We()).getReader(),o=[],c=0;for(;;){let{done:u,value:h}=await a.read();if(u)break;try{n.acceptOutput(h.length)}catch(y){throw await a.cancel(),y}c+=h.length,o.push(h)}let l=new Uint8Array(c),f=0;for(let u of o)l.set(u,f),f+=u.length;return L(l,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:`Decompression failed: ${i}`}}}function xe(e){return e.length>=2&&e[0]===31&&e[1]===139}function be(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function ze(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Dt(e,t){let r=new _({maxInputBytes:t.maxCompressedSize,maxOutputBytes:t.maxArchiveSize,maxExpansionRatio:t.maxExpansionRatio,signal:t.signal,label:"bzip2 archive"});r.acceptInput(e.length);let n=Math.min(64*1024,t.maxArchiveSize),i=[],s=Buffer.allocUnsafe(n),a=0,o=0,c={writeByte(l){r.acceptOutput(1),a===s.length&&(i.push(s),s=Buffer.allocUnsafe(n),a=0),s[a++]=l,o++}};return Lt.decode(Buffer.from(e),c),a>0&&i.push(s.subarray(0,a)),new Uint8Array(Buffer.concat(i,o))}async function Wt(e,t){let r=new _({maxInputBytes:t.maxArchiveSize,maxOutputBytes:t.maxCompressedSize,signal:t.signal,label:"bzip2 archive"});r.acceptInput(e.length);let n=await Ge(e,9,t.maxArchiveSize,t.maxCompressedSize);return r.acceptOutput(n.length),n}async function _t(e){let r=(await Ze()).unxzSync(Buffer.from(e));return new Uint8Array(r)}async function jt(e){let r=(await Ze()).xzSync(Buffer.from(e));return new Uint8Array(r)}async function Ke(e,t){let r=O(t),n=await R(e,r);return Wt(n,r)}async function Je(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)throw new Error("xz compression is disabled by configuration. Enable native and trusted whole-buffer codecs to use it.");let n=await R(e,r),i=await jt(n);if(r.signal?.throwIfAborted(),i.length>r.maxCompressedSize)throw new Error(`xz archive: output exceeds limit (${r.maxCompressedSize} bytes)`);return i}async function ve(e,t){let r=O({...t,maxArchiveSize:t?.maxDecompressedSize??t?.maxArchiveSize});if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await Dt(e,r);return L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return i===`bzip2 archive: output exceeds limit (${r.maxArchiveSize} bytes)`?{entries:[],error:`Decompressed archive too large (max ${r.maxArchiveSize} bytes)`}:{entries:[],error:i}}}async function ke(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)return{entries:[],error:"xz decompression is disabled by configuration. Enable native and trusted whole-buffer codecs, or decompress the archive externally before extraction."};if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await _t(e);return r.signal?.throwIfAborted(),n.length>r.maxArchiveSize?{entries:[],error:`Trusted xz codec produced data over limit (${r.maxArchiveSize} bytes)`}:L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:i}}}function Ce(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function Ht(e){let r=await(await qe()).compress(Buffer.from(e),3);return new Uint8Array(r)}async function Xt(e){let r=await(await qe()).decompress(Buffer.from(e));return new Uint8Array(r)}async function Ve(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)throw new Error("zstd compression is disabled by configuration. Enable native and trusted whole-buffer codecs to use it.");let n=await R(e,r),i=await Ht(n);if(r.signal?.throwIfAborted(),i.length>r.maxCompressedSize)throw new Error(`zstd archive: output exceeds limit (${r.maxCompressedSize} bytes)`);return i}async function Ae(e,t){let r=O(t);if(t?.allowNativeCodecs===!1||!r.allowTrustedWholeBufferCodecs)return{entries:[],error:"zstd decompression is disabled by configuration. Enable native and trusted whole-buffer codecs, or decompress the archive externally before extraction."};if(e.length>r.maxCompressedSize)return{entries:[],error:`Archive too large (max ${r.maxCompressedSize} bytes)`};try{let n=await Xt(e);return r.signal?.throwIfAborted(),n.length>r.maxArchiveSize?{entries:[],error:`Trusted zstd codec produced data over limit (${r.maxArchiveSize} bytes)`}:L(n,r)}catch(n){let i=n instanceof Error?n.message:"Unknown error";return{entries:[],error:i}}}function Qe(e){let t=e.length>0&&e[0]!==""&&!e[0].startsWith("-")?Gt(e):e,r={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},n=[],i=0;for(;i<t.length;){let s=t[i];if(s.startsWith("-")&&!s.startsWith("--")&&s.length>2){if(/^-\d+$/.test(s)){n.push(s),i++;continue}for(let a=1;a<s.length;a++){let o=s[a];switch(o){case"c":r.create=!0;break;case"r":r.append=!0;break;case"u":r.update=!0;break;case"x":r.extract=!0;break;case"t":r.list=!0;break;case"a":r.autoCompress=!0;break;case"z":r.gzip=!0;break;case"j":r.bzip2=!0;break;case"J":r.xz=!0;break;case"v":r.verbose=!0;break;case"O":r.toStdout=!0;break;case"k":r.keepOldFiles=!0;break;case"m":r.touch=!0;break;case"p":r.preserve=!0;break;case"P":r.absoluteNames=!0;break;case"f":if(a<s.length-1)r.file=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
4
4
  `,exitCode:2}};r.file=t[i]}break;case"C":if(a<s.length-1)r.directory=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
5
5
  `,exitCode:2}};r.directory=t[i]}break;case"T":if(a<s.length-1)r.filesFrom=s.substring(a+1),a=s.length;else{if(i++,i>=t.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as m}from"./chunk-4KZT23KR.js";import{b as x}from"./chunk-AYSZ5MAE.js";import{a as w}from"./chunk-FOCWZZDE.js";var k={name:"expr",async execute(i,a){if(i.length===0)return{stdout:"",stderr:`expr: missing operand
2
+ import{a as m}from"./chunk-O5BHWBYH.js";import{b as x}from"./chunk-A3C4Z3Q3.js";import{a as w}from"./chunk-FOCWZZDE.js";var k={name:"expr",async execute(i,a){if(i.length===0)return{stdout:"",stderr:`expr: missing operand
3
3
  `,exitCode:2};try{let t=S(i,h=>a.executionScope?.consumeWork(h,"expr index")),f=t==="0"||t===""?1:0;return{stdout:`${t}
4
4
  `,stderr:"",exitCode:f}}catch(t){return x(t),{stdout:"",stderr:`expr: ${w(t.message)}
5
5
  `,exitCode:2}}}};function S(i,a){if(i.length===1)return i[0];let t=0;function f(){let e=h();for(;t<i.length&&i[t]==="|";){t++;let r=h();if(e!=="0"&&e!=="")return e;e=r}return e}function h(){let e=g();for(;t<i.length&&i[t]==="&";){t++;let r=g();(e==="0"||e===""||r==="0"||r==="")&&(e="0")}return e}function g(){let e=p();for(;t<i.length;){let r=i[t];if(["=","!=","<",">","<=",">="].includes(r)){t++;let s=p(),o=parseInt(e,10),n=parseInt(s,10),l=!Number.isNaN(o)&&!Number.isNaN(n),c;r==="="?c=l?o===n:e===s:r==="!="?c=l?o!==n:e!==s:r==="<"?c=l?o<n:e<s:r===">"?c=l?o>n:e>s:r==="<="?c=l?o<=n:e<=s:c=l?o>=n:e>=s,e=c?"1":"0"}else break}return e}function p(){let e=N();for(;t<i.length;){let r=i[t];if(r==="+"||r==="-"){t++;let s=N(),o=parseInt(e,10),n=parseInt(s,10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");e=String(r==="+"?o+n:o-n)}else break}return e}function N(){let e=d();for(;t<i.length;){let r=i[t];if(r==="*"||r==="/"||r==="%"){t++;let s=d(),o=parseInt(e,10),n=parseInt(s,10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");if((r==="/"||r==="%")&&n===0)throw new Error("division by zero");r==="*"?e=String(o*n):r==="/"?e=String(Math.trunc(o/n)):e=String(o%n)}else break}return e}function d(){let e=u();for(;t<i.length&&i[t]===":";){t++;let r=u(),o=m(`^${r}`).match(e);o?e=o[1]!==void 0?o[1]:String(o[0].length):e="0"}return e}function u(){if(t>=i.length)throw new Error("syntax error");let e=i[t];if(e==="match"){t++;let r=u(),s=u(),n=m(s).match(r);return n?n[1]!==void 0?n[1]:String(n[0].length):"0"}if(e==="substr"){t++;let r=u(),s=parseInt(u(),10),o=parseInt(u(),10);if(Number.isNaN(s)||Number.isNaN(o))throw new Error("non-integer argument");return r.substring(s-1,s-1+o)}if(e==="index"){t++;let r=u(),s=u();a(s.length+r.length);let o=new Set;for(let n=0;n<s.length;n++)o.add(s[n]);for(let n=0;n<r.length;n++)if(o.has(r[n]))return String(n+1);return"0"}if(e==="length"){t++;let r=u();return String(r.length)}if(e==="("){t++;let r=f();if(t>=i.length||i[t]!==")")throw new Error("syntax error");return t++,r}return t++,e}let b=f();if(t!==i.length)throw new Error("syntax error");return b}var C={name:"expr",flags:[],needsArgs:!0};export{k as a,C as b};
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as n}from"./chunk-TDD4NFYE.js";import{b as $}from"./chunk-AYSZ5MAE.js";import{l as F}from"./chunk-TVCZIH6M.js";import{a as S}from"./chunk-GN6CQ3J4.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as z,b as O}from"./chunk-QAYAQNCG.js";var M={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},E={format:{short:"c",type:"string"}},I={name:"stat",async execute(l,s){if(O(l))return z(M);let o=x("stat",l,E);if(!o.ok)return o.error;let m=o.result.flags.format??null,u=o.result.positional;if(u.length===0)return{stdout:"",stderr:`stat: missing operand
2
+ import{a as n}from"./chunk-TDD4NFYE.js";import{b as $}from"./chunk-A3C4Z3Q3.js";import{l as F}from"./chunk-TVCZIH6M.js";import{a as S}from"./chunk-GN6CQ3J4.js";import{a as x}from"./chunk-QIQMJJZ4.js";import{a as z,b as O}from"./chunk-QAYAQNCG.js";var M={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},E={format:{short:"c",type:"string"}},I={name:"stat",async execute(l,s){if(O(l))return z(M);let o=x("stat",l,E);if(!o.ok)return o.error;let m=o.result.flags.format??null,u=o.result.positional;if(u.length===0)return{stdout:"",stderr:`stat: missing operand
3
3
  `,exitCode:1};let c="",f="",p=!1,d=0,g=Math.min(s.limits.maxOutputSize,s.limits.maxStringLength),h=e=>{let r=S(e);if(r>g-d)throw new F(`stat: output size limit exceeded (${g} bytes)`,"output_size");c+=e,d+=r};for(let e of u){let r=s.fs.resolvePath(s.cwd,e);try{let t=await s.fs.stat(r);if(m){let a=t.mode.toString(8),i=n(t.mode,t.isDirectory),w=new Map([["%n",e],["%N",`'${e}'`],["%s",String(t.size)],["%F",t.isDirectory?"directory":"regular file"],["%a",a],["%A",i],["%u","1000"],["%U","user"],["%g","1000"],["%G","group"]]),A=m.replace(/%[nNsFaAuUgG]/g,y=>w.get(y)??y);h(`${A}
4
4
  `)}else{let a=t.mode.toString(8).padStart(4,"0"),i=n(t.mode,t.isDirectory);h(` File: ${e}
5
5
  Size: ${t.size} Blocks: ${Math.ceil(t.size/512)}
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as w}from"./chunk-AYSZ5MAE.js";import{d as b}from"./chunk-FTET43KM.js";import{d as S,e as F}from"./chunk-CM4T4GB4.js";import{a as v,b as $,c as y}from"./chunk-QAYAQNCG.js";var E={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
2
+ import{b as w}from"./chunk-A3C4Z3Q3.js";import{e as b}from"./chunk-ZUEPJPYA.js";import{d as S,e as F}from"./chunk-CM4T4GB4.js";import{a as v,b as $,c as y}from"./chunk-QAYAQNCG.js";var E={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
3
3
  `,exitCode:1};let i=!1,f=!1,n=0;for(;n<e.length&&e[n].startsWith("-");){let t=e[n];if(t==="-R"||t==="--recursive")i=!0,n++;else if(t==="-v"||t==="--verbose")f=!0,n++;else if(t==="--"){n++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(i=!0),t.includes("v")&&(f=!0),n++;continue}return y("chmod",t)}}if(e.length-n<2)return{stdout:"",stderr:`chmod: missing operand
4
4
  `,exitCode:1};let r=e[n],d=e.slice(n+1),o=/^[0-7]+$/.test(r),s;if(o)s=parseInt(r,8);else try{p(r,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${r}'
5
5
  `,exitCode:1}}let u=new b(Math.min(a.limits.maxOutputSize,a.limits.maxStringLength),"chmod"),l="",c=!1;for(let t of d){let m=a.fs.resolvePath(a.cwd,t);try{let h;if(o&&s!==void 0)h=s;else{let g=await a.fs.stat(m);h=p(r,g.mode)}await a.fs.chmod(m,h),f&&u.append(`mode of '${t}' changed to ${h.toString(8).padStart(4,"0")}
@@ -1,5 +1,5 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{b as A}from"./chunk-AYSZ5MAE.js";import{l as f}from"./chunk-TVCZIH6M.js";import{a as z,d as T}from"./chunk-GN6CQ3J4.js";import{a as _}from"./chunk-FOCWZZDE.js";import{a as B}from"./chunk-QIQMJJZ4.js";import{a as M,b as q}from"./chunk-QAYAQNCG.js";var L={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
2
+ import{b as A}from"./chunk-A3C4Z3Q3.js";import{l as f}from"./chunk-TVCZIH6M.js";import{a as z,d as T}from"./chunk-GN6CQ3J4.js";import{a as _}from"./chunk-FOCWZZDE.js";import{a as B}from"./chunk-QIQMJJZ4.js";import{a as M,b as q}from"./chunk-QAYAQNCG.js";var L={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
3
3
  a-z character range
4
4
  [:alnum:] all letters and digits
5
5
  [:alpha:] all letters