@opencode/core 0.0.0-dev-256 → 0.0.0-dev-271

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 (863) hide show
  1. package/dist/account/sql.js +1 -1
  2. package/dist/agent.js +93 -93
  3. package/dist/aisdk-native.js +101 -101
  4. package/dist/aisdk.js +107 -107
  5. package/dist/app.js +9 -9
  6. package/dist/bus.js +83 -83
  7. package/dist/chunks/{ripgrep-hzv53yz7.js → location-services-05aev6jb.js} +14 -14
  8. package/dist/chunks/{ripgrep-5c6v7bf7.js → location-services-05pzx58r.js} +32 -32
  9. package/dist/chunks/location-services-060k1ctd.js +52 -0
  10. package/dist/chunks/{ripgrep-a4f3mdv6.js → location-services-0a35qxtn.js} +18 -18
  11. package/dist/chunks/{ripgrep-5zt75wsq.js → location-services-0h0q04aj.js} +8 -8
  12. package/dist/chunks/{ripgrep-9nd6g1h4.js → location-services-13jgvn4c.js} +16 -16
  13. package/dist/chunks/{ripgrep-hs9b4b47.js → location-services-162nfr0g.js} +2 -2
  14. package/dist/chunks/{ripgrep-17cjzed1.js → location-services-17cjzed1.js} +2 -2
  15. package/dist/chunks/{ripgrep-jhvnj4yv.js → location-services-19yw54pw.js} +15 -15
  16. package/dist/chunks/{ripgrep-z38nccrw.js → location-services-1aqsckx4.js} +4 -4
  17. package/dist/chunks/{ripgrep-gs1ef0jt.js → location-services-1dztdw8x.js} +21 -21
  18. package/dist/chunks/{ripgrep-1x2knyw4.js → location-services-1x2knyw4.js} +1 -1
  19. package/dist/chunks/{ripgrep-1yq9hg58.js → location-services-1yq9hg58.js} +1 -1
  20. package/dist/chunks/{ripgrep-204s3925.js → location-services-204s3925.js} +1 -1
  21. package/dist/chunks/{ripgrep-ak1f0tsr.js → location-services-254d7qhc.js} +9 -9
  22. package/dist/chunks/{ripgrep-25h84942.js → location-services-25h84942.js} +1 -1
  23. package/dist/chunks/{ripgrep-6fpch3kw.js → location-services-26cw61yh.js} +19 -19
  24. package/dist/chunks/{ripgrep-27w5k9zf.js → location-services-27w5k9zf.js} +2 -2
  25. package/dist/chunks/{ripgrep-bzmxpqn3.js → location-services-2kqsk57r.js} +15 -15
  26. package/dist/chunks/{ripgrep-shmzzj1p.js → location-services-2ywsvzr2.js} +17 -17
  27. package/dist/chunks/{ripgrep-x3d3mep8.js → location-services-35ctkm3t.js} +6 -6
  28. package/dist/chunks/{ripgrep-3cbjf1nt.js → location-services-3cbjf1nt.js} +2 -2
  29. package/dist/chunks/{ripgrep-qnghve6e.js → location-services-3dempbt2.js} +8 -8
  30. package/dist/chunks/{ripgrep-3hepkmqq.js → location-services-3hepkmqq.js} +1 -1
  31. package/dist/chunks/{ripgrep-3nnrz6f6.js → location-services-3nnrz6f6.js} +1 -1
  32. package/dist/chunks/{ripgrep-x8yhn9vn.js → location-services-3sv3e4sh.js} +21 -21
  33. package/dist/chunks/{ripgrep-qzwfbxrg.js → location-services-3t0svxwq.js} +14 -14
  34. package/dist/chunks/{ripgrep-zr96t73h.js → location-services-41ee7e1g.js} +13 -13
  35. package/dist/chunks/{ripgrep-jqnfqjgv.js → location-services-4987t165.js} +6 -6
  36. package/dist/chunks/{ripgrep-tsszwamj.js → location-services-49985bx3.js} +30 -30
  37. package/dist/chunks/{ripgrep-pcc6rjnf.js → location-services-4c0eh56a.js} +23 -13
  38. package/dist/chunks/location-services-4dx1dgte.js +16 -0
  39. package/dist/chunks/{ripgrep-mvntxdz5.js → location-services-4pwmc3zk.js} +17 -17
  40. package/dist/chunks/{ripgrep-4pyp9zr9.js → location-services-4pyp9zr9.js} +1 -1
  41. package/dist/chunks/{ripgrep-8k3jsm6y.js → location-services-4pza82rh.js} +25 -25
  42. package/dist/chunks/{ripgrep-qys60372.js → location-services-4rf7amqy.js} +10 -10
  43. package/dist/chunks/{ripgrep-9x1v9m9g.js → location-services-4tsnxgj1.js} +4 -4
  44. package/dist/chunks/{ripgrep-4v008n1t.js → location-services-4v008n1t.js} +1 -1
  45. package/dist/chunks/{ripgrep-1t7faze9.js → location-services-4ya28txs.js} +21 -21
  46. package/dist/chunks/location-services-53f4ettz.js +113 -0
  47. package/dist/chunks/{ripgrep-jqfrpy0b.js → location-services-5c0ay57s.js} +4 -4
  48. package/dist/chunks/location-services-5d7ky1sb.js +257 -0
  49. package/dist/chunks/{ripgrep-6t0y96w1.js → location-services-5jrjkhem.js} +30 -30
  50. package/dist/chunks/{ripgrep-5m9w47nd.js → location-services-5m9w47nd.js} +1 -1
  51. package/dist/chunks/{ripgrep-82b9pnxq.js → location-services-5q7cnmnd.js} +5 -5
  52. package/dist/chunks/{ripgrep-ackzm7p5.js → location-services-5r9j27z7.js} +18 -18
  53. package/dist/chunks/{ripgrep-ffcqnzz5.js → location-services-5rab9vhz.js} +16 -16
  54. package/dist/chunks/{ripgrep-pvvt21d7.js → location-services-5sg2j4zb.js} +14 -14
  55. package/dist/chunks/{ripgrep-3t0qvtxf.js → location-services-5t0xdgr9.js} +12 -12
  56. package/dist/chunks/{ripgrep-b363w4yw.js → location-services-5xcrp97n.js} +18 -18
  57. package/dist/chunks/{ripgrep-03sqz7a9.js → location-services-5zz88cvn.js} +9 -9
  58. package/dist/chunks/{ripgrep-7pf9jw4b.js → location-services-5zzfvef7.js} +6 -6
  59. package/dist/chunks/{ripgrep-v8xpr2tt.js → location-services-6147jgs2.js} +11 -11
  60. package/dist/chunks/{ripgrep-ams2yx18.js → location-services-61erhr80.js} +18 -18
  61. package/dist/chunks/{ripgrep-1gx6yymd.js → location-services-625chkn0.js} +77 -48
  62. package/dist/chunks/{ripgrep-wz5tj16h.js → location-services-66r9f6z1.js} +5 -5
  63. package/dist/chunks/location-services-68291c0v.js +407 -0
  64. package/dist/chunks/{ripgrep-ndtpazxm.js → location-services-69f0ar7f.js} +30 -30
  65. package/dist/chunks/{ripgrep-6esdw8yj.js → location-services-6esdw8yj.js} +1 -1
  66. package/dist/chunks/{ripgrep-49835bfw.js → location-services-6jdd6yf6.js} +4 -4
  67. package/dist/chunks/{ripgrep-z7zabdrt.js → location-services-6pkyn431.js} +18 -18
  68. package/dist/chunks/{ripgrep-vydydcga.js → location-services-6r75hzjy.js} +23 -23
  69. package/dist/chunks/{ripgrep-a33m5c2w.js → location-services-6tnzhnxt.js} +11 -11
  70. package/dist/chunks/{ripgrep-xv70sp23.js → location-services-6yaxbs98.js} +23 -23
  71. package/dist/chunks/{ripgrep-fkx1epcn.js → location-services-701es3rv.js} +24 -24
  72. package/dist/chunks/{ripgrep-zmz19rft.js → location-services-73ktn4xx.js} +9 -9
  73. package/dist/chunks/{ripgrep-rxc5w0st.js → location-services-73nq7rd4.js} +46 -53
  74. package/dist/chunks/{ripgrep-76cb1hcw.js → location-services-76cb1hcw.js} +1 -1
  75. package/dist/chunks/{ripgrep-6dstrpje.js → location-services-76jdhfq7.js} +12 -12
  76. package/dist/chunks/{ripgrep-fqsvv22e.js → location-services-7863p8e9.js} +43 -43
  77. package/dist/chunks/{ripgrep-7bmhse3q.js → location-services-7bmhse3q.js} +1 -1
  78. package/dist/chunks/{ripgrep-xp46ybm5.js → location-services-7ffjm3fx.js} +22 -22
  79. package/dist/chunks/{ripgrep-rvdapjqy.js → location-services-7rnxwetx.js} +11 -11
  80. package/dist/chunks/{ripgrep-xyn9xt4d.js → location-services-7s9zy64f.js} +11 -11
  81. package/dist/chunks/{ripgrep-7w2ypzdf.js → location-services-7w2ypzdf.js} +1 -1
  82. package/dist/chunks/{ripgrep-m7egy7mx.js → location-services-88j3sdmx.js} +47 -47
  83. package/dist/chunks/{ripgrep-jxs8nk7d.js → location-services-8agbak6g.js} +11 -11
  84. package/dist/chunks/{ripgrep-s4vdbda8.js → location-services-8f2e40mw.js} +14 -14
  85. package/dist/chunks/{ripgrep-2k2kcze4.js → location-services-8hfnrd7b.js} +74 -74
  86. package/dist/chunks/{ripgrep-11hfp36g.js → location-services-8jztxfpf.js} +4 -4
  87. package/dist/chunks/{ripgrep-qh99nfkk.js → location-services-8nmq4mhy.js} +27 -27
  88. package/dist/chunks/{ripgrep-xsga5jf7.js → location-services-8tx4q2tc.js} +20 -20
  89. package/dist/chunks/{ripgrep-d8k33s6g.js → location-services-8ve89bpf.js} +8 -8
  90. package/dist/chunks/{ripgrep-8wtp7s3z.js → location-services-8wtp7s3z.js} +1 -1
  91. package/dist/chunks/{ripgrep-8z6m94af.js → location-services-8z6m94af.js} +3 -3
  92. package/dist/chunks/{ripgrep-sk9th60b.js → location-services-8zhw5swa.js} +32 -32
  93. package/dist/chunks/{ripgrep-90zstvax.js → location-services-90zstvax.js} +1 -1
  94. package/dist/chunks/{ripgrep-7rr96ps8.js → location-services-92ee31my.js} +34 -34
  95. package/dist/chunks/{ripgrep-cac0wmbb.js → location-services-95sp4hdf.js} +4 -4
  96. package/dist/chunks/{ripgrep-5jefyemb.js → location-services-99y0fxy8.js} +5 -5
  97. package/dist/chunks/{ripgrep-y8d574bw.js → location-services-9f1h0s6x.js} +26 -26
  98. package/dist/chunks/{ripgrep-ddwaa558.js → location-services-9tvpxs1q.js} +4 -4
  99. package/dist/chunks/{ripgrep-d5xvmxkt.js → location-services-9w6kyjc8.js} +9 -9
  100. package/dist/chunks/location-services-a2vx32ez.js +535 -0
  101. package/dist/chunks/location-services-a610t88q.js +18 -0
  102. package/dist/chunks/{ripgrep-pnxd3f75.js → location-services-a678287s.js} +11 -11
  103. package/dist/chunks/{ripgrep-q91dqmyj.js → location-services-a7c68mes.js} +29 -29
  104. package/dist/chunks/{ripgrep-xf83b33t.js → location-services-ae75vsr5.js} +29 -29
  105. package/dist/chunks/{ripgrep-3szttj5s.js → location-services-af4avevc.js} +23 -23
  106. package/dist/chunks/{ripgrep-r5gpr2p5.js → location-services-ahrjqvfw.js} +22 -22
  107. package/dist/chunks/{ripgrep-aj7mw0zk.js → location-services-aj7mw0zk.js} +2 -2
  108. package/dist/chunks/{ripgrep-fxhhzhmy.js → location-services-aqhqhhxw.js} +23 -23
  109. package/dist/chunks/{ripgrep-ddcyzbs8.js → location-services-av666v8z.js} +13 -13
  110. package/dist/chunks/{ripgrep-3b0cyw5p.js → location-services-b2g2cd4c.js} +13 -13
  111. package/dist/chunks/{ripgrep-b6vsg801.js → location-services-b6vsg801.js} +2 -2
  112. package/dist/chunks/{ripgrep-2n5jzsvh.js → location-services-bfkxtapt.js} +11 -11
  113. package/dist/chunks/{ripgrep-zd07p9e4.js → location-services-bg8p5thh.js} +31 -31
  114. package/dist/chunks/{ripgrep-p47gpjqr.js → location-services-bheemw2q.js} +22 -18
  115. package/dist/chunks/{ripgrep-7442v31d.js → location-services-bm1x4rjt.js} +6 -6
  116. package/dist/chunks/{ripgrep-a17h2gz7.js → location-services-bnp5qds0.js} +5 -5
  117. package/dist/chunks/{ripgrep-xd9cc171.js → location-services-bstexjd6.js} +5 -5
  118. package/dist/chunks/{ripgrep-db73xe5x.js → location-services-bxvvv3jc.js} +21 -21
  119. package/dist/chunks/location-services-c078hgae.js +2050 -0
  120. package/dist/chunks/{ripgrep-wjc27my0.js → location-services-c4cv6xmm.js} +11 -11
  121. package/dist/chunks/{ripgrep-2w1g18fp.js → location-services-c5gvz1b5.js} +4 -4
  122. package/dist/chunks/{ripgrep-yxp9849n.js → location-services-cfh5dtam.js} +31 -31
  123. package/dist/chunks/{ripgrep-909bcygr.js → location-services-crjm84aa.js} +48 -48
  124. package/dist/chunks/{ripgrep-cwrgdav8.js → location-services-cwrgdav8.js} +2 -2
  125. package/dist/chunks/{ripgrep-x959zq99.js → location-services-d1scnhdx.js} +4 -4
  126. package/dist/chunks/{ripgrep-gkng5bng.js → location-services-d7akxsfc.js} +6 -6
  127. package/dist/chunks/{ripgrep-mw7r6xhf.js → location-services-d83be7vq.js} +6 -6
  128. package/dist/chunks/{ripgrep-agz4bq91.js → location-services-d987wdq8.js} +30 -30
  129. package/dist/chunks/{ripgrep-d0t1jrhe.js → location-services-dcgrx69e.js} +5 -5
  130. package/dist/chunks/{ripgrep-zh4a5xq0.js → location-services-dfgayekp.js} +19 -19
  131. package/dist/chunks/{ripgrep-mg06kx6s.js → location-services-dj84jp87.js} +16 -16
  132. package/dist/chunks/{ripgrep-m049c8tp.js → location-services-dq6afaen.js} +20 -20
  133. package/dist/chunks/{ripgrep-dt77769w.js → location-services-dt77769w.js} +1 -1
  134. package/dist/chunks/{ripgrep-r2aaaqsx.js → location-services-dw0jwsqt.js} +34 -34
  135. package/dist/chunks/{ripgrep-e834z07m.js → location-services-e834z07m.js} +1 -1
  136. package/dist/chunks/{ripgrep-tjx9btwx.js → location-services-edf6ca2j.js} +186 -186
  137. package/dist/chunks/{ripgrep-8d2bz6m6.js → location-services-enkpkfwx.js} +8 -8
  138. package/dist/chunks/{ripgrep-eqmd2tfz.js → location-services-eqmd2tfz.js} +1 -1
  139. package/dist/chunks/{ripgrep-7fjdcjgg.js → location-services-exjf25px.js} +11 -11
  140. package/dist/chunks/{ripgrep-b3tsdpgs.js → location-services-f12jx86d.js} +11 -11
  141. package/dist/chunks/{ripgrep-c48vnd7r.js → location-services-f2738s6n.js} +3 -3
  142. package/dist/chunks/{ripgrep-r8ack8x7.js → location-services-fa27aj77.js} +8 -8
  143. package/dist/chunks/{ripgrep-gffq2h0h.js → location-services-faykeh36.js} +19 -19
  144. package/dist/chunks/{ripgrep-vmaxc52x.js → location-services-fb4xs09j.js} +18 -18
  145. package/dist/chunks/{ripgrep-phrz113q.js → location-services-fex8285v.js} +30 -28
  146. package/dist/chunks/{ripgrep-fffv3p7h.js → location-services-fffv3p7h.js} +1 -1
  147. package/dist/chunks/{ripgrep-fg9p65nk.js → location-services-fg9p65nk.js} +2 -2
  148. package/dist/chunks/{ripgrep-bccmdxdz.js → location-services-fn0pn290.js} +12 -12
  149. package/dist/chunks/{ripgrep-tak8qdkr.js → location-services-fngvx4yd.js} +8 -8
  150. package/dist/chunks/{ripgrep-q6vnkpbt.js → location-services-fq0hatx6.js} +33 -33
  151. package/dist/chunks/{ripgrep-dsmd9z3t.js → location-services-fse61478.js} +37 -37
  152. package/dist/chunks/{ripgrep-0h910ma9.js → location-services-g3d6ha41.js} +17 -17
  153. package/dist/chunks/{ripgrep-3sxgvrsr.js → location-services-g6c2jpgq.js} +15 -15
  154. package/dist/chunks/{ripgrep-jk10zsa9.js → location-services-g6dvkvqf.js} +28 -28
  155. package/dist/chunks/{ripgrep-jdra26ww.js → location-services-gcfys28r.js} +19 -19
  156. package/dist/chunks/{ripgrep-b0mgw4ep.js → location-services-gf94v7ds.js} +12 -12
  157. package/dist/chunks/{ripgrep-7h63ckp6.js → location-services-gkg0y7d3.js} +19 -19
  158. package/dist/chunks/{ripgrep-d4v9tmah.js → location-services-gn8tkhbf.js} +2 -2
  159. package/dist/chunks/{ripgrep-rmk8jq11.js → location-services-gtjkmstt.js} +37 -37
  160. package/dist/chunks/{ripgrep-hr4y9snp.js → location-services-gz7axp6c.js} +7 -7
  161. package/dist/chunks/{ripgrep-pj6fb39f.js → location-services-hcdj4fe2.js} +67 -53
  162. package/dist/chunks/{ripgrep-y6qsxzbk.js → location-services-hcky80w5.js} +4 -4
  163. package/dist/chunks/{ripgrep-erc81w38.js → location-services-he1z5msn.js} +24 -19
  164. package/dist/chunks/{ripgrep-mg356nz4.js → location-services-hgfegmhz.js} +58 -26
  165. package/dist/chunks/{ripgrep-hh7kjqtw.js → location-services-hh7kjqtw.js} +1 -1
  166. package/dist/chunks/{ripgrep-5qbnyx67.js → location-services-hhcegec1.js} +37 -37
  167. package/dist/chunks/{ripgrep-2e5pdp54.js → location-services-hnv7rbyt.js} +7 -7
  168. package/dist/chunks/{ripgrep-hpg1pkwy.js → location-services-hpg1pkwy.js} +1 -1
  169. package/dist/chunks/{ripgrep-am8n4zj8.js → location-services-hrj3d3rg.js} +40 -40
  170. package/dist/chunks/{ripgrep-qf4spmep.js → location-services-ht7smmrx.js} +33 -33
  171. package/dist/chunks/{ripgrep-pmnwwjgv.js → location-services-hwdk6992.js} +56 -56
  172. package/dist/chunks/{ripgrep-sy9atnn8.js → location-services-j28mjm60.js} +7 -7
  173. package/dist/chunks/{ripgrep-5bp97s21.js → location-services-j4wsft1q.js} +18 -18
  174. package/dist/chunks/{ripgrep-1f952vs7.js → location-services-jcrsb2we.js} +9 -9
  175. package/dist/chunks/{ripgrep-jfaecv01.js → location-services-jfaecv01.js} +1 -1
  176. package/dist/chunks/{ripgrep-fdfr6sds.js → location-services-jjkdzw18.js} +15 -15
  177. package/dist/chunks/{ripgrep-1fwefjcd.js → location-services-jsrgk7v1.js} +22 -22
  178. package/dist/chunks/{ripgrep-jtnps1zs.js → location-services-jtnps1zs.js} +2 -2
  179. package/dist/chunks/{ripgrep-kcg78dnn.js → location-services-jv2xnyk0.js} +2 -2
  180. package/dist/chunks/{ripgrep-882n9ge3.js → location-services-k3f7456s.js} +5 -5
  181. package/dist/chunks/{ripgrep-yqqn7f99.js → location-services-k56767v4.js} +1 -1
  182. package/dist/chunks/{ripgrep-k814nvkf.js → location-services-k814nvkf.js} +1 -1
  183. package/dist/chunks/{ripgrep-4fcq8f9m.js → location-services-kbq9sd94.js} +11 -11
  184. package/dist/chunks/{ripgrep-z33c4g07.js → location-services-kecs8cm0.js} +13 -13
  185. package/dist/chunks/{ripgrep-9wqtqs01.js → location-services-kfcsbfj2.js} +45 -35
  186. package/dist/chunks/{ripgrep-sfvb2ra8.js → location-services-kgaj0b42.js} +33 -33
  187. package/dist/chunks/{ripgrep-dqyfjygp.js → location-services-kpd0ft4p.js} +22 -22
  188. package/dist/chunks/{ripgrep-psanbaqe.js → location-services-kreataz1.js} +9 -9
  189. package/dist/chunks/{ripgrep-kt3bjfbg.js → location-services-kt3bjfbg.js} +1 -1
  190. package/dist/chunks/{ripgrep-m1714858.js → location-services-m1714858.js} +1 -1
  191. package/dist/chunks/{ripgrep-sbpkqjks.js → location-services-m3pbq8ct.js} +16 -16
  192. package/dist/chunks/{ripgrep-s85z3cra.js → location-services-m7xh3h0x.js} +4 -4
  193. package/dist/chunks/{ripgrep-2kk97py3.js → location-services-m8vjyhwb.js} +11 -11
  194. package/dist/chunks/{ripgrep-m9w0rfyh.js → location-services-m9w0rfyh.js} +1 -1
  195. package/dist/chunks/{ripgrep-5rgg5y2m.js → location-services-mcaz155f.js} +6 -6
  196. package/dist/chunks/{ripgrep-xcebgh3h.js → location-services-mm24p6x7.js} +4 -4
  197. package/dist/chunks/{ripgrep-mtkfycnh.js → location-services-mtkfycnh.js} +1 -1
  198. package/dist/chunks/{ripgrep-h7tawekg.js → location-services-mwby5be6.js} +27 -27
  199. package/dist/chunks/{ripgrep-7521vzgd.js → location-services-mwyy67aj.js} +13 -13
  200. package/dist/chunks/{ripgrep-t5kja7d6.js → location-services-mz3xd1k6.js} +24 -24
  201. package/dist/chunks/{ripgrep-pa3yh9f4.js → location-services-n91e94x0.js} +30 -30
  202. package/dist/chunks/{ripgrep-h0xgca3k.js → location-services-n94pvp91.js} +54 -30
  203. package/dist/chunks/{ripgrep-nah043kf.js → location-services-nah043kf.js} +1 -1
  204. package/dist/chunks/{ripgrep-kjdrtwey.js → location-services-ndcaramg.js} +5 -5
  205. package/dist/chunks/{ripgrep-hq7e4nr1.js → location-services-nk8zryt9.js} +7 -7
  206. package/dist/chunks/{ripgrep-r87akjs2.js → location-services-nm8x0m3s.js} +6 -6
  207. package/dist/chunks/{ripgrep-3tpyq6vw.js → location-services-nn8146rv.js} +13 -13
  208. package/dist/chunks/{ripgrep-n6v2b7cw.js → location-services-nv205p9v.js} +5 -5
  209. package/dist/chunks/{ripgrep-b0hcd791.js → location-services-nwn24kq0.js} +8 -8
  210. package/dist/chunks/{ripgrep-nx4vzyjd.js → location-services-nx4vzyjd.js} +2 -2
  211. package/dist/chunks/{ripgrep-p015t6z3.js → location-services-p015t6z3.js} +2 -2
  212. package/dist/chunks/{ripgrep-f2hbk3te.js → location-services-p8e6hb0k.js} +14 -14
  213. package/dist/chunks/{ripgrep-nxftzjsa.js → location-services-p9aaxzzm.js} +19 -19
  214. package/dist/chunks/{ripgrep-gt0enb5r.js → location-services-perw67p4.js} +22 -22
  215. package/dist/chunks/{ripgrep-pknna89w.js → location-services-pknna89w.js} +1 -1
  216. package/dist/chunks/{ripgrep-h7zsgwja.js → location-services-pqan8706.js} +23 -23
  217. package/dist/chunks/{ripgrep-qkw2jr9b.js → location-services-pxtfkpje.js} +2 -2
  218. package/dist/chunks/{ripgrep-5aysfjzq.js → location-services-pygderqp.js} +22 -22
  219. package/dist/chunks/{ripgrep-zh7bbm8x.js → location-services-q4fcarhy.js} +9 -9
  220. package/dist/chunks/{ripgrep-n0xqaxze.js → location-services-qmv0q6pw.js} +30 -30
  221. package/dist/chunks/{ripgrep-vaq1yek0.js → location-services-qnqasnye.js} +6 -6
  222. package/dist/chunks/{ripgrep-qp7r0hxv.js → location-services-qp7r0hxv.js} +1 -1
  223. package/dist/chunks/{ripgrep-qqvy8y24.js → location-services-qqvy8y24.js} +1 -1
  224. package/dist/chunks/{ripgrep-enpxw9ft.js → location-services-qw73mqn2.js} +38 -38
  225. package/dist/chunks/{ripgrep-bxe7n28z.js → location-services-qz087kyw.js} +8 -8
  226. package/dist/chunks/location-services-r09xcsm2.js +390 -0
  227. package/dist/chunks/{ripgrep-qavpxcye.js → location-services-r1fhaev6.js} +2 -2
  228. package/dist/chunks/{ripgrep-18g90bpv.js → location-services-r4pwrx75.js} +9 -9
  229. package/dist/chunks/{ripgrep-r542h3bh.js → location-services-r542h3bh.js} +1 -1
  230. package/dist/chunks/{ripgrep-jzpa86ty.js → location-services-rb8dmkdr.js} +27 -27
  231. package/dist/chunks/{ripgrep-rb9dy4dg.js → location-services-rb9dy4dg.js} +1 -1
  232. package/dist/chunks/{ripgrep-f2dkd9c9.js → location-services-rgy8fvzs.js} +82 -82
  233. package/dist/chunks/{ripgrep-b5jmjrr6.js → location-services-rkmfgj7k.js} +32 -32
  234. package/dist/chunks/{ripgrep-k4hxmz12.js → location-services-rqxwm5vf.js} +33 -33
  235. package/dist/chunks/{ripgrep-rt5dr6hb.js → location-services-rt5dr6hb.js} +1 -1
  236. package/dist/chunks/{ripgrep-8wxjt6jj.js → location-services-rwtt4501.js} +28 -28
  237. package/dist/chunks/{ripgrep-dwwyec8z.js → location-services-rwvswa9y.js} +6 -6
  238. package/dist/chunks/{ripgrep-g24xgb35.js → location-services-ry6m6k45.js} +11 -11
  239. package/dist/chunks/{ripgrep-h5prggwk.js → location-services-s6rqyy7q.js} +47 -47
  240. package/dist/chunks/{ripgrep-vm4ntgdp.js → location-services-s7dtnyk2.js} +91 -91
  241. package/dist/chunks/{ripgrep-zbjfvsrb.js → location-services-s87tva5r.js} +9 -9
  242. package/dist/chunks/{ripgrep-sa3fpqfw.js → location-services-sa3fpqfw.js} +2 -2
  243. package/dist/chunks/{ripgrep-j83zfqb4.js → location-services-sab8hb9j.js} +25 -25
  244. package/dist/chunks/{ripgrep-wsrqy1ze.js → location-services-sb68qyrv.js} +21 -21
  245. package/dist/chunks/{ripgrep-sqjzf8x2.js → location-services-sqjzf8x2.js} +1 -1
  246. package/dist/chunks/{ripgrep-svcy3p9a.js → location-services-svcy3p9a.js} +1 -1
  247. package/dist/chunks/{ripgrep-vcxd5eqd.js → location-services-sxfdfs5r.js} +11 -11
  248. package/dist/chunks/{ripgrep-3jqgx5kj.js → location-services-t20evbn4.js} +47 -47
  249. package/dist/chunks/{ripgrep-7kef5ntp.js → location-services-t815r62s.js} +3 -3
  250. package/dist/chunks/{ripgrep-0cc6nv5k.js → location-services-t9fjyv5p.js} +9 -9
  251. package/dist/chunks/{ripgrep-tczq8hjw.js → location-services-tczq8hjw.js} +1 -1
  252. package/dist/chunks/{ripgrep-aytd9eaj.js → location-services-tptvq6v6.js} +4 -4
  253. package/dist/chunks/{ripgrep-s5z0gt4g.js → location-services-ts3q81hd.js} +3 -3
  254. package/dist/chunks/{ripgrep-twssxy5n.js → location-services-twssxy5n.js} +2 -2
  255. package/dist/chunks/{ripgrep-x524hec9.js → location-services-txb82dsv.js} +23 -23
  256. package/dist/chunks/{ripgrep-x3fmc1hr.js → location-services-tzw071bs.js} +21 -21
  257. package/dist/chunks/{ripgrep-my54cbqv.js → location-services-v2psmyxx.js} +5 -5
  258. package/dist/chunks/{ripgrep-v2r1d0zg.js → location-services-v2r1d0zg.js} +1 -1
  259. package/dist/chunks/{ripgrep-2zp5a6yg.js → location-services-vb80j1wh.js} +3 -3
  260. package/dist/chunks/{ripgrep-2hnaskt6.js → location-services-vc4cryav.js} +9 -9
  261. package/dist/chunks/{ripgrep-jp89zqat.js → location-services-vkcgzpwt.js} +23 -23
  262. package/dist/chunks/{ripgrep-nta1mp64.js → location-services-vwgtfhce.js} +11 -11
  263. package/dist/chunks/{ripgrep-qfkq8xrf.js → location-services-vy4m1q4k.js} +58 -58
  264. package/dist/chunks/{ripgrep-40za9wsf.js → location-services-w2eysc6j.js} +9 -9
  265. package/dist/chunks/{ripgrep-w3wsvvr9.js → location-services-w3wsvvr9.js} +1 -1
  266. package/dist/chunks/{ripgrep-mmx1mfjr.js → location-services-w79nt68w.js} +4 -4
  267. package/dist/chunks/{ripgrep-ybcwzyjp.js → location-services-w8ndjz7j.js} +31 -31
  268. package/dist/chunks/{ripgrep-wakvkjy4.js → location-services-wakvkjy4.js} +1 -1
  269. package/dist/chunks/{ripgrep-wd87259q.js → location-services-wd87259q.js} +1 -1
  270. package/dist/chunks/{ripgrep-mb3v38wv.js → location-services-wdw55mq4.js} +5 -5
  271. package/dist/chunks/{ripgrep-aje86v63.js → location-services-wj1hwnq7.js} +3 -3
  272. package/dist/chunks/{ripgrep-wnhgecwx.js → location-services-wnhgecwx.js} +1 -1
  273. package/dist/chunks/{ripgrep-w687dnns.js → location-services-wr3re1en.js} +4 -4
  274. package/dist/chunks/{ripgrep-e7gncem7.js → location-services-x51b6bk0.js} +2 -2
  275. package/dist/chunks/{ripgrep-j5dh2pqj.js → location-services-x93g9n8c.js} +15 -15
  276. package/dist/chunks/{ripgrep-x62jm14v.js → location-services-x99kszcd.js} +14 -14
  277. package/dist/chunks/{ripgrep-ydbjebpg.js → location-services-x9nckj68.js} +25 -25
  278. package/dist/chunks/{ripgrep-3ryz99p0.js → location-services-xmx7xj34.js} +4 -4
  279. package/dist/chunks/{ripgrep-3416qbwy.js → location-services-xrc3640n.js} +8 -8
  280. package/dist/chunks/{ripgrep-dp20ymjh.js → location-services-xsdjk4ge.js} +5 -5
  281. package/dist/chunks/{ripgrep-qqpbcr2p.js → location-services-xt0z8zst.js} +4 -4
  282. package/dist/chunks/{ripgrep-z9qgeafv.js → location-services-y98qbkn6.js} +20 -20
  283. package/dist/chunks/{ripgrep-rkafft8x.js → location-services-y9r97bb3.js} +14 -14
  284. package/dist/chunks/{ripgrep-yb20nhc3.js → location-services-yb20nhc3.js} +1 -1
  285. package/dist/chunks/{ripgrep-jew46n24.js → location-services-yh9hqaeq.js} +9 -9
  286. package/dist/chunks/{ripgrep-68gxk72y.js → location-services-ykap3e57.js} +25 -25
  287. package/dist/chunks/{ripgrep-ke335cjj.js → location-services-ytz496fy.js} +5 -5
  288. package/dist/chunks/{ripgrep-c5rgx9f0.js → location-services-yx6x8jfj.js} +2 -2
  289. package/dist/chunks/{ripgrep-k4461cq5.js → location-services-yz9rz98a.js} +6 -6
  290. package/dist/chunks/{ripgrep-29bbm67v.js → location-services-z5fvc4pa.js} +27 -27
  291. package/dist/chunks/{ripgrep-e5697zjm.js → location-services-z89tmfeq.js} +12 -12
  292. package/dist/chunks/{ripgrep-yeejah88.js → location-services-zb5gs1ba.js} +3 -3
  293. package/dist/chunks/{ripgrep-daqk1zzh.js → location-services-zcdj67b9.js} +30 -30
  294. package/dist/chunks/{ripgrep-gzqtw9gm.js → location-services-zdpw9dy9.js} +20 -20
  295. package/dist/chunks/location-services-zf52n5v2.js +26 -0
  296. package/dist/chunks/{ripgrep-6vab03tz.js → location-services-zgmb78cs.js} +33 -33
  297. package/dist/chunks/{ripgrep-z48jxn29.js → location-services-zkyvmhna.js} +16 -16
  298. package/dist/chunks/{ripgrep-4ggjgtjs.js → location-services-zpn8n3e3.js} +11 -11
  299. package/dist/chunks/{ripgrep-3rj35y7k.js → location-services-zsjka0ec.js} +5 -5
  300. package/dist/chunks/{ripgrep-hy1b2qcd.js → location-services-zwp1eeat.js} +2 -2
  301. package/dist/chunks/{ripgrep-k1sfxhaz.js → location-services-zx82kmhe.js} +40 -40
  302. package/dist/chunks/{ripgrep-vpm1h889.js → location-services-zyy8z9rg.js} +19 -19
  303. package/dist/codemode/catalog.js +1 -1
  304. package/dist/codemode/instructions.js +5 -5
  305. package/dist/codemode/tool.js +8 -4
  306. package/dist/codemode/web.js +1 -1
  307. package/dist/command.js +91 -91
  308. package/dist/config/discovery.js +94 -94
  309. package/dist/config/integration.js +13 -9
  310. package/dist/config/managed.js +8 -0
  311. package/dist/config/markdown.js +1 -1
  312. package/dist/config/normalize.js +111 -111
  313. package/dist/config/plugin/agent.js +131 -127
  314. package/dist/config/plugin/command.js +228 -225
  315. package/dist/config/plugin/compaction.js +169 -166
  316. package/dist/config/plugin/compatibility.js +149 -146
  317. package/dist/config/plugin/entry-observer.js +1 -1
  318. package/dist/config/plugin/formatter.js +130 -126
  319. package/dist/config/plugin/image.js +129 -125
  320. package/dist/config/plugin/instruction.js +129 -125
  321. package/dist/config/plugin/location-watcher.js +131 -127
  322. package/dist/config/plugin/mcp.js +138 -134
  323. package/dist/config/plugin/policy.js +129 -127
  324. package/dist/config/plugin/provider.js +129 -126
  325. package/dist/config/plugin/reference.js +131 -127
  326. package/dist/config/plugin/shell.js +131 -127
  327. package/dist/config/plugin/skill-file.js +145 -142
  328. package/dist/config/plugin/skill-scan.js +1 -1
  329. package/dist/config/plugin/skill.js +150 -147
  330. package/dist/config/plugin/snapshot.js +129 -125
  331. package/dist/config/plugin/source.js +132 -128
  332. package/dist/config/plugin/tool-output.js +130 -126
  333. package/dist/config/plugin/websearch.js +130 -126
  334. package/dist/config/plugin/worktree.js +131 -127
  335. package/dist/config/variable.js +1 -1
  336. package/dist/config/watch.js +1 -1
  337. package/dist/config.js +130 -126
  338. package/dist/console-access.js +1 -1
  339. package/dist/credential/sql.js +2 -2
  340. package/dist/credential.js +93 -93
  341. package/dist/database/database.js +80 -80
  342. package/dist/database/drizzle/effect-sqlite/driver.js +14 -14
  343. package/dist/database/drizzle/effect-sqlite/index.js +14 -14
  344. package/dist/database/drizzle/effect-sqlite/session.js +11 -11
  345. package/dist/database/drizzle/index.js +15 -15
  346. package/dist/database/drizzle/internal/drizzle-utils.js +1 -1
  347. package/dist/database/drizzle/sqlite-core/effect/count.js +1 -1
  348. package/dist/database/drizzle/sqlite-core/effect/db.js +9 -9
  349. package/dist/database/drizzle/sqlite-core/effect/delete.js +2 -2
  350. package/dist/database/drizzle/sqlite-core/effect/index.js +10 -10
  351. package/dist/database/drizzle/sqlite-core/effect/insert.js +2 -2
  352. package/dist/database/drizzle/sqlite-core/effect/query.js +1 -1
  353. package/dist/database/drizzle/sqlite-core/effect/raw.js +1 -1
  354. package/dist/database/drizzle/sqlite-core/effect/select.js +2 -2
  355. package/dist/database/drizzle/sqlite-core/effect/session.js +10 -10
  356. package/dist/database/drizzle/sqlite-core/effect/update.js +2 -2
  357. package/dist/database/drizzle.js +16 -16
  358. package/dist/database/migration/20260127222353_familiar_lady_ursula.js +1 -1
  359. package/dist/database/migration/20260211171708_add_project_commands.js +1 -1
  360. package/dist/database/migration/20260213144116_wakeful_the_professor.js +1 -1
  361. package/dist/database/migration/20260225215848_workspace.js +1 -1
  362. package/dist/database/migration/20260227213759_add_session_workspace_id.js +1 -1
  363. package/dist/database/migration/20260228203230_blue_harpoon.js +1 -1
  364. package/dist/database/migration/20260303231226_add_workspace_fields.js +1 -1
  365. package/dist/database/migration/20260309230000_move_org_to_state.js +1 -1
  366. package/dist/database/migration/20260312043431_session_message_cursor.js +1 -1
  367. package/dist/database/migration/20260323234822_events.js +1 -1
  368. package/dist/database/migration/20260410174513_workspace-name.js +1 -1
  369. package/dist/database/migration/20260413175956_chief_energizer.js +1 -1
  370. package/dist/database/migration/20260423070820_add_icon_url_override.js +1 -1
  371. package/dist/database/migration/20260427172553_slow_nightmare.js +1 -1
  372. package/dist/database/migration/20260428004200_add_session_path.js +1 -1
  373. package/dist/database/migration/20260501142318_next_venus.js +1 -1
  374. package/dist/database/migration/20260504145000_add_sync_owner.js +1 -1
  375. package/dist/database/migration/20260507164347_add_workspace_time.js +1 -1
  376. package/dist/database/migration/20260510033149_session_usage.js +1 -1
  377. package/dist/database/migration/20260511000411_data_migration_state.js +1 -1
  378. package/dist/database/migration/20260511173437_session-metadata.js +1 -1
  379. package/dist/database/migration/20260601010001_normalize_storage_paths.js +1 -1
  380. package/dist/database/migration/20260601202201_amazing_prowler.js +1 -1
  381. package/dist/database/migration/20260602002951_lowly_union_jack.js +1 -1
  382. package/dist/database/migration/20260602182828_add_project_directories.js +1 -1
  383. package/dist/database/migration/20260603001617_session_message_projection_indexes.js +1 -1
  384. package/dist/database/migration/20260603040000_session_message_projection_order.js +1 -1
  385. package/dist/database/migration/20260603141458_session_input_inbox.js +1 -1
  386. package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +1 -1
  387. package/dist/database/migration/20260604172448_event_sourced_session_input.js +1 -1
  388. package/dist/database/migration/20260605003541_add_session_context_snapshot.js +1 -1
  389. package/dist/database/migration/20260605042240_add_context_epoch_agent.js +1 -1
  390. package/dist/database/migration/20260611035744_credential.js +1 -1
  391. package/dist/database/migration/20260611192811_lush_chimera.js +1 -1
  392. package/dist/database/migration/20260612174303_project_dir_strategy.js +1 -1
  393. package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +1 -1
  394. package/dist/database/migration/20260622170816_reset_v2_session_state.js +1 -1
  395. package/dist/database/migration/20260622202450_simplify_session_input.js +1 -1
  396. package/dist/database/migration/20260804233008_loose_psylocke.js +1 -1
  397. package/dist/database/migration/20260805200742_import_legacy_credentials.js +1 -1
  398. package/dist/database/migration/20260808023530_workspace_domain.js +1 -1
  399. package/dist/database/migration/20260811161259_execution_claim_attempts.js +1 -1
  400. package/dist/database/migration/20260812181746_session_inbox.js +1 -1
  401. package/dist/database/migration/20260812213948_worktree.js +1 -1
  402. package/dist/database/migration/20260819222447_session_viewed_state.js +1 -1
  403. package/dist/database/migration/20260823191254_nullable_workspace_binding.js +1 -1
  404. package/dist/database/migration/20260910120000_clear_v1_session_permission.js +1 -1
  405. package/dist/database/migration/20260923013825_project_time_active.js +1 -1
  406. package/dist/database/migration/20261007190000_azure_cli_external_credential.js +1 -1
  407. package/dist/database/migration/20261010180456_project_time_archived.js +1 -1
  408. package/dist/database/migration/20261024002554_session_allowance.js +1 -1
  409. package/dist/database/migration/20261024175301_drop_session_allowance.js +1 -1
  410. package/dist/database/migration/20261025123711_blob.js +1 -1
  411. package/dist/database/migration/20261025154125_drop_session_pending.js +1 -1
  412. package/dist/database/migration/20261026223005_schedule.js +1 -1
  413. package/dist/database/migration/20261029002625_session_part.js +1 -1
  414. package/dist/database/migration/20261029073502_session_time_busy.js +1 -1
  415. package/dist/database/migration/20261029165540_schedule_checks.js +1 -1
  416. package/dist/database/migration.gen.js +59 -59
  417. package/dist/database/migration.js +61 -61
  418. package/dist/database/path.js +2 -2
  419. package/dist/database/schema.gen.js +1 -1
  420. package/dist/database/schema.sql.js +1 -1
  421. package/dist/database/sqlite.bun.js +1 -1
  422. package/dist/database/sqlite.js +1 -1
  423. package/dist/database/sqlite.node.js +1 -1
  424. package/dist/database/sqlite.workerd.js +1 -1
  425. package/dist/database/v1-migration.bun.js +100 -100
  426. package/dist/database/v1-migration.js +1 -1
  427. package/dist/effect/app-node-builder.js +392 -390
  428. package/dist/effect/app-node-platform.js +2 -2
  429. package/dist/effect/keyed-mutex.js +3 -3
  430. package/dist/effect/websocket-constructor.js +1 -1
  431. package/dist/environment/driver.js +1 -1
  432. package/dist/environment/environment.js +105 -105
  433. package/dist/environment/exec-defaults.js +2 -2
  434. package/dist/environment/files.js +1 -1
  435. package/dist/environment/index.js +105 -105
  436. package/dist/environment/local.js +2 -2
  437. package/dist/environment/memory.js +2 -2
  438. package/dist/environment/unavailable.js +3 -3
  439. package/dist/event/sql.js +1 -1
  440. package/dist/event-logger.js +84 -84
  441. package/dist/file-access.js +155 -152
  442. package/dist/file-mutation.js +106 -106
  443. package/dist/file-retention.js +1 -1
  444. package/dist/filesystem/fff.bun.js +2 -2
  445. package/dist/filesystem/fff.js +1 -1
  446. package/dist/filesystem/fff.node.js +2 -2
  447. package/dist/filesystem/fff.workerd.js +2 -2
  448. package/dist/filesystem/file-watch.js +90 -90
  449. package/dist/filesystem/location-watcher-policy.js +6 -6
  450. package/dist/filesystem/location-watcher.js +241 -238
  451. package/dist/filesystem/protected.js +1 -1
  452. package/dist/filesystem/search.js +111 -111
  453. package/dist/filesystem/watcher-binding.js +1 -1
  454. package/dist/filesystem/watcher.js +9 -9
  455. package/dist/filesystem.js +116 -116
  456. package/dist/form.js +90 -90
  457. package/dist/formatter/builtins.js +4 -4
  458. package/dist/formatter.js +99 -99
  459. package/dist/generate.js +119 -119
  460. package/dist/git.js +11 -11
  461. package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +1 -1
  462. package/dist/github-copilot/chat/get-response-metadata.js +1 -1
  463. package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +1 -1
  464. package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +7 -7
  465. package/dist/github-copilot/chat/openai-compatible-chat-options.js +1 -1
  466. package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +1 -1
  467. package/dist/github-copilot/copilot-provider.js +17 -17
  468. package/dist/github-copilot/models.js +111 -111
  469. package/dist/github-copilot/openai-compatible-error.js +1 -1
  470. package/dist/github-copilot/responses/convert-to-openai-responses-input.js +1 -1
  471. package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +1 -1
  472. package/dist/github-copilot/responses/openai-error.js +1 -1
  473. package/dist/github-copilot/responses/openai-responses-language-model.js +10 -10
  474. package/dist/github-copilot/responses/openai-responses-prepare-tools.js +6 -6
  475. package/dist/github-copilot/responses/tool/code-interpreter.js +1 -1
  476. package/dist/github-copilot/responses/tool/file-search.js +1 -1
  477. package/dist/github-copilot/responses/tool/image-generation.js +1 -1
  478. package/dist/github-copilot/responses/tool/web-search-preview.js +1 -1
  479. package/dist/github-copilot/responses/tool/web-search.js +1 -1
  480. package/dist/image/notice.js +1 -1
  481. package/dist/image/photon-normalize.js +1 -1
  482. package/dist/image/photon-worker.js +1 -1
  483. package/dist/image/photon.js +4 -4
  484. package/dist/image.js +6 -6
  485. package/dist/instance/service.js +5 -5
  486. package/dist/instance.js +383 -381
  487. package/dist/instruction-discovery.js +86 -86
  488. package/dist/instructions/builtins.js +99 -99
  489. package/dist/instructions/index.js +3 -3
  490. package/dist/integration/connection.js +3 -3
  491. package/dist/integration.js +99 -99
  492. package/dist/job.js +88 -88
  493. package/dist/kv/sql.js +2 -2
  494. package/dist/kv.js +83 -83
  495. package/dist/location-activity.js +173 -170
  496. package/dist/location-lifecycle.js +149 -146
  497. package/dist/location-service-map.js +98 -98
  498. package/dist/location-services.js +380 -378
  499. package/dist/location.js +93 -93
  500. package/dist/managed-policy.js +11 -3
  501. package/dist/mcp/client.js +103 -103
  502. package/dist/mcp/index.js +117 -117
  503. package/dist/mcp/instructions.js +173 -170
  504. package/dist/mcp/oauth.js +88 -88
  505. package/dist/mcp/socket-client.js +1 -1
  506. package/dist/mcp/stdio.js +102 -102
  507. package/dist/mime.js +1 -1
  508. package/dist/modal/models.js +111 -111
  509. package/dist/model-resolver.js +109 -109
  510. package/dist/model-retry.js +1 -1
  511. package/dist/model.js +114 -114
  512. package/dist/models-dev/v1.js +1 -1
  513. package/dist/models-dev.js +120 -120
  514. package/dist/oauth/page.js +1 -1
  515. package/dist/permission/saved.js +92 -92
  516. package/dist/permission/sql.js +5 -5
  517. package/dist/permission.js +152 -149
  518. package/dist/persistent-pty/binary.bun.js +1 -1
  519. package/dist/persistent-pty/daemon.js +1 -1
  520. package/dist/persistent-pty/index.js +100 -100
  521. package/dist/persistent-pty/pty-binding.js +1 -1
  522. package/dist/persistent-pty.js +85 -85
  523. package/dist/plugin/agent.js +86 -86
  524. package/dist/plugin/command.js +114 -114
  525. package/dist/plugin/goal.js +3 -3
  526. package/dist/plugin/hooks.js +5 -5
  527. package/dist/plugin/host.js +232 -229
  528. package/dist/plugin/identity.js +5 -5
  529. package/dist/plugin/instance.js +5 -5
  530. package/dist/plugin/internal.js +359 -357
  531. package/dist/plugin/mcp-codemode-defaults.js +3 -3
  532. package/dist/plugin/models-dev.js +109 -109
  533. package/dist/plugin/module.js +126 -125
  534. package/dist/plugin/optimize.js +2 -2
  535. package/dist/plugin/plan.js +145 -142
  536. package/dist/plugin/promise.js +1 -1
  537. package/dist/plugin/provider/amazon-bedrock.js +103 -103
  538. package/dist/plugin/provider/azure.js +129 -125
  539. package/dist/plugin/provider/cerebras.js +1 -1
  540. package/dist/plugin/provider/chatgpt.js +129 -125
  541. package/dist/plugin/provider/cloudflare-ai-gateway.js +127 -123
  542. package/dist/plugin/provider/cloudflare-workers-ai.js +127 -123
  543. package/dist/plugin/provider/configured.js +125 -121
  544. package/dist/plugin/provider/credential-settings.js +84 -84
  545. package/dist/plugin/provider/databricks.js +1 -1
  546. package/dist/plugin/provider/digitalocean.js +105 -105
  547. package/dist/plugin/provider/dynamic.js +2 -2
  548. package/dist/plugin/provider/github-copilot.js +107 -107
  549. package/dist/plugin/provider/gitlab.js +106 -106
  550. package/dist/plugin/provider/google-vertex.js +126 -122
  551. package/dist/plugin/provider/kilo.js +1 -1
  552. package/dist/plugin/provider/llmgateway.js +88 -88
  553. package/dist/plugin/provider/lmstudio.js +138 -134
  554. package/dist/plugin/provider/local.js +135 -131
  555. package/dist/plugin/provider/modal.js +104 -104
  556. package/dist/plugin/provider/neon.js +1 -1
  557. package/dist/plugin/provider/nvidia.js +1 -1
  558. package/dist/plugin/provider/ollama.js +138 -134
  559. package/dist/plugin/provider/openai-context-caps.js +102 -102
  560. package/dist/plugin/provider/openai.js +129 -125
  561. package/dist/plugin/provider/opencode.js +131 -128
  562. package/dist/plugin/provider/openrouter.js +103 -103
  563. package/dist/plugin/provider/poe.js +89 -89
  564. package/dist/plugin/provider/prompt-cache-key.js +1 -1
  565. package/dist/plugin/provider/sap-ai-core.js +103 -103
  566. package/dist/plugin/provider/sdk-factory.js +1 -1
  567. package/dist/plugin/provider/snowflake-cortex.js +128 -124
  568. package/dist/plugin/provider/vllm.js +138 -134
  569. package/dist/plugin/provider/xai.js +103 -103
  570. package/dist/plugin/provider/zenmux.js +1 -1
  571. package/dist/plugin/provider.js +179 -176
  572. package/dist/plugin/sdk.js +82 -82
  573. package/dist/plugin/service.js +3 -3
  574. package/dist/plugin/skill.js +148 -145
  575. package/dist/plugin/source-directory.js +1 -1
  576. package/dist/plugin/supervisor.js +367 -365
  577. package/dist/plugin/tool-input-repair.js +4 -4
  578. package/dist/plugin/update.js +2 -2
  579. package/dist/plugin/vcs/git.js +98 -98
  580. package/dist/plugin/vcs/hg.js +98 -98
  581. package/dist/plugin/verbosity.js +105 -105
  582. package/dist/plugin/warming.js +127 -123
  583. package/dist/plugin/websearch/exa.js +7 -7
  584. package/dist/plugin/websearch/firecrawl.js +8 -8
  585. package/dist/plugin/websearch/index.js +9 -9
  586. package/dist/plugin/websearch/mcp.js +6 -6
  587. package/dist/plugin/websearch/parallel.js +6 -6
  588. package/dist/plugin/websearch/tavily.js +4 -4
  589. package/dist/plugin/websearch/tinyfish.js +8 -8
  590. package/dist/plugin.js +239 -236
  591. package/dist/project/icon.js +5 -5
  592. package/dist/project/schema.js +2 -2
  593. package/dist/project/sql.js +4 -4
  594. package/dist/project.js +92 -92
  595. package/dist/provider.js +111 -111
  596. package/dist/pty/protocol.js +1 -1
  597. package/dist/pty/ticket.js +1 -1
  598. package/dist/pty.js +106 -106
  599. package/dist/reference/instructions.js +100 -100
  600. package/dist/reference.js +102 -102
  601. package/dist/repository-cache.js +92 -92
  602. package/dist/repository.js +3 -3
  603. package/dist/ripgrep/binary.js +2 -2
  604. package/dist/ripgrep.js +109 -109
  605. package/dist/rpc.js +98 -98
  606. package/dist/schedule/check.js +237 -233
  607. package/dist/schedule/sql.js +6 -6
  608. package/dist/schedule.js +251 -247
  609. package/dist/schema.js +1 -1
  610. package/dist/session/affinity.js +1 -1
  611. package/dist/session/background.js +1 -1
  612. package/dist/session/blob.js +128 -124
  613. package/dist/session/command.js +84 -84
  614. package/dist/session/compaction.js +165 -162
  615. package/dist/session/context.js +195 -192
  616. package/dist/session/diff.js +100 -100
  617. package/dist/session/environment.js +5 -5
  618. package/dist/session/error.js +5 -5
  619. package/dist/session/event.js +1 -1
  620. package/dist/session/execution/restart.js +239 -236
  621. package/dist/session/execution.js +161 -158
  622. package/dist/session/generate.js +197 -194
  623. package/dist/session/history.js +135 -131
  624. package/dist/session/inbox.js +146 -142
  625. package/dist/session/info.js +3 -3
  626. package/dist/session/instruction-entry.js +87 -87
  627. package/dist/session/instruction-state.js +8 -8
  628. package/dist/session/instructions.js +140 -136
  629. package/dist/session/message-updater.js +2 -2
  630. package/dist/session/message.js +1 -1
  631. package/dist/session/model-request.js +162 -159
  632. package/dist/session/model-transport.js +9 -9
  633. package/dist/session/move.js +163 -160
  634. package/dist/session/projector.js +142 -138
  635. package/dist/session/prompt.js +147 -144
  636. package/dist/session/recent-text.js +1 -1
  637. package/dist/session/revert.js +138 -134
  638. package/dist/session/run-coordinator.js +1 -1
  639. package/dist/session/runner/index.js +3 -3
  640. package/dist/session/runner/llm.js +244 -241
  641. package/dist/session/runner/max-steps.js +1 -1
  642. package/dist/session/runner/model.js +112 -112
  643. package/dist/session/runner/publish-llm-event.js +148 -145
  644. package/dist/session/runner/retry.js +5 -5
  645. package/dist/session/runner/step.js +159 -156
  646. package/dist/session/runner/to-llm-message.js +136 -132
  647. package/dist/session/schema.js +5 -5
  648. package/dist/session/session.js +177 -174
  649. package/dist/session/shell.js +143 -139
  650. package/dist/session/skill.js +146 -143
  651. package/dist/session/sql.js +5 -5
  652. package/dist/session/stats.js +85 -85
  653. package/dist/session/store.js +141 -137
  654. package/dist/session/stored.js +2 -2
  655. package/dist/session/subagent-completion.js +1 -1
  656. package/dist/session/subagent-job.js +226 -223
  657. package/dist/session/system-prompt.js +1 -1
  658. package/dist/session/title.js +193 -190
  659. package/dist/session/to-session-error.js +147 -144
  660. package/dist/session/transfer.js +237 -234
  661. package/dist/session/usage.js +1 -1
  662. package/dist/session.js +232 -229
  663. package/dist/shell/parse.js +6 -6
  664. package/dist/shell/result.js +1 -1
  665. package/dist/shell/scan.js +6 -2007
  666. package/dist/shell/select.js +15 -15
  667. package/dist/shell.js +145 -141
  668. package/dist/skill/discovery.js +6 -6
  669. package/dist/skill/instructions.js +150 -147
  670. package/dist/skill.js +155 -152
  671. package/dist/snapshot.js +105 -105
  672. package/dist/state.js +1 -1
  673. package/dist/tool/html-markdown.js +1 -1
  674. package/dist/tool/http-body.js +1 -1
  675. package/dist/tool/mcp.js +172 -169
  676. package/dist/tool/plugin/edit.js +163 -160
  677. package/dist/tool/plugin/file-diff.js +1 -1
  678. package/dist/tool/plugin/glob.js +167 -164
  679. package/dist/tool/plugin/grep.js +167 -164
  680. package/dist/tool/plugin/image-generate.js +228 -225
  681. package/dist/tool/plugin/mcp-resource.js +161 -158
  682. package/dist/tool/plugin/opencode.js +160 -157
  683. package/dist/tool/plugin/patch.js +157 -154
  684. package/dist/tool/plugin/question.js +145 -142
  685. package/dist/tool/plugin/read.js +168 -165
  686. package/dist/tool/plugin/schedule.js +243 -239
  687. package/dist/tool/plugin/shell.js +232 -228
  688. package/dist/tool/plugin/skill.js +156 -153
  689. package/dist/tool/plugin/subagent.js +225 -222
  690. package/dist/tool/plugin/todo.js +152 -149
  691. package/dist/tool/plugin/webfetch.js +156 -153
  692. package/dist/tool/plugin/websearch.js +154 -151
  693. package/dist/tool/plugin/write.js +165 -162
  694. package/dist/tool/read-filesystem.js +112 -112
  695. package/dist/tool/runtime.js +1 -1
  696. package/dist/tool-output.js +7 -7
  697. package/dist/tool.js +16 -16
  698. package/dist/types/codemode/tool.d.ts +39 -0
  699. package/dist/types/config/integration.d.ts +29 -7
  700. package/dist/types/config/managed.d.ts +10 -0
  701. package/dist/types/config/plugin/policy.d.ts +4 -1
  702. package/dist/types/managed-policy.d.ts +16 -2
  703. package/dist/types/schedule/check.d.ts +35 -4
  704. package/dist/types/schedule/sql.d.ts +3 -0
  705. package/dist/types/shell/parse.d.ts +2 -6
  706. package/dist/types/tool/plugin/schedule.d.ts +12 -0
  707. package/dist/types/tool/plugin/shell.d.ts +1 -2
  708. package/dist/types/tool.d.ts +14 -0
  709. package/dist/types/websearch.d.ts +2 -0
  710. package/dist/usage-limits.js +95 -95
  711. package/dist/util/error-summary.js +1 -1
  712. package/dist/util/git-executable.js +3 -3
  713. package/dist/util/lazy.js +1 -1
  714. package/dist/util/slug.js +1 -1
  715. package/dist/util/token.js +1 -1
  716. package/dist/util/which.js +1 -1
  717. package/dist/util/wildcard.js +3 -3
  718. package/dist/v1/config/agent.js +7 -7
  719. package/dist/v1/config/command.js +3 -3
  720. package/dist/v1/config/mcp.js +6 -6
  721. package/dist/v1/config/migrate.js +104 -104
  722. package/dist/v1/config/permission.js +3 -3
  723. package/dist/v1/config/plugin.js +1 -1
  724. package/dist/v1/config/provider-options.js +1 -1
  725. package/dist/v1/config/provider.js +4 -4
  726. package/dist/variant.js +105 -105
  727. package/dist/vcs/patch.js +1 -1
  728. package/dist/vcs.js +101 -101
  729. package/dist/voice.js +100 -100
  730. package/dist/websearch.js +94 -94
  731. package/dist/wellknown/plugin.js +86 -86
  732. package/dist/wellknown.js +89 -89
  733. package/dist/workspace/driver.js +5 -5
  734. package/dist/workspace/sql.js +1 -1
  735. package/dist/workspace.js +92 -92
  736. package/dist/worktree/directory.js +2 -2
  737. package/dist/worktree/git.js +11 -11
  738. package/dist/worktree/sql.js +5 -5
  739. package/dist/worktree/strategies.js +101 -101
  740. package/dist/worktree.js +108 -108
  741. package/package.json +8 -17
  742. package/dist/chunks/ripgrep-5w9dwxvh.js +0 -222
  743. package/dist/chunks/ripgrep-apk2hew3.js +0 -76
  744. package/dist/chunks/ripgrep-cgp1s624.js +0 -26
  745. package/dist/chunks/ripgrep-f38wrs86.js +0 -535
  746. package/dist/chunks/ripgrep-n3r3rt18.js +0 -18
  747. package/dist/chunks/ripgrep-n53x6sf3.js +0 -356
  748. package/dist/chunks/ripgrep-qraj6mtx.js +0 -257
  749. package/dist/chunks/ripgrep-x7c80rtj.js +0 -31
  750. package/dist/shell/parser-wasm.bun.js +0 -8
  751. package/dist/shell/parser-wasm.node.js +0 -11
  752. package/dist/shell/parser-wasm.workerd.js +0 -5
  753. package/dist/types/shell/parser-wasm.bun.d.ts +0 -5
  754. package/dist/types/shell/parser-wasm.node.d.ts +0 -5
  755. package/dist/types/shell/parser-wasm.workerd.d.ts +0 -5
  756. /package/dist/chunks/{ripgrep-0qkdqm5v.js → location-services-0qkdqm5v.js} +0 -0
  757. /package/dist/chunks/{ripgrep-0zkw76rk.js → location-services-0zkw76rk.js} +0 -0
  758. /package/dist/chunks/{ripgrep-17cy0kzp.js → location-services-17cy0kzp.js} +0 -0
  759. /package/dist/chunks/{ripgrep-1cnp2v09.js → location-services-1cnp2v09.js} +0 -0
  760. /package/dist/chunks/{ripgrep-1kah00gy.js → location-services-1kah00gy.js} +0 -0
  761. /package/dist/chunks/{ripgrep-24dcb14g.js → location-services-24dcb14g.js} +0 -0
  762. /package/dist/chunks/{ripgrep-2710q6r3.js → location-services-2710q6r3.js} +0 -0
  763. /package/dist/chunks/{ripgrep-2bv980vf.js → location-services-2bv980vf.js} +0 -0
  764. /package/dist/chunks/{ripgrep-2c3vjs8z.js → location-services-2c3vjs8z.js} +0 -0
  765. /package/dist/chunks/{ripgrep-359p4xyc.js → location-services-359p4xyc.js} +0 -0
  766. /package/dist/chunks/{ripgrep-3asan66x.js → location-services-3asan66x.js} +0 -0
  767. /package/dist/chunks/{ripgrep-3v8g72cx.js → location-services-3v8g72cx.js} +0 -0
  768. /package/dist/chunks/{ripgrep-3wcehsnq.js → location-services-3wcehsnq.js} +0 -0
  769. /package/dist/chunks/{ripgrep-43n2bw4t.js → location-services-43n2bw4t.js} +0 -0
  770. /package/dist/chunks/{ripgrep-4knz6hnm.js → location-services-4knz6hnm.js} +0 -0
  771. /package/dist/chunks/{ripgrep-4vcrnpx2.js → location-services-4vcrnpx2.js} +0 -0
  772. /package/dist/chunks/{ripgrep-4y7fprxs.js → location-services-4y7fprxs.js} +0 -0
  773. /package/dist/chunks/{ripgrep-53557ph1.js → location-services-53557ph1.js} +0 -0
  774. /package/dist/chunks/{ripgrep-550bvhaj.js → location-services-550bvhaj.js} +0 -0
  775. /package/dist/chunks/{ripgrep-5w3e23ze.js → location-services-5w3e23ze.js} +0 -0
  776. /package/dist/chunks/{ripgrep-6prwharc.js → location-services-6prwharc.js} +0 -0
  777. /package/dist/chunks/{ripgrep-6q2bdcd1.js → location-services-6q2bdcd1.js} +0 -0
  778. /package/dist/chunks/{ripgrep-7akdwqpd.js → location-services-7akdwqpd.js} +0 -0
  779. /package/dist/chunks/{ripgrep-7m9af43g.js → location-services-7m9af43g.js} +0 -0
  780. /package/dist/chunks/{ripgrep-7stb81gk.js → location-services-7stb81gk.js} +0 -0
  781. /package/dist/chunks/{ripgrep-822emrt2.js → location-services-822emrt2.js} +0 -0
  782. /package/dist/chunks/{ripgrep-84wd9syh.js → location-services-84wd9syh.js} +0 -0
  783. /package/dist/chunks/{ripgrep-88xbtdfr.js → location-services-88xbtdfr.js} +0 -0
  784. /package/dist/chunks/{ripgrep-8n3pysct.js → location-services-8n3pysct.js} +0 -0
  785. /package/dist/chunks/{ripgrep-8wj87zfr.js → location-services-8wj87zfr.js} +0 -0
  786. /package/dist/chunks/{ripgrep-9a4afbnw.js → location-services-9a4afbnw.js} +0 -0
  787. /package/dist/chunks/{ripgrep-9rqn6x4v.js → location-services-9rqn6x4v.js} +0 -0
  788. /package/dist/chunks/{ripgrep-a058387c.js → location-services-a058387c.js} +0 -0
  789. /package/dist/chunks/{ripgrep-a6k6eb26.js → location-services-a6k6eb26.js} +0 -0
  790. /package/dist/chunks/{ripgrep-af5trqkr.js → location-services-af5trqkr.js} +0 -0
  791. /package/dist/chunks/{ripgrep-afrmfg78.js → location-services-afrmfg78.js} +0 -0
  792. /package/dist/chunks/{ripgrep-aqzs7mqg.js → location-services-aqzs7mqg.js} +0 -0
  793. /package/dist/chunks/{ripgrep-atq7p7m5.js → location-services-atq7p7m5.js} +0 -0
  794. /package/dist/chunks/{ripgrep-beh6qq61.js → location-services-beh6qq61.js} +0 -0
  795. /package/dist/chunks/{ripgrep-bkyjaxrp.js → location-services-bkyjaxrp.js} +0 -0
  796. /package/dist/chunks/{ripgrep-bmr6ed5q.js → location-services-bmr6ed5q.js} +0 -0
  797. /package/dist/chunks/{ripgrep-cf4snx6d.js → location-services-cf4snx6d.js} +0 -0
  798. /package/dist/chunks/{ripgrep-cqv5kn06.js → location-services-cqv5kn06.js} +0 -0
  799. /package/dist/chunks/{ripgrep-cvy3z8tj.js → location-services-cvy3z8tj.js} +0 -0
  800. /package/dist/chunks/{ripgrep-d9fn303g.js → location-services-d9fn303g.js} +0 -0
  801. /package/dist/chunks/{ripgrep-d9jj8t3e.js → location-services-d9jj8t3e.js} +0 -0
  802. /package/dist/chunks/{ripgrep-dap0rakb.js → location-services-dap0rakb.js} +0 -0
  803. /package/dist/chunks/{ripgrep-df08tz66.js → location-services-df08tz66.js} +0 -0
  804. /package/dist/chunks/{ripgrep-dy18nga0.js → location-services-dy18nga0.js} +0 -0
  805. /package/dist/chunks/{ripgrep-e5kj55wp.js → location-services-e5kj55wp.js} +0 -0
  806. /package/dist/chunks/{ripgrep-e73j6tqm.js → location-services-e73j6tqm.js} +0 -0
  807. /package/dist/chunks/{ripgrep-ean2d8b5.js → location-services-ean2d8b5.js} +0 -0
  808. /package/dist/chunks/{ripgrep-ec1grn59.js → location-services-ec1grn59.js} +0 -0
  809. /package/dist/chunks/{ripgrep-eh3zwz77.js → location-services-eh3zwz77.js} +0 -0
  810. /package/dist/chunks/{ripgrep-emrn6kk6.js → location-services-emrn6kk6.js} +0 -0
  811. /package/dist/chunks/{ripgrep-f0mxakyp.js → location-services-f0mxakyp.js} +0 -0
  812. /package/dist/chunks/{ripgrep-f6n9ztr4.js → location-services-f6n9ztr4.js} +0 -0
  813. /package/dist/chunks/{ripgrep-faypxj3z.js → location-services-faypxj3z.js} +0 -0
  814. /package/dist/chunks/{ripgrep-fd410y7t.js → location-services-fd410y7t.js} +0 -0
  815. /package/dist/chunks/{ripgrep-fkpq3x5p.js → location-services-fkpq3x5p.js} +0 -0
  816. /package/dist/chunks/{ripgrep-g4wezp1m.js → location-services-g4wezp1m.js} +0 -0
  817. /package/dist/chunks/{ripgrep-g86h250q.js → location-services-g86h250q.js} +0 -0
  818. /package/dist/chunks/{ripgrep-gebd4c9n.js → location-services-gebd4c9n.js} +0 -0
  819. /package/dist/chunks/{ripgrep-gftt206x.js → location-services-gftt206x.js} +0 -0
  820. /package/dist/chunks/{ripgrep-hcxmzztb.js → location-services-hcxmzztb.js} +0 -0
  821. /package/dist/chunks/{ripgrep-hk9envan.js → location-services-hk9envan.js} +0 -0
  822. /package/dist/chunks/{ripgrep-j2ntwpah.js → location-services-j2ntwpah.js} +0 -0
  823. /package/dist/chunks/{ripgrep-j5zkgpj8.js → location-services-j5zkgpj8.js} +0 -0
  824. /package/dist/chunks/{ripgrep-jjkms2e6.js → location-services-jjkms2e6.js} +0 -0
  825. /package/dist/chunks/{ripgrep-jr7sbwjy.js → location-services-jr7sbwjy.js} +0 -0
  826. /package/dist/chunks/{ripgrep-jwfs4k6c.js → location-services-jwfs4k6c.js} +0 -0
  827. /package/dist/chunks/{ripgrep-jwr30sdr.js → location-services-jwr30sdr.js} +0 -0
  828. /package/dist/chunks/{ripgrep-jze0r7bz.js → location-services-jze0r7bz.js} +0 -0
  829. /package/dist/chunks/{ripgrep-jzg6c2d5.js → location-services-jzg6c2d5.js} +0 -0
  830. /package/dist/chunks/{ripgrep-m18g726c.js → location-services-m18g726c.js} +0 -0
  831. /package/dist/chunks/{ripgrep-mp448xyj.js → location-services-mp448xyj.js} +0 -0
  832. /package/dist/chunks/{ripgrep-msx8hqn2.js → location-services-msx8hqn2.js} +0 -0
  833. /package/dist/chunks/{ripgrep-n05xt0ee.js → location-services-n05xt0ee.js} +0 -0
  834. /package/dist/chunks/{ripgrep-n3j8tn72.js → location-services-n3j8tn72.js} +0 -0
  835. /package/dist/chunks/{ripgrep-ncqqe42p.js → location-services-ncqqe42p.js} +0 -0
  836. /package/dist/chunks/{ripgrep-nh4v3znn.js → location-services-nh4v3znn.js} +0 -0
  837. /package/dist/chunks/{ripgrep-njntx4h6.js → location-services-njntx4h6.js} +0 -0
  838. /package/dist/chunks/{ripgrep-p71gwv9c.js → location-services-p71gwv9c.js} +0 -0
  839. /package/dist/chunks/{ripgrep-q3sfg36h.js → location-services-q3sfg36h.js} +0 -0
  840. /package/dist/chunks/{ripgrep-q74kybfr.js → location-services-q74kybfr.js} +0 -0
  841. /package/dist/chunks/{ripgrep-qaymkmh1.js → location-services-qaymkmh1.js} +0 -0
  842. /package/dist/chunks/{ripgrep-qb87gjwd.js → location-services-qb87gjwd.js} +0 -0
  843. /package/dist/chunks/{ripgrep-qfa1cgps.js → location-services-qfa1cgps.js} +0 -0
  844. /package/dist/chunks/{ripgrep-qg3g05ea.js → location-services-qg3g05ea.js} +0 -0
  845. /package/dist/chunks/{ripgrep-qrg20bc0.js → location-services-qrg20bc0.js} +0 -0
  846. /package/dist/chunks/{ripgrep-rcb2kzg1.js → location-services-rcb2kzg1.js} +0 -0
  847. /package/dist/chunks/{ripgrep-sdp7kfr6.js → location-services-sdp7kfr6.js} +0 -0
  848. /package/dist/chunks/{ripgrep-ssg3fenm.js → location-services-ssg3fenm.js} +0 -0
  849. /package/dist/chunks/{ripgrep-stkk57rt.js → location-services-stkk57rt.js} +0 -0
  850. /package/dist/chunks/{ripgrep-t03h4f5z.js → location-services-t03h4f5z.js} +0 -0
  851. /package/dist/chunks/{ripgrep-ty7weeps.js → location-services-ty7weeps.js} +0 -0
  852. /package/dist/chunks/{ripgrep-ve7vex1e.js → location-services-ve7vex1e.js} +0 -0
  853. /package/dist/chunks/{ripgrep-w803qqfp.js → location-services-w803qqfp.js} +0 -0
  854. /package/dist/chunks/{ripgrep-wc3fc9cn.js → location-services-wc3fc9cn.js} +0 -0
  855. /package/dist/chunks/{ripgrep-wer8tq1h.js → location-services-wer8tq1h.js} +0 -0
  856. /package/dist/chunks/{ripgrep-wtztk69x.js → location-services-wtztk69x.js} +0 -0
  857. /package/dist/chunks/{ripgrep-x0ckcb58.js → location-services-x0ckcb58.js} +0 -0
  858. /package/dist/chunks/{ripgrep-x61499pn.js → location-services-x61499pn.js} +0 -0
  859. /package/dist/chunks/{ripgrep-y44na4kk.js → location-services-y44na4kk.js} +0 -0
  860. /package/dist/chunks/{ripgrep-y8f7s663.js → location-services-y8f7s663.js} +0 -0
  861. /package/dist/chunks/{ripgrep-ygaqb7jw.js → location-services-ygaqb7jw.js} +0 -0
  862. /package/dist/chunks/{ripgrep-z5v4ffb3.js → location-services-z5v4ffb3.js} +0 -0
  863. /package/dist/chunks/{ripgrep-z9919s4g.js → location-services-z9919s4g.js} +0 -0
@@ -0,0 +1,2050 @@
1
+ import {
2
+ __export
3
+ } from "./location-services-9rqn6x4v.js";
4
+
5
+ // src/shell/scan.ts
6
+ var exports_scan = {};
7
+ __export(exports_scan, {
8
+ ShellScan: () => exports_scan,
9
+ scan: () => scan4,
10
+ scanPowerShell: () => scanPowerShell2
11
+ });
12
+ var BASH_REDIRECTS = ["&>>", "&>", "<<<", "<<-", "<<", "<>", "<&", ">&", ">|", ">>", ">", "<"];
13
+ var BASH_LIST_OPERATORS = ["&&", "||", "|&"];
14
+ var ZSH_LIST_OPERATORS = ["&&", "||", "|&", "&!", "&|"];
15
+ var BASH_CASE_OPERATORS = [";;&", ";;", ";&", ";|", ...BASH_LIST_OPERATORS];
16
+ var ZSH_CASE_OPERATORS = [";;&", ";;", ";&", ";|", ...ZSH_LIST_OPERATORS];
17
+ var BASH_BINDING_BUILTINS = new Set([
18
+ "declare",
19
+ "typeset",
20
+ "local",
21
+ "export",
22
+ "readonly",
23
+ "private",
24
+ "unset",
25
+ "read",
26
+ "getln",
27
+ "vared",
28
+ "getopts",
29
+ "mapfile",
30
+ "readarray",
31
+ "compgen",
32
+ "zparseopts",
33
+ "zregexparse",
34
+ "zformat",
35
+ "zstyle",
36
+ "zstat",
37
+ "stat"
38
+ ]);
39
+ var BASH_ARITHMETIC_COMPARISONS = new Set(["-eq", "-ne", "-lt", "-le", "-gt", "-ge"]);
40
+ var BASH_EXPANSION_RE = /\$(?:\\.|\\\n)*[({]|`/;
41
+ var BASH_ESCAPE_RE = /\\(?:x[\da-fA-F]{1,2}|[0-7]{1,3}|u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})/;
42
+ var BASH_ASSIGNMENT_DECLARATIONS = new Set(["declare", "typeset", "export", "readonly", "local"]);
43
+ var BASH_DECLARATIONS = new Set([...BASH_ASSIGNMENT_DECLARATIONS, "unset", "unsetenv"]);
44
+ var BASH_PRECOMMANDS = new Set(["builtin", "command", "time", "coproc", "!"]);
45
+ var ZSH_PRECOMMANDS = new Set(["noglob", "nocorrect", "exec", "-"]);
46
+ var ZSH_ARITHMETIC_BUILTINS = new Set([
47
+ "integer",
48
+ "float",
49
+ "exit",
50
+ "return",
51
+ "shift",
52
+ "break",
53
+ "continue",
54
+ "bye",
55
+ "logout"
56
+ ]);
57
+ var BASH_NON_FUNCTION_KEYWORDS = new Set([
58
+ "if",
59
+ "for",
60
+ "select",
61
+ "case",
62
+ "then",
63
+ "elif",
64
+ "else",
65
+ "fi",
66
+ "do",
67
+ "done",
68
+ "in",
69
+ "esac"
70
+ ]);
71
+ var BASH_UNIT_STARTS = "\\$'\"`<>";
72
+ var MAX_INPUT_LENGTH = 64 * 1024;
73
+ var MAX_SUBSTITUTION_DEPTH = 32;
74
+ var TOKEN_RE = /[A-Za-z_][A-Za-z0-9_]*(?=(?:\\\n)*(?:[ \t\n;|&()<>]|$))/y;
75
+ var BRACE_CLOSE_AHEAD_RE = /(?:\\\n)*(?:[ \t\n;&|()<>]|$)/y;
76
+ var SPACE_CONTINUATION_AHEAD_RE = /(?:\\\n)*[ \t\n]/y;
77
+ var NEGATION_AHEAD_RE = /(?:\\\n)*[ \t\n(]/y;
78
+ var COPROC_AHEAD_RE = /coproc(?:[ \t]|\\\n)+(?:--(?:[ \t]|\\\n)+)?(?:[A-Za-z_][A-Za-z0-9_]*(?:[ \t]|\\\n)+)?(?=(?:!(?:[ \t]|\\\n)*)*(?:[{(]|\[\[(?:\\\n)*[ \t\n]|(?:if|while|until|for|select|case|repeat)\b))/y;
79
+ var TIME_AHEAD_RE = /time(?:[ \t]|\\\n)+(?:-p(?:[ \t]|\\\n)+)?(?:--(?:[ \t]|\\\n)+)?(?=(?:!(?:[ \t]|\\\n)*)*(?:[{(]|\[\[(?:\\\n)*[ \t\n]|(?:if|while|until|for|select|case|repeat)\b))/y;
80
+ var FUNCTION_HEAD_RE = /(function[ \t](?:[ \t]|\\\n)*)?([A-Za-z_][\w.:+@%-]*)?(?:[ \t]|\\\n)*(\([ \t]*\))?((?:[ \t\n]|\\\n|#[^\n]*\n)*)/y;
81
+ var FUNCTION_BODY_RE = /[{(]|\[\[(?=(?:\\\n)*[ \t\n])|(?:if|while|until|for|select|case|repeat)(?=(?:\\\n)*(?:[ \t\n(]|$))/y;
82
+ var DO_AHEAD_RE = /(?:[ \t\n;]|\\\n|#[^\n]*(?:\n|$))*(?:do(?=(?:\\\n)*(?:[ \t\n;{(]|$))|\{(?=(?:\\\n)*[ \t\n]))/y;
83
+ var NOFORK_OPEN_RE = /\$\{(?:\\\n)*(?:[ \t\n]|\|)/y;
84
+ var ZSH_SAFE_FLAGS_RE = /\$\{\((?:[@AaBbCcDEfFikLMmNnOopPqStUuVvWwXZz0-]|q[-+]?|[js]([^({[<\\])(?:(?!\1)[^)])*\1)*\)/y;
85
+ var ZSH_QUOTED_FLAG_ARG_RE = /[js]([^({[<\\])(?:(?!\1)[^)])*\1/g;
86
+ var ZSH_GLOB_MODIFIER_RE = /(?:[\^=~#+]|\\\n)*~/y;
87
+ var ZSH_GLOB_QUALIFIER_RE = /\((?:[/F.@=*rwxAIERWsStUG^MTNDn-]|[oO][nLlamcdN]|[amc][Mwhmsd]?[-+]?\d+|L[kKmMpPgGtT]?[-+]?\d+|[lY][-+]?\d+|\[[-+]?\d+(?:,[-+]?\d+)?\]|,)+\)(?=(?:\\\n)*(?:[ \t\n;&|<>)]|$))/y;
88
+ var ZSH_SUBSCRIPT_RE = /\$(?:[\^=+~#]|\\\n)*(?:[A-Za-z_](?:[A-Za-z0-9_]|\\\n)*|[@*#?$!0-9-])(?:\\\n)*\[/y;
89
+ var LINE_CONTINUATION_RE = /(?:\\\n)*/y;
90
+ var PARAMETER_PREFIX_RE = /(?:\\\n)*(?:\([^)]*\))?(?:[!#^=+~]|\\\n)*/y;
91
+ var PARAMETER_NAME_RE = /(?:[A-Za-z_](?:[A-Za-z0-9_]|\\\n)*|\d(?:\d|\\\n)*|[@*#?$!-])(?:\\\n)*/y;
92
+ var PARAMETER_PROMPT_RE = /@(?:\\\n)*[EP](?:\\\n)*\}/y;
93
+ var BASH_ANSI_ESCAPES = {
94
+ a: "\x07",
95
+ b: "\b",
96
+ e: "\x1B",
97
+ E: "\x1B",
98
+ f: "\f",
99
+ n: `
100
+ `,
101
+ r: "\r",
102
+ t: "\t",
103
+ v: "\v",
104
+ "\\": "\\",
105
+ "'": "'",
106
+ '"': '"',
107
+ "?": "?"
108
+ };
109
+ function scan4(input, dialect = "posix") {
110
+ if (input.length > MAX_INPUT_LENGTH)
111
+ return { kind: "opaque", reason: "invalid-structure" };
112
+ const context = { remaining: MAX_INPUT_LENGTH * MAX_SUBSTITUTION_DEPTH, dialect };
113
+ const result = scanBash(input, 0, 0, context);
114
+ if (result.kind === "opaque")
115
+ return result;
116
+ if (context.boundDollar && context.boundOpen && (context.evalSink || (context.boundBracket || context.sinkBracket) && context.variableSink))
117
+ return { kind: "opaque", reason: "dynamic-execution" };
118
+ return { kind: "scanned", commands: result.commands };
119
+ }
120
+ function bashStatement(state) {
121
+ const structure = state.structures.at(-1);
122
+ if (structure)
123
+ structure.count++;
124
+ }
125
+ function bashInHeader(state) {
126
+ const phase = state.structures.at(-1)?.phase;
127
+ return phase === "header" || phase === "pattern" || phase === "do";
128
+ }
129
+ function atCommandStart(state) {
130
+ return !state.words.length && !state.hasRedirect && !state.compoundEnd && !bashInHeader(state);
131
+ }
132
+ function pending(state) {
133
+ return state.wordStarted || state.words.length > 0 || state.hasRedirect || state.compoundEnd;
134
+ }
135
+ function endBashList(state) {
136
+ if (pending(state))
137
+ finishBashCommand(state, false, true);
138
+ return !state.dangling;
139
+ }
140
+ function closeBashList(state, end) {
141
+ if (!endBashList(state))
142
+ return { kind: "opaque", reason: "invalid-structure" };
143
+ if (state.invalid)
144
+ return { kind: "opaque", reason: state.invalid };
145
+ if (state.structures.length)
146
+ return { kind: "opaque", reason: "compound-command" };
147
+ return { kind: "scanned", commands: state.commands, end };
148
+ }
149
+ function finishBashWord(state) {
150
+ if (!state.wordStarted)
151
+ return;
152
+ if (/PS4/.test(state.word))
153
+ state.context.evalSink = true;
154
+ const evaluation = bashWordEvaluation(state);
155
+ if (state.context.dialect !== "bash" && (/(?:READ)?NULLCMD/.test(state.word) || (state.assignmentWord || evaluation === "binding") && /^(?:-[A-Za-z]*v)?(?:(?:dis_)?(?:functions|[gs]?aliases)|options|commands)(?:\+?=|\[|$)/.test(state.word)))
156
+ state.invalid ??= "dynamic-execution";
157
+ if (evaluation && bashEvaluatesExpansion(state, evaluation, state.context))
158
+ state.invalid ??= "dynamic-execution";
159
+ if (state.word !== state.literal && state.commandWordIndex >= 0) {
160
+ const builtin = state.words[bashBuiltinIndex(state)];
161
+ if (builtin === "declare" || builtin === "typeset" || builtin === "local")
162
+ state.context.evalSink = true;
163
+ }
164
+ if (state.outer)
165
+ state.outer.output += ` ${state.literal} ${state.output}`;
166
+ const structure = state.structures.at(-1);
167
+ const repeatHeader = structure?.kind === "repeat" && structure.phase === "header";
168
+ if (!state.redirectTarget && repeatHeader)
169
+ structure.phase = "do";
170
+ if (!state.redirectTarget && !repeatHeader) {
171
+ if (!state.assignmentWord && state.commandWordIndex < 0)
172
+ state.commandWordIndex = state.words.length;
173
+ state.commandStart ??= state.wordStart;
174
+ state.words.push(state.word);
175
+ state.rawWords.push(state.input.slice(state.wordStart, state.wordEnd));
176
+ state.commandEnd = state.wordEnd;
177
+ }
178
+ if (state.hereString && state.resourceEnd === undefined)
179
+ state.commandEnd = state.wordEnd;
180
+ state.redirectTarget = false;
181
+ state.hereString = false;
182
+ state.word = "";
183
+ state.literal = "";
184
+ state.output = "";
185
+ state.wordStarted = false;
186
+ state.assignmentWord = false;
187
+ state.assignmentHeadUnsafe = false;
188
+ }
189
+ function bashWordEvaluation(state) {
190
+ if (state.redirectTarget)
191
+ return state.hereString ? "deferred" : undefined;
192
+ const structure = state.structures.at(-1);
193
+ if (structure?.kind === "repeat" && structure.phase === "header")
194
+ return "arithmetic";
195
+ if (structure?.kind === "for" && structure.phase === "header" && structure.sawIn)
196
+ return "deferred";
197
+ if (state.commandWordIndex < 0)
198
+ return state.assignmentWord ? "deferred" : undefined;
199
+ const name = bashBuiltinIndex(state);
200
+ const command = state.words[name];
201
+ if (command === undefined)
202
+ return;
203
+ if (command === "let" || state.context.dialect !== "bash" && ZSH_ARITHMETIC_BUILTINS.has(command))
204
+ return "arithmetic";
205
+ if (command === "set")
206
+ return state.words.slice(name + 1).some((word) => /^[-+][A-Za-z0-9]*A/.test(word)) ? "binding" : "deferred";
207
+ if (BASH_BINDING_BUILTINS.has(command)) {
208
+ const options = state.words.slice(name + 1);
209
+ if (options.some((word) => word.startsWith("-") && /[EFin]/.test(word)))
210
+ return "arithmetic";
211
+ if (state.assignmentWord && BASH_ASSIGNMENT_DECLARATIONS.has(command) && options.every((word) => !word.startsWith("-")) && (command === "export" || command === "readonly" || state.context.dialect === "zsh" || !/\+?=(?:\(|[$`])/.test(state.word)))
212
+ return "deferred";
213
+ return "binding";
214
+ }
215
+ if (command === "printf" || command === "print") {
216
+ const options = [...state.words.slice(name + 1), state.word];
217
+ const flag = command === "print" ? /^-[A-Za-z]*v/ : /^-v/;
218
+ return options.some((word) => flag.test(word)) ? "binding" : undefined;
219
+ }
220
+ if (command === "wait")
221
+ return /^-[nf]*p/.test(state.word) || /^-[nf]*p$/.test(state.words.at(-1) ?? "") ? "binding" : undefined;
222
+ if (command === "test" || command === "[") {
223
+ if (state.words.at(-1) === "-v")
224
+ return "binding";
225
+ if (state.context.dialect !== "bash" && state.words.at(-1) === "-t")
226
+ return "arithmetic";
227
+ }
228
+ return;
229
+ }
230
+ function bashBuiltinIndex(state) {
231
+ let name = state.commandWordIndex;
232
+ while (BASH_PRECOMMANDS.has(state.words[name] ?? "") || state.context.dialect !== "bash" && ZSH_PRECOMMANDS.has(state.words[name] ?? "")) {
233
+ const precommand = state.words[name++];
234
+ while (precommand !== "-" && state.words[name]?.startsWith("-")) {
235
+ if (precommand === "exec" && /^-[cl]*a$/.test(state.words[name]))
236
+ name++;
237
+ name++;
238
+ }
239
+ }
240
+ return name;
241
+ }
242
+ function finishBashCommand(state, boundary = false, newline = false) {
243
+ finishBashWord(state);
244
+ if (state.redirectTarget)
245
+ state.invalid ??= "invalid-redirect";
246
+ state.redirectTarget = false;
247
+ if (state.compoundEnd && state.words.length > 0)
248
+ state.invalid ??= "invalid-structure";
249
+ const name = state.commandWordIndex;
250
+ const inHeader = bashInHeader(state);
251
+ if (name >= 0 && !state.words[name])
252
+ state.invalid ??= "invalid-structure";
253
+ if (name >= 0 && !inHeader) {
254
+ const resource = state.input.slice(state.commandStart, state.resourceEnd ?? state.wordEnd).replace(/^[ \t\n]+|[ \t\n]+$/g, "");
255
+ const command = {
256
+ resource,
257
+ words: state.words.slice(name),
258
+ rawWords: state.rawWords.slice(name),
259
+ ...name === 0 && BASH_DECLARATIONS.has(state.rawWords[0]) && resource.startsWith(state.rawWords[0]) ? { declaration: true } : {},
260
+ ...state.redirectWordCount !== undefined && state.redirectWordCount < state.words.length ? { redirectWordCount: state.redirectWordCount - name } : {}
261
+ };
262
+ state.commands.push(command);
263
+ const builtin = bashBuiltinIndex(state);
264
+ const builtinName = state.words[builtin];
265
+ const builtinArgs = state.words.slice(builtin + 1);
266
+ if (builtinName === "eval")
267
+ state.context.evalSink = true;
268
+ if (builtinName === "set" && builtinArgs.some((word) => /^-[A-Za-z0-9]*k/.test(word) || word === "keyword"))
269
+ state.invalid ??= "dynamic-execution";
270
+ if (builtinName === "alias" && builtinArgs.some((word) => word.includes("=")))
271
+ state.invalid ??= "dynamic-execution";
272
+ if (state.context.dialect !== "bash" && (builtinName === "emulate" || (builtinName === "setopt" || builtinName === "unsetopt" || builtinName === "set" && builtinArgs.some((word) => /^[-+][A-Za-z0-9]*o/.test(word))) && builtinArgs.some((word) => /^-[A-Za-z0-9]*m/.test(word) || /^(?:no)?(?:globsubst|kshglob|promptsubst|promptvars|aliases)$/.test(word.replace(/^[-+][A-Za-z0-9]*?o/i, "").toLowerCase().replace(/[_-]/g, "")))))
273
+ state.invalid ??= "dynamic-execution";
274
+ if (state.context.dialect !== "zsh" && builtinName === "compgen" && builtinArgs.some((word) => word.startsWith("-") && /[CF]/.test(word)))
275
+ state.invalid ??= "dynamic-execution";
276
+ if (BASH_BINDING_BUILTINS.has(builtinName ?? "")) {
277
+ for (const heredoc of state.heredocs)
278
+ heredoc.binding ??= true;
279
+ }
280
+ for (const heredoc of state.heredocs) {
281
+ if (heredoc.owned)
282
+ continue;
283
+ heredoc.owned = true;
284
+ if (newline && state.resourceEnd === undefined) {
285
+ heredoc.command = command;
286
+ heredoc.start = state.commandStart;
287
+ }
288
+ }
289
+ }
290
+ for (const heredoc of state.heredocs)
291
+ heredoc.owned = true;
292
+ if (boundary && !state.words.length && !state.hasRedirect && !state.compoundEnd && !inHeader)
293
+ state.invalid ??= "invalid-structure";
294
+ if (state.words.length > (state.ampersandRedirectWords ?? Infinity))
295
+ state.invalid ??= "invalid-redirect";
296
+ state.commands.push(...state.nestedCommands.splice(0));
297
+ if (!inHeader && (state.words.length > 0 || state.hasRedirect))
298
+ bashStatement(state);
299
+ state.words.length = 0;
300
+ state.rawWords.length = 0;
301
+ state.commandWordIndex = -1;
302
+ state.commandStart = undefined;
303
+ state.hasRedirect = false;
304
+ state.resourceEnd = undefined;
305
+ state.redirectWordCount = undefined;
306
+ state.ampersandRedirectWords = undefined;
307
+ state.compoundEnd = false;
308
+ state.dangling = false;
309
+ }
310
+ function scanBash(input, start, depth, context, close, heredocs, outer) {
311
+ if (depth > MAX_SUBSTITUTION_DEPTH || context.remaining < 0)
312
+ return { kind: "opaque", reason: "invalid-structure" };
313
+ const state = {
314
+ input,
315
+ context,
316
+ commands: [],
317
+ nestedCommands: [],
318
+ words: [],
319
+ rawWords: [],
320
+ heredocs: heredocs ?? [],
321
+ structures: [],
322
+ word: "",
323
+ literal: "",
324
+ output: "",
325
+ wordStarted: false,
326
+ wordStart: start,
327
+ wordEnd: start,
328
+ commandStart: undefined,
329
+ commandEnd: start,
330
+ resourceEnd: undefined,
331
+ redirectWordCount: undefined,
332
+ ampersandRedirectWords: undefined,
333
+ commandWordIndex: -1,
334
+ assignmentWord: false,
335
+ assignmentHeadUnsafe: false,
336
+ invalid: undefined,
337
+ redirectTarget: false,
338
+ hereString: false,
339
+ hasRedirect: false,
340
+ compoundEnd: false,
341
+ dangling: false,
342
+ outer
343
+ };
344
+ for (let index = start;index < input.length; index++) {
345
+ if (--context.remaining < 0)
346
+ return { kind: "opaque", reason: "invalid-structure" };
347
+ const char = input[index];
348
+ if (char === "\\" && input[index + 1] === `
349
+ `) {
350
+ index++;
351
+ continue;
352
+ }
353
+ if (!state.wordStarted) {
354
+ state.wordStart = index;
355
+ if (char === " " || char === "\t")
356
+ continue;
357
+ if (char === "}" && state.words.length === 0 && !state.redirectTarget && (close === "}" || close === "nofork") && state.structures.length === 0 && (heredocs !== undefined || state.heredocs.length === 0) && (close === "nofork" || (BRACE_CLOSE_AHEAD_RE.lastIndex = index + 1, BRACE_CLOSE_AHEAD_RE.test(input))))
358
+ return closeBashList(state, index);
359
+ if (char === "}")
360
+ return { kind: "opaque", reason: state.structures.length ? "compound-command" : "invalid-structure" };
361
+ const step = scanBashCommandStart(state, index, depth, context);
362
+ if (typeof step === "object")
363
+ return step;
364
+ if (step !== undefined) {
365
+ index = step;
366
+ continue;
367
+ }
368
+ }
369
+ if (char === "\\" && index + 1 >= input.length)
370
+ return { kind: "opaque", reason: "unterminated-escape" };
371
+ if (!state.assignmentWord && (`'"\\`.includes(char) || char === "$" && (input[index + 1] === "'" || input[index + 1] === '"')))
372
+ state.assignmentHeadUnsafe = true;
373
+ const inCasePattern = state.structures.at(-1)?.phase === "pattern";
374
+ const array = (char === "=" || char === "(") && state.assignmentWord && state.word.length > 1 && state.word.endsWith("=") && !state.word.endsWith("==") && (state.commandWordIndex < 0 || BASH_ASSIGNMENT_DECLARATIONS.has(state.rawWords[state.commandWordIndex]));
375
+ if (char === "=" && (!state.wordStarted || array) && input[index + 1] === "(") {
376
+ const end = scanBashNested(input, index + 2, depth, context, state.nestedCommands, ")");
377
+ if (typeof end === "object")
378
+ return end;
379
+ state.wordStarted = true;
380
+ state.word += input.slice(index, end + 1);
381
+ index = end;
382
+ state.wordEnd = index + 1;
383
+ continue;
384
+ }
385
+ const unit = BASH_UNIT_STARTS.includes(char) ? scanBashUnit(input, index, depth, context, state.nestedCommands, "word", !state.assignmentWord && state.commandWordIndex >= 0 && !BASH_DECLARATIONS.has(state.rawWords[0]), state) : undefined;
386
+ if (typeof unit === "object")
387
+ return unit;
388
+ if (unit !== undefined) {
389
+ state.wordStarted = true;
390
+ index = unit;
391
+ state.wordEnd = index + 1;
392
+ continue;
393
+ }
394
+ if (char === "[" && !inCasePattern && !state.assignmentWord && !state.assignmentHeadUnsafe && state.commandWordIndex < 0 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(state.word)) {
395
+ const subscript = [];
396
+ const end = scanBashSubscript(input, index + 1, depth, context, subscript, BASH_SPANS.assignmentSubscript);
397
+ if (typeof end === "object")
398
+ return end;
399
+ const assign = bashOperator(input, end + 1, ["+=", "="]);
400
+ if (typeof assign === "object")
401
+ return assign;
402
+ if (assign) {
403
+ if (context.dialect === "posix" && /[$`]/.test(input.slice(index + 1, end)))
404
+ return { kind: "opaque", reason: "invalid-structure" };
405
+ state.nestedCommands.push(...subscript);
406
+ state.assignmentWord = true;
407
+ state.word += input.slice(index, end + 1);
408
+ index = end;
409
+ state.wordEnd = index + 1;
410
+ continue;
411
+ }
412
+ }
413
+ if (char === "(" && (array || (inCasePattern || context.dialect === "bash") && /[?*+@!]$/.test(state.word))) {
414
+ const mode = array ? "array" : "pattern";
415
+ const end = scanBashArrayOrPattern(input, index, depth + 1, context, state.nestedCommands, mode);
416
+ if (typeof end === "object")
417
+ return end;
418
+ if (bashCrossesHeredoc(state, index, end))
419
+ return { kind: "opaque", reason: "heredoc" };
420
+ if (array && end + 1 < input.length && !`
421
+ ;&|<>)`.includes(input[end + 1]))
422
+ return { kind: "opaque", reason: "invalid-structure" };
423
+ state.wordStarted = true;
424
+ state.word += input.slice(index, end + 1);
425
+ index = end;
426
+ state.wordEnd = index + 1;
427
+ continue;
428
+ }
429
+ if (char === "#" && !state.wordStarted) {
430
+ const newline = input.indexOf(`
431
+ `, index);
432
+ if (newline === -1)
433
+ break;
434
+ index = newline - 1;
435
+ continue;
436
+ }
437
+ if (`<>&|;
438
+ `.includes(char)) {
439
+ const step = scanBashOperatorOrSeparator(state, index, depth, context);
440
+ if (typeof step === "object")
441
+ return step;
442
+ index = step;
443
+ continue;
444
+ }
445
+ if (inCasePattern && char === ")") {
446
+ finishBashWord(state);
447
+ index--;
448
+ continue;
449
+ }
450
+ if (char === ")") {
451
+ if (close !== ")" || state.structures.length > 0 || heredocs === undefined && state.heredocs.length > 0)
452
+ return { kind: "opaque", reason: "compound-command" };
453
+ return closeBashList(state, index);
454
+ }
455
+ if (char === "(" && context.dialect === "zsh" && state.wordStarted && !inCasePattern && (ZSH_GLOB_QUALIFIER_RE.lastIndex = index, ZSH_GLOB_QUALIFIER_RE.test(input))) {
456
+ const end = ZSH_GLOB_QUALIFIER_RE.lastIndex - 1;
457
+ bashAppend(state, input.slice(index, end + 1));
458
+ index = end;
459
+ state.wordEnd = index + 1;
460
+ continue;
461
+ }
462
+ if (char === "(")
463
+ return { kind: "opaque", reason: state.wordStarted ? "dynamic-execution" : "compound-command" };
464
+ if (/\s/.test(char) && !`
465
+ `.includes(char))
466
+ return { kind: "opaque", reason: "invalid-structure" };
467
+ if (char === " " || char === "\t") {
468
+ finishBashWord(state);
469
+ continue;
470
+ }
471
+ state.wordStarted = true;
472
+ if (char === "=" && !state.assignmentWord && !state.assignmentHeadUnsafe && /^[A-Za-z_][A-Za-z0-9_]*\+?$/.test(state.word))
473
+ state.assignmentWord = true;
474
+ bashAppend(state, char);
475
+ state.wordEnd = index + 1;
476
+ }
477
+ if (close)
478
+ return { kind: "opaque", reason: close === ")" ? "command-substitution" : "invalid-structure" };
479
+ if (state.heredocs.length)
480
+ return { kind: "opaque", reason: "heredoc" };
481
+ return closeBashList(state, input.length);
482
+ }
483
+ function scanBashOperatorOrSeparator(state, index, depth, context) {
484
+ const input = state.input;
485
+ const char = input[index];
486
+ const redirect = "<>&".includes(char) ? bashOperator(input, index, BASH_REDIRECTS) : undefined;
487
+ if (typeof redirect === "object")
488
+ return redirect;
489
+ const caseHead = state.structures.at(-1);
490
+ if (redirect && caseHead?.kind === "case" && caseHead.phase !== "body")
491
+ return { kind: "opaque", reason: "invalid-redirect" };
492
+ if (redirect) {
493
+ state.hasRedirect = true;
494
+ state.commandStart ??= state.wordStart;
495
+ if (state.redirectTarget)
496
+ state.invalid ??= "invalid-redirect";
497
+ const fdPrefix = state.wordStarted && !state.assignmentHeadUnsafe && /^(?:\d+|\{[A-Za-z_][A-Za-z0-9_]*\})$/.test(state.word);
498
+ if (fdPrefix) {
499
+ if (state.wordEnd < index)
500
+ state.commandEnd = state.wordEnd;
501
+ state.word = "";
502
+ state.literal = "";
503
+ state.output = "";
504
+ state.wordStarted = false;
505
+ }
506
+ if (!fdPrefix)
507
+ finishBashWord(state);
508
+ if (redirect.startsWith("&") && context.dialect === "posix")
509
+ state.ampersandRedirectWords ??= state.words.length;
510
+ if (state.redirectWordCount === undefined && state.commandWordIndex >= 0) {
511
+ state.redirectWordCount = state.words.length;
512
+ }
513
+ if (state.dangling && redirect !== "<<<" && state.commandWordIndex >= 0) {
514
+ state.resourceEnd ??= state.commandEnd;
515
+ }
516
+ if (redirect === "<<" || redirect === "<<-") {
517
+ const delimiter = bashHeredocDelimiter(input, index + redirect.length, redirect === "<<-");
518
+ if (!delimiter)
519
+ return { kind: "opaque", reason: "invalid-redirect" };
520
+ state.heredocs.push(delimiter);
521
+ state.wordEnd = delimiter.end + 1;
522
+ state.redirectTarget = false;
523
+ return delimiter.end;
524
+ }
525
+ state.redirectTarget = true;
526
+ state.hereString = redirect === "<<<";
527
+ return index + redirect.length - 1;
528
+ }
529
+ if (state.structures.at(-1)?.phase === "pattern" && char === "|") {
530
+ finishBashWord(state);
531
+ return index - 1;
532
+ }
533
+ const structure = state.structures.at(-1);
534
+ const caseBody = structure?.kind === "case" && structure.phase === "body";
535
+ const operators = context.dialect === "zsh" ? caseBody ? ZSH_CASE_OPERATORS : ZSH_LIST_OPERATORS : caseBody ? BASH_CASE_OPERATORS : BASH_LIST_OPERATORS;
536
+ const operator = bashOperator(input, index, operators);
537
+ if (typeof operator === "object")
538
+ return operator;
539
+ const separator = operator ?? char;
540
+ if (caseBody && separator.startsWith(";") && separator.length > 1) {
541
+ if (!endBashList(state))
542
+ return { kind: "opaque", reason: "invalid-structure" };
543
+ structure.phase = "pattern";
544
+ structure.patternStarted = false;
545
+ return index + separator.length - 1;
546
+ }
547
+ if (structure?.kind === "case" && (structure.phase === "header" || structure.phase === "pattern")) {
548
+ if (separator !== `
549
+ `)
550
+ return { kind: "opaque", reason: "compound-command" };
551
+ if (structure.phase === "pattern" && (state.wordStarted || state.words.length > 0))
552
+ return { kind: "opaque", reason: "compound-command" };
553
+ finishBashWord(state);
554
+ return readBashHeredocs(state, index, depth, context);
555
+ }
556
+ if ((structure?.kind === "for" || structure?.kind === "repeat") && (structure.phase === "header" || structure.phase === "do")) {
557
+ if (separator !== ";" && separator !== `
558
+ `)
559
+ return { kind: "opaque", reason: "compound-command" };
560
+ if (structure.phase === "header" && !structure.sawIn && !state.wordStarted && state.words.length === 0)
561
+ return { kind: "opaque", reason: "compound-command" };
562
+ }
563
+ if (separator === `
564
+ ` && !pending(state))
565
+ return readBashHeredocs(state, index, depth, context);
566
+ if (separator === ";" && context.dialect === "zsh" && !pending(state) && !state.dangling)
567
+ return index;
568
+ finishBashCommand(state, true, separator === `
569
+ `);
570
+ if (structure?.kind === "for" && structure.phase === "header")
571
+ structure.phase = "do";
572
+ state.dangling = !(separator === ";" || separator === `
573
+ ` || separator.startsWith("&") && separator !== "&&");
574
+ if (separator === `
575
+ ` && state.heredocs.length)
576
+ return index - 1;
577
+ return index + separator.length - 1;
578
+ }
579
+ function bashCommandKey(command) {
580
+ return JSON.stringify([command.resource, command.words]);
581
+ }
582
+ function readBashHeredocs(state, index, depth, context) {
583
+ let end = index;
584
+ for (const heredoc of state.heredocs.splice(0)) {
585
+ const body = bashHeredoc(state.input, end + 1, heredoc);
586
+ if (!body)
587
+ return { kind: "opaque", reason: "heredoc" };
588
+ if (heredoc.command)
589
+ heredoc.command.resource = state.input.slice(heredoc.start, body.end).trim();
590
+ const text = heredoc.quoted ? { word: body.source, literal: body.source, output: "" } : bashText();
591
+ if (!heredoc.quoted) {
592
+ const expansion = scanBashSpan(body.source, 0, depth, context, state.commands, BASH_SPANS.heredoc, true, text);
593
+ if (typeof expansion === "object")
594
+ return expansion;
595
+ }
596
+ if (heredoc.binding)
597
+ bashEvaluatesExpansion(text, "deferred", context);
598
+ end = body.end;
599
+ }
600
+ return end;
601
+ }
602
+ function bashCrossesHeredoc(state, start, end) {
603
+ return state.heredocs.length > 0 && state.input.slice(start, end).includes(`
604
+ `);
605
+ }
606
+ function scanBashCommandStart(state, index, depth, context) {
607
+ const input = state.input;
608
+ const char = input[index];
609
+ const structure = state.structures.at(-1);
610
+ if (structure?.phase === "pattern" && !structure.patternStarted && !state.words.length && char === "(") {
611
+ structure.patternStarted = true;
612
+ return index;
613
+ }
614
+ if (structure?.phase === "pattern" && char === "|") {
615
+ if (!state.words.length)
616
+ return { kind: "opaque", reason: "compound-command" };
617
+ finishBashWord(state);
618
+ structure.patternStarted = true;
619
+ return index;
620
+ }
621
+ if (structure?.phase === "pattern" && char === ")") {
622
+ if (!state.words.length)
623
+ return { kind: "opaque", reason: "compound-command" };
624
+ finishBashCommand(state);
625
+ structure.phase = "body";
626
+ structure.count = 0;
627
+ return index;
628
+ }
629
+ if (structure?.kind === "for" && structure.phase === "header" && char === "(" && input[index + 1] !== "(") {
630
+ const end = scanBashArrayOrPattern(input, index, depth + 1, context, state.nestedCommands, "array");
631
+ if (typeof end === "object")
632
+ return end;
633
+ if (bashCrossesHeredoc(state, index, end))
634
+ return { kind: "opaque", reason: "heredoc" };
635
+ finishBashCommand(state);
636
+ structure.phase = "do";
637
+ structure.parenthesized = true;
638
+ DO_AHEAD_RE.lastIndex = end + 1;
639
+ if (!DO_AHEAD_RE.test(input))
640
+ state.structures.pop();
641
+ return end;
642
+ }
643
+ if (structure?.kind === "repeat" && structure.phase === "do" && char !== `
644
+ ` && char !== "#" && char !== ";") {
645
+ TOKEN_RE.lastIndex = index;
646
+ if (TOKEN_RE.exec(input)?.[0] !== "do")
647
+ state.structures.pop();
648
+ }
649
+ const keywordStep = scanBashKeyword(state, index, depth, context);
650
+ if (keywordStep !== undefined)
651
+ return keywordStep;
652
+ if (structure?.kind === "for" && structure.phase === "do" && char !== `
653
+ ` && char !== "#" && char !== ";") {
654
+ SPACE_CONTINUATION_AHEAD_RE.lastIndex = index + 1;
655
+ if (char !== "{" || !SPACE_CONTINUATION_AHEAD_RE.test(input))
656
+ return { kind: "opaque", reason: "compound-command" };
657
+ state.structures.pop();
658
+ }
659
+ const atStart = atCommandStart(state);
660
+ const functionHead = atStart && char === "(" ? bashFunctionHeadLength(input, index) : 0;
661
+ if (functionHead)
662
+ return index + functionHead - 1;
663
+ if (atStart && char === "!") {
664
+ NEGATION_AHEAD_RE.lastIndex = index + 1;
665
+ if (NEGATION_AHEAD_RE.test(input))
666
+ return index;
667
+ }
668
+ const forHeader = structure?.kind === "for" && structure.phase === "header";
669
+ const compoundOpen = (atStart || forHeader) && "([".includes(char) ? bashOperator(input, index, ["((", "[["]) : undefined;
670
+ if (typeof compoundOpen === "object")
671
+ return compoundOpen;
672
+ if (compoundOpen === "((") {
673
+ if (forHeader && state.words.length > 0)
674
+ return { kind: "opaque", reason: "compound-command" };
675
+ const span = forHeader ? BASH_SPANS.forArithmetic : BASH_SPANS.arithmetic;
676
+ const end = scanBashArithmetic(input, index + 2, depth, context, state.commands, span);
677
+ if (typeof end === "number") {
678
+ if (bashCrossesHeredoc(state, index, end))
679
+ return { kind: "opaque", reason: "heredoc" };
680
+ if (!forHeader && context.dialect === "posix") {
681
+ const subshells = scanBash(input, index + 1, depth + 1, context, ")");
682
+ if (subshells.kind === "opaque")
683
+ return subshells;
684
+ if (subshells.end !== end)
685
+ return { kind: "opaque", reason: "compound-command" };
686
+ const seen = new Set(state.commands.map(bashCommandKey));
687
+ state.commands.push(...subshells.commands.filter((command) => !seen.has(bashCommandKey(command))));
688
+ }
689
+ if (forHeader) {
690
+ structure.phase = "do";
691
+ structure.sawIn = true;
692
+ }
693
+ if (!forHeader) {
694
+ bashStatement(state);
695
+ state.compoundEnd = true;
696
+ }
697
+ return end;
698
+ }
699
+ if (end)
700
+ return end;
701
+ if (forHeader)
702
+ return { kind: "opaque", reason: "invalid-structure" };
703
+ }
704
+ if (atStart && (char === "(" || char === "{" && (SPACE_CONTINUATION_AHEAD_RE.lastIndex = index + 1, SPACE_CONTINUATION_AHEAD_RE.test(input)))) {
705
+ const group = scanBash(input, index + 1, depth + 1, context, char === "{" ? "}" : ")", state.heredocs);
706
+ if (group.kind === "opaque")
707
+ return group;
708
+ if (!input.slice(index + 1, group.end).trim())
709
+ return { kind: "opaque", reason: "invalid-structure" };
710
+ state.commands.push(...group.commands);
711
+ bashStatement(state);
712
+ state.compoundEnd = true;
713
+ return group.end;
714
+ }
715
+ if (atStart && compoundOpen === "[[" && (SPACE_CONTINUATION_AHEAD_RE.lastIndex = index + 2, SPACE_CONTINUATION_AHEAD_RE.test(input))) {
716
+ const end = scanBashConditional(input, index + 2, depth, context, state.commands);
717
+ if (typeof end === "object")
718
+ return end;
719
+ if (bashCrossesHeredoc(state, index, end))
720
+ return { kind: "opaque", reason: "heredoc" };
721
+ bashStatement(state);
722
+ state.compoundEnd = true;
723
+ return end;
724
+ }
725
+ return;
726
+ }
727
+ function scanBashKeyword(state, index, depth, context) {
728
+ const input = state.input;
729
+ const char = input[index];
730
+ if (!(char >= "A" && char <= "Z" || char >= "a" && char <= "z" || char === "_"))
731
+ return;
732
+ const structure = state.structures.at(-1);
733
+ TOKEN_RE.lastIndex = index;
734
+ const token = TOKEN_RE.exec(input)?.[0];
735
+ const end = index + (token?.length ?? 0) - 1;
736
+ if (structure?.kind === "case" && structure.phase === "header" && token === "in") {
737
+ if (state.words.length !== 1 || state.hasRedirect)
738
+ return { kind: "opaque", reason: "compound-command" };
739
+ finishBashCommand(state);
740
+ structure.phase = "pattern";
741
+ structure.patternStarted = false;
742
+ return end;
743
+ }
744
+ if (structure?.kind === "for" && (structure.phase === "header" || structure.phase === "do") && !structure.sawIn && !structure.parenthesized && token === "in" && (structure.phase === "do" || state.words.length >= 1)) {
745
+ structure.sawIn = true;
746
+ structure.phase = "header";
747
+ return end;
748
+ }
749
+ if (structure?.phase === "pattern" && !structure.patternStarted && !state.words.length && token === "esac") {
750
+ state.structures.pop();
751
+ bashStatement(state);
752
+ state.compoundEnd = true;
753
+ return end;
754
+ }
755
+ if (structure?.kind === "for" && structure.phase === "header" && !structure.sawIn && state.words.length === 1 && !state.hasRedirect && token === "do") {
756
+ finishBashCommand(state);
757
+ structure.phase = "do";
758
+ }
759
+ const inHeader = bashInHeader(state);
760
+ if (token && ["then", "elif", "else", "fi", "do", "done", "esac"].includes(token) && !state.words.length && !state.redirectTarget && (!inHeader || token === "do" && structure?.phase === "do")) {
761
+ if (state.hasRedirect && context.dialect !== "zsh" || !endBashList(state) || !structure)
762
+ return { kind: "opaque", reason: "compound-command" };
763
+ if (token === "then") {
764
+ if (structure.kind !== "if" || structure.phase !== "condition" || !structure.count)
765
+ return { kind: "opaque", reason: "compound-command" };
766
+ structure.phase = "body";
767
+ structure.count = 0;
768
+ return end;
769
+ }
770
+ if (token === "elif" || token === "else") {
771
+ if (structure.kind !== "if" || structure.phase !== "body" || !structure.count || structure.sawElse)
772
+ return { kind: "opaque", reason: "compound-command" };
773
+ structure.phase = token === "elif" ? "condition" : "body";
774
+ structure.sawElse = token === "else";
775
+ structure.count = 0;
776
+ return end;
777
+ }
778
+ if (token === "do") {
779
+ if (!["for", "while", "until", "repeat"].includes(structure.kind) || !["condition", "do"].includes(structure.phase) || structure.kind !== "for" && structure.kind !== "repeat" && !structure.count)
780
+ return { kind: "opaque", reason: "compound-command" };
781
+ structure.phase = "body";
782
+ structure.count = 0;
783
+ return end;
784
+ }
785
+ if (token === "fi" && (structure.kind !== "if" || structure.phase !== "body" || !structure.count) || token === "done" && (!["for", "while", "until", "repeat"].includes(structure.kind) || structure.phase !== "body" || !structure.count) || token === "esac" && (structure.kind !== "case" || structure.phase === "header"))
786
+ return { kind: "opaque", reason: "compound-command" };
787
+ state.structures.pop();
788
+ bashStatement(state);
789
+ state.compoundEnd = true;
790
+ return end;
791
+ }
792
+ if (!atCommandStart(state))
793
+ return;
794
+ const definitionLength = bashFunctionHeadLength(input, index);
795
+ if (definitionLength > 0)
796
+ return index + definitionLength - 1;
797
+ if (token === "if" || token === "while" || token === "until" || token === "for" || token === "select" || token === "case" || token === "repeat" && context.dialect !== "bash") {
798
+ if (depth + state.structures.length >= MAX_SUBSTITUTION_DEPTH)
799
+ return { kind: "opaque", reason: "compound-command" };
800
+ state.structures.push({
801
+ kind: token === "select" ? "for" : token,
802
+ phase: ["for", "select", "case", "repeat"].includes(token) ? "header" : "condition",
803
+ count: 0
804
+ });
805
+ state.dangling = false;
806
+ return end;
807
+ }
808
+ if (token === "coproc") {
809
+ COPROC_AHEAD_RE.lastIndex = index;
810
+ const coprocMatch = COPROC_AHEAD_RE.exec(input)?.[0];
811
+ if (coprocMatch)
812
+ return index + coprocMatch.length - 1;
813
+ }
814
+ if (token === "time") {
815
+ TIME_AHEAD_RE.lastIndex = index;
816
+ const timeMatch = TIME_AHEAD_RE.exec(input)?.[0];
817
+ if (timeMatch)
818
+ return index + timeMatch.length - 1;
819
+ }
820
+ return;
821
+ }
822
+ function bashFunctionHeadLength(input, start) {
823
+ FUNCTION_HEAD_RE.lastIndex = start;
824
+ const head = FUNCTION_HEAD_RE.exec(input);
825
+ if (!head || (head[1] ? !head[2] : !head[3] || BASH_NON_FUNCTION_KEYWORDS.has(head[2] ?? "")))
826
+ return 0;
827
+ FUNCTION_BODY_RE.lastIndex = start + head[0].length;
828
+ return FUNCTION_BODY_RE.test(input) ? head[0].length - head[4].length : 0;
829
+ }
830
+ var BASH_SPANS = {
831
+ double: { close: '"', reject: "", mode: "quoted" },
832
+ heredoc: { reject: "", mode: "quoted" },
833
+ arithmetic: { open: "(", close: ")", reject: ";#}", mode: "arithmetic" },
834
+ forArithmetic: { open: "(", close: ")", reject: "#}", mode: "arithmetic" },
835
+ bracketArithmetic: { close: "]", reject: `;|&<>()[
836
+ '"\\#`, mode: "arithmetic" },
837
+ subscript: { open: "[", close: "]", reject: '"}', mode: "arithmetic" },
838
+ quotedSubscript: { open: "[", close: "]", reject: '"', mode: "quoted" },
839
+ assignmentSubscript: { open: "[", close: "]", reject: `
840
+ \r\v\f;&|<>()`, mode: "arithmetic" },
841
+ arithmeticQuote: { close: "'", reject: '()[];"}', mode: "quoted" },
842
+ arithmeticDouble: { close: '"', reject: "()[];}", mode: "quoted" },
843
+ parameterQuote: { close: "'", reject: '"}[]', mode: "quoted" }
844
+ };
845
+ function scanBashUnit(input, index, depth, context, commands, mode, allowBracket, text) {
846
+ const char = input[index];
847
+ const next = input[index + 1] ?? "\x00";
848
+ if (char === "\\") {
849
+ if (mode === "quoted" && !'$`"\\\n'.includes(next))
850
+ return;
851
+ if (text && next !== `
852
+ `)
853
+ bashAppend(text, input.slice(index + 1, index + 2));
854
+ return index + 1;
855
+ }
856
+ if (char === "$" && context.dialect !== "bash" && zshEvaluates(input, index))
857
+ return { kind: "opaque", reason: "dynamic-execution" };
858
+ if (char === "$" && context.dialect !== "bash" && (mode === "word" || mode === "quoted") && (ZSH_SUBSCRIPT_RE.lastIndex = index, ZSH_SUBSCRIPT_RE.test(input))) {
859
+ const bracket = ZSH_SUBSCRIPT_RE.lastIndex;
860
+ const subscript = bashText();
861
+ const span = mode === "quoted" ? BASH_SPANS.quotedSubscript : BASH_SPANS.subscript;
862
+ const end = scanBashSpan(input, bracket, depth, context, commands, span, false, subscript);
863
+ if (typeof end === "object")
864
+ return end;
865
+ context.sinkBracket = true;
866
+ if (bashEvaluatesExpansion(subscript, "arithmetic", context))
867
+ return { kind: "opaque", reason: "dynamic-execution" };
868
+ if (text)
869
+ text.word += `${input.slice(index, bracket)}${subscript.word}]`;
870
+ return end;
871
+ }
872
+ const opener = char === "$" ? bashOperator(input, index, ["$$", "$((", "$(", "${", "$[", "$'", '$"']) : mode === "word" && (char === "<" || char === ">") ? bashOperator(input, index, [`${char}(`]) : undefined;
873
+ if (typeof opener === "object")
874
+ return opener;
875
+ if (opener === "$$") {
876
+ LINE_CONTINUATION_RE.lastIndex = index + 2;
877
+ const quoteStart = LINE_CONTINUATION_RE.exec(input) ? LINE_CONTINUATION_RE.lastIndex : index + 2;
878
+ if (input[quoteStart] === "'") {
879
+ const nextQuote = input.indexOf("'", quoteStart + 1);
880
+ if (nextQuote < 0)
881
+ return { kind: "opaque", reason: "unterminated-quote" };
882
+ if (input.slice(quoteStart + 1, nextQuote).includes("\\") && input.includes("'", nextQuote + 1))
883
+ return { kind: "opaque", reason: "unterminated-quote" };
884
+ }
885
+ if (text)
886
+ text.word += "$$";
887
+ return index + 1;
888
+ }
889
+ if (mode === "word" && opener === "$'") {
890
+ const quote = bashAnsiQuote(input, index + 1);
891
+ if (!quote)
892
+ return { kind: "opaque", reason: "unterminated-quote" };
893
+ const firstQuote = input.indexOf("'", index + 2);
894
+ if (quote.end !== firstQuote && (context.dialect !== "bash" && index >= 2 && input[index - 2] === "$" || context.dialect === "posix" && (input.indexOf("'", firstQuote + 1) < quote.end || /[#"\n]|\\'/.test(input.slice(firstQuote + 1)))))
895
+ return { kind: "opaque", reason: "unterminated-quote" };
896
+ if (text)
897
+ bashAppend(text, quote.value);
898
+ return quote.end;
899
+ }
900
+ if (mode === "arithmetic" && opener === "$'") {
901
+ const quote = bashAnsiQuote(input, index + 1);
902
+ if (!quote || quote.end !== input.indexOf("'", index + 2) || /[()[\];"}]/.test(quote.value))
903
+ return { kind: "opaque", reason: "invalid-structure" };
904
+ if (text)
905
+ bashAppend(text, quote.value);
906
+ return scanBashSpan(input, index + 2, depth, context, commands, BASH_SPANS.arithmeticQuote, allowBracket, text);
907
+ }
908
+ if (mode === "word" && char === "'") {
909
+ const end = input.indexOf("'", index + 1);
910
+ if (end < 0)
911
+ return { kind: "opaque", reason: "unterminated-quote" };
912
+ if (text)
913
+ bashAppend(text, input.slice(index + 1, end));
914
+ return end;
915
+ }
916
+ if (mode === "arithmetic" && char === "'")
917
+ return scanBashSpan(input, index + 1, depth, context, commands, BASH_SPANS.arithmeticQuote, allowBracket, text);
918
+ if (mode === "word" && opener === '$"')
919
+ return scanBashSpan(input, index + 2, depth, context, commands, BASH_SPANS.double, allowBracket, text);
920
+ if (mode !== "quoted" && char === '"') {
921
+ const span = mode === "arithmetic" ? BASH_SPANS.arithmeticDouble : BASH_SPANS.double;
922
+ return scanBashSpan(input, index + 1, depth, context, commands, span, allowBracket, text);
923
+ }
924
+ const end = opener === "<(" || opener === ">(" ? scanBashNested(input, index + 2, depth, context, commands, ")") : opener && opener !== "$'" && opener !== '$"' || char === "`" ? scanBashDollarOrBacktick(input, index, depth, context, commands, mode !== "word", allowBracket, text) : undefined;
925
+ if (end === undefined && char === "$" && /[A-Za-z_0-9@*#?$!-]/.test(next)) {
926
+ if (text)
927
+ text.word += "$";
928
+ return index;
929
+ }
930
+ if (text && typeof end === "number")
931
+ text.word += input.slice(index, end + 1);
932
+ return end;
933
+ }
934
+ function zshEvaluates(input, index) {
935
+ let at = index + 1;
936
+ if (input.startsWith("{\\\n", at))
937
+ return true;
938
+ if (input[at] === "{" && input[at + 1] === "(") {
939
+ ZSH_SAFE_FLAGS_RE.lastIndex = index;
940
+ if (!ZSH_SAFE_FLAGS_RE.test(input))
941
+ return true;
942
+ at = ZSH_SAFE_FLAGS_RE.lastIndex;
943
+ }
944
+ if (input[at] === "{")
945
+ at++;
946
+ ZSH_GLOB_MODIFIER_RE.lastIndex = at;
947
+ return ZSH_GLOB_MODIFIER_RE.test(input);
948
+ }
949
+ function bashAppend(text, value) {
950
+ text.word += value;
951
+ text.literal += value;
952
+ }
953
+ function bashEvaluatesExpansion(text, evaluation, context) {
954
+ const combined = `${text.literal} ${text.output}`;
955
+ const hasExpansion = BASH_EXPANSION_RE.test(combined);
956
+ const hasEscape = BASH_ESCAPE_RE.test(combined);
957
+ if (hasExpansion || hasEscape || /[$`]/.test(text.literal))
958
+ context.boundDollar = true;
959
+ if (hasExpansion || hasEscape || /[({`]/.test(text.literal))
960
+ context.boundOpen = true;
961
+ if (hasExpansion || hasEscape || text.output.trim() || combined.includes("["))
962
+ context.boundBracket = true;
963
+ if (evaluation === "deferred")
964
+ return false;
965
+ if (text.word.includes("[") || combined.includes("["))
966
+ context.sinkBracket = true;
967
+ if (evaluation === "arithmetic" ? /[A-Za-z_]|(?:\$(?![?#!-]|\$(?!\[)))/.test(text.word) : text.word.includes("$") || combined.includes("["))
968
+ context.variableSink = true;
969
+ if (evaluation === "arithmetic")
970
+ return hasExpansion;
971
+ return combined.includes("[") && hasExpansion;
972
+ }
973
+ function bashText() {
974
+ return { word: "", literal: "", output: "" };
975
+ }
976
+ function scanBashSubscript(input, start, depth, context, commands, span = BASH_SPANS.subscript) {
977
+ const text = bashText();
978
+ const end = scanBashSpan(input, start, depth, context, commands, span, false, text);
979
+ if (typeof end === "number") {
980
+ context.sinkBracket = true;
981
+ if (bashEvaluatesExpansion(text, "arithmetic", context))
982
+ return { kind: "opaque", reason: "dynamic-execution" };
983
+ }
984
+ return end;
985
+ }
986
+ function scanBashSpan(input, start, depth, context, commands, span, allowBracket, text) {
987
+ let nesting = 0;
988
+ for (let index = start;index < input.length; index++) {
989
+ if (--context.remaining < 0)
990
+ return { kind: "opaque", reason: "invalid-structure" };
991
+ const char = input[index];
992
+ if (char === span.close && !nesting)
993
+ return index;
994
+ if (span.reject.includes(char) && !(char === "#" && /[\d$]/.test(input[index - 1] ?? "")))
995
+ return { kind: "opaque", reason: "invalid-structure" };
996
+ if (char === span.open && ++nesting + depth > MAX_SUBSTITUTION_DEPTH)
997
+ return { kind: "opaque", reason: "invalid-structure" };
998
+ if (char === span.close)
999
+ nesting--;
1000
+ const unit = char === span.open || char === span.close ? undefined : scanBashUnit(input, index, depth, context, commands, span.mode, allowBracket, text);
1001
+ if (typeof unit === "object")
1002
+ return unit;
1003
+ if (unit !== undefined)
1004
+ index = unit;
1005
+ else if (char === "\\" && (input[index + 1] === span.open || input[index + 1] === span.close)) {
1006
+ if (text)
1007
+ bashAppend(text, input.slice(index, index + 2));
1008
+ index++;
1009
+ } else if (text)
1010
+ bashAppend(text, char);
1011
+ }
1012
+ return span.close ? { kind: "opaque", reason: "unterminated-quote" } : input.length;
1013
+ }
1014
+ function scanBashNested(input, start, depth, context, commands, close, text) {
1015
+ const nested = scanBash(input, start, depth + 1, context, close, undefined, text);
1016
+ if (nested.kind === "opaque")
1017
+ return nested;
1018
+ commands.push(...nested.commands);
1019
+ return nested.end;
1020
+ }
1021
+ function bashOperator(input, index, operators) {
1022
+ let text = "";
1023
+ for (let cursor = index;text.length < 3 && cursor < input.length; cursor++) {
1024
+ if (input.startsWith("\\\n", cursor))
1025
+ cursor++;
1026
+ else
1027
+ text += input[cursor];
1028
+ }
1029
+ const operator = operators.find((candidate) => text.startsWith(candidate));
1030
+ if (operator && !input.startsWith(operator, index))
1031
+ return { kind: "opaque", reason: "invalid-structure" };
1032
+ return operator;
1033
+ }
1034
+ function scanBashDollarOrBacktick(input, start, depth, context, commands, quoted, allowBracket, text) {
1035
+ if (depth >= MAX_SUBSTITUTION_DEPTH)
1036
+ return { kind: "opaque", reason: "command-substitution" };
1037
+ if (input[start] === "`")
1038
+ return scanBashBacktick(input, start, depth + 1, context, commands, quoted, text);
1039
+ if (input.startsWith("$((", start)) {
1040
+ const end = scanBashArithmetic(input, start + 3, depth + 1, context, commands, BASH_SPANS.arithmetic);
1041
+ if (end !== undefined)
1042
+ return end;
1043
+ }
1044
+ if (input.startsWith("$(", start))
1045
+ return scanBashNested(input, start + 2, depth, context, commands, ")", text);
1046
+ NOFORK_OPEN_RE.lastIndex = start;
1047
+ const nofork = NOFORK_OPEN_RE.exec(input);
1048
+ if (nofork)
1049
+ return scanBashNested(input, start + nofork[0].length, depth, context, commands, "nofork", text);
1050
+ if (input.startsWith("${", start)) {
1051
+ const parameter = bashText();
1052
+ const end = scanBashParameter(input, start + 2, depth + 1, context, commands, quoted, parameter);
1053
+ const indirect = /^(?:\\\n)*!/.test(input.slice(start + 2)) || context.dialect !== "bash" && input[start + 2] === "(" && (ZSH_SAFE_FLAGS_RE.lastIndex = start, ZSH_SAFE_FLAGS_RE.test(input)) && input.slice(start + 3, ZSH_SAFE_FLAGS_RE.lastIndex - 1).replace(ZSH_QUOTED_FLAG_ARG_RE, "").includes("P");
1054
+ if (indirect) {
1055
+ context.variableSink = true;
1056
+ if (bashEvaluatesExpansion(parameter, "binding", context))
1057
+ return { kind: "opaque", reason: "dynamic-execution" };
1058
+ }
1059
+ if (text) {
1060
+ text.literal += parameter.literal;
1061
+ text.output += parameter.output;
1062
+ }
1063
+ return end;
1064
+ }
1065
+ if (!allowBracket && context.dialect === "posix")
1066
+ return { kind: "opaque", reason: "command-substitution" };
1067
+ const expression = bashText();
1068
+ const end = scanBashSpan(input, start + 2, depth + 1, context, commands, BASH_SPANS.bracketArithmetic, true, expression);
1069
+ if (typeof end === "number" && bashEvaluatesExpansion(expression, "arithmetic", context))
1070
+ return { kind: "opaque", reason: "dynamic-execution" };
1071
+ return end;
1072
+ }
1073
+ function scanBashArithmetic(input, start, depth, context, commands, span) {
1074
+ const arithmetic = [];
1075
+ const text = bashText();
1076
+ const end = scanBashSpan(input, start, depth, context, arithmetic, span, true, text);
1077
+ if (typeof end === "object")
1078
+ return { kind: "opaque", reason: "invalid-structure" };
1079
+ const close = bashOperator(input, end, ["))"]);
1080
+ if (typeof close === "object")
1081
+ return close;
1082
+ if (!close)
1083
+ return;
1084
+ if (bashEvaluatesExpansion(text, "arithmetic", context))
1085
+ return { kind: "opaque", reason: "dynamic-execution" };
1086
+ commands.push(...arithmetic);
1087
+ return end + 1;
1088
+ }
1089
+ function scanBashBacktick(input, start, depth, context, commands, quoted, text) {
1090
+ let source = "";
1091
+ for (let index = start + 1;index < input.length; index++) {
1092
+ if (--context.remaining < 0)
1093
+ return { kind: "opaque", reason: "invalid-structure" };
1094
+ if (input[index] === "`") {
1095
+ const inner = scanBash(source, 0, depth, context, undefined, undefined, text);
1096
+ if (inner.kind === "opaque")
1097
+ return { kind: "opaque", reason: "command-substitution" };
1098
+ commands.push(...inner.commands);
1099
+ return index;
1100
+ }
1101
+ const next = input[index + 1] ?? "\x00";
1102
+ if (input[index] === "\\" && ("$`\\\n".includes(next) || quoted && next === '"')) {
1103
+ index++;
1104
+ if (next !== `
1105
+ `)
1106
+ source += next;
1107
+ continue;
1108
+ }
1109
+ source += input[index];
1110
+ }
1111
+ return { kind: "opaque", reason: "command-substitution" };
1112
+ }
1113
+ function scanBashParameter(input, start, depth, context, commands, quoted, text) {
1114
+ PARAMETER_PREFIX_RE.lastIndex = start;
1115
+ const nameStart = PARAMETER_PREFIX_RE.exec(input) ? PARAMETER_PREFIX_RE.lastIndex : start;
1116
+ PARAMETER_NAME_RE.lastIndex = nameStart;
1117
+ let colon = PARAMETER_NAME_RE.test(input) ? PARAMETER_NAME_RE.lastIndex : -1;
1118
+ const name = colon > nameStart ? input.slice(nameStart, colon).replace(/\\\n/g, "") : "";
1119
+ if (context.dialect !== "bash" && (/^(?:READ)?NULLCMD$/.test(name) || /^(?:(?:dis_)?(?:functions|[gs]?aliases)|options|commands)$/.test(name) && "[=:".includes(input[colon] ?? "")))
1120
+ return { kind: "opaque", reason: "dynamic-execution" };
1121
+ if (name === "PS4")
1122
+ context.evalSink = true;
1123
+ let evaluation;
1124
+ let wordOffset = 0;
1125
+ let literalOffset = 0;
1126
+ for (let index = start;index < input.length; index++) {
1127
+ if (--context.remaining < 0)
1128
+ return { kind: "opaque", reason: "invalid-structure" };
1129
+ const char = input[index];
1130
+ if (char === "}") {
1131
+ if (evaluation && bashEvaluatesExpansion({ word: text.word.slice(wordOffset), literal: text.literal.slice(literalOffset), output: text.output }, evaluation, context))
1132
+ return { kind: "opaque", reason: "dynamic-execution" };
1133
+ return index;
1134
+ }
1135
+ if (index === colon && !evaluation) {
1136
+ if (char === ":" && !"-=?+".includes(input[index + 1] ?? ""))
1137
+ evaluation = "arithmetic";
1138
+ if (char === "=" || char === ":" && input[index + 1] === "=")
1139
+ evaluation = "deferred";
1140
+ if (evaluation) {
1141
+ wordOffset = text.word.length;
1142
+ literalOffset = text.literal.length;
1143
+ }
1144
+ }
1145
+ if (char === "@") {
1146
+ PARAMETER_PROMPT_RE.lastIndex = index;
1147
+ if (PARAMETER_PROMPT_RE.test(input))
1148
+ return { kind: "opaque", reason: "dynamic-execution" };
1149
+ }
1150
+ if (!quoted && context.dialect !== "bash" && char === "(" && index > start)
1151
+ return { kind: "opaque", reason: "dynamic-execution" };
1152
+ if (quoted && char === "'" && input[index - 1] === "$") {
1153
+ const ansi = bashAnsiQuote(input, index);
1154
+ if (!ansi)
1155
+ return { kind: "opaque", reason: "unterminated-quote" };
1156
+ text.literal += ansi.value;
1157
+ }
1158
+ const subscript = index === colon && char === "[";
1159
+ const unit = subscript ? scanBashSubscript(input, index + 1, depth, context, commands) : quoted && char === "'" ? scanBashSpan(input, index + 1, depth, context, commands, BASH_SPANS.parameterQuote, false, text) : quoted && char === '"' ? scanBashSpan(input, index + 1, depth, context, commands, BASH_SPANS.double, false, text) : scanBashUnit(input, index, depth, context, commands, quoted ? "quoted" : "word", false, text);
1160
+ if (typeof unit === "object")
1161
+ return unit;
1162
+ if (quoted && unit !== undefined && input.startsWith("$(", index) && input.slice(index, unit + 1).includes("}"))
1163
+ return { kind: "opaque", reason: "command-substitution" };
1164
+ if (subscript || index === nameStart && input.startsWith("${", index) && unit !== undefined) {
1165
+ LINE_CONTINUATION_RE.lastIndex = Number(unit) + 1;
1166
+ colon = LINE_CONTINUATION_RE.exec(input) ? LINE_CONTINUATION_RE.lastIndex : Number(unit) + 1;
1167
+ }
1168
+ if (unit !== undefined)
1169
+ index = unit;
1170
+ else
1171
+ bashAppend(text, char);
1172
+ }
1173
+ return { kind: "opaque", reason: "command-substitution" };
1174
+ }
1175
+ function scanBashConditional(input, start, depth, context, commands) {
1176
+ const words = [];
1177
+ let text = bashText();
1178
+ let wordStarted = false;
1179
+ let hasWord = false;
1180
+ let parenDepth = 0;
1181
+ let patternParenDepth = 0;
1182
+ const flushWord = () => {
1183
+ if (!hasWord)
1184
+ return;
1185
+ words.push(text);
1186
+ text = bashText();
1187
+ hasWord = false;
1188
+ };
1189
+ for (let index = start;index < input.length; index++) {
1190
+ if (--context.remaining < 0)
1191
+ return { kind: "opaque", reason: "invalid-structure" };
1192
+ const char = input[index];
1193
+ if (char === "\\" && input[index + 1] === `
1194
+ `) {
1195
+ index++;
1196
+ continue;
1197
+ }
1198
+ if (!wordStarted)
1199
+ flushWord();
1200
+ const close = !wordStarted && char === "]" ? bashOperator(input, index, ["]]"]) : undefined;
1201
+ if (typeof close === "object")
1202
+ return close;
1203
+ if (close) {
1204
+ BRACE_CLOSE_AHEAD_RE.lastIndex = index + 2;
1205
+ if (BRACE_CLOSE_AHEAD_RE.test(input)) {
1206
+ if (parenDepth !== 0)
1207
+ return { kind: "opaque", reason: "invalid-structure" };
1208
+ const evaluated = words.some((word, at) => words[at - 1]?.word === "-v" && bashEvaluatesExpansion(word, "binding", context) || (context.dialect !== "bash" && words[at - 1]?.word === "-t" || BASH_ARITHMETIC_COMPARISONS.has(words[at - 1]?.word ?? "") || BASH_ARITHMETIC_COMPARISONS.has(words[at + 1]?.word ?? "")) && bashEvaluatesExpansion(word, "arithmetic", context));
1209
+ if (evaluated)
1210
+ return { kind: "opaque", reason: "dynamic-execution" };
1211
+ return index + 1;
1212
+ }
1213
+ }
1214
+ if (!wordStarted && char === "#") {
1215
+ const newline = input.indexOf(`
1216
+ `, index);
1217
+ if (newline < 0)
1218
+ return { kind: "opaque", reason: "invalid-structure" };
1219
+ index = newline;
1220
+ continue;
1221
+ }
1222
+ if (char === " " || char === "\t" || char === `
1223
+ `) {
1224
+ if (!patternParenDepth)
1225
+ wordStarted = false;
1226
+ continue;
1227
+ }
1228
+ if (char === ";")
1229
+ return { kind: "opaque", reason: "invalid-structure" };
1230
+ if (char === "(" || char === ")") {
1231
+ if (char === ")" && parenDepth === 0)
1232
+ return { kind: "opaque", reason: "invalid-structure" };
1233
+ const inPattern = patternParenDepth > 0 || char === "(" && ["=", "==", "!=", "=~"].includes(words.at(-1)?.word ?? "");
1234
+ parenDepth += char === "(" ? 1 : -1;
1235
+ if (inPattern) {
1236
+ patternParenDepth += char === "(" ? 1 : -1;
1237
+ wordStarted = true;
1238
+ hasWord = true;
1239
+ bashAppend(text, char);
1240
+ continue;
1241
+ }
1242
+ flushWord();
1243
+ words.push({ word: char, literal: "", output: "" });
1244
+ wordStarted = false;
1245
+ continue;
1246
+ }
1247
+ const unit = scanBashUnit(input, index, depth, context, commands, "word", true, text);
1248
+ if (typeof unit === "object")
1249
+ return unit;
1250
+ if (unit !== undefined)
1251
+ index = unit;
1252
+ if (unit === undefined && !patternParenDepth && "&|<>".includes(char)) {
1253
+ flushWord();
1254
+ words.push({ word: char, literal: "", output: "" });
1255
+ wordStarted = false;
1256
+ continue;
1257
+ }
1258
+ wordStarted = true;
1259
+ hasWord = true;
1260
+ if (unit === undefined)
1261
+ bashAppend(text, char);
1262
+ }
1263
+ return { kind: "opaque", reason: "invalid-structure" };
1264
+ }
1265
+ function scanBashArrayOrPattern(input, start, depth, context, commands, mode) {
1266
+ if (depth > MAX_SUBSTITUTION_DEPTH)
1267
+ return { kind: "opaque", reason: "command-substitution" };
1268
+ const text = mode === "array" ? bashText() : undefined;
1269
+ let wordStarted = false;
1270
+ for (let index = start + 1;index < input.length; index++) {
1271
+ if (--context.remaining < 0)
1272
+ return { kind: "opaque", reason: "invalid-structure" };
1273
+ const char = input[index];
1274
+ if (char === "\\" && input[index + 1] === `
1275
+ `) {
1276
+ index++;
1277
+ continue;
1278
+ }
1279
+ if (text && (char === ")" || char === " " || char === "\t" || char === `
1280
+ `)) {
1281
+ bashEvaluatesExpansion(text, "deferred", context);
1282
+ text.literal = "";
1283
+ text.output = "";
1284
+ }
1285
+ if (char === ")")
1286
+ return index;
1287
+ if (mode === "array" && !wordStarted && char === "#") {
1288
+ const newline = input.indexOf(`
1289
+ `, index);
1290
+ if (newline < 0)
1291
+ return { kind: "opaque", reason: "command-substitution" };
1292
+ index = newline;
1293
+ continue;
1294
+ }
1295
+ if (char === " " || char === "\t" || mode === "array" && char === `
1296
+ `) {
1297
+ wordStarted = false;
1298
+ continue;
1299
+ }
1300
+ if (mode === "array" && wordStarted && char === "(" && context.dialect === "zsh" && (ZSH_GLOB_QUALIFIER_RE.lastIndex = index, ZSH_GLOB_QUALIFIER_RE.test(input))) {
1301
+ const end = ZSH_GLOB_QUALIFIER_RE.lastIndex - 1;
1302
+ if (text)
1303
+ text.literal += input.slice(index, end + 1);
1304
+ index = end;
1305
+ continue;
1306
+ }
1307
+ if (char === `
1308
+ ` || char === ";" || char === "&" || mode === "array" && "|(".includes(char))
1309
+ return { kind: "opaque", reason: "command-substitution" };
1310
+ wordStarted = true;
1311
+ const unit = mode === "array" && char === "=" && input[index + 1] === "(" ? scanBashNested(input, index + 2, depth, context, commands, ")") : char === "(" ? scanBashArrayOrPattern(input, index, depth + 1, context, commands, mode) : char === "[" ? scanBashSubscript(input, index + 1, depth, context, commands) : scanBashUnit(input, index, depth, context, commands, "word", false, text);
1312
+ if (typeof unit === "object")
1313
+ return unit;
1314
+ if (unit !== undefined)
1315
+ index = unit;
1316
+ else if (text)
1317
+ text.literal += char;
1318
+ }
1319
+ return { kind: "opaque", reason: "command-substitution" };
1320
+ }
1321
+ function bashAnsiQuote(input, start, allowUnicode = true) {
1322
+ let value = "";
1323
+ for (let index = start + 1;index < input.length; index++) {
1324
+ if (input[index] === "'")
1325
+ return { value, end: index };
1326
+ if (input[index] !== "\\") {
1327
+ value += input[index];
1328
+ continue;
1329
+ }
1330
+ const escaped = input[++index];
1331
+ if (escaped === undefined)
1332
+ return;
1333
+ if (escaped in BASH_ANSI_ESCAPES) {
1334
+ value += BASH_ANSI_ESCAPES[escaped];
1335
+ continue;
1336
+ }
1337
+ const digits = escaped === "x" ? /^[\da-fA-F]{1,2}/.exec(input.slice(index + 1, index + 3))?.[0] : allowUnicode && escaped === "u" ? /^[\da-fA-F]{1,4}/.exec(input.slice(index + 1, index + 5))?.[0] : allowUnicode && escaped === "U" ? /^[\da-fA-F]{1,8}/.exec(input.slice(index + 1, index + 9))?.[0] : /[0-7]/.test(escaped) ? /^[0-7]{1,3}/.exec(input.slice(index, index + 3))?.[0] : undefined;
1338
+ if (!digits)
1339
+ return;
1340
+ const octal = /[0-7]/.test(escaped);
1341
+ const point = parseInt(digits, octal ? 8 : 16);
1342
+ if (point === 0 || point > 1114111 || point >= 55296 && point <= 57343)
1343
+ return;
1344
+ value += String.fromCodePoint(point);
1345
+ index += digits.length - (octal ? 1 : 0);
1346
+ }
1347
+ }
1348
+ function bashHeredocDelimiter(input, start, tabs) {
1349
+ let delimiter = "";
1350
+ let dashDelimiter;
1351
+ let quoted = false;
1352
+ let quote;
1353
+ let end = start;
1354
+ let started = false;
1355
+ for (let index = start;index < input.length; index++) {
1356
+ const char = input[index];
1357
+ if (!started && /[ \t]/.test(char))
1358
+ continue;
1359
+ if (!started && char === "#")
1360
+ return;
1361
+ if (!quote && /[ \t\n;&|()<>]/.test(char))
1362
+ return started ? { delimiter, dashDelimiter, quoted, tabs, end } : undefined;
1363
+ if (!quote && char === "$" && input.startsWith("\\\n", index + 1))
1364
+ return;
1365
+ if (!quote && input.startsWith("$'", index)) {
1366
+ const literal = bashAnsiQuote(input, index + 1, false);
1367
+ if (!literal || literal.end !== input.indexOf("'", index + 2))
1368
+ return;
1369
+ dashDelimiter = `${dashDelimiter ?? delimiter}$${input.slice(index + 2, literal.end)}`;
1370
+ delimiter += literal.value;
1371
+ quoted = true;
1372
+ started = true;
1373
+ index = literal.end;
1374
+ end = index;
1375
+ continue;
1376
+ }
1377
+ if (!quote && input.startsWith('$"', index))
1378
+ return;
1379
+ if (char === quote) {
1380
+ quote = undefined;
1381
+ end = index;
1382
+ continue;
1383
+ }
1384
+ if (char === "\\" && quote !== "'") {
1385
+ const next = input[index + 1];
1386
+ if (next === undefined)
1387
+ return;
1388
+ if (next === `
1389
+ `) {
1390
+ index++;
1391
+ continue;
1392
+ }
1393
+ if (!quote || '$`"\\'.includes(next)) {
1394
+ quoted = true;
1395
+ started = true;
1396
+ const escaped = input[++index];
1397
+ if (dashDelimiter !== undefined)
1398
+ dashDelimiter += escaped;
1399
+ delimiter += escaped;
1400
+ end = index;
1401
+ continue;
1402
+ }
1403
+ }
1404
+ if (!quote && (char === "'" || char === '"')) {
1405
+ quote = char;
1406
+ quoted = true;
1407
+ started = true;
1408
+ end = index;
1409
+ continue;
1410
+ }
1411
+ if (dashDelimiter !== undefined)
1412
+ dashDelimiter += char;
1413
+ delimiter += char;
1414
+ started = true;
1415
+ end = index;
1416
+ }
1417
+ if (started && !quote)
1418
+ return { delimiter, dashDelimiter, quoted, tabs, end };
1419
+ }
1420
+ function bashHeredoc(input, start, delimiter) {
1421
+ const bodyStart = start;
1422
+ let lineStart = start;
1423
+ let line = "";
1424
+ let backslashes = 0;
1425
+ for (let index = start;index <= input.length; index++) {
1426
+ if (index < input.length && input[index] !== `
1427
+ `)
1428
+ continue;
1429
+ const text = delimiter.tabs && start === lineStart ? input.slice(start, index).replace(/^\t+/, "") : input.slice(start, index);
1430
+ let run = 0;
1431
+ while (text[text.length - 1 - run] === "\\")
1432
+ run++;
1433
+ backslashes = run === text.length ? backslashes + run : run;
1434
+ const continued = !delimiter.quoted && backslashes % 2 === 1 && index < input.length;
1435
+ const maxLength = Math.max(delimiter.delimiter.length, delimiter.dashDelimiter?.length ?? 0);
1436
+ if (line.length <= maxLength)
1437
+ line += continued ? text.slice(0, -1) : text;
1438
+ if (continued) {
1439
+ backslashes--;
1440
+ start = index + 1;
1441
+ continue;
1442
+ }
1443
+ if (delimiter.dashDelimiter !== undefined && line === delimiter.dashDelimiter)
1444
+ return;
1445
+ if (line === delimiter.delimiter) {
1446
+ if (start > lineStart && input.slice(index + 1).includes(delimiter.delimiter))
1447
+ return;
1448
+ return { source: input.slice(bodyStart, lineStart), end: index };
1449
+ }
1450
+ line = "";
1451
+ backslashes = 0;
1452
+ start = index + 1;
1453
+ lineStart = start;
1454
+ }
1455
+ }
1456
+ function scanPowerShell2(input) {
1457
+ if (input.length > MAX_INPUT_LENGTH)
1458
+ return { kind: "opaque", reason: "invalid-structure" };
1459
+ if (/[\0\u0085\u2013-\u2015\u2018-\u201e\ufeff]/.test(input))
1460
+ return { kind: "opaque", reason: "invalid-structure" };
1461
+ const result = scanPowerShellList(input, 0, 0, { remaining: MAX_INPUT_LENGTH * MAX_SUBSTITUTION_DEPTH });
1462
+ if (result.kind === "opaque")
1463
+ return result;
1464
+ return { kind: "scanned", commands: result.commands };
1465
+ }
1466
+ function scanPowerShellList(input, start, depth, budget, close, hash = false, skipped) {
1467
+ if (depth >= MAX_SUBSTITUTION_DEPTH || budget.remaining < 0)
1468
+ return { kind: "opaque", reason: "invalid-structure" };
1469
+ const commands = [];
1470
+ const nestedCommands = [];
1471
+ const words = [];
1472
+ const rawWords = [];
1473
+ const wordEnds = [];
1474
+ const initialExpression = hash === true || hash === "clause";
1475
+ const initialClause = hash === "clause" || hash === "switch" ? "member" : undefined;
1476
+ let segment = start;
1477
+ let word = "";
1478
+ let started = false;
1479
+ let wordStart = start;
1480
+ let quote;
1481
+ let standalone = false;
1482
+ let expression = initialExpression;
1483
+ let clause = initialClause;
1484
+ let after;
1485
+ let indexable = false;
1486
+ let stopParsing = false;
1487
+ let commandEnd = start;
1488
+ let statementHead = true;
1489
+ let invalid = false;
1490
+ let redirectTarget = false;
1491
+ let dangling = false;
1492
+ let invocation = false;
1493
+ const finishWord = (end) => {
1494
+ if (!started)
1495
+ return;
1496
+ if (word === "--%" && words.length > 0 && !expression && !clause && !redirectTarget && !/['"]/.test(input[wordStart]) && !rawWords.at(-1)?.endsWith(",") && !POWERSHELL_PARAMETER_COLON_RE.test(rawWords.at(-1) ?? ""))
1497
+ stopParsing = true;
1498
+ if (!redirectTarget) {
1499
+ if (!words.length && !invocation && !expression)
1500
+ segment = wordStart;
1501
+ words.push(word);
1502
+ rawWords.push(input.slice(wordStart, end));
1503
+ wordEnds.push(end);
1504
+ dangling = false;
1505
+ }
1506
+ commandEnd = end;
1507
+ redirectTarget = false;
1508
+ word = "";
1509
+ started = false;
1510
+ };
1511
+ const finishCommand = (end, required = false) => {
1512
+ finishWord(end);
1513
+ if (words.length && !expression && !clause)
1514
+ commands.push({
1515
+ resource: input.slice(segment, commandEnd).trimEnd(),
1516
+ words: [...words],
1517
+ rawWords: [...rawWords],
1518
+ wordEnds: wordEnds.map((value) => value - segment),
1519
+ ...statementHead && !invocation ? { statementHead: true } : {}
1520
+ });
1521
+ else if (!expression && !clause && invocation || required && !words.length && !nestedCommands.length || clause !== undefined && clause !== "member")
1522
+ invalid = true;
1523
+ if (redirectTarget)
1524
+ invalid = true;
1525
+ commands.push(...nestedCommands.splice(0));
1526
+ words.length = 0;
1527
+ rawWords.length = 0;
1528
+ wordEnds.length = 0;
1529
+ redirectTarget = false;
1530
+ invocation = false;
1531
+ expression = initialExpression;
1532
+ clause = initialClause;
1533
+ after = undefined;
1534
+ indexable = false;
1535
+ stopParsing = false;
1536
+ };
1537
+ let index = start;
1538
+ for (;index < input.length; index++) {
1539
+ if (--budget.remaining < 0)
1540
+ return { kind: "opaque", reason: "invalid-structure" };
1541
+ if (skipped?.has(index))
1542
+ continue;
1543
+ const char = input[index];
1544
+ const inExpression = expression && !redirectTarget;
1545
+ const atBoundary = !started || !inExpression && word.endsWith(",");
1546
+ if (!started)
1547
+ wordStart = index;
1548
+ if (stopParsing) {
1549
+ const stop = powerShellStopParsing(input, index, skipped);
1550
+ const text = input.slice(index, stop).trim();
1551
+ if (text) {
1552
+ wordStart = index + input.slice(index, stop).search(/\S/);
1553
+ word = text;
1554
+ started = true;
1555
+ finishWord(wordStart + text.length);
1556
+ }
1557
+ stopParsing = false;
1558
+ index = stop - 1;
1559
+ continue;
1560
+ }
1561
+ if (quote) {
1562
+ let nextQuote = index + 1;
1563
+ while (skipped?.has(nextQuote))
1564
+ nextQuote++;
1565
+ if (char === quote && input[nextQuote] === quote) {
1566
+ word += quote;
1567
+ index = nextQuote;
1568
+ } else if (char === quote) {
1569
+ quote = undefined;
1570
+ if (standalone) {
1571
+ finishWord(index + 1);
1572
+ indexable = "closed";
1573
+ }
1574
+ } else if (quote === '"' && char === "`") {
1575
+ const escape = powerShellEscape(input, index, false, skipped);
1576
+ if (!escape)
1577
+ return { kind: "opaque", reason: "unterminated-escape" };
1578
+ word += escape.value;
1579
+ index = escape.end;
1580
+ } else if (quote === '"' && char === "$" && input[index + 1] === "{") {
1581
+ const end = powerShellBracedVariable(input, index, skipped);
1582
+ if (end === undefined)
1583
+ return { kind: "opaque", reason: "invalid-structure" };
1584
+ word += input.slice(index, end + 1);
1585
+ index = end;
1586
+ } else if (quote === '"' && char === "$" && input[index + 1] === "(") {
1587
+ const sub = powerShellSubExpression(input, index + 2, false, budget, skipped);
1588
+ if (!sub)
1589
+ return { kind: "opaque", reason: "invalid-structure" };
1590
+ const result = scanPowerShellList(input, index + 2, depth + 1, budget, ")", false, sub.skipped);
1591
+ if (result.kind === "opaque")
1592
+ return result;
1593
+ nestedCommands.push(...result.commands);
1594
+ const end = sub.rawEnd !== undefined && sub.rawEnd > result.end ? sub.rawEnd : result.end;
1595
+ word += input.slice(index, end + 1);
1596
+ index = end;
1597
+ } else
1598
+ word += char;
1599
+ continue;
1600
+ }
1601
+ if (char === "'" || char === '"') {
1602
+ if (!started && words.length === 0 && !invocation)
1603
+ expression = true;
1604
+ quote = char;
1605
+ standalone = atBoundary || expression && !redirectTarget || indexable === "member" && /[.:]$/.test(word);
1606
+ if (!standalone)
1607
+ indexable = false;
1608
+ started = true;
1609
+ continue;
1610
+ }
1611
+ if (char === "`") {
1612
+ const escape = powerShellEscape(input, index, atBoundary || inExpression, skipped);
1613
+ if (!escape)
1614
+ return { kind: "opaque", reason: "unterminated-escape" };
1615
+ const rawSpace = /\s/.test(input[index + 1] ?? "");
1616
+ if ((inExpression || atBoundary) && started && rawSpace)
1617
+ finishWord(index);
1618
+ else if (!atBoundary || !rawSpace) {
1619
+ started = true;
1620
+ indexable = false;
1621
+ word += escape.value;
1622
+ }
1623
+ index = escape.end;
1624
+ continue;
1625
+ }
1626
+ if (!started && words.length > 0 && !expression && !clause && !redirectTarget && testAt(POWERSHELL_STOP_PARSING_RE, input, index)) {
1627
+ word = "--%";
1628
+ started = true;
1629
+ finishWord(index + 3);
1630
+ index += 2;
1631
+ continue;
1632
+ }
1633
+ if (char === "<" && input[index + 1] === "#" && (atBoundary || inExpression || indexable === "member")) {
1634
+ const memberOperator = indexable === "member" && /[.:]$/.test(started ? word : words.at(-1) ?? "");
1635
+ if (started)
1636
+ finishWord(index);
1637
+ const end = input.indexOf("#>", index + 2);
1638
+ if (end < 0)
1639
+ return { kind: "opaque", reason: "invalid-structure" };
1640
+ if (!memberOperator)
1641
+ indexable = false;
1642
+ index = end + 1;
1643
+ continue;
1644
+ }
1645
+ if (char === "#" && (atBoundary || indexable === "member" || inExpression && !(close === "]" && /^[\p{L}\p{Nl}_][\p{L}\p{Nl}\d_.#+`\\]*$/u.test(word)))) {
1646
+ const prev = started ? word : words.at(-1) ?? "";
1647
+ const memberOperator = indexable === "member" && /[.:]$/.test(prev);
1648
+ if (clause && clause !== "member" || prev.endsWith(",") || memberOperator)
1649
+ finishWord(index);
1650
+ else if (words.length || started || invocation)
1651
+ finishCommand(index);
1652
+ statementHead = !dangling;
1653
+ const endings = [input.indexOf(`
1654
+ `, index), input.indexOf("\r", index)].filter((ending) => ending >= 0);
1655
+ const newline = endings.length > 0 ? Math.min(...endings) : -1;
1656
+ if (newline === -1) {
1657
+ index = input.length;
1658
+ break;
1659
+ }
1660
+ index = input[newline] === "\r" && input[newline + 1] === `
1661
+ ` ? newline + 1 : newline;
1662
+ continue;
1663
+ }
1664
+ if (inExpression && started && (char === ">" || char === "*" && input[index + 1] === ">"))
1665
+ finishWord(index);
1666
+ const redirect = !started && (char === ">" || char === "*" || /\d/.test(char) && (words.length > 0 || testAt(POWERSHELL_MERGE_REDIRECT_RE, input, index))) ? powerShellRedirect(input, index) : undefined;
1667
+ if (redirect === false)
1668
+ return { kind: "opaque", reason: "invalid-redirect" };
1669
+ if (redirect) {
1670
+ if (redirectTarget || words.length === 0 || clause && clause !== "member")
1671
+ return { kind: "opaque", reason: "invalid-redirect" };
1672
+ redirectTarget = !redirect.includes("&");
1673
+ indexable = false;
1674
+ index += redirect.length - 1;
1675
+ commandEnd = index + 1;
1676
+ continue;
1677
+ }
1678
+ if (!started && !words.length && !invocation && !expression && !clause && char === ":") {
1679
+ const label = matchAt(POWERSHELL_LABEL_RE, input, index);
1680
+ if (label) {
1681
+ index += label[0].length - 1;
1682
+ continue;
1683
+ }
1684
+ }
1685
+ if (!started && !invocation && !clause && (!words.length ? !expression : words.every((item) => item.startsWith("["))) && /[A-Za-z]/.test(char)) {
1686
+ const keyword = matchAt(POWERSHELL_KEYWORD_RE, input, index)?.[0]?.toLowerCase();
1687
+ if (keyword && (words.length > 0 ? keyword === "param" && testAt(POWERSHELL_PARAM_RE, input, index) || keyword === "class" || keyword === "enum" : keyword === "param" && testAt(POWERSHELL_PARAM_RE, input, index) || keyword === "foreach" && testAt(POWERSHELL_FOREACH_RE, input, index) || keyword === "until" && after === "do" || (keyword === "else" || keyword === "elseif") && after === "if" || (keyword === "catch" || keyword === "finally") && after === "try" || /^(?:if|for|while|do|switch|function|filter|workflow|parallel|sequence|configuration|try|begin|process|end|clean|trap|class|enum|data|dynamicparam|using|break|continue)$/.test(keyword))) {
1688
+ expression = /^(?:class|enum|break|continue)$/.test(keyword);
1689
+ clause = keyword === "using" || keyword === "break" || keyword === "continue" ? "member" : keyword === "param" || keyword === "until" || keyword === "while" && after === "do" ? "paren" : keyword === "do" ? "do" : keyword === "if" || keyword === "elseif" ? "if" : keyword === "try" || keyword === "catch" ? "try" : keyword === "switch" ? "switch" : keyword === "class" || keyword === "enum" ? "clause" : "block";
1690
+ after = undefined;
1691
+ index += keyword.length - 1;
1692
+ continue;
1693
+ }
1694
+ if (!words.length && keyword && /^(?:return|throw|exit)$/.test(keyword)) {
1695
+ after = undefined;
1696
+ index += keyword.length - 1;
1697
+ continue;
1698
+ }
1699
+ }
1700
+ const assign = inExpression && !clause && (char === "=" || /[-+*/%]/.test(char) && input[index + 1] === "=");
1701
+ if (assign || inExpression && close === ")" && !started && testAt(POWERSHELL_IN_RE, input, index)) {
1702
+ if (assign)
1703
+ finishWord(index);
1704
+ words.length = 0;
1705
+ rawWords.length = 0;
1706
+ wordEnds.length = 0;
1707
+ expression = false;
1708
+ indexable = false;
1709
+ if (!assign || char !== "=")
1710
+ index++;
1711
+ continue;
1712
+ }
1713
+ if (atBoundary && char === "@" && !testAt(POWERSHELL_AT_OPENER_RE, input, index + 1))
1714
+ return { kind: "opaque", reason: "invalid-structure" };
1715
+ if (atBoundary && char === "@" && (input[index + 1] === "'" || input[index + 1] === '"')) {
1716
+ if (started)
1717
+ finishWord(index);
1718
+ wordStart = index;
1719
+ const literal = powerShellHereString(input, index, depth, budget, skipped);
1720
+ if (literal.kind === "opaque")
1721
+ return literal;
1722
+ if (!words.length && !invocation)
1723
+ expression = true;
1724
+ nestedCommands.push(...literal.commands);
1725
+ word = literal.source;
1726
+ started = true;
1727
+ index = literal.end;
1728
+ finishWord(index + 1);
1729
+ indexable = "closed";
1730
+ continue;
1731
+ }
1732
+ if (char === "$" && input[index + 1] === "{") {
1733
+ const end = powerShellBracedVariable(input, index, skipped);
1734
+ if (end === undefined)
1735
+ return { kind: "opaque", reason: "invalid-structure" };
1736
+ if (!started && !words.length && !invocation && hash !== "switch")
1737
+ expression = true;
1738
+ indexable = atBoundary || indexable === "member" && /[.:]$/.test(word) ? "closed" : false;
1739
+ word += input.slice(index, end + 1);
1740
+ started = true;
1741
+ index = end;
1742
+ if (expression && !redirectTarget && input[index + 1] !== "[")
1743
+ finishWord(index + 1);
1744
+ continue;
1745
+ }
1746
+ const opener = (char === "$" || atBoundary && char === "@") && input[index + 1] === "(" ? index + 1 : atBoundary && char === "@" && input[index + 1] === "{" ? index + 1 : char === "(" || char === "{" || char === "[" && (inExpression || Boolean(indexable) || !started && !invocation && (!words.length || clause === "block" || clause === "try")) ? index : undefined;
1747
+ if (opener !== undefined) {
1748
+ const openChar = input[opener];
1749
+ const standaloneBlock = atBoundary || inExpression || char === "(" || openChar === "{";
1750
+ const blockClose = openChar === "(" ? ")" : openChar === "[" ? "]" : "}";
1751
+ const blockHash = openChar === "[" ? true : char === "@" && openChar === "{" ? true : clause === "switch" && openChar === "{" ? "switch" : clause === "clause" && openChar === "{" ? "clause" : close === "]" && char === "(" && started ? "clause" : false;
1752
+ if (started && (char === "{" || char === "(" || char === "@" && atBoundary)) {
1753
+ finishWord(index);
1754
+ if (stopParsing) {
1755
+ index--;
1756
+ continue;
1757
+ }
1758
+ wordStart = index;
1759
+ }
1760
+ if (!started && !words.length && !invocation)
1761
+ expression = true;
1762
+ const result = scanPowerShellList(input, opener + 1, depth + 1, budget, blockClose, blockHash, skipped);
1763
+ if (result.kind === "opaque")
1764
+ return result;
1765
+ nestedCommands.push(...result.commands);
1766
+ started = true;
1767
+ word += input.slice(index, result.end + 1);
1768
+ index = result.end;
1769
+ if (openChar === "[") {
1770
+ indexable = "closed";
1771
+ if (input[index + 1] !== "[")
1772
+ finishWord(index + 1);
1773
+ } else if (standaloneBlock) {
1774
+ finishWord(index + 1);
1775
+ indexable = "closed";
1776
+ }
1777
+ if (clause === "paren" && char === "(" || clause && clause !== "paren" && char === "{") {
1778
+ const completed = clause === "do" || clause === "if" || clause === "try" ? clause : undefined;
1779
+ clause = "member";
1780
+ finishCommand(index + 1);
1781
+ after = completed;
1782
+ }
1783
+ continue;
1784
+ }
1785
+ if (char === close)
1786
+ break;
1787
+ if (char === "}" || char === ")" || char === "]" && inExpression)
1788
+ return { kind: "opaque", reason: "invalid-structure" };
1789
+ if (!started && words.length === 0 && (char === "&" && input[index + 1] !== "&" || char === "." && (!input[index + 1] || /[\s"'$(),;{|}&]/.test(input[index + 1])))) {
1790
+ if (invocation)
1791
+ return { kind: "opaque", reason: "invalid-structure" };
1792
+ segment = index;
1793
+ invocation = true;
1794
+ after = undefined;
1795
+ continue;
1796
+ }
1797
+ if (/\s/.test(char) && char !== `
1798
+ ` && char !== "\r") {
1799
+ finishWord(index);
1800
+ indexable = false;
1801
+ continue;
1802
+ }
1803
+ const next = input[index + 1];
1804
+ const separator = char === "\r" && next === `
1805
+ ` ? char + next : char === "&" && next === "&" || char === "|" && next === "|" ? char + next : char === ";" || char === "|" || char === "&" || char === `
1806
+ ` || char === "\r" ? char : undefined;
1807
+ if (separator) {
1808
+ if (close === "]" && (separator === ";" || separator === "|" || separator === "||" || separator === "&&" || separator === "&"))
1809
+ return { kind: "opaque", reason: "invalid-structure" };
1810
+ if (separator === `
1811
+ ` || separator === "\r" || separator === `\r
1812
+ `) {
1813
+ const prev = started ? word : words.at(-1) ?? "";
1814
+ const memberOperator = indexable === "member" && /[.:]$/.test(prev);
1815
+ if (clause && clause !== "member" || prev.endsWith(",") || memberOperator) {
1816
+ finishWord(index);
1817
+ index += separator.length - 1;
1818
+ if (!memberOperator)
1819
+ indexable = false;
1820
+ continue;
1821
+ }
1822
+ if (!started && !words.length && !invocation) {
1823
+ index += separator.length - 1;
1824
+ indexable = false;
1825
+ continue;
1826
+ }
1827
+ }
1828
+ finishCommand(index, dangling || ![";", `
1829
+ `, "\r", `\r
1830
+ `].includes(separator));
1831
+ dangling = ![";", "&", `
1832
+ `, "\r", `\r
1833
+ `].includes(separator);
1834
+ statementHead = !dangling;
1835
+ index += separator.length - 1;
1836
+ continue;
1837
+ }
1838
+ if (!started && !words.length && !invocation && hash !== "switch" && testAt(POWERSHELL_EXPRESSION_RE, input, index))
1839
+ expression = true;
1840
+ if ((atBoundary || indexable === "member" && /[.:]$/.test(word)) && char === "$")
1841
+ indexable = testAt(POWERSHELL_INDEXABLE_VAR_RE, input, index + 1) ? "variable" : false;
1842
+ else if (indexable === "closed")
1843
+ indexable = char === "." && input[index + 1] !== "." && !/\s/.test(input[index + 1] ?? "") || !started && char === ":" && input[index + 1] === ":" && !/\s/.test(input[index + 2] ?? "") || !started && char === "?" && input[index + 1] === "." && input[index + 2] !== "." && !/\s/.test(input[index + 2] ?? "") ? "member" : !started && char === "?" && input[index + 1] === "[" ? "closed" : false;
1844
+ else if (indexable === "variable")
1845
+ indexable = char === "." && input[index + 1] !== "." && !/\s/.test(input[index + 1] ?? "") || char === ":" && input[index + 1] === ":" && !/\s/.test(input[index + 2] ?? "") ? "member" : char === "." && input[index + 1] === "." || !/[\p{L}\p{Nl}\d_:?]/u.test(char) ? false : "variable";
1846
+ else if (indexable === "member")
1847
+ indexable = char === "." && input[index + 1] === "." ? false : char === "." && !/\s/.test(input[index + 1] ?? "") || char === ":" && (input[index + 1] === ":" || input[index - 1] === ":") || char === "?" && input[index + 1] === "." && input[index + 2] !== "." || /[\p{L}\p{Nl}\d_]/u.test(char) ? "member" : false;
1848
+ after = undefined;
1849
+ started = true;
1850
+ dangling = false;
1851
+ word += char;
1852
+ }
1853
+ if (close !== undefined && input[index] !== close)
1854
+ return { kind: "opaque", reason: "invalid-structure" };
1855
+ if (quote)
1856
+ return { kind: "opaque", reason: "unterminated-quote" };
1857
+ finishCommand(index);
1858
+ if (redirectTarget || invalid || dangling)
1859
+ return { kind: "opaque", reason: "invalid-structure" };
1860
+ if (commands.some((command) => !command.words[0]))
1861
+ return { kind: "opaque", reason: "dynamic-command-name" };
1862
+ return { kind: "scanned", commands, end: index };
1863
+ }
1864
+ var POWERSHELL_STOP_PARSING_RE = /--%(?=$|[\s;|&(){}])/y;
1865
+ var POWERSHELL_PARAMETER_COLON_RE = /^-[\p{L}\p{Nl}_?][\p{L}\p{Nl}\d_?-]*:$/u;
1866
+ var POWERSHELL_MERGE_REDIRECT_RE = /\d>&/y;
1867
+ var POWERSHELL_LABEL_RE = /:[A-Za-z_]\w*(?=\s*(?:while|for|foreach|do|switch)(?=$|[\s&(),;{|}]))/iy;
1868
+ var POWERSHELL_KEYWORD_RE = /[A-Za-z]+(?=$|[\s&(),;{|}])/y;
1869
+ var POWERSHELL_FOREACH_RE = /foreach\s*\(/isy;
1870
+ var POWERSHELL_PARAM_RE = /param\s*\(/isy;
1871
+ var POWERSHELL_IN_RE = /in(?=$|[\s&(),;{|}])/iy;
1872
+ var POWERSHELL_AT_OPENER_RE = /[({'"\p{L}\p{Nl}\d_?]/uy;
1873
+ var POWERSHELL_INDEXABLE_VAR_RE = /(?::[\p{L}\p{Nl}\d_?]+|[\p{L}\p{Nl}\d_][\p{L}\p{Nl}\d_?]*)/uy;
1874
+ var POWERSHELL_HERE_HEADER_RE = /@['"][^\S\r\n]*(?:\r\n|\r|\n)/y;
1875
+ var POWERSHELL_UNICODE_ESCAPE_RE = /u\{([0-9a-f]{1,6})\}/iy;
1876
+ var POWERSHELL_EXPRESSION_RE = /(?:!*(?:\+\+|--|[+-])?\$(?:\{|(?:\?|\$|\^)(?=$|[\s;|&(){},#>])|:[\p{L}\p{Nl}\d_?]+|[\p{L}\p{Nl}\d_][\p{L}\p{Nl}\d_?]*(?::[\p{L}\p{Nl}\d_?]+)?)|!(?![\p{L}\p{Nl}_.\d])|\+(?![=\p{L}\p{Nl}_.\d])|--(?!=)|-(?![=\p{L}\p{Nl}\d_?.])|,(?!\s*$)|!*[+-]?(?:0[xX][\da-fA-F]+|0[bB][01]+|(?:\d+(?:\.(?!\.)\d*|(?!\.(?!\.)))|\.\d+)(?:[eE][+-]?\d+)?)(?:[dDlLnN]|[uU][sSyYlL]?|[sSyY])?(?:[kKmMgGtTpP][bB])?(?=$|[\s!#%&()*+,\-/.;<=>\]|{}])|-(?:not|bnot|join|[ic]?split)(?![\p{L}\p{Nl}]))/iuy;
1877
+ var POWERSHELL_ESCAPES = {
1878
+ "0": "\x00",
1879
+ a: "\x07",
1880
+ b: "\b",
1881
+ e: "\x1B",
1882
+ f: "\f",
1883
+ n: `
1884
+ `,
1885
+ r: "\r",
1886
+ t: "\t",
1887
+ v: "\v"
1888
+ };
1889
+ function matchAt(regex, input, index) {
1890
+ regex.lastIndex = index;
1891
+ return regex.exec(input);
1892
+ }
1893
+ function testAt(regex, input, index) {
1894
+ regex.lastIndex = index;
1895
+ return regex.test(input);
1896
+ }
1897
+ function powerShellEscape(input, start, lineContinuation = false, skipped) {
1898
+ let next = start + 1;
1899
+ while (skipped?.has(next))
1900
+ next++;
1901
+ const char = input[next];
1902
+ if (char === undefined)
1903
+ return;
1904
+ if (char === "\r" || char === `
1905
+ `)
1906
+ return {
1907
+ value: lineContinuation && char === "\r" && input[next + 1] === `
1908
+ ` ? `\r
1909
+ ` : char,
1910
+ end: next + (lineContinuation && char === "\r" && input[next + 1] === `
1911
+ ` ? 1 : 0)
1912
+ };
1913
+ if (char === "u" && input[next + 1] === "{") {
1914
+ const code = matchAt(POWERSHELL_UNICODE_ESCAPE_RE, input, next);
1915
+ if (!code || Number.parseInt(code[1], 16) > 1114111)
1916
+ return;
1917
+ return { value: String.fromCodePoint(Number.parseInt(code[1], 16)), end: next + code[0].length - 1 };
1918
+ }
1919
+ return { value: POWERSHELL_ESCAPES[char] ?? char, end: next };
1920
+ }
1921
+ function powerShellBracedVariable(input, start, skipped) {
1922
+ for (let index = start + 2;index < input.length; index++) {
1923
+ if (skipped?.has(index))
1924
+ continue;
1925
+ if (input[index] === "`") {
1926
+ const escape = powerShellEscape(input, index, false, skipped);
1927
+ if (!escape)
1928
+ return;
1929
+ index = escape.end;
1930
+ continue;
1931
+ }
1932
+ if (input[index] === "}")
1933
+ return index > start + 2 ? index : undefined;
1934
+ }
1935
+ }
1936
+ function powerShellSubExpression(input, start, hereString, budget, skipped) {
1937
+ const nextSkipped = new Set(skipped);
1938
+ let depth = 1;
1939
+ let rawEnd;
1940
+ for (let index = start;index < input.length; index++) {
1941
+ if (--budget.remaining < 0)
1942
+ return;
1943
+ if (nextSkipped.has(index))
1944
+ continue;
1945
+ const char = input[index];
1946
+ if (char === "(")
1947
+ depth++;
1948
+ else if (char === ")") {
1949
+ if (--depth === 0 && rawEnd === undefined)
1950
+ rawEnd = index;
1951
+ } else if (!hereString && (char === '"' || char === "`")) {
1952
+ let next = index + 1;
1953
+ while (nextSkipped.has(next))
1954
+ next++;
1955
+ if (input[next] === '"') {
1956
+ nextSkipped.add(index);
1957
+ index = next;
1958
+ }
1959
+ }
1960
+ }
1961
+ return { skipped: nextSkipped, rawEnd };
1962
+ }
1963
+ function powerShellStopParsing(input, start, skipped) {
1964
+ let quoted = false;
1965
+ for (let index = start;index < input.length; index++) {
1966
+ if (skipped?.has(index))
1967
+ continue;
1968
+ if (input[index] === '"')
1969
+ quoted = !quoted;
1970
+ if (input[index] === "\r" || input[index] === `
1971
+ ` || (input[index] === "|" || input[index] === "&" && input[index + 1] === "&") && !quoted)
1972
+ return index;
1973
+ }
1974
+ return input.length;
1975
+ }
1976
+ function powerShellHereString(input, start, depth, budget, skipped) {
1977
+ const header = matchAt(POWERSHELL_HERE_HEADER_RE, input, start);
1978
+ if (!header)
1979
+ return { kind: "opaque", reason: "unterminated-quote" };
1980
+ const quote = input[start + 1];
1981
+ const body = start + header[0].length;
1982
+ const commands = [];
1983
+ let lineStart = true;
1984
+ for (let index = body;index < input.length; index++) {
1985
+ if (--budget.remaining < 0)
1986
+ return { kind: "opaque", reason: "invalid-structure" };
1987
+ if (skipped?.has(index))
1988
+ continue;
1989
+ if (lineStart && input[index] === quote && input[index + 1] === "@") {
1990
+ const end = index > body && input[index - 1] === `
1991
+ ` && input[index - 2] === "\r" ? index - 2 : index > body ? index - 1 : index;
1992
+ return { kind: "scanned", commands, source: input.slice(body, end), end: index + 1 };
1993
+ }
1994
+ if (quote === '"') {
1995
+ if (input[index] === "`") {
1996
+ const escape = powerShellEscape(input, index, false, skipped);
1997
+ if (!escape)
1998
+ return { kind: "opaque", reason: "unterminated-escape" };
1999
+ index = escape.end;
2000
+ lineStart = false;
2001
+ continue;
2002
+ }
2003
+ if (input[index] === "$" && input[index + 1] === "{") {
2004
+ const end = powerShellBracedVariable(input, index, skipped);
2005
+ if (end === undefined)
2006
+ return { kind: "opaque", reason: "invalid-structure" };
2007
+ index = end;
2008
+ lineStart = false;
2009
+ continue;
2010
+ }
2011
+ if (input[index] === "$" && input[index + 1] === "(") {
2012
+ const sub = powerShellSubExpression(input, index + 2, true, budget, skipped);
2013
+ if (!sub)
2014
+ return { kind: "opaque", reason: "invalid-structure" };
2015
+ const result = scanPowerShellList(input, index + 2, depth + 1, budget, ")", false, sub.skipped);
2016
+ if (result.kind === "opaque")
2017
+ return result;
2018
+ commands.push(...result.commands);
2019
+ index = sub.rawEnd !== undefined && sub.rawEnd > result.end ? sub.rawEnd : result.end;
2020
+ lineStart = false;
2021
+ continue;
2022
+ }
2023
+ }
2024
+ lineStart = input[index] === "\r" || input[index] === `
2025
+ `;
2026
+ }
2027
+ return { kind: "opaque", reason: "unterminated-quote" };
2028
+ }
2029
+ function powerShellRedirect(input, index) {
2030
+ let cursor = index;
2031
+ if (input[cursor] === "*")
2032
+ cursor++;
2033
+ else
2034
+ while (/\d/.test(input[cursor] ?? ""))
2035
+ cursor++;
2036
+ if (input[cursor] !== ">")
2037
+ return;
2038
+ cursor++;
2039
+ if (input[cursor] === ">")
2040
+ cursor++;
2041
+ if (input[cursor] === "&") {
2042
+ cursor++;
2043
+ while (/\d/.test(input[cursor] ?? ""))
2044
+ cursor++;
2045
+ }
2046
+ const redirect = input.slice(index, cursor);
2047
+ return /^(?:(?:[1-6]|\*)?>>?|[2-6*]>&1)$/.test(redirect) ? redirect : false;
2048
+ }
2049
+
2050
+ export { scan4, scanPowerShell2, exports_scan };