just-bash 2.7.0 → 2.7.1

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 (165) hide show
  1. package/dist/bin/chunks/alias-MGDOL4KG.js +7 -0
  2. package/dist/bin/chunks/awk2-ASLLINAN.js +21 -0
  3. package/dist/bin/{shell/chunks/base64-O7TCK5TL.js → chunks/base64-43KPK6TL.js} +1 -1
  4. package/dist/bin/chunks/bash-OAUBNRSG.js +6 -0
  5. package/dist/bin/{shell/chunks/cat-AJXZOSPN.js → chunks/cat-HNXE2ES2.js} +1 -1
  6. package/dist/bin/chunks/chunk-4PRVMER6.js +2 -0
  7. package/dist/bin/chunks/chunk-C6FK2JV3.js +74 -0
  8. package/dist/bin/chunks/chunk-GZHFXDDO.js +10 -0
  9. package/dist/bin/chunks/chunk-JBABAK44.js +4 -0
  10. package/dist/bin/chunks/chunk-YNACG4DZ.js +6 -0
  11. package/dist/bin/chunks/{column-TSFEMTG6.js → column-HQ4AK5DM.js} +1 -1
  12. package/dist/bin/chunks/{cp-XXWRVG2D.js → cp-VFXCUKXO.js} +1 -1
  13. package/dist/bin/chunks/{curl-TH7YRBSA.js → curl-7IUASLUJ.js} +1 -1
  14. package/dist/bin/chunks/{diff-GI3QVUGD.js → diff-ZGXLP3DN.js} +1 -1
  15. package/dist/bin/chunks/{du-XQPYLN3H.js → du-PECPOFQT.js} +1 -1
  16. package/dist/bin/chunks/env-W6IMQ43Y.js +9 -0
  17. package/dist/bin/chunks/{expansion-BOR3ELLC.js → expansion-IEMZ6T22.js} +1 -1
  18. package/dist/bin/{shell/chunks/gzip-YXK3WZQL.js → chunks/gzip-5ILPB46W.js} +1 -1
  19. package/dist/bin/chunks/history-56DL6SXU.js +3 -0
  20. package/dist/bin/{shell/chunks/jq-RGZHJNXC.js → chunks/jq-M2WXBRXF.js} +1 -1
  21. package/dist/bin/chunks/{ls-BEHQBUMC.js → ls-5LN47VHU.js} +1 -1
  22. package/dist/bin/chunks/{mkdir-XJABRAUN.js → mkdir-XMSNS6S5.js} +1 -1
  23. package/dist/bin/chunks/{mv-3ATZ2ABL.js → mv-P4KHB27X.js} +1 -1
  24. package/dist/bin/chunks/{paste-FT6WBQZG.js → paste-UCH462KK.js} +1 -1
  25. package/dist/bin/{shell/chunks/printf-YPXD4CRE.js → chunks/printf-XPBSFXJE.js} +1 -1
  26. package/dist/bin/{shell/chunks/python3-JGT65AEB.js → chunks/python3-ZWX5SFJ3.js} +5 -5
  27. package/dist/bin/{shell/chunks/rm-2PKAWTSQ.js → chunks/rm-S7ASVG34.js} +1 -1
  28. package/dist/bin/chunks/{rmdir-GOODLY5W.js → rmdir-OEMA5ZTD.js} +1 -1
  29. package/dist/bin/chunks/{stat-UEQ7KMY5.js → stat-ZZVPXHLF.js} +1 -1
  30. package/dist/bin/{shell/chunks/tee-ZFIT2GTM.js → chunks/tee-XSKPK43X.js} +1 -1
  31. package/dist/bin/chunks/time-F4NVQOJH.js +14 -0
  32. package/dist/bin/chunks/{tr-MBLEXZBI.js → tr-FMT6JWLE.js} +1 -1
  33. package/dist/bin/chunks/{tree-DQBEJH47.js → tree-WC3AXFHC.js} +1 -1
  34. package/dist/bin/chunks/{uniq-IXHB2FVS.js → uniq-NNXAFO6D.js} +1 -1
  35. package/dist/bin/{shell/chunks/wc-SAOHEZYP.js → chunks/wc-CZ2TD6T6.js} +1 -1
  36. package/dist/bin/{shell/chunks/which-FCDFBOMN.js → chunks/which-5QEJAXNR.js} +1 -1
  37. package/dist/bin/chunks/xan-OPVCJ3ZA.js +140 -0
  38. package/dist/bin/chunks/{xan-view-6Z6TWXMY.js → xan-view-5SZBYPLG.js} +1 -1
  39. package/dist/bin/chunks/{yq-PFV4T2PV.js → yq-JU6VN4X4.js} +1 -1
  40. package/dist/bin/just-bash.js +251 -251
  41. package/dist/bin/shell/chunks/alias-MGDOL4KG.js +7 -0
  42. package/dist/bin/shell/chunks/awk2-ASLLINAN.js +21 -0
  43. package/dist/bin/{chunks/base64-O7TCK5TL.js → shell/chunks/base64-43KPK6TL.js} +1 -1
  44. package/dist/bin/shell/chunks/bash-OAUBNRSG.js +6 -0
  45. package/dist/bin/{chunks/cat-AJXZOSPN.js → shell/chunks/cat-HNXE2ES2.js} +1 -1
  46. package/dist/bin/shell/chunks/chunk-4PRVMER6.js +2 -0
  47. package/dist/bin/shell/chunks/chunk-C6FK2JV3.js +74 -0
  48. package/dist/bin/shell/chunks/chunk-GZHFXDDO.js +10 -0
  49. package/dist/bin/shell/chunks/chunk-JBABAK44.js +4 -0
  50. package/dist/bin/shell/chunks/chunk-YNACG4DZ.js +6 -0
  51. package/dist/bin/shell/chunks/{column-TSFEMTG6.js → column-HQ4AK5DM.js} +1 -1
  52. package/dist/bin/shell/chunks/{cp-XXWRVG2D.js → cp-VFXCUKXO.js} +1 -1
  53. package/dist/bin/shell/chunks/{curl-TH7YRBSA.js → curl-7IUASLUJ.js} +1 -1
  54. package/dist/bin/shell/chunks/{diff-GI3QVUGD.js → diff-ZGXLP3DN.js} +1 -1
  55. package/dist/bin/shell/chunks/{du-XQPYLN3H.js → du-PECPOFQT.js} +1 -1
  56. package/dist/bin/shell/chunks/env-W6IMQ43Y.js +9 -0
  57. package/dist/bin/shell/chunks/{expansion-BOR3ELLC.js → expansion-IEMZ6T22.js} +1 -1
  58. package/dist/bin/{chunks/gzip-YXK3WZQL.js → shell/chunks/gzip-5ILPB46W.js} +1 -1
  59. package/dist/bin/shell/chunks/history-56DL6SXU.js +3 -0
  60. package/dist/bin/{chunks/jq-RGZHJNXC.js → shell/chunks/jq-M2WXBRXF.js} +1 -1
  61. package/dist/bin/shell/chunks/{ls-BEHQBUMC.js → ls-5LN47VHU.js} +1 -1
  62. package/dist/bin/shell/chunks/{mkdir-XJABRAUN.js → mkdir-XMSNS6S5.js} +1 -1
  63. package/dist/bin/shell/chunks/{mv-3ATZ2ABL.js → mv-P4KHB27X.js} +1 -1
  64. package/dist/bin/shell/chunks/{paste-FT6WBQZG.js → paste-UCH462KK.js} +1 -1
  65. package/dist/bin/{chunks/printf-YPXD4CRE.js → shell/chunks/printf-XPBSFXJE.js} +1 -1
  66. package/dist/bin/{chunks/python3-JGT65AEB.js → shell/chunks/python3-ZWX5SFJ3.js} +5 -5
  67. package/dist/bin/{chunks/rm-2PKAWTSQ.js → shell/chunks/rm-S7ASVG34.js} +1 -1
  68. package/dist/bin/shell/chunks/{rmdir-GOODLY5W.js → rmdir-OEMA5ZTD.js} +1 -1
  69. package/dist/bin/shell/chunks/{stat-UEQ7KMY5.js → stat-ZZVPXHLF.js} +1 -1
  70. package/dist/bin/{chunks/tee-ZFIT2GTM.js → shell/chunks/tee-XSKPK43X.js} +1 -1
  71. package/dist/bin/shell/chunks/time-F4NVQOJH.js +14 -0
  72. package/dist/bin/shell/chunks/{tr-MBLEXZBI.js → tr-FMT6JWLE.js} +1 -1
  73. package/dist/bin/shell/chunks/{tree-DQBEJH47.js → tree-WC3AXFHC.js} +1 -1
  74. package/dist/bin/shell/chunks/{uniq-IXHB2FVS.js → uniq-NNXAFO6D.js} +1 -1
  75. package/dist/bin/{chunks/wc-SAOHEZYP.js → shell/chunks/wc-CZ2TD6T6.js} +1 -1
  76. package/dist/bin/{chunks/which-FCDFBOMN.js → shell/chunks/which-5QEJAXNR.js} +1 -1
  77. package/dist/bin/shell/chunks/xan-OPVCJ3ZA.js +140 -0
  78. package/dist/bin/shell/chunks/{xan-view-6Z6TWXMY.js → xan-view-5SZBYPLG.js} +1 -1
  79. package/dist/bin/shell/chunks/{yq-PFV4T2PV.js → yq-JU6VN4X4.js} +1 -1
  80. package/dist/bin/shell/shell.js +226 -226
  81. package/dist/bundle/browser.js +623 -623
  82. package/dist/bundle/chunks/alias-YGOORMWI.js +6 -0
  83. package/dist/bundle/chunks/awk2-5K7HVGCQ.js +20 -0
  84. package/dist/bundle/chunks/{base64-3BME25ON.js → base64-2JFR3HGT.js} +1 -1
  85. package/dist/bundle/chunks/bash-BYWM5OPC.js +5 -0
  86. package/dist/bundle/chunks/{cat-MV4K6AUA.js → cat-GPKR7D6K.js} +1 -1
  87. package/dist/bundle/chunks/chunk-76ZRJPDK.js +73 -0
  88. package/dist/bundle/chunks/chunk-F55TLFGB.js +9 -0
  89. package/dist/bundle/chunks/chunk-HWKDQ44K.js +3 -0
  90. package/dist/bundle/chunks/chunk-IEPFPINK.js +5 -0
  91. package/dist/bundle/chunks/chunk-OJDRYQWQ.js +1 -0
  92. package/dist/bundle/chunks/{column-XPDNNO5Y.js → column-R6OLMEUA.js} +1 -1
  93. package/dist/bundle/chunks/{cp-PBJT3GBF.js → cp-NJSENVKC.js} +1 -1
  94. package/dist/bundle/chunks/{curl-XLP4VABU.js → curl-QDCXHQMX.js} +1 -1
  95. package/dist/bundle/chunks/{diff-ZLJYSBRK.js → diff-ELUS3RW7.js} +1 -1
  96. package/dist/bundle/chunks/{du-NQXEC3EF.js → du-T4JUAAB2.js} +1 -1
  97. package/dist/bundle/chunks/env-M3AXY56V.js +8 -0
  98. package/dist/bundle/chunks/{expansion-RIGCFEMA.js → expansion-DXWR3WZB.js} +1 -1
  99. package/dist/bundle/chunks/{gzip-L3NDJG3F.js → gzip-4P4KGYT5.js} +1 -1
  100. package/dist/bundle/chunks/history-TMBGOQO6.js +2 -0
  101. package/dist/bundle/chunks/{jq-RLRYRPOJ.js → jq-KF5D2PYR.js} +1 -1
  102. package/dist/bundle/chunks/{ls-5W3NU5OJ.js → ls-PUJHEPXS.js} +1 -1
  103. package/dist/bundle/chunks/{mkdir-7UKY4B3B.js → mkdir-SF2UE4KB.js} +1 -1
  104. package/dist/bundle/chunks/{mv-FXHEKRTB.js → mv-JPBZPM4O.js} +1 -1
  105. package/dist/bundle/chunks/{paste-QTGVEPH5.js → paste-QAP6Y75J.js} +1 -1
  106. package/dist/bundle/chunks/{printf-66XGXFCD.js → printf-OAPYPRGV.js} +1 -1
  107. package/dist/bundle/chunks/{python3-3OP7EKER.js → python3-SKZGHYDO.js} +5 -5
  108. package/dist/bundle/chunks/{rm-I2SRVF7H.js → rm-MJFRIDNT.js} +1 -1
  109. package/dist/bundle/chunks/{rmdir-XFQE4ZYV.js → rmdir-DU6C7ZEO.js} +1 -1
  110. package/dist/bundle/chunks/{stat-IVQBBOKN.js → stat-IOLJTP7U.js} +1 -1
  111. package/dist/bundle/chunks/{tee-2QU4NRSJ.js → tee-4KHTWVWB.js} +1 -1
  112. package/dist/bundle/chunks/time-EGF4KTWV.js +13 -0
  113. package/dist/bundle/chunks/{tr-EDGW5FG6.js → tr-P43NRVKL.js} +1 -1
  114. package/dist/bundle/chunks/{tree-MEM64BW3.js → tree-UFVZH4SS.js} +1 -1
  115. package/dist/bundle/chunks/{uniq-47QVBRNC.js → uniq-XBP4SJA3.js} +1 -1
  116. package/dist/bundle/chunks/{wc-HE5XARI4.js → wc-VDPK3LVS.js} +1 -1
  117. package/dist/bundle/chunks/{which-UBLRBDHN.js → which-GF77XMJD.js} +1 -1
  118. package/dist/bundle/chunks/xan-RW5GSH6C.js +139 -0
  119. package/dist/bundle/chunks/{xan-view-DMFUMZG7.js → xan-view-ECQUO7AJ.js} +1 -1
  120. package/dist/bundle/chunks/{yq-L665QPQU.js → yq-EMWRPC7R.js} +1 -1
  121. package/dist/bundle/index.js +253 -253
  122. package/dist/commands/query-engine/evaluator.d.ts +2 -2
  123. package/dist/commands/query-engine/safe-object.d.ts +49 -0
  124. package/dist/commands/query-engine/value-operations.d.ts +1 -0
  125. package/dist/commands/xan/aggregation.d.ts +1 -1
  126. package/dist/commands/xan/csv.d.ts +16 -0
  127. package/dist/interpreter/alias-expansion.d.ts +1 -1
  128. package/dist/interpreter/helpers/ifs.d.ts +4 -4
  129. package/dist/interpreter/simple-command-assignments.d.ts +1 -1
  130. package/dist/interpreter/types.d.ts +2 -2
  131. package/dist/types.d.ts +2 -2
  132. package/package.json +1 -1
  133. package/dist/bin/chunks/alias-EGIS5LUE.js +0 -7
  134. package/dist/bin/chunks/awk2-GFEJOWML.js +0 -21
  135. package/dist/bin/chunks/bash-PGDTHIM2.js +0 -6
  136. package/dist/bin/chunks/chunk-FSAGDARS.js +0 -74
  137. package/dist/bin/chunks/chunk-KD3EODLB.js +0 -6
  138. package/dist/bin/chunks/chunk-TA7RUHGQ.js +0 -4
  139. package/dist/bin/chunks/chunk-UUQYHLBO.js +0 -10
  140. package/dist/bin/chunks/env-7A4MH7BJ.js +0 -9
  141. package/dist/bin/chunks/history-G5C2J2OY.js +0 -3
  142. package/dist/bin/chunks/time-37F5EBPK.js +0 -14
  143. package/dist/bin/chunks/xan-5HNHTFMB.js +0 -140
  144. package/dist/bin/shell/chunks/alias-EGIS5LUE.js +0 -7
  145. package/dist/bin/shell/chunks/awk2-GFEJOWML.js +0 -21
  146. package/dist/bin/shell/chunks/bash-PGDTHIM2.js +0 -6
  147. package/dist/bin/shell/chunks/chunk-FSAGDARS.js +0 -74
  148. package/dist/bin/shell/chunks/chunk-KD3EODLB.js +0 -6
  149. package/dist/bin/shell/chunks/chunk-TA7RUHGQ.js +0 -4
  150. package/dist/bin/shell/chunks/chunk-UUQYHLBO.js +0 -10
  151. package/dist/bin/shell/chunks/env-7A4MH7BJ.js +0 -9
  152. package/dist/bin/shell/chunks/history-G5C2J2OY.js +0 -3
  153. package/dist/bin/shell/chunks/time-37F5EBPK.js +0 -14
  154. package/dist/bin/shell/chunks/xan-5HNHTFMB.js +0 -140
  155. package/dist/bundle/chunks/alias-ATFBB6D2.js +0 -6
  156. package/dist/bundle/chunks/awk2-6FBZTP57.js +0 -20
  157. package/dist/bundle/chunks/bash-OLRNM52U.js +0 -5
  158. package/dist/bundle/chunks/chunk-3AWP5CWK.js +0 -73
  159. package/dist/bundle/chunks/chunk-A263W2RD.js +0 -9
  160. package/dist/bundle/chunks/chunk-CZPA5RBA.js +0 -5
  161. package/dist/bundle/chunks/chunk-ZVV5VXYZ.js +0 -3
  162. package/dist/bundle/chunks/env-2UI6XINU.js +0 -8
  163. package/dist/bundle/chunks/history-MQDK2OPD.js +0 -2
  164. package/dist/bundle/chunks/time-UWXBG6CS.js +0 -13
  165. package/dist/bundle/chunks/xan-A6VPI4HJ.js +0 -139
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import{a as y,b as D}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as x}from"node:url";import{Worker as L}from"node:worker_threads";var a={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},n={PENDING:0,READY:1,SUCCESS:2,ERROR:3},u={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},i={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},R={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},h={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function C(){return new SharedArrayBuffer(p.TOTAL)}var w=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return Atomics.load(this.int32View,i.OP_CODE/4)}setOpCode(t){Atomics.store(this.int32View,i.OP_CODE/4,t)}getStatus(){return Atomics.load(this.int32View,i.STATUS/4)}setStatus(t){Atomics.store(this.int32View,i.STATUS/4,t)}getPathLength(){return Atomics.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){Atomics.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return Atomics.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){Atomics.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return Atomics.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){Atomics.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return Atomics.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){Atomics.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return Atomics.load(this.int32View,i.FLAGS/4)}setFlags(t){Atomics.store(this.int32View,i.FLAGS/4,t)}getMode(){return Atomics.load(this.int32View,i.MODE/4)}setMode(t){Atomics.store(this.int32View,i.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(i.PATH_BUFFER,i.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,i.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[i.DATA_BUFFER+h.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+h.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+h.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+h.MTIME,t.mtime.getTime(),!0),this.setResultLength(h.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+h.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+h.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+h.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+h.MTIME,!0))}}waitForReady(t){return Atomics.wait(this.int32View,i.STATUS/4,n.PENDING,t)}waitForReadyAsync(t){return Atomics.waitAsync(this.int32View,i.STATUS/4,n.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===n.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let l=t-o,d=Atomics.waitAsync(this.int32View,i.STATUS/4,s,l);if(d.async&&await d.value==="timed-out")return!1}}waitForResult(t){return Atomics.wait(this.int32View,i.STATUS/4,n.READY,t)}notify(){return Atomics.notify(this.int32View,i.STATUS/4)}reset(){this.setOpCode(a.NOOP),this.setStatus(n.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(u.NONE),this.setFlags(R.NONE),this.setMode(0)}};var A=class{fs;cwd;secureFetch;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};constructor(t,e,s,o=void 0){this.fs=e,this.cwd=s,this.secureFetch=o,this.protocol=new w(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
2
+ import{a as C}from"./chunk-4PRVMER6.js";import{a as y,b as D}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as L}from"node:url";import{Worker as N}from"node:worker_threads";var a={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},n={PENDING:0,READY:1,SUCCESS:2,ERROR:3},u={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},i={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},p={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},R={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},h={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function O(){return new SharedArrayBuffer(p.TOTAL)}var w=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return Atomics.load(this.int32View,i.OP_CODE/4)}setOpCode(t){Atomics.store(this.int32View,i.OP_CODE/4,t)}getStatus(){return Atomics.load(this.int32View,i.STATUS/4)}setStatus(t){Atomics.store(this.int32View,i.STATUS/4,t)}getPathLength(){return Atomics.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){Atomics.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return Atomics.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){Atomics.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return Atomics.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){Atomics.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return Atomics.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){Atomics.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return Atomics.load(this.int32View,i.FLAGS/4)}setFlags(t){Atomics.store(this.int32View,i.FLAGS/4,t)}getMode(){return Atomics.load(this.int32View,i.MODE/4)}setMode(t){Atomics.store(this.int32View,i.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(i.PATH_BUFFER,i.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>p.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${p.PATH_BUFFER}`);this.uint8View.set(e,i.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setData(t){if(t.length>p.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setResult(t){if(t.length>p.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${p.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[i.DATA_BUFFER+h.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+h.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+h.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+h.MTIME,t.mtime.getTime(),!0),this.setResultLength(h.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+h.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+h.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+h.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+h.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+h.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+h.MTIME,!0))}}waitForReady(t){return Atomics.wait(this.int32View,i.STATUS/4,n.PENDING,t)}waitForReadyAsync(t){return Atomics.waitAsync(this.int32View,i.STATUS/4,n.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===n.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let l=t-o,d=Atomics.waitAsync(this.int32View,i.STATUS/4,s,l);if(d.async&&await d.value==="timed-out")return!1}}waitForResult(t){return Atomics.wait(this.int32View,i.STATUS/4,n.READY,t)}notify(){return Atomics.notify(this.int32View,i.STATUS/4)}reset(){this.setOpCode(a.NOOP),this.setStatus(n.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(u.NONE),this.setFlags(R.NONE),this.setMode(0)}};var A=class{fs;cwd;secureFetch;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};constructor(t,e,s,o=void 0){this.fs=e,this.cwd=s,this.secureFetch=o,this.protocol=new w(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
3
3
  python3: execution timeout exceeded
4
4
  `,this.output.exitCode=124;break}let o=t-s;if(!await this.protocol.waitUntilReady(o)){this.output.stderr+=`
5
5
  python3: execution timeout exceeded
6
- `,this.output.exitCode=124;break}let d=this.protocol.getOpCode();await this.handleOperation(d),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case a.READ_FILE:await this.handleReadFile();break;case a.WRITE_FILE:await this.handleWriteFile();break;case a.STAT:await this.handleStat();break;case a.LSTAT:await this.handleLstat();break;case a.READDIR:await this.handleReaddir();break;case a.MKDIR:await this.handleMkdir();break;case a.RM:await this.handleRm();break;case a.EXISTS:await this.handleExists();break;case a.APPEND_FILE:await this.handleAppendFile();break;case a.SYMLINK:await this.handleSymlink();break;case a.READLINK:await this.handleReadlink();break;case a.CHMOD:await this.handleChmod();break;case a.REALPATH:await this.handleRealpath();break;case a.WRITE_STDOUT:this.handleWriteStdout();break;case a.WRITE_STDERR:this.handleWriteStderr();break;case a.EXIT:this.handleExit();break;case a.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setStatus(n.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return t.startsWith("/mnt/host/")?t.slice(9):t.startsWith("/mnt/host")?t.slice(9)||"/":this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&R.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&R.RECURSIVE)!==0,o=(e&R.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:o}),this.protocol.setStatus(n.SUCCESS)}catch(l){this.setErrorFromException(l)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();this.output.stdout+=t,this.protocol.setStatus(n.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();this.output.stderr+=t,this.protocol.setStatus(n.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.output.exitCode=t,this.protocol.setStatus(n.SUCCESS),this.running=!1}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(n.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},o=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),l=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,body:o.body,url:o.url});this.protocol.setResultFromString(l),this.protocol.setStatus(n.SUCCESS)}catch(s){let o=s instanceof Error?s.message:String(s);this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(o),this.protocol.setStatus(n.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=u.IO_ERROR,o=e.toLowerCase();o.includes("no such file")||o.includes("not found")||o.includes("enoent")?s=u.NOT_FOUND:o.includes("is a directory")||o.includes("eisdir")?s=u.IS_DIRECTORY:o.includes("not a directory")||o.includes("enotdir")?s=u.NOT_DIRECTORY:o.includes("already exists")||o.includes("eexist")?s=u.EXISTS:(o.includes("permission")||o.includes("eperm")||o.includes("eacces"))&&(s=u.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(e),this.protocol.setStatus(n.ERROR)}};var N=3e4,V={name:"python3",summary:"Execute Python code via Pyodide",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using Pyodide (Python compiled to WebAssembly).","","This command runs Python in a sandboxed environment with access to","the virtual filesystem. Only Pyodide-bundled packages are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["Pyodide runs in WebAssembly, so execution may be slower than native Python.","Only packages bundled with Pyodide are available (no pip install).","First execution loads Pyodide (~30MB), subsequent calls are faster.","Maximum execution time is 30 seconds by default."]};function k(r){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(r.length===0)return t;let e=r.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?r.length:e);s++){let o=r[s];if(o==="-c")return s+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
6
+ `,this.output.exitCode=124;break}let d=this.protocol.getOpCode();await this.handleOperation(d),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case a.READ_FILE:await this.handleReadFile();break;case a.WRITE_FILE:await this.handleWriteFile();break;case a.STAT:await this.handleStat();break;case a.LSTAT:await this.handleLstat();break;case a.READDIR:await this.handleReaddir();break;case a.MKDIR:await this.handleMkdir();break;case a.RM:await this.handleRm();break;case a.EXISTS:await this.handleExists();break;case a.APPEND_FILE:await this.handleAppendFile();break;case a.SYMLINK:await this.handleSymlink();break;case a.READLINK:await this.handleReadlink();break;case a.CHMOD:await this.handleChmod();break;case a.REALPATH:await this.handleRealpath();break;case a.WRITE_STDOUT:this.handleWriteStdout();break;case a.WRITE_STDERR:this.handleWriteStderr();break;case a.EXIT:this.handleExit();break;case a.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setStatus(n.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return t.startsWith("/mnt/host/")?t.slice(9):t.startsWith("/mnt/host")?t.slice(9)||"/":this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&R.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&R.RECURSIVE)!==0,o=(e&R.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:o}),this.protocol.setStatus(n.SUCCESS)}catch(l){this.setErrorFromException(l)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(n.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(n.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(n.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();this.output.stdout+=t,this.protocol.setStatus(n.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();this.output.stderr+=t,this.protocol.setStatus(n.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.output.exitCode=t,this.protocol.setStatus(n.SUCCESS),this.running=!1}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(n.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},o=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),l=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,body:o.body,url:o.url});this.protocol.setResultFromString(l),this.protocol.setStatus(n.SUCCESS)}catch(s){let o=s instanceof Error?s.message:String(s);this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(o),this.protocol.setStatus(n.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=u.IO_ERROR,o=e.toLowerCase();o.includes("no such file")||o.includes("not found")||o.includes("enoent")?s=u.NOT_FOUND:o.includes("is a directory")||o.includes("eisdir")?s=u.IS_DIRECTORY:o.includes("not a directory")||o.includes("enotdir")?s=u.NOT_DIRECTORY:o.includes("already exists")||o.includes("eexist")?s=u.EXISTS:(o.includes("permission")||o.includes("eperm")||o.includes("eacces"))&&(s=u.PERMISSION_DENIED),this.protocol.setErrorCode(s),this.protocol.setResultFromString(e),this.protocol.setStatus(n.ERROR)}};var V=3e4,k={name:"python3",summary:"Execute Python code via Pyodide",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using Pyodide (Python compiled to WebAssembly).","","This command runs Python in a sandboxed environment with access to","the virtual filesystem. Only Pyodide-bundled packages are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["Pyodide runs in WebAssembly, so execution may be slower than native Python.","Only packages bundled with Pyodide are available (no pip install).","First execution loads Pyodide (~30MB), subsequent calls are faster.","Maximum execution time is 30 seconds by default."]};function M(r){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(r.length===0)return t;let e=r.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?r.length:e);s++){let o=r[s];if(o==="-c")return s+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
7
7
  `,exitCode:2}:(t.code=r[s+1],t.scriptArgs=r.slice(s+2),t);if(o==="-m")return s+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
8
8
  `,exitCode:2}:(t.module=r[s+1],t.scriptArgs=r.slice(s+2),t);if(o==="--version"||o==="-V")return t.showVersion=!0,t;if(o.startsWith("-")&&o!=="-")return{stdout:"",stderr:`python3: unrecognized option '${o}'
9
- `,exitCode:2}}if(e!==-1){let s=r[e];s==="--"?e+1<r.length&&(t.scriptFile=r[e+1],t.scriptArgs=r.slice(e+2)):(t.scriptFile=s,t.scriptArgs=r.slice(e+1))}return t}var c=null,F=null,S=[],E=null,M=x(new URL("./worker.js",import.meta.url));function O(){if(E||S.length===0)return;let r=S.shift();if(!r)return;E=r,b().postMessage(E.input)}function b(){return F&&(clearTimeout(F),F=null),c||(c=new L(M),c.on("message",r=>{E&&(E.resolve(r),E=null),S.length>0?O():B()}),c.on("error",r=>{E&&(E.resolve({success:!1,error:r.message}),E=null);for(let t of S)t.resolve({success:!1,error:"Worker crashed"});S.length=0,c=null}),c.on("exit",()=>{c=null}),c)}function B(){F=setTimeout(()=>{c&&!E&&S.length===0&&(c.terminate(),c=null)},5e3)}async function v(r,t,e,s=[]){let o=C(),l=new A(o,t.fs,t.cwd,t.fetch),d=t.limits?.maxPythonTimeoutMs??N,f={sharedBuffer:o,pythonCode:r,cwd:t.cwd,env:t.env,args:s,scriptPath:e},_=new Promise(T=>{let P=setTimeout(()=>{T({success:!1,error:`Execution timeout: exceeded ${d}ms limit`})},d),I=U=>{clearTimeout(P),T(U)};S.push({input:f,resolve:I}),O()}),[m,g]=await Promise.all([l.run(d),_.catch(T=>({success:!1,error:T.message}))]);return!g.success&&g.error?{stdout:m.stdout,stderr:`${m.stderr}python3: ${g.error}
10
- `,exitCode:m.exitCode||1}:m}var H={name:"python3",async execute(r,t){if(D(r))return y(V);let e=k(r);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.12.1 (Pyodide)
9
+ `,exitCode:2}}if(e!==-1){let s=r[e];s==="--"?e+1<r.length&&(t.scriptFile=r[e+1],t.scriptArgs=r.slice(e+2)):(t.scriptFile=s,t.scriptArgs=r.slice(e+1))}return t}var c=null,F=null,S=[],E=null,b=L(new URL("./worker.js",import.meta.url));function _(){if(E||S.length===0)return;let r=S.shift();if(!r)return;E=r,B().postMessage(E.input)}function B(){return F&&(clearTimeout(F),F=null),c||(c=new N(b),c.on("message",r=>{E&&(E.resolve(r),E=null),S.length>0?_():v()}),c.on("error",r=>{E&&(E.resolve({success:!1,error:r.message}),E=null);for(let t of S)t.resolve({success:!1,error:"Worker crashed"});S.length=0,c=null}),c.on("exit",()=>{c=null}),c)}function v(){F=setTimeout(()=>{c&&!E&&S.length===0&&(c.terminate(),c=null)},5e3)}async function H(r,t,e,s=[]){let o=O(),l=new A(o,t.fs,t.cwd,t.fetch),d=t.limits?.maxPythonTimeoutMs??V,f={sharedBuffer:o,pythonCode:r,cwd:t.cwd,env:C(t.env),args:s,scriptPath:e},P=new Promise(T=>{let I=setTimeout(()=>{T({success:!1,error:`Execution timeout: exceeded ${d}ms limit`})},d),U=x=>{clearTimeout(I),T(x)};S.push({input:f,resolve:U}),_()}),[m,g]=await Promise.all([l.run(d),P.catch(T=>({success:!1,error:T.message}))]);return!g.success&&g.error?{stdout:m.stdout,stderr:`${m.stderr}python3: ${g.error}
10
+ `,exitCode:m.exitCode||1}:m}var W={name:"python3",async execute(r,t){if(D(r))return y(k);let e=M(r);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.12.1 (Pyodide)
11
11
  `,stderr:"",exitCode:0};let s,o;if(e.code!==null)s=e.code,o="-c";else if(e.module!==null)s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,o=e.module;else if(e.scriptFile!==null){let l=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(l))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
12
12
  `,exitCode:2};try{s=await t.fs.readFile(l),o=e.scriptFile}catch(d){return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${d.message}
13
13
  `,exitCode:2}}}else if(t.stdin.trim())s=t.stdin,o="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
14
- `,exitCode:2};return v(s,t,o,e.scriptArgs)}},J={name:"python",async execute(r,t){return H.execute(r,t)}};export{H as python3Command,J as pythonCommand};
14
+ `,exitCode:2};return H(s,t,o,e.scriptArgs)}},Z={name:"python",async execute(r,t){return W.execute(r,t)}};export{W as python3Command,Z as pythonCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as u}from"./chunk-TA7RUHGQ.js";import{a as m}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},y={name:"rm",async execute(d,s){let e=u("rm",d,v);if(!e.ok)return e.error;let a=e.result.flags.recursive||e.result.flags.recursiveUpper,c=e.result.flags.force,p=e.result.flags.verbose,l=e.result.positional;if(l.length===0)return c?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
2
+ import{a as u}from"./chunk-JBABAK44.js";import{a as m}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},y={name:"rm",async execute(d,s){let e=u("rm",d,v);if(!e.ok)return e.error;let a=e.result.flags.recursive||e.result.flags.recursiveUpper,c=e.result.flags.force,p=e.result.flags.verbose,l=e.result.positional;if(l.length===0)return c?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
3
3
  `,exitCode:1};let f="",t="",i=0;for(let r of l)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!a){t+=`rm: cannot remove '${r}': Is a directory
4
4
  `,i=1;continue}await s.fs.rm(n,{recursive:a,force:c}),p&&(f+=`removed '${r}'
5
5
  `)}catch(n){if(!c){let o=m(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as p}from"./chunk-TA7RUHGQ.js";import{a as g}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x=`Usage: rmdir [-pv] DIRECTORY...
2
+ import{a as p}from"./chunk-JBABAK44.js";import{a as g}from"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x=`Usage: rmdir [-pv] DIRECTORY...
3
3
  Remove empty directories.
4
4
 
5
5
  Options:
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as d}from"./chunk-TA7RUHGQ.js";import{a as u,b as g}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var S={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},$={format:{short:"c",type:"string"}},x={name:"stat",async execute(e,a){if(g(e))return u(S);let s=d("stat",e,$);if(!s.ok)return s.error;let n=s.result.flags.format??null,c=s.result.positional;if(c.length===0)return{stdout:"",stderr:`stat: missing operand
2
+ import{a as d}from"./chunk-JBABAK44.js";import{a as u,b as g}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var S={name:"stat",summary:"display file or file system status",usage:"stat [OPTION]... FILE...",options:["-c FORMAT use the specified FORMAT instead of the default"," --help display this help and exit"]},$={format:{short:"c",type:"string"}},x={name:"stat",async execute(e,a){if(g(e))return u(S);let s=d("stat",e,$);if(!s.ok)return s.error;let n=s.result.flags.format??null,c=s.result.positional;if(c.length===0)return{stdout:"",stderr:`stat: missing operand
3
3
  `,exitCode:1};let o="",p="",f=!1;for(let i of c){let h=a.fs.resolvePath(a.cwd,i);try{let r=await a.fs.stat(h);if(n){let t=n,l=r.mode.toString(8),y=m(r.mode,r.isDirectory);t=t.replace(/%n/g,i),t=t.replace(/%N/g,`'${i}'`),t=t.replace(/%s/g,String(r.size)),t=t.replace(/%F/g,r.isDirectory?"directory":"regular file"),t=t.replace(/%a/g,l),t=t.replace(/%A/g,y),t=t.replace(/%u/g,"1000"),t=t.replace(/%U/g,"user"),t=t.replace(/%g/g,"1000"),t=t.replace(/%G/g,"group"),o+=`${t}
4
4
  `}else{let t=r.mode.toString(8).padStart(4,"0"),l=m(r.mode,r.isDirectory);o+=` File: ${i}
5
5
  `,o+=` Size: ${r.size} Blocks: ${Math.ceil(r.size/512)}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as d}from"./chunk-TA7RUHGQ.js";import{a as p,b as l}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var h={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},m={append:{short:"a",long:"append",type:"boolean"}},g={name:"tee",async execute(r,e){if(l(r))return p(h);let t=d("tee",r,m);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,n="",a=0;for(let i of c)try{let s=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(s,o):await e.fs.writeFile(s,o)}catch{n+=`tee: ${i}: No such file or directory
2
+ import{a as d}from"./chunk-JBABAK44.js";import{a as p,b as l}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var h={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},m={append:{short:"a",long:"append",type:"boolean"}},g={name:"tee",async execute(r,e){if(l(r))return p(h);let t=d("tee",r,m);if(!t.ok)return t.error;let{append:f}=t.result.flags,c=t.result.positional,o=e.stdin,n="",a=0;for(let i of c)try{let s=e.fs.resolvePath(e.cwd,i);f?await e.fs.appendFile(s,o):await e.fs.writeFile(s,o)}catch{n+=`tee: ${i}: No such file or directory
3
3
  `,a=1}return{stdout:o,stderr:n,exitCode:a}}};export{g as teeCommand};
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import{a as u}from"./chunk-4PRVMER6.js";import"./chunk-KGOUQS5A.js";var C={name:"time",async execute(i,r){let a="%e %M",o=null,d=!1,m=!1,t=0;for(;t<i.length;){let e=i[t];if(e==="-f"||e==="--format"){if(t++,t>=i.length)return{stdout:"",stderr:`time: missing argument to '-f'
3
+ `,exitCode:1};a=i[t],t++}else if(e==="-o"||e==="--output"){if(t++,t>=i.length)return{stdout:"",stderr:`time: missing argument to '-o'
4
+ `,exitCode:1};o=i[t],t++}else if(e==="-a"||e==="--append")d=!0,t++;else if(e==="-v"||e==="--verbose")a=`Command being timed: %C
5
+ Elapsed (wall clock) time: %e seconds
6
+ Maximum resident set size (kbytes): %M`,t++;else if(e==="-p"||e==="--portability")m=!0,t++;else if(e==="--"){t++;break}else if(e.startsWith("-"))t++;else break}let f=i.slice(t);if(f.length===0)return{stdout:"",stderr:"",exitCode:0};let p=performance.now(),c=f.join(" "),s;try{if(!r.exec)return{stdout:"",stderr:`time: exec not available
7
+ `,exitCode:1};s=await r.exec(c,{env:u(r.env),cwd:r.cwd})}catch(e){s={stdout:"",stderr:`time: ${e.message}
8
+ `,exitCode:127}}let l=(performance.now()-p)/1e3,n;if(m?n=`real ${l.toFixed(2)}
9
+ user 0.00
10
+ sys 0.00
11
+ `:(n=a.replace(/%e/g,l.toFixed(2)).replace(/%E/g,w(l)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,c),n.endsWith(`
12
+ `)||(n+=`
13
+ `)),o)try{let e=r.fs.resolvePath(r.cwd,o);if(d&&await r.fs.exists(e)){let g=await r.fs.readFile(e);await r.fs.writeFile(e,g+n)}else await r.fs.writeFile(e,n)}catch(e){return{stdout:s.stdout,stderr:s.stderr+`time: cannot write to '${o}': ${e.message}
14
+ `,exitCode:s.exitCode}}else s={...s,stderr:s.stderr+n};return s}};function w(i){let r=Math.floor(i/3600),a=Math.floor(i%3600/60),o=i%60;return r>0?`${r}:${a.toString().padStart(2,"0")}:${o.toFixed(2).padStart(5,"0")}`:`${a}:${o.toFixed(2).padStart(5,"0")}`}export{C as timeCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as C}from"./chunk-TA7RUHGQ.js";import{a as g,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
2
+ import{a as C}from"./chunk-JBABAK44.js";import{a as g,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var x={name:"tr",summary:"translate or delete characters",usage:"tr [OPTION]... SET1 [SET2]",options:["-c, -C, --complement use the complement of SET1","-d, --delete delete characters in SET1","-s, --squeeze-repeats squeeze repeated characters"," --help display this help and exit"],description:`SET syntax:
3
3
  a-z character range
4
4
  [:alnum:] all letters and digits
5
5
  [:alpha:] all letters
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import"./chunk-OBH7XN5N.js";import{a as w}from"./chunk-TA7RUHGQ.js";import{a as D,b as $}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var g={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},T={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},E={name:"tree",async execute(i,o){if($(i))return D(g);let s=w("tree",i,T);if(!s.ok)return s.error;let f={showHidden:s.result.flags.showHidden,directoriesOnly:s.result.flags.directoriesOnly,maxDepth:s.result.flags.maxDepth??null,fullPath:s.result.flags.fullPath},d=s.result.positional;d.length===0&&d.push(".");let t="",l="",a=0,n=0;for(let e of d){let r=await b(o,e,f,"",0);t+=r.output,l+=r.stderr,a+=r.dirCount,n+=r.fileCount}return t+=`
2
+ import"./chunk-OBH7XN5N.js";import{a as w}from"./chunk-JBABAK44.js";import{a as D,b as $}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var g={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},T={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},E={name:"tree",async execute(i,o){if($(i))return D(g);let s=w("tree",i,T);if(!s.ok)return s.error;let f={showHidden:s.result.flags.showHidden,directoriesOnly:s.result.flags.directoriesOnly,maxDepth:s.result.flags.maxDepth??null,fullPath:s.result.flags.fullPath},d=s.result.positional;d.length===0&&d.push(".");let t="",l="",a=0,n=0;for(let e of d){let r=await b(o,e,f,"",0);t+=r.output,l+=r.stderr,a+=r.dirCount,n+=r.fileCount}return t+=`
3
3
  ${a} director${a===1?"y":"ies"}`,f.directoriesOnly||(t+=`, ${n} file${n===1?"":"s"}`),t+=`
4
4
  `,{stdout:t,stderr:l,exitCode:l?1:0}}};async function b(i,o,s,f,d){let t={output:"",stderr:"",dirCount:0,fileCount:0},l=i.fs.resolvePath(i.cwd,o);try{if(!(await i.fs.stat(l)).isDirectory)return t.output=`${o}
5
5
  `,t.fileCount=1,t}catch{return t.stderr=`tree: ${o}: No such file or directory
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{b as g}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as f}from"./chunk-TA7RUHGQ.js";import{a as p,b as d}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var b={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},P={name:"uniq",async execute(a,m){if(d(a))return p(b);let o=f("uniq",a,w);if(!o.ok)return o.error;let{count:h,duplicatesOnly:y,uniqueOnly:q,ignoreCase:C}=o.result.flags,O=o.result.positional,u=await g(m,O,{cmdName:"uniq"});if(!u.ok)return u.error;let n=u.content.split(`
2
+ import{b as g}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as f}from"./chunk-JBABAK44.js";import{a as p,b as d}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var b={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},P={name:"uniq",async execute(a,m){if(d(a))return p(b);let o=f("uniq",a,w);if(!o.ok)return o.error;let{count:h,duplicatesOnly:y,uniqueOnly:q,ignoreCase:C}=o.result.flags,O=o.result.positional,u=await g(m,O,{cmdName:"uniq"});if(!u.ok)return u.error;let n=u.content.split(`
3
3
  `);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,s)=>C?e.toLowerCase()===s.toLowerCase():e===s;for(let e=1;e<n.length;e++)x(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let l=t;y?l=t.filter(e=>e.count>1):q&&(l=t.filter(e=>e.count===1));let c="";for(let{line:e,count:s}of l)h?c+=`${String(s).padStart(4)} ${e}
4
4
  `:c+=`${e}
5
5
  `;return{stdout:c,stderr:"",exitCode:0}}};export{P as uniqCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as b}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as S}from"./chunk-TA7RUHGQ.js";import{a as x,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var F={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},H={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},I={name:"wc",async execute(a,c){if(y(a))return x(F);let n=S("wc",a,H);if(!n.ok)return n.error;let{lines:r,words:s}=n.result.flags,e=n.result.flags.bytes||n.result.flags.chars,t=n.result.positional;!r&&!s&&!e&&(r=s=e=!0);let i=await b(c,t,{cmdName:"wc",stopOnError:!1});if(t.length===0){let o=C(i.files[0].content);return{stdout:`${g(o,r,s,e,"",0)}
2
+ import{a as b}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as S}from"./chunk-JBABAK44.js";import{a as x,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var F={name:"wc",summary:"print newline, word, and byte counts for each file",usage:"wc [OPTION]... [FILE]...",options:["-c, --bytes print the byte counts","-m, --chars print the character counts","-l, --lines print the newline counts","-w, --words print the word counts"," --help display this help and exit"]},H={lines:{short:"l",long:"lines",type:"boolean"},words:{short:"w",long:"words",type:"boolean"},bytes:{short:"c",long:"bytes",type:"boolean"},chars:{short:"m",long:"chars",type:"boolean"}},I={name:"wc",async execute(a,c){if(y(a))return x(F);let n=S("wc",a,H);if(!n.ok)return n.error;let{lines:r,words:s}=n.result.flags,e=n.result.flags.bytes||n.result.flags.chars,t=n.result.positional;!r&&!s&&!e&&(r=s=e=!0);let i=await b(c,t,{cmdName:"wc",stopOnError:!1});if(t.length===0){let o=C(i.files[0].content);return{stdout:`${g(o,r,s,e,"",0)}
3
3
  `,stderr:"",exitCode:0}}let h=[],p=0,d=0,u=0;for(let{filename:o,content:w}of i.files){let f=C(w);p+=f.lines,d+=f.words,u+=f.chars,h.push({filename:o,stats:f})}let M=t.length>1?p:Math.max(...h.map(o=>o.stats.lines)),L=t.length>1?d:Math.max(...h.map(o=>o.stats.words)),$=t.length>1?u:Math.max(...h.map(o=>o.stats.chars)),l=t.length>1?3:0;r&&(l=Math.max(l,String(M).length)),s&&(l=Math.max(l,String(L).length)),e&&(l=Math.max(l,String($).length));let m="";for(let{filename:o,stats:w}of h)m+=`${g(w,r,s,e,o,l)}
4
4
  `;return t.length>1&&(m+=`${g({lines:p,words:d,chars:u},r,s,e,"total",l)}
5
5
  `),{stdout:m,stderr:i.stderr,exitCode:i.exitCode}}};function C(a){let c=a.length,n=0,r=0,s=!1;for(let e=0;e<c;e++){let t=a[e];t===`
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as u}from"./chunk-TA7RUHGQ.js";import{a as f,b as h}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var w={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"]},g={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(s,e){if(h(s))return f(w);let t=u("which",s,g);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=(e.env.PATH||"/usr/bin:/bin").split(":"),n="",r=!0;for(let m of o){let a=!1;for(let i of d){if(!i)continue;let l=`${i}/${m}`;if(await e.fs.exists(l)&&(a=!0,p||(n+=`${l}
2
+ import{a as u}from"./chunk-JBABAK44.js";import{a as f,b as h}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var w={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"]},g={showAll:{short:"a",type:"boolean"},silent:{short:"s",type:"boolean"}},A={name:"which",async execute(e,s){if(h(e))return f(w);let t=u("which",e,g);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="",r=!0;for(let m of o){let a=!1;for(let i of d){if(!i)continue;let l=`${i}/${m}`;if(await s.fs.exists(l)&&(a=!0,p||(n+=`${l}
3
3
  `),!c))break}a||(r=!1)}return{stdout:n,stderr:"",exitCode:r?0:1}}};export{A as whichCommand};
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+ import{a as F,b,c as M,d as Ve,e as w,f as v,g as K,h as G}from"./chunk-GZHFXDDO.js";import{a as Ze}from"./chunk-QSDVMMYI.js";import{a as $}from"./chunk-YNACG4DZ.js";import"./chunk-4PRVMER6.js";import"./chunk-K5IXNHO5.js";import{a as De}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as D,b as z}from"./chunk-GTNBSMZR.js";import{b as je,d as Xe,e as Ye,f as Be}from"./chunk-KGOUQS5A.js";var q,We=je(()=>{"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===`
3
+ `||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
4
+ `;)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 r=this.input[this.pos+1];if(r==='"'||r==="'"||r==="`")return this.pos++,this.readString(r)}if(t==="/"){let r=this.tokens[this.tokens.length-1];return r&&(r.type==="int"||r.type==="float"||r.type==="string"||r.type==="ident"||r.type===")"||r.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 s={"(":"(",")":")","[":"[","]":"]","{":"{","}":"}",",":",",":":":",";":";","+":"+","-":"-","*":"*","%":"%","<":"<",">":">","!":"!",".":".","|":"|","=":"="};if(t in s)return this.pos++,{type:s[t],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+=`
5
+ `;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${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={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(/\?$/,"");return o in r&&!t?{type:r[o],value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var Ue={};Xe(Ue,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},a=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){a();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let i=o();if((i.type===","||i.type==="as")&&u===0)break;(i.type==="("||i.type==="["||i.type==="{")&&u++,(i.type===")"||i.type==="]"||i.type==="}")&&u--,h.push(a())}h.push({type:"eof",value:"",pos:0});let f=new H(h).parse(),c;if(o().type==="as")if(a(),o().type==="("){a();let i=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(i.push(o().value),a()),o().type===","&&a();o().type===")"&&a(),c=i}else if(o().type==="ident"||o().type==="string")c=o().value,a();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 H(t).parse()}var R,H,W=je(()=>{"use strict";We();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},H=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,a=this.pos+1;a<this.tokens.length&&this.tokens[a].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(),r={"+":"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"};if(s.type in r){this.advance();let o=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:r[s.type],args:[{expr:n},{expr:o}]}}if(s.type==="|"){this.advance();let o=this.parseExpr(t);return this.handlePipe(n,o)}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()}}});W();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 _e={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=>qe(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 qe(s,n,t.length===1?t[0]:_e.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 Qe="then";function qe(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[Qe]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function L(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=>L(r.expr,n)),s=_e[e.name];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=L(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:L(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?L(e.start,n):void 0,end:e.end?L(e.end,n):void 0};case"lambda":return L(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Y(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,a=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(a,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 He(e){return/^\w+$/.test(e)}function X(e,n,t){let s=L(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function B(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(He(r)?o=e.map(a=>a[r]).filter(a=>a!=null):o=e.map(a=>X(a,r,t)).filter(a=>a!=null),s){case"count":return He(r)?o.length:o.filter(a=>!!a).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 a=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return a.length>0?a.reduce((h,u)=>h+u,0)/a.length:0}case"min":{let a=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return a.length>0?Math.min(...a):null}case"max":{let a=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return a.length>0?Math.max(...a):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let a=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(a.length===0)return null;let h=Math.floor(a.length/2);return a.length%2===0?(a[h-1]+a[h])/2:a[h]}case"mode":{let a=new Map;for(let p of o){let l=String(p);a.set(l,(a.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of a)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(a=>String(a)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let a of e)if(!X(a,r,t))return!1;return!0}case"any":{for(let a of e)if(X(a,r,t))return!0;return!1}default:return null}}function Je(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,B(e,r,t));return s}async function Z(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
6
+ `,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let a={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},h=Y(t),u=h.map(l=>l.alias),p=Je(r,h,a);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function Q(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]
7
+ `,exitCode:1};let{data:o,error:a}=await v(r,n);if(a)return a;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Y(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)],i=[];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,B(m,y,h));i.push(g)}return{stdout:w(c,i),stderr:"",exitCode:0}}async function ee(e,n){let t=[],s="",r=10,o=!1,a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--select")&&i+1<e.length?t=e[++i].split(","):(d==="-g"||d==="--groupby")&&i+1<e.length?s=e[++i]:(d==="-l"||d==="--limit")&&i+1<e.length?r=Number.parseInt(e[++i],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||a.push(d)}let{headers:h,data:u,error:p}=await v(a,n);if(p)return p;let l=t.length>0?t:h.filter(i=>i!==s);s&&t.length===0&&(l=h.filter(i=>i!==s));let f=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let i=new Map;for(let d of u){let m=String(d[s]??"");i.has(m)||i.set(m,[]),i.get(m)?.push(d)}for(let d of l)for(let[m,g]of i){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 i of l){let d=new Map;for(let g of u){let y=g[i],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:i,value:g===""?"<empty>":g,count:y})}return{stdout:w(c,f),stderr:"",exitCode:0}}async function te(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:a}=await v(s,n);if(a)return a;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)),i=c.length===f.length&&c.length>0;p.push({field:l,type:i?"Number":"String",count:f.length,min:i?Math.min(...c):"",max:i?Math.max(...c):"",mean:i?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}W();function ze(e){let n=_(e);return L(n)}function et(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${t}$`)}function J(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=J(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=et(o);for(let l of n)p.test(l)&&!t.includes(l)&&t.push(l);continue}let a=o.match(/^([^:]*):([^:]*)$/);if(a&&(a[1]||a[2])){let p=a[1],l=a[2],f=p?n.indexOf(p):0,c=l?n.indexOf(l):n.length-1;if(f!==-1&&c!==-1){let i=f<=c?1:-1;for(let d=f;i>0?d<=c:d>=c;d+=i)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 ne(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
8
+ `,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let h=J(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 se(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
9
+ `,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let h=new Set(J(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 re(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
10
+ `,exitCode:1};let{headers:o,data:a,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 i=0;i<l.length&&i<f.length;i++)c.set(l[i],f[i]);u=o.map(i=>c.get(i)||i)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=a.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 oe(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:a}=await v(s,n);if(a)return a;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 ie(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(a=>a!=="-j"&&a!=="--just-names"),n);return r||{stdout:t?`${s.map(a=>a).join(`
11
+ `)}
12
+ `:`${s.map((a,h)=>`${h} ${a}`).join(`
13
+ `)}
14
+ `,stderr:"",exitCode:0}}async function ae(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length}
15
+ `,stderr:"",exitCode:0}}async function le(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:a}=await v(s,n);if(a)return a;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function ue(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:a}=await v(s,n);if(a)return a;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function ce(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let i=e[c];(i==="-s"||i==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(i==="-e"||i==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(i==="-l"||i==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):i.startsWith("-")||o.push(i)}let{headers:a,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(a,f),stderr:"",exitCode:0}}async function pe(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 fe=Ye(Ze(),1);async function de(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 a=s[0],h=[a,...r.map((p,l)=>String(p[a]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=F();b(f,a,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 he(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:a}=await v(s,n);if(a)return a;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 me(e,n){let t=null,s="",r=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-l"||d==="--length")&&i+1<e.length?t=Number.parseInt(e[++i],10):(d==="-d"||d==="--default")&&i+1<e.length?s=e[++i]:d.startsWith("-")||r.push(d)}let o=r[0],a;if(!o||o==="-")a=n.stdin;else try{let i=n.fs.resolvePath(n.cwd,o);a=await n.fs.readFile(i)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
16
+ `,exitCode:1}}let u=fe.default.parse(a.trim(),{header:!1,skipEmptyLines:!0}).data;if(u.length===0)return{stdout:"",stderr:"",exitCode:0};let p=Math.max(...u.map(i=>i.length)),l=t??p,f=u.map(i=>i.length===l?i:i.length<l?[...i,...Array(l-i.length).fill(s)]:i.slice(0,l));return{stdout:`${fe.default.unparse(f).replace(/\r\n/g,`
17
+ `)}
18
+ `,stderr:"",exitCode:0}}async function ge(e,n){let t=null,s=null,r=".",o=[];for(let c=0;c<e.length;c++){let i=e[c];(i==="-c"||i==="--chunks")&&c+1<e.length?t=Number.parseInt(e[++c],10):(i==="-S"||i==="--size")&&c+1<e.length?s=Number.parseInt(e[++c],10):(i==="-o"||i==="--output")&&c+1<e.length?r=e[++c]:i.startsWith("-")||o.push(i)}if(!t&&!s)return{stdout:"",stderr:`xan split: must specify -c or -S
19
+ `,exitCode:1};let{headers:a,data:h,error:u}=await v(o,n);if(u)return u;let p=[];if(t){let c=Math.ceil(h.length/t);for(let i=0;i<t;i++)p.push(h.slice(i*c,(i+1)*c))}else if(s)for(let c=0;c<h.length;c+=s)p.push(h.slice(c,c+s));let l=p.filter(c=>c.length>0),f=o[0]?.replace(/\.csv$/,"")||"part";try{let c=n.fs.resolvePath(n.cwd,r);for(let i=0;i<l.length;i++){let d=`${f}_${String(i+1).padStart(3,"0")}.csv`,m=n.fs.resolvePath(c,d);await n.fs.writeFile(m,w(a,l[i]))}return{stdout:`Split into ${l.length} parts
20
+ `,stderr:"",exitCode:0}}catch{return{stdout:`${l.map((i,d)=>`Part ${d+1}: ${i.length} rows`).join(`
21
+ `)}
22
+ `,stderr:"",exitCode:0}}}async function ye(e,n){let t="",s=".",r=[];for(let p=0;p<e.length;p++){let l=e[p];(l==="-o"||l==="--output")&&p+1<e.length?s=e[++p]:l.startsWith("-")||(t?r.push(l):t=l)}if(!t)return{stdout:"",stderr:`xan partition: usage: xan partition COLUMN [FILE]
23
+ `,exitCode:1};let{headers:o,data:a,error:h}=await v(r,n);if(h)return h;if(!o.includes(t))return{stdout:"",stderr:`xan partition: column '${t}' not found
24
+ `,exitCode:1};let u=new Map;for(let p of a){let l=String(p[t]??"");u.has(l)||u.set(l,[]),u.get(l)?.push(p)}try{let p=n.fs.resolvePath(n.cwd,s);for(let[l,f]of u){let i=`${l.replace(/[^a-zA-Z0-9_-]/g,"_")||"empty"}.csv`,d=n.fs.resolvePath(p,i);await n.fs.writeFile(d,w(o,f))}return{stdout:`Partitioned into ${u.size} files by '${t}'
25
+ `,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([l,f])=>`${l}: ${f.length} rows`).join(`
26
+ `)}
27
+ `,stderr:"",exitCode:0}}}async function xe(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to <format> [FILE]
28
+ `,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?tt(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}'
29
+ `,exitCode:1}}async function tt(e,n){let t=e.filter(a=>!a.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)}
30
+ `,stderr:"",exitCode:0}}async function we(e,n){let t="",s=[];for(let r=0;r<e.length;r++){let o=e[r];(o==="-f"||o==="--format")&&r+1<e.length?t=e[++r]:o.startsWith("-")||s.push(o)}return t?t==="json"?nt(s,n):{stdout:"",stderr:`xan from: unsupported format '${t}'
31
+ `,exitCode:1}:{stdout:"",stderr:`xan from: usage: xan from -f <format> [FILE]
32
+ `,exitCode:1}}async function nt(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
33
+ `,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array
34
+ `,exitCode:1};if(r.length===0)return{stdout:`
35
+ `,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[a,...h]=r,u=h.map(p=>{let l=F();for(let f=0;f<a.length;f++)b(l,a[f],p[f]);return l});return{stdout:w(a,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
36
+ `,exitCode:1}}}async function ve(e,n){let t=!1,s=0,r="",o=[];for(let c=0;c<e.length;c++){let i=e[c];if(i==="-v"||i==="--invert")t=!0;else if((i==="-l"||i==="--limit")&&c+1<e.length)s=Number.parseInt(e[++c],10);else{if(i==="--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"]});i.startsWith("-")||(r?o.push(i):r=i)}}if(!r)return{stdout:"",stderr:`xan filter: no expression specified
37
+ `,exitCode:1};let{headers:a,data:h,error:u}=await v(o,n);if(u)return u;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=ze(r),f=[];for(let c of h){if(s>0&&f.length>=s)break;let i=$(c,l,p),d=i.length>0&&i.some(m=>!!m);(t?!d:d)&&f.push(c)}return{stdout:w(a,f),stderr:"",exitCode:0}}async function Ce(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:a,data:h,error:u}=await v(o,n);if(u)return u;!t&&a.length>0&&(t=a[0]);let p=[...h].sort((l,f)=>{let c=l[t],i=f[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof i=="number"?i:Number.parseFloat(String(i));d=m-g}else d=String(c).localeCompare(String(i));return r?-d:d});return{stdout:w(a,p),stderr:"",exitCode:0}}async function be(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:a}=await v(s,n);if(a)return a;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 Se(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:a,data:h,error:u}=await v(o,n);if(u)return u;!s&&a.length>0&&(s=a[0]);let l=[...h].sort((f,c)=>{let i=f[s],d=c[s],m=typeof i=="number"?i:Number.parseFloat(String(i)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:w(a,l),stderr:"",exitCode:0}}W();async function Ie(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
38
+ `,exitCode:1};let{headers:a,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:L(d)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...a];for(let d of l)a.includes(d.alias)||c.push(d.alias)}else c=[...a,...l.map(d=>d.alias)];let i=[];for(let d=0;d<h.length;d++){let m=h[d],g=M(m),y=!1,x={...m,_row_index:d};for(let I of l){let N=$(x,I.ast,f),C=N.length>0?N[0]:null;if(r&&C==null){y=!0;break}b(g,I.alias,C)}y||i.push(g)}return{stdout:w(c,i),stderr:"",exitCode:0}}async function ke(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]
39
+ `,exitCode:1};let{headers:a,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(!a.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found
40
+ `,exitCode:1};let f=L(V(s)[0]?.expr||(W(),Be(Ue)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},i=a.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={...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(i,d),stderr:"",exitCode:0}}async function Ne(e,n){let t="",s="|",r=!1,o="",a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--separator")&&i+1<e.length?s=e[++i]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&i+1<e.length?o=e[++i]:d.startsWith("-")||(t?a.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
41
+ `,exitCode:1};let{headers:h,data:u,error:p}=await v(a,n);if(p)return p;if(!h.includes(t))return{stdout:"",stderr:`xan explode: column '${t}' not found
42
+ `,exitCode:1};let l=o?h.map(i=>i===t?o:i):h,f=o||t,c=[];for(let i of u){let d=i[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(i);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(i);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Ee(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]
43
+ `,exitCode:1};let{headers:a,data:h,error:u}=await v(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan implode: column '${t}' not found
44
+ `,exitCode:1};let p=a.filter(g=>g!==t),l=r?a.map(g=>g===t?r:g):a,f=r||t,c=[],i=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!==i){if(m!==null){let N=M(m);r&&delete N[t],b(N,f,d.join(s)),c.push(N)}i=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 Ae(e,n){let t="",s="",r="",o="",a="inner",h="",u=0;for(let C=0;C<e.length;C++){let A=e[C];A==="--left"?a="left":A==="--right"?a="right":A==="--full"?a="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]
45
+ `,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:i,data:d}=l;if(!f.includes(t))return{stdout:"",stderr:`xan join: column '${t}' not found in first file
46
+ `,exitCode:1};if(!i.includes(r))return{stdout:"",stderr:`xan join: column '${r}' not found in second file
47
+ `,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=i.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 O of j){let T=F();for(let U of f)b(T,U,C[U]);for(let U of y)b(T,U,O[U]);I.push(T)}}else if(a==="left"||a==="full"){let O=F();for(let T of f)b(O,T,C[T]);for(let T of y)b(O,T,h);I.push(O)}}if(a==="right"||a==="full")for(let C of d){let A=String(C[r]??"");if(!N.has(A)){let j=F();for(let O of f)b(j,O,i.includes(O)?C[O]:h);for(let O of y)b(j,O,C[O]);I.push(j)}}return{stdout:w(x,I),stderr:"",exitCode:0}}async function Fe(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]
48
+ `,exitCode:1};let{headers:a,data:h,error:u}=await v(o,n);if(u)return u;if(!a.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found
49
+ `,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}'
50
+ `,exitCode:1};let[,l,f]=p;r.length===0&&(r=a.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 i=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];i.has(x)||(i.set(x,new Map),d.push(x));let C=i.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=i.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,st(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function st(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 Le(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 ...
51
+ `,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
52
+ `,exitCode:1};r.push({headers:u.headers,data:u.data})}if(!o)return{stdout:"",stderr:"",exitCode:0};let a=[];for(let{data:h}of r)a=a.concat(h);if(t){if(!o.includes(t))return{stdout:"",stderr:`xan merge: column '${t}' not found
53
+ `,exitCode:1};a.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,a),stderr:"",exitCode:0}}W();async function Oe(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=>rt(p)).join(",")).join(`
54
+ `)+`
55
+ `,stderr:"",exitCode:0})}function rt(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(`
56
+ `)?`"${n.replace(/"/g,'""')}"`:n}async function Pe(e,n){let t=null,s=null,r=[];for(let c=0;c<e.length;c++){let i=e[c];if(i==="--seed"&&c+1<e.length)s=Number.parseInt(e[++c],10);else if(!i.startsWith("-")){let d=Number.parseInt(i,10);t===null&&!Number.isNaN(d)&&d>0?t=d:r.push(i)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample <sample-size> [FILE]
57
+ `,exitCode:1};let{headers:o,data:a,error:h}=await v(r,n);if(h)return h;if(a.length<=t)return{stdout:w(o,a),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),l=a.map((c,i)=>i);for(let c=l.length-1;c>0;c--){let i=Math.floor(p()*(c+1));[l[c],l[i]]=[l[i],l[c]]}let f=l.slice(0,t).sort((c,i)=>c-i).map(c=>a[c]);return{stdout:w(o,f),stderr:"",exitCode:0}}async function Re(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
58
+ `,exitCode:1};let r=await De(n,s,{cmdName:"xan cat",stopOnError:!0});if(r.exitCode!==0)return{stdout:"",stderr:r.stderr,exitCode:r.exitCode};let o=[],a=[];for(let{content:u}of r.files){let{headers:p,data:l}=Ve(u);o.push({headers:p,data:l});for(let f of p)a.includes(f)||a.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)
59
+ `,exitCode:1};a=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 a)b(f,c,u.includes(c)?l[c]:"");h.push(f)}return{stdout:w(a,h),stderr:"",exitCode:0}}async function Me(e,n){let t="",s=[],r=!1,o=!1,a=[];for(let i=0;i<e.length;i++){let d=e[i];(d==="-s"||d==="--select")&&i+1<e.length?s=e[++i].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?a.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
60
+ `,exitCode:1};let{headers:h,data:u,error:p}=await v(a,n);if(p)return p;let l=s.length>0?s:h,f;try{f=new RegExp(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}'
61
+ `,exitCode:1}}let c=u.filter(i=>{let d=l.some(m=>{let g=i[m];return g!=null&&f.test(String(g))});return r?!d:d});return{stdout:w(h,c),stderr:"",exitCode:0}}async function $e(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
62
+ `,exitCode:1};let{headers:r,data:o,error:a}=await v(s,n);if(a)return a;let u=V(t).map(({expr:c,name:i})=>({alias:typeof i=="string"?i:i[0],ast:L(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 i=[],d=1;for(let m of u){let g=$(c,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;i.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=i[y][m]??null;b(g,u[y].alias,x)}f.push(g)}}return{stdout:w(l,f),stderr:"",exitCode:0}}async function Te(e,n){let{cmdView:t}=await import("./xan-view-5SZBYPLG.js");return t(e,n)}var Ge=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),ot=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",...Ge]),Ke={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.
63
+ It provides a simple, ergonomic interface for common data operations.
64
+
65
+ COMMANDS:
66
+ Core:
67
+ headers Show column names
68
+ count Count rows
69
+ head Show first N rows
70
+ tail Show last N rows
71
+ slice Extract row range
72
+ reverse Reverse row order
73
+ behead Remove header row
74
+ sample Random sample of rows
75
+
76
+ Column operations:
77
+ select Select columns (supports glob, ranges, negation)
78
+ drop Drop columns
79
+ rename Rename columns
80
+ enum Add row index column
81
+
82
+ Row operations:
83
+ filter Filter rows by expression
84
+ search Filter rows by regex match
85
+ sort Sort rows
86
+ dedup Remove duplicates
87
+ top Get top N by column
88
+
89
+ Transformations:
90
+ map Add computed columns
91
+ transform Modify existing columns
92
+ explode Split column into multiple rows
93
+ implode Combine rows, join column values
94
+ flatmap Map returning multiple rows
95
+ pivot Reshape rows into columns
96
+ transpose Swap rows and columns
97
+
98
+ Aggregation:
99
+ agg Aggregate values
100
+ groupby Group and aggregate
101
+ frequency Count value occurrences
102
+ stats Show column statistics
103
+
104
+ Multi-file:
105
+ cat Concatenate CSV files
106
+ join Join two CSV files on key
107
+ merge Merge sorted CSV files
108
+ split Split into multiple files
109
+ partition Split by column value
110
+
111
+ Data conversion:
112
+ to Convert CSV to other formats (json)
113
+ from Convert other formats to CSV (json)
114
+ shuffle Randomly reorder rows
115
+ fixlengths Fix ragged CSV files
116
+
117
+ Output:
118
+ view Pretty print as table
119
+ flatten Display records vertically (alias: f)
120
+ fmt Format output
121
+
122
+ EXAMPLES:
123
+ xan headers data.csv
124
+ xan count data.csv
125
+ xan head -n 5 data.csv
126
+ xan select name,email data.csv
127
+ xan select 'vec_*' data.csv # glob pattern
128
+ xan select 'a:c' data.csv # column range
129
+ xan filter 'age > 30' data.csv
130
+ xan search -r '^foo' data.csv
131
+ xan sort -N price data.csv
132
+ xan agg 'sum(amount) as total' data.csv
133
+ xan groupby region 'count() as n' data.csv
134
+ xan explode tags data.csv
135
+ xan join id file1.csv id file2.csv
136
+ xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},it={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"]}},rn={name:"xan",async execute(e,n){if(e.length===0||z(e))return D(Ke);let t=e[0],s=e.slice(1);if(z(s)){let r=it[t];return r?D(r):D(Ke)}if(Ge.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
137
+ `,exitCode:1};switch(t){case"headers":return ie(s,n);case"count":return ae(s,n);case"head":return le(s,n);case"tail":return ue(s,n);case"slice":return ce(s,n);case"reverse":return pe(s,n);case"behead":return Oe(s,n);case"sample":return Pe(s,n);case"select":return ne(s,n);case"drop":return se(s,n);case"rename":return re(s,n);case"enum":return oe(s,n);case"filter":return ve(s,n);case"search":return Me(s,n);case"sort":return Ce(s,n);case"dedup":return be(s,n);case"top":return Se(s,n);case"map":return Ie(s,n);case"transform":return ke(s,n);case"explode":return Ne(s,n);case"implode":return Ee(s,n);case"flatmap":return $e(s,n);case"pivot":return Fe(s,n);case"agg":return Z(s,n);case"groupby":return Q(s,n);case"frequency":case"freq":return ee(s,n);case"stats":return te(s,n);case"cat":return Re(s,n);case"join":return Ae(s,n);case"merge":return Le(s,n);case"split":return ge(s,n);case"partition":return ye(s,n);case"to":return xe(s,n);case"from":return we(s,n);case"transpose":return de(s,n);case"shuffle":return he(s,n);case"fixlengths":return me(s,n);case"view":return G(s,n);case"flatten":case"f":return K(s,n);case"fmt":return Te(s,n);default:return ot.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
138
+ `,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
139
+ Run 'xan --help' for usage.
140
+ `,exitCode:1}}}};export{rn as xanCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{d as a,e as b}from"./chunk-UUQYHLBO.js";import"./chunk-QSDVMMYI.js";import"./chunk-KGOUQS5A.js";export{a as cmdFlatten,b as cmdView};
2
+ import{g as a,h as b}from"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-KGOUQS5A.js";export{a as cmdFlatten,b as cmdView};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as Ja}from"./chunk-QSDVMMYI.js";import{a as Le,b as Oi}from"./chunk-KD3EODLB.js";import{k as Ts}from"./chunk-K5IXNHO5.js";import{a as Ai,b as Ti,c as ae}from"./chunk-GTNBSMZR.js";import{a as bt,c as b,e as As}from"./chunk-KGOUQS5A.js";var Yi=b((rp,Ri)=>{var{hasOwnProperty:Ps}=Object.prototype,Ms=(s,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
2
+ import{a as Ja}from"./chunk-QSDVMMYI.js";import{a as Le,b as Oi}from"./chunk-YNACG4DZ.js";import"./chunk-4PRVMER6.js";import{k as Ts}from"./chunk-K5IXNHO5.js";import{a as Ai,b as Ti,c as ae}from"./chunk-GTNBSMZR.js";import{a as bt,c as b,e as As}from"./chunk-KGOUQS5A.js";var Yi=b((rp,Ri)=>{var{hasOwnProperty:Ps}=Object.prototype,Ms=(s,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
3
3
  `:`
4
4
  `,n=e.whitespace?" = ":"=",i=[],r=e.sort?Object.keys(s).sort():Object.keys(s),o=0;e.align&&(o=G(r.filter(c=>s[c]===null||Array.isArray(s[c])||typeof s[c]!="object").map(c=>Array.isArray(s[c])?`${c}[]`:c).concat([""]).reduce((c,u)=>G(c).length>=G(u).length?c:u)).length);let a="",l=e.bracketedArray?"[]":"";for(let c of r){let u=s[c];if(u&&Array.isArray(u))for(let f of u)a+=G(`${c}${l}`).padEnd(o," ")+n+G(f)+t;else u&&typeof u=="object"?i.push(c):a+=G(c).padEnd(o," ")+n+G(u)+t}e.section&&a.length&&(a="["+G(e.section)+"]"+(e.newline?t+t:t)+a);for(let c of i){let u=Vi(c,".").join("\\."),f=(e.section?e.section+".":"")+u,d=Ms(s[c],{...e,section:f});a.length&&d.length&&(a+=t),a+=d}return a};function Vi(s,e){var t=0,n=0,i=0,r=[];do if(i=s.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&s[i-1]==="\\")continue;r.push(s.slice(n,i)),n=i+e.length}while(i!==-1);return r.push(s.slice(n)),r}var ji=(s,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,r=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=s.split(/[\r\n]+/g),a={};for(let c of o){if(!c||c.match(/^\s*[;#]/)||c.match(/^\s*$/))continue;let u=c.match(r);if(!u)continue;if(u[1]!==void 0){if(i=Nt(u[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let f=Nt(u[2]),d;e.bracketedArray?d=f.length>2&&f.slice(-2)==="[]":(a[f]=(a?.[f]||0)+1,d=a[f]>1);let p=d&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=u[3]?Nt(u[4]):!0,h=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;d&&(Ps.call(n,p)?Array.isArray(n[p])||(n[p]=[n[p]]):n[p]=[]),Array.isArray(n[p])?n[p].push(h):n[p]=h}let l=[];for(let c of Object.keys(t)){if(!Ps.call(t,c)||typeof t[c]!="object"||Array.isArray(t[c]))continue;let u=Vi(c,".");n=t;let f=u.pop(),d=f.replace(/\\\./g,".");for(let p of u)p!=="__proto__"&&((!Ps.call(n,p)||typeof n[p]!="object")&&(n[p]=Object.create(null)),n=n[p]);n===t&&d===f||(n[d]=t[c],l.push(c))}for(let c of l)delete t[c];return t},Ki=s=>s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"),G=s=>typeof s!="string"||s.match(/[=\r\n]/)||s.match(/^\[/)||s.length>1&&Ki(s)||s!==s.trim()?JSON.stringify(s):s.split(";").join("\\;").split("#").join("\\#"),Nt=s=>{if(s=(s||"").trim(),Ki(s)){s.charAt(0)==="'"&&(s=s.slice(1,-1));try{s=JSON.parse(s)}catch{}}else{let e=!1,t="";for(let n=0,i=s.length;n<i;n++){let r=s.charAt(n);if(e)"\\;#".indexOf(r)!==-1?t+=r:t+="\\"+r,e=!1;else{if(";#".indexOf(r)!==-1)break;r==="\\"?e=!0:t+=r}}return e&&(t+="\\"),t.trim()}return s};Ri.exports={parse:ji,decode:ji,stringify:Ms,encode:Ms,safe:G,unsafe:Nt}});var O=b($=>{"use strict";var Fs=Symbol.for("yaml.alias"),Di=Symbol.for("yaml.document"),kt=Symbol.for("yaml.map"),Zi=Symbol.for("yaml.pair"),js=Symbol.for("yaml.scalar"),It=Symbol.for("yaml.seq"),X=Symbol.for("yaml.node.type"),Xl=s=>!!s&&typeof s=="object"&&s[X]===Fs,Ql=s=>!!s&&typeof s=="object"&&s[X]===Di,Hl=s=>!!s&&typeof s=="object"&&s[X]===kt,Dl=s=>!!s&&typeof s=="object"&&s[X]===Zi,zi=s=>!!s&&typeof s=="object"&&s[X]===js,Zl=s=>!!s&&typeof s=="object"&&s[X]===It;function er(s){if(s&&typeof s=="object")switch(s[X]){case kt:case It:return!0}return!1}function zl(s){if(s&&typeof s=="object")switch(s[X]){case Fs:case kt:case js:case It:return!0}return!1}var ec=s=>(zi(s)||er(s))&&!!s.anchor;$.ALIAS=Fs;$.DOC=Di;$.MAP=kt;$.NODE_TYPE=X;$.PAIR=Zi;$.SCALAR=js;$.SEQ=It;$.hasAnchor=ec;$.isAlias=Xl;$.isCollection=er;$.isDocument=Ql;$.isMap=Hl;$.isNode=zl;$.isPair=Dl;$.isScalar=zi;$.isSeq=Zl});var Ve=b(Vs=>{"use strict";var M=O(),F=Symbol("break visit"),tr=Symbol("skip children"),J=Symbol("remove node");function qt(s,e){let t=sr(e);M.isDocument(s)?Se(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):Se(null,s,t,Object.freeze([]))}qt.BREAK=F;qt.SKIP=tr;qt.REMOVE=J;function Se(s,e,t,n){let i=nr(s,e,t,n);if(M.isNode(i)||M.isPair(i))return ir(s,n,i),Se(s,i,t,n);if(typeof i!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=Se(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===F)return F;o===J&&(e.items.splice(r,1),r-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let r=Se("key",e.key,t,n);if(r===F)return F;r===J&&(e.key=null);let o=Se("value",e.value,t,n);if(o===F)return F;o===J&&(e.value=null)}}return i}async function Ct(s,e){let t=sr(e);M.isDocument(s)?await Ne(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):await Ne(null,s,t,Object.freeze([]))}Ct.BREAK=F;Ct.SKIP=tr;Ct.REMOVE=J;async function Ne(s,e,t,n){let i=await nr(s,e,t,n);if(M.isNode(i)||M.isPair(i))return ir(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ne(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===F)return F;o===J&&(e.items.splice(r,1),r-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let r=await Ne("key",e.key,t,n);if(r===F)return F;r===J&&(e.key=null);let o=await Ne("value",e.value,t,n);if(o===F)return F;o===J&&(e.value=null)}}return i}function sr(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function nr(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(M.isMap(e))return t.Map?.(s,e,n);if(M.isSeq(e))return t.Seq?.(s,e,n);if(M.isPair(e))return t.Pair?.(s,e,n);if(M.isScalar(e))return t.Scalar?.(s,e,n);if(M.isAlias(e))return t.Alias?.(s,e,n)}function ir(s,e,t){let n=e[e.length-1];if(M.isCollection(n))n.items[s]=t;else if(M.isPair(n))s==="key"?n.key=t:n.value=t;else if(M.isDocument(n))n.contents=t;else{let i=M.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Vs.visit=qt;Vs.visitAsync=Ct});var Ks=b(or=>{"use strict";var rr=O(),tc=Ve(),sc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},nc=s=>s.replace(/[!,[\]{}]/g,e=>sc[e]),Ke=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+nc(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&rr.isNode(e.contents)){let r={};tc.visit(e.contents,(o,a)=>{rr.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
5
5
  `)}};Ke.defaultYaml={explicit:!1,version:"1.2"};Ke.defaultTags={"!!":"tag:yaml.org,2002:"};or.Directives=Ke});var Lt=b(Re=>{"use strict";var ar=O(),ic=Ve();function rc(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function lr(s){let e=new Set;return ic.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function cr(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function oc(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=lr(s));let o=cr(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(ar.isScalar(o.node)||ar.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}Re.anchorIsValid=rc;Re.anchorNames=lr;Re.createNodeAnchors=oc;Re.findNewAnchor=cr});var Rs=b(fr=>{"use strict";function Ye(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=Ye(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=Ye(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=Ye(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=Ye(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}fr.applyReviver=Ye});var D=b(dr=>{"use strict";var ac=O();function ur(s,e,t){if(Array.isArray(s))return s.map((n,i)=>ur(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!ac.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}dr.toJS=ur});var Pt=b(pr=>{"use strict";var lc=Rs(),hr=O(),cc=D(),Ys=class{constructor(e){Object.defineProperty(this,hr.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!hr.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=cc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?lc.applyReviver(r,{"":a},"",a):a}};pr.NodeBase=Ys});var Ue=b(mr=>{"use strict";var fc=Lt(),uc=Ve(),Ee=O(),dc=Pt(),hc=D(),Us=class extends dc.NodeBase{constructor(e){super(Ee.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],uc.visit(e,{Node:(r,o)=>{(Ee.isAlias(o)||Ee.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(hc.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Mt(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(fc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function Mt(s,e,t){if(Ee.isAlias(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(Ee.isCollection(e)){let n=0;for(let i of e.items){let r=Mt(s,i,t);r>n&&(n=r)}return n}else if(Ee.isPair(e)){let n=Mt(s,e.key,t),i=Mt(s,e.value,t);return Math.max(n,i)}return 1}mr.Alias=Us});var C=b(Js=>{"use strict";var pc=O(),mc=Pt(),gc=D(),yc=s=>!s||typeof s!="function"&&typeof s!="object",Z=class extends mc.NodeBase{constructor(e){super(pc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:gc.toJS(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED="BLOCK_FOLDED";Z.BLOCK_LITERAL="BLOCK_LITERAL";Z.PLAIN="PLAIN";Z.QUOTE_DOUBLE="QUOTE_DOUBLE";Z.QUOTE_SINGLE="QUOTE_SINGLE";Js.Scalar=Z;Js.isScalarValue=yc});var Je=b(yr=>{"use strict";var bc=Ue(),fe=O(),gr=C(),wc="tag:yaml.org,2002:";function Sc(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function Nc(s,e,t){if(fe.isDocument(s)&&(s=s.contents),fe.isNode(s))return s;if(fe.isPair(s)){let f=t.schema[fe.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new bc.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=wc+e.slice(2));let c=Sc(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new gr.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?o[fe.MAP]:Symbol.iterator in Object(s)?o[fe.SEQ]:o[fe.MAP]}r&&(r(c),delete t.onTagObj);let u=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new gr.Scalar(s);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}yr.createNode=Nc});var _t=b($t=>{"use strict";var Ec=Je(),W=O(),vc=Pt();function Ws(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Ec.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var br=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Gs=class extends vc.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>W.isNode(n)||W.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(br(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(W.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ws(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(W.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&W.isScalar(r)?r.value:r:W.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!W.isPair(t))return!1;let n=t.value;return n==null||e&&W.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return W.isCollection(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(W.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ws(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};$t.Collection=Gs;$t.collectionFromPath=Ws;$t.isEmptyPath=br});var We=b(xt=>{"use strict";var Ac=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Xs(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Tc=(s,e,t)=>s.endsWith(`