just-bash 2.12.4 → 2.12.6

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 (272) hide show
  1. package/dist/banned-patterns-test.d.ts +0 -7
  2. package/dist/bin/chunks/{awk2-RGDNV4HO.js → awk2-EB5SCHVW.js} +1 -1
  3. package/dist/bin/{shell/chunks/chmod-4O2C4V42.js → chunks/chmod-N5CQATDW.js} +1 -1
  4. package/dist/bin/{shell/chunks/chunk-WO4B7WUT.js → chunks/chunk-5MUD3WB2.js} +1 -1
  5. package/dist/bin/chunks/chunk-7ADG3DNO.js +8 -0
  6. package/dist/bin/{shell/chunks/chunk-Q4WHWGOT.js → chunks/chunk-BBRVF6XE.js} +1 -1
  7. package/dist/bin/chunks/chunk-DHFZMFUW.js +36 -0
  8. package/dist/bin/chunks/{chunk-LHN3LRVT.js → chunk-IRCLOW32.js} +20 -20
  9. package/dist/bin/chunks/chunk-JX6YLHDX.js +2 -0
  10. package/dist/bin/chunks/chunk-MY5PY2PL.js +2 -0
  11. package/dist/bin/chunks/chunk-NTKUVXEL.js +5 -0
  12. package/dist/bin/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  13. package/dist/bin/chunks/{chunk-DGFDVZ4N.js → chunk-OLN6BSO3.js} +1 -1
  14. package/dist/bin/chunks/chunk-OQV5J23L.js +7 -0
  15. package/dist/bin/chunks/chunk-PIBXJ3VX.js +13 -0
  16. package/dist/bin/chunks/chunk-PLKGKTIS.js +6 -0
  17. package/dist/bin/{shell/chunks/chunk-J4WYAO5Q.js → chunks/chunk-QTII62YM.js} +13 -13
  18. package/dist/bin/chunks/chunk-QZNF3Y3J.js +2 -0
  19. package/dist/bin/chunks/chunk-R2LDP472.js +8 -0
  20. package/dist/bin/chunks/chunk-ROMKUVHI.js +10 -0
  21. package/dist/bin/chunks/chunk-STOAUD75.js +11 -0
  22. package/dist/bin/chunks/chunk-SXB55JOI.js +2 -0
  23. package/dist/bin/chunks/chunk-VCKKRS7V.js +12 -0
  24. package/dist/bin/chunks/{chunk-SY2WM5RM.js → chunk-VIYJJTN2.js} +5 -5
  25. package/dist/bin/{shell/chunks/chunk-GA6KXSOC.js → chunks/chunk-YFPDB4PH.js} +1 -1
  26. package/dist/bin/chunks/chunk-YMMJLYIX.js +2 -0
  27. package/dist/bin/chunks/chunk-YTIURC67.js +2 -0
  28. package/dist/bin/chunks/chunk-YWZOGBFE.js +9 -0
  29. package/dist/bin/chunks/chunk-YX7OOTPO.js +9 -0
  30. package/dist/bin/chunks/chunk-ZJGIBTWD.js +2 -0
  31. package/dist/bin/chunks/{chunk-Q3FNZYGG.js → chunk-ZNPXCE5B.js} +99 -99
  32. package/dist/bin/chunks/chunk-ZSVBYEY4.js +6 -0
  33. package/dist/bin/chunks/curl-3GMIPMCI.js +26 -0
  34. package/dist/bin/{shell/chunks/expansion-TCB3WZP5.js → chunks/expansion-JBCP2CHQ.js} +1 -1
  35. package/dist/bin/chunks/find-MTLF23HX.js +2 -0
  36. package/dist/bin/chunks/flag-coverage-7GOZYXJT.js +2 -0
  37. package/dist/bin/{shell/chunks/grep-F3GT2VPG.js → chunks/grep-OZJTRD4D.js} +1 -1
  38. package/dist/bin/chunks/jq-P457LMHU.js +2 -0
  39. package/dist/bin/chunks/{ln-BEOFQJNP.js → ln-VAOSD4HK.js} +1 -1
  40. package/dist/bin/chunks/mkdir-CH7JGW4N.js +2 -0
  41. package/dist/bin/chunks/python3-45TMCI4M.js +17 -0
  42. package/dist/bin/chunks/{readlink-YNOUXNUY.js → readlink-BD5VFOC5.js} +1 -1
  43. package/dist/bin/chunks/rm-GWYJO4W7.js +2 -0
  44. package/dist/bin/chunks/sed-UV2LTNVK.js +2 -0
  45. package/dist/bin/chunks/sleep-3WHM7JMW.js +2 -0
  46. package/dist/bin/chunks/{sqlite3-SJHZFBT2.js → sqlite3-B3P3OMPI.js} +1 -1
  47. package/dist/bin/chunks/stat-XS2LXYS2.js +2 -0
  48. package/dist/bin/chunks/tar-SO3XDDIW.js +2 -0
  49. package/dist/bin/chunks/time-GZSHCM77.js +2 -0
  50. package/dist/bin/chunks/timeout-BYB3L2JA.js +2 -0
  51. package/dist/bin/chunks/worker.js +229 -20
  52. package/dist/bin/chunks/xan-FZB7FHX3.js +2 -0
  53. package/dist/bin/chunks/yq-H7D2U3HS.js +2 -0
  54. package/dist/bin/just-bash.js +183 -183
  55. package/dist/bin/shell/chunks/{awk2-RGDNV4HO.js → awk2-EB5SCHVW.js} +1 -1
  56. package/dist/bin/{chunks/chmod-4O2C4V42.js → shell/chunks/chmod-N5CQATDW.js} +1 -1
  57. package/dist/bin/{chunks/chunk-WO4B7WUT.js → shell/chunks/chunk-5MUD3WB2.js} +1 -1
  58. package/dist/bin/shell/chunks/chunk-7ADG3DNO.js +8 -0
  59. package/dist/bin/{chunks/chunk-Q4WHWGOT.js → shell/chunks/chunk-BBRVF6XE.js} +1 -1
  60. package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +2 -0
  61. package/dist/bin/shell/chunks/chunk-DHFZMFUW.js +36 -0
  62. package/dist/bin/shell/chunks/{chunk-LHN3LRVT.js → chunk-IRCLOW32.js} +20 -20
  63. package/dist/bin/shell/chunks/chunk-JX6YLHDX.js +2 -0
  64. package/dist/bin/shell/chunks/chunk-NTKUVXEL.js +5 -0
  65. package/dist/bin/shell/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  66. package/dist/bin/shell/chunks/{chunk-DGFDVZ4N.js → chunk-OLN6BSO3.js} +1 -1
  67. package/dist/bin/shell/chunks/chunk-OQV5J23L.js +7 -0
  68. package/dist/bin/shell/chunks/chunk-PIBXJ3VX.js +13 -0
  69. package/dist/bin/shell/chunks/chunk-PLKGKTIS.js +6 -0
  70. package/dist/bin/{chunks/chunk-J4WYAO5Q.js → shell/chunks/chunk-QTII62YM.js} +13 -13
  71. package/dist/bin/shell/chunks/chunk-QZNF3Y3J.js +2 -0
  72. package/dist/bin/shell/chunks/chunk-R2LDP472.js +8 -0
  73. package/dist/bin/shell/chunks/chunk-ROMKUVHI.js +10 -0
  74. package/dist/bin/shell/chunks/chunk-STOAUD75.js +11 -0
  75. package/dist/bin/shell/chunks/chunk-SXB55JOI.js +2 -0
  76. package/dist/bin/shell/chunks/chunk-VCKKRS7V.js +12 -0
  77. package/dist/bin/shell/chunks/{chunk-SY2WM5RM.js → chunk-VIYJJTN2.js} +5 -5
  78. package/dist/bin/{chunks/chunk-GA6KXSOC.js → shell/chunks/chunk-YFPDB4PH.js} +1 -1
  79. package/dist/bin/shell/chunks/chunk-YMMJLYIX.js +2 -0
  80. package/dist/bin/shell/chunks/chunk-YTIURC67.js +2 -0
  81. package/dist/bin/shell/chunks/chunk-YWZOGBFE.js +9 -0
  82. package/dist/bin/shell/chunks/chunk-YX7OOTPO.js +9 -0
  83. package/dist/bin/shell/chunks/chunk-ZJGIBTWD.js +2 -0
  84. package/dist/bin/shell/chunks/{chunk-Q3FNZYGG.js → chunk-ZNPXCE5B.js} +99 -99
  85. package/dist/bin/shell/chunks/chunk-ZSVBYEY4.js +6 -0
  86. package/dist/bin/shell/chunks/curl-3GMIPMCI.js +26 -0
  87. package/dist/bin/{chunks/expansion-TCB3WZP5.js → shell/chunks/expansion-JBCP2CHQ.js} +1 -1
  88. package/dist/bin/shell/chunks/find-MTLF23HX.js +2 -0
  89. package/dist/bin/shell/chunks/flag-coverage-7GOZYXJT.js +2 -0
  90. package/dist/bin/{chunks/grep-F3GT2VPG.js → shell/chunks/grep-OZJTRD4D.js} +1 -1
  91. package/dist/bin/shell/chunks/jq-P457LMHU.js +2 -0
  92. package/dist/bin/shell/chunks/{ln-BEOFQJNP.js → ln-VAOSD4HK.js} +1 -1
  93. package/dist/bin/shell/chunks/mkdir-CH7JGW4N.js +2 -0
  94. package/dist/bin/shell/chunks/python3-IV3DBMHM.js +17 -0
  95. package/dist/bin/shell/chunks/{readlink-YNOUXNUY.js → readlink-BD5VFOC5.js} +1 -1
  96. package/dist/bin/shell/chunks/rm-GWYJO4W7.js +2 -0
  97. package/dist/bin/shell/chunks/sed-UV2LTNVK.js +2 -0
  98. package/dist/bin/shell/chunks/sleep-3WHM7JMW.js +2 -0
  99. package/dist/bin/shell/chunks/{sqlite3-SJHZFBT2.js → sqlite3-B3P3OMPI.js} +1 -1
  100. package/dist/bin/shell/chunks/stat-XS2LXYS2.js +2 -0
  101. package/dist/bin/shell/chunks/tar-SO3XDDIW.js +2 -0
  102. package/dist/bin/shell/chunks/time-GZSHCM77.js +2 -0
  103. package/dist/bin/shell/chunks/timeout-BYB3L2JA.js +2 -0
  104. package/dist/bin/shell/chunks/xan-FZB7FHX3.js +2 -0
  105. package/dist/bin/shell/chunks/yq-H7D2U3HS.js +2 -0
  106. package/dist/bin/shell/shell.js +187 -187
  107. package/dist/bundle/browser.js +632 -635
  108. package/dist/bundle/chunks/{awk2-XLDR2J4Q.js → awk2-VPBKDCSO.js} +1 -1
  109. package/dist/bundle/chunks/{chmod-MIKE3OIT.js → chmod-SYMGL4JA.js} +1 -1
  110. package/dist/bundle/chunks/chunk-3ZUFRYJ4.js +1 -0
  111. package/dist/bundle/chunks/chunk-4GTNDTRF.js +7 -0
  112. package/dist/bundle/chunks/{chunk-N4QLRJ32.js → chunk-4YPFHVJJ.js} +1 -1
  113. package/dist/bundle/chunks/chunk-5QVNJEHU.js +8 -0
  114. package/dist/bundle/chunks/chunk-64CW2LGZ.js +6 -0
  115. package/dist/bundle/chunks/chunk-6HBBXB3L.js +11 -0
  116. package/dist/bundle/chunks/chunk-72EQZSVH.js +4 -0
  117. package/dist/bundle/chunks/chunk-7YDOWJ75.js +1 -0
  118. package/dist/bundle/chunks/chunk-AUD37QB3.js +35 -0
  119. package/dist/bundle/chunks/{chunk-NTP6TTH5.js → chunk-BED5HSP2.js} +13 -13
  120. package/dist/bundle/chunks/{chunk-K5BTXJQC.js → chunk-C7ZTXK5C.js} +99 -99
  121. package/dist/bundle/chunks/chunk-D2FZX7A2.js +10 -0
  122. package/dist/bundle/chunks/chunk-DZZS6SJP.js +1 -0
  123. package/dist/bundle/chunks/{chunk-KAZYKNBG.js → chunk-EX62JIX3.js} +5 -5
  124. package/dist/bundle/chunks/chunk-FGALERPA.js +8 -0
  125. package/dist/bundle/chunks/chunk-HJWBQKYG.js +5 -0
  126. package/dist/bundle/chunks/chunk-IP7G3BNA.js +7 -0
  127. package/dist/bundle/chunks/chunk-J642UCRS.js +1 -0
  128. package/dist/bundle/chunks/chunk-KZ7BI7TV.js +5 -0
  129. package/dist/bundle/chunks/chunk-RH6GWZAJ.js +1 -0
  130. package/dist/bundle/chunks/{chunk-4VCAQZKQ.js → chunk-TRD56HID.js} +39 -39
  131. package/dist/bundle/chunks/chunk-U5FWK6IA.js +12 -0
  132. package/dist/bundle/chunks/{chunk-H4QOE4W3.js → chunk-VBF2GWEM.js} +20 -20
  133. package/dist/bundle/chunks/{chunk-2OHMPZNZ.js → chunk-VSWTMNI3.js} +1 -1
  134. package/dist/bundle/chunks/chunk-X2AJGDEF.js +1 -0
  135. package/dist/bundle/chunks/{chunk-T2EHE3CV.js → chunk-X36DXRVC.js} +1 -1
  136. package/dist/bundle/chunks/chunk-X3CVFNQZ.js +9 -0
  137. package/dist/bundle/chunks/chunk-XHM67O4N.js +1 -0
  138. package/dist/bundle/chunks/{chunk-CYTBPLPE.js → chunk-YS3AZT3J.js} +1 -1
  139. package/dist/bundle/chunks/curl-KM2ZAUR6.js +25 -0
  140. package/dist/bundle/chunks/{expansion-HJ6B4DDG.js → expansion-XG7G47TX.js} +1 -1
  141. package/dist/bundle/chunks/find-DOIVMX6X.js +1 -0
  142. package/dist/bundle/chunks/flag-coverage-NT32EG6Q.js +1 -0
  143. package/dist/bundle/chunks/{grep-LXKUQUAE.js → grep-3AIAIJVR.js} +1 -1
  144. package/dist/bundle/chunks/jq-NLRWI2Q6.js +1 -0
  145. package/dist/bundle/chunks/{ln-RI2SJGXU.js → ln-UJ6YJVBK.js} +1 -1
  146. package/dist/bundle/chunks/mkdir-F6XHPXZC.js +1 -0
  147. package/dist/bundle/chunks/python3-G2ZUJAQL.js +16 -0
  148. package/dist/bundle/chunks/{readlink-IEQO24KU.js → readlink-MI4GCHJF.js} +1 -1
  149. package/dist/bundle/chunks/rm-FYNVTQIU.js +1 -0
  150. package/dist/bundle/chunks/sed-2BILOGNL.js +1 -0
  151. package/dist/bundle/chunks/sleep-IUBP5GMH.js +1 -0
  152. package/dist/bundle/chunks/{sqlite3-CTI4ZW7L.js → sqlite3-VEDNWJL6.js} +1 -1
  153. package/dist/bundle/chunks/stat-BT5A227F.js +1 -0
  154. package/dist/bundle/chunks/tar-LKO7DKAK.js +1 -0
  155. package/dist/bundle/chunks/time-XL42Z4U5.js +1 -0
  156. package/dist/bundle/chunks/timeout-TL4Q5YKZ.js +1 -0
  157. package/dist/bundle/chunks/worker.js +229 -20
  158. package/dist/bundle/chunks/xan-KSDYKKEK.js +1 -0
  159. package/dist/bundle/chunks/yq-HIQ4WMDY.js +1 -0
  160. package/dist/bundle/index.cjs +857 -860
  161. package/dist/bundle/index.js +246 -246
  162. package/dist/commands/duration.d.ts +5 -0
  163. package/dist/commands/format-mode.d.ts +4 -0
  164. package/dist/commands/python3/worker.d.ts +1 -0
  165. package/dist/commands/query-engine/safe-object.d.ts +13 -0
  166. package/dist/commands/sed/types.d.ts +0 -4
  167. package/dist/commands/sqlite3/worker.d.ts +1 -0
  168. package/dist/commands/tar/archive.d.ts +18 -4
  169. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +0 -3
  170. package/dist/fs/mountable-fs/mountable-fs.d.ts +0 -4
  171. package/dist/fs/overlay-fs/overlay-fs.d.ts +6 -7
  172. package/dist/fs/path-utils.d.ts +46 -0
  173. package/dist/fs/read-write-fs/read-write-fs.d.ts +0 -4
  174. package/dist/fs/real-fs-utils.d.ts +17 -11
  175. package/dist/timers.d.ts +0 -3
  176. package/package.json +3 -2
  177. package/dist/bin/chunks/chunk-253LRF5J.js +0 -11
  178. package/dist/bin/chunks/chunk-4C4F4EKM.js +0 -2
  179. package/dist/bin/chunks/chunk-55QIFSKH.js +0 -36
  180. package/dist/bin/chunks/chunk-5VFN7VVJ.js +0 -9
  181. package/dist/bin/chunks/chunk-6MF2IYQX.js +0 -10
  182. package/dist/bin/chunks/chunk-D2GFNFUN.js +0 -7
  183. package/dist/bin/chunks/chunk-EO5AH4U7.js +0 -5
  184. package/dist/bin/chunks/chunk-GIFF636B.js +0 -2
  185. package/dist/bin/chunks/chunk-KWLLB7S3.js +0 -7
  186. package/dist/bin/chunks/chunk-NDP6L74Z.js +0 -10
  187. package/dist/bin/chunks/chunk-PWZZGTFL.js +0 -13
  188. package/dist/bin/chunks/chunk-UYBH3FNE.js +0 -2
  189. package/dist/bin/chunks/chunk-V5YFCVCZ.js +0 -12
  190. package/dist/bin/chunks/chunk-V7VIJQD6.js +0 -6
  191. package/dist/bin/chunks/chunk-WMYKQURM.js +0 -2
  192. package/dist/bin/chunks/chunk-XAL6VWGA.js +0 -9
  193. package/dist/bin/chunks/chunk-YYQ22ZRL.js +0 -8
  194. package/dist/bin/chunks/curl-RWQO3SBN.js +0 -26
  195. package/dist/bin/chunks/find-4YAO7JQS.js +0 -2
  196. package/dist/bin/chunks/flag-coverage-K6IBGWAC.js +0 -2
  197. package/dist/bin/chunks/jq-VBB2XIZS.js +0 -2
  198. package/dist/bin/chunks/mkdir-6OKMS3KO.js +0 -2
  199. package/dist/bin/chunks/python3-JX5PXXTX.js +0 -17
  200. package/dist/bin/chunks/rm-5QIBTLJG.js +0 -2
  201. package/dist/bin/chunks/sed-BYFYBR4A.js +0 -2
  202. package/dist/bin/chunks/sleep-E3K6M6BN.js +0 -2
  203. package/dist/bin/chunks/stat-XH7E4E2C.js +0 -2
  204. package/dist/bin/chunks/tar-W5GBTEDZ.js +0 -2
  205. package/dist/bin/chunks/time-AWAKKRSE.js +0 -2
  206. package/dist/bin/chunks/timeout-OLS72AZG.js +0 -2
  207. package/dist/bin/chunks/xan-BJ66NSYT.js +0 -2
  208. package/dist/bin/chunks/yq-GPYVGU2N.js +0 -2
  209. package/dist/bin/shell/chunks/chunk-253LRF5J.js +0 -11
  210. package/dist/bin/shell/chunks/chunk-4C4F4EKM.js +0 -2
  211. package/dist/bin/shell/chunks/chunk-55QIFSKH.js +0 -36
  212. package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +0 -9
  213. package/dist/bin/shell/chunks/chunk-6MF2IYQX.js +0 -10
  214. package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +0 -7
  215. package/dist/bin/shell/chunks/chunk-EO5AH4U7.js +0 -5
  216. package/dist/bin/shell/chunks/chunk-GIFF636B.js +0 -2
  217. package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +0 -7
  218. package/dist/bin/shell/chunks/chunk-NDP6L74Z.js +0 -10
  219. package/dist/bin/shell/chunks/chunk-PWZZGTFL.js +0 -13
  220. package/dist/bin/shell/chunks/chunk-UYBH3FNE.js +0 -2
  221. package/dist/bin/shell/chunks/chunk-V5YFCVCZ.js +0 -12
  222. package/dist/bin/shell/chunks/chunk-V7VIJQD6.js +0 -6
  223. package/dist/bin/shell/chunks/chunk-WMYKQURM.js +0 -2
  224. package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +0 -9
  225. package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +0 -8
  226. package/dist/bin/shell/chunks/curl-RWQO3SBN.js +0 -26
  227. package/dist/bin/shell/chunks/find-4YAO7JQS.js +0 -2
  228. package/dist/bin/shell/chunks/flag-coverage-K6IBGWAC.js +0 -2
  229. package/dist/bin/shell/chunks/jq-VBB2XIZS.js +0 -2
  230. package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +0 -2
  231. package/dist/bin/shell/chunks/python3-JX5PXXTX.js +0 -17
  232. package/dist/bin/shell/chunks/rm-5QIBTLJG.js +0 -2
  233. package/dist/bin/shell/chunks/sed-BYFYBR4A.js +0 -2
  234. package/dist/bin/shell/chunks/sleep-E3K6M6BN.js +0 -2
  235. package/dist/bin/shell/chunks/stat-XH7E4E2C.js +0 -2
  236. package/dist/bin/shell/chunks/tar-W5GBTEDZ.js +0 -2
  237. package/dist/bin/shell/chunks/time-AWAKKRSE.js +0 -2
  238. package/dist/bin/shell/chunks/timeout-OLS72AZG.js +0 -2
  239. package/dist/bin/shell/chunks/xan-BJ66NSYT.js +0 -2
  240. package/dist/bin/shell/chunks/yq-GPYVGU2N.js +0 -2
  241. package/dist/bundle/chunks/chunk-27LMNKBP.js +0 -7
  242. package/dist/bundle/chunks/chunk-3RCXHB4E.js +0 -4
  243. package/dist/bundle/chunks/chunk-7MKBHGLS.js +0 -1
  244. package/dist/bundle/chunks/chunk-DOTBQEPN.js +0 -5
  245. package/dist/bundle/chunks/chunk-GENDESYN.js +0 -1
  246. package/dist/bundle/chunks/chunk-GZ2N3SXD.js +0 -8
  247. package/dist/bundle/chunks/chunk-IJXFPKNC.js +0 -1
  248. package/dist/bundle/chunks/chunk-IKZ5LEGB.js +0 -6
  249. package/dist/bundle/chunks/chunk-OFJTSXN6.js +0 -8
  250. package/dist/bundle/chunks/chunk-QUME7R6S.js +0 -9
  251. package/dist/bundle/chunks/chunk-TBAWQWQB.js +0 -12
  252. package/dist/bundle/chunks/chunk-VYV3YE2F.js +0 -35
  253. package/dist/bundle/chunks/chunk-W42IGK5R.js +0 -11
  254. package/dist/bundle/chunks/chunk-WAN3B6E3.js +0 -9
  255. package/dist/bundle/chunks/chunk-XZ3MZS57.js +0 -6
  256. package/dist/bundle/chunks/chunk-YCABLDKV.js +0 -10
  257. package/dist/bundle/chunks/chunk-ZK6J6F7O.js +0 -1
  258. package/dist/bundle/chunks/curl-6L7YZUIH.js +0 -25
  259. package/dist/bundle/chunks/find-DQFMWHAC.js +0 -1
  260. package/dist/bundle/chunks/flag-coverage-VGF5NAZP.js +0 -1
  261. package/dist/bundle/chunks/jq-JQXAVWNT.js +0 -1
  262. package/dist/bundle/chunks/mkdir-QWGXDWUS.js +0 -1
  263. package/dist/bundle/chunks/python3-TSPOVUHX.js +0 -16
  264. package/dist/bundle/chunks/rm-KPTLPKPH.js +0 -1
  265. package/dist/bundle/chunks/sed-CJFW7UYO.js +0 -1
  266. package/dist/bundle/chunks/sleep-TFDNFOXK.js +0 -1
  267. package/dist/bundle/chunks/stat-74KBZFAX.js +0 -1
  268. package/dist/bundle/chunks/tar-Y6LP5EBC.js +0 -1
  269. package/dist/bundle/chunks/time-WBKSMCJ6.js +0 -1
  270. package/dist/bundle/chunks/timeout-O7WSXY5H.js +0 -1
  271. package/dist/bundle/chunks/xan-VMLUNIDS.js +0 -1
  272. package/dist/bundle/chunks/yq-QXIYE3MW.js +0 -1
@@ -1,8 +1 @@
1
- /**
2
- * This file exists solely to test that the banned-patterns lint script
3
- * correctly detects all patterns and that ignore comments work properly.
4
- *
5
- * DO NOT import or use this file anywhere - it's only for lint verification.
6
- * Each pattern below would be flagged without its corresponding ignore comment.
7
- */
8
1
  export {};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-DGFDVZ4N.js";import"./chunk-4PRVMER6.js";import"./chunk-WO4B7WUT.js";import"./chunk-EO5AH4U7.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as awkCommand2,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-OLN6BSO3.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as awkCommand2,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-5VFN7VVJ.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as chmodCommand,b as flagsForFuzzing};
2
+ import{a,b}from"./chunk-7ADG3DNO.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as chmodCommand,b as flagsForFuzzing};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as s,b as i}from"./chunk-EO5AH4U7.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
2
+ import{a as s,b as i}from"./chunk-NTKUVXEL.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{a as w,b as v,c as $}from"./chunk-GTNBSMZR.js";var R={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},C={name:"chmod",async execute(s,a){if(v(s))return w(R);if(s.length<2)return{stdout:"",stderr:`chmod: missing operand
3
+ `,exitCode:1};let e=!1,c=!1,i=0;for(;i<s.length&&s[i].startsWith("-");){let t=s[i];if(t==="-R"||t==="--recursive")e=!0,i++;else if(t==="-v"||t==="--verbose")c=!0,i++;else if(t==="--"){i++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(e=!0),t.includes("v")&&(c=!0),i++;continue}return $("chmod",t)}}if(s.length-i<2)return{stdout:"",stderr:`chmod: missing operand
4
+ `,exitCode:1};let n=s[i],l=s.slice(i+1),r=/^[0-7]+$/.test(n),o;if(r)o=parseInt(n,8);else try{p(n,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${n}'
5
+ `,exitCode:1}}let f="",d="",u=!1;for(let t of l){let h=a.fs.resolvePath(a.cwd,t);try{let m;if(r&&o!==void 0)m=o;else{let g=await a.fs.stat(h);m=p(n,g.mode)}if(await a.fs.chmod(h,m),c&&(f+=`mode of '${t}' changed to ${m.toString(8).padStart(4,"0")}
6
+ `),e&&(await a.fs.stat(h)).isDirectory){let I=await y(a,h,r?o:void 0,r?void 0:n,c);f+=I}}catch{d+=`chmod: cannot access '${t}': No such file or directory
7
+ `,u=!0}}return{stdout:f,stderr:d,exitCode:u?1:0}}};async function y(s,a,e,c,i){let n="",l=await s.fs.readdir(a);for(let r of l){let o=a==="/"?`/${r}`:`${a}/${r}`,f;if(e!==void 0)f=e;else if(c!==void 0){let u=await s.fs.stat(o);f=p(c,u.mode)}else f=420;await s.fs.chmod(o,f),i&&(n+=`mode of '${o}' changed to ${f.toString(8).padStart(4,"0")}
8
+ `),(await s.fs.stat(o)).isDirectory&&(n+=await y(s,o,e,c,i))}return n}function p(s,a=420){if(/^[0-7]+$/.test(s))return parseInt(s,8);let e=a&4095,c=s.split(",");for(let i of c){let n=i.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!n)throw new Error(`Invalid mode: ${s}`);let l=n[1]||"a",r=n[2],o=n[3];(l==="a"||l==="")&&(l="ugo");let f=0;o.includes("r")&&(f|=4),o.includes("w")&&(f|=2),(o.includes("x")||o.includes("X"))&&(f|=1);let d=0;o.includes("s")&&(l.includes("u")&&(d|=2048),l.includes("g")&&(d|=1024)),o.includes("t")&&(d|=512);for(let u of l){let t=0;u==="u"?t=6:u==="g"?t=3:u==="o"&&(t=0);let h=f<<t;r==="+"?e|=h:r==="-"?e&=~h:r==="="&&(e&=~(7<<t),e|=h)}r==="+"?e|=d:r==="-"?e&=~d:r==="="&&(o.includes("s")&&(l.includes("u")&&(e&=-2049,e|=d&2048),l.includes("g")&&(e&=-1025,e|=d&1024)),o.includes("t")&&(e&=-513,e|=d&512))}return e}var O={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{C as a,O as b};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-GZHFXDDO.js";import{a as et}from"./chunk-QSDVMMYI.js";import{a as $}from"./chunk-V7VIJQD6.js";import{d as G}from"./chunk-UYBH3FNE.js";import{a as H}from"./chunk-SE4C7FJY.js";import{a as We}from"./chunk-5WFYIUU2.js";import{a as D,b as K}from"./chunk-GTNBSMZR.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-KGOUQS5A.js";var q,_e=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
2
+ import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-GZHFXDDO.js";import{a as et}from"./chunk-QSDVMMYI.js";import{a as $}from"./chunk-PLKGKTIS.js";import{f as G}from"./chunk-ZJGIBTWD.js";import{a as H}from"./chunk-SE4C7FJY.js";import{a as We}from"./chunk-5WFYIUU2.js";import{a as D,b as K}from"./chunk-GTNBSMZR.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-KGOUQS5A.js";var q,_e=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
3
3
  `||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
4
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 o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(t==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:n}):(this.pos++,{type:"/",value:"/",pos:n}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:n};if(this.match("=>"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(n,this.pos).replace(/_/g,"");return{type:t?"float":"int",value:r,pos:n}}readString(n){let t=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===n)return this.pos++,{type:"string",value:s,pos:t};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
5
5
  `;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var He={};Be(He,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";_e();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var B={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>k("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>Je(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>O(r.expr,n)),s=Object.hasOwn(B,e.name)?B[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=O(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function ze(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=O(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(ze(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return ze(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ke(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import{a as x,b as w}from"./chunk-JX6YLHDX.js";import{c as b}from"./chunk-5MUD3WB2.js";import{b as j}from"./chunk-NTKUVXEL.js";import{a as m}from"./chunk-SYG3IW7P.js";import{a as q,b as C}from"./chunk-GTNBSMZR.js";import{randomBytes as _}from"node:crypto";import{existsSync as E}from"node:fs";import{dirname as z,join as T}from"node:path";import{fileURLToPath as X}from"node:url";import{Worker as Y}from"node:worker_threads";import G from"sql.js";function V(e,t,r){switch(r.mode){case"list":return B(e,t,r);case"csv":return O(e,t,r);case"json":return I(e,t);case"line":return N(e,t,r);case"column":return R(e,t,r);case"table":return F(e,t,r);case"markdown":return Q(e,t,r);case"tabs":return U(e,t,r);case"box":return W(e,t,r);case"quote":return D(e,t,r);case"html":return H(e,t,r);case"ascii":return J(e,t,r)}}function f(e,t){return e==null?t:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function B(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(r.separator));for(let a of t)n.push(a.map(o=>f(o,r.nullValue)).join(r.separator));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function O(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(L).join(","));for(let a of t)n.push(a.map(o=>L(f(o,r.nullValue))).join(","));return n.length>0?`${n.join(`
3
+ `)}
4
+ `:""}function L(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
5
+ `)?`"${e.replace(/"/g,'""')}"`:e}function A(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function P(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):A(e):JSON.stringify(e)}function I(e,t){return t.length===0?"":`[${t.map(n=>`{${e.map((o,i)=>`${JSON.stringify(o)}:${P(n[i])}`).join(",")}}`).join(`,
6
+ `)}]
7
+ `}function N(e,t,r){if(e.length===0||t.length===0)return"";let n=Math.max(5,...e.map(o=>o.length)),a=[];for(let o of t)for(let i=0;i<e.length;i++){let s=e[i].padStart(n);a.push(`${s} = ${f(o[i],r.nullValue)}`)}return`${a.join(`
8
+ `)}
9
+ `}function R(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let i=0;i<o.length;i++){let s=f(o[i],r.nullValue).length;s>n[i]&&(n[i]=s)}let a=[];r.header&&(a.push(e.map((o,i)=>o.padEnd(n[i])).join(" ")),a.push(n.map(o=>"-".repeat(o)).join(" ")));for(let o of t)a.push(o.map((i,s)=>f(i,r.nullValue).padEnd(n[s])).join(" "));return a.length>0?`${a.join(`
10
+ `)}
11
+ `:""}function F(e,t,r){if(e.length===0)return"";let n=e.map(i=>i.length);for(let i of t)for(let s=0;s<i.length;s++){let p=f(i[s],r.nullValue).length;p>n[s]&&(n[s]=p)}let a=[],o=`+${n.map(i=>"-".repeat(i+2)).join("+")}+`;a.push(o),r.header&&(a.push(`| ${e.map((i,s)=>i.padEnd(n[s])).join(" | ")} |`),a.push(o));for(let i of t)a.push(`| ${i.map((s,p)=>f(s,r.nullValue).padEnd(n[p])).join(" | ")} |`);return a.push(o),`${a.join(`
12
+ `)}
13
+ `}function Q(e,t,r){if(e.length===0)return"";let n=[];r.header&&(n.push(`| ${e.join(" | ")} |`),n.push(`|${e.map(()=>"---").join("|")}|`));for(let a of t)n.push(`| ${a.map(o=>f(o,r.nullValue)).join(" | ")} |`);return n.length>0?`${n.join(`
14
+ `)}
15
+ `:""}function U(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(" "));for(let a of t)n.push(a.map(o=>f(o,r.nullValue)).join(" "));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function W(e,t,r){if(e.length===0)return"";let n=e.map(o=>o.length);for(let o of t)for(let i=0;i<o.length;i++){let s=f(o[i],r.nullValue).length;s>n[i]&&(n[i]=s)}let a=[];a.push(`\u250C${n.map(o=>"\u2500".repeat(o+2)).join("\u252C")}\u2510`),a.push(`\u2502 ${e.map((o,i)=>o.padEnd(n[i])).join(" \u2502 ")} \u2502`),a.push(`\u251C${n.map(o=>"\u2500".repeat(o+2)).join("\u253C")}\u2524`);for(let o of t)a.push(`\u2502 ${o.map((i,s)=>f(i,r.nullValue).padEnd(n[s])).join(" \u2502 ")} \u2502`);return a.push(`\u2514${n.map(o=>"\u2500".repeat(o+2)).join("\u2534")}\u2518`),`${a.join(`
16
+ `)}
17
+ `}function D(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(a=>`'${a}'`).join(","));for(let a of t)n.push(a.map(o=>o==null?"NULL":typeof o=="number"?Number.isInteger(o)?String(o):A(o):`'${String(o)}'`).join(","));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function H(e,t,r){let n=[];r.header&&e.length>0&&(n.push(`<TR>${e.map(a=>`<TH>${M(a)}</TH>`).join("")}`),n.push("</TR>"));for(let a of t)n.push(`<TR>${a.map(o=>`<TD>${M(f(o,r.nullValue))}</TD>`).join("")}`),n.push("</TR>");return n.length>0?`${n.join(`
18
+ `)}
19
+ `:""}function M(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function J(e,t,r){let o=[];r.header&&e.length>0&&o.push(e.join(""));for(let i of t)o.push(i.map(s=>f(s,r.nullValue)).join(""));return o.length>0?o.join("")+"":""}var K=5e3,Z={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function v(e){let t={mode:"list",header:!1,separator:"|",newline:`
20
+ `,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},r=null,n=null,a=!1,o=!1;for(let i=0;i<e.length;i++){let s=e[i];if(o){r===null?r=s:n===null&&(n=s);continue}if(s==="--")o=!0;else if(s==="-version")a=!0;else if(s==="-list")t.mode="list";else if(s==="-csv")t.mode="csv";else if(s==="-json")t.mode="json";else if(s==="-line")t.mode="line";else if(s==="-column")t.mode="column";else if(s==="-table")t.mode="table";else if(s==="-markdown")t.mode="markdown";else if(s==="-tabs")t.mode="tabs";else if(s==="-box")t.mode="box";else if(s==="-quote")t.mode="quote";else if(s==="-html")t.mode="html";else if(s==="-ascii")t.mode="ascii";else if(s==="-header")t.header=!0;else if(s==="-noheader")t.header=!1;else if(s==="-readonly")t.readonly=!0;else if(s==="-bail")t.bail=!0;else if(s==="-echo")t.echo=!0;else if(s==="-separator"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
21
+ `,exitCode:1};t.separator=e[++i]}else if(s==="-newline"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
22
+ `,exitCode:1};t.newline=e[++i]}else if(s==="-nullvalue"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
23
+ `,exitCode:1};t.nullValue=e[++i]}else if(s==="-cmd"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
24
+ `,exitCode:1};t.cmd=e[++i]}else{if(s.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${s.startsWith("--")?s.slice(1):s}
25
+ Use -help for a list of options.
26
+ `,exitCode:1};r===null?r=s:n===null&&(n=s)}}return{options:t,database:r,sql:n,showVersion:a}}async function ee(){let e=await j.runTrustedAsync(()=>G()),t=new e.Database;try{let r=t.exec("SELECT sqlite_version()");return r.length>0&&r[0].values.length>0?String(r[0].values[0][0]):"unknown"}finally{t.close()}}function re(){let e=z(X(import.meta.url)),t=T(e,"../../commands/sqlite3/worker.js");if(E(t))return t;let r=T(e,"worker.js");if(E(r))return r;let n=T(e,"../../../dist/commands/sqlite3/worker.js");if(E(n))return n;throw new Error("sqlite3 worker not found. Run 'pnpm build' to compile the worker.")}var te={createWorker(e,t){return new Y(e,{workerData:t})}};function ne(){return _(16).toString("hex")}function oe(e,t){if(!e||typeof e!="object")return{success:!1,error:"Malformed worker response"};let r=e;return typeof r.protocolToken!="string"||r.protocolToken!==t?{success:!1,error:"Malformed worker response: invalid protocol token"}:r.type==="security-violation"?{success:!1,error:`Security violation: ${typeof r.violation?.type=="string"?r.violation.type:"unknown"}`}:typeof r.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:r.success?Array.isArray(r.results)?typeof r.hasModifications!="boolean"?{success:!1,error:"Malformed worker response: missing hasModifications flag"}:r.dbBuffer!==null&&r.dbBuffer!==void 0&&!(r.dbBuffer instanceof Uint8Array)?{success:!1,error:"Malformed worker response: invalid dbBuffer"}:{success:!0,results:r.results,hasModifications:r.hasModifications,dbBuffer:r.dbBuffer===void 0?null:r.dbBuffer,defenseStats:r.defenseStats}:{success:!1,error:"Malformed worker response: missing results array"}:{success:!1,error:typeof r.error=="string"&&r.error.length>0?r.error:"Worker execution failed"}}async function se(e,t,r){try{let n=re();return await new Promise((a,o)=>{let i=j.runTrusted(()=>te.createWorker(n,e)),s=b(r,"sqlite3","worker timeout callback",()=>{i.terminate(),a({success:!1,error:`Query timeout: execution exceeded ${t}ms limit`})}),c=x(()=>{try{s()}catch(u){let l=u instanceof Error?u.message:String(u);a({success:!1,error:m(l)})}},t),S=b(r,"sqlite3","worker message callback",u=>{w(c),a(oe(u,e.protocolToken))}),$=b(r,"sqlite3","worker error callback",u=>{w(c),o(u)}),y=b(r,"sqlite3","worker exit callback",u=>{w(c),u!==0&&a({success:!1,error:`Worker exited with code ${u}`})}),h=u=>{try{S(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);a({success:!1,error:m(d)})}},k=u=>{try{$(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);o(new Error(m(d)))}},g=u=>{try{y(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);a({success:!1,error:m(d)})}};i.on("message",h),i.on("error",k),i.on("exit",g)})}catch(n){let a=m(n.message);throw new Error(`sqlite3 worker failed to load: ${a}`)}}var Se={name:"sqlite3",async execute(e,t){if(C(e)||e.includes("-help"))return q(Z);let r=v(e);if("exitCode"in r)return r;let{options:n,database:a,sql:o,showVersion:i}=r;if(i)return{stdout:`${await ee()}
27
+ `,stderr:"",exitCode:0};if(!a)return{stdout:"",stderr:`sqlite3: missing database argument
28
+ `,exitCode:1};let s=o||t.stdin.trim();if(n.cmd&&(s=n.cmd+(s?`; ${s}`:"")),!s)return{stdout:"",stderr:`sqlite3: no SQL provided
29
+ `,exitCode:1};let p=a===":memory:",c="",S=null;try{p||(c=t.fs.resolvePath(t.cwd,a),await t.fs.exists(c)&&(S=await t.fs.readFileBuffer(c)))}catch(l){let d=m(l.message);return{stdout:"",stderr:`sqlite3: unable to open database "${a}": ${d}
30
+ `,exitCode:1}}let $=t.limits?.maxSqliteTimeoutMs??K,y={protocolToken:ne(),dbBuffer:S,sql:s,options:{bail:n.bail,echo:n.echo}},h;try{h=await se(y,$,t.requireDefenseContext)}catch(l){return{stdout:"",stderr:`sqlite3: worker error: ${m(l.message)}
31
+ `,exitCode:1}}if(!h.success)return{stdout:"",stderr:`sqlite3: ${m(h.error)}
32
+ `,exitCode:1};let k={mode:n.mode,header:n.header,separator:n.separator,newline:n.newline,nullValue:n.nullValue},g="";n.echo&&(g+=`${s}
33
+ `);let u=!1;for(let l of h.results)if(l.type==="error"){if(n.bail)return{stdout:g,stderr:`Error: ${l.error}
34
+ `,exitCode:1};g+=`Error: ${l.error}
35
+ `,u=!0}else l.columns&&l.rows&&(l.rows.length>0||n.header)&&(g+=V(l.columns,l.rows,k));if(h.hasModifications&&!n.readonly&&!p&&c&&h.dbBuffer)try{await t.fs.writeFile(c,h.dbBuffer)}catch(l){let d=m(l.message);return{stdout:g,stderr:`sqlite3: failed to write database: ${d}
36
+ `,exitCode:1}}return{stdout:g,stderr:"",exitCode:u&&n.bail?1:0}}},$e={name:"sqlite3",flags:[],needsArgs:!0};export{te as a,Se as b,$e as c};
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import{a as W,b as U}from"./chunk-WO4B7WUT.js";import{a as I}from"./chunk-EO5AH4U7.js";import{a as A}from"./chunk-SE4C7FJY.js";import{a as L}from"./chunk-SYG3IW7P.js";import{k}from"./chunk-6KZRLMG3.js";import{a as ee,b as te,c as P}from"./chunk-GTNBSMZR.js";var z=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function H(i){let e="",t=0,n=!1;for(;t<i.length;){if(i[t]==="["&&!n){if(i[t+1]==="["&&i[t+2]===":"){let s=i.indexOf(":]]",t+3);if(s!==-1){let a=i.slice(t+3,s),r=z.get(a);if(r){e+=`[${r}]`,t=s+3;continue}}}if(i[t+1]==="^"&&i[t+2]==="["&&i[t+3]===":"){let s=i.indexOf(":]]",t+4);if(s!==-1){let a=i.slice(t+4,s),r=z.get(a);if(r){e+=`[^${r}]`,t=s+3;continue}}}e+="[",t++,n=!0,t<i.length&&i[t]==="^"&&(e+="^",t++),t<i.length&&i[t]==="]"&&(e+="\\]",t++);continue}if(n){if(i[t]==="]"){e+="]",t++,n=!1;continue}if(i[t]==="["&&i[t+1]===":"){let s=i.indexOf(":]",t+2);if(s!==-1){let a=i.slice(t+2,s),r=z.get(a);if(r){e+=r,t=s+2;continue}}}if(i[t]==="\\"&&t+1<i.length){e+=i[t]+i[t+1],t+=2;continue}e+=i[t],t++;continue}if(i[t]==="\\"&&t+1<i.length){let s=i[t+1];if(s==="+"||s==="?"||s==="|"){e+=s,t+=2;continue}if(s==="("||s===")"){e+=s,t+=2;continue}if(s==="{"||s==="}"){e+=s,t+=2;continue}if(s==="t"){e+=" ",t+=2;continue}if(s==="n"){e+=`
2
+ import{a as W,b as U}from"./chunk-5MUD3WB2.js";import{a as I}from"./chunk-NTKUVXEL.js";import{a as A}from"./chunk-SE4C7FJY.js";import{k}from"./chunk-6KZRLMG3.js";import{a as L}from"./chunk-SYG3IW7P.js";import{a as ee,b as te,c as P}from"./chunk-GTNBSMZR.js";var z=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]);function H(i){let e="",t=0,n=!1;for(;t<i.length;){if(i[t]==="["&&!n){if(i[t+1]==="["&&i[t+2]===":"){let s=i.indexOf(":]]",t+3);if(s!==-1){let a=i.slice(t+3,s),r=z.get(a);if(r){e+=`[${r}]`,t=s+3;continue}}}if(i[t+1]==="^"&&i[t+2]==="["&&i[t+3]===":"){let s=i.indexOf(":]]",t+4);if(s!==-1){let a=i.slice(t+4,s),r=z.get(a);if(r){e+=`[^${r}]`,t=s+3;continue}}}e+="[",t++,n=!0,t<i.length&&i[t]==="^"&&(e+="^",t++),t<i.length&&i[t]==="]"&&(e+="\\]",t++);continue}if(n){if(i[t]==="]"){e+="]",t++,n=!1;continue}if(i[t]==="["&&i[t+1]===":"){let s=i.indexOf(":]",t+2);if(s!==-1){let a=i.slice(t+2,s),r=z.get(a);if(r){e+=r,t=s+2;continue}}}if(i[t]==="\\"&&t+1<i.length){e+=i[t]+i[t+1],t+=2;continue}e+=i[t],t++;continue}if(i[t]==="\\"&&t+1<i.length){let s=i[t+1];if(s==="+"||s==="?"||s==="|"){e+=s,t+=2;continue}if(s==="("||s===")"){e+=s,t+=2;continue}if(s==="{"||s==="}"){e+=s,t+=2;continue}if(s==="t"){e+=" ",t+=2;continue}if(s==="n"){e+=`
3
3
  `,t+=2;continue}if(s==="r"){e+="\r",t+=2;continue}e+=i[t]+s,t+=2;continue}if(i[t]==="+"||i[t]==="?"||i[t]==="|"||i[t]==="("||i[t]===")"){e+=`\\${i[t]}`,t++;continue}if(i[t]==="^"&&!(e===""||e.endsWith("("))){e+="\\^",t++;continue}if(i[t]==="$"){let s=t===i.length-1,a=t+2<i.length&&i[t+1]==="\\"&&i[t+2]===")";if(!s&&!a){e+="\\$",t++;continue}}e+=i[t],t++}return e}function V(i){let e="",t=!1;for(let n=0;n<i.length;n++)i[n]==="["&&!t?(t=!0,e+="[",n++,n<i.length&&i[n]==="^"&&(e+="^",n++),n<i.length&&i[n]==="]"&&(e+="]",n++),n--):i[n]==="]"&&t?(t=!1,e+="]"):!t&&i[n]==="{"&&i[n+1]===","?(e+="{0,",n++):e+=i[n];return e}function ne(i){let e="";for(let t=0;t<i.length;t++){let n=i[t],s=n.charCodeAt(0);n==="\\"?e+="\\\\":n===" "?e+="\\t":n===`
4
4
  `?e+=`$
5
- `:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var de=1e4;function se(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],pendingExecute:void 0,rangeStates:t||new Map,linesConsumedInCycle:0}}function pe(i){return typeof i=="object"&&"first"in i&&"step"in i}function me(i){return typeof i=="object"&&"offset"in i}function N(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(pe(i)){let{first:a,step:r}=i;return r===0?e===a:(e-a)%r===0&&e>=a}if(typeof i=="object"&&"pattern"in i)try{let a=i.pattern;a===""&&s?.lastPattern?a=s.lastPattern:a!==""&&s&&(s.lastPattern=a);let r=V(H(a));return A(r).test(n)}catch{return!1}return!1}function X(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function ge(i,e,t,n,s,a){if(!i||!i.start&&!i.end)return!0;let r=i.start,l=i.end;if(r!==void 0&&l===void 0)return N(r,e,t,n,a);if(r!==void 0&&l!==void 0){let c=typeof r=="object"&&"pattern"in r,h=typeof l=="object"&&"pattern"in l,p=me(l);if(p&&s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active){let E=d.startLine||e;return e>=E+l.offset&&(d.active=!1,s.set(g,d)),!0}else return N(r,e,t,n,a)?(d.active=!0,d.startLine=e,s.set(g,d),l.offset===0&&(d.active=!1,s.set(g,d)),!0):!1}if(!c&&!h&&!p){let g=typeof r=="number"?r:r==="$"?t:1,d=typeof l=="number"?l:t;if(g<=d)return e>=g&&e<=d;if(s){let E=X(i),u=s.get(E);return u||(u={active:!1},s.set(E,u)),!u.completed&&e>=g?(u.completed=!0,s.set(E,u),!0):!1}return!1}if(s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active)return N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0;{if(d.completed)return!1;let E=!1;return typeof r=="number"?E=e>=r:E=N(r,e,t,n,a),E?(d.active=!0,d.startLine=e,s.set(g,d),N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0):!1}}return N(r,e,t,n,a)}return!0}function w(i,e,t,n,s,a){let r=ge(i,e,t,n,s,a);return i?.negated?!r:r}function be(i,e,t,n){let s="",a=0,r=!1;for(;a<=i.length;){e.lastIndex=a;let l=e.exec(i);if(!l){s+=i.slice(a);break}if(l.index!==a){s+=i.slice(a,l.index),a=l.index,r=!1;continue}let c=l[0],h=l.slice(1);if(r&&c.length===0){if(a<i.length)s+=i[a],a++;else break;r=!1;continue}if(s+=n(c,h),r=!1,c.length===0)if(a<i.length)s+=i[a],a++;else break;else a+=c.length,r=!0}return s}function G(i,e,t){let n="",s=0;for(;s<i.length;){if(i[s]==="\\"&&s+1<i.length){let a=i[s+1];if(a==="&"){n+="&",s+=2;continue}if(a==="n"){n+=`
6
- `,s+=2;continue}if(a==="t"){n+=" ",s+=2;continue}if(a==="r"){n+="\r",s+=2;continue}let r=parseInt(a,10);if(r===0){n+=e,s+=2;continue}if(r>=1&&r<=9){n+=t[r-1]||"",s+=2;continue}n+=a,s+=2;continue}if(i[s]==="&"){n+=e,s++;continue}n+=i[s],s++}return n}function ie(i,e,t){if(e>0&&i.length>e)throw new k(`sed: ${t} size limit exceeded (${e} bytes)`,"string_length")}function Ee(i,e,t){let{lineNumber:n,totalLines:s,patternSpace:a}=e;if(i.type==="label"){e.coverage?.hit(`sed:cmd:${i.type}`);return}if(w(i.address,n,s,a,e.rangeStates,e))switch(e.coverage?.hit(`sed:cmd:${i.type}`),i.type){case"substitute":{let r=i,l="";r.global&&(l+="g"),r.ignoreCase&&(l+="i");let c=r.pattern;c===""&&e.lastPattern?c=e.lastPattern:c!==""&&(e.lastPattern=c);let h=V(r.extendedRegex?c:H(c));try{let p=A(h,l),x=p.test(e.patternSpace);if(p.lastIndex=0,x){if(e.substitutionMade=!0,r.nthOccurrence&&r.nthOccurrence>0&&!r.global){let g=0,d=r.nthOccurrence,E=A(h,`g${r.ignoreCase?"i":""}`);e.patternSpace=E.replace(e.patternSpace,(u,...f)=>{if(g++,g===d){let b=f.slice(0,-2);return G(r.replacement,u,b)}return u})}else if(r.global){let g=A(h,`g${r.ignoreCase?"i":""}`);e.patternSpace=be(e.patternSpace,g,r.replacement,(d,E)=>G(r.replacement,d,E))}else e.patternSpace=p.replace(e.patternSpace,(g,...d)=>{let E=d.slice(0,-2);return G(r.replacement,g,E)});r.printOnMatch&&e.lineNumberOutput.push(e.patternSpace)}}catch{}break}case"print":e.lineNumberOutput.push(e.patternSpace);break;case"printFirstLine":{let r=e.patternSpace.indexOf(`
5
+ `:n==="\r"?e+="\\r":n==="\x07"?e+="\\a":n==="\b"?e+="\\b":n==="\f"?e+="\\f":n==="\v"?e+="\\v":s<32||s>=127?e+=`\\${s.toString(8).padStart(3,"0")}`:e+=n}return`${e}$`}var de=1e4;function se(i,e,t){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:i,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:e,pendingFileReads:[],pendingFileWrites:[],rangeStates:t||new Map,linesConsumedInCycle:0}}function pe(i){return typeof i=="object"&&"first"in i&&"step"in i}function me(i){return typeof i=="object"&&"offset"in i}function N(i,e,t,n,s){if(i==="$")return e===t;if(typeof i=="number")return e===i;if(pe(i)){let{first:a,step:r}=i;return r===0?e===a:(e-a)%r===0&&e>=a}if(typeof i=="object"&&"pattern"in i)try{let a=i.pattern;a===""&&s?.lastPattern?a=s.lastPattern:a!==""&&s&&(s.lastPattern=a);let r=V(H(a));return A(r).test(n)}catch{return!1}return!1}function X(i){let e=t=>t===void 0?"undefined":t==="$"?"$":typeof t=="number"?String(t):"pattern"in t?`/${t.pattern}/`:"first"in t?`${t.first}~${t.step}`:"unknown";return`${e(i.start)},${e(i.end)}`}function ge(i,e,t,n,s,a){if(!i||!i.start&&!i.end)return!0;let r=i.start,l=i.end;if(r!==void 0&&l===void 0)return N(r,e,t,n,a);if(r!==void 0&&l!==void 0){let c=typeof r=="object"&&"pattern"in r,f=typeof l=="object"&&"pattern"in l,p=me(l);if(p&&s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active){let E=d.startLine||e;return e>=E+l.offset&&(d.active=!1,s.set(g,d)),!0}else return N(r,e,t,n,a)?(d.active=!0,d.startLine=e,s.set(g,d),l.offset===0&&(d.active=!1,s.set(g,d)),!0):!1}if(!c&&!f&&!p){let g=typeof r=="number"?r:r==="$"?t:1,d=typeof l=="number"?l:t;if(g<=d)return e>=g&&e<=d;if(s){let E=X(i),u=s.get(E);return u||(u={active:!1},s.set(E,u)),!u.completed&&e>=g?(u.completed=!0,s.set(E,u),!0):!1}return!1}if(s){let g=X(i),d=s.get(g);if(d||(d={active:!1},s.set(g,d)),d.active)return N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0;{if(d.completed)return!1;let E=!1;return typeof r=="number"?E=e>=r:E=N(r,e,t,n,a),E?(d.active=!0,d.startLine=e,s.set(g,d),N(l,e,t,n,a)&&(d.active=!1,typeof r=="number"&&(d.completed=!0),s.set(g,d)),!0):!1}}return N(r,e,t,n,a)}return!0}function w(i,e,t,n,s,a){let r=ge(i,e,t,n,s,a);return i?.negated?!r:r}function be(i,e,t,n){let s="",a=0,r=!1;for(;a<=i.length;){e.lastIndex=a;let l=e.exec(i);if(!l){s+=i.slice(a);break}if(l.index!==a){s+=i.slice(a,l.index),a=l.index,r=!1;continue}let c=l[0],f=l.slice(1);if(r&&c.length===0){if(a<i.length)s+=i[a],a++;else break;r=!1;continue}if(s+=n(c,f),r=!1,c.length===0)if(a<i.length)s+=i[a],a++;else break;else a+=c.length,r=!0}return s}function G(i,e,t){let n="",s=0;for(;s<i.length;){if(i[s]==="\\"&&s+1<i.length){let a=i[s+1];if(a==="&"){n+="&",s+=2;continue}if(a==="n"){n+=`
6
+ `,s+=2;continue}if(a==="t"){n+=" ",s+=2;continue}if(a==="r"){n+="\r",s+=2;continue}let r=parseInt(a,10);if(r===0){n+=e,s+=2;continue}if(r>=1&&r<=9){n+=t[r-1]||"",s+=2;continue}n+=a,s+=2;continue}if(i[s]==="&"){n+=e,s++;continue}n+=i[s],s++}return n}function ie(i,e,t){if(e>0&&i.length>e)throw new k(`sed: ${t} size limit exceeded (${e} bytes)`,"string_length")}function Ee(i,e,t){let{lineNumber:n,totalLines:s,patternSpace:a}=e;if(i.type==="label"){e.coverage?.hit(`sed:cmd:${i.type}`);return}if(w(i.address,n,s,a,e.rangeStates,e))switch(e.coverage?.hit(`sed:cmd:${i.type}`),i.type){case"substitute":{let r=i,l="";r.global&&(l+="g"),r.ignoreCase&&(l+="i");let c=r.pattern;c===""&&e.lastPattern?c=e.lastPattern:c!==""&&(e.lastPattern=c);let f=V(r.extendedRegex?c:H(c));try{let p=A(f,l),x=p.test(e.patternSpace);if(p.lastIndex=0,x){if(e.substitutionMade=!0,r.nthOccurrence&&r.nthOccurrence>0&&!r.global){let g=0,d=r.nthOccurrence,E=A(f,`g${r.ignoreCase?"i":""}`);e.patternSpace=E.replace(e.patternSpace,(u,...h)=>{if(g++,g===d){let b=h.slice(0,-2);return G(r.replacement,u,b)}return u})}else if(r.global){let g=A(f,`g${r.ignoreCase?"i":""}`);e.patternSpace=be(e.patternSpace,g,r.replacement,(d,E)=>G(r.replacement,d,E))}else e.patternSpace=p.replace(e.patternSpace,(g,...d)=>{let E=d.slice(0,-2);return G(r.replacement,g,E)});r.printOnMatch&&e.lineNumberOutput.push(e.patternSpace)}}catch{}break}case"print":e.lineNumberOutput.push(e.patternSpace);break;case"printFirstLine":{let r=e.patternSpace.indexOf(`
7
7
  `);r!==-1?e.lineNumberOutput.push(e.patternSpace.slice(0,r)):e.lineNumberOutput.push(e.patternSpace);break}case"delete":e.deleted=!0;break;case"deleteFirstLine":{let r=e.patternSpace.indexOf(`
8
8
  `);r!==-1?(e.patternSpace=e.patternSpace.slice(r+1),e.restartCycle=!0,e.inDRestartedCycle=!0):e.deleted=!0;break}case"zap":e.patternSpace="";break;case"append":e.appendBuffer.push(i.text);break;case"insert":e.appendBuffer.unshift(`__INSERT__${i.text}`);break;case"change":e.deleted=!0,e.changedText=i.text;break;case"hold":e.holdSpace=e.patternSpace;break;case"holdAppend":e.holdSpace?e.holdSpace+=`
9
9
  ${e.patternSpace}`:e.holdSpace=e.patternSpace,ie(e.holdSpace,t?.maxStringLength??0,"hold space");break;case"get":e.patternSpace=e.holdSpace;break;case"getAppend":e.patternSpace+=`
10
- ${e.holdSpace}`,ie(e.patternSpace,t?.maxStringLength??0,"pattern space");break;case"exchange":{let r=e.patternSpace;e.patternSpace=e.holdSpace,e.holdSpace=r;break}case"next":e.printed=!0;break;case"quit":e.quit=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"quitSilent":e.quit=!0,e.quitSilent=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"list":{let r=ne(e.patternSpace);e.lineNumberOutput.push(r);break}case"printFilename":e.currentFilename&&e.lineNumberOutput.push(e.currentFilename);break;case"version":{let r=[4,8,0];if(i.minVersion){let l=i.minVersion.split("."),c=[],h=!1;for(let p of l){let x=parseInt(p,10);if(Number.isNaN(x)||x<0){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: invalid version string: ${i.minVersion}`,h=!0;break}c.push(x)}if(!h){for(;c.length<3;)c.push(0);for(let p=0;p<3;p++){if(c[p]>r[p]){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: this is not GNU sed version ${i.minVersion}`;break}if(c[p]<r[p])break}}}break}case"readFile":e.pendingFileReads.push({filename:i.filename,wholeFile:!0});break;case"readFileLine":e.pendingFileReads.push({filename:i.filename,wholeFile:!1});break;case"writeFile":e.pendingFileWrites.push({filename:i.filename,content:`${e.patternSpace}
10
+ ${e.holdSpace}`,ie(e.patternSpace,t?.maxStringLength??0,"pattern space");break;case"exchange":{let r=e.patternSpace;e.patternSpace=e.holdSpace,e.holdSpace=r;break}case"next":e.printed=!0;break;case"quit":e.quit=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"quitSilent":e.quit=!0,e.quitSilent=!0,i.exitCode!==void 0&&(e.exitCode=i.exitCode);break;case"list":{let r=ne(e.patternSpace);e.lineNumberOutput.push(r);break}case"printFilename":e.currentFilename&&e.lineNumberOutput.push(e.currentFilename);break;case"version":{let r=[4,8,0];if(i.minVersion){let l=i.minVersion.split("."),c=[],f=!1;for(let p of l){let x=parseInt(p,10);if(Number.isNaN(x)||x<0){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: invalid version string: ${i.minVersion}`,f=!0;break}c.push(x)}if(!f){for(;c.length<3;)c.push(0);for(let p=0;p<3;p++){if(c[p]>r[p]){e.quit=!0,e.exitCode=1,e.errorMessage=`sed: this is not GNU sed version ${i.minVersion}`;break}if(c[p]<r[p])break}}}break}case"readFile":e.pendingFileReads.push({filename:i.filename,wholeFile:!0});break;case"readFileLine":e.pendingFileReads.push({filename:i.filename,wholeFile:!1});break;case"writeFile":e.pendingFileWrites.push({filename:i.filename,content:`${e.patternSpace}
11
11
  `});break;case"writeFirstLine":{let r=e.patternSpace.indexOf(`
12
12
  `),l=r!==-1?e.patternSpace.slice(0,r):e.patternSpace;e.pendingFileWrites.push({filename:i.filename,content:`${l}
13
- `});break}case"execute":i.command?e.pendingExecute={command:i.command,replacePattern:!1}:e.pendingExecute={command:e.patternSpace,replacePattern:!0};break;case"transliterate":e.patternSpace=ve(e.patternSpace,i);break;case"lineNumber":e.lineNumberOutput.push(String(e.lineNumber));break;case"branch":break;case"branchOnSubst":break;case"branchOnNoSubst":break;case"group":break}}function ve(i,e){let t="";for(let n of i){let s=e.source.indexOf(n);s!==-1?t+=e.dest[s]:t+=n}return t}function j(i,e,t,n){let s=new Map;for(let c=0;c<i.length;c++){let h=i[c];h.type==="label"&&s.set(h.name,c)}let a=n?.maxIterations??de,r=0,l=0;for(;l<i.length;){if(r++,r>a)throw new k(`sed: command execution exceeded maximum iterations (${a})`,"iterations");if(e.deleted||e.quit||e.quitSilent||e.restartCycle)break;let c=i[l];if(c.type==="next"){if(w(c.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.coverage?.hit("sed:cmd:next"),e.nCommandOutput.push(e.patternSpace),t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let h=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace=h,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1,e.substitutionMade=!1}else{e.quit=!0,e.deleted=!0;break}l++;continue}if(c.type==="nextAppend"){if(w(c.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.coverage?.hit("sed:cmd:nextAppend"),t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let h=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace+=`
14
- ${h}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;break}l++;continue}if(c.type==="branch"){let h=c;if(w(h.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)){if(e.coverage?.hit("sed:cmd:branch"),h.label){let p=s.get(h.label);if(p!==void 0){l=p;continue}e.branchRequest=h.label;break}break}l++;continue}if(c.type==="branchOnSubst"){let h=c;if(w(h.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:branchOnSubst"),e.substitutionMade)){if(e.substitutionMade=!1,h.label){let p=s.get(h.label);if(p!==void 0){l=p;continue}e.branchRequest=h.label;break}break}l++;continue}if(c.type==="branchOnNoSubst"){let h=c;if(w(h.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:branchOnNoSubst"),!e.substitutionMade)){if(h.label){let p=s.get(h.label);if(p!==void 0){l=p;continue}e.branchRequest=h.label;break}break}l++;continue}if(c.type==="group"){let h=c;if(w(h.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:group"),j(h.commands,e,t,n),e.branchRequest)){let p=s.get(e.branchRequest);if(p!==void 0){e.branchRequest=void 0,l=p;continue}break}l++;continue}Ee(c,e,n),l++}return e.linesConsumedInCycle}var o;(function(i){i.NUMBER="NUMBER",i.DOLLAR="DOLLAR",i.PATTERN="PATTERN",i.STEP="STEP",i.RELATIVE_OFFSET="RELATIVE_OFFSET",i.LBRACE="LBRACE",i.RBRACE="RBRACE",i.SEMICOLON="SEMICOLON",i.NEWLINE="NEWLINE",i.COMMA="COMMA",i.NEGATION="NEGATION",i.COMMAND="COMMAND",i.SUBSTITUTE="SUBSTITUTE",i.TRANSLITERATE="TRANSLITERATE",i.LABEL_DEF="LABEL_DEF",i.BRANCH="BRANCH",i.BRANCH_ON_SUBST="BRANCH_ON_SUBST",i.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",i.TEXT_CMD="TEXT_CMD",i.FILE_READ="FILE_READ",i.FILE_READ_LINE="FILE_READ_LINE",i.FILE_WRITE="FILE_WRITE",i.FILE_WRITE_LINE="FILE_WRITE_LINE",i.EXECUTE="EXECUTE",i.VERSION="VERSION",i.EOF="EOF",i.ERROR="ERROR"})(o||(o={}));var _=class{input;pos=0;line=1;column=1;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&e.push(t)}return e.push(this.makeToken(o.EOF,"")),e}makeToken(e,t,n){return{type:e,value:t,line:this.line,column:this.column,...n}}peek(e=0){return this.input[this.pos+e]||""}advance(){let e=this.input[this.pos++]||"";return e===`
13
+ `});break}case"execute":e.errorMessage="sed: e command (shell execution) is not supported in sandboxed environment",e.quit=!0;break;case"transliterate":e.patternSpace=ve(e.patternSpace,i);break;case"lineNumber":e.lineNumberOutput.push(String(e.lineNumber));break;case"branch":break;case"branchOnSubst":break;case"branchOnNoSubst":break;case"group":break}}function ve(i,e){let t="";for(let n of i){let s=e.source.indexOf(n);s!==-1?t+=e.dest[s]:t+=n}return t}function j(i,e,t,n){let s=new Map;for(let c=0;c<i.length;c++){let f=i[c];f.type==="label"&&s.set(f.name,c)}let a=n?.maxIterations??de,r=0,l=0;for(;l<i.length;){if(r++,r>a)throw new k(`sed: command execution exceeded maximum iterations (${a})`,"iterations");if(e.deleted||e.quit||e.quitSilent||e.restartCycle)break;let c=i[l];if(c.type==="next"){if(w(c.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.coverage?.hit("sed:cmd:next"),e.nCommandOutput.push(e.patternSpace),t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let f=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace=f,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1,e.substitutionMade=!1}else{e.quit=!0,e.deleted=!0;break}l++;continue}if(c.type==="nextAppend"){if(w(c.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e))if(e.coverage?.hit("sed:cmd:nextAppend"),t&&t.currentLineIndex+e.linesConsumedInCycle+1<t.lines.length){e.linesConsumedInCycle++;let f=t.lines[t.currentLineIndex+e.linesConsumedInCycle];e.patternSpace+=`
14
+ ${f}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;break}l++;continue}if(c.type==="branch"){let f=c;if(w(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)){if(e.coverage?.hit("sed:cmd:branch"),f.label){let p=s.get(f.label);if(p!==void 0){l=p;continue}e.branchRequest=f.label;break}break}l++;continue}if(c.type==="branchOnSubst"){let f=c;if(w(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:branchOnSubst"),e.substitutionMade)){if(e.substitutionMade=!1,f.label){let p=s.get(f.label);if(p!==void 0){l=p;continue}e.branchRequest=f.label;break}break}l++;continue}if(c.type==="branchOnNoSubst"){let f=c;if(w(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:branchOnNoSubst"),!e.substitutionMade)){if(f.label){let p=s.get(f.label);if(p!==void 0){l=p;continue}e.branchRequest=f.label;break}break}l++;continue}if(c.type==="group"){let f=c;if(w(f.address,e.lineNumber,e.totalLines,e.patternSpace,e.rangeStates,e)&&(e.coverage?.hit("sed:cmd:group"),j(f.commands,e,t,n),e.branchRequest)){let p=s.get(e.branchRequest);if(p!==void 0){e.branchRequest=void 0,l=p;continue}break}l++;continue}Ee(c,e,n),l++}return e.linesConsumedInCycle}var o;(function(i){i.NUMBER="NUMBER",i.DOLLAR="DOLLAR",i.PATTERN="PATTERN",i.STEP="STEP",i.RELATIVE_OFFSET="RELATIVE_OFFSET",i.LBRACE="LBRACE",i.RBRACE="RBRACE",i.SEMICOLON="SEMICOLON",i.NEWLINE="NEWLINE",i.COMMA="COMMA",i.NEGATION="NEGATION",i.COMMAND="COMMAND",i.SUBSTITUTE="SUBSTITUTE",i.TRANSLITERATE="TRANSLITERATE",i.LABEL_DEF="LABEL_DEF",i.BRANCH="BRANCH",i.BRANCH_ON_SUBST="BRANCH_ON_SUBST",i.BRANCH_ON_NO_SUBST="BRANCH_ON_NO_SUBST",i.TEXT_CMD="TEXT_CMD",i.FILE_READ="FILE_READ",i.FILE_READ_LINE="FILE_READ_LINE",i.FILE_WRITE="FILE_WRITE",i.FILE_WRITE_LINE="FILE_WRITE_LINE",i.EXECUTE="EXECUTE",i.VERSION="VERSION",i.EOF="EOF",i.ERROR="ERROR"})(o||(o={}));var _=class{input;pos=0;line=1;column=1;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&e.push(t)}return e.push(this.makeToken(o.EOF,"")),e}makeToken(e,t,n){return{type:e,value:t,line:this.line,column:this.column,...n}}peek(e=0){return this.input[this.pos+e]||""}advance(){let e=this.input[this.pos++]||"";return e===`
15
15
  `?(this.line++,this.column=1):this.column++,e}readEscapedString(e){let t="";for(;this.pos<this.input.length&&this.peek()!==e;)if(this.peek()==="\\"){this.advance();let n=this.advance();n==="n"?t+=`
16
16
  `:n==="t"?t+=" ":t+=n}else{if(this.peek()===`
17
17
  `)return null;t+=this.advance()}return t}skipWhitespace(){for(;this.pos<this.input.length;){let e=this.peek();if(e===" "||e===" "||e==="\r")this.advance();else if(e==="#")for(;this.pos<this.input.length&&this.peek()!==`
@@ -39,8 +39,8 @@ ${h}`,e.lineNumber=t.currentLineIndex+e.linesConsumedInCycle+1}else{e.quit=!0;br
39
39
  `||r===";"||r==="}"||r==="{")break;a+=this.advance()}return{type:e,value:t,label:a||void 0,line:n,column:s}}readVersion(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(s===" "||s===" "||s===`
40
40
  `||s===";"||s==="}"||s==="{")break;n+=this.advance()}return{type:o.VERSION,value:"v",label:n||void 0,line:e,column:t}}readFileCommand(e,t,n,s){for(;this.peek()===" "||this.peek()===" ";)this.advance();let a="";for(;this.pos<this.input.length;){let r=this.peek();if(r===`
41
41
  `||r===";")break;a+=this.advance()}return{type:e,value:t,filename:a.trim(),line:n,column:s}}readExecute(e,t){for(;this.peek()===" "||this.peek()===" ";)this.advance();let n="";for(;this.pos<this.input.length;){let s=this.peek();if(s===`
42
- `||s===";")break;n+=this.advance()}return{type:o.EXECUTE,value:"e",command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>="0"&&e<="9"}};var Z=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let n=new _(t);for(this.tokens=n.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let s=this.pos,a=this.parseCommand();if(a.error)return{commands:[],error:a.error};if(a.command&&e.push(a.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(o.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(o.NEWLINE)||this.check(o.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null};let n=this.peek();switch(n.type){case o.COMMAND:return this.parseSimpleCommand(n,t);case o.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case o.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case o.LABEL_DEF:return this.advance(),{command:{type:"label",name:n.label||""}};case o.BRANCH:return this.advance(),{command:{type:"branch",address:t,label:n.label}};case o.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:t,label:n.label}};case o.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:t,label:n.label}};case o.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case o.FILE_READ:return this.advance(),{command:{type:"readFile",address:t,filename:n.filename||""}};case o.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:t,filename:n.filename||""}};case o.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:t,filename:n.filename||""}};case o.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:t,filename:n.filename||""}};case o.EXECUTE:return this.advance(),{command:{type:"execute",address:t,command:n.command}};case o.VERSION:return this.advance(),{command:{type:"version",address:t,minVersion:n.label}};case o.LBRACE:return this.parseGroup(t);case o.RBRACE:return{command:null};case o.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case"p":return{command:{type:"print",address:t}};case"P":return{command:{type:"printFirstLine",address:t}};case"d":return{command:{type:"delete",address:t}};case"D":return{command:{type:"deleteFirstLine",address:t}};case"h":return{command:{type:"hold",address:t}};case"H":return{command:{type:"holdAppend",address:t}};case"g":return{command:{type:"get",address:t}};case"G":return{command:{type:"getAppend",address:t}};case"x":return{command:{type:"exchange",address:t}};case"n":return{command:{type:"next",address:t}};case"N":return{command:{type:"nextAppend",address:t}};case"q":return{command:{type:"quit",address:t}};case"Q":return{command:{type:"quitSilent",address:t}};case"z":return{command:{type:"zap",address:t}};case"=":return{command:{type:"lineNumber",address:t}};case"l":return{command:{type:"list",address:t}};case"F":return{command:{type:"printFilename",address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||"",s,a=n.match(/(\d+)/);return a&&(s=parseInt(a[1],10)),{command:{type:"substitute",address:t,pattern:e.pattern||"",replacement:e.replacement||"",global:n.includes("g"),ignoreCase:n.includes("i")||n.includes("I"),printOnMatch:n.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||"",s=e.dest||"";return n.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:t,source:n,dest:s}}}parseTextCommand(e,t){let n=e.value,s=e.text||"";switch(n){case"a":return{command:{type:"append",address:t,text:s}};case"i":return{command:{type:"insert",address:t,text:s}};case"c":return{command:{type:"change",address:t,text:s}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(o.RBRACE);){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let n=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&t.push(s.command),this.pos===n&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(o.RBRACE)?(this.advance(),{command:{type:"group",address:e,commands:t}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(o.COMMA))return{error:"expected context address"};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(o.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(o.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:"expected context address"};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case o.NUMBER:return this.advance(),e.value;case o.DOLLAR:return this.advance(),"$";case o.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case o.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case o.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:o.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===o.EOF}};function re(i,e=!1){let t=!1,n=!1,s=[];for(let c=0;c<i.length;c++){let h=i[c];if(s.length===0&&c===0){let p=h.match(/^#([nr]+)\s*(?:\n|$)/i);if(p){let x=p[1].toLowerCase();x.includes("n")&&(t=!0),x.includes("r")&&(n=!0),h=h.slice(p[0].length)}}if(s.length>0&&s[s.length-1].endsWith("\\")){let p=s[s.length-1];s[s.length-1]=`${p}
43
- ${h}`}else s.push(h)}let a=s.join(`
42
+ `||s===";")break;n+=this.advance()}return{type:o.EXECUTE,value:"e",command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>="0"&&e<="9"}};var Z=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let n=new _(t);for(this.tokens=n.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let s=this.pos,a=this.parseCommand();if(a.error)return{commands:[],error:a.error};if(a.command&&e.push(a.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(o.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(o.NEWLINE)||this.check(o.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null};let n=this.peek();switch(n.type){case o.COMMAND:return this.parseSimpleCommand(n,t);case o.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case o.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case o.LABEL_DEF:return this.advance(),{command:{type:"label",name:n.label||""}};case o.BRANCH:return this.advance(),{command:{type:"branch",address:t,label:n.label}};case o.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:t,label:n.label}};case o.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:t,label:n.label}};case o.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case o.FILE_READ:return this.advance(),{command:{type:"readFile",address:t,filename:n.filename||""}};case o.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:t,filename:n.filename||""}};case o.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:t,filename:n.filename||""}};case o.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:t,filename:n.filename||""}};case o.EXECUTE:return this.advance(),{command:{type:"execute",address:t,command:n.command}};case o.VERSION:return this.advance(),{command:{type:"version",address:t,minVersion:n.label}};case o.LBRACE:return this.parseGroup(t);case o.RBRACE:return{command:null};case o.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case"p":return{command:{type:"print",address:t}};case"P":return{command:{type:"printFirstLine",address:t}};case"d":return{command:{type:"delete",address:t}};case"D":return{command:{type:"deleteFirstLine",address:t}};case"h":return{command:{type:"hold",address:t}};case"H":return{command:{type:"holdAppend",address:t}};case"g":return{command:{type:"get",address:t}};case"G":return{command:{type:"getAppend",address:t}};case"x":return{command:{type:"exchange",address:t}};case"n":return{command:{type:"next",address:t}};case"N":return{command:{type:"nextAppend",address:t}};case"q":return{command:{type:"quit",address:t}};case"Q":return{command:{type:"quitSilent",address:t}};case"z":return{command:{type:"zap",address:t}};case"=":return{command:{type:"lineNumber",address:t}};case"l":return{command:{type:"list",address:t}};case"F":return{command:{type:"printFilename",address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||"",s,a=n.match(/(\d+)/);return a&&(s=parseInt(a[1],10)),{command:{type:"substitute",address:t,pattern:e.pattern||"",replacement:e.replacement||"",global:n.includes("g"),ignoreCase:n.includes("i")||n.includes("I"),printOnMatch:n.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||"",s=e.dest||"";return n.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:t,source:n,dest:s}}}parseTextCommand(e,t){let n=e.value,s=e.text||"";switch(n){case"a":return{command:{type:"append",address:t,text:s}};case"i":return{command:{type:"insert",address:t,text:s}};case"c":return{command:{type:"change",address:t,text:s}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(o.RBRACE);){if(this.check(o.NEWLINE)||this.check(o.SEMICOLON)){this.advance();continue}let n=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&t.push(s.command),this.pos===n&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(o.RBRACE)?(this.advance(),{command:{type:"group",address:e,commands:t}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(o.COMMA))return{error:"expected context address"};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(o.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(o.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:"expected context address"};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case o.NUMBER:return this.advance(),e.value;case o.DOLLAR:return this.advance(),"$";case o.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case o.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case o.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:o.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===o.EOF}};function re(i,e=!1){let t=!1,n=!1,s=[];for(let c=0;c<i.length;c++){let f=i[c];if(s.length===0&&c===0){let p=f.match(/^#([nr]+)\s*(?:\n|$)/i);if(p){let x=p[1].toLowerCase();x.includes("n")&&(t=!0),x.includes("r")&&(n=!0),f=f.slice(p[0].length)}}if(s.length>0&&s[s.length-1].endsWith("\\")){let p=s[s.length-1];s[s.length-1]=`${p}
43
+ ${f}`}else s.push(f)}let a=s.join(`
44
44
  `),l=new Z([a],e||n).parse();if(!l.error&&l.commands.length>0){let c=Ce(l.commands);if(c)return{commands:[],error:c,silentMode:t,extendedRegexMode:n}}return{...l,silentMode:t,extendedRegexMode:n}}function Ce(i){let e=new Set;ae(i,e);let t=ce(i,e);if(t)return`undefined label '${t}'`}function ae(i,e){for(let t of i)t.type==="label"?e.add(t.name):t.type==="group"&&ae(t.commands,e)}function ce(i,e){for(let t of i){if((t.type==="branch"||t.type==="branchOnSubst"||t.type==="branchOnNoSubst")&&t.label&&!e.has(t.label))return t.label;if(t.type==="group"){let n=ce(t.commands,e);if(n)return n}}}var xe={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands:
45
45
  s/regexp/replacement/[flags] substitute
46
46
  d delete pattern space
@@ -70,31 +70,31 @@ Addresses:
70
70
  $ last line
71
71
  /regexp/ lines matching regexp
72
72
  N,M range from line N to M
73
- first~step every step-th line starting at first`};async function K(i,e,t,n={}){let{limits:s,filename:a,fs:r,cwd:l,coverage:c,requireDefenseContext:h}=n;W(h,"sed","processing entry");let p=(R,m)=>U(h,"sed",R,m),x=i.endsWith(`
73
+ first~step every step-th line starting at first`};async function K(i,e,t,n={}){let{limits:s,filename:a,fs:r,cwd:l,coverage:c,requireDefenseContext:f}=n;W(f,"sed","processing entry");let p=(R,m)=>U(f,"sed",R,m),x=i.endsWith(`
74
74
  `),g=i.split(`
75
- `);g.length>0&&g[g.length-1]===""&&g.pop();let d=g.length,E="",u,f=!1,b=s?.maxStringLength??0,v=R=>{if(E+=R,b>0&&E.length>b)throw new k(`sed: output size limit exceeded (${b} bytes)`,"string_length")},O="",Q,oe=new Map,T=new Map,B=new Map,D=new Map,le=s?{maxIterations:s.maxSedIterations,maxStringLength:b}:void 0;for(let R=0;R<g.length;R++){let m={...se(d,a,oe),patternSpace:g[R],holdSpace:O,lastPattern:Q,lineNumber:R+1,totalLines:d,substitutionMade:!1,coverage:c},F={lines:g,currentLineIndex:R},J=0,ue=1e4;m.linesConsumedInCycle=0;do{if(J++,J>ue)break;if(m.restartCycle=!1,m.pendingFileReads=[],m.pendingFileWrites=[],j(e,m,F,le),r&&l){for(let C of m.pendingFileReads){let S=r.resolvePath(l,C.filename);try{if(C.wholeFile){let y=await p("read command file",()=>r.readFile(S));m.appendBuffer.push(y.replace(/\n$/,""))}else{if(!T.has(S)){let he=await p("read command file line cache",()=>r.readFile(S));T.set(S,he.split(`
75
+ `);g.length>0&&g[g.length-1]===""&&g.pop();let d=g.length,E="",u,h=!1,b=s?.maxStringLength??0,v=R=>{if(E+=R,b>0&&E.length>b)throw new k(`sed: output size limit exceeded (${b} bytes)`,"string_length")},O="",Q,oe=new Map,T=new Map,B=new Map,D=new Map,le=s?{maxIterations:s.maxSedIterations,maxStringLength:b}:void 0;for(let R=0;R<g.length;R++){let m={...se(d,a,oe),patternSpace:g[R],holdSpace:O,lastPattern:Q,lineNumber:R+1,totalLines:d,substitutionMade:!1,coverage:c},F={lines:g,currentLineIndex:R},J=0,ue=1e4;m.linesConsumedInCycle=0;do{if(J++,J>ue)break;if(m.restartCycle=!1,m.pendingFileReads=[],m.pendingFileWrites=[],j(e,m,F,le),r&&l){for(let C of m.pendingFileReads){let S=r.resolvePath(l,C.filename);try{if(C.wholeFile){let y=await p("read command file",()=>r.readFile(S));m.appendBuffer.push(y.replace(/\n$/,""))}else{if(!T.has(S)){let fe=await p("read command file line cache",()=>r.readFile(S));T.set(S,fe.split(`
76
76
  `)),B.set(S,0)}let y=T.get(S),M=B.get(S);y&&M!==void 0&&M<y.length&&(m.appendBuffer.push(y[M]),B.set(S,M+1))}}catch(y){if(y instanceof I)throw y}}for(let C of m.pendingFileWrites){let S=r.resolvePath(l,C.filename),y=D.get(S)||"";D.set(S,y+C.content)}}}while(m.restartCycle&&!m.deleted&&!m.quit&&!m.quitSilent);if(R+=m.linesConsumedInCycle,O=m.holdSpace,Q=m.lastPattern,!t)for(let C of m.nCommandOutput)v(`${C}
77
- `);let fe=m.lineNumberOutput.length>0;for(let C of m.lineNumberOutput)v(`${C}
77
+ `);let he=m.lineNumberOutput.length>0;for(let C of m.lineNumberOutput)v(`${C}
78
78
  `);let Y=[],q=[];for(let C of m.appendBuffer)C.startsWith("__INSERT__")?Y.push(C.slice(10)):q.push(C);for(let C of Y)v(`${C}
79
79
  `);let $=!1;!m.deleted&&!m.quitSilent?t?m.printed&&(v(`${m.patternSpace}
80
80
  `),$=!0):(v(`${m.patternSpace}
81
81
  `),$=!0):m.changedText!==void 0&&(v(`${m.changedText}
82
82
  `),$=!0);for(let C of q)v(`${C}
83
- `);if(f=(fe||$)&&q.length===0,m.quit||m.quitSilent){if(m.exitCode!==void 0&&(u=m.exitCode),m.errorMessage)return{output:"",exitCode:u||1,errorMessage:m.errorMessage};break}}if(r&&l)for(let[R,m]of D)try{await p("flush pending file writes",()=>r.writeFile(R,m))}catch(F){if(F instanceof I)throw F}return!x&&f&&E.endsWith(`
84
- `)&&(E=E.slice(0,-1)),{output:E,exitCode:u}}var De={name:"sed",async execute(i,e){W(e.requireDefenseContext,"sed","execution entry");let t=(u,f)=>U(e.requireDefenseContext,"sed",u,f);if(te(i))return ee(xe);let n=[],s=[],a=!1,r=!1,l=!1,c=[];for(let u=0;u<i.length;u++){let f=i[u];if(f==="-n"||f==="--quiet"||f==="--silent")a=!0;else if(f==="-i"||f==="--in-place")r=!0;else if(f.startsWith("-i"))r=!0;else if(f==="-E"||f==="-r"||f==="--regexp-extended")l=!0;else if(f==="-e")u+1<i.length&&n.push(i[++u]);else if(f==="-f")u+1<i.length&&s.push(i[++u]);else{if(f.startsWith("--"))return P("sed",f);if(f==="-")c.push(f);else if(f.startsWith("-")&&f.length>1){for(let b of f.slice(1))if(b!=="n"&&b!=="e"&&b!=="f"&&b!=="i"&&b!=="E"&&b!=="r")return P("sed",`-${b}`);f.includes("n")&&(a=!0),f.includes("i")&&(r=!0),(f.includes("E")||f.includes("r"))&&(l=!0),f.includes("e")&&!f.includes("n")&&!f.includes("i")&&u+1<i.length&&n.push(i[++u]),f.includes("f")&&!f.includes("e")&&u+1<i.length&&s.push(i[++u])}else!f.startsWith("-")&&n.length===0&&s.length===0?n.push(f):f.startsWith("-")||c.push(f)}}for(let u of s){let f=e.fs.resolvePath(e.cwd,u);try{let b=await t("script file read",()=>e.fs.readFile(f));for(let v of b.split(`
83
+ `);if(h=(he||$)&&q.length===0,m.quit||m.quitSilent){if(m.exitCode!==void 0&&(u=m.exitCode),m.errorMessage)return{output:"",exitCode:u||1,errorMessage:m.errorMessage};break}}if(r&&l)for(let[R,m]of D)try{await p("flush pending file writes",()=>r.writeFile(R,m))}catch(F){if(F instanceof I)throw F}return!x&&h&&E.endsWith(`
84
+ `)&&(E=E.slice(0,-1)),{output:E,exitCode:u}}var De={name:"sed",async execute(i,e){W(e.requireDefenseContext,"sed","execution entry");let t=(u,h)=>U(e.requireDefenseContext,"sed",u,h);if(te(i))return ee(xe);let n=[],s=[],a=!1,r=!1,l=!1,c=[];for(let u=0;u<i.length;u++){let h=i[u];if(h==="-n"||h==="--quiet"||h==="--silent")a=!0;else if(h==="-i"||h==="--in-place")r=!0;else if(h.startsWith("-i"))r=!0;else if(h==="-E"||h==="-r"||h==="--regexp-extended")l=!0;else if(h==="-e")u+1<i.length&&n.push(i[++u]);else if(h==="-f")u+1<i.length&&s.push(i[++u]);else{if(h.startsWith("--"))return P("sed",h);if(h==="-")c.push(h);else if(h.startsWith("-")&&h.length>1){for(let b of h.slice(1))if(b!=="n"&&b!=="e"&&b!=="f"&&b!=="i"&&b!=="E"&&b!=="r")return P("sed",`-${b}`);h.includes("n")&&(a=!0),h.includes("i")&&(r=!0),(h.includes("E")||h.includes("r"))&&(l=!0),h.includes("e")&&!h.includes("n")&&!h.includes("i")&&u+1<i.length&&n.push(i[++u]),h.includes("f")&&!h.includes("e")&&u+1<i.length&&s.push(i[++u])}else!h.startsWith("-")&&n.length===0&&s.length===0?n.push(h):h.startsWith("-")||c.push(h)}}for(let u of s){let h=e.fs.resolvePath(e.cwd,u);try{let b=await t("script file read",()=>e.fs.readFile(h));for(let v of b.split(`
85
85
  `)){let O=v.trim();O&&!O.startsWith("#")&&n.push(O)}}catch(b){if(b instanceof I)throw b;return{stdout:"",stderr:`sed: couldn't open file ${u}: No such file or directory
86
86
  `,exitCode:1}}}if(n.length===0)return{stdout:"",stderr:`sed: no script specified
87
- `,exitCode:1};let{commands:h,error:p,silentMode:x}=re(n,l);if(p)return{stdout:"",stderr:`sed: ${p}
87
+ `,exitCode:1};let{commands:f,error:p,silentMode:x}=re(n,l);if(p)return{stdout:"",stderr:`sed: ${p}
88
88
  `,exitCode:1};let g=!!(a||x);if(r){if(c.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
89
- `,exitCode:1};for(let u of c){if(u==="-")continue;let f=e.fs.resolvePath(e.cwd,u);try{let b=await t("in-place input read",()=>e.fs.readFile(f)),v=await t("in-place processing",()=>K(b,h,g,{limits:e.limits,filename:u,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));if(v.errorMessage)return{stdout:"",stderr:`${v.errorMessage}
90
- `,exitCode:v.exitCode??1};await t("in-place output write",()=>e.fs.writeFile(f,v.output))}catch(b){if(b instanceof I)throw b;return b instanceof k?{stdout:"",stderr:`sed: ${L(b.message)}
89
+ `,exitCode:1};for(let u of c){if(u==="-")continue;let h=e.fs.resolvePath(e.cwd,u);try{let b=await t("in-place input read",()=>e.fs.readFile(h)),v=await t("in-place processing",()=>K(b,f,g,{limits:e.limits,filename:u,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));if(v.errorMessage)return{stdout:"",stderr:`${v.errorMessage}
90
+ `,exitCode:v.exitCode??1};await t("in-place output write",()=>e.fs.writeFile(h,v.output))}catch(b){if(b instanceof I)throw b;return b instanceof k?{stdout:"",stderr:`sed: ${L(b.message)}
91
91
  `,exitCode:k.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory
92
- `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let d="";if(c.length===0){d=e.stdin;try{let u=await t("stdin processing",()=>K(d,h,g,{limits:e.limits,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
92
+ `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let d="";if(c.length===0){d=e.stdin;try{let u=await t("stdin processing",()=>K(d,f,g,{limits:e.limits,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
93
93
  `:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof I)throw u;if(u instanceof k)return{stdout:"",stderr:`sed: ${L(u.message)}
94
- `,exitCode:k.EXIT_CODE};throw u}}let E=!1;for(let u of c){let f;if(u==="-")E?f="":(f=e.stdin,E=!0);else{let b=e.fs.resolvePath(e.cwd,u);try{f=await t("input file read",()=>e.fs.readFile(b))}catch(v){if(v instanceof I)throw v;return v instanceof k?{stdout:"",stderr:`sed: ${L(v.message)}
94
+ `,exitCode:k.EXIT_CODE};throw u}}let E=!1;for(let u of c){let h;if(u==="-")E?h="":(h=e.stdin,E=!0);else{let b=e.fs.resolvePath(e.cwd,u);try{h=await t("input file read",()=>e.fs.readFile(b))}catch(v){if(v instanceof I)throw v;return v instanceof k?{stdout:"",stderr:`sed: ${L(v.message)}
95
95
  `,exitCode:k.EXIT_CODE}:{stdout:"",stderr:`sed: ${u}: No such file or directory
96
- `,exitCode:1}}}d.length>0&&f.length>0&&!d.endsWith(`
96
+ `,exitCode:1}}}d.length>0&&h.length>0&&!d.endsWith(`
97
97
  `)&&(d+=`
98
- `),d+=f}try{let u=await t("final processing",()=>K(d,h,g,{limits:e.limits,filename:c.length===1?c[0]:void 0,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
98
+ `),d+=h}try{let u=await t("final processing",()=>K(d,f,g,{limits:e.limits,filename:c.length===1?c[0]:void 0,fs:e.fs,cwd:e.cwd,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext}));return{stdout:u.output,stderr:u.errorMessage?`${u.errorMessage}
99
99
  `:"",exitCode:u.exitCode??0}}catch(u){if(u instanceof I)throw u;if(u instanceof k)return{stdout:"",stderr:`sed: ${L(u.message)}
100
100
  `,exitCode:k.EXIT_CODE};throw u}}},qe={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0};export{De as a,qe as b};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{b as e}from"./chunk-NTKUVXEL.js";var i=globalThis.setTimeout.bind(globalThis),r=globalThis.clearTimeout.bind(globalThis),s=globalThis.setInterval.bind(globalThis),T=globalThis.clearInterval.bind(globalThis);function l(t){return typeof t!="function"?t:e.bindCurrentContext(t)}var b=((t,n,...o)=>i(l(t),n,...o)),u=r;export{b as a,u as b};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import*as i from"node:fs";import*as o from"node:path";function c(t){if(!t||t==="/")return"/";let e=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;e.startsWith("/")||(e=`/${e}`);let n=e.split("/").filter(r=>r&&r!=="."),s=[];for(let r of n)r===".."?s.pop():s.push(r);return`/${s.join("/")}`||"/"}function h(t,e){if(t.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${e} '${t}'`)}function m(t){let e=c(t);if(e==="/")return"/";let n=e.lastIndexOf("/");return n===0?"/":e.slice(0,n)}function y(t,e){if(e.startsWith("/"))return c(e);let n=t==="/"?`/${e}`:`${t}/${e}`;return c(n)}function p(t,e){return t==="/"?`/${e}`:`${t}/${e}`}function v(t,e){if(e.startsWith("/"))return c(e);let n=m(t);return c(p(n,e))}function d(t,e){return t===e||t.startsWith(`${e}/`)}function f(t,e){try{let n=i.realpathSync(t);return d(n,e)?n:null}catch(n){if(n.code==="ENOENT"){let s=o.dirname(t);if(s===t)return null;let r=f(s,e);if(r===null)return null;try{if(i.lstatSync(t).isSymbolicLink()){let l=i.readlinkSync(t),u=o.isAbsolute(l)?l:o.resolve(o.dirname(t),l);if(f(u,e)===null)return null}}catch{}return o.join(r,o.basename(t))}return null}}function P(t,e,n){let s=f(t,n);if(s===null)return null;let r=o.resolve(t),a=r.slice(e.length),l=s.slice(n.length);if(a!==l)return null;try{if(i.lstatSync(r).isSymbolicLink())return null}catch{}return s}function $(t,e){if(!i.existsSync(t))throw new Error(`${e} root does not exist`);if(!i.statSync(t).isDirectory())throw new Error(`${e} root is not a directory`)}function D(t,e){if(!o.isAbsolute(t))return{withinRoot:!0,relativePath:t};let n;try{n=i.realpathSync(t)}catch{n=o.resolve(t)}return d(n,e)?{withinRoot:!0,relativePath:n.slice(e.length)||"/"}:{withinRoot:!1,safeName:o.basename(t)}}function N(t,e,n,s){let r=t;if(r.path===void 0){for(let l of s)if(r.message?.includes(l))throw t}let a=r.code||"EIO";throw new Error(`${a}: ${n} '${e}'`)}export{c as a,h as b,m as c,y as d,p as e,v as f,d as g,f as h,P as i,$ as j,D as k,N as l};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{a as g}from"./chunk-KGOUQS5A.js";function v(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return a.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var f=typeof __BROWSER__<"u"&&__BROWSER__;function w(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var x=null;if(!f)try{let{AsyncLocalStorage:a}=g("node:async_hooks");x=a}catch{}var k=`
3
+
4
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,d=class extends Error{violation;constructor(e,t){super(e+k),this.violation=t,this.name="SecurityViolationError"}},l=!f&&x?new x:null,T=1e3;function D(a,e,...t){return l.run(a,()=>e(...t))}var m={enabled:!0,auditMode:!1};function E(a){return a===void 0?{...m,enabled:!1}:typeof a=="boolean"?{...m,enabled:a}:{...m,...a}}var _=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=E(e);if(!a.instance)a.instance=new a(t);else{let r=a.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return l?l?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(l)return l?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!l)return e;let t=a.instance,r=l.getStore(),s=r?.sandboxActive===!0?r.executionId:t?.getPreferredActiveExecutionId();if(!s)return e;let n=t?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let i=a.instance;if(!(i&&!i.isExecutionIdActive(s)&&(i.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!i.config.auditMode)))return D(n,e,...o)})}isEnabled(){return this.config.enabled===!0&&l!==null&&!f}updateConfig(e){this.config={...this.config,...e}}activate(){if(f||!this.config.enabled||!l){let r=w(),s=!1;return{run:n=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):n(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=w(),t=!1;return{run:r=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),l.run({sandboxActive:!0,executionId:e},r)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!l)return e();let t=l.getStore();if(!t)return e();let{executionId:r}=t;return l.run({...t,trusted:!0},()=>{a.enterTrustedScope(r);try{let s=e();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{a.leaveTrustedScope(r)}):(a.leaveTrustedScope(r),s)}catch(s){throw a.leaveTrustedScope(r),s}})}static async runTrustedAsync(e){if(!l)return e();let t=l.getStore();if(!t)return e();let{executionId:r}=t;return l.run({...t,trusted:!0},async()=>{a.enterTrustedScope(r);try{return await e()}finally{a.leaveTrustedScope(r)}})}shouldBlock(){if(f||this.config.auditMode||!l)return!1;let e=l?.getStore();return!(e?.sandboxActive!==!0||e.trusted||a.isTrustedScopeActive(e.executionId))}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:l?.getStore()?.executionId};if(this.violations.length<T&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(n){console.debug("[DefenseInDepthBox] onViolation callback threw:",n instanceof Error?n.message:n)}return s}createBlockingProxy(e,t,r){let s=this;return new Proxy(e,{apply(n,o,i){if(s.shouldBlock()){let c=`${t} is blocked during script execution`,u=s.recordViolation(r,t,c);throw new d(c,u)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} called (audit mode)`),Reflect.apply(n,o,i)},construct(n,o,i){if(s.shouldBlock()){let c=`${t} constructor is blocked during script execution`,u=s.recordViolation(r,t,c);throw new d(c,u)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} constructor called (audit mode)`),Reflect.construct(n,o,i)}})}createBlockingObjectProxy(e,t,r,s){let n=this;return new Proxy(e,{get(o,i,c){if(n.shouldBlock()){if(s&&typeof i=="string"&&s.has(i))return Reflect.get(o,i,c);let u=`${t}.${String(i)}`,p=`${u} is blocked during script execution`,h=n.recordViolation(r,u,p);throw new d(p,h)}if(n.config.auditMode&&l?.getStore()?.sandboxActive===!0){let u=`${t}.${String(i)}`;n.recordViolation(r,u,`${u} accessed (audit mode)`)}return Reflect.get(o,i,c)},set(o,i,c,u){if(n.shouldBlock()){let p=`${t}.${String(i)}`,h=`${p} modification is blocked during script execution`,y=n.recordViolation(r,p,h);throw new d(h,y)}return Reflect.set(o,i,c,u)},ownKeys(o){if(n.shouldBlock()){let i=`${t} enumeration is blocked during script execution`,c=n.recordViolation(r,t,i);throw new d(i,c)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,u=`${c} descriptor access is blocked during script execution`,p=n.recordViolation(r,c,u);throw new d(u,p)}return Reflect.getOwnPropertyDescriptor(o,i)},has(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,u=`${c} existence check is blocked during script execution`,p=n.recordViolation(r,c,u);throw new d(u,p)}return Reflect.has(o,i)},deleteProperty(o,i){if(n.shouldBlock()){let c=`${t}.${String(i)}`,u=`${c} deletion is blocked during script execution`,p=n.recordViolation(r,c,u);throw new d(u,p)}return Reflect.deleteProperty(o,i)},setPrototypeOf(o,i){if(n.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,u=n.recordViolation(r,t,c);throw new d(c,u)}return Reflect.setPrototypeOf(o,i)},defineProperty(o,i,c){if(n.shouldBlock()){let u=`${t}.${String(i)}`,p=`${u} defineProperty is blocked during script execution`,h=n.recordViolation(r,u,p);throw new d(p,h)}return Reflect.defineProperty(o,i,c)}})}applyPatches(){this.patchFailures=[];let e=v(),t=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let n of e)t.has(n.violationType)||this.applyPatch(n);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(n=>r.includes(n));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(e.shouldBlock()){let n="Error.prepareStackTrace modification is blocked during script execution",o=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",n);throw new d(n,o)}e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let n=function(...o){return l.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var t=n;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(i,c){if(!l)return Reflect.apply(s,this,[i,c]);let u=l.getStore(),p=u?.sandboxActive===!0&&u.trusted!==!0?u.executionId:void 0;if(!p)return Reflect.apply(s,this,[i,c]);let h=e.getCachedContext(p),y=(b,P)=>typeof b!="function"?b:n.bind({box:e,executionId:p,captured:h,cb:b,kind:P});return Reflect.apply(s,this,[y(i,"fulfilled"),y(c,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(e,t,r){let s=this;try{let n=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:n});let o=n?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let i=`${t} access is blocked during script execution`,c=s.recordViolation(r,t,i);throw new d(i,c)}return s.config.auditMode&&l?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),o},set(i){if(s.shouldBlock()){let c=`${t} modification is blocked during script execution`,u=s.recordViolation(r,t,c);throw new d(c,u)}Object.defineProperty(this,"constructor",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,n instanceof Error?n.message:n)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",s);throw new d(s,n)}return e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.mainModule modification is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",n);throw new d(n,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",s);throw new d(s,n)}return e.config.auditMode&&l?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let n="process.execPath modification is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",n);throw new d(n,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,r)=>{try{let s=Object.getOwnPropertyDescriptor(t,r);if(s?.configurable){if("value"in s){Object.defineProperty(t,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(t,r,{...s,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive)}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=this,t=g("node:module"),r=new Set;for(let o of t.builtinModules??[]){let i=o.startsWith("node:")?o.slice(5):o;r.add(i);let c=i.indexOf("/");c>0&&r.add(i.slice(0,c))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let i=o.startsWith("node:")?o.slice(5):o;if(!i)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(i)||r.has(i))return!0;let c=i.indexOf("/");return c>0&&r.has(i.slice(0,c))},n=()=>{let o=l?.getStore();return e.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!a.isTrustedScopeActive(o.executionId)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(o,i,c){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let u=`import(${o})`,p=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(e.shouldBlock()){let h=e.recordViolation("dynamic_import_builtin",u,p);throw new d(p,h)}n()&&e.recordViolation("dynamic_import_builtin",u,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return c(o,i)}}),a.importHooksRegistered=!0;return}if(typeof t.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
5
+ `);t.register(`data:text/javascript,${encodeURIComponent(o)}`),a.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!f)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._load!="function")return;let t=e._load,r=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:r});let n=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!f)try{let e=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(e=o.constructor)}if(!e&&typeof g<"u"&&typeof g.main<"u"&&(e=g.main.constructor),!e||typeof e._resolveFilename!="function")return;let t=e._resolveFilename,r=Object.getOwnPropertyDescriptor(e,"_resolveFilename");this.originalDescriptors.push({target:e,prop:"_resolveFilename",descriptor:r});let n=this.createBlockingProxy(t,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(e,"_resolveFilename",{value:n,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:r,violationType:s,strategy:n}=e;try{let o=t[r];if(o===void 0)return;let i=Object.getOwnPropertyDescriptor(t,r);if(this.originalDescriptors.push({target:t,prop:r,descriptor:i}),n==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let c=this.getPathForTarget(t,r),u=typeof o=="function"?this.createBlockingProxy(o,c,s):this.createBlockingObjectProxy(o,c,s,e.allowedKeys);Object.defineProperty(t,r,{value:u,writable:!0,configurable:!0})}}catch(o){let i=this.getPathForTarget(t,r);this.patchFailures.push(i),console.debug(`[DefenseInDepthBox] Could not patch ${i}:`,o instanceof Error?o.message:o)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:r,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,r,s):delete t[r]}catch(n){let o=this.getPathForTarget(t,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,n instanceof Error?n.message:n)}}this.originalDescriptors=[]}};export{d as a,_ as b};