just-bash 2.9.3 → 2.9.5

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 (750) hide show
  1. package/dist/AGENTS.md +31 -2
  2. package/dist/Bash.d.ts +7 -1
  3. package/dist/bin/chunks/alias-3GODYSFD.js +2 -0
  4. package/dist/bin/chunks/awk2-JBWRWZZH.js +2 -0
  5. package/dist/bin/chunks/base64-OHU2WTUF.js +2 -0
  6. package/dist/bin/chunks/basename-KBUKWB2E.js +2 -0
  7. package/dist/bin/chunks/bash-RJTQJAKW.js +2 -0
  8. package/dist/bin/chunks/cat-3J7U3HHI.js +2 -0
  9. package/dist/bin/chunks/chmod-4O2C4V42.js +2 -0
  10. package/dist/bin/chunks/chunk-26NO42TF.js +14 -0
  11. package/dist/bin/chunks/chunk-2SIXTZCJ.js +5 -0
  12. package/dist/bin/chunks/chunk-3MBAUIBB.js +7 -0
  13. package/dist/bin/chunks/chunk-3Y32LPNT.js +2 -0
  14. package/dist/bin/chunks/chunk-4E3LY6YK.js +10 -0
  15. package/dist/bin/chunks/chunk-4P5OA25Z.js +26 -0
  16. package/dist/bin/chunks/chunk-4PS5JJDT.js +8 -0
  17. package/dist/bin/chunks/chunk-5G2VOPPJ.js +7 -0
  18. package/dist/bin/chunks/chunk-5U7Q4GUC.js +6 -0
  19. package/dist/bin/chunks/chunk-5VFN7VVJ.js +9 -0
  20. package/dist/bin/chunks/chunk-6VUEI2GS.js +9 -0
  21. package/dist/bin/chunks/chunk-7BORMNPQ.js +2 -0
  22. package/dist/bin/chunks/chunk-7ECKLAVW.js +11 -0
  23. package/dist/bin/{shell/chunks/sed-E4QAUCYQ.js → chunks/chunk-7FTB27TY.js} +36 -36
  24. package/dist/bin/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
  25. package/dist/bin/chunks/chunk-BYDV4VEF.js +3 -0
  26. package/dist/bin/{shell/chunks/yq-XD7UYY5C.js → chunks/chunk-CHQBMS62.js} +24 -24
  27. package/dist/bin/chunks/chunk-D2GFNFUN.js +7 -0
  28. package/dist/bin/chunks/chunk-DAGNL3F2.js +32 -0
  29. package/dist/bin/chunks/chunk-DSNA7727.js +13 -0
  30. package/dist/bin/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
  31. package/dist/bin/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
  32. package/dist/bin/chunks/chunk-EUXCM6C4.js +12 -0
  33. package/dist/bin/{shell/chunks/xan-QLNZCWIG.js → chunks/chunk-F26OLHG5.js} +17 -17
  34. package/dist/bin/chunks/chunk-FLPVVSN5.js +5 -0
  35. package/dist/bin/chunks/{chunk-HSNUCOOQ.js → chunk-FZNYF2PQ.js} +2 -2
  36. package/dist/bin/chunks/chunk-ITA43A73.js +7 -0
  37. package/dist/bin/chunks/chunk-IY3BUFJK.js +5 -0
  38. package/dist/bin/chunks/chunk-JLX6YWGA.js +3 -0
  39. package/dist/bin/chunks/chunk-JQBC3FXE.js +8 -0
  40. package/dist/bin/chunks/chunk-JTF74J6E.js +2 -0
  41. package/dist/bin/chunks/chunk-JXC25GVQ.js +5 -0
  42. package/dist/bin/chunks/chunk-K47SEEPI.js +6 -0
  43. package/dist/bin/chunks/chunk-KLMOJKL4.js +16 -0
  44. package/dist/bin/chunks/chunk-KWLLB7S3.js +7 -0
  45. package/dist/bin/chunks/chunk-LJKIWB5F.js +4 -0
  46. package/dist/bin/chunks/chunk-LMK6G2HH.js +8 -0
  47. package/dist/bin/chunks/chunk-MAVV76T4.js +2 -0
  48. package/dist/bin/chunks/chunk-N43DJTSI.js +2 -0
  49. package/dist/bin/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
  50. package/dist/bin/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
  51. package/dist/bin/chunks/chunk-NEQEZ32M.js +5 -0
  52. package/dist/bin/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
  53. package/dist/bin/chunks/chunk-NSUMEERA.js +12 -0
  54. package/dist/bin/chunks/chunk-OIKCUTTB.js +6 -0
  55. package/dist/bin/chunks/chunk-P6GNZPVW.js +19 -0
  56. package/dist/bin/chunks/chunk-P7UCWJ33.js +12 -0
  57. package/dist/bin/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
  58. package/dist/bin/chunks/chunk-PPBQJBC2.js +5 -0
  59. package/dist/bin/chunks/chunk-PQNTKMH3.js +6 -0
  60. package/dist/bin/chunks/chunk-PS4LOXE5.js +8 -0
  61. package/dist/bin/chunks/chunk-Q4AUWUII.js +74 -0
  62. package/dist/bin/{shell/chunks/rg-IZR5557M.js → chunks/chunk-Q4QFIAHB.js} +9 -9
  63. package/dist/bin/chunks/chunk-QXB5WI2V.js +16 -0
  64. package/dist/bin/chunks/chunk-RJSAGJQJ.js +11 -0
  65. package/dist/bin/chunks/chunk-ROJPSS6N.js +3 -0
  66. package/dist/bin/chunks/chunk-RT7TRQVZ.js +3 -0
  67. package/dist/bin/chunks/chunk-S7OHMN3F.js +6 -0
  68. package/dist/bin/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
  69. package/dist/bin/chunks/chunk-STU6KQN4.js +6 -0
  70. package/dist/bin/chunks/chunk-SXRVLCZ4.js +2 -0
  71. package/dist/bin/chunks/chunk-TEFXEYX3.js +3 -0
  72. package/dist/bin/chunks/chunk-THALLNXT.js +7 -0
  73. package/dist/bin/chunks/chunk-THLAHQXV.js +16 -0
  74. package/dist/bin/chunks/chunk-TIDZOIPX.js +3 -0
  75. package/dist/bin/chunks/chunk-VNER2XXL.js +7 -0
  76. package/dist/bin/chunks/chunk-W2FKF3MM.js +9 -0
  77. package/dist/bin/chunks/chunk-WT2HWDDA.js +9 -0
  78. package/dist/bin/chunks/chunk-X2I3PJTX.js +15 -0
  79. package/dist/bin/chunks/chunk-XAL6VWGA.js +9 -0
  80. package/dist/bin/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
  81. package/dist/bin/chunks/chunk-YEKSVVRC.js +11 -0
  82. package/dist/bin/chunks/chunk-YLE2OYY6.js +2 -0
  83. package/dist/bin/chunks/chunk-YYQ22ZRL.js +8 -0
  84. package/dist/bin/chunks/chunk-ZA4HUKJ3.js +13 -0
  85. package/dist/bin/chunks/chunk-ZJSZ2BE5.js +21 -0
  86. package/dist/bin/chunks/chunk-ZKC5HQYO.js +14 -0
  87. package/dist/bin/chunks/clear-KRGKPFOI.js +2 -0
  88. package/dist/bin/chunks/column-XGV32UPN.js +2 -0
  89. package/dist/bin/chunks/comm-R3F3Z5DX.js +2 -0
  90. package/dist/bin/chunks/cp-XH2ZB7WT.js +2 -0
  91. package/dist/bin/chunks/cut-HDHQDWRG.js +2 -0
  92. package/dist/bin/chunks/date-6VDN5QZ5.js +2 -0
  93. package/dist/bin/chunks/diff-LE7GMFZD.js +2 -0
  94. package/dist/bin/chunks/dirname-5FAOMLBL.js +2 -0
  95. package/dist/bin/chunks/du-66BNA4IN.js +2 -0
  96. package/dist/bin/chunks/echo-2MUAOGUE.js +2 -0
  97. package/dist/bin/chunks/env-EVLPSWFF.js +2 -0
  98. package/dist/bin/chunks/expand-26XPP5KB.js +2 -0
  99. package/dist/bin/{shell/chunks/expansion-QOAPT4NU.js → chunks/expansion-HIAVHGBZ.js} +1 -1
  100. package/dist/bin/chunks/expr-MLHUWFYI.js +2 -0
  101. package/dist/bin/chunks/file-D5YKS5NV.js +2 -0
  102. package/dist/bin/chunks/find-K777TRNA.js +2 -0
  103. package/dist/bin/chunks/flag-coverage-FNEHS7AY.js +2 -0
  104. package/dist/bin/chunks/fold-XSVNTAWH.js +2 -0
  105. package/dist/bin/chunks/grep-FRIPZKKT.js +2 -0
  106. package/dist/bin/chunks/gzip-EENEW6WQ.js +2 -0
  107. package/dist/bin/chunks/head-YMNRW3F3.js +2 -0
  108. package/dist/bin/chunks/help-JF5TTAKQ.js +2 -0
  109. package/dist/bin/chunks/history-UUKG55YW.js +2 -0
  110. package/dist/bin/chunks/hostname-WY6RKE32.js +2 -0
  111. package/dist/bin/chunks/html-to-markdown-WVZA3MCP.js +2 -0
  112. package/dist/bin/chunks/join-Y4Q5WVVE.js +2 -0
  113. package/dist/bin/chunks/jq-3VHS7DR6.js +2 -0
  114. package/dist/bin/chunks/ln-5TCJXDGY.js +2 -0
  115. package/dist/bin/chunks/ls-ZXYOL67L.js +2 -0
  116. package/dist/bin/chunks/md5sum-NCLXV2S3.js +2 -0
  117. package/dist/bin/chunks/mkdir-6OKMS3KO.js +2 -0
  118. package/dist/bin/chunks/mv-OY7X62QC.js +2 -0
  119. package/dist/bin/chunks/nl-XH3L75DR.js +2 -0
  120. package/dist/bin/chunks/od-52FBC34W.js +2 -0
  121. package/dist/bin/chunks/paste-3UVLMQ2K.js +2 -0
  122. package/dist/bin/chunks/printf-TZC5BRAY.js +2 -0
  123. package/dist/bin/chunks/pwd-6VBAPL3Y.js +2 -0
  124. package/dist/bin/chunks/readlink-YNOUXNUY.js +2 -0
  125. package/dist/bin/chunks/rev-UHEPS2UL.js +2 -0
  126. package/dist/bin/chunks/rg-3R5G2XL4.js +2 -0
  127. package/dist/bin/chunks/rm-5QIBTLJG.js +2 -0
  128. package/dist/bin/chunks/rmdir-5KLM4EA6.js +2 -0
  129. package/dist/bin/chunks/sed-XP3QCHIB.js +2 -0
  130. package/dist/bin/chunks/seq-V7KBLSQ7.js +2 -0
  131. package/dist/bin/chunks/sha1sum-BHNJ5ALF.js +2 -0
  132. package/dist/bin/chunks/sha256sum-HJJ3NJ5L.js +2 -0
  133. package/dist/bin/chunks/sleep-PICQVS6Q.js +2 -0
  134. package/dist/bin/chunks/sort-NZSEYCI6.js +2 -0
  135. package/dist/bin/chunks/split-NOZ7FFXW.js +2 -0
  136. package/dist/bin/chunks/sqlite3-4SEIR46P.js +2 -0
  137. package/dist/bin/chunks/stat-XH7E4E2C.js +2 -0
  138. package/dist/bin/chunks/strings-XXKZCWY5.js +2 -0
  139. package/dist/bin/chunks/tac-TZBNTR4K.js +2 -0
  140. package/dist/bin/chunks/tail-V537TDFR.js +2 -0
  141. package/dist/bin/chunks/tar-7B5KH3QG.js +2 -0
  142. package/dist/bin/chunks/tee-HK2SYCAR.js +2 -0
  143. package/dist/bin/chunks/time-4C3A4THJ.js +2 -0
  144. package/dist/bin/chunks/timeout-RS7REDYT.js +2 -0
  145. package/dist/bin/chunks/touch-DWKSZGOQ.js +2 -0
  146. package/dist/bin/chunks/tr-GDDRKGRB.js +2 -0
  147. package/dist/bin/chunks/tree-HEKABARE.js +2 -0
  148. package/dist/bin/chunks/true-DP5UZP52.js +2 -0
  149. package/dist/bin/chunks/unexpand-OYZ7KOYR.js +2 -0
  150. package/dist/bin/chunks/uniq-FZWFZEN5.js +2 -0
  151. package/dist/bin/chunks/wc-ZIV3TFVG.js +2 -0
  152. package/dist/bin/chunks/which-67WZ6OMV.js +2 -0
  153. package/dist/bin/chunks/whoami-E7PN2UWC.js +2 -0
  154. package/dist/bin/chunks/worker.js +157 -1
  155. package/dist/bin/chunks/xan-EBI2W7YX.js +2 -0
  156. package/dist/bin/chunks/xargs-YWPEV2QC.js +2 -0
  157. package/dist/bin/chunks/yq-O56CEX4T.js +2 -0
  158. package/dist/bin/just-bash.js +192 -190
  159. package/dist/bin/shell/chunks/alias-3GODYSFD.js +2 -0
  160. package/dist/bin/shell/chunks/awk2-JBWRWZZH.js +2 -0
  161. package/dist/bin/shell/chunks/base64-OHU2WTUF.js +2 -0
  162. package/dist/bin/shell/chunks/basename-KBUKWB2E.js +2 -0
  163. package/dist/bin/shell/chunks/bash-RJTQJAKW.js +2 -0
  164. package/dist/bin/shell/chunks/cat-3J7U3HHI.js +2 -0
  165. package/dist/bin/shell/chunks/chmod-4O2C4V42.js +2 -0
  166. package/dist/bin/shell/chunks/chunk-26NO42TF.js +14 -0
  167. package/dist/bin/shell/chunks/chunk-2SIXTZCJ.js +5 -0
  168. package/dist/bin/shell/chunks/chunk-3MBAUIBB.js +7 -0
  169. package/dist/bin/shell/chunks/chunk-3Y32LPNT.js +2 -0
  170. package/dist/bin/shell/chunks/chunk-4E3LY6YK.js +10 -0
  171. package/dist/bin/shell/chunks/chunk-4P5OA25Z.js +26 -0
  172. package/dist/bin/shell/chunks/chunk-4PS5JJDT.js +8 -0
  173. package/dist/bin/shell/chunks/chunk-5G2VOPPJ.js +7 -0
  174. package/dist/bin/shell/chunks/chunk-5U7Q4GUC.js +6 -0
  175. package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +9 -0
  176. package/dist/bin/shell/chunks/chunk-6VUEI2GS.js +9 -0
  177. package/dist/bin/shell/chunks/chunk-7BORMNPQ.js +2 -0
  178. package/dist/bin/shell/chunks/chunk-7ECKLAVW.js +11 -0
  179. package/dist/bin/{chunks/sed-E4QAUCYQ.js → shell/chunks/chunk-7FTB27TY.js} +36 -36
  180. package/dist/bin/shell/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
  181. package/dist/bin/shell/chunks/chunk-BYDV4VEF.js +3 -0
  182. package/dist/bin/{chunks/yq-XD7UYY5C.js → shell/chunks/chunk-CHQBMS62.js} +24 -24
  183. package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +7 -0
  184. package/dist/bin/shell/chunks/chunk-DAGNL3F2.js +32 -0
  185. package/dist/bin/shell/chunks/chunk-DSNA7727.js +13 -0
  186. package/dist/bin/shell/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
  187. package/dist/bin/shell/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
  188. package/dist/bin/shell/chunks/chunk-EUXCM6C4.js +12 -0
  189. package/dist/bin/{chunks/xan-QLNZCWIG.js → shell/chunks/chunk-F26OLHG5.js} +17 -17
  190. package/dist/bin/shell/chunks/chunk-FLPVVSN5.js +5 -0
  191. package/dist/bin/shell/chunks/{chunk-HSNUCOOQ.js → chunk-FZNYF2PQ.js} +2 -2
  192. package/dist/bin/shell/chunks/chunk-ITA43A73.js +7 -0
  193. package/dist/bin/shell/chunks/chunk-IY3BUFJK.js +5 -0
  194. package/dist/bin/shell/chunks/chunk-JLX6YWGA.js +3 -0
  195. package/dist/bin/shell/chunks/chunk-JQBC3FXE.js +8 -0
  196. package/dist/bin/shell/chunks/chunk-JTF74J6E.js +2 -0
  197. package/dist/bin/shell/chunks/chunk-JXC25GVQ.js +5 -0
  198. package/dist/bin/shell/chunks/chunk-K47SEEPI.js +6 -0
  199. package/dist/bin/shell/chunks/chunk-KLMOJKL4.js +16 -0
  200. package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +7 -0
  201. package/dist/bin/shell/chunks/chunk-LJKIWB5F.js +4 -0
  202. package/dist/bin/shell/chunks/chunk-LMK6G2HH.js +8 -0
  203. package/dist/bin/shell/chunks/chunk-MAVV76T4.js +2 -0
  204. package/dist/bin/shell/chunks/chunk-N43DJTSI.js +2 -0
  205. package/dist/bin/shell/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
  206. package/dist/bin/shell/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
  207. package/dist/bin/shell/chunks/chunk-NEQEZ32M.js +5 -0
  208. package/dist/bin/shell/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
  209. package/dist/bin/shell/chunks/chunk-NSUMEERA.js +12 -0
  210. package/dist/bin/shell/chunks/chunk-OIKCUTTB.js +6 -0
  211. package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +19 -0
  212. package/dist/bin/shell/chunks/chunk-P7UCWJ33.js +12 -0
  213. package/dist/bin/shell/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
  214. package/dist/bin/shell/chunks/chunk-PPBQJBC2.js +5 -0
  215. package/dist/bin/shell/chunks/chunk-PQNTKMH3.js +6 -0
  216. package/dist/bin/shell/chunks/chunk-PS4LOXE5.js +8 -0
  217. package/dist/bin/shell/chunks/chunk-Q4AUWUII.js +74 -0
  218. package/dist/bin/{chunks/rg-IZR5557M.js → shell/chunks/chunk-Q4QFIAHB.js} +9 -9
  219. package/dist/bin/shell/chunks/chunk-QXB5WI2V.js +16 -0
  220. package/dist/bin/shell/chunks/chunk-RJSAGJQJ.js +11 -0
  221. package/dist/bin/shell/chunks/chunk-ROJPSS6N.js +3 -0
  222. package/dist/bin/shell/chunks/chunk-RT7TRQVZ.js +3 -0
  223. package/dist/bin/shell/chunks/chunk-S7OHMN3F.js +6 -0
  224. package/dist/bin/shell/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
  225. package/dist/bin/shell/chunks/chunk-STU6KQN4.js +6 -0
  226. package/dist/bin/shell/chunks/chunk-SXRVLCZ4.js +2 -0
  227. package/dist/bin/shell/chunks/chunk-TEFXEYX3.js +3 -0
  228. package/dist/bin/shell/chunks/chunk-THALLNXT.js +7 -0
  229. package/dist/bin/shell/chunks/chunk-THLAHQXV.js +16 -0
  230. package/dist/bin/shell/chunks/chunk-TIDZOIPX.js +3 -0
  231. package/dist/bin/shell/chunks/chunk-VNER2XXL.js +7 -0
  232. package/dist/bin/shell/chunks/chunk-W2FKF3MM.js +9 -0
  233. package/dist/bin/shell/chunks/chunk-WT2HWDDA.js +9 -0
  234. package/dist/bin/shell/chunks/chunk-X2I3PJTX.js +15 -0
  235. package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +9 -0
  236. package/dist/bin/shell/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
  237. package/dist/bin/shell/chunks/chunk-YEKSVVRC.js +11 -0
  238. package/dist/bin/shell/chunks/chunk-YLE2OYY6.js +2 -0
  239. package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +8 -0
  240. package/dist/bin/shell/chunks/chunk-ZA4HUKJ3.js +13 -0
  241. package/dist/bin/shell/chunks/chunk-ZJSZ2BE5.js +21 -0
  242. package/dist/bin/shell/chunks/chunk-ZKC5HQYO.js +14 -0
  243. package/dist/bin/shell/chunks/clear-KRGKPFOI.js +2 -0
  244. package/dist/bin/shell/chunks/column-XGV32UPN.js +2 -0
  245. package/dist/bin/shell/chunks/comm-R3F3Z5DX.js +2 -0
  246. package/dist/bin/shell/chunks/cp-XH2ZB7WT.js +2 -0
  247. package/dist/bin/shell/chunks/cut-HDHQDWRG.js +2 -0
  248. package/dist/bin/shell/chunks/date-6VDN5QZ5.js +2 -0
  249. package/dist/bin/shell/chunks/diff-LE7GMFZD.js +2 -0
  250. package/dist/bin/shell/chunks/dirname-5FAOMLBL.js +2 -0
  251. package/dist/bin/shell/chunks/du-66BNA4IN.js +2 -0
  252. package/dist/bin/shell/chunks/echo-2MUAOGUE.js +2 -0
  253. package/dist/bin/shell/chunks/env-EVLPSWFF.js +2 -0
  254. package/dist/bin/shell/chunks/expand-26XPP5KB.js +2 -0
  255. package/dist/bin/{chunks/expansion-QOAPT4NU.js → shell/chunks/expansion-HIAVHGBZ.js} +1 -1
  256. package/dist/bin/shell/chunks/expr-MLHUWFYI.js +2 -0
  257. package/dist/bin/shell/chunks/file-D5YKS5NV.js +2 -0
  258. package/dist/bin/shell/chunks/find-K777TRNA.js +2 -0
  259. package/dist/bin/shell/chunks/flag-coverage-FNEHS7AY.js +2 -0
  260. package/dist/bin/shell/chunks/fold-XSVNTAWH.js +2 -0
  261. package/dist/bin/shell/chunks/grep-FRIPZKKT.js +2 -0
  262. package/dist/bin/shell/chunks/gzip-EENEW6WQ.js +2 -0
  263. package/dist/bin/shell/chunks/head-YMNRW3F3.js +2 -0
  264. package/dist/bin/shell/chunks/help-JF5TTAKQ.js +2 -0
  265. package/dist/bin/shell/chunks/history-UUKG55YW.js +2 -0
  266. package/dist/bin/shell/chunks/hostname-WY6RKE32.js +2 -0
  267. package/dist/bin/shell/chunks/html-to-markdown-WVZA3MCP.js +2 -0
  268. package/dist/bin/shell/chunks/join-Y4Q5WVVE.js +2 -0
  269. package/dist/bin/shell/chunks/jq-3VHS7DR6.js +2 -0
  270. package/dist/bin/shell/chunks/ln-5TCJXDGY.js +2 -0
  271. package/dist/bin/shell/chunks/ls-ZXYOL67L.js +2 -0
  272. package/dist/bin/shell/chunks/md5sum-NCLXV2S3.js +2 -0
  273. package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +2 -0
  274. package/dist/bin/shell/chunks/mv-OY7X62QC.js +2 -0
  275. package/dist/bin/shell/chunks/nl-XH3L75DR.js +2 -0
  276. package/dist/bin/shell/chunks/od-52FBC34W.js +2 -0
  277. package/dist/bin/shell/chunks/paste-3UVLMQ2K.js +2 -0
  278. package/dist/bin/shell/chunks/printf-TZC5BRAY.js +2 -0
  279. package/dist/bin/shell/chunks/pwd-6VBAPL3Y.js +2 -0
  280. package/dist/bin/shell/chunks/readlink-YNOUXNUY.js +2 -0
  281. package/dist/bin/shell/chunks/rev-UHEPS2UL.js +2 -0
  282. package/dist/bin/shell/chunks/rg-3R5G2XL4.js +2 -0
  283. package/dist/bin/shell/chunks/rm-5QIBTLJG.js +2 -0
  284. package/dist/bin/shell/chunks/rmdir-5KLM4EA6.js +2 -0
  285. package/dist/bin/shell/chunks/sed-XP3QCHIB.js +2 -0
  286. package/dist/bin/shell/chunks/seq-V7KBLSQ7.js +2 -0
  287. package/dist/bin/shell/chunks/sha1sum-BHNJ5ALF.js +2 -0
  288. package/dist/bin/shell/chunks/sha256sum-HJJ3NJ5L.js +2 -0
  289. package/dist/bin/shell/chunks/sleep-PICQVS6Q.js +2 -0
  290. package/dist/bin/shell/chunks/sort-NZSEYCI6.js +2 -0
  291. package/dist/bin/shell/chunks/split-NOZ7FFXW.js +2 -0
  292. package/dist/bin/shell/chunks/sqlite3-4SEIR46P.js +2 -0
  293. package/dist/bin/shell/chunks/stat-XH7E4E2C.js +2 -0
  294. package/dist/bin/shell/chunks/strings-XXKZCWY5.js +2 -0
  295. package/dist/bin/shell/chunks/tac-TZBNTR4K.js +2 -0
  296. package/dist/bin/shell/chunks/tail-V537TDFR.js +2 -0
  297. package/dist/bin/shell/chunks/tar-7B5KH3QG.js +2 -0
  298. package/dist/bin/shell/chunks/tee-HK2SYCAR.js +2 -0
  299. package/dist/bin/shell/chunks/time-4C3A4THJ.js +2 -0
  300. package/dist/bin/shell/chunks/timeout-RS7REDYT.js +2 -0
  301. package/dist/bin/shell/chunks/touch-DWKSZGOQ.js +2 -0
  302. package/dist/bin/shell/chunks/tr-GDDRKGRB.js +2 -0
  303. package/dist/bin/shell/chunks/tree-HEKABARE.js +2 -0
  304. package/dist/bin/shell/chunks/true-DP5UZP52.js +2 -0
  305. package/dist/bin/shell/chunks/unexpand-OYZ7KOYR.js +2 -0
  306. package/dist/bin/shell/chunks/uniq-FZWFZEN5.js +2 -0
  307. package/dist/bin/shell/chunks/wc-ZIV3TFVG.js +2 -0
  308. package/dist/bin/shell/chunks/which-67WZ6OMV.js +2 -0
  309. package/dist/bin/shell/chunks/whoami-E7PN2UWC.js +2 -0
  310. package/dist/bin/shell/chunks/xan-EBI2W7YX.js +2 -0
  311. package/dist/bin/shell/chunks/xargs-YWPEV2QC.js +2 -0
  312. package/dist/bin/shell/chunks/yq-O56CEX4T.js +2 -0
  313. package/dist/bin/shell/shell.js +195 -193
  314. package/dist/bundle/browser.js +774 -772
  315. package/dist/bundle/chunks/alias-JE7RI5QX.js +1 -0
  316. package/dist/bundle/chunks/awk2-M5NFQRYA.js +1 -0
  317. package/dist/bundle/chunks/base64-HYOQ5I2F.js +1 -0
  318. package/dist/bundle/chunks/basename-AA2KJYZQ.js +1 -0
  319. package/dist/bundle/chunks/bash-OVBCDR7G.js +1 -0
  320. package/dist/bundle/chunks/cat-C2OBLGHA.js +1 -0
  321. package/dist/bundle/chunks/chmod-MIKE3OIT.js +1 -0
  322. package/dist/bundle/chunks/chunk-27LMNKBP.js +7 -0
  323. package/dist/bundle/chunks/chunk-4HHKTUW3.js +2 -0
  324. package/dist/bundle/chunks/chunk-4Q4SM6WR.js +4 -0
  325. package/dist/bundle/chunks/chunk-55VFSPNA.js +2 -0
  326. package/dist/bundle/chunks/chunk-5V6VZH6T.js +1 -0
  327. package/dist/bundle/chunks/chunk-64BAICW3.js +1 -0
  328. package/dist/bundle/chunks/chunk-6NY2AP72.js +5 -0
  329. package/dist/bundle/chunks/chunk-7C6RBHP3.js +4 -0
  330. package/dist/bundle/chunks/chunk-7DBA735O.js +5 -0
  331. package/dist/bundle/chunks/chunk-A4HU7SVR.js +2 -0
  332. package/dist/bundle/chunks/chunk-A4JSPFCI.js +6 -0
  333. package/dist/bundle/chunks/chunk-A7A2DBEE.js +6 -0
  334. package/dist/bundle/chunks/chunk-A7ICOL4V.js +13 -0
  335. package/dist/bundle/chunks/chunk-ALLTKNUZ.js +5 -0
  336. package/dist/bundle/chunks/chunk-APT7OOP2.js +1 -0
  337. package/dist/bundle/chunks/chunk-CCL4U6Q4.js +73 -0
  338. package/dist/bundle/chunks/{file-APPTAFMI.js → chunk-CR5AFCPT.js} +1 -1
  339. package/dist/bundle/chunks/{time-EGF4KTWV.js → chunk-CSBFBYLD.js} +5 -5
  340. package/dist/bundle/chunks/chunk-D4J545R4.js +11 -0
  341. package/dist/bundle/chunks/chunk-DCAAORBQ.js +1 -0
  342. package/dist/bundle/chunks/chunk-DZ33S2U7.js +31 -0
  343. package/dist/bundle/chunks/{nl-KWQGFZH5.js → chunk-F23WWYKW.js} +7 -7
  344. package/dist/bundle/chunks/chunk-GCTKCWKD.js +3 -0
  345. package/dist/bundle/chunks/{yq-JD6M7T5A.js → chunk-GOBUJIHS.js} +24 -24
  346. package/dist/bundle/chunks/chunk-GQ7SJRUH.js +12 -0
  347. package/dist/bundle/chunks/chunk-GXVXFKBA.js +5 -0
  348. package/dist/bundle/chunks/chunk-GZ2N3SXD.js +8 -0
  349. package/dist/bundle/chunks/{sqlite3-DK5YHTWU.js → chunk-HDZ4QEVJ.js} +9 -9
  350. package/dist/bundle/chunks/chunk-HJQJAYMS.js +2 -0
  351. package/dist/bundle/chunks/chunk-HXILPMCG.js +5 -0
  352. package/dist/bundle/chunks/chunk-IKZ5LEGB.js +6 -0
  353. package/dist/bundle/chunks/chunk-JSZMK2JZ.js +5 -0
  354. package/dist/bundle/chunks/chunk-JVPRLUMK.js +7 -0
  355. package/dist/bundle/chunks/chunk-K3PAWJ7V.js +7 -0
  356. package/dist/bundle/chunks/chunk-KAEMRWOH.js +15 -0
  357. package/dist/bundle/chunks/chunk-KTGH7NTP.js +15 -0
  358. package/dist/bundle/chunks/chunk-KY5VPZXG.js +23 -0
  359. package/dist/bundle/chunks/{printf-4U5V2VHK.js → chunk-L4KW73FJ.js} +11 -11
  360. package/dist/bundle/chunks/chunk-LL3S3NLB.js +1 -0
  361. package/dist/bundle/chunks/chunk-LWEGUNWT.js +7 -0
  362. package/dist/bundle/chunks/chunk-MDLLFABN.js +4 -0
  363. package/dist/bundle/chunks/chunk-NCNPKYJZ.js +2 -0
  364. package/dist/bundle/chunks/chunk-NQOQ2Q77.js +8 -0
  365. package/dist/bundle/chunks/chunk-NUYSJFDK.js +7 -0
  366. package/dist/bundle/chunks/chunk-OCK72LWW.js +4 -0
  367. package/dist/bundle/chunks/chunk-OCLXQMOG.js +6 -0
  368. package/dist/bundle/chunks/{rmdir-DU6C7ZEO.js → chunk-OCS6LSEM.js} +3 -3
  369. package/dist/bundle/chunks/chunk-OFJTSXN6.js +8 -0
  370. package/dist/bundle/chunks/chunk-OGDTSM2Q.js +8 -0
  371. package/dist/bundle/chunks/chunk-PP6PSHAB.js +4 -0
  372. package/dist/bundle/chunks/chunk-PYSFUGCK.js +10 -0
  373. package/dist/bundle/chunks/chunk-QCDB2VPH.js +6 -0
  374. package/dist/bundle/chunks/{rg-JNKRPEYR.js → chunk-QOENL5UZ.js} +9 -9
  375. package/dist/bundle/chunks/chunk-R6QSAL5T.js +1 -0
  376. package/dist/bundle/chunks/{chunk-WQCJYUEW.js → chunk-RSXSWZBQ.js} +2 -2
  377. package/dist/bundle/chunks/chunk-S6BBC45K.js +8 -0
  378. package/dist/bundle/chunks/chunk-SL4FN3A5.js +9 -0
  379. package/dist/bundle/chunks/chunk-SXR3EI72.js +4 -0
  380. package/dist/bundle/chunks/chunk-TLSUDHID.js +6 -0
  381. package/dist/bundle/chunks/chunk-U7QI5ZS5.js +4 -0
  382. package/dist/bundle/chunks/{xan-EN6JZQ3T.js → chunk-UAHZJD43.js} +17 -17
  383. package/dist/bundle/chunks/chunk-UYGR3CFC.js +2 -0
  384. package/dist/bundle/chunks/chunk-VJFXDYWH.js +10 -0
  385. package/dist/bundle/chunks/chunk-VOBGTVA6.js +6 -0
  386. package/dist/bundle/chunks/{sed-4K5HXNXE.js → chunk-VTHR2H5Q.js} +36 -36
  387. package/dist/bundle/chunks/chunk-VYOJP4TV.js +13 -0
  388. package/dist/bundle/chunks/{tar-5V4PGBFL.js → chunk-VZWXH2PZ.js} +6 -6
  389. package/dist/bundle/chunks/chunk-WEIVGBP5.js +20 -0
  390. package/dist/bundle/chunks/chunk-WMLBQOWO.js +9 -0
  391. package/dist/bundle/chunks/{tr-UJSEBPIQ.js → chunk-X6JMGGW2.js} +5 -5
  392. package/dist/bundle/chunks/chunk-XKQRETAK.js +1 -0
  393. package/dist/bundle/chunks/chunk-XNL7YAHW.js +11 -0
  394. package/dist/bundle/chunks/chunk-XVDPCNWR.js +11 -0
  395. package/dist/bundle/chunks/chunk-XZ3MZS57.js +6 -0
  396. package/dist/bundle/chunks/chunk-YYB54I7F.js +10 -0
  397. package/dist/bundle/chunks/chunk-Z7JVV2SM.js +12 -0
  398. package/dist/bundle/chunks/chunk-ZKLK6C7H.js +15 -0
  399. package/dist/bundle/chunks/clear-5CZ5X4YR.js +1 -0
  400. package/dist/bundle/chunks/column-WLPMMSTS.js +1 -0
  401. package/dist/bundle/chunks/comm-5SLSESQG.js +1 -0
  402. package/dist/bundle/chunks/cp-XOYR4ABJ.js +1 -0
  403. package/dist/bundle/chunks/cut-LO6YYY5P.js +1 -0
  404. package/dist/bundle/chunks/date-FT2P5UCQ.js +1 -0
  405. package/dist/bundle/chunks/diff-HJF2MPDN.js +1 -0
  406. package/dist/bundle/chunks/dirname-LEMTZZFS.js +1 -0
  407. package/dist/bundle/chunks/du-DM4QX4XA.js +1 -0
  408. package/dist/bundle/chunks/echo-O45JWWI2.js +1 -0
  409. package/dist/bundle/chunks/env-S547XMN7.js +1 -0
  410. package/dist/bundle/chunks/expand-DTNXU4LQ.js +1 -0
  411. package/dist/bundle/chunks/{expansion-7IMG6HKQ.js → expansion-R2VVQUSY.js} +1 -1
  412. package/dist/bundle/chunks/expr-3572LAOT.js +1 -0
  413. package/dist/bundle/chunks/file-ZIGAJ4YS.js +1 -0
  414. package/dist/bundle/chunks/find-74OP3M7S.js +1 -0
  415. package/dist/bundle/chunks/flag-coverage-KDDXWVDJ.js +1 -0
  416. package/dist/bundle/chunks/fold-LDSORVYE.js +1 -0
  417. package/dist/bundle/chunks/grep-BPEMMINR.js +1 -0
  418. package/dist/bundle/chunks/gzip-UTSGNF5Z.js +1 -0
  419. package/dist/bundle/chunks/head-HT2B6D2J.js +1 -0
  420. package/dist/bundle/chunks/help-T2NGLTSG.js +1 -0
  421. package/dist/bundle/chunks/history-J4QRNGRO.js +1 -0
  422. package/dist/bundle/chunks/hostname-BK6HG2DE.js +1 -0
  423. package/dist/bundle/chunks/html-to-markdown-TFCECAGV.js +1 -0
  424. package/dist/bundle/chunks/join-GG2LDHE5.js +1 -0
  425. package/dist/bundle/chunks/jq-HA6MN2H5.js +1 -0
  426. package/dist/bundle/chunks/ln-YAIFIHCT.js +1 -0
  427. package/dist/bundle/chunks/ls-OTONBH2E.js +1 -0
  428. package/dist/bundle/chunks/md5sum-INMIK4DX.js +1 -0
  429. package/dist/bundle/chunks/mkdir-QWGXDWUS.js +1 -0
  430. package/dist/bundle/chunks/mv-Z6MORUFL.js +1 -0
  431. package/dist/bundle/chunks/nl-U5YJDM32.js +1 -0
  432. package/dist/bundle/chunks/od-VJEF2UR5.js +1 -0
  433. package/dist/bundle/chunks/paste-7N6AFSDS.js +1 -0
  434. package/dist/bundle/chunks/printf-KGN6BDCY.js +1 -0
  435. package/dist/bundle/chunks/pwd-D4OZ7N27.js +1 -0
  436. package/dist/bundle/chunks/readlink-IEQO24KU.js +1 -0
  437. package/dist/bundle/chunks/rev-XOSYPP45.js +1 -0
  438. package/dist/bundle/chunks/rg-ORQK4GVH.js +1 -0
  439. package/dist/bundle/chunks/rm-KPTLPKPH.js +1 -0
  440. package/dist/bundle/chunks/rmdir-XTQXT7RK.js +1 -0
  441. package/dist/bundle/chunks/sed-MUVA7R2C.js +1 -0
  442. package/dist/bundle/chunks/seq-RN5ZUASB.js +1 -0
  443. package/dist/bundle/chunks/sha1sum-VJPNLNU6.js +1 -0
  444. package/dist/bundle/chunks/sha256sum-PI32XWXY.js +1 -0
  445. package/dist/bundle/chunks/sleep-JHK4I472.js +1 -0
  446. package/dist/bundle/chunks/sort-T7TNLWXL.js +1 -0
  447. package/dist/bundle/chunks/split-EZOC5IIZ.js +1 -0
  448. package/dist/bundle/chunks/sqlite3-Z2IGWYCE.js +1 -0
  449. package/dist/bundle/chunks/stat-74KBZFAX.js +1 -0
  450. package/dist/bundle/chunks/strings-7PLOGTPD.js +1 -0
  451. package/dist/bundle/chunks/tac-T7YAU2Y6.js +1 -0
  452. package/dist/bundle/chunks/tail-S5ULNTJU.js +1 -0
  453. package/dist/bundle/chunks/tar-K7K7BL55.js +1 -0
  454. package/dist/bundle/chunks/tee-O7VXZDCO.js +1 -0
  455. package/dist/bundle/chunks/time-BPT76IHZ.js +1 -0
  456. package/dist/bundle/chunks/timeout-5UJUQXOE.js +1 -0
  457. package/dist/bundle/chunks/touch-DX2IJOQ4.js +1 -0
  458. package/dist/bundle/chunks/tr-RYO2EDCA.js +1 -0
  459. package/dist/bundle/chunks/tree-LYXBS7DC.js +1 -0
  460. package/dist/bundle/chunks/true-WHJNXCHG.js +1 -0
  461. package/dist/bundle/chunks/unexpand-RGTMIGZM.js +1 -0
  462. package/dist/bundle/chunks/uniq-ZXE4O5XB.js +1 -0
  463. package/dist/bundle/chunks/wc-TQB3VNOX.js +1 -0
  464. package/dist/bundle/chunks/which-NCIYTMAT.js +1 -0
  465. package/dist/bundle/chunks/whoami-DGKU3D2X.js +1 -0
  466. package/dist/bundle/chunks/worker.js +157 -1
  467. package/dist/bundle/chunks/xan-6DLWA2BW.js +1 -0
  468. package/dist/bundle/chunks/xargs-OGI2NN6J.js +1 -0
  469. package/dist/bundle/chunks/yq-LO2NVDTD.js +1 -0
  470. package/dist/bundle/index.js +185 -183
  471. package/dist/commands/alias/alias.d.ts +3 -0
  472. package/dist/commands/awk/awk2.d.ts +2 -0
  473. package/dist/commands/awk/interpreter/context.d.ts +5 -0
  474. package/dist/commands/base64/base64.d.ts +2 -0
  475. package/dist/commands/basename/basename.d.ts +2 -0
  476. package/dist/commands/bash/bash.d.ts +3 -0
  477. package/dist/commands/cat/cat.d.ts +2 -0
  478. package/dist/commands/chmod/chmod.d.ts +2 -0
  479. package/dist/commands/clear/clear.d.ts +2 -0
  480. package/dist/commands/column/column.d.ts +2 -0
  481. package/dist/commands/comm/comm.d.ts +2 -0
  482. package/dist/commands/cp/cp.d.ts +2 -0
  483. package/dist/commands/cut/cut.d.ts +2 -0
  484. package/dist/commands/date/date.d.ts +2 -0
  485. package/dist/commands/diff/diff.d.ts +2 -0
  486. package/dist/commands/dirname/dirname.d.ts +2 -0
  487. package/dist/commands/du/du.d.ts +2 -0
  488. package/dist/commands/echo/echo.d.ts +2 -0
  489. package/dist/commands/env/env.d.ts +3 -0
  490. package/dist/commands/expand/expand.d.ts +2 -0
  491. package/dist/commands/expand/unexpand.d.ts +2 -0
  492. package/dist/commands/expr/expr.d.ts +2 -0
  493. package/dist/commands/file/file.d.ts +2 -0
  494. package/dist/commands/find/find.d.ts +2 -0
  495. package/dist/commands/flag-coverage.d.ts +2 -0
  496. package/dist/commands/fold/fold.d.ts +2 -0
  497. package/dist/commands/fuzz-flags-types.d.ts +17 -0
  498. package/dist/commands/fuzz-flags.d.ts +8 -0
  499. package/dist/commands/grep/grep.d.ts +4 -0
  500. package/dist/commands/gzip/gzip.d.ts +4 -0
  501. package/dist/commands/head/head.d.ts +2 -0
  502. package/dist/commands/help/help.d.ts +2 -0
  503. package/dist/commands/history/history.d.ts +2 -0
  504. package/dist/commands/hostname/hostname.d.ts +2 -0
  505. package/dist/commands/html-to-markdown/html-to-markdown.d.ts +2 -0
  506. package/dist/commands/join/join.d.ts +2 -0
  507. package/dist/commands/jq/jq.d.ts +2 -0
  508. package/dist/commands/ln/ln.d.ts +2 -0
  509. package/dist/commands/ls/ls.d.ts +2 -0
  510. package/dist/commands/md5sum/md5sum.d.ts +2 -0
  511. package/dist/commands/md5sum/sha1sum.d.ts +2 -0
  512. package/dist/commands/md5sum/sha256sum.d.ts +2 -0
  513. package/dist/commands/mkdir/mkdir.d.ts +2 -0
  514. package/dist/commands/mv/mv.d.ts +2 -0
  515. package/dist/commands/nl/nl.d.ts +2 -0
  516. package/dist/commands/od/od.d.ts +2 -0
  517. package/dist/commands/paste/paste.d.ts +2 -0
  518. package/dist/commands/printf/printf.d.ts +2 -0
  519. package/dist/commands/pwd/pwd.d.ts +2 -0
  520. package/dist/commands/query-engine/evaluator.d.ts +4 -0
  521. package/dist/commands/readlink/readlink.d.ts +2 -0
  522. package/dist/commands/rev/rev.d.ts +2 -0
  523. package/dist/commands/rg/rg.d.ts +2 -0
  524. package/dist/commands/rm/rm.d.ts +2 -0
  525. package/dist/commands/rmdir/rmdir.d.ts +2 -0
  526. package/dist/commands/sed/sed.d.ts +2 -0
  527. package/dist/commands/sed/types.d.ts +2 -0
  528. package/dist/commands/seq/seq.d.ts +2 -0
  529. package/dist/commands/sleep/sleep.d.ts +2 -0
  530. package/dist/commands/sort/sort.d.ts +2 -0
  531. package/dist/commands/split/split.d.ts +2 -0
  532. package/dist/commands/sqlite3/sqlite3.d.ts +2 -0
  533. package/dist/commands/stat/stat.d.ts +2 -0
  534. package/dist/commands/strings/strings.d.ts +2 -0
  535. package/dist/commands/tac/tac.d.ts +2 -0
  536. package/dist/commands/tail/tail.d.ts +2 -0
  537. package/dist/commands/tar/tar.d.ts +2 -0
  538. package/dist/commands/tee/tee.d.ts +2 -0
  539. package/dist/commands/time/time.d.ts +2 -0
  540. package/dist/commands/timeout/timeout.d.ts +2 -0
  541. package/dist/commands/touch/touch.d.ts +2 -0
  542. package/dist/commands/tr/tr.d.ts +2 -0
  543. package/dist/commands/tree/tree.d.ts +2 -0
  544. package/dist/commands/true/true.d.ts +3 -0
  545. package/dist/commands/uniq/uniq.d.ts +2 -0
  546. package/dist/commands/wc/wc.d.ts +2 -0
  547. package/dist/commands/which/which.d.ts +2 -0
  548. package/dist/commands/whoami/whoami.d.ts +2 -0
  549. package/dist/commands/xan/xan.d.ts +2 -0
  550. package/dist/commands/xargs/xargs.d.ts +2 -0
  551. package/dist/commands/yq/yq.d.ts +2 -0
  552. package/dist/fs/overlay-fs/overlay-fs.d.ts +7 -0
  553. package/dist/fs/read-write-fs/read-write-fs.d.ts +7 -0
  554. package/dist/interpreter/interpreter.d.ts +3 -1
  555. package/dist/interpreter/types.d.ts +3 -1
  556. package/dist/network/types.d.ts +11 -0
  557. package/dist/parser/parser.d.ts +6 -0
  558. package/dist/parser/types.d.ts +1 -0
  559. package/dist/types.d.ts +12 -0
  560. package/package.json +4 -4
  561. package/dist/bin/chunks/alias-MGDOL4KG.js +0 -7
  562. package/dist/bin/chunks/awk2-OKD2P6CM.js +0 -21
  563. package/dist/bin/chunks/base64-43KPK6TL.js +0 -6
  564. package/dist/bin/chunks/basename-SO5MVUEX.js +0 -6
  565. package/dist/bin/chunks/bash-OAUBNRSG.js +0 -6
  566. package/dist/bin/chunks/cat-HNXE2ES2.js +0 -6
  567. package/dist/bin/chunks/chmod-TYLTHXFR.js +0 -9
  568. package/dist/bin/chunks/chunk-2ODUA7YH.js +0 -74
  569. package/dist/bin/chunks/clear-CI7A5IXQ.js +0 -2
  570. package/dist/bin/chunks/column-HQ4AK5DM.js +0 -8
  571. package/dist/bin/chunks/comm-CPIFQTKY.js +0 -13
  572. package/dist/bin/chunks/cp-VFXCUKXO.js +0 -8
  573. package/dist/bin/chunks/cut-IHF6BEOO.js +0 -6
  574. package/dist/bin/chunks/date-IQLPMFYI.js +0 -5
  575. package/dist/bin/chunks/diff-ZGXLP3DN.js +0 -19
  576. package/dist/bin/chunks/dirname-EES7TR26.js +0 -5
  577. package/dist/bin/chunks/du-PECPOFQT.js +0 -8
  578. package/dist/bin/chunks/echo-7I42V66Q.js +0 -4
  579. package/dist/bin/chunks/env-W6IMQ43Y.js +0 -9
  580. package/dist/bin/chunks/expand-77K5HH2M.js +0 -11
  581. package/dist/bin/chunks/expr-433HIVAI.js +0 -5
  582. package/dist/bin/chunks/find-KHOYETRP.js +0 -11
  583. package/dist/bin/chunks/fold-452R4I2C.js +0 -12
  584. package/dist/bin/chunks/grep-BD56656Z.js +0 -9
  585. package/dist/bin/chunks/gzip-5ILPB46W.js +0 -32
  586. package/dist/bin/chunks/head-TJHLLIMR.js +0 -2
  587. package/dist/bin/chunks/help-L43ENI4H.js +0 -16
  588. package/dist/bin/chunks/history-56DL6SXU.js +0 -3
  589. package/dist/bin/chunks/hostname-WXDKRL2Z.js +0 -3
  590. package/dist/bin/chunks/join-3IXMEGNA.js +0 -14
  591. package/dist/bin/chunks/jq-EIPK4SZA.js +0 -13
  592. package/dist/bin/chunks/ln-EFFNQ3RY.js +0 -10
  593. package/dist/bin/chunks/ls-5LN47VHU.js +0 -26
  594. package/dist/bin/chunks/md5sum-VHPDBIVV.js +0 -2
  595. package/dist/bin/chunks/mkdir-XMSNS6S5.js +0 -7
  596. package/dist/bin/chunks/mv-P4KHB27X.js +0 -7
  597. package/dist/bin/chunks/od-KRKGC2U3.js +0 -5
  598. package/dist/bin/chunks/paste-UCH462KK.js +0 -8
  599. package/dist/bin/chunks/printf-4W7NDLLV.js +0 -15
  600. package/dist/bin/chunks/pwd-L26WH2K4.js +0 -3
  601. package/dist/bin/chunks/readlink-VL3R4LAM.js +0 -7
  602. package/dist/bin/chunks/rev-VP42N2JN.js +0 -7
  603. package/dist/bin/chunks/rm-S7ASVG34.js +0 -8
  604. package/dist/bin/chunks/seq-AVK43XM2.js +0 -7
  605. package/dist/bin/chunks/sha1sum-4SVNPPXZ.js +0 -2
  606. package/dist/bin/chunks/sha256sum-BM3AFTIE.js +0 -2
  607. package/dist/bin/chunks/sort-QF3YLXRW.js +0 -16
  608. package/dist/bin/chunks/split-7UP7EATZ.js +0 -16
  609. package/dist/bin/chunks/stat-ZZVPXHLF.js +0 -9
  610. package/dist/bin/chunks/strings-ZEKN6D4Q.js +0 -14
  611. package/dist/bin/chunks/tac-KNRFDAY7.js +0 -9
  612. package/dist/bin/chunks/tail-YAUIERGN.js +0 -2
  613. package/dist/bin/chunks/tee-XSKPK43X.js +0 -3
  614. package/dist/bin/chunks/timeout-JED4EKFH.js +0 -12
  615. package/dist/bin/chunks/touch-IBPHJBM3.js +0 -7
  616. package/dist/bin/chunks/tree-WC3AXFHC.js +0 -12
  617. package/dist/bin/chunks/true-OVATH2SQ.js +0 -2
  618. package/dist/bin/chunks/unexpand-BFVYAPOU.js +0 -11
  619. package/dist/bin/chunks/uniq-NNXAFO6D.js +0 -5
  620. package/dist/bin/chunks/wc-CZ2TD6T6.js +0 -6
  621. package/dist/bin/chunks/which-5QEJAXNR.js +0 -3
  622. package/dist/bin/chunks/whoami-JVLUNKSG.js +0 -3
  623. package/dist/bin/chunks/xargs-IWT2HHEA.js +0 -5
  624. package/dist/bin/shell/chunks/alias-MGDOL4KG.js +0 -7
  625. package/dist/bin/shell/chunks/awk2-OKD2P6CM.js +0 -21
  626. package/dist/bin/shell/chunks/base64-43KPK6TL.js +0 -6
  627. package/dist/bin/shell/chunks/basename-SO5MVUEX.js +0 -6
  628. package/dist/bin/shell/chunks/bash-OAUBNRSG.js +0 -6
  629. package/dist/bin/shell/chunks/cat-HNXE2ES2.js +0 -6
  630. package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +0 -9
  631. package/dist/bin/shell/chunks/chunk-2ODUA7YH.js +0 -74
  632. package/dist/bin/shell/chunks/clear-CI7A5IXQ.js +0 -2
  633. package/dist/bin/shell/chunks/column-HQ4AK5DM.js +0 -8
  634. package/dist/bin/shell/chunks/comm-CPIFQTKY.js +0 -13
  635. package/dist/bin/shell/chunks/cp-VFXCUKXO.js +0 -8
  636. package/dist/bin/shell/chunks/cut-IHF6BEOO.js +0 -6
  637. package/dist/bin/shell/chunks/date-IQLPMFYI.js +0 -5
  638. package/dist/bin/shell/chunks/diff-ZGXLP3DN.js +0 -19
  639. package/dist/bin/shell/chunks/dirname-EES7TR26.js +0 -5
  640. package/dist/bin/shell/chunks/du-PECPOFQT.js +0 -8
  641. package/dist/bin/shell/chunks/echo-7I42V66Q.js +0 -4
  642. package/dist/bin/shell/chunks/env-W6IMQ43Y.js +0 -9
  643. package/dist/bin/shell/chunks/expand-77K5HH2M.js +0 -11
  644. package/dist/bin/shell/chunks/expr-433HIVAI.js +0 -5
  645. package/dist/bin/shell/chunks/find-KHOYETRP.js +0 -11
  646. package/dist/bin/shell/chunks/fold-452R4I2C.js +0 -12
  647. package/dist/bin/shell/chunks/grep-BD56656Z.js +0 -9
  648. package/dist/bin/shell/chunks/gzip-5ILPB46W.js +0 -32
  649. package/dist/bin/shell/chunks/head-TJHLLIMR.js +0 -2
  650. package/dist/bin/shell/chunks/help-L43ENI4H.js +0 -16
  651. package/dist/bin/shell/chunks/history-56DL6SXU.js +0 -3
  652. package/dist/bin/shell/chunks/hostname-WXDKRL2Z.js +0 -3
  653. package/dist/bin/shell/chunks/join-3IXMEGNA.js +0 -14
  654. package/dist/bin/shell/chunks/jq-EIPK4SZA.js +0 -13
  655. package/dist/bin/shell/chunks/ln-EFFNQ3RY.js +0 -10
  656. package/dist/bin/shell/chunks/ls-5LN47VHU.js +0 -26
  657. package/dist/bin/shell/chunks/md5sum-VHPDBIVV.js +0 -2
  658. package/dist/bin/shell/chunks/mkdir-XMSNS6S5.js +0 -7
  659. package/dist/bin/shell/chunks/mv-P4KHB27X.js +0 -7
  660. package/dist/bin/shell/chunks/od-KRKGC2U3.js +0 -5
  661. package/dist/bin/shell/chunks/paste-UCH462KK.js +0 -8
  662. package/dist/bin/shell/chunks/printf-4W7NDLLV.js +0 -15
  663. package/dist/bin/shell/chunks/pwd-L26WH2K4.js +0 -3
  664. package/dist/bin/shell/chunks/readlink-VL3R4LAM.js +0 -7
  665. package/dist/bin/shell/chunks/rev-VP42N2JN.js +0 -7
  666. package/dist/bin/shell/chunks/rm-S7ASVG34.js +0 -8
  667. package/dist/bin/shell/chunks/seq-AVK43XM2.js +0 -7
  668. package/dist/bin/shell/chunks/sha1sum-4SVNPPXZ.js +0 -2
  669. package/dist/bin/shell/chunks/sha256sum-BM3AFTIE.js +0 -2
  670. package/dist/bin/shell/chunks/sort-QF3YLXRW.js +0 -16
  671. package/dist/bin/shell/chunks/split-7UP7EATZ.js +0 -16
  672. package/dist/bin/shell/chunks/stat-ZZVPXHLF.js +0 -9
  673. package/dist/bin/shell/chunks/strings-ZEKN6D4Q.js +0 -14
  674. package/dist/bin/shell/chunks/tac-KNRFDAY7.js +0 -9
  675. package/dist/bin/shell/chunks/tail-YAUIERGN.js +0 -2
  676. package/dist/bin/shell/chunks/tee-XSKPK43X.js +0 -3
  677. package/dist/bin/shell/chunks/timeout-JED4EKFH.js +0 -12
  678. package/dist/bin/shell/chunks/touch-IBPHJBM3.js +0 -7
  679. package/dist/bin/shell/chunks/tree-WC3AXFHC.js +0 -12
  680. package/dist/bin/shell/chunks/true-OVATH2SQ.js +0 -2
  681. package/dist/bin/shell/chunks/unexpand-BFVYAPOU.js +0 -11
  682. package/dist/bin/shell/chunks/uniq-NNXAFO6D.js +0 -5
  683. package/dist/bin/shell/chunks/wc-CZ2TD6T6.js +0 -6
  684. package/dist/bin/shell/chunks/which-5QEJAXNR.js +0 -3
  685. package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +0 -3
  686. package/dist/bin/shell/chunks/xargs-IWT2HHEA.js +0 -5
  687. package/dist/bundle/chunks/alias-YGOORMWI.js +0 -6
  688. package/dist/bundle/chunks/awk2-YNEKUV4T.js +0 -20
  689. package/dist/bundle/chunks/base64-2JFR3HGT.js +0 -5
  690. package/dist/bundle/chunks/basename-CFA5ZIGT.js +0 -5
  691. package/dist/bundle/chunks/bash-BYWM5OPC.js +0 -5
  692. package/dist/bundle/chunks/cat-GPKR7D6K.js +0 -5
  693. package/dist/bundle/chunks/chmod-ODWUR7E6.js +0 -8
  694. package/dist/bundle/chunks/chunk-2AON5K3E.js +0 -73
  695. package/dist/bundle/chunks/clear-VT2LJIDX.js +0 -1
  696. package/dist/bundle/chunks/column-R6OLMEUA.js +0 -7
  697. package/dist/bundle/chunks/comm-AXQM7FFF.js +0 -12
  698. package/dist/bundle/chunks/cp-NJSENVKC.js +0 -7
  699. package/dist/bundle/chunks/cut-NVKWEAZF.js +0 -5
  700. package/dist/bundle/chunks/date-PN3CMG7K.js +0 -4
  701. package/dist/bundle/chunks/diff-ELUS3RW7.js +0 -6
  702. package/dist/bundle/chunks/dirname-YPJLCQYA.js +0 -4
  703. package/dist/bundle/chunks/du-T4JUAAB2.js +0 -7
  704. package/dist/bundle/chunks/echo-6S7WE7XB.js +0 -3
  705. package/dist/bundle/chunks/env-M3AXY56V.js +0 -8
  706. package/dist/bundle/chunks/expand-VSTNOVF5.js +0 -10
  707. package/dist/bundle/chunks/expr-YSFDPKPV.js +0 -4
  708. package/dist/bundle/chunks/find-WTVSUXL3.js +0 -10
  709. package/dist/bundle/chunks/fold-6CFXIPYZ.js +0 -11
  710. package/dist/bundle/chunks/grep-UTH3KDWL.js +0 -8
  711. package/dist/bundle/chunks/gzip-4P4KGYT5.js +0 -31
  712. package/dist/bundle/chunks/head-SA7P5NJ7.js +0 -1
  713. package/dist/bundle/chunks/help-UD3E73G5.js +0 -15
  714. package/dist/bundle/chunks/history-TMBGOQO6.js +0 -2
  715. package/dist/bundle/chunks/hostname-NWR32CGF.js +0 -2
  716. package/dist/bundle/chunks/html-to-markdown-ZK6GQVSL.js +0 -4
  717. package/dist/bundle/chunks/join-X3QYPZUA.js +0 -13
  718. package/dist/bundle/chunks/jq-6U2TPE6U.js +0 -12
  719. package/dist/bundle/chunks/ln-Y7YB677N.js +0 -9
  720. package/dist/bundle/chunks/ls-PUJHEPXS.js +0 -23
  721. package/dist/bundle/chunks/md5sum-TGZPGVOK.js +0 -1
  722. package/dist/bundle/chunks/mkdir-SF2UE4KB.js +0 -6
  723. package/dist/bundle/chunks/mv-JPBZPM4O.js +0 -6
  724. package/dist/bundle/chunks/od-3FPDPLWJ.js +0 -4
  725. package/dist/bundle/chunks/paste-QAP6Y75J.js +0 -7
  726. package/dist/bundle/chunks/pwd-S4NVAMC4.js +0 -2
  727. package/dist/bundle/chunks/readlink-EM4O3U4P.js +0 -6
  728. package/dist/bundle/chunks/rev-FKUV5GH5.js +0 -6
  729. package/dist/bundle/chunks/rm-MJFRIDNT.js +0 -7
  730. package/dist/bundle/chunks/seq-5VRIVQYP.js +0 -6
  731. package/dist/bundle/chunks/sha1sum-37LOTSQP.js +0 -1
  732. package/dist/bundle/chunks/sha256sum-I4J5BPZA.js +0 -1
  733. package/dist/bundle/chunks/sleep-AK4QE4WR.js +0 -9
  734. package/dist/bundle/chunks/sort-LT2PE47K.js +0 -15
  735. package/dist/bundle/chunks/split-LGSGJHV5.js +0 -15
  736. package/dist/bundle/chunks/stat-IOLJTP7U.js +0 -8
  737. package/dist/bundle/chunks/strings-LRU5XCFP.js +0 -13
  738. package/dist/bundle/chunks/tac-2X4JLF4W.js +0 -8
  739. package/dist/bundle/chunks/tail-52LRAWXT.js +0 -1
  740. package/dist/bundle/chunks/tee-4KHTWVWB.js +0 -2
  741. package/dist/bundle/chunks/timeout-X3X3N6IE.js +0 -11
  742. package/dist/bundle/chunks/touch-TDTEBHHI.js +0 -6
  743. package/dist/bundle/chunks/tree-UFVZH4SS.js +0 -11
  744. package/dist/bundle/chunks/true-CNJ54NE6.js +0 -1
  745. package/dist/bundle/chunks/unexpand-I7A2VXFD.js +0 -10
  746. package/dist/bundle/chunks/uniq-XBP4SJA3.js +0 -4
  747. package/dist/bundle/chunks/wc-VDPK3LVS.js +0 -5
  748. package/dist/bundle/chunks/which-GF77XMJD.js +0 -2
  749. package/dist/bundle/chunks/whoami-YUDAIS32.js +0 -2
  750. package/dist/bundle/chunks/xargs-4FRA6OJ7.js +0 -4
@@ -0,0 +1,4 @@
1
+ import{a as A,b as I,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"]},N={name:"xargs",async execute(l,i){if(I(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 r;if(h?r=i.stdin.split("\0").filter(e=>e.length>0):g!==null?r=i.stdin.replace(/\n$/,"").split(g).filter(t=>t.length>0):r=i.stdin.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0),r.length===0)return y?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",u="",f=0,v=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,"\\$1")}"`:e,C=async e=>{let t=e.map(v).join(" ");return x&&(u+=`${t}
3
+ `),i.exec?i.exec(t,{cwd:i.cwd}):{stdout:`${t}
4
+ `,stderr:"",exitCode:0}},w=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=r.map(t=>a.map(n=>n.replaceAll(m,t)));await w(e)}else if(c!==null){let e=[];for(let t=0;t<r.length;t+=c){let n=r.slice(t,t+c);e.push([...a,...n])}await w(e)}else{let e=[...a,...r],t=await C(e);d+=t.stdout,u+=t.stderr,f=t.exitCode}return{stdout:d,stderr:u,exitCode:f}}},P={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{N as a,P as b};
@@ -0,0 +1,6 @@
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};
@@ -0,0 +1,4 @@
1
+ import{a}from"./chunk-YNYSPYQ5.js";var w={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand
2
+ `,exitCode:2};try{let l=d(s),h=l==="0"||l===""?1:0;return{stdout:`${l}
3
+ `,stderr:"",exitCode:h}}catch(l){return{stdout:"",stderr:`expr: ${l.message}
4
+ `,exitCode:2}}}};function d(s){if(s.length===1)return s[0];let r=0;function l(){let e=h();for(;r<s.length&&s[r]==="|";){r++;let t=h();if(e!=="0"&&e!=="")return e;e=t}return e}function h(){let e=m();for(;r<s.length&&s[r]==="&";){r++;let t=m();(e==="0"||e===""||t==="0"||t==="")&&(e="0")}return e}function m(){let e=p();for(;r<s.length;){let t=s[r];if(["=","!=","<",">","<=",">="].includes(t)){r++;let o=p(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),c;t==="="?c=f?n===i:e===o:t==="!="?c=f?n!==i:e!==o:t==="<"?c=f?n<i:e<o:t===">"?c=f?n>i:e>o:t==="<="?c=f?n<=i:e<=o:c=f?n>=i:e>=o,e=c?"1":"0"}else break}return e}function p(){let e=g();for(;r<s.length;){let t=s[r];if(t==="+"||t==="-"){r++;let o=g(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");e=String(t==="+"?n+i:n-i)}else break}return e}function g(){let e=N();for(;r<s.length;){let t=s[r];if(t==="*"||t==="/"||t==="%"){r++;let o=N(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");if((t==="/"||t==="%")&&i===0)throw new Error("division by zero");t==="*"?e=String(n*i):t==="/"?e=String(Math.trunc(n/i)):e=String(n%i)}else break}return e}function N(){let e=u();for(;r<s.length&&s[r]===":";){r++;let t=u(),n=a(`^${t}`).match(e);n?e=n[1]!==void 0?n[1]:String(n[0].length):e="0"}return e}function u(){if(r>=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),i=a(o).match(t);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n<t.length;n++)if(o.includes(t[n]))return String(n+1);return"0"}if(e==="length"){r++;let t=u();return String(t.length)}if(e==="("){r++;let t=l();if(r>=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return l()}var b={name:"expr",flags:[],needsArgs:!0};export{w as a,b};
@@ -1,17 +1,17 @@
1
- import{a as O,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB.js";import{a as et}from"./chunk-SYMJJMQ4.js";import{a as $}from"./chunk-WQCJYUEW.js";import{d as G}from"./chunk-7MKBHGLS.js";import"./chunk-OJDRYQWQ.js";import"./chunk-PSW6BMXW.js";import{a as H}from"./chunk-YNYSPYQ5.js";import{a as We}from"./chunk-7L36YK2X.js";import"./chunk-NUFRM6SI.js";import{a as D,b as K}from"./chunk-74CEPOFO.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-DXB73IDG.js";var q,_e=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===`
1
+ import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB.js";import{a as et}from"./chunk-SYMJJMQ4.js";import{a as $}from"./chunk-RSXSWZBQ.js";import{d as G}from"./chunk-7MKBHGLS.js";import{a as H}from"./chunk-YNYSPYQ5.js";import{a as We}from"./chunk-7L36YK2X.js";import{a as D,b as K}from"./chunk-74CEPOFO.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-DXB73IDG.js";var q,_e=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
2
  `||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
3
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 He={};Be(He,{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";_e();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 B={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=>Je(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 Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};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 tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=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(B,e.name)?B[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 ze(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(ze(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 ze(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 Ke(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
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 He={};Be(He,{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";_e();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 B={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=>Je(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 Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};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 tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(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=>O(r.expr,n)),s=Object.hasOwn(B,e.name)?B[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=O(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:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(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 ze(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=O(_(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(ze(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 ze(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 Ke(e,n,t={}){let s=F();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
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=Ke(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 Ge(e){let n=_(e);return F(n)}function nt(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function z(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=z(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=nt(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=z(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(z(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(`
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=F();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 Ge(e){let n=_(e);return O(n)}function nt(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function z(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=z(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=nt(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=z(t,r),u=o.map(p=>{let l=F();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(z(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=F();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=F();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=F();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
10
  `)}
11
11
  `:`${s.map((i,h)=>`${h} ${i}`).join(`
12
12
  `)}
13
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=Ze(et(),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
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=Ze(et(),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=F();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
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
16
  `)}
17
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
@@ -31,22 +31,22 @@ import{a as O,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB
31
31
  `,exitCode:1}}async function rt(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
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
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
34
+ `,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=F();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
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
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=Ge(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(G(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]
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:O(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(G(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
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(),Qe(He)).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(G(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]
39
+ `,exitCode:1};let f=O(V(s)[0]?.expr||(U(),Qe(He)).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(G(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 Fe(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
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]
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 Oe(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
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
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
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
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]
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=F();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=F();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=F();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
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
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,ot(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function ot(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 ...
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=F();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,ot(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function ot(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
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
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
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=>it(p)).join(",")).join(`
@@ -55,10 +55,10 @@ import{a as O,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB
55
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
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
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}=qe(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
58
+ `,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=F();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
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
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 Ye=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),at=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",...Ye]),Xe={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.
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:O(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 Ye=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),at=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",...Ye]),Xe={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
62
  It provides a simple, ergonomic interface for common data operations.
63
63
 
64
64
  COMMANDS:
@@ -133,7 +133,7 @@ EXAMPLES:
133
133
  xan explode tags data.csv
134
134
  xan join id file1.csv id file2.csv
135
135
  xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},lt={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"]}},cn={name:"xan",async execute(e,n){if(e.length===0||K(e))return D(Xe);let t=e[0],s=e.slice(1);if(K(s)){let r=lt[t];return r?D(r):D(Xe)}if(Ye.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 Y(s,n);case"flatten":case"f":return X(s,n);case"fmt":return Ve(s,n);default:return at.has(t)?{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 Fe(s,n);case"implode":return Oe(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 Y(s,n);case"flatten":case"f":return X(s,n);case"fmt":return Ve(s,n);default:return at.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
137
137
  `,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
138
138
  Run 'xan --help' for usage.
139
- `,exitCode:1}}}};export{cn as xanCommand};
139
+ `,exitCode:1}}}},pn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{cn as a,pn as b};
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-HWKDQ44K.js";import{a as f,b as h}from"./chunk-74CEPOFO.js";var g={name:"which",summary:"locate a command",usage:"which [-as] program ...",options:["-a List all instances of executables found","-s No output, just return 0 if found, 1 if not","--help display this help and exit"]},w={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(e,s){if(h(e))return f(g);let t=u("which",e,w);if(!t.ok)return t.error;let c=t.result.flags.showAll,p=t.result.flags.silent,o=t.result.positional;if(o.length===0)return{stdout:"",stderr:"",exitCode:1};let d=(s.env.get("PATH")||"/usr/bin:/bin").split(":"),n="",a=!0;for(let m of o){let l=!1;for(let r of d){if(!r)continue;let i=`${r}/${m}`;if(await s.fs.exists(i)&&(l=!0,p||(n+=`${i}
2
+ `),!c))break}l||(a=!1)}return{stdout:n,stderr:"",exitCode:a?0:1}}},F={name:"which",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"boolean"}],needsArgs:!0};export{A as a,F as b};
@@ -0,0 +1,10 @@
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};
@@ -0,0 +1,6 @@
1
+ import{a as r,b as u}from"./chunk-74CEPOFO.js";var d={name:"alias",summary:"define or display aliases",usage:"alias [name[=value] ...]",options:[" --help display this help and exit"]},o="BASH_ALIAS_",m={name:"alias",async execute(e,a){if(u(e))return r(d);if(e.length===0){let s="";for(let[i,t]of a.env)if(i.startsWith(o)){let n=i.slice(o.length);s+=`alias ${n}='${t}'
2
+ `}return{stdout:s,stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e;for(let s of l){let i=s.indexOf("=");if(i===-1){let t=o+s;return a.env.get(t)?{stdout:`alias ${s}='${a.env.get(t)}'
3
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:`alias: ${s}: not found
4
+ `,exitCode:1}}else{let t=s.slice(0,i),n=s.slice(i+1);(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))&&(n=n.slice(1,-1)),a.env.set(o+t,n)}}return{stdout:"",stderr:"",exitCode:0}}},c={name:"unalias",async execute(e,a){if(u(e))return r({name:"unalias",summary:"remove alias definitions",usage:"unalias name [name ...]",options:["-a remove all aliases"," --help display this help and exit"]});if(e.length===0)return{stdout:"",stderr:`unalias: usage: unalias [-a] name [name ...]
5
+ `,exitCode:1};if(e[0]==="-a"){for(let t of a.env.keys())t.startsWith(o)&&a.env.delete(t);return{stdout:"",stderr:"",exitCode:0}}let l=e[0]==="--"?e.slice(1):e,s=!1,i="";for(let t of l){let n=o+t;a.env.get(n)?a.env.delete(n):(i+=`unalias: ${t}: not found
6
+ `,s=!0)}return{stdout:"",stderr:i,exitCode:s?1:0}}},p={name:"alias",flags:[]},h={name:"unalias",flags:[{flag:"-a",type:"boolean"}]};export{m as a,c as b,p as c,h as d};