just-bash 2.15.1-executor.0 → 3.0.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 (643) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +38 -2
  3. package/dist/Bash.d.ts +23 -84
  4. package/dist/bin/chunks/awk2-CKPJ75GN.js +2 -0
  5. package/dist/bin/chunks/base64-I3CXGD2Q.js +2 -0
  6. package/dist/bin/chunks/bash-UYSJL7VA.js +2 -0
  7. package/dist/bin/chunks/cat-3TMJDECR.js +2 -0
  8. package/dist/bin/chunks/chunk-24DJ4XAS.js +18 -0
  9. package/dist/bin/chunks/{chunk-DOXYBGNA.js → chunk-2ACK45YF.js} +4 -4
  10. package/dist/bin/chunks/chunk-2GZSSMV3.js +14 -0
  11. package/dist/bin/chunks/{chunk-WXMBDX4P.js → chunk-2TMMAY52.js} +7 -7
  12. package/dist/bin/chunks/chunk-575DV2PL.js +9 -0
  13. package/dist/bin/chunks/chunk-5DFR7VRU.js +13 -0
  14. package/dist/bin/chunks/chunk-63XSH3IT.js +2 -0
  15. package/dist/bin/{shell/chunks/chunk-N43DJTSI.js → chunks/chunk-6CW6ATOU.js} +1 -1
  16. package/dist/bin/chunks/chunk-6NYAJMTL.js +14 -0
  17. package/dist/bin/chunks/chunk-6ZKYK7PO.js +63 -0
  18. package/dist/bin/chunks/chunk-7FOU5QKD.js +11 -0
  19. package/dist/bin/chunks/chunk-7RSTZI3G.js +9 -0
  20. package/dist/bin/chunks/{chunk-SGA7Y45Z.js → chunk-A65XLABI.js} +5 -5
  21. package/dist/bin/chunks/{chunk-YLE2OYY6.js → chunk-A6CAHGYF.js} +1 -1
  22. package/dist/bin/{shell/chunks/chunk-XKPFI566.js → chunks/chunk-AM6HJVBI.js} +17 -17
  23. package/dist/bin/chunks/chunk-AQBEVPZP.js +6 -0
  24. package/dist/bin/chunks/chunk-AX3QU3MP.js +6 -0
  25. package/dist/bin/chunks/chunk-B4CUXR3Q.js +33 -0
  26. package/dist/bin/chunks/{chunk-NLBRLRWD.js → chunk-B5DAHNDY.js} +1 -1
  27. package/dist/bin/chunks/chunk-BEWZWAXH.js +8 -0
  28. package/dist/bin/{shell/chunks/chunk-SE4C7FJY.js → chunks/chunk-C6FRS5UB.js} +13 -13
  29. package/dist/bin/chunks/chunk-CUYKY2BK.js +5 -0
  30. package/dist/bin/chunks/chunk-D3JRD3JF.js +36 -0
  31. package/dist/bin/chunks/chunk-D6DORGK7.js +16 -0
  32. package/dist/bin/chunks/{chunk-SXB55JOI.js → chunk-DH7TPGPX.js} +1 -1
  33. package/dist/bin/chunks/chunk-FU7JHPYW.js +9 -0
  34. package/dist/bin/chunks/chunk-G36D7WFF.js +6 -0
  35. package/dist/bin/chunks/chunk-GQQLQPZG.js +7 -0
  36. package/dist/bin/chunks/chunk-HIVPP3AM.js +17 -0
  37. package/dist/bin/{shell/chunks/chunk-NAX7MTAR.js → chunks/chunk-I3X57RP5.js} +6 -6
  38. package/dist/bin/chunks/chunk-IZ3AT2KX.js +19 -0
  39. package/dist/bin/chunks/chunk-KHOBXZFG.js +12 -0
  40. package/dist/bin/chunks/chunk-KMFPV7SR.js +6 -0
  41. package/dist/bin/chunks/chunk-KX2PR2HV.js +16 -0
  42. package/dist/bin/chunks/{chunk-54G6AE72.js → chunk-LCJRVV55.js} +1 -1
  43. package/dist/bin/chunks/chunk-M33SULGQ.js +9 -0
  44. package/dist/bin/chunks/{chunk-3Y32LPNT.js → chunk-M3T6XOXC.js} +1 -1
  45. package/dist/bin/chunks/chunk-MWKPB24E.js +11 -0
  46. package/dist/bin/chunks/chunk-NN2DBOAZ.js +5 -0
  47. package/dist/bin/chunks/{chunk-RMQC3GS7.js → chunk-NOGXKS2G.js} +23 -23
  48. package/dist/bin/chunks/chunk-NTW6IA45.js +2 -0
  49. package/dist/bin/{shell/chunks/chunk-7BORMNPQ.js → chunks/chunk-NWG67HAQ.js} +1 -1
  50. package/dist/bin/chunks/{chunk-A3HQTYHR.js → chunk-P43NQKUN.js} +1 -1
  51. package/dist/bin/chunks/chunk-PHZPFNDZ.js +287 -0
  52. package/dist/bin/chunks/chunk-RX22J4AC.js +14 -0
  53. package/dist/bin/chunks/chunk-S7KZBLGH.js +3 -0
  54. package/dist/bin/{shell/chunks/chunk-ZO5PSLKR.js → chunks/chunk-SDOJRQF5.js} +1 -1
  55. package/dist/bin/chunks/chunk-UFJFAFSS.js +28 -0
  56. package/dist/bin/chunks/chunk-UMYJNWPA.js +140 -0
  57. package/dist/bin/chunks/chunk-UO7ZJYDM.js +11 -0
  58. package/dist/bin/chunks/{chunk-THNL3XFF.js → chunk-VECTAALH.js} +1 -1
  59. package/dist/bin/chunks/chunk-VRU3NTQB.js +3 -0
  60. package/dist/bin/chunks/chunk-WJ3HZK2S.js +5 -0
  61. package/dist/bin/chunks/chunk-WLBA7L7U.js +23 -0
  62. package/dist/bin/{shell/chunks/chunk-SXRVLCZ4.js → chunks/chunk-WRYJHXRE.js} +1 -1
  63. package/dist/bin/chunks/chunk-XZEAAOBW.js +8 -0
  64. package/dist/bin/{shell/chunks/chunk-SDLWFYVT.js → chunks/chunk-YMQY74O7.js} +13 -13
  65. package/dist/bin/chunks/chunk-ZNMFCOTS.js +10 -0
  66. package/dist/bin/chunks/{chunk-GOJZHH3L.js → chunk-ZO3PBKJB.js} +3 -3
  67. package/dist/bin/chunks/column-MTXKQLJH.js +2 -0
  68. package/dist/bin/chunks/comm-YZHVF2XN.js +2 -0
  69. package/dist/bin/chunks/{curl-SRTMGOVV.js → curl-2DCNBIKJ.js} +8 -8
  70. package/dist/bin/chunks/cut-MWPHE25M.js +2 -0
  71. package/dist/bin/chunks/diff-EINZHDTZ.js +2 -0
  72. package/dist/bin/chunks/env-NK55NKL6.js +2 -0
  73. package/dist/bin/chunks/expand-47QQBMM5.js +2 -0
  74. package/dist/bin/{shell/chunks/expansion-2RO5M3QC.js → chunks/expansion-H3VFC532.js} +1 -1
  75. package/dist/bin/chunks/{expr-4CJYC4LY.js → expr-VPJ77DR7.js} +1 -1
  76. package/dist/bin/{shell/chunks/file-D5YKS5NV.js → chunks/file-MMSHRWCJ.js} +1 -1
  77. package/dist/bin/chunks/find-O2KKT6KZ.js +2 -0
  78. package/dist/bin/chunks/flag-coverage-FHFMNAV6.js +2 -0
  79. package/dist/bin/chunks/fold-QC27S46O.js +2 -0
  80. package/dist/bin/chunks/grep-3X5B47DW.js +2 -0
  81. package/dist/bin/chunks/gzip-VYBZGPTA.js +2 -0
  82. package/dist/bin/chunks/head-BM7J6BEI.js +2 -0
  83. package/dist/bin/chunks/html-to-markdown-G2FXKDLR.js +2 -0
  84. package/dist/bin/chunks/join-5J5VA3I7.js +2 -0
  85. package/dist/bin/chunks/jq-HYQ3KMGL.js +2 -0
  86. package/dist/bin/chunks/js-exec-LZPKIZ5V.js +97 -0
  87. package/dist/bin/chunks/js-exec-worker.js +27 -185
  88. package/dist/bin/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
  89. package/dist/bin/chunks/md5sum-GVZ66MRR.js +2 -0
  90. package/dist/bin/chunks/nl-XLPXDHHK.js +2 -0
  91. package/dist/bin/chunks/od-CRBL7ZML.js +2 -0
  92. package/dist/bin/chunks/paste-7MEIW3PG.js +2 -0
  93. package/dist/bin/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
  94. package/dist/bin/chunks/python3-BBQ4SVHU.js +12 -0
  95. package/dist/bin/chunks/rev-6LTZEDBA.js +2 -0
  96. package/dist/bin/chunks/rg-UPQTBQZR.js +2 -0
  97. package/dist/bin/chunks/sed-OKEUW2KT.js +2 -0
  98. package/dist/bin/chunks/sha1sum-HFI2SRA4.js +2 -0
  99. package/dist/bin/chunks/sha256sum-N44D3OCP.js +2 -0
  100. package/dist/bin/chunks/sort-ES3NRFJA.js +2 -0
  101. package/dist/bin/chunks/split-QFBCCUR5.js +2 -0
  102. package/dist/bin/chunks/sqlite3-V4SEWTIR.js +2 -0
  103. package/dist/bin/chunks/sqlite3-worker.js +1728 -0
  104. package/dist/bin/chunks/strings-YGI6HF5M.js +2 -0
  105. package/dist/bin/chunks/tac-HWXFWOGO.js +2 -0
  106. package/dist/bin/chunks/tail-YX6MELZ5.js +2 -0
  107. package/dist/bin/chunks/tar-UO62YC6N.js +2 -0
  108. package/dist/bin/chunks/tee-XKJM7HV7.js +2 -0
  109. package/dist/bin/chunks/time-RPVNTV72.js +2 -0
  110. package/dist/bin/chunks/timeout-4QMASFQG.js +2 -0
  111. package/dist/bin/chunks/tr-A6IXSBQX.js +2 -0
  112. package/dist/bin/chunks/unexpand-UCJETXUX.js +2 -0
  113. package/dist/bin/chunks/uniq-2KXDTNDX.js +2 -0
  114. package/dist/bin/chunks/wc-KTXPMRYY.js +2 -0
  115. package/dist/bin/chunks/worker.js +28 -9
  116. package/dist/bin/chunks/xan-IHA7IHBM.js +2 -0
  117. package/dist/bin/chunks/xan-view-JFFJAU35.js +2 -0
  118. package/dist/bin/chunks/xargs-EWL5DXR3.js +2 -0
  119. package/dist/bin/chunks/yq-LDGFI4EM.js +2 -0
  120. package/dist/bin/just-bash.js +292 -292
  121. package/dist/bin/shell/chunks/awk2-CKPJ75GN.js +2 -0
  122. package/dist/bin/shell/chunks/base64-I3CXGD2Q.js +2 -0
  123. package/dist/bin/shell/chunks/bash-UYSJL7VA.js +2 -0
  124. package/dist/bin/shell/chunks/cat-3TMJDECR.js +2 -0
  125. package/dist/bin/shell/chunks/chunk-24DJ4XAS.js +18 -0
  126. package/dist/bin/shell/chunks/{chunk-DOXYBGNA.js → chunk-2ACK45YF.js} +4 -4
  127. package/dist/bin/shell/chunks/chunk-2GZSSMV3.js +14 -0
  128. package/dist/bin/shell/chunks/{chunk-WXMBDX4P.js → chunk-2TMMAY52.js} +7 -7
  129. package/dist/bin/shell/chunks/chunk-575DV2PL.js +9 -0
  130. package/dist/bin/shell/chunks/chunk-5DFR7VRU.js +13 -0
  131. package/dist/bin/shell/chunks/chunk-63XSH3IT.js +2 -0
  132. package/dist/bin/{chunks/chunk-N43DJTSI.js → shell/chunks/chunk-6CW6ATOU.js} +1 -1
  133. package/dist/bin/shell/chunks/chunk-6NYAJMTL.js +14 -0
  134. package/dist/bin/shell/chunks/chunk-6ZKYK7PO.js +63 -0
  135. package/dist/bin/shell/chunks/chunk-7FOU5QKD.js +11 -0
  136. package/dist/bin/shell/chunks/chunk-7RSTZI3G.js +9 -0
  137. package/dist/bin/shell/chunks/{chunk-SGA7Y45Z.js → chunk-A65XLABI.js} +5 -5
  138. package/dist/bin/shell/chunks/{chunk-YLE2OYY6.js → chunk-A6CAHGYF.js} +1 -1
  139. package/dist/bin/{chunks/chunk-XKPFI566.js → shell/chunks/chunk-AM6HJVBI.js} +17 -17
  140. package/dist/bin/shell/chunks/chunk-AQBEVPZP.js +6 -0
  141. package/dist/bin/shell/chunks/chunk-AX3QU3MP.js +6 -0
  142. package/dist/bin/shell/chunks/chunk-B4CUXR3Q.js +33 -0
  143. package/dist/bin/shell/chunks/{chunk-NLBRLRWD.js → chunk-B5DAHNDY.js} +1 -1
  144. package/dist/bin/shell/chunks/chunk-BEWZWAXH.js +8 -0
  145. package/dist/bin/{chunks/chunk-SE4C7FJY.js → shell/chunks/chunk-C6FRS5UB.js} +13 -13
  146. package/dist/bin/shell/chunks/chunk-CUYKY2BK.js +5 -0
  147. package/dist/bin/shell/chunks/chunk-D3JRD3JF.js +36 -0
  148. package/dist/bin/shell/chunks/chunk-D6DORGK7.js +16 -0
  149. package/dist/bin/shell/chunks/{chunk-SXB55JOI.js → chunk-DH7TPGPX.js} +1 -1
  150. package/dist/bin/shell/chunks/chunk-FU7JHPYW.js +9 -0
  151. package/dist/bin/shell/chunks/chunk-G36D7WFF.js +6 -0
  152. package/dist/bin/shell/chunks/chunk-GQQLQPZG.js +7 -0
  153. package/dist/bin/shell/chunks/chunk-HIVPP3AM.js +17 -0
  154. package/dist/bin/{chunks/chunk-NAX7MTAR.js → shell/chunks/chunk-I3X57RP5.js} +6 -6
  155. package/dist/bin/shell/chunks/chunk-IZ3AT2KX.js +19 -0
  156. package/dist/bin/shell/chunks/chunk-KHOBXZFG.js +12 -0
  157. package/dist/bin/shell/chunks/chunk-KMFPV7SR.js +6 -0
  158. package/dist/bin/shell/chunks/chunk-KX2PR2HV.js +16 -0
  159. package/dist/bin/shell/chunks/{chunk-54G6AE72.js → chunk-LCJRVV55.js} +1 -1
  160. package/dist/bin/shell/chunks/chunk-M33SULGQ.js +9 -0
  161. package/dist/bin/shell/chunks/{chunk-3Y32LPNT.js → chunk-M3T6XOXC.js} +1 -1
  162. package/dist/bin/shell/chunks/chunk-MWKPB24E.js +11 -0
  163. package/dist/bin/shell/chunks/chunk-NN2DBOAZ.js +5 -0
  164. package/dist/bin/shell/chunks/{chunk-RMQC3GS7.js → chunk-NOGXKS2G.js} +23 -23
  165. package/dist/bin/shell/chunks/chunk-NTW6IA45.js +2 -0
  166. package/dist/bin/{chunks/chunk-7BORMNPQ.js → shell/chunks/chunk-NWG67HAQ.js} +1 -1
  167. package/dist/bin/shell/chunks/{chunk-A3HQTYHR.js → chunk-P43NQKUN.js} +1 -1
  168. package/dist/bin/shell/chunks/chunk-PHZPFNDZ.js +287 -0
  169. package/dist/bin/shell/chunks/chunk-RX22J4AC.js +14 -0
  170. package/dist/bin/shell/chunks/chunk-S7KZBLGH.js +3 -0
  171. package/dist/bin/{chunks/chunk-ZO5PSLKR.js → shell/chunks/chunk-SDOJRQF5.js} +1 -1
  172. package/dist/bin/shell/chunks/chunk-UFJFAFSS.js +28 -0
  173. package/dist/bin/shell/chunks/chunk-UMYJNWPA.js +140 -0
  174. package/dist/bin/shell/chunks/chunk-UO7ZJYDM.js +11 -0
  175. package/dist/bin/shell/chunks/{chunk-THNL3XFF.js → chunk-VECTAALH.js} +1 -1
  176. package/dist/bin/shell/chunks/chunk-VRU3NTQB.js +3 -0
  177. package/dist/bin/shell/chunks/chunk-WJ3HZK2S.js +5 -0
  178. package/dist/bin/shell/chunks/chunk-WLBA7L7U.js +23 -0
  179. package/dist/bin/{chunks/chunk-SXRVLCZ4.js → shell/chunks/chunk-WRYJHXRE.js} +1 -1
  180. package/dist/bin/shell/chunks/chunk-XZEAAOBW.js +8 -0
  181. package/dist/bin/{chunks/chunk-SDLWFYVT.js → shell/chunks/chunk-YMQY74O7.js} +13 -13
  182. package/dist/bin/shell/chunks/chunk-ZNMFCOTS.js +10 -0
  183. package/dist/bin/shell/chunks/{chunk-GOJZHH3L.js → chunk-ZO3PBKJB.js} +3 -3
  184. package/dist/bin/shell/chunks/column-MTXKQLJH.js +2 -0
  185. package/dist/bin/shell/chunks/comm-YZHVF2XN.js +2 -0
  186. package/dist/bin/shell/chunks/{curl-SRTMGOVV.js → curl-2DCNBIKJ.js} +8 -8
  187. package/dist/bin/shell/chunks/cut-MWPHE25M.js +2 -0
  188. package/dist/bin/shell/chunks/diff-EINZHDTZ.js +2 -0
  189. package/dist/bin/shell/chunks/env-NK55NKL6.js +2 -0
  190. package/dist/bin/shell/chunks/expand-47QQBMM5.js +2 -0
  191. package/dist/bin/{chunks/expansion-2RO5M3QC.js → shell/chunks/expansion-H3VFC532.js} +1 -1
  192. package/dist/bin/shell/chunks/{expr-4CJYC4LY.js → expr-VPJ77DR7.js} +1 -1
  193. package/dist/bin/{chunks/file-D5YKS5NV.js → shell/chunks/file-MMSHRWCJ.js} +1 -1
  194. package/dist/bin/shell/chunks/find-O2KKT6KZ.js +2 -0
  195. package/dist/bin/shell/chunks/flag-coverage-FHFMNAV6.js +2 -0
  196. package/dist/bin/shell/chunks/fold-QC27S46O.js +2 -0
  197. package/dist/bin/shell/chunks/grep-3X5B47DW.js +2 -0
  198. package/dist/bin/shell/chunks/gzip-VYBZGPTA.js +2 -0
  199. package/dist/bin/shell/chunks/head-BM7J6BEI.js +2 -0
  200. package/dist/bin/shell/chunks/html-to-markdown-G2FXKDLR.js +2 -0
  201. package/dist/bin/shell/chunks/join-5J5VA3I7.js +2 -0
  202. package/dist/bin/shell/chunks/jq-HYQ3KMGL.js +2 -0
  203. package/dist/bin/shell/chunks/js-exec-LZPKIZ5V.js +97 -0
  204. package/dist/bin/shell/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
  205. package/dist/bin/shell/chunks/md5sum-GVZ66MRR.js +2 -0
  206. package/dist/bin/shell/chunks/nl-XLPXDHHK.js +2 -0
  207. package/dist/bin/shell/chunks/od-CRBL7ZML.js +2 -0
  208. package/dist/bin/shell/chunks/paste-7MEIW3PG.js +2 -0
  209. package/dist/bin/shell/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
  210. package/dist/bin/shell/chunks/python3-BBQ4SVHU.js +12 -0
  211. package/dist/bin/shell/chunks/rev-6LTZEDBA.js +2 -0
  212. package/dist/bin/shell/chunks/rg-UPQTBQZR.js +2 -0
  213. package/dist/bin/shell/chunks/sed-OKEUW2KT.js +2 -0
  214. package/dist/bin/shell/chunks/sha1sum-HFI2SRA4.js +2 -0
  215. package/dist/bin/shell/chunks/sha256sum-N44D3OCP.js +2 -0
  216. package/dist/bin/shell/chunks/sort-ES3NRFJA.js +2 -0
  217. package/dist/bin/shell/chunks/split-QFBCCUR5.js +2 -0
  218. package/dist/bin/shell/chunks/sqlite3-V4SEWTIR.js +2 -0
  219. package/dist/bin/shell/chunks/strings-YGI6HF5M.js +2 -0
  220. package/dist/bin/shell/chunks/tac-HWXFWOGO.js +2 -0
  221. package/dist/bin/shell/chunks/tail-YX6MELZ5.js +2 -0
  222. package/dist/bin/shell/chunks/tar-UO62YC6N.js +2 -0
  223. package/dist/bin/shell/chunks/tee-XKJM7HV7.js +2 -0
  224. package/dist/bin/shell/chunks/time-RPVNTV72.js +2 -0
  225. package/dist/bin/shell/chunks/timeout-4QMASFQG.js +2 -0
  226. package/dist/bin/shell/chunks/tr-A6IXSBQX.js +2 -0
  227. package/dist/bin/shell/chunks/unexpand-UCJETXUX.js +2 -0
  228. package/dist/bin/shell/chunks/uniq-2KXDTNDX.js +2 -0
  229. package/dist/bin/shell/chunks/wc-KTXPMRYY.js +2 -0
  230. package/dist/bin/shell/chunks/xan-IHA7IHBM.js +2 -0
  231. package/dist/bin/shell/chunks/xan-view-JFFJAU35.js +2 -0
  232. package/dist/bin/shell/chunks/xargs-EWL5DXR3.js +2 -0
  233. package/dist/bin/shell/chunks/yq-LDGFI4EM.js +2 -0
  234. package/dist/bin/shell/shell.js +274 -274
  235. package/dist/browser.d.ts +1 -0
  236. package/dist/bundle/browser.js +676 -674
  237. package/dist/bundle/chunks/awk2-RXRC54TM.js +1 -0
  238. package/dist/bundle/chunks/base64-FJOOBRMC.js +1 -0
  239. package/dist/bundle/chunks/bash-4WLDO24C.js +1 -0
  240. package/dist/bundle/chunks/cat-VQEWZT5O.js +1 -0
  241. package/dist/bundle/chunks/chunk-2TRDZQLB.js +17 -0
  242. package/dist/bundle/chunks/chunk-5DI2YNX7.js +10 -0
  243. package/dist/bundle/chunks/chunk-6N5CMDSQ.js +9 -0
  244. package/dist/bundle/chunks/{chunk-F23WWYKW.js → chunk-7P5JCWX5.js} +5 -5
  245. package/dist/bundle/chunks/chunk-7RIQPKJE.js +2 -0
  246. package/dist/bundle/chunks/{chunk-APT7OOP2.js → chunk-7ZUB672J.js} +1 -1
  247. package/dist/bundle/chunks/chunk-AH77CRWX.js +1 -0
  248. package/dist/bundle/chunks/{chunk-YNYSPYQ5.js → chunk-B74TABJS.js} +13 -13
  249. package/dist/bundle/chunks/{chunk-QJ7O6ZN3.js → chunk-BAXBSHE5.js} +3 -3
  250. package/dist/bundle/chunks/{chunk-FEIOJCZD.js → chunk-BGSUD5R5.js} +1 -1
  251. package/dist/bundle/chunks/chunk-CHRGJY5U.js +10 -0
  252. package/dist/bundle/chunks/chunk-CYJSRRNG.js +4 -0
  253. package/dist/bundle/chunks/chunk-CZYXTGMR.js +139 -0
  254. package/dist/bundle/chunks/{chunk-OL3S66CO.js → chunk-DFS4EHCX.js} +23 -23
  255. package/dist/bundle/chunks/chunk-DIB23V32.js +8 -0
  256. package/dist/bundle/chunks/chunk-DMJSDIQO.js +6 -0
  257. package/dist/bundle/chunks/chunk-DRGAV7ST.js +11 -0
  258. package/dist/bundle/chunks/chunk-DZCB42NK.js +2 -0
  259. package/dist/bundle/chunks/{chunk-DCAAORBQ.js → chunk-EIUAYBIC.js} +1 -1
  260. package/dist/bundle/chunks/chunk-G22IYMH5.js +16 -0
  261. package/dist/bundle/chunks/chunk-GFPLGF6W.js +5 -0
  262. package/dist/bundle/chunks/chunk-HCKS7PTH.js +10 -0
  263. package/dist/bundle/chunks/{chunk-5V6VZH6T.js → chunk-HKY7IG73.js} +1 -1
  264. package/dist/bundle/chunks/chunk-HL6NGDO2.js +22 -0
  265. package/dist/bundle/chunks/chunk-IIJDG7QW.js +13 -0
  266. package/dist/bundle/chunks/{chunk-Z6LRHWXI.js → chunk-JKZMQVSS.js} +7 -7
  267. package/dist/bundle/chunks/chunk-JMNW4NXI.js +8 -0
  268. package/dist/bundle/chunks/{chunk-LPQPILI2.js → chunk-K6LIBGJA.js} +1 -1
  269. package/dist/bundle/chunks/chunk-KBZ5NVXE.js +5 -0
  270. package/dist/bundle/chunks/chunk-KK2SFKTN.js +13 -0
  271. package/dist/bundle/chunks/{chunk-BBXLRYSX.js → chunk-KRBPSX3W.js} +1 -1
  272. package/dist/bundle/chunks/{chunk-LTZRCH7N.js → chunk-LBUR6QMO.js} +1 -1
  273. package/dist/bundle/chunks/chunk-MBDW4C5R.js +8 -0
  274. package/dist/bundle/chunks/chunk-MIV7TH6W.js +32 -0
  275. package/dist/bundle/chunks/chunk-MOLNCDQJ.js +5 -0
  276. package/dist/bundle/chunks/chunk-NUY2ZGZL.js +286 -0
  277. package/dist/bundle/chunks/chunk-OYFKMNOH.js +4 -0
  278. package/dist/bundle/chunks/{chunk-62RKD26F.js → chunk-Q7DN34BC.js} +6 -6
  279. package/dist/bundle/chunks/chunk-R6VWJ2ZL.js +1 -0
  280. package/dist/bundle/chunks/chunk-RGAX6VXO.js +6 -0
  281. package/dist/bundle/chunks/chunk-RHD3NWJY.js +15 -0
  282. package/dist/bundle/chunks/chunk-S7CS4O3M.js +5 -0
  283. package/dist/bundle/chunks/chunk-SFQDTSOG.js +8 -0
  284. package/dist/bundle/chunks/{chunk-J642UCRS.js → chunk-SNN4IESC.js} +1 -1
  285. package/dist/bundle/chunks/{chunk-64BAICW3.js → chunk-T6RP4YO5.js} +1 -1
  286. package/dist/bundle/chunks/chunk-TWHVX65V.js +4 -0
  287. package/dist/bundle/chunks/chunk-U2ATS66X.js +4 -0
  288. package/dist/bundle/chunks/chunk-UGMTY5A7.js +15 -0
  289. package/dist/bundle/chunks/chunk-UKBVVIW7.js +62 -0
  290. package/dist/bundle/chunks/chunk-USP7VSKV.js +12 -0
  291. package/dist/bundle/chunks/{chunk-OARHFVLG.js → chunk-UTKQPLMD.js} +13 -13
  292. package/dist/bundle/chunks/{chunk-YFG2CMIF.js → chunk-V5MWI2OL.js} +1 -1
  293. package/dist/bundle/chunks/{chunk-XKQRETAK.js → chunk-WEZK5ELQ.js} +1 -1
  294. package/dist/bundle/chunks/{chunk-YTNYSM6T.js → chunk-WURK7XMI.js} +4 -4
  295. package/dist/bundle/chunks/chunk-WZG5CB4V.js +7 -0
  296. package/dist/bundle/chunks/chunk-XUZRLD2X.js +35 -0
  297. package/dist/bundle/chunks/chunk-YDILEREV.js +7 -0
  298. package/dist/bundle/chunks/chunk-YXVMSFJA.js +13 -0
  299. package/dist/bundle/chunks/column-DCCLCHUR.js +1 -0
  300. package/dist/bundle/chunks/comm-AXP77KC4.js +1 -0
  301. package/dist/bundle/chunks/{curl-COE4TZE6.js → curl-47BFPSFW.js} +8 -8
  302. package/dist/bundle/chunks/cut-RBX7IXC7.js +1 -0
  303. package/dist/bundle/chunks/diff-AYXX5MI5.js +1 -0
  304. package/dist/bundle/chunks/env-GBSZDQLS.js +1 -0
  305. package/dist/bundle/chunks/expand-UMGRCDTC.js +1 -0
  306. package/dist/bundle/chunks/{expansion-ENLSRCXJ.js → expansion-VBDYWVZR.js} +1 -1
  307. package/dist/bundle/chunks/{expr-5T3UU5KE.js → expr-YYCVMXE3.js} +1 -1
  308. package/dist/bundle/chunks/{file-ZIGAJ4YS.js → file-IGDTDPLG.js} +1 -1
  309. package/dist/bundle/chunks/find-DH2ALKQS.js +1 -0
  310. package/dist/bundle/chunks/flag-coverage-WZWBNOJT.js +1 -0
  311. package/dist/bundle/chunks/fold-V23GDLZD.js +1 -0
  312. package/dist/bundle/chunks/grep-7CE2SS3X.js +1 -0
  313. package/dist/bundle/chunks/gzip-EVI6YRMT.js +1 -0
  314. package/dist/bundle/chunks/head-FG33BE3W.js +1 -0
  315. package/dist/bundle/chunks/html-to-markdown-AQHC3PHD.js +1 -0
  316. package/dist/bundle/chunks/join-TLHD7S7W.js +1 -0
  317. package/dist/bundle/chunks/jq-OKCSVTHN.js +1 -0
  318. package/dist/bundle/chunks/js-exec-2U7NEXAP.js +96 -0
  319. package/dist/bundle/chunks/js-exec-worker.js +27 -185
  320. package/dist/bundle/chunks/md5sum-XMCB7L5Z.js +1 -0
  321. package/dist/bundle/chunks/nl-LBU6FPPF.js +1 -0
  322. package/dist/bundle/chunks/od-O6TPXWVX.js +1 -0
  323. package/dist/bundle/chunks/paste-HIF3YKHC.js +1 -0
  324. package/dist/bundle/chunks/python3-ZR6W2FR3.js +11 -0
  325. package/dist/bundle/chunks/rev-SKETTPXH.js +1 -0
  326. package/dist/bundle/chunks/rg-GMXITNCP.js +1 -0
  327. package/dist/bundle/chunks/sed-YRQXQDMQ.js +1 -0
  328. package/dist/bundle/chunks/sha1sum-ZHNS7PS4.js +1 -0
  329. package/dist/bundle/chunks/sha256sum-YWE2HB65.js +1 -0
  330. package/dist/bundle/chunks/sort-5KALNK6P.js +1 -0
  331. package/dist/bundle/chunks/split-4CXZNBGE.js +1 -0
  332. package/dist/bundle/chunks/sqlite3-FXN2MHWU.js +1 -0
  333. package/dist/bundle/chunks/sqlite3-worker.js +1728 -0
  334. package/dist/bundle/chunks/strings-7VYWRFIZ.js +1 -0
  335. package/dist/bundle/chunks/tac-74F3WHUM.js +1 -0
  336. package/dist/bundle/chunks/tail-EDLAF4WW.js +1 -0
  337. package/dist/bundle/chunks/tar-RKYTUGDT.js +1 -0
  338. package/dist/bundle/chunks/tee-DUMXETDQ.js +1 -0
  339. package/dist/bundle/chunks/time-U22WPHDM.js +1 -0
  340. package/dist/bundle/chunks/timeout-PWE4AOYD.js +1 -0
  341. package/dist/bundle/chunks/tr-2QSZN4JB.js +1 -0
  342. package/dist/bundle/chunks/unexpand-ZTD2RXS2.js +1 -0
  343. package/dist/bundle/chunks/uniq-DCP6SV3B.js +1 -0
  344. package/dist/bundle/chunks/wc-J6YO4AFR.js +1 -0
  345. package/dist/bundle/chunks/worker.js +28 -9
  346. package/dist/bundle/chunks/xan-74G4ZYYZ.js +1 -0
  347. package/dist/bundle/chunks/xan-view-FLG5O7II.js +1 -0
  348. package/dist/bundle/chunks/xargs-LB2QOP6N.js +1 -0
  349. package/dist/bundle/chunks/yq-4NJ2P5VT.js +1 -0
  350. package/dist/bundle/index.cjs +984 -985
  351. package/dist/bundle/index.js +271 -271
  352. package/dist/commands/js-exec/{worker.d.ts → js-exec-worker.d.ts} +4 -10
  353. package/dist/commands/js-exec/js-exec.d.ts +1 -19
  354. package/dist/commands/search-engine/matcher.d.ts +6 -0
  355. package/dist/commands/search-engine/regex.d.ts +13 -0
  356. package/dist/commands/sqlite3/sqlite3.d.ts +1 -0
  357. package/dist/commands/sqlite3/worker.js +1728 -0
  358. package/dist/commands/tar/bzip2-compress.d.ts +17 -0
  359. package/dist/commands/worker-bridge/sync-backend.d.ts +2 -1
  360. package/dist/encoding.d.ts +115 -0
  361. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +2 -0
  362. package/dist/fs/interface.d.ts +23 -1
  363. package/dist/fs/mountable-fs/mountable-fs.d.ts +2 -0
  364. package/dist/fs/overlay-fs/overlay-fs.d.ts +2 -0
  365. package/dist/fs/read-write-fs/read-write-fs.d.ts +2 -0
  366. package/dist/index.d.cts +2 -0
  367. package/dist/index.d.ts +2 -0
  368. package/dist/interpreter/interpreter.d.ts +2 -7
  369. package/dist/interpreter/types.d.ts +3 -8
  370. package/dist/network/dns-pin.d.ts +43 -0
  371. package/dist/network/types.d.ts +2 -1
  372. package/dist/types.d.ts +48 -21
  373. package/dist/utils/file-reader.d.ts +12 -5
  374. package/package.json +36 -40
  375. package/vendor/cpython-emscripten/python.wasm +0 -0
  376. package/dist/bin/chunks/awk2-VTJMI54B.js +0 -2
  377. package/dist/bin/chunks/base64-43M2R3GA.js +0 -2
  378. package/dist/bin/chunks/bash-6ZHZ6BX7.js +0 -2
  379. package/dist/bin/chunks/cat-XZIJZXKP.js +0 -2
  380. package/dist/bin/chunks/chunk-26NO42TF.js +0 -14
  381. package/dist/bin/chunks/chunk-5G2VOPPJ.js +0 -7
  382. package/dist/bin/chunks/chunk-5WFYIUU2.js +0 -3
  383. package/dist/bin/chunks/chunk-AAW7UMPO.js +0 -9
  384. package/dist/bin/chunks/chunk-B3RU2PUI.js +0 -140
  385. package/dist/bin/chunks/chunk-CGE2EHYP.js +0 -5
  386. package/dist/bin/chunks/chunk-CM4532DS.js +0 -36
  387. package/dist/bin/chunks/chunk-CQG2HEAL.js +0 -5
  388. package/dist/bin/chunks/chunk-EUXCM6C4.js +0 -12
  389. package/dist/bin/chunks/chunk-F3LGZXLQ.js +0 -9
  390. package/dist/bin/chunks/chunk-FA2CHD73.js +0 -16
  391. package/dist/bin/chunks/chunk-FLPVVSN5.js +0 -5
  392. package/dist/bin/chunks/chunk-FSZWFMB4.js +0 -16
  393. package/dist/bin/chunks/chunk-G43H2WGH.js +0 -17
  394. package/dist/bin/chunks/chunk-GO6FXSC4.js +0 -6
  395. package/dist/bin/chunks/chunk-GZHFXDDO.js +0 -10
  396. package/dist/bin/chunks/chunk-HJEHIH4P.js +0 -33
  397. package/dist/bin/chunks/chunk-JQBC3FXE.js +0 -8
  398. package/dist/bin/chunks/chunk-L2JBII6Z.js +0 -287
  399. package/dist/bin/chunks/chunk-LGJM5YFT.js +0 -17
  400. package/dist/bin/chunks/chunk-LMK6G2HH.js +0 -8
  401. package/dist/bin/chunks/chunk-MNMRGJJM.js +0 -11
  402. package/dist/bin/chunks/chunk-MRP4ZCD7.js +0 -6
  403. package/dist/bin/chunks/chunk-MXVNCVD6.js +0 -30
  404. package/dist/bin/chunks/chunk-MY5PY2PL.js +0 -2
  405. package/dist/bin/chunks/chunk-N5OTVT4F.js +0 -23
  406. package/dist/bin/chunks/chunk-OBI37ZY4.js +0 -9
  407. package/dist/bin/chunks/chunk-P6GNZPVW.js +0 -19
  408. package/dist/bin/chunks/chunk-RJSAGJQJ.js +0 -11
  409. package/dist/bin/chunks/chunk-ROJPSS6N.js +0 -3
  410. package/dist/bin/chunks/chunk-S7OHMN3F.js +0 -6
  411. package/dist/bin/chunks/chunk-VHUYNUT7.js +0 -13
  412. package/dist/bin/chunks/chunk-WS6P4H4S.js +0 -63
  413. package/dist/bin/chunks/chunk-WWZVR5NN.js +0 -6
  414. package/dist/bin/chunks/chunk-YEKSVVRC.js +0 -11
  415. package/dist/bin/chunks/chunk-YFPDB4PH.js +0 -9
  416. package/dist/bin/chunks/chunk-ZA4HUKJ3.js +0 -13
  417. package/dist/bin/chunks/chunk-ZKC5HQYO.js +0 -14
  418. package/dist/bin/chunks/column-XGV32UPN.js +0 -2
  419. package/dist/bin/chunks/comm-R3F3Z5DX.js +0 -2
  420. package/dist/bin/chunks/cut-5EY2XPXX.js +0 -2
  421. package/dist/bin/chunks/diff-LE7GMFZD.js +0 -2
  422. package/dist/bin/chunks/env-NTPN5QYM.js +0 -2
  423. package/dist/bin/chunks/expand-26XPP5KB.js +0 -2
  424. package/dist/bin/chunks/find-GAYRV4IF.js +0 -2
  425. package/dist/bin/chunks/flag-coverage-LBMWMYOO.js +0 -2
  426. package/dist/bin/chunks/fold-XSVNTAWH.js +0 -2
  427. package/dist/bin/chunks/grep-OZJTRD4D.js +0 -2
  428. package/dist/bin/chunks/gzip-LHOO65AN.js +0 -2
  429. package/dist/bin/chunks/head-YMNRW3F3.js +0 -2
  430. package/dist/bin/chunks/html-to-markdown-WVZA3MCP.js +0 -2
  431. package/dist/bin/chunks/join-Y4Q5WVVE.js +0 -2
  432. package/dist/bin/chunks/jq-FIV5Q5T4.js +0 -2
  433. package/dist/bin/chunks/js-exec-RGKNWHHL.js +0 -100
  434. package/dist/bin/chunks/md5sum-NCLXV2S3.js +0 -2
  435. package/dist/bin/chunks/nl-XH3L75DR.js +0 -2
  436. package/dist/bin/chunks/od-52FBC34W.js +0 -2
  437. package/dist/bin/chunks/paste-3UVLMQ2K.js +0 -2
  438. package/dist/bin/chunks/python3-QOJU2POC.js +0 -12
  439. package/dist/bin/chunks/rev-UHEPS2UL.js +0 -2
  440. package/dist/bin/chunks/rg-C6KMBFNG.js +0 -2
  441. package/dist/bin/chunks/sed-HALRQZKY.js +0 -2
  442. package/dist/bin/chunks/sha1sum-BHNJ5ALF.js +0 -2
  443. package/dist/bin/chunks/sha256sum-HJJ3NJ5L.js +0 -2
  444. package/dist/bin/chunks/sort-7GENYU2I.js +0 -2
  445. package/dist/bin/chunks/split-YWV64TJH.js +0 -2
  446. package/dist/bin/chunks/sqlite3-CVNFMP3Z.js +0 -2
  447. package/dist/bin/chunks/strings-XXKZCWY5.js +0 -2
  448. package/dist/bin/chunks/tac-T42SKDDI.js +0 -2
  449. package/dist/bin/chunks/tail-V537TDFR.js +0 -2
  450. package/dist/bin/chunks/tar-TOWX2TDU.js +0 -2
  451. package/dist/bin/chunks/tee-HK2SYCAR.js +0 -2
  452. package/dist/bin/chunks/time-5R4QWCYF.js +0 -2
  453. package/dist/bin/chunks/timeout-Z24MNWOP.js +0 -2
  454. package/dist/bin/chunks/tr-4FPGAEVB.js +0 -2
  455. package/dist/bin/chunks/unexpand-OYZ7KOYR.js +0 -2
  456. package/dist/bin/chunks/uniq-TMSAIZM3.js +0 -2
  457. package/dist/bin/chunks/wc-ZIV3TFVG.js +0 -2
  458. package/dist/bin/chunks/xan-MOZFJGMY.js +0 -2
  459. package/dist/bin/chunks/xan-view-5SZBYPLG.js +0 -2
  460. package/dist/bin/chunks/xargs-SCYIFXOW.js +0 -2
  461. package/dist/bin/chunks/yq-Q47JUWL6.js +0 -2
  462. package/dist/bin/shell/chunks/awk2-VTJMI54B.js +0 -2
  463. package/dist/bin/shell/chunks/base64-43M2R3GA.js +0 -2
  464. package/dist/bin/shell/chunks/bash-6ZHZ6BX7.js +0 -2
  465. package/dist/bin/shell/chunks/cat-XZIJZXKP.js +0 -2
  466. package/dist/bin/shell/chunks/chunk-26NO42TF.js +0 -14
  467. package/dist/bin/shell/chunks/chunk-5G2VOPPJ.js +0 -7
  468. package/dist/bin/shell/chunks/chunk-5WFYIUU2.js +0 -3
  469. package/dist/bin/shell/chunks/chunk-AAW7UMPO.js +0 -9
  470. package/dist/bin/shell/chunks/chunk-B3RU2PUI.js +0 -140
  471. package/dist/bin/shell/chunks/chunk-CGE2EHYP.js +0 -5
  472. package/dist/bin/shell/chunks/chunk-CM4532DS.js +0 -36
  473. package/dist/bin/shell/chunks/chunk-CQG2HEAL.js +0 -5
  474. package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +0 -2
  475. package/dist/bin/shell/chunks/chunk-EUXCM6C4.js +0 -12
  476. package/dist/bin/shell/chunks/chunk-F3LGZXLQ.js +0 -9
  477. package/dist/bin/shell/chunks/chunk-FA2CHD73.js +0 -16
  478. package/dist/bin/shell/chunks/chunk-FLPVVSN5.js +0 -5
  479. package/dist/bin/shell/chunks/chunk-FSZWFMB4.js +0 -16
  480. package/dist/bin/shell/chunks/chunk-G43H2WGH.js +0 -17
  481. package/dist/bin/shell/chunks/chunk-GO6FXSC4.js +0 -6
  482. package/dist/bin/shell/chunks/chunk-GZHFXDDO.js +0 -10
  483. package/dist/bin/shell/chunks/chunk-HJEHIH4P.js +0 -33
  484. package/dist/bin/shell/chunks/chunk-JQBC3FXE.js +0 -8
  485. package/dist/bin/shell/chunks/chunk-L2JBII6Z.js +0 -287
  486. package/dist/bin/shell/chunks/chunk-LGJM5YFT.js +0 -17
  487. package/dist/bin/shell/chunks/chunk-LMK6G2HH.js +0 -8
  488. package/dist/bin/shell/chunks/chunk-MNMRGJJM.js +0 -11
  489. package/dist/bin/shell/chunks/chunk-MRP4ZCD7.js +0 -6
  490. package/dist/bin/shell/chunks/chunk-MXVNCVD6.js +0 -30
  491. package/dist/bin/shell/chunks/chunk-N5OTVT4F.js +0 -23
  492. package/dist/bin/shell/chunks/chunk-OBI37ZY4.js +0 -9
  493. package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +0 -19
  494. package/dist/bin/shell/chunks/chunk-RJSAGJQJ.js +0 -11
  495. package/dist/bin/shell/chunks/chunk-ROJPSS6N.js +0 -3
  496. package/dist/bin/shell/chunks/chunk-S7OHMN3F.js +0 -6
  497. package/dist/bin/shell/chunks/chunk-VHUYNUT7.js +0 -13
  498. package/dist/bin/shell/chunks/chunk-WS6P4H4S.js +0 -63
  499. package/dist/bin/shell/chunks/chunk-WWZVR5NN.js +0 -6
  500. package/dist/bin/shell/chunks/chunk-YEKSVVRC.js +0 -11
  501. package/dist/bin/shell/chunks/chunk-YFPDB4PH.js +0 -9
  502. package/dist/bin/shell/chunks/chunk-ZA4HUKJ3.js +0 -13
  503. package/dist/bin/shell/chunks/chunk-ZKC5HQYO.js +0 -14
  504. package/dist/bin/shell/chunks/column-XGV32UPN.js +0 -2
  505. package/dist/bin/shell/chunks/comm-R3F3Z5DX.js +0 -2
  506. package/dist/bin/shell/chunks/cut-5EY2XPXX.js +0 -2
  507. package/dist/bin/shell/chunks/diff-LE7GMFZD.js +0 -2
  508. package/dist/bin/shell/chunks/env-NTPN5QYM.js +0 -2
  509. package/dist/bin/shell/chunks/expand-26XPP5KB.js +0 -2
  510. package/dist/bin/shell/chunks/find-GAYRV4IF.js +0 -2
  511. package/dist/bin/shell/chunks/flag-coverage-LBMWMYOO.js +0 -2
  512. package/dist/bin/shell/chunks/fold-XSVNTAWH.js +0 -2
  513. package/dist/bin/shell/chunks/grep-OZJTRD4D.js +0 -2
  514. package/dist/bin/shell/chunks/gzip-LHOO65AN.js +0 -2
  515. package/dist/bin/shell/chunks/head-YMNRW3F3.js +0 -2
  516. package/dist/bin/shell/chunks/html-to-markdown-WVZA3MCP.js +0 -2
  517. package/dist/bin/shell/chunks/join-Y4Q5WVVE.js +0 -2
  518. package/dist/bin/shell/chunks/jq-FIV5Q5T4.js +0 -2
  519. package/dist/bin/shell/chunks/js-exec-DUGJM6RL.js +0 -100
  520. package/dist/bin/shell/chunks/md5sum-NCLXV2S3.js +0 -2
  521. package/dist/bin/shell/chunks/nl-XH3L75DR.js +0 -2
  522. package/dist/bin/shell/chunks/od-52FBC34W.js +0 -2
  523. package/dist/bin/shell/chunks/paste-3UVLMQ2K.js +0 -2
  524. package/dist/bin/shell/chunks/python3-O4VTP6TD.js +0 -12
  525. package/dist/bin/shell/chunks/rev-UHEPS2UL.js +0 -2
  526. package/dist/bin/shell/chunks/rg-C6KMBFNG.js +0 -2
  527. package/dist/bin/shell/chunks/sed-HALRQZKY.js +0 -2
  528. package/dist/bin/shell/chunks/sha1sum-BHNJ5ALF.js +0 -2
  529. package/dist/bin/shell/chunks/sha256sum-HJJ3NJ5L.js +0 -2
  530. package/dist/bin/shell/chunks/sort-7GENYU2I.js +0 -2
  531. package/dist/bin/shell/chunks/split-YWV64TJH.js +0 -2
  532. package/dist/bin/shell/chunks/sqlite3-CVNFMP3Z.js +0 -2
  533. package/dist/bin/shell/chunks/strings-XXKZCWY5.js +0 -2
  534. package/dist/bin/shell/chunks/tac-T42SKDDI.js +0 -2
  535. package/dist/bin/shell/chunks/tail-V537TDFR.js +0 -2
  536. package/dist/bin/shell/chunks/tar-TOWX2TDU.js +0 -2
  537. package/dist/bin/shell/chunks/tee-HK2SYCAR.js +0 -2
  538. package/dist/bin/shell/chunks/time-5R4QWCYF.js +0 -2
  539. package/dist/bin/shell/chunks/timeout-Z24MNWOP.js +0 -2
  540. package/dist/bin/shell/chunks/tr-4FPGAEVB.js +0 -2
  541. package/dist/bin/shell/chunks/unexpand-OYZ7KOYR.js +0 -2
  542. package/dist/bin/shell/chunks/uniq-TMSAIZM3.js +0 -2
  543. package/dist/bin/shell/chunks/wc-ZIV3TFVG.js +0 -2
  544. package/dist/bin/shell/chunks/xan-MOZFJGMY.js +0 -2
  545. package/dist/bin/shell/chunks/xan-view-5SZBYPLG.js +0 -2
  546. package/dist/bin/shell/chunks/xargs-SCYIFXOW.js +0 -2
  547. package/dist/bin/shell/chunks/yq-Q47JUWL6.js +0 -2
  548. package/dist/bundle/chunks/awk2-POPGKRAI.js +0 -1
  549. package/dist/bundle/chunks/base64-4YMZCVJ5.js +0 -1
  550. package/dist/bundle/chunks/bash-IJWYRKFO.js +0 -1
  551. package/dist/bundle/chunks/cat-RDUMLXKC.js +0 -1
  552. package/dist/bundle/chunks/chunk-55VFSPNA.js +0 -2
  553. package/dist/bundle/chunks/chunk-7L36YK2X.js +0 -2
  554. package/dist/bundle/chunks/chunk-A7ICOL4V.js +0 -13
  555. package/dist/bundle/chunks/chunk-B6O2PIY4.js +0 -10
  556. package/dist/bundle/chunks/chunk-CR5AFCPT.js +0 -22
  557. package/dist/bundle/chunks/chunk-D4J545R4.js +0 -11
  558. package/dist/bundle/chunks/chunk-D6CWQ5DW.js +0 -5
  559. package/dist/bundle/chunks/chunk-EIZGF4BS.js +0 -8
  560. package/dist/bundle/chunks/chunk-F55TLFGB.js +0 -9
  561. package/dist/bundle/chunks/chunk-GXVXFKBA.js +0 -5
  562. package/dist/bundle/chunks/chunk-HDQ56CKY.js +0 -15
  563. package/dist/bundle/chunks/chunk-HWBSOZZR.js +0 -35
  564. package/dist/bundle/chunks/chunk-JVPRLUMK.js +0 -7
  565. package/dist/bundle/chunks/chunk-KMEYNNUA.js +0 -15
  566. package/dist/bundle/chunks/chunk-LWEGUNWT.js +0 -7
  567. package/dist/bundle/chunks/chunk-MDLLFABN.js +0 -4
  568. package/dist/bundle/chunks/chunk-MHTUABJP.js +0 -8
  569. package/dist/bundle/chunks/chunk-MYE6AGBJ.js +0 -16
  570. package/dist/bundle/chunks/chunk-NAERJDUW.js +0 -8
  571. package/dist/bundle/chunks/chunk-NYQYO467.js +0 -32
  572. package/dist/bundle/chunks/chunk-PP6PSHAB.js +0 -4
  573. package/dist/bundle/chunks/chunk-PYSFUGCK.js +0 -10
  574. package/dist/bundle/chunks/chunk-QCDB2VPH.js +0 -6
  575. package/dist/bundle/chunks/chunk-SDNKECQQ.js +0 -5
  576. package/dist/bundle/chunks/chunk-TLSUDHID.js +0 -6
  577. package/dist/bundle/chunks/chunk-TOMNU26N.js +0 -4
  578. package/dist/bundle/chunks/chunk-TXBZCHCQ.js +0 -5
  579. package/dist/bundle/chunks/chunk-UNYNJIFU.js +0 -139
  580. package/dist/bundle/chunks/chunk-VJFXDYWH.js +0 -10
  581. package/dist/bundle/chunks/chunk-VLGZJRPG.js +0 -16
  582. package/dist/bundle/chunks/chunk-VYOJP4TV.js +0 -13
  583. package/dist/bundle/chunks/chunk-WKFATFPP.js +0 -4
  584. package/dist/bundle/chunks/chunk-XHM67O4N.js +0 -1
  585. package/dist/bundle/chunks/chunk-XORM457F.js +0 -286
  586. package/dist/bundle/chunks/chunk-YCFVLTST.js +0 -12
  587. package/dist/bundle/chunks/chunk-YS3AZT3J.js +0 -8
  588. package/dist/bundle/chunks/chunk-Z7JVV2SM.js +0 -12
  589. package/dist/bundle/chunks/chunk-ZXL7TQLN.js +0 -62
  590. package/dist/bundle/chunks/column-WLPMMSTS.js +0 -1
  591. package/dist/bundle/chunks/comm-5SLSESQG.js +0 -1
  592. package/dist/bundle/chunks/cut-OPC3VAGB.js +0 -1
  593. package/dist/bundle/chunks/diff-HJF2MPDN.js +0 -1
  594. package/dist/bundle/chunks/env-5EPCWSXR.js +0 -1
  595. package/dist/bundle/chunks/expand-DTNXU4LQ.js +0 -1
  596. package/dist/bundle/chunks/find-TPUOAIUQ.js +0 -1
  597. package/dist/bundle/chunks/flag-coverage-LMTH7T5F.js +0 -1
  598. package/dist/bundle/chunks/fold-LDSORVYE.js +0 -1
  599. package/dist/bundle/chunks/grep-3AIAIJVR.js +0 -1
  600. package/dist/bundle/chunks/gzip-AQXSGOVS.js +0 -1
  601. package/dist/bundle/chunks/head-HT2B6D2J.js +0 -1
  602. package/dist/bundle/chunks/html-to-markdown-TFCECAGV.js +0 -1
  603. package/dist/bundle/chunks/join-GG2LDHE5.js +0 -1
  604. package/dist/bundle/chunks/jq-ODXZBPLY.js +0 -1
  605. package/dist/bundle/chunks/js-exec-LSIPMWTQ.js +0 -99
  606. package/dist/bundle/chunks/md5sum-INMIK4DX.js +0 -1
  607. package/dist/bundle/chunks/nl-U5YJDM32.js +0 -1
  608. package/dist/bundle/chunks/od-VJEF2UR5.js +0 -1
  609. package/dist/bundle/chunks/paste-7N6AFSDS.js +0 -1
  610. package/dist/bundle/chunks/python3-5F2XPEW4.js +0 -11
  611. package/dist/bundle/chunks/rev-XOSYPP45.js +0 -1
  612. package/dist/bundle/chunks/rg-FOQSCCX3.js +0 -1
  613. package/dist/bundle/chunks/sed-VFTTATXJ.js +0 -1
  614. package/dist/bundle/chunks/sha1sum-VJPNLNU6.js +0 -1
  615. package/dist/bundle/chunks/sha256sum-PI32XWXY.js +0 -1
  616. package/dist/bundle/chunks/sort-DCNRDA7U.js +0 -1
  617. package/dist/bundle/chunks/split-SITCSYCZ.js +0 -1
  618. package/dist/bundle/chunks/sqlite3-56UMWEY3.js +0 -1
  619. package/dist/bundle/chunks/strings-7PLOGTPD.js +0 -1
  620. package/dist/bundle/chunks/tac-SJGXQ4T2.js +0 -1
  621. package/dist/bundle/chunks/tail-S5ULNTJU.js +0 -1
  622. package/dist/bundle/chunks/tar-232RCEFK.js +0 -1
  623. package/dist/bundle/chunks/tee-O7VXZDCO.js +0 -1
  624. package/dist/bundle/chunks/time-DEUO3QV2.js +0 -1
  625. package/dist/bundle/chunks/timeout-VRKMCG72.js +0 -1
  626. package/dist/bundle/chunks/tr-2HXZRDSW.js +0 -1
  627. package/dist/bundle/chunks/unexpand-RGTMIGZM.js +0 -1
  628. package/dist/bundle/chunks/uniq-SUNANL47.js +0 -1
  629. package/dist/bundle/chunks/wc-TQB3VNOX.js +0 -1
  630. package/dist/bundle/chunks/xan-BXDXYEIB.js +0 -1
  631. package/dist/bundle/chunks/xan-view-ECQUO7AJ.js +0 -1
  632. package/dist/bundle/chunks/xargs-I6EZUCYF.js +0 -1
  633. package/dist/bundle/chunks/yq-MJMAR36V.js +0 -1
  634. package/dist/commands/js-exec/executor-adapter.d.ts +0 -66
  635. package/dist/executor-init.d.ts +0 -19
  636. package/vendor/executor/executor-sdk-bundle.d.mts +0 -18
  637. package/vendor/executor/executor-sdk-bundle.mjs +0 -512
  638. package/vendor/executor/openapi-extractor-wasm/openapi_extractor_bg.wasm +0 -0
  639. /package/dist/bin/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
  640. /package/dist/bin/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
  641. /package/dist/bin/shell/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
  642. /package/dist/bin/shell/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
  643. /package/dist/bundle/chunks/{chunk-SYMJJMQ4.js → chunk-PXTK5WE2.js} +0 -0
@@ -1,16 +0,0 @@
1
- import{a,b as d,c as h}from"./chunk-74CEPOFO.js";var k={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, ..."]},p=1e5;function m(s){let l=s.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!l)return null;let e=Number.parseInt(l[1],10);if(Number.isNaN(e)||e<1)return null;let o=(l[2]||"").toUpperCase(),u=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(o);return u===void 0?null:e*u}function y(s,l,e){if(l)return s.toString().padStart(e,"0");let o="abcdefghijklmnopqrstuvwxyz",t="",u=s;for(let r=0;r<e;r++)t=o[u%26]+t,u=Math.floor(u/26);return t}function g(s,l){let e=s.split(`
2
- `),o=s.endsWith(`
3
- `)&&e[e.length-1]==="";o&&e.pop();let t=[];for(let u=0;u<e.length;u+=l){let r=e.slice(u,u+l),c=u+l>=e.length&&!o?r.join(`
4
- `):`${r.join(`
5
- `)}
6
- `;t.push({content:c,hasContent:!0})}return t}function C(s,l){let o=new TextEncoder().encode(s),t=new TextDecoder,u=[];for(let r=0;r<o.length;r+=l){let f=o.slice(r,r+l);u.push({content:t.decode(f),hasContent:f.length>0})}return u}function S(s,l){let o=new TextEncoder().encode(s),t=new TextDecoder,u=[],r=Math.ceil(o.length/l);for(let f=0;f<l;f++){let c=f*r,i=Math.min(c+r,o.length),n=o.slice(c,i);u.push({content:t.decode(n),hasContent:n.length>0})}return u}var I={name:"split",execute:async(s,l)=>{if(d(s))return a(k);let e={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},o=[],t=0;for(;t<s.length;){let i=s[t];if(i==="-l"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s[t+1]}'
7
- `};e.mode="lines",e.lines=n,t+=2}else if(i.match(/^-l\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${i.slice(2)}'
8
- `};e.mode="lines",e.lines=n,t++}else if(i==="-b"&&t+1<s.length){let n=m(s[t+1]);if(n===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s[t+1]}'
9
- `};e.mode="bytes",e.bytes=n,t+=2}else if(i.match(/^-b.+$/)){let n=m(i.slice(2));if(n===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${i.slice(2)}'
10
- `};e.mode="bytes",e.bytes=n,t++}else if(i==="-n"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${s[t+1]}'
11
- `};e.mode="chunks",e.chunks=n,t+=2}else if(i.match(/^-n\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${i.slice(2)}'
12
- `};e.mode="chunks",e.chunks=n,t++}else if(i==="-a"&&t+1<s.length){let n=Number.parseInt(s[t+1],10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${s[t+1]}'
13
- `};e.suffixLength=n,t+=2}else if(i.match(/^-a\d+$/)){let n=Number.parseInt(i.slice(2),10);if(Number.isNaN(n)||n<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${i.slice(2)}'
14
- `};e.suffixLength=n,t++}else if(i==="-d"||i==="--numeric-suffixes")e.useNumericSuffix=!0,t++;else if(i.startsWith("--additional-suffix="))e.additionalSuffix=i.slice(20),t++;else if(i==="--additional-suffix"&&t+1<s.length)e.additionalSuffix=s[t+1],t+=2;else if(i==="--"){o.push(...s.slice(t+1));break}else{if(i.startsWith("-")&&i!=="-")return h("split",i);o.push(i),t++}}let u="-",r="x";o.length>=1&&(u=o[0]),o.length>=2&&(r=o[1]);let f;if(u==="-")f=l.stdin??"";else{let i=l.fs.resolvePath(l.cwd,u),n=await l.fs.readFile(i);if(n===null)return{exitCode:1,stdout:"",stderr:`split: ${u}: No such file or directory
15
- `};f=n}if(f==="")return{exitCode:0,stdout:"",stderr:""};let c;switch(e.mode){case"lines":c=g(f,e.lines);break;case"bytes":c=C(f,e.bytes);break;case"chunks":c=S(f,e.chunks);break;default:return e.mode}if(c.length>p)return{exitCode:1,stdout:"",stderr:`split: too many output files (${c.length}), limit is ${p}
16
- `};for(let i=0;i<c.length;i++){let n=c[i];if(!n.hasContent)continue;let x=y(i,e.useNumericSuffix,e.suffixLength),b=`${r}${x}${e.additionalSuffix}`,N=l.fs.resolvePath(l.cwd,b);await l.fs.writeFile(N,n.content)}return{exitCode:0,stdout:"",stderr:""}}},$={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0};export{I as a,$ as b};
@@ -1,8 +0,0 @@
1
- import{a as v}from"./chunk-OJDRYQWQ.js";import{a as c,b as f,c as m}from"./chunk-74CEPOFO.js";var g={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},w={name:"env",async execute(o,i){if(f(o))return c(g);let a=!1,r=[],u=new Map,t=-1;for(let n=0;n<o.length;n++){let e=o[n];if(e==="-i"||e==="--ignore-environment")a=!0;else if(e==="-u"&&n+1<o.length)r.push(o[++n]);else if(e.startsWith("-u"))r.push(e.slice(2));else if(e.startsWith("--unset="))r.push(e.slice(8));else{if(e.startsWith("--")&&e!=="--")return m("env",e);if(e.startsWith("-")&&e!=="-"){for(let l of e.slice(1))if(l!=="i"&&l!=="u")return m("env",`-${l}`);e.includes("i")&&(a=!0)}else if(e.includes("=")&&t===-1){let l=e.indexOf("="),d=e.slice(0,l),h=e.slice(l+1);u.set(d,h)}else{t=n;break}}}let s;if(a)s=new Map(u);else{s=new Map(i.env);for(let n of r)s.delete(n);for(let[n,e]of u)s.set(n,e)}if(t===-1){let n=[];for(let[e,l]of s)n.push(`${e}=${l}`);return{stdout:n.join(`
2
- `)+(n.length>0?`
3
- `:""),stderr:"",exitCode:0}}if(!i.exec)return{stdout:"",stderr:`env: command execution not supported in this context
4
- `,exitCode:1};let p=o.slice(t);return i.exec("command",{cwd:i.cwd,env:v(s),replaceEnv:!0,stdin:i.stdin,signal:i.signal,args:p})}},x={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},E={name:"printenv",async execute(o,i){if(f(o))return c(x);let a=o.filter(t=>!t.startsWith("-"));if(a.length===0){let t=[];for(let[s,p]of i.env)t.push(`${s}=${p}`);return{stdout:t.join(`
5
- `)+(t.length>0?`
6
- `:""),stderr:"",exitCode:0}}let r=[],u=0;for(let t of a){let s=i.env.get(t);s!==void 0?r.push(s):u=1}return{stdout:r.join(`
7
- `)+(r.length>0?`
8
- `:""),stderr:"",exitCode:u}}},M={name:"env",flags:[{flag:"-i",type:"boolean"},{flag:"-u",type:"value",valueHint:"string"}]},N={name:"printenv",flags:[]};export{w as a,E as b,M as c,N as d};
@@ -1,32 +0,0 @@
1
- import{f as G}from"./chunk-7TSDKFEO.js";import{a as z,b as B,c as E}from"./chunk-VLGZJRPG.js";import{a as U}from"./chunk-IPJHKYVM.js";import{a as $}from"./chunk-YNYSPYQ5.js";import{a as R,b as _,c as D}from"./chunk-74CEPOFO.js";var q=G({js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}}),M=class{types;constructor(){this.types=new Map(Object.entries(q).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let o=this.types.get(s)||{extensions:[],globs:[]};o.extensions.push(...i.extensions),o.globs.push(...i.globs),this.types.set(s,o)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let o=i.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${o}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function H(){let e=[];for(let[t,n]of Object.entries(q).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
2
- `)}
3
- `}function V(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function te(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function se(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
4
- `,exitCode:1}}function Z(e){return null}var J=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:Z},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:Z},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:te,validate:se},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],ne=new Map([["i",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["--ignore-case",e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],["s",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["--case-sensitive",e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],["S",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["--smart-case",e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],["F",e=>{e.fixedStrings=!0}],["--fixed-strings",e=>{e.fixedStrings=!0}],["w",e=>{e.wordRegexp=!0}],["--word-regexp",e=>{e.wordRegexp=!0}],["x",e=>{e.lineRegexp=!0}],["--line-regexp",e=>{e.lineRegexp=!0}],["v",e=>{e.invertMatch=!0}],["--invert-match",e=>{e.invertMatch=!0}],["U",e=>{e.multiline=!0}],["--multiline",e=>{e.multiline=!0}],["--multiline-dotall",e=>{e.multilineDotall=!0,e.multiline=!0}],["c",e=>{e.count=!0}],["--count",e=>{e.count=!0}],["--count-matches",e=>{e.countMatches=!0}],["l",e=>{e.filesWithMatches=!0}],["--files",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!0}],["o",e=>{e.onlyMatching=!0}],["--only-matching",e=>{e.onlyMatching=!0}],["q",e=>{e.quiet=!0}],["--quiet",e=>{e.quiet=!0}],["N",e=>{e.lineNumber=!1}],["--no-line-number",e=>{e.lineNumber=!1}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["I",e=>{e.noFilename=!0}],["--no-filename",e=>{e.noFilename=!0}],["0",e=>{e.nullSeparator=!0}],["--null",e=>{e.nullSeparator=!0}],["b",e=>{e.byteOffset=!0}],["--byte-offset",e=>{e.byteOffset=!0}],["--column",e=>{e.column=!0,e.lineNumber=!0}],["--no-column",e=>{e.column=!1}],["--vimgrep",e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],["--json",e=>{e.json=!0}],["--hidden",e=>{e.hidden=!0}],["--no-ignore",e=>{e.noIgnore=!0}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!0}],["L",e=>{e.followSymlinks=!0}],["--follow",e=>{e.followSymlinks=!0}],["z",e=>{e.searchZip=!0}],["--search-zip",e=>{e.searchZip=!0}],["a",e=>{e.searchBinary=!0}],["--text",e=>{e.searchBinary=!0}],["--heading",e=>{e.heading=!0}],["--passthru",e=>{e.passthru=!0}],["--include-zero",e=>{e.includeZero=!0}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),re=new Set(["n","--line-number"]);function ie(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function le(e,t,n){let s=e[t];for(let r of J){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=P(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=P(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function oe(e){return J.find(t=>t.short===e)}function P(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function ae(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function ce(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function fe(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Y(e){let t=V(),n=null,s=[],r=-1,l=-1,i=-1,o=!1;for(let c=0;c<e.length;c++){let a=e[c];if(a.startsWith("-")&&a!=="-"){let u=ce(e,c);if(u){let{flag:f,value:x,newIndex:b}=u;f==="A"?r=Math.max(r,x):f==="B"?l=Math.max(l,x):i=x,c=b;continue}let d=fe(a);if(d!==null){t.maxCount=d;continue}let p=le(e,c,t);if(p){if(p.error)return{success:!1,error:p.error};c=p.newIndex;continue}let g=ae(e,c);if(g){t.sort=g.value,c=g.newIndex;continue}let w=a.startsWith("--")?[a]:a.slice(1).split(""),m=!1;for(let f of w){if(re.has(f)){t.lineNumber=!0,o=!0;continue}if(f==="u"||f==="--unrestricted"){ie(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
5
- `,exitCode:1}};if(f.length===1){let b=oe(f);if(b){if(c+1>=e.length)return{success:!1,error:D("rg",`-${f}`)};let h=P(t,b,e[c+1]);if(h)return{success:!1,error:h};c++,m=!0;continue}}let x=ne.get(f);if(x){x(t);continue}if(f.startsWith("--"))return{success:!1,error:D("rg",f)};if(f.length===1)return{success:!1,error:D("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=a:s.push(a)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(o=!0),{success:!0,options:t,paths:s,explicitLineNumbers:o}}import{gunzipSync as ue}from"node:zlib";var T=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
6
- `);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let o=!1;r.startsWith("/")?(o=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(o=!0);let c=this.patternToRegex(r,o);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:o})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",$(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},k=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let o=this.fs.resolvePath(l,i);try{let c=await this.fs.readFile(o),a=new T(l);a.parse(c),this.parsers.push(a)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFile(r),i=new T(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new T(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function A(e,t,n=!1,s=!1,r=[]){let l=new k(e,t,n,s);await l.load(t);for(let i of r)try{let o=e.resolvePath(t,i),c=await e.readFile(o);l.addPatternsFromContent(c,t)}catch{}return l}function he(e){return e.length>=2&&e[0]===31&&e[1]===139}function ge(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function K(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let x=f.startsWith("!")?f.slice(1):f,b=ge(x);if(b)return{stdout:"",stderr:`${b}
7
- `,exitCode:1}}if(n.files){let f=[...n.patterns,...s];return de(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let x;if(f==="-")x=t.stdin;else{let h=t.fs.resolvePath(t.cwd,f);x=await t.fs.readFile(h)}let b=x.split(`
8
- `).filter(h=>h.length>0);l.push(...b)}catch{return{stdout:"",stderr:`rg: ${f}: No such file or directory
9
- `,exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
10
- `,exitCode:2};let i=s.length===0?["."]:s,o=pe(n,l),c,a;try{let f=me(l,n,o);c=f.regex,a=f.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${l.join(", ")}
11
- `,exitCode:2}}let u=null;n.noIgnore||(u=await A(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new M;for(let f of n.typeClear)d.clearType(f);for(let f of n.typeAdd)d.addType(f);let{files:p,singleExplicitFile:g}=await X(t,i,n,u,d);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let w=!n.noFilename&&(n.withFilename||!g||p.length>1),m=n.lineNumber;return r||(g&&p.length===1&&(m=!1),n.onlyMatching&&(m=!1)),be(t,p,c,n,w,m,a)}function pe(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function me(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),B(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function X(e,t,n,s,r){let l=[],i=0,o=0;for(let a of t){let u=e.fs.resolvePath(e.cwd,a);try{let d=await e.fs.stat(u);if(d.isFile){if(i++,n.maxFilesize>0&&d.size>n.maxFilesize)continue;ee(a,n,s,u,r)&&l.push(a)}else d.isDirectory&&(o++,await Q(e,a,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&o===0}}async function Q(e,t,n,s,r,l,i,o){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(a=>({name:a,isFile:void 0}));for(let a of c){let u=a.name;if(!r.noIgnore&&k.isCommonIgnored(u))continue;let d=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,g=e.fs.resolvePath(n,u),w,m,f=!1;if(a.isFile!==void 0&&"isDirectory"in a){let h=a;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let y=await e.fs.stat(g);w=y.isFile,m=y.isDirectory}catch{continue}else w=h.isFile,m=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(g):await e.fs.stat(g);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let y=f&&r.followSymlinks?await e.fs.stat(g):h;w=y.isFile,m=y.isDirectory}catch{continue}if(!l?.matches(g,m)&&!(d&&!r.hidden&&!l?.isWhitelisted(g,m))){if(m)await Q(e,p,g,s+1,r,l,i,o);else if(w){if(r.maxFilesize>0)try{if((await e.fs.stat(g)).size>r.maxFilesize)continue}catch{continue}ee(p,r,l,g,i)&&o.push(p)}}}}catch{}}}function ee(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,o=t.globs.filter(a=>!a.startsWith("!")),c=t.globs.filter(a=>a.startsWith("!")).map(a=>a.slice(1));if(o.length>0){let a=!1;for(let u of o)if(v(l,u,i)||v(e,u,i)){a=!0;break}if(!a)return!1}for(let a of c)if(a.startsWith("/")){let u=a.slice(1);if(v(e,u,i))return!1}else if(v(l,a,i)||v(e,a,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),o=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let a of i)if(v(l,a,!0)||v(e,a,!0)){c=!0;break}if(!c)return!1}for(let c of o)if(c.startsWith("/")){let a=c.slice(1);if(v(e,a,!0))return!1}else if(v(l,c,!0)||v(e,c,!0))return!1}return!0}function v(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",$(s,n?"i":"").test(e)}async function de(e,t,n){let s=null;n.noIgnore||(s=await A(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new M;for(let a of n.typeClear)r.clearType(a);for(let a of n.typeAdd)r.addType(a);let l=t.length===0?["."]:t,{files:i}=await X(e,l,n,s,r);if(i.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let o=n.nullSeparator?"\0":`
12
- `;return{stdout:i.map(a=>a+o).join(""),stderr:"",exitCode:0}}function xe(e,t){if(t.length===0)return!0;for(let n of t)if(v(e,n,!1))return!0;return!1}async function ye(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(xe(i,s.preprocessorGlobs)){let o=await e.exec(U([s.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(o.exitCode===0&&o.stdout){let c=o.stdout.slice(0,8192);return{content:o.stdout,isBinary:c.includes("\0")}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await e.fs.readFileBuffer(t);if(he(i))try{let o=ue(i),c=new TextDecoder().decode(o),a=c.slice(0,8192);return{content:c,isBinary:a.includes("\0")}}catch{return null}}let r=await e.fs.readFile(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function be(e,t,n,s,r,l,i){let o="",c=!1,a=[],u=0,d=0,p=0,g=50;e:for(let f=0;f<t.length;f+=g){let x=t.slice(f,f+g),b=await Promise.all(x.map(async h=>{let y=e.fs.resolvePath(e.cwd,h),F=await ye(e,y,h,s);if(!F)return null;let{content:C,isBinary:N}=F;if(p+=C.length,N&&!s.searchBinary)return null;let W=r&&!s.heading?h:"",S=z(C,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:W,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace!==null?E(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&S.matched?{file:h,result:S,content:C,isBinary:!1}:{file:h,result:S}}));for(let h of b){if(!h)continue;let{file:y,result:F}=h;if(F.matched){if(c=!0,d++,u+=F.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let C=h.content||"";a.push(JSON.stringify({type:"begin",data:{path:{text:y}}}));let N=C.split(`
13
- `);n.lastIndex=0;let W=0;for(let S=0;S<N.length;S++){let j=N[S];n.lastIndex=0;let O=[];for(let I=n.exec(j);I!==null;I=n.exec(j)){let L={match:{text:I[0]},start:I.index,end:I.index+I[0].length};s.replace!==null&&(L.replacement={text:s.replace}),O.push(L),I[0].length===0&&n.lastIndex++}if(O.length>0){let I={type:"match",data:{path:{text:y},lines:{text:`${j}
14
- `},line_number:S+1,absolute_offset:W,submatches:O}};a.push(JSON.stringify(I))}W+=j.length+1}a.push(JSON.stringify({type:"end",data:{path:{text:y},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:C.length,bytes_printed:0,matched_lines:F.matchCount,matches:F.matchCount}}}))}else if(s.filesWithMatches){let C=s.nullSeparator?"\0":`
15
- `;o+=`${y}${C}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(o+=`${y}
16
- `),o+=F.output)}else if(s.filesWithoutMatch){let C=s.nullSeparator?"\0":`
17
- `;o+=`${y}${C}`}else s.includeZero&&(s.count||s.countMatches)&&(o+=F.output)}}s.json&&(a.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:d,bytes_searched:p,bytes_printed:0,matched_lines:u,matches:u}}})),o=`${a.join(`
18
- `)}
19
- `);let w=s.quiet&&!s.json?"":o;if(s.stats&&!s.json){let f=["",`${u} matches`,`${u} matched lines`,`${d} files contained matches`,`${t.length} files searched`,`${p} bytes searched`].join(`
20
- `);w+=`${f}
21
- `}let m;return s.filesWithoutMatch?m=o.length>0?0:1:m=c?0:1,{stdout:w,stderr:"",exitCode:m}}var we={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
22
- Unlike grep, rg is recursive by default and respects .gitignore files.
23
-
24
- EXAMPLES:
25
- rg foo Search for 'foo' in current directory
26
- rg foo src/ Search in src/ directory
27
- rg -i foo Case-insensitive search
28
- rg -w foo Match whole words only
29
- rg -t js foo Search only JavaScript files
30
- rg -g '*.ts' foo Search files matching glob
31
- rg --hidden foo Include hidden files
32
- rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Be={name:"rg",async execute(e,t){if(_(e))return R(we);if(e.includes("--type-list"))return{stdout:H(),stderr:"",exitCode:0};let n=Y(e);return n.success?K({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},Ee={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{Be as a,Ee as b};
@@ -1,4 +0,0 @@
1
- async function x(a,u){let o="octal",n=[],i=[];for(let t=0;t<a.length;t++){let e=a[t];if(e==="-c")n.push("char");else if(e==="-An"||e==="-A"&&a[t+1]==="n")o="none",e==="-A"&&t++;else if(e==="-t"&&a[t+1]){let r=a[++t];r==="x1"?n.push("hex"):r==="c"?n.push("char"):r.startsWith("o")&&n.push("octal")}else(!e.startsWith("-")||e==="-")&&i.push(e)}n.length===0&&n.push("octal");let c=u.stdin;if(i.length>0&&i[0]!=="-"){let t=i[0].startsWith("/")?i[0]:`${u.cwd}/${i[0]}`;try{c=await u.fs.readFile(t)}catch{return{stdout:"",stderr:`od: ${i[0]}: No such file or directory
2
- `,exitCode:1}}}let d=n.includes("char");function m(t){return t===0?" \\0":t===7?" \\a":t===8?" \\b":t===9?" \\t":t===10?" \\n":t===11?" \\v":t===12?" \\f":t===13?" \\r":t>=32&&t<127?` ${String.fromCharCode(t)}`:` ${t.toString(8).padStart(3,"0")}`}function y(t){return d?` ${t.toString(16).padStart(2,"0")}`:` ${t.toString(16).padStart(2,"0")}`}function S(t){return` ${t.toString(8).padStart(3,"0")}`}let s=[];for(let t of c)s.push(t.charCodeAt(0));let p=16,f=[];for(let t=0;t<s.length;t+=p){let e=s.slice(t,t+p);for(let r=0;r<n.length;r++){let g=n[r],l;g==="char"?l=e.map(m):g==="hex"?l=e.map(y):l=e.map(S);let h="";r===0&&o!=="none"?h=`${t.toString(8).padStart(7,"0")} `:(r>0||o==="none")&&(h=o==="none"?"":" "),f.push(h+l.join(""))}}return o!=="none"&&s.length>0&&f.push(s.length.toString(8).padStart(7,"0")),{stdout:f.length>0?`${f.join(`
3
- `)}
4
- `:"",stderr:"",exitCode:0}}var $={name:"od",execute:x},v={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0};export{$ as a,v as b};
@@ -1,10 +0,0 @@
1
- import{a as g,b,c as m}from"./chunk-74CEPOFO.js";var k={name:"unexpand",summary:"convert spaces to tabs",usage:"unexpand [OPTION]... [FILE]...",description:"Convert blanks in each FILE to TABs, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-a Convert all sequences of blanks (not just leading)"],examples:["unexpand file.txt # Convert leading spaces to tabs","unexpand -a file.txt # Convert all space sequences","unexpand -t 4 file.txt # Use 4-space tabs"]};function f(s){let i=s.split(",").map(l=>l.trim()),e=[];for(let l of i){let n=parseInt(l,10);if(Number.isNaN(n)||n<1)return null;e.push(n)}for(let l=1;l<e.length;l++)if(e[l]<=e[l-1])return null;return e}function v(s,i){if(i.length===1){let e=i[0];return s+(e-s%e)}for(let e of i)if(e>s)return e;if(i.length>=2){let e=i[i.length-1]-i[i.length-2],l=i[i.length-1],n=Math.floor((s-l)/e)+1;return l+n*e}return-1}function L(s,i){let{tabStops:e,allBlanks:l}=i,n="",o=0,t="",a=0,u=!0,d=()=>{if(t.length===0)return;let r=a+t.length;if(!l&&!u){n+=t,t="";return}let p=a,c="";for(;p<r;){let h=v(p,e);if(h<=r&&h>p)c+=" ",p=h;else break}let x=r-p;x>0&&(c+=" ".repeat(x)),n+=c,t=""};for(let r of s)r===" "?(t.length===0&&(a=o),t+=r,o++):r===" "?(d(),n+=r,o=v(o,e)):(d(),n+=r,o++,u=!1);return d(),n}function C(s,i){if(s==="")return"";let e=s.split(`
2
- `),l=s.endsWith(`
3
- `)&&e[e.length-1]==="";return l&&e.pop(),e.map(o=>L(o,i)).join(`
4
- `)+(l?`
5
- `:"")}var w={name:"unexpand",execute:async(s,i)=>{if(b(s))return g(k);let e={tabStops:[8],allBlanks:!1},l=[],n=0;for(;n<s.length;){let t=s[n];if(t==="-t"&&n+1<s.length){let a=f(s[n+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
6
- `};e.tabStops=a,n+=2}else if(t.startsWith("-t")&&t.length>2){let a=f(t.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(2)}'
7
- `};e.tabStops=a,n++}else if(t==="--tabs"&&n+1<s.length){let a=f(s[n+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${s[n+1]}'
8
- `};e.tabStops=a,n+=2}else if(t.startsWith("--tabs=")){let a=f(t.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${t.slice(7)}'
9
- `};e.tabStops=a,n++}else if(t==="-a"||t==="--all")e.allBlanks=!0,n++;else if(t==="--"){l.push(...s.slice(n+1));break}else{if(t.startsWith("-")&&t!=="-")return m("unexpand",t);l.push(t),n++}}let o="";if(l.length===0){let t=i.stdin??"";o=C(t,e)}else for(let t of l){let a=i.fs.resolvePath(i.cwd,t),u=await i.fs.readFile(a);if(u===null)return{exitCode:1,stdout:o,stderr:`unexpand: ${t}: No such file or directory
10
- `};o+=C(u,e)}return{exitCode:0,stdout:o,stderr:""}}},F={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0};export{w as a,F as b};
@@ -1,6 +0,0 @@
1
- import{a as f,b as a,c}from"./chunk-74CEPOFO.js";var u={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};function d(t){return Array.from(t).reverse().join("")}var v={name:"rev",execute:async(t,s)=>{if(a(t))return f(u);let o=[];for(let e of t)if(e==="--"){let r=t.indexOf(e);o.push(...t.slice(r+1));break}else{if(e.startsWith("-")&&e!=="-")return c("rev",e);o.push(e)}let n="",l=e=>{let r=e.split(`
2
- `),i=e.endsWith(`
3
- `)&&r[r.length-1]==="";return i&&r.pop(),r.map(d).join(`
4
- `)+(i?`
5
- `:"")};if(o.length===0){let e=s.stdin??"";n=l(e)}else for(let e of o)if(e==="-"){let r=s.stdin??"";n+=l(r)}else{let r=s.fs.resolvePath(s.cwd,e),i=await s.fs.readFile(r);if(i===null)return{exitCode:1,stdout:n,stderr:`rev: ${e}: No such file or directory
6
- `};n+=l(i)}return{exitCode:0,stdout:n,stderr:""}}},m={name:"rev",flags:[],stdinType:"text",needsFiles:!0};export{v as a,m as b};
@@ -1,5 +0,0 @@
1
- import{b as x}from"./chunk-7L36YK2X.js";import{a as y,b as I,c as g}from"./chunk-74CEPOFO.js";var w={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function F(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function L(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let o=s;o<r&&o<t.length;o++)o>=0&&!l.includes(t[o])&&l.push(t[o])}return l}var k={name:"cut",async execute(t,c){if(I(t))return y(w);let l=" ",n=null,s=null,r=!1,o=[];for(let i=0;i<t.length;i++){let e=t[i];if(e==="-d")l=t[++i]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++i];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++i];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return g("cut",e);if(e.startsWith("-")){let a=!1;for(let f of e.slice(1))if(f==="s")r=!0;else if(!"dfc".includes(f)){a=!0;break}if(a)return g("cut",e)}else o.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
2
- `,exitCode:1};let p=await x(c,o,{cmdName:"cut"});if(!p.ok)return p.error;let u=p.content.split(`
3
- `);u.length>0&&u[u.length-1]===""&&u.pop();let m=F(n||s||"1"),h="";for(let i of u)if(s){let e=i.split(""),a=[];for(let f of m){let v=f.start-1,H=f.end===null?e.length:f.end;for(let d=v;d<H&&d<e.length;d++)d>=0&&a.push(e[d])}h+=`${a.join("")}
4
- `}else{if(r&&!i.includes(l))continue;let e=i.split(l),a=L(e,m);h+=`${a.join(l)}
5
- `}return{stdout:h,stderr:"",exitCode:0,stdoutEncoding:"binary"}}},C={name:"cut",flags:[{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-f",type:"value",valueHint:"string"},{flag:"-c",type:"value",valueHint:"string"},{flag:"-s",type:"boolean"}],stdinType:"text",needsFiles:!0};export{k as a,C as b};
@@ -1,6 +0,0 @@
1
- import{a as p}from"./chunk-HWKDQ44K.js";import{a as l,b as u}from"./chunk-74CEPOFO.js";import*as c from"diff";var y={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},b={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},$={name:"diff",async execute(a,e){if(u(a))return l(y);let t=p("diff",a,b);if(!t.ok)return t.error;let g=t.result.flags.brief,h=t.result.flags.reportSame,m=t.result.flags.ignoreCase,d=t.result.positional;if(t.result.flags.unified,d.length<2)return{stdout:"",stderr:`diff: missing operand
2
- `,exitCode:2};let i,s,[r,o]=d;try{i=r==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,r))}catch{return{stdout:"",stderr:`diff: ${r}: No such file or directory
3
- `,exitCode:2}}try{s=o==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:"",stderr:`diff: ${o}: No such file or directory
4
- `,exitCode:2}}let f=i,n=s;return m&&(f=f.toLowerCase(),n=n.toLowerCase()),f===n?h?{stdout:`Files ${r} and ${o} are identical
5
- `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:g?{stdout:`Files ${r} and ${o} differ
6
- `,stderr:"",exitCode:1}:{stdout:c.createTwoFilesPatch(r,o,i,s,"","",{context:3}),stderr:"",exitCode:1}}},x={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{$ as a,x as b};
@@ -1,4 +0,0 @@
1
- import{a as L}from"./chunk-IPJHKYVM.js";import{a as A,b as v,c as b}from"./chunk-74CEPOFO.js";var $={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},P={name:"xargs",async execute(l,r){if(v(l))return A($);let m=null,g=null,c=null,o=null,h=!1,x=!1,y=!1,s=0;for(let e=0;e<l.length;e++){let t=l[e];if(t==="-I"&&e+1<l.length)m=l[++e],s=e+1;else if(t==="-d"&&e+1<l.length)g=l[++e].replace(/\\n/g,`
2
- `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),s=e+1;else if(t==="-n"&&e+1<l.length)c=parseInt(l[++e],10),s=e+1;else if(t==="-P"&&e+1<l.length)o=parseInt(l[++e],10),s=e+1;else if(t==="-0"||t==="--null")h=!0,s=e+1;else if(t==="-t"||t==="--verbose")x=!0,s=e+1;else if(t==="-r"||t==="--no-run-if-empty")y=!0,s=e+1;else{if(t.startsWith("--"))return b("xargs",t);if(t.startsWith("-")&&t.length>1){for(let n of t.slice(1))if(!"0tr".includes(n))return b("xargs",`-${n}`);t.includes("0")&&(h=!0),t.includes("t")&&(x=!0),t.includes("r")&&(y=!0),s=e+1}else if(!t.startsWith("-")){s=e;break}}}let a=l.slice(s);a.length===0&&a.push("echo");let i;if(h?i=r.stdin.split("\0").filter(e=>e.length>0):g!==null?i=r.stdin.replace(/\n$/,"").split(g).filter(t=>t.length>0):i=r.stdin.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0),i.length===0)return y?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",u="",f=0,w=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,"\\$1")}"`:e,C=async e=>{if(x){let n=e.map(w).join(" ");u+=`${n}
3
- `}return r.exec?r.exec(L([e[0]]),{cwd:r.cwd,signal:r.signal,args:e.slice(1)}):{stdout:`${e.map(w).join(" ")}
4
- `,stderr:"",exitCode:0}},I=async e=>{if(o!==null&&o>1)for(let t=0;t<e.length;t+=o){let n=e.slice(t,t+o),M=await Promise.all(n.map(C));for(let p of M)d+=p.stdout,u+=p.stderr,p.exitCode!==0&&(f=p.exitCode)}else for(let t of e){let n=await C(t);d+=n.stdout,u+=n.stderr,n.exitCode!==0&&(f=n.exitCode)}};if(m!==null){let e=i.map(t=>a.map(n=>n.replaceAll(m,t)));await I(e)}else if(c!==null){let e=[];for(let t=0;t<i.length;t+=c){let n=i.slice(t,t+c);e.push([...a,...n])}await I(e)}else{let e=[...a,...i],t=await C(e);d+=t.stdout,u+=t.stderr,f=t.exitCode}return{stdout:d,stderr:u,exitCode:f}}},H={name:"xargs",flags:[{flag:"-I",type:"value",valueHint:"string"},{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-0",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-r",type:"boolean"}],stdinType:"text"};export{P as a,H as b};
@@ -1,5 +0,0 @@
1
- import{a as f}from"./chunk-7L36YK2X.js";import{a as d}from"./chunk-HWKDQ44K.js";import{a as m,b as p}from"./chunk-74CEPOFO.js";var b={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},g={number:{short:"n",long:"number",type:"boolean"}},F={name:"cat",async execute(n,s){if(p(n))return m(b);let e=d("cat",n,g);if(!e.ok)return e.error;let r=e.result.flags.number,t=e.result.positional,a=await f(s,t,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",l=1;for(let{content:i}of a.files)if(r){let c=y(i,l);o+=c.content,l=c.nextLineNumber}else o+=i;let u=t.length>0&&t.some(i=>i!=="-");return{stdout:o,stderr:a.stderr,exitCode:a.exitCode,...u?{stdoutEncoding:"binary"}:{}}}};function y(n,s){let e=n.split(`
2
- `),r=n.endsWith(`
3
- `),t=r?e.slice(0,-1):e;return{content:t.map((o,l)=>`${String(s+l).padStart(6," ")} ${o}`).join(`
4
- `)+(r?`
5
- `:""),nextLineNumber:s+t.length}}var w={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0};export{F as a,w as b};
@@ -1,139 +0,0 @@
1
- import{a as O,b,c as M,d as _e,e as w,f as v,g as Y,h as B}from"./chunk-F55TLFGB.js";import{a as tt}from"./chunk-SYMJJMQ4.js";import{a as $}from"./chunk-BBXLRYSX.js";import{f as qe,g as X}from"./chunk-7TSDKFEO.js";import{a as H}from"./chunk-YNYSPYQ5.js";import{a as We}from"./chunk-7L36YK2X.js";import{a as D,b as G}from"./chunk-74CEPOFO.js";import{b as Ue,d as Ze,e as Qe,f as et}from"./chunk-DXB73IDG.js";var q,He=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
2
- `||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
3
- `;)this.pos++;else break}}nextToken(){let n=this.pos,t=this.input[this.pos];if(t>="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="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(t==="/"){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:n}):(this.pos++,{type:"/",value:"/",pos:n}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:n};if(this.match("=>"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!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==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!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(n,this.pos).replace(/_/g,"");return{type:t?"float":"int",value:r,pos:n}}readString(n){let t=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===n)return this.pos++,{type:"string",value:s,pos:t};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
4
- `;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 ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",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:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(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&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var Je={};Ze(Je,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";He();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.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 t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;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 t=[];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;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.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);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){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(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var z={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("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=>k("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=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>ze(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[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return ze(s,n,t.length===1?t[0]:z.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};Object.setPrototypeOf(z,null);function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var nt="then";function ze(e,n,t){let s=qe({type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}});return s[nt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function F(e,n=!0){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 n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>F(r.expr,n)),s=Object.hasOwn(z,e.name)?z[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=F(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:F(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?F(e.start,n):void 0,end:e.end?F(e.end,n):void 0};case"lambda":return F(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function Ke(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=F(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(Ke(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return Ke(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ge(e,n,t={}){let s=O();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
5
- `,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let i={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},h=Q(t),u=h.map(l=>l.alias),p=Ge(r,h,i);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function ne(e,n){let t="",s="",r=[];for(let d=0;d<e.length;d++){let m=e[d];m==="--sorted"||m.startsWith("-")||(t?s?r.push(m):s=m:t=m)}if(!t||!s)return{stdout:"",stderr:`xan groupby: usage: xan groupby COLS EXPR [FILE]
6
- `,exitCode:1};let{data:o,error:i}=await v(r,n);if(i)return i;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Q(s),l=[],f=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");f.has(m)||(f.set(m,[]),l.push(m)),f.get(m)?.push(d)}let c=[...u,...p.map(d=>d.alias)],a=[];for(let d of l){let m=f.get(d);if(!m)continue;let g=O();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,ee(m,y,h));a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function se(e,n){let t=[],s="",r=10,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?t=e[++a].split(","):(d==="-g"||d==="--groupby")&&a+1<e.length?s=e[++a]:(d==="-l"||d==="--limit")&&a+1<e.length?r=Number.parseInt(e[++a],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||i.push(d)}let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=t.length>0?t:h.filter(a=>a!==s);s&&t.length===0&&(l=h.filter(a=>a!==s));let f=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let a=new Map;for(let d of u){let m=String(d[s]??"");a.has(m)||a.set(m,[]),a.get(m)?.push(d)}for(let d of l)for(let[m,g]of a){let y=new Map;for(let I of g){let N=I[d],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((I,N)=>N[1]!==I[1]?N[1]-I[1]:I[0].localeCompare(N[0]));o&&(x=x.filter(([I])=>I!=="")),r>0&&(x=x.slice(0,r));for(let[I,N]of x)f.push({field:d,[s]:m,value:I===""?"<empty>":I,count:N})}}else for(let a of l){let d=new Map;for(let g of u){let y=g[a],x=y===""||y===null||y===void 0?"":String(y);d.set(x,(d.get(x)||0)+1)}let m=[...d.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)f.push({field:a,value:g===""?"<empty>":g,count:y})}return{stdout:w(c,f),stderr:"",exitCode:0}}async function re(e,n){let t=[],s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?t=e[++l].split(","):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t.length>0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let l of h){let f=o.map(d=>d[l]).filter(d=>d!=null),c=f.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).filter(d=>!Number.isNaN(d)),a=c.length===f.length&&c.length>0;p.push({field:l,type:a?"Number":"String",count:f.length,min:a?Math.min(...c):"",max:a?Math.max(...c):"",mean:a?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}U();function Xe(e){let n=_(e);return F(n)}function st(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function K(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),l=K(p,n);for(let f of l)s.add(f);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=st(o);for(let l of n)p.test(l)&&!t.includes(l)&&t.push(l);continue}let i=o.match(/^([^:]*):([^:]*)$/);if(i&&(i[1]||i[2])){let p=i[1],l=i[2],f=p?n.indexOf(p):0,c=l?n.indexOf(l):n.length-1;if(f!==-1&&c!==-1){let a=f<=c?1:-1;for(let d=f;a>0?d<=c:d>=c;d+=a)t.includes(n[d])||t.push(n[d])}continue}let h=o.match(/^(\d+)-(\d+)$/);if(h){let p=Number.parseInt(h[1],10),l=Number.parseInt(h[2],10);for(let f=p;f<=l&&f<n.length;f++)t.push(n[f]);continue}let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0&&u<n.length){t.push(n[u]);continue}n.includes(o)&&t.push(o)}return s.size>0?t.filter(r=>!s.has(r)):t}async function oe(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified
7
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=K(t,r),u=o.map(p=>{let l=O();for(let f of h)b(l,f,p[f]);return l});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ie(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan drop: no columns specified
8
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set(K(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=O();for(let c of u)b(f,c,l[c]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function ae(e,n){let t="",s="",r=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?s=e[++l]:f.startsWith("-")||(t?r.push(f):t=f)}if(!t)return{stdout:"",stderr:`xan rename: no new name(s) specified
9
- `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;let u;if(s){let l=s.split(","),f=t.split(","),c=new Map;for(let a=0;a<l.length&&a<f.length;a++)c.set(l[a],f[a]);u=o.map(a=>c.get(a)||a)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=i.map(l=>{let f=O();for(let c=0;c<o.length;c++)b(f,u[c],l[o[c]]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function le(e,n){let t="index",s=[];for(let p=0;p<e.length;p++)e[p]==="-c"&&p+1<e.length?t=e[++p]:s.push(e[p]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=[t,...r],u=o.map((p,l)=>{let f=O();b(f,t,l);for(let c of r)b(f,c,p[c]);return f});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ue(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(i=>i!=="-j"&&i!=="--just-names"),n);return r||{stdout:t?`${s.map(i=>i).join(`
10
- `)}
11
- `:`${s.map((i,h)=>`${h} ${i}`).join(`
12
- `)}
13
- `,stderr:"",exitCode:0}}async function ce(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length}
14
- `,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function de(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-s"||a==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-e"||a==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-l"||a==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):a.startsWith("-")||o.push(a)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t??0,l;r!==void 0?l=p+r:s!==void 0?l=s:l=h.length;let f=h.slice(p,l);return{stdout:w(i,f),stderr:"",exitCode:0}}async function he(e,n){let{headers:t,data:s,error:r}=await v(e,n);if(r)return r;let o=[...s].reverse();return{stdout:w(t,o),stderr:"",exitCode:0}}var me=Qe(tt(),1);async function ge(e,n){let t=e.filter(p=>!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],l=s.map(f=>({column:f}));return{stdout:w(p,l),stderr:"",exitCode:0}}let i=s[0],h=[i,...r.map((p,l)=>String(p[i]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=O();b(f,i,l);for(let c=0;c<r.length;c++)b(f,h[c+1],r[c][l]);u.push(f)}return{stdout:w(h,u),stderr:"",exitCode:0}}async function ye(e,n){let t=null,s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="--seed"&&l+1<e.length?t=Number.parseInt(e[++l],10):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t!==null?t:Date.now(),u=()=>(h=h*1103515245+12345&2147483647,h/2147483647),p=[...o];for(let l=p.length-1;l>0;l--){let f=Math.floor(u()*(l+1));[p[l],p[f]]=[p[f],p[l]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function xe(e,n){let t=null,s="",r=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-l"||d==="--length")&&a+1<e.length?t=Number.parseInt(e[++a],10):(d==="-d"||d==="--default")&&a+1<e.length?s=e[++a]:d.startsWith("-")||r.push(d)}let o=r[0],i;if(!o||o==="-")i=n.stdin;else try{let a=n.fs.resolvePath(n.cwd,o);i=await n.fs.readFile(a)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
15
- `,exitCode:1}}let u=me.default.parse(i.trim(),{header:!1,skipEmptyLines:!0}).data;if(u.length===0)return{stdout:"",stderr:"",exitCode:0};let p=Math.max(...u.map(a=>a.length)),l=t??p,f=u.map(a=>a.length===l?a:a.length<l?[...a,...Array(l-a.length).fill(s)]:a.slice(0,l));return{stdout:`${me.default.unparse(f).replace(/\r\n/g,`
16
- `)}
17
- `,stderr:"",exitCode:0}}async function we(e,n){let t=null,s=null,r=".",o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-c"||a==="--chunks")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-S"||a==="--size")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-o"||a==="--output")&&c+1<e.length?r=e[++c]:a.startsWith("-")||o.push(a)}if(!t&&!s)return{stdout:"",stderr:`xan split: must specify -c or -S
18
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=[];if(t){let c=Math.ceil(h.length/t);for(let a=0;a<t;a++)p.push(h.slice(a*c,(a+1)*c))}else if(s)for(let c=0;c<h.length;c+=s)p.push(h.slice(c,c+s));let l=p.filter(c=>c.length>0),f=o[0]?.replace(/\.csv$/,"")||"part";try{let c=n.fs.resolvePath(n.cwd,r);for(let a=0;a<l.length;a++){let d=`${f}_${String(a+1).padStart(3,"0")}.csv`,m=n.fs.resolvePath(c,d);await n.fs.writeFile(m,w(i,l[a]))}return{stdout:`Split into ${l.length} parts
19
- `,stderr:"",exitCode:0}}catch{return{stdout:`${l.map((a,d)=>`Part ${d+1}: ${a.length} rows`).join(`
20
- `)}
21
- `,stderr:"",exitCode:0}}}async function ve(e,n){let t="",s=".",r=[];for(let p=0;p<e.length;p++){let l=e[p];(l==="-o"||l==="--output")&&p+1<e.length?s=e[++p]:l.startsWith("-")||(t?r.push(l):t=l)}if(!t)return{stdout:"",stderr:`xan partition: usage: xan partition COLUMN [FILE]
22
- `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;if(!o.includes(t))return{stdout:"",stderr:`xan partition: column '${t}' not found
23
- `,exitCode:1};let u=new Map;for(let p of i){let l=String(p[t]??"");u.has(l)||u.set(l,[]),u.get(l)?.push(p)}try{let p=n.fs.resolvePath(n.cwd,s);for(let[l,f]of u){let a=`${l.replace(/[^a-zA-Z0-9_-]/g,"_")||"empty"}.csv`,d=n.fs.resolvePath(p,a);await n.fs.writeFile(d,w(o,f))}return{stdout:`Partitioned into ${u.size} files by '${t}'
24
- `,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([l,f])=>`${l}: ${f.length} rows`).join(`
25
- `)}
26
- `,stderr:"",exitCode:0}}}async function Ce(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to <format> [FILE]
27
- `,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?rt(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}'
28
- `,exitCode:1}}async function rt(e,n){let t=e.filter(i=>!i.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)}
29
- `,stderr:"",exitCode:0}}async function be(e,n){let t="",s=[];for(let r=0;r<e.length;r++){let o=e[r];(o==="-f"||o==="--format")&&r+1<e.length?t=e[++r]:o.startsWith("-")||s.push(o)}return t?t==="json"?ot(s,n):{stdout:"",stderr:`xan from: unsupported format '${t}'
30
- `,exitCode:1}:{stdout:"",stderr:`xan from: usage: xan from -f <format> [FILE]
31
- `,exitCode:1}}async function ot(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory
32
- `,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array
33
- `,exitCode:1};if(r.length===0)return{stdout:`
34
- `,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=O();for(let f=0;f<i.length;f++)b(l,i[f],p[f]);return l});return{stdout:w(i,u),stderr:"",exitCode:0}}let o=Object.keys(r[0]).sort();return{stdout:w(o,r),stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`xan from: invalid JSON input
35
- `,exitCode:1}}}async function Se(e,n){let t=!1,s=0,r="",o=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="-v"||a==="--invert")t=!0;else if((a==="-l"||a==="--limit")&&c+1<e.length)s=Number.parseInt(e[++c],10);else{if(a==="--help")return D({name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output to N rows"," --help display help"]});a.startsWith("-")||(r?o.push(a):r=a)}}if(!r)return{stdout:"",stderr:`xan filter: no expression specified
36
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=Xe(r),f=[];for(let c of h){if(s>0&&f.length>=s)break;let a=$(c,l,p),d=a.length>0&&a.some(m=>!!m);(t?!d:d)&&f.push(c)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=!1,r=!1,o=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-N"||f==="--numeric"?s=!0:f==="-R"||f==="-r"||f==="--reverse"?r=!0:f==="-s"&&l+1<e.length?t=e[++l]:f.startsWith("-")||o.push(f)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!t&&i.length>0&&(t=i[0]);let p=[...h].sort((l,f)=>{let c=l[t],a=f[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof a=="number"?a:Number.parseFloat(String(a));d=m-g}else d=String(c).localeCompare(String(a));return r?-d:d});return{stdout:w(i,p),stderr:"",exitCode:0}}async function ke(e,n){let t="",s=[];for(let p=0;p<e.length;p++){let l=e[p];l==="-s"&&p+1<e.length?t=e[++p]:l.startsWith("-")||s.push(l)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set,u=o.filter(p=>{let l=t?String(p[t]):JSON.stringify(p);return h.has(l)?!1:(h.add(l),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ne(e,n){let t=10,s="",r=!1,o=[];for(let f=0;f<e.length;f++){let c=e[f];(c==="-l"||c==="-n")&&f+1<e.length?t=Number.parseInt(e[++f],10):c==="-R"||c==="-r"||c==="--reverse"?r=!0:c.startsWith("-")||(s?o.push(c):s=c)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!s&&i.length>0&&(s=i[0]);let l=[...h].sort((f,c)=>{let a=f[s],d=c[s],m=typeof a=="number"?a:Number.parseFloat(String(a)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:w(i,l),stderr:"",exitCode:0}}U();async function Ee(e,n){let t="",s=!1,r=!1,o=[];for(let d=0;d<e.length;d++){let m=e[d];m==="-O"||m==="--overwrite"?s=!0:m==="--filter"?r=!0:m.startsWith("-")||(t?o.push(m):t=m)}if(!t)return{stdout:"",stderr:`xan map: no expression specified
37
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let l=V(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:F(d)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...i];for(let d of l)i.includes(d.alias)||c.push(d.alias)}else c=[...i,...l.map(d=>d.alias)];let a=[];for(let d=0;d<h.length;d++){let m=h[d],g=M(m),y=!1,x=Object.assign(X(m),{_row_index:d});for(let I of l){let N=$(x,I.ast,f),C=N.length>0?N[0]:null;if(r&&C==null){y=!0;break}b(g,I.alias,C)}y||a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function Ae(e,n){let t="",s="",r="",o=[];for(let m=0;m<e.length;m++){let g=e[m];(g==="-r"||g==="--rename")&&m+1<e.length?r=e[++m]:g.startsWith("-")||(t?s?o.push(g):s=g:t=g)}if(!t||!s)return{stdout:"",stderr:`xan transform: usage: xan transform COLUMN EXPR [FILE]
38
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t.split(",").map(m=>m.trim()),l=r?r.split(",").map(m=>m.trim()):[];for(let m of p)if(!i.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found
39
- `,exitCode:1};let f=F(V(s)[0]?.expr||(U(),et(Je)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},a=i.map(m=>{let g=p.indexOf(m);return g!==-1&&l[g]?l[g]:m}),d=[];for(let m of h){let g=M(m);for(let y=0;y<p.length;y++){let x=p[y],I=Object.assign(X(m),{_:m[x]}),N=$(I,f,c),C=N.length>0?N[0]:null,A=l[y]||x;A!==x&&delete g[x],b(g,A,C)}d.push(g)}return{stdout:w(a,d),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r=!1,o="",i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--separator")&&a+1<e.length?s=e[++a]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&a+1<e.length?o=e[++a]:d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
40
- `,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;if(!h.includes(t))return{stdout:"",stderr:`xan explode: column '${t}' not found
41
- `,exitCode:1};let l=o?h.map(a=>a===t?o:a):h,f=o||t,c=[];for(let a of u){let d=a[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(a);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(a);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="|",r="",o=[];for(let g=0;g<e.length;g++){let y=e[g];(y==="-s"||y==="--sep")&&g+1<e.length?s=e[++g]:(y==="-r"||y==="--rename")&&g+1<e.length?r=e[++g]:y.startsWith("-")||(t?o.push(y):t=y)}if(!t)return{stdout:"",stderr:`xan implode: usage: xan implode COLUMN [FILE]
42
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan implode: column '${t}' not found
43
- `,exitCode:1};let p=i.filter(g=>g!==t),l=r?i.map(g=>g===t?r:g):i,f=r||t,c=[],a=null,d=[],m=null;for(let g of h){let y=p.map(N=>String(g[N]??"")).join("\0"),x=g[t],I=x==null?"":String(x);if(y!==a){if(m!==null){let N=M(m);r&&delete N[t],b(N,f,d.join(s)),c.push(N)}a=y,d=[I],m=g}else d.push(I)}if(m!==null){let g=M(m);r&&delete g[t],b(g,f,d.join(s)),c.push(g)}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Le(e,n){let t="",s="",r="",o="",i="inner",h="",u=0;for(let C=0;C<e.length;C++){let A=e[C];A==="--left"?i="left":A==="--right"?i="right":A==="--full"?i="full":(A==="-D"||A==="--default")&&C+1<e.length?h=e[++C]:A.startsWith("-")||(u++,u===1?t=A:u===2?s=A:u===3?r=A:u===4&&(o=A))}if(!t||!s||!r||!o)return{stdout:"",stderr:`xan join: usage: xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]
44
- `,exitCode:1};let p=await v([s],n);if(p.error)return p.error;let l=await v([o],n);if(l.error)return l.error;let{headers:f,data:c}=p,{headers:a,data:d}=l;if(!f.includes(t))return{stdout:"",stderr:`xan join: column '${t}' not found in first file
45
- `,exitCode:1};if(!a.includes(r))return{stdout:"",stderr:`xan join: column '${r}' not found in second file
46
- `,exitCode:1};let m=new Map;for(let C of d){let A=String(C[r]??"");m.has(A)||m.set(A,[]),m.get(A)?.push(C)}let g=new Set(f),y=a.filter(C=>!g.has(C)),x=[...f,...y],I=[],N=new Set;for(let C of c){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=O();for(let W of f)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);I.push(T)}}else if(i==="left"||i==="full"){let L=O();for(let T of f)b(L,T,C[T]);for(let T of y)b(L,T,h);I.push(L)}}if(i==="right"||i==="full")for(let C of d){let A=String(C[r]??"");if(!N.has(A)){let j=O();for(let L of f)b(j,L,a.includes(L)?C[L]:h);for(let L of y)b(j,L,C[L]);I.push(j)}}return{stdout:w(x,I),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r=[],o=[];for(let y=0;y<e.length;y++){let x=e[y];(x==="-g"||x==="--groupby")&&y+1<e.length?r=e[++y].split(",").map(I=>I.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]
47
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found
48
- `,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}'
49
- `,exitCode:1};let[,l,f]=p;r.length===0&&(r=i.filter(y=>y!==t&&y!==f));let c=[];for(let y of h){let x=String(y[t]??"");c.includes(x)||c.push(x)}let a=new Map,d=[];for(let y of h){let x=r.map(A=>String(y[A]??"")).join("\0"),I=String(y[t]??""),N=y[f];a.has(x)||(a.set(x,new Map),d.push(x));let C=a.get(x);C&&(C.has(I)||C.set(I,[]),C.get(I)?.push(N))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),I=a.get(y);if(!I)continue;let N=O();for(let C=0;C<r.length;C++)b(N,r[C],x[C]);for(let C of c){let A=I.get(C)||[];b(N,C,it(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function it(e,n){let t=n.filter(s=>s!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Re(e,n){let t="",s=[];for(let h=0;h<e.length;h++){let u=e[h];(u==="-s"||u==="--sort")&&h+1<e.length?t=e[++h]:u.startsWith("-")||s.push(u)}if(s.length<2)return{stdout:"",stderr:`xan merge: usage: xan merge [OPTIONS] FILE1 FILE2 ...
50
- `,exitCode:1};let r=[],o=null;for(let h of s){let u=await v([h],n);if(u.error)return u.error;if(o===null)o=u.headers;else if(JSON.stringify(o)!==JSON.stringify(u.headers))return{stdout:"",stderr:`xan merge: all files must have the same headers
51
- `,exitCode:1};r.push({headers:u.headers,data:u.data})}if(!o)return{stdout:"",stderr:"",exitCode:0};let i=[];for(let{data:h}of r)i=i.concat(h);if(t){if(!o.includes(t))return{stdout:"",stderr:`xan merge: column '${t}' not found
52
- `,exitCode:1};i.sort((h,u)=>{let p=h[t],l=u[t],f=typeof p=="number"?p:Number.parseFloat(String(p)),c=typeof l=="number"?l:Number.parseFloat(String(l));return!Number.isNaN(f)&&!Number.isNaN(c)?f-c:String(p??"").localeCompare(String(l??""))})}return{stdout:w(o,i),stderr:"",exitCode:0}}U();async function Me(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>at(p)).join(",")).join(`
53
- `)+`
54
- `,stderr:"",exitCode:0})}function at(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(`
55
- `)?`"${n.replace(/"/g,'""')}"`:n}async function $e(e,n){let t=null,s=null,r=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="--seed"&&c+1<e.length)s=Number.parseInt(e[++c],10);else if(!a.startsWith("-")){let d=Number.parseInt(a,10);t===null&&!Number.isNaN(d)&&d>0?t=d:r.push(a)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample <sample-size> [FILE]
56
- `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;if(i.length<=t)return{stdout:w(o,i),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),l=i.map((c,a)=>a);for(let c=l.length-1;c>0;c--){let a=Math.floor(p()*(c+1));[l[c],l[a]]=[l[a],l[c]]}let f=l.slice(0,t).sort((c,a)=>c-a).map(c=>i[c]);return{stdout:w(o,f),stderr:"",exitCode:0}}async function Te(e,n){let t=!1,s=[];for(let u=0;u<e.length;u++){let p=e[u];p==="-p"||p==="--pad"?t=!0:p.startsWith("-")||s.push(p)}if(s.length===0)return{stdout:"",stderr:`xan cat: no files specified
57
- `,exitCode:1};let r=await We(n,s,{cmdName:"xan cat",stopOnError:!0});if(r.exitCode!==0)return{stdout:"",stderr:r.stderr,exitCode:r.exitCode};let o=[],i=[];for(let{content:u}of r.files){let{headers:p,data:l}=_e(u);o.push({headers:p,data:l});for(let f of p)i.includes(f)||i.push(f)}if(!t){let u=JSON.stringify(o[0].headers);for(let p=1;p<o.length;p++)if(JSON.stringify(o[p].headers)!==u)return{stdout:"",stderr:`xan cat: headers do not match (use -p to pad)
58
- `,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=O();for(let c of i)b(f,c,u.includes(c)?l[c]:"");h.push(f)}return{stdout:w(i,h),stderr:"",exitCode:0}}async function je(e,n){let t="",s=[],r=!1,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?s=e[++a].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
59
- `,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=s.length>0?s:h,f;try{f=H(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}'
60
- `,exitCode:1}}let c=u.filter(a=>{let d=l.some(m=>{let g=a[m];return g!=null&&f.test(String(g))});return r?!d:d});return{stdout:w(h,c),stderr:"",exitCode:0}}async function De(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified
61
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let u=V(t).map(({expr:c,name:a})=>({alias:typeof a=="string"?a:a[0],ast:F(c)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=[...r,...u.map(c=>c.alias)],f=[];for(let c of o){let a=[],d=1;for(let m of u){let g=$(c,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;a.push(y),d=Math.max(d,y.length)}for(let m=0;m<d;m++){let g=M(c);for(let y=0;y<u.length;y++){let x=a[y][m]??null;b(g,u[y].alias,x)}f.push(g)}}return{stdout:w(l,f),stderr:"",exitCode:0}}async function Ve(e,n){let{cmdView:t}=await import("./xan-view-ECQUO7AJ.js");return t(e,n)}var Be=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),lt=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",...Be]),Ye={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.
62
- It provides a simple, ergonomic interface for common data operations.
63
-
64
- COMMANDS:
65
- Core:
66
- headers Show column names
67
- count Count rows
68
- head Show first N rows
69
- tail Show last N rows
70
- slice Extract row range
71
- reverse Reverse row order
72
- behead Remove header row
73
- sample Random sample of rows
74
-
75
- Column operations:
76
- select Select columns (supports glob, ranges, negation)
77
- drop Drop columns
78
- rename Rename columns
79
- enum Add row index column
80
-
81
- Row operations:
82
- filter Filter rows by expression
83
- search Filter rows by regex match
84
- sort Sort rows
85
- dedup Remove duplicates
86
- top Get top N by column
87
-
88
- Transformations:
89
- map Add computed columns
90
- transform Modify existing columns
91
- explode Split column into multiple rows
92
- implode Combine rows, join column values
93
- flatmap Map returning multiple rows
94
- pivot Reshape rows into columns
95
- transpose Swap rows and columns
96
-
97
- Aggregation:
98
- agg Aggregate values
99
- groupby Group and aggregate
100
- frequency Count value occurrences
101
- stats Show column statistics
102
-
103
- Multi-file:
104
- cat Concatenate CSV files
105
- join Join two CSV files on key
106
- merge Merge sorted CSV files
107
- split Split into multiple files
108
- partition Split by column value
109
-
110
- Data conversion:
111
- to Convert CSV to other formats (json)
112
- from Convert other formats to CSV (json)
113
- shuffle Randomly reorder rows
114
- fixlengths Fix ragged CSV files
115
-
116
- Output:
117
- view Pretty print as table
118
- flatten Display records vertically (alias: f)
119
- fmt Format output
120
-
121
- EXAMPLES:
122
- xan headers data.csv
123
- xan count data.csv
124
- xan head -n 5 data.csv
125
- xan select name,email data.csv
126
- xan select 'vec_*' data.csv # glob pattern
127
- xan select 'a:c' data.csv # column range
128
- xan filter 'age > 30' data.csv
129
- xan search -r '^foo' data.csv
130
- xan sort -N price data.csv
131
- xan agg 'sum(amount) as total' data.csv
132
- xan groupby region 'count() as n' data.csv
133
- xan explode tags data.csv
134
- xan join id file1.csv id file2.csv
135
- xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},ut={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},fn={name:"xan",async execute(e,n){if(e.length===0||G(e))return D(Ye);let t=e[0],s=e.slice(1);if(G(s)){let r=ut[t];return r?D(r):D(Ye)}if(Be.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
136
- `,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return Ie(s,n);case"dedup":return ke(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return Oe(s,n);case"implode":return Fe(s,n);case"flatmap":return De(s,n);case"pivot":return Pe(s,n);case"agg":return te(s,n);case"groupby":return ne(s,n);case"frequency":case"freq":return se(s,n);case"stats":return re(s,n);case"cat":return Te(s,n);case"join":return Le(s,n);case"merge":return Re(s,n);case"split":return we(s,n);case"partition":return ve(s,n);case"to":return Ce(s,n);case"from":return be(s,n);case"transpose":return ge(s,n);case"shuffle":return ye(s,n);case"fixlengths":return xe(s,n);case"view":return B(s,n);case"flatten":case"f":return Y(s,n);case"fmt":return Ve(s,n);default:return lt.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
137
- `,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
138
- Run 'xan --help' for usage.
139
- `,exitCode:1}}}},dn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{fn as a,dn as b};
@@ -1,10 +0,0 @@
1
- import{a as d,b as f,c as u}from"./chunk-74CEPOFO.js";var h={name:"expand",summary:"convert tabs to spaces",usage:"expand [OPTION]... [FILE]...",description:"Convert TABs in each FILE to spaces, writing to standard output. If no FILE is specified, standard input is read.",options:["-t N Use N spaces per tab (default: 8)","-t LIST Use comma-separated list of tab stops","-i Only convert leading tabs on each line"],examples:["expand file.txt # Convert all tabs to 8 spaces","expand -t 4 file.txt # Use 4-space tabs","expand -t 4,8,12 file.txt # Custom tab stops"]};function p(n){let i=n.split(",").map(o=>o.trim()),t=[];for(let o of i){let e=parseInt(o,10);if(Number.isNaN(e)||e<1)return null;t.push(e)}for(let o=1;o<t.length;o++)if(t[o]<=t[o-1])return null;return t}function x(n,i){if(i.length===1){let t=i[0];return t-n%t}for(let t of i)if(t>n)return t-n;if(i.length>=2){let t=i[i.length-1]-i[i.length-2],o=i[i.length-1],e=Math.floor((n-o)/t)+1;return o+e*t-n}return 1}function g(n,i){let{tabStops:t,leadingOnly:o}=i,e="",l=0,s=!0;for(let a of n)if(a===" ")if(o&&!s)e+=a,l++;else{let r=x(l,t);e+=" ".repeat(r),l+=r}else a!==" "&&a!==" "&&(s=!1),e+=a,l++;return e}function c(n,i){if(n==="")return"";let t=n.split(`
2
- `),o=n.endsWith(`
3
- `)&&t[t.length-1]==="";return o&&t.pop(),t.map(l=>g(l,i)).join(`
4
- `)+(o?`
5
- `:"")}var m={name:"expand",execute:async(n,i)=>{if(f(n))return d(h);let t={tabStops:[8],leadingOnly:!1},o=[],e=0;for(;e<n.length;){let s=n[e];if(s==="-t"&&e+1<n.length){let a=p(n[e+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${n[e+1]}'
6
- `};t.tabStops=a,e+=2}else if(s.startsWith("-t")&&s.length>2){let a=p(s.slice(2));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${s.slice(2)}'
7
- `};t.tabStops=a,e++}else if(s==="--tabs"&&e+1<n.length){let a=p(n[e+1]);if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${n[e+1]}'
8
- `};t.tabStops=a,e+=2}else if(s.startsWith("--tabs=")){let a=p(s.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${s.slice(7)}'
9
- `};t.tabStops=a,e++}else if(s==="-i"||s==="--initial")t.leadingOnly=!0,e++;else if(s==="--"){o.push(...n.slice(e+1));break}else{if(s.startsWith("-")&&s!=="-")return u("expand",s);o.push(s),e++}}let l="";if(o.length===0){let s=i.stdin??"";l=c(s,t)}else for(let s of o){let a=i.fs.resolvePath(i.cwd,s),r=await i.fs.readFile(a);if(r===null)return{exitCode:1,stdout:l,stderr:`expand: ${s}: No such file or directory
10
- `};l+=c(r,t)}return{exitCode:0,stdout:l,stderr:""}}},v={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{m as a,v as b};
@@ -1,16 +0,0 @@
1
- import{a as N}from"./chunk-YNYSPYQ5.js";function B(n,t){return n.replace(/\$(&|\d+|<([^>]+)>)/g,(e,i,s)=>{if(i==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let h=parseInt(i,10);return t[h]??""})}function D(n,t,e={}){let{invertMatch:i=!1,showLineNumbers:s=!1,countOnly:h=!1,countMatches:d=!1,filename:a="",onlyMatching:m=!1,beforeContext:I=0,afterContext:R=0,maxCount:S=0,contextSeparator:F="--",showColumn:O=!1,vimgrep:G=!1,showByteOffset:P=!1,replace:k=null,passthru:y=!1,multiline:j=!1,kResetGroup:A}=e;if(j)return Q(n,t,{invertMatch:i,showLineNumbers:s,countOnly:h,countMatches:d,filename:a,onlyMatching:m,beforeContext:I,afterContext:R,maxCount:S,contextSeparator:F,showColumn:O,showByteOffset:P,replace:k,kResetGroup:A});let x=n.split(`
2
- `),Z=x.length,v=Z>0&&x[Z-1]===""?Z-1:Z;if(h||d){let f=0,r=(d||m)&&!i;for(let l=0;l<v;l++)if(t.lastIndex=0,r)for(let u=t.exec(x[l]);u!==null;u=t.exec(x[l]))f++,u[0].length===0&&t.lastIndex++;else t.test(x[l])!==i&&f++;return{output:`${a?`${a}:${f}`:String(f)}
3
- `,matched:f>0,matchCount:f}}if(I===0&&R===0&&!y){let f=[],r=!1,o=0,l=0;for(let u=0;u<v&&!(S>0&&o>=S);u++){let L=x[u];if(t.lastIndex=0,t.test(L)!==i)if(r=!0,o++,m){t.lastIndex=0;for(let $=t.exec(L);$!==null;$=t.exec(L)){let b=A!==void 0?$[A]??"":$[0],T=k!==null?B(k,$):b,z=a?`${a}:`:"";P&&(z+=`${l+$.index}:`),s&&(z+=`${u+1}:`),O&&(z+=`${$.index+1}:`),f.push(z+T),$[0].length===0&&t.lastIndex++}}else if(G){t.lastIndex=0;for(let $=t.exec(L);$!==null;$=t.exec(L)){let b=a?`${a}:`:"";P&&(b+=`${l+$.index}:`),s&&(b+=`${u+1}:`),O&&(b+=`${$.index+1}:`),f.push(b+L),$[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let $=t.exec(L),b=$?$.index+1:1,T=L;k!==null&&(t.lastIndex=0,T=t.replace(L,(...M)=>{if(M[0].length===0)return"";let U=M,_=M[M.length-1];return typeof _=="object"&&_!==null?(U.groups=_,U.input=M[M.length-2],U.index=M[M.length-3]):(U.input=M[M.length-1],U.index=M[M.length-2]),B(k,U)}));let z=a?`${a}:`:"";P&&(z+=`${l+($?$.index:0)}:`),s&&(z+=`${u+1}:`),O&&(z+=`${b}:`),f.push(z+T)}l+=L.length+1}return{output:f.length>0?`${f.join(`
4
- `)}
5
- `:"",matched:r,matchCount:o}}if(y){let f=[],r=!1,o=0;for(let l=0;l<v;l++){let u=x[l];t.lastIndex=0;let E=t.test(u)!==i;E&&(r=!0,o++);let $=E?":":"-",b=a?`${a}${$}`:"";s&&(b+=`${l+1}${$}`),f.push(b+u)}return{output:f.length>0?`${f.join(`
6
- `)}
7
- `:"",matched:r,matchCount:o}}let g=[],w=0,p=new Set,C=-1,c=[];for(let f=0;f<v&&!(S>0&&w>=S);f++)t.lastIndex=0,t.test(x[f])!==i&&(c.push(f),w++);for(let f of c){let r=Math.max(0,f-I);C>=0&&r>C+1&&g.push(F);for(let l=r;l<f;l++)if(!p.has(l)){p.add(l),C=l;let u=x[l];s&&(u=`${l+1}-${u}`),a&&(u=`${a}-${u}`),g.push(u)}if(!p.has(f)){p.add(f),C=f;let l=x[f];if(m){t.lastIndex=0;for(let u=t.exec(l);u!==null;u=t.exec(l)){let L=A!==void 0?u[A]??"":u[0],E=k!==null?k:L,$=a?`${a}:`:"";s&&($+=`${f+1}:`),O&&($+=`${u.index+1}:`),g.push($+E),u[0].length===0&&t.lastIndex++}}else{let u=l;s&&(u=`${f+1}:${u}`),a&&(u=`${a}:${u}`),g.push(u)}}let o=Math.min(v-1,f+R);for(let l=f+1;l<=o;l++)if(!p.has(l)){p.add(l),C=l;let u=x[l];s&&(u=`${l+1}-${u}`),a&&(u=`${a}-${u}`),g.push(u)}}return{output:g.length>0?`${g.join(`
8
- `)}
9
- `:"",matched:w>0,matchCount:w}}function Q(n,t,e){let{invertMatch:i,showLineNumbers:s,countOnly:h,countMatches:d,filename:a,onlyMatching:m,beforeContext:I,afterContext:R,maxCount:S,contextSeparator:F,showColumn:O,showByteOffset:G,replace:P,kResetGroup:k}=e,y=n.split(`
10
- `),j=y.length,A=j>0&&y[j-1]===""?j-1:j,x=[0];for(let c=0;c<n.length;c++)n[c]===`
11
- `&&x.push(c+1);let Z=c=>{let f=0;for(let r=0;r<x.length&&!(x[r]>c);r++)f=r;return f},v=c=>{let f=Z(c);return c-x[f]+1},g=[];t.lastIndex=0;for(let c=t.exec(n);c!==null&&!(S>0&&g.length>=S);c=t.exec(n)){let f=Z(c.index),r=Z(c.index+Math.max(0,c[0].length-1)),o=k!==void 0?c[k]??"":c[0];g.push({startLine:f,endLine:r,byteOffset:c.index,column:v(c.index),matchText:o}),c[0].length===0&&t.lastIndex++}if(h||d){let c;if(d)c=i?0:g.length;else{let r=new Set;for(let o of g)for(let l=o.startLine;l<=o.endLine;l++)r.add(l);c=i?A-r.size:r.size}return{output:`${a?`${a}:${c}`:String(c)}
12
- `,matched:c>0,matchCount:c}}if(i){let c=new Set;for(let r of g)for(let o=r.startLine;o<=r.endLine;o++)c.add(o);let f=[];for(let r=0;r<A;r++)if(!c.has(r)){let o=y[r];s&&(o=`${r+1}:${o}`),a&&(o=`${a}:${o}`),f.push(o)}return{output:f.length>0?`${f.join(`
13
- `)}
14
- `:"",matched:f.length>0,matchCount:f.length}}if(g.length===0)return{output:"",matched:!1,matchCount:0};let w=new Set,p=-1,C=[];for(let c of g){let f=Math.max(0,c.startLine-I),r=Math.min(A-1,c.endLine+R);p>=0&&f>p+1&&C.push(F);for(let o=f;o<c.startLine;o++)if(!w.has(o)){w.add(o),p=o;let l=y[o];s&&(l=`${o+1}-${l}`),a&&(l=`${a}-${l}`),C.push(l)}if(m){let o=P!==null?P:c.matchText,l=a?`${a}:`:"";G&&(l+=`${c.byteOffset}:`),s&&(l+=`${c.startLine+1}:`),O&&(l+=`${c.column}:`),C.push(l+o);for(let u=c.startLine;u<=c.endLine;u++)w.add(u),p=u}else for(let o=c.startLine;o<=c.endLine&&o<A;o++)if(!w.has(o)){w.add(o),p=o;let l=y[o];P!==null&&o===c.startLine&&(t.lastIndex=0,l=t.replace(l,P));let u=a?`${a}:`:"";G&&o===c.startLine&&(u+=`${c.byteOffset}:`),s&&(u+=`${o+1}:`),O&&o===c.startLine&&(u+=`${c.column}:`),C.push(u+l)}for(let o=c.endLine+1;o<=r;o++)if(!w.has(o)){w.add(o),p=o;let l=y[o];s&&(l=`${o+1}-${l}`),a&&(l=`${a}-${l}`),C.push(l)}}return{output:C.length>0?`${C.join(`
15
- `)}
16
- `:"",matched:!0,matchCount:g.length}}var q=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]]);function K(n){let t="",e=0;for(;e<n.length;){if(n.slice(e,e+7)==="[[:<:]]"){t+="\\b",e+=7;continue}if(n.slice(e,e+7)==="[[:>:]]"){t+="\\b",e+=7;continue}if(n[e]==="["){let i="[";for(e++,e<n.length&&(n[e]==="^"||n[e]==="!")&&(i+="^",e++),e<n.length&&n[e]==="]"&&(i+="\\]",e++);e<n.length&&n[e]!=="]";){if(n[e]==="["&&e+1<n.length&&n[e+1]===":"){let s=n.indexOf(":]",e+2);if(s!==-1){let h=n.slice(e+2,s),d=q.get(h);if(d){i+=d,e=s+2;continue}}}if(n[e]==="\\"&&e+1<n.length){i+=n[e]+n[e+1],e+=2;continue}i+=n[e],e++}e<n.length&&n[e]==="]"&&(i+="]",e++),t+=i;continue}if(n[e]==="\\"&&e+1<n.length){t+=n[e]+n[e+1],e+=2;continue}t+=n[e],e++}return t}function W(n,t){let e,i;switch(t.mode){case"fixed":e=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(e=K(n),e=e.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){e=X(e),e=H(e),e=J(e);let d=ne(e);e=d.pattern,i=d.kResetGroup}break}default:e=K(n),e=se(e);break}t.wholeWord&&(e=`\\b(?:${e})\\b`),t.lineRegexp&&(e=`^${e}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(e),h="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":"");return{regex:N(e,h),kResetGroup:i}}function X(n){let t="",e=0;for(;e<n.length;)if(n[e]==="\\"&&e+1<n.length&&n[e+1]==="Q"){e+=2;let i="";for(;e<n.length;){if(n[e]==="\\"&&e+1<n.length&&n[e+1]==="E"){e+=2;break}i+=n[e],e++}t+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else t+=n[e],e++;return t}function H(n){return n.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function J(n){let t="",e=0;for(;e<n.length;){if(n[e]==="("&&e+1<n.length&&n[e+1]==="?"){let i=n.slice(e).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(i){let s=i[1]||"",h=i[2]||"",d=i[3];if(d===":"){let a=e+i[0].length-1,m=V(n,e);if(m!==-1){let I=n.slice(a+1,m),R=Y(I,s,h);t+=`(?:${R})`,e=m+1;continue}}else if(d===")"||d===""){e+=i[0].length;continue}}}t+=n[e],e++}return t}function V(n,t){let e=0,i=t;for(;i<n.length;){if(n[i]==="\\"){i+=2;continue}if(n[i]==="["){for(i++;i<n.length&&n[i]!=="]";)n[i]==="\\"&&i++,i++;i++;continue}if(n[i]==="(")e++;else if(n[i]===")"&&(e--,e===0))return i;i++}return-1}function Y(n,t,e){let i=n;return t.includes("i")&&(i=ee(i)),i}function ee(n){let t="",e=0;for(;e<n.length;){let i=n[e];if(i==="\\"){e+1<n.length?(t+=i+n[e+1],e+=2):(t+=i,e++);continue}if(i==="["){t+=i,e++,e<n.length&&n[e]==="^"&&(t+=n[e],e++);let s=[];for(;e<n.length&&n[e]!=="]";)if(n[e]==="\\")s.push(n[e]),e++,e<n.length&&(s.push(n[e]),e++);else if(n[e]==="-"&&s.length>0&&e+1<n.length&&n[e+1]!=="]"){let h=s[s.length-1],d=n[e+1];s.push("-"),s.push(d),/[a-z]/.test(h)&&/[a-z]/.test(d)?(s.push(h.toUpperCase()),s.push("-"),s.push(d.toUpperCase())):/[A-Z]/.test(h)&&/[A-Z]/.test(d)&&(s.push(h.toLowerCase()),s.push("-"),s.push(d.toLowerCase())),e+=2}else{let h=n[e];if(s.push(h),/[a-zA-Z]/.test(h)){let d=h===h.toLowerCase()?h.toUpperCase():h.toLowerCase();s.includes(d)||s.push(d)}e++}t+=s.join(""),e<n.length&&(t+=n[e],e++);continue}if(/[a-zA-Z]/.test(i)){let s=i.toLowerCase(),h=i.toUpperCase();t+=`[${h}${s}]`}else t+=i;e++}return t}function ne(n){let t=te(n);if(t===-1)return{pattern:n};let e=n.slice(0,t),i=n.slice(t+2),s=ie(e);return{pattern:`(?:${e})(${i})`,kResetGroup:s+1}}function te(n){let t=0;for(;t<n.length-1;)if(n[t]==="\\"){if(n[t+1]==="K"){let e=0,i=t-1;for(;i>=0&&n[i]==="\\";)e++,i--;if(e%2===0)return t}t+=2}else t++;return-1}function ie(n){let t=0,e=0;for(;e<n.length;){if(n[e]==="\\"){e+=2;continue}if(n[e]==="["){for(e++;e<n.length&&n[e]!=="]";)n[e]==="\\"&&e++,e++;e++;continue}if(n[e]==="(")if(e+1<n.length&&n[e+1]==="?"){if(e+2<n.length){let i=n[e+2];if(i===":"||i==="="||i==="!"){e++;continue}if(i==="<"&&e+3<n.length){let s=n[e+3];if(s==="="||s==="!"){e++;continue}t++,e++;continue}}}else t++;e++}return t}function le(n){let t=n.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function se(n){let t="",e=0,i=!0,s=0;for(;e<n.length;){let h=n[e];if(h==="["){for(t+=h,e++,e<n.length&&(n[e]==="^"||n[e]==="!")&&(t+=n[e],e++),e<n.length&&n[e]==="]"&&(t+=n[e],e++);e<n.length&&n[e]!=="]";)n[e]==="\\"&&e+1<n.length?(t+=n[e]+n[e+1],e+=2):(t+=n[e],e++);e<n.length&&n[e]==="]"&&(t+=n[e],e++),i=!1;continue}if(h==="\\"&&e+1<n.length){let d=n[e+1];if(d==="|"){t+="|",e+=2,i=!0;continue}if(d==="("){t+="(",e+=2,s++,i=!0;continue}if(d===")"){t+=")",e+=2,s=Math.max(0,s-1),i=!1;continue}if(d==="{"){let m=n.slice(e).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(m){let I=m[1],R=m[2]!==void 0,S=m[3]||"";R?t+=`{${I},${S}}`:t+=`{${I}}`,e+=m[0].length,i=!1;continue}t+="\\{",e+=2,i=!1;continue}if(d==="}"){t+="\\}",e+=2,i=!1;continue}t+=h+d,e+=2,i=!1;continue}if(h==="*"&&i){t+="\\*",e++;continue}if(h==="^"){if(i){t+="^",e++;continue}t+="\\^",e++;continue}if(h==="$"){let d=e===n.length-1,a=e+2<n.length&&n[e+1]==="\\"&&n[e+2]===")";d||a?t+="$":t+="\\$",e++,i=!1;continue}h==="+"||h==="?"||h==="|"||h==="("||h===")"||h==="{"||h==="}"?t+=`\\${h}`:t+=h,e++,i=!1}return t}export{D as a,W as b,le as c};
@@ -1,13 +0,0 @@
1
- import{a as f,b as c,c as u}from"./chunk-74CEPOFO.js";var m={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};function p(n){return n>=32&&n<=126||n===9}function d(n,s){if(s===null)return"";switch(s){case"o":return`${n.toString(8).padStart(7," ")} `;case"x":return`${n.toString(16).padStart(7," ")} `;case"d":return`${n.toString(10).padStart(7," ")} `;default:return s}}function g(n,s){let o=[],r="",i=0,l=typeof n=="string"?new TextEncoder().encode(n):n;for(let e=0;e<l.length;e++){let t=l[e];if(p(t))r.length===0&&(i=e),r+=String.fromCharCode(t);else{if(r.length>=s.minLength){let a=d(i,s.offsetFormat);o.push(`${a}${r}`)}r=""}}if(r.length>=s.minLength){let e=d(i,s.offsetFormat);o.push(`${e}${r}`)}return o}var b={name:"strings",execute:async(n,s)=>{if(c(n))return f(m);let o={minLength:4,offsetFormat:null},r=[],i=0;for(;i<n.length;){let e=n[i];if(e==="-n"&&i+1<n.length){let t=Number.parseInt(n[i+1],10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${n[i+1]}'
2
- `};o.minLength=t,i+=2}else if(e.match(/^-n\d+$/)){let t=Number.parseInt(e.slice(2),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(2)}'
3
- `};o.minLength=t,i++}else if(e.match(/^-\d+$/)){let t=Number.parseInt(e.slice(1),10);if(Number.isNaN(t)||t<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e.slice(1)}'
4
- `};o.minLength=t,i++}else if(e==="-t"&&i+1<n.length){let t=n[i+1];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
5
- `};o.offsetFormat=t,i+=2}else if(e.startsWith("-t")&&e.length===3){let t=e[2];if(t!=="o"&&t!=="x"&&t!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${t}'
6
- `};o.offsetFormat=t,i++}else if(e==="-a"||e==="--all"||e==="-")e==="-"&&r.push(e),i++;else if(e==="-e"&&i+1<n.length){let t=n[i+1];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
7
- `};i+=2}else if(e.startsWith("-e")&&e.length===3){let t=e[2];if(t!=="s"&&t!=="S")return{exitCode:1,stdout:"",stderr:`strings: invalid encoding: '${t}'
8
- `};i++}else if(e==="--"){r.push(...n.slice(i+1));break}else{if(e.startsWith("-")&&e!=="-")return u("strings",e);r.push(e),i++}}let l="";if(r.length===0){let e=s.stdin??"",t=g(e,o);l=t.length>0?`${t.join(`
9
- `)}
10
- `:""}else for(let e of r){let t;if(e==="-")t=s.stdin??"";else{let h=s.fs.resolvePath(s.cwd,e);if(t=await s.fs.readFile(h),t===null)return{exitCode:1,stdout:l,stderr:`strings: ${e}: No such file or directory
11
- `}}let a=g(t,o);a.length>0&&(l+=`${a.join(`
12
- `)}
13
- `)}return{exitCode:0,stdout:l,stderr:""}}},N={name:"strings",flags:[{flag:"-n",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-a",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsFiles:!0};export{b as a,N as b};
@@ -1,4 +0,0 @@
1
- import{b as g}from"./chunk-7L36YK2X.js";import{a as d}from"./chunk-HWKDQ44K.js";import{a as p,b as f}from"./chunk-74CEPOFO.js";var O={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},N={name:"uniq",async execute(c,y){if(f(c))return p(O);let o=d("uniq",c,w);if(!o.ok)return o.error;let{count:m,duplicatesOnly:h,uniqueOnly:q,ignoreCase:b}=o.result.flags,C=o.result.positional,l=await g(y,C,{cmdName:"uniq"});if(!l.ok)return l.error;let n=l.content.split(`
2
- `);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,s)=>b?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;e<n.length;e++)x(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let u=t;h?u=t.filter(e=>e.count>1):q&&(u=t.filter(e=>e.count===1));let a="";for(let{line:e,count:s}of u)m?a+=`${String(s).padStart(4)} ${e}
3
- `:a+=`${e}
4
- `;return{stdout:a,stderr:"",exitCode:0,stdoutEncoding:"binary"}}},P={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{N as a,P as b};