@bkm016/basalt 0.1.27 → 0.1.28

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 (535) hide show
  1. package/{chunk-ydhdewcv.js → chunk-4n4wn5cj.js} +1 -1
  2. package/{chunk-x3g1bzq6.js → chunk-78yngmvf.js} +1 -1
  3. package/{chunk-jxcghx26.js → chunk-a454ntda.js} +2 -2
  4. package/compiled.js +1 -1
  5. package/package.json +1 -1
  6. package/web/{chunk-45ex0e3e.js → chunk-02z7yrhn.js} +1 -1
  7. package/web/chunk-02z7yrhn.js.br +0 -0
  8. package/web/chunk-02z7yrhn.js.gz +0 -0
  9. package/web/chunk-0an1eqtf.js +1 -0
  10. package/web/chunk-0an1eqtf.js.br +0 -0
  11. package/web/chunk-0an1eqtf.js.gz +0 -0
  12. package/web/{chunk-w2gy2tmp.js → chunk-128zy60g.js} +1 -1
  13. package/web/chunk-128zy60g.js.br +0 -0
  14. package/web/chunk-128zy60g.js.gz +0 -0
  15. package/web/{chunk-1fnxbfkf.js → chunk-1e2jy7m2.js} +1 -1
  16. package/web/chunk-1e2jy7m2.js.br +0 -0
  17. package/web/chunk-1e2jy7m2.js.gz +0 -0
  18. package/web/{chunk-f2bb976c.js → chunk-1v3e001f.js} +1 -1
  19. package/web/chunk-1v3e001f.js.br +0 -0
  20. package/web/chunk-1v3e001f.js.gz +0 -0
  21. package/web/{chunk-whfh2wev.js → chunk-214p3rj6.js} +1 -1
  22. package/web/chunk-214p3rj6.js.br +0 -0
  23. package/web/chunk-214p3rj6.js.gz +0 -0
  24. package/web/{chunk-5h3r1hpg.js → chunk-29byd5kf.js} +1 -1
  25. package/web/chunk-29byd5kf.js.br +0 -0
  26. package/web/chunk-29byd5kf.js.gz +0 -0
  27. package/web/{chunk-b4d1948q.js → chunk-3fbh1wxk.js} +1 -1
  28. package/web/chunk-3fbh1wxk.js.br +0 -0
  29. package/web/chunk-3fbh1wxk.js.gz +0 -0
  30. package/web/{chunk-r97hd8wk.js → chunk-3fnrzj1h.js} +1 -1
  31. package/web/chunk-3fnrzj1h.js.br +0 -0
  32. package/web/chunk-3fnrzj1h.js.gz +0 -0
  33. package/web/{chunk-nymsmy8d.js → chunk-3g1095m7.js} +1 -1
  34. package/web/chunk-3g1095m7.js.br +0 -0
  35. package/web/chunk-3g1095m7.js.gz +0 -0
  36. package/web/{chunk-a1cpkzwh.js → chunk-3nn7w4hw.js} +1 -1
  37. package/web/chunk-3nn7w4hw.js.br +0 -0
  38. package/web/chunk-3nn7w4hw.js.gz +0 -0
  39. package/web/{chunk-vwms8c7b.js → chunk-3qa8xcdr.js} +1 -1
  40. package/web/chunk-3qa8xcdr.js.br +0 -0
  41. package/web/chunk-3qa8xcdr.js.gz +0 -0
  42. package/web/{chunk-ctr4kt7p.js → chunk-3x69jfmh.js} +1 -1
  43. package/web/chunk-3x69jfmh.js.br +0 -0
  44. package/web/chunk-3x69jfmh.js.gz +0 -0
  45. package/web/chunk-4v6m77sv.css +1 -0
  46. package/web/chunk-4v6m77sv.css.br +0 -0
  47. package/web/chunk-4v6m77sv.css.gz +0 -0
  48. package/web/chunk-4vk6xma5.js +1 -0
  49. package/web/chunk-4vk6xma5.js.br +0 -0
  50. package/web/chunk-4vk6xma5.js.gz +0 -0
  51. package/web/{chunk-qa0wwff0.js → chunk-50pdas2t.js} +1 -1
  52. package/web/chunk-50pdas2t.js.br +0 -0
  53. package/web/chunk-50pdas2t.js.gz +0 -0
  54. package/web/{chunk-hxsrph02.js → chunk-56a6zytc.js} +94 -94
  55. package/web/chunk-56a6zytc.js.br +0 -0
  56. package/web/chunk-56a6zytc.js.gz +0 -0
  57. package/web/chunk-5ckj4zez.js +1 -0
  58. package/web/chunk-5ckj4zez.js.br +2 -0
  59. package/web/chunk-5ckj4zez.js.gz +0 -0
  60. package/web/{chunk-xjbxndxz.js → chunk-5mr8z024.js} +1 -1
  61. package/web/chunk-5mr8z024.js.br +0 -0
  62. package/web/chunk-5mr8z024.js.gz +0 -0
  63. package/web/{chunk-df9ja645.js → chunk-5q4pemdh.js} +1 -1
  64. package/web/chunk-5q4pemdh.js.br +0 -0
  65. package/web/chunk-5q4pemdh.js.gz +0 -0
  66. package/web/{chunk-g7b4p9k9.js → chunk-63ft76vs.js} +1 -1
  67. package/web/chunk-63ft76vs.js.br +0 -0
  68. package/web/chunk-63ft76vs.js.gz +0 -0
  69. package/web/chunk-67ynxnvq.js +8 -0
  70. package/web/chunk-67ynxnvq.js.br +0 -0
  71. package/web/chunk-67ynxnvq.js.gz +0 -0
  72. package/web/{chunk-3m2nnnk5.js → chunk-6c2pv79h.js} +1 -1
  73. package/web/chunk-6c2pv79h.js.br +0 -0
  74. package/web/chunk-6c2pv79h.js.gz +0 -0
  75. package/web/{chunk-a31z4c14.js → chunk-77nxgqqb.js} +1 -1
  76. package/web/chunk-77nxgqqb.js.br +0 -0
  77. package/web/chunk-77nxgqqb.js.gz +0 -0
  78. package/web/{chunk-68q4nnmc.js → chunk-7c59jb8d.js} +1 -1
  79. package/web/chunk-7c59jb8d.js.br +0 -0
  80. package/web/chunk-7c59jb8d.js.gz +0 -0
  81. package/web/{chunk-btk2h3vh.js → chunk-7ed5jf6e.js} +1 -1
  82. package/web/chunk-7ed5jf6e.js.br +0 -0
  83. package/web/chunk-7ed5jf6e.js.gz +0 -0
  84. package/web/{chunk-x1gr0017.js → chunk-891bpx3c.js} +1 -1
  85. package/web/chunk-891bpx3c.js.br +0 -0
  86. package/web/chunk-891bpx3c.js.gz +0 -0
  87. package/web/{chunk-jnhem746.js → chunk-8h4dc48v.js} +1 -1
  88. package/web/chunk-8h4dc48v.js.br +0 -0
  89. package/web/chunk-8h4dc48v.js.gz +0 -0
  90. package/web/{chunk-82aqq58f.js → chunk-9bs7khrr.js} +1 -1
  91. package/web/chunk-9bs7khrr.js.br +0 -0
  92. package/web/chunk-9bs7khrr.js.gz +0 -0
  93. package/web/{chunk-3ry5cjnp.js → chunk-9ctyqr3n.js} +1 -1
  94. package/web/chunk-9ctyqr3n.js.br +0 -0
  95. package/web/chunk-9ctyqr3n.js.gz +0 -0
  96. package/web/{chunk-508cpafz.js → chunk-9qdx0ekk.js} +2 -2
  97. package/web/chunk-9qdx0ekk.js.br +0 -0
  98. package/web/chunk-9qdx0ekk.js.gz +0 -0
  99. package/web/{chunk-023b3kdx.js → chunk-9r0rnt6d.js} +1 -1
  100. package/web/chunk-9r0rnt6d.js.br +0 -0
  101. package/web/chunk-9r0rnt6d.js.gz +0 -0
  102. package/web/chunk-ac9g3w7v.js +1 -0
  103. package/web/chunk-ac9g3w7v.js.br +0 -0
  104. package/web/chunk-ac9g3w7v.js.gz +0 -0
  105. package/web/{chunk-mvm0gvwj.js → chunk-ackts7ph.js} +1 -1
  106. package/web/chunk-ackts7ph.js.br +0 -0
  107. package/web/chunk-ackts7ph.js.gz +0 -0
  108. package/web/{chunk-wjecy48x.js → chunk-asyqrf38.js} +1 -1
  109. package/web/chunk-asyqrf38.js.br +0 -0
  110. package/web/chunk-asyqrf38.js.gz +0 -0
  111. package/web/{chunk-jw92texh.js → chunk-b13crsv9.js} +1 -1
  112. package/web/chunk-b13crsv9.js.br +0 -0
  113. package/web/chunk-b13crsv9.js.gz +0 -0
  114. package/web/{chunk-nxnkb0w4.js → chunk-brg2zcv5.js} +1 -1
  115. package/web/chunk-brg2zcv5.js.br +0 -0
  116. package/web/chunk-brg2zcv5.js.gz +0 -0
  117. package/web/{chunk-6ktmzq32.js → chunk-cgwnzse1.js} +1 -1
  118. package/web/chunk-cgwnzse1.js.br +0 -0
  119. package/web/chunk-cgwnzse1.js.gz +0 -0
  120. package/web/{chunk-gxwsf4t1.js → chunk-cm4fjb6j.js} +1 -1
  121. package/web/chunk-cm4fjb6j.js.br +0 -0
  122. package/web/chunk-cm4fjb6j.js.gz +0 -0
  123. package/web/{chunk-n0fqhrqv.js → chunk-djrvdzsb.js} +1 -1
  124. package/web/chunk-djrvdzsb.js.br +0 -0
  125. package/web/chunk-djrvdzsb.js.gz +0 -0
  126. package/web/{chunk-7rs26q98.js → chunk-dsffzc1e.js} +1 -1
  127. package/web/chunk-dsffzc1e.js.br +0 -0
  128. package/web/chunk-dsffzc1e.js.gz +0 -0
  129. package/web/{chunk-wqmyjj6w.js → chunk-e1wy8050.js} +1 -1
  130. package/web/chunk-e1wy8050.js.br +0 -0
  131. package/web/chunk-e1wy8050.js.gz +0 -0
  132. package/web/{chunk-z04ncfs3.js → chunk-ebknmxdp.js} +1 -1
  133. package/web/chunk-ebknmxdp.js.br +0 -0
  134. package/web/chunk-ebknmxdp.js.gz +0 -0
  135. package/web/{chunk-crfbqd4d.js → chunk-egjv760p.js} +1 -1
  136. package/web/chunk-egjv760p.js.br +0 -0
  137. package/web/chunk-egjv760p.js.gz +0 -0
  138. package/web/chunk-etpd8y98.js +1 -0
  139. package/web/chunk-etpd8y98.js.br +0 -0
  140. package/web/chunk-etpd8y98.js.gz +0 -0
  141. package/web/chunk-f5kr9p2k.js +1 -0
  142. package/web/chunk-f5kr9p2k.js.br +2 -0
  143. package/web/chunk-f5kr9p2k.js.gz +0 -0
  144. package/web/{chunk-1qd75yjn.js → chunk-fjhqg9ag.js} +1 -1
  145. package/web/chunk-fjhqg9ag.js.br +0 -0
  146. package/web/chunk-fjhqg9ag.js.gz +0 -0
  147. package/web/{chunk-zapwrc5k.js → chunk-fyr6rm2p.js} +1 -1
  148. package/web/chunk-fyr6rm2p.js.br +0 -0
  149. package/web/chunk-fyr6rm2p.js.gz +0 -0
  150. package/web/chunk-grjq1g15.js +1 -0
  151. package/web/chunk-grjq1g15.js.br +0 -0
  152. package/web/chunk-grjq1g15.js.gz +0 -0
  153. package/web/{chunk-eq59kad4.js → chunk-h4bzgvbg.js} +2 -2
  154. package/web/chunk-h4bzgvbg.js.br +0 -0
  155. package/web/chunk-h4bzgvbg.js.gz +0 -0
  156. package/web/{chunk-dy2egpw5.js → chunk-heen0v5d.js} +1 -1
  157. package/web/chunk-heen0v5d.js.br +0 -0
  158. package/web/chunk-heen0v5d.js.gz +0 -0
  159. package/web/{chunk-sb61aqg8.js → chunk-henez15c.js} +1 -1
  160. package/web/chunk-henez15c.js.br +0 -0
  161. package/web/chunk-henez15c.js.gz +0 -0
  162. package/web/chunk-hpcvwdkg.js +1 -0
  163. package/web/chunk-hpcvwdkg.js.br +0 -0
  164. package/web/chunk-hpcvwdkg.js.gz +0 -0
  165. package/web/{chunk-g0s2xxfd.js → chunk-hpvyk6rz.js} +1 -1
  166. package/web/chunk-hpvyk6rz.js.br +0 -0
  167. package/web/chunk-hpvyk6rz.js.gz +0 -0
  168. package/web/chunk-j0dyf1g8.js +2 -0
  169. package/web/chunk-j0dyf1g8.js.br +3 -0
  170. package/web/chunk-j0dyf1g8.js.gz +0 -0
  171. package/web/{chunk-b07y0tzq.js → chunk-jb89v31q.js} +1 -1
  172. package/web/chunk-jb89v31q.js.br +0 -0
  173. package/web/chunk-jb89v31q.js.gz +0 -0
  174. package/web/{chunk-xsfmh8rr.js → chunk-jb949ewp.js} +1 -1
  175. package/web/chunk-jb949ewp.js.br +0 -0
  176. package/web/chunk-jb949ewp.js.gz +0 -0
  177. package/web/{chunk-n1p03ng0.js → chunk-je4bf95v.js} +1 -1
  178. package/web/chunk-je4bf95v.js.br +0 -0
  179. package/web/chunk-je4bf95v.js.gz +0 -0
  180. package/web/{chunk-wv83gygp.js → chunk-js6c1973.js} +1 -1
  181. package/web/chunk-js6c1973.js.br +0 -0
  182. package/web/chunk-js6c1973.js.gz +0 -0
  183. package/web/chunk-k140nr54.js +1 -0
  184. package/web/chunk-k140nr54.js.br +0 -0
  185. package/web/chunk-k140nr54.js.gz +0 -0
  186. package/web/{chunk-hh6vpvar.js → chunk-kknrn2wb.js} +1 -1
  187. package/web/chunk-kknrn2wb.js.br +0 -0
  188. package/web/chunk-kknrn2wb.js.gz +0 -0
  189. package/web/{chunk-ghr3jf15.js → chunk-mhtzdq9d.js} +1 -1
  190. package/web/chunk-mhtzdq9d.js.br +0 -0
  191. package/web/chunk-mhtzdq9d.js.gz +0 -0
  192. package/web/{chunk-22jfhjk3.js → chunk-mrnj2k3v.js} +1 -1
  193. package/web/chunk-mrnj2k3v.js.br +0 -0
  194. package/web/chunk-mrnj2k3v.js.gz +0 -0
  195. package/web/{chunk-g1k9nggh.js → chunk-my0k5w7f.js} +1 -1
  196. package/web/chunk-my0k5w7f.js.br +0 -0
  197. package/web/chunk-my0k5w7f.js.gz +0 -0
  198. package/web/{chunk-58gh3tbh.js → chunk-n08727ym.js} +1 -1
  199. package/web/chunk-n08727ym.js.br +0 -0
  200. package/web/chunk-n08727ym.js.gz +0 -0
  201. package/web/{chunk-d7nrrcwp.js → chunk-n5ghyxwk.js} +1 -1
  202. package/web/chunk-n5ghyxwk.js.br +0 -0
  203. package/web/chunk-n5ghyxwk.js.gz +0 -0
  204. package/web/{chunk-3crfxxst.js → chunk-nt21rjrm.js} +2 -2
  205. package/web/chunk-nt21rjrm.js.br +0 -0
  206. package/web/chunk-nt21rjrm.js.gz +0 -0
  207. package/web/{chunk-j2gkg76r.js → chunk-nzgj9qx5.js} +1 -1
  208. package/web/chunk-nzgj9qx5.js.br +0 -0
  209. package/web/chunk-nzgj9qx5.js.gz +0 -0
  210. package/web/{chunk-20v068s6.js → chunk-p9wm0dv3.js} +1 -1
  211. package/web/chunk-p9wm0dv3.js.br +0 -0
  212. package/web/chunk-p9wm0dv3.js.gz +0 -0
  213. package/web/{chunk-xa9m0mh2.js → chunk-pqh9yszs.js} +1 -1
  214. package/web/chunk-pqh9yszs.js.br +0 -0
  215. package/web/chunk-pqh9yszs.js.gz +0 -0
  216. package/web/chunk-q0vsqq43.js +1 -0
  217. package/web/chunk-q0vsqq43.js.br +0 -0
  218. package/web/chunk-q0vsqq43.js.gz +0 -0
  219. package/web/{chunk-tefm9md2.js → chunk-qv5d69fn.js} +1 -1
  220. package/web/chunk-qv5d69fn.js.br +0 -0
  221. package/web/chunk-qv5d69fn.js.gz +0 -0
  222. package/web/{chunk-37hn49td.js → chunk-r7afv22v.js} +1 -1
  223. package/web/chunk-r7afv22v.js.br +0 -0
  224. package/web/chunk-r7afv22v.js.gz +0 -0
  225. package/web/{chunk-6x9r1z9z.js → chunk-rc6at4k5.js} +1 -1
  226. package/web/chunk-rc6at4k5.js.br +0 -0
  227. package/web/chunk-rc6at4k5.js.gz +0 -0
  228. package/web/{chunk-n033azqs.js → chunk-rnsvrehz.js} +1 -1
  229. package/web/chunk-rnsvrehz.js.br +0 -0
  230. package/web/chunk-rnsvrehz.js.gz +0 -0
  231. package/web/chunk-rsmhn1fq.js +1 -0
  232. package/web/chunk-rsmhn1fq.js.br +0 -0
  233. package/web/chunk-rsmhn1fq.js.gz +0 -0
  234. package/web/chunk-s1p271av.js +1 -0
  235. package/web/chunk-s1p271av.js.br +0 -0
  236. package/web/chunk-s1p271av.js.gz +0 -0
  237. package/web/chunk-sc4kwbnh.js +1 -0
  238. package/web/chunk-sc4kwbnh.js.br +2 -0
  239. package/web/chunk-sc4kwbnh.js.gz +0 -0
  240. package/web/{chunk-cgt871p9.js → chunk-scebh2ee.js} +1 -1
  241. package/web/chunk-scebh2ee.js.br +0 -0
  242. package/web/chunk-scebh2ee.js.gz +0 -0
  243. package/web/{chunk-c1s7faqj.js → chunk-shtkgxz6.js} +1 -1
  244. package/web/chunk-shtkgxz6.js.br +0 -0
  245. package/web/chunk-shtkgxz6.js.gz +0 -0
  246. package/web/{chunk-nb73fq72.js → chunk-spmfwbhd.js} +1 -1
  247. package/web/chunk-spmfwbhd.js.br +0 -0
  248. package/web/chunk-spmfwbhd.js.gz +0 -0
  249. package/web/chunk-svtenejf.js +1 -0
  250. package/web/chunk-svtenejf.js.br +0 -0
  251. package/web/chunk-svtenejf.js.gz +0 -0
  252. package/web/{chunk-qtwjt5mm.js → chunk-t9z1bp8j.js} +1 -1
  253. package/web/chunk-t9z1bp8j.js.br +0 -0
  254. package/web/chunk-t9z1bp8j.js.gz +0 -0
  255. package/web/chunk-tnttdgsc.js +1 -0
  256. package/web/chunk-tnttdgsc.js.br +0 -0
  257. package/web/chunk-tnttdgsc.js.gz +0 -0
  258. package/web/{chunk-6wxxypbv.js → chunk-txdkp6yc.js} +1 -1
  259. package/web/chunk-txdkp6yc.js.br +0 -0
  260. package/web/chunk-txdkp6yc.js.gz +0 -0
  261. package/web/{chunk-gv4zh4er.js → chunk-v34mwgx8.js} +1 -1
  262. package/web/chunk-v34mwgx8.js.br +0 -0
  263. package/web/chunk-v34mwgx8.js.gz +0 -0
  264. package/web/{chunk-00a6amwf.js → chunk-vtp01n96.js} +1 -1
  265. package/web/chunk-vtp01n96.js.br +0 -0
  266. package/web/chunk-vtp01n96.js.gz +0 -0
  267. package/web/{chunk-zs7physk.js → chunk-vx1qmkbm.js} +1 -1
  268. package/web/chunk-vx1qmkbm.js.br +0 -0
  269. package/web/chunk-vx1qmkbm.js.gz +0 -0
  270. package/web/chunk-vxx451tt.js +1 -0
  271. package/web/chunk-vxx451tt.js.br +0 -0
  272. package/web/chunk-vxx451tt.js.gz +0 -0
  273. package/web/{chunk-hxqqy585.js → chunk-w8epfc0c.js} +1 -1
  274. package/web/chunk-w8epfc0c.js.br +0 -0
  275. package/web/chunk-w8epfc0c.js.gz +0 -0
  276. package/web/{chunk-shtvhd61.js → chunk-whgh2r7d.js} +1 -1
  277. package/web/chunk-whgh2r7d.js.br +0 -0
  278. package/web/chunk-whgh2r7d.js.gz +0 -0
  279. package/web/chunk-x0p1n5ws.js +1 -0
  280. package/web/chunk-x0p1n5ws.js.br +2 -0
  281. package/web/chunk-x0p1n5ws.js.gz +0 -0
  282. package/web/{chunk-jcbheqv1.js → chunk-x2tk9zeq.js} +1 -1
  283. package/web/chunk-x2tk9zeq.js.br +0 -0
  284. package/web/chunk-x2tk9zeq.js.gz +0 -0
  285. package/web/chunk-xbt045kt.js +1 -0
  286. package/web/chunk-xbt045kt.js.br +2 -0
  287. package/web/chunk-xbt045kt.js.gz +0 -0
  288. package/web/{chunk-f05s9gsw.js → chunk-xh3agbvb.js} +1 -1
  289. package/web/chunk-xh3agbvb.js.br +0 -0
  290. package/web/chunk-xh3agbvb.js.gz +0 -0
  291. package/web/{chunk-407zrkgx.js → chunk-xpw1spgj.js} +1 -1
  292. package/web/chunk-xpw1spgj.js.br +0 -0
  293. package/web/chunk-xpw1spgj.js.gz +0 -0
  294. package/web/{chunk-scwrkcdw.js → chunk-yp2jydfj.js} +1 -1
  295. package/web/chunk-yp2jydfj.js.br +0 -0
  296. package/web/chunk-yp2jydfj.js.gz +0 -0
  297. package/web/{chunk-g26mzwzc.js → chunk-yxp1es3b.js} +1 -1
  298. package/web/chunk-yxp1es3b.js.br +0 -0
  299. package/web/chunk-yxp1es3b.js.gz +0 -0
  300. package/web/{chunk-fmbc7t17.js → chunk-yzrww95m.js} +1 -1
  301. package/web/chunk-yzrww95m.js.br +0 -0
  302. package/web/chunk-yzrww95m.js.gz +0 -0
  303. package/web/{chunk-qgv81n98.js → chunk-z502b5p0.js} +1 -1
  304. package/web/chunk-z502b5p0.js.br +0 -0
  305. package/web/chunk-z502b5p0.js.gz +0 -0
  306. package/web/chunk-zny7cya7.js +1 -0
  307. package/web/chunk-zny7cya7.js.br +2 -0
  308. package/web/chunk-zny7cya7.js.gz +0 -0
  309. package/web/index.html +1 -1
  310. package/web/index.html.br +0 -0
  311. package/web/index.html.gz +0 -0
  312. package/web/chunk-00a6amwf.js.br +0 -0
  313. package/web/chunk-00a6amwf.js.gz +0 -0
  314. package/web/chunk-023b3kdx.js.br +0 -0
  315. package/web/chunk-023b3kdx.js.gz +0 -0
  316. package/web/chunk-1bzdt1n8.js +0 -1
  317. package/web/chunk-1bzdt1n8.js.br +0 -2
  318. package/web/chunk-1bzdt1n8.js.gz +0 -0
  319. package/web/chunk-1fnxbfkf.js.br +0 -0
  320. package/web/chunk-1fnxbfkf.js.gz +0 -0
  321. package/web/chunk-1qd75yjn.js.br +0 -0
  322. package/web/chunk-1qd75yjn.js.gz +0 -0
  323. package/web/chunk-20v068s6.js.br +0 -0
  324. package/web/chunk-20v068s6.js.gz +0 -0
  325. package/web/chunk-22jfhjk3.js.br +0 -0
  326. package/web/chunk-22jfhjk3.js.gz +0 -0
  327. package/web/chunk-37hn49td.js.br +0 -0
  328. package/web/chunk-37hn49td.js.gz +0 -0
  329. package/web/chunk-3crfxxst.js.br +0 -0
  330. package/web/chunk-3crfxxst.js.gz +0 -0
  331. package/web/chunk-3hg9a6xa.js +0 -1
  332. package/web/chunk-3hg9a6xa.js.br +0 -0
  333. package/web/chunk-3hg9a6xa.js.gz +0 -0
  334. package/web/chunk-3m2nnnk5.js.br +0 -0
  335. package/web/chunk-3m2nnnk5.js.gz +0 -0
  336. package/web/chunk-3ry5cjnp.js.br +0 -0
  337. package/web/chunk-3ry5cjnp.js.gz +0 -0
  338. package/web/chunk-407zrkgx.js.br +0 -0
  339. package/web/chunk-407zrkgx.js.gz +0 -0
  340. package/web/chunk-43e1ste5.js +0 -1
  341. package/web/chunk-43e1ste5.js.br +0 -0
  342. package/web/chunk-43e1ste5.js.gz +0 -0
  343. package/web/chunk-45ex0e3e.js.br +0 -0
  344. package/web/chunk-45ex0e3e.js.gz +0 -0
  345. package/web/chunk-508cpafz.js.br +0 -0
  346. package/web/chunk-508cpafz.js.gz +0 -0
  347. package/web/chunk-538r4sey.js +0 -1
  348. package/web/chunk-538r4sey.js.br +0 -0
  349. package/web/chunk-538r4sey.js.gz +0 -0
  350. package/web/chunk-55zs0yq1.js +0 -1
  351. package/web/chunk-55zs0yq1.js.br +0 -0
  352. package/web/chunk-55zs0yq1.js.gz +0 -0
  353. package/web/chunk-58gh3tbh.js.br +0 -0
  354. package/web/chunk-58gh3tbh.js.gz +0 -0
  355. package/web/chunk-5h3r1hpg.js.br +0 -0
  356. package/web/chunk-5h3r1hpg.js.gz +0 -0
  357. package/web/chunk-68q4nnmc.js.br +0 -3
  358. package/web/chunk-68q4nnmc.js.gz +0 -0
  359. package/web/chunk-6ktmzq32.js.br +0 -0
  360. package/web/chunk-6ktmzq32.js.gz +0 -0
  361. package/web/chunk-6ry6x1ez.js +0 -1
  362. package/web/chunk-6ry6x1ez.js.br +0 -0
  363. package/web/chunk-6ry6x1ez.js.gz +0 -0
  364. package/web/chunk-6wxxypbv.js.br +0 -0
  365. package/web/chunk-6wxxypbv.js.gz +0 -0
  366. package/web/chunk-6x9r1z9z.js.br +0 -0
  367. package/web/chunk-6x9r1z9z.js.gz +0 -0
  368. package/web/chunk-7devrtv4.js +0 -2
  369. package/web/chunk-7devrtv4.js.br +0 -3
  370. package/web/chunk-7devrtv4.js.gz +0 -0
  371. package/web/chunk-7rs26q98.js.br +0 -0
  372. package/web/chunk-7rs26q98.js.gz +0 -0
  373. package/web/chunk-82aqq58f.js.br +0 -0
  374. package/web/chunk-82aqq58f.js.gz +0 -0
  375. package/web/chunk-a1cpkzwh.js.br +0 -0
  376. package/web/chunk-a1cpkzwh.js.gz +0 -0
  377. package/web/chunk-a31z4c14.js.br +0 -0
  378. package/web/chunk-a31z4c14.js.gz +0 -0
  379. package/web/chunk-b07y0tzq.js.br +0 -0
  380. package/web/chunk-b07y0tzq.js.gz +0 -0
  381. package/web/chunk-b4d1948q.js.br +0 -0
  382. package/web/chunk-b4d1948q.js.gz +0 -0
  383. package/web/chunk-btk2h3vh.js.br +0 -0
  384. package/web/chunk-btk2h3vh.js.gz +0 -0
  385. package/web/chunk-c1s7faqj.js.br +0 -0
  386. package/web/chunk-c1s7faqj.js.gz +0 -0
  387. package/web/chunk-cgt871p9.js.br +0 -0
  388. package/web/chunk-cgt871p9.js.gz +0 -0
  389. package/web/chunk-crfbqd4d.js.br +0 -0
  390. package/web/chunk-crfbqd4d.js.gz +0 -0
  391. package/web/chunk-ctr4kt7p.js.br +0 -0
  392. package/web/chunk-ctr4kt7p.js.gz +0 -0
  393. package/web/chunk-d6wcabaa.css +0 -1
  394. package/web/chunk-d6wcabaa.css.br +0 -0
  395. package/web/chunk-d6wcabaa.css.gz +0 -0
  396. package/web/chunk-d7nrrcwp.js.br +0 -0
  397. package/web/chunk-d7nrrcwp.js.gz +0 -0
  398. package/web/chunk-df9ja645.js.br +0 -0
  399. package/web/chunk-df9ja645.js.gz +0 -0
  400. package/web/chunk-dhxc6xe9.js +0 -1
  401. package/web/chunk-dhxc6xe9.js.br +0 -2
  402. package/web/chunk-dhxc6xe9.js.gz +0 -0
  403. package/web/chunk-dy2egpw5.js.br +0 -0
  404. package/web/chunk-dy2egpw5.js.gz +0 -0
  405. package/web/chunk-eq59kad4.js.br +0 -0
  406. package/web/chunk-eq59kad4.js.gz +0 -0
  407. package/web/chunk-f05s9gsw.js.br +0 -0
  408. package/web/chunk-f05s9gsw.js.gz +0 -0
  409. package/web/chunk-f2bb976c.js.br +0 -0
  410. package/web/chunk-f2bb976c.js.gz +0 -0
  411. package/web/chunk-f4aabnnv.js +0 -1
  412. package/web/chunk-f4aabnnv.js.br +0 -0
  413. package/web/chunk-f4aabnnv.js.gz +0 -0
  414. package/web/chunk-fmbc7t17.js.br +0 -0
  415. package/web/chunk-fmbc7t17.js.gz +0 -0
  416. package/web/chunk-g0s2xxfd.js.br +0 -0
  417. package/web/chunk-g0s2xxfd.js.gz +0 -0
  418. package/web/chunk-g1k9nggh.js.br +0 -0
  419. package/web/chunk-g1k9nggh.js.gz +0 -0
  420. package/web/chunk-g26mzwzc.js.br +0 -0
  421. package/web/chunk-g26mzwzc.js.gz +0 -0
  422. package/web/chunk-g7b4p9k9.js.br +0 -0
  423. package/web/chunk-g7b4p9k9.js.gz +0 -0
  424. package/web/chunk-ghr3jf15.js.br +0 -0
  425. package/web/chunk-ghr3jf15.js.gz +0 -0
  426. package/web/chunk-gv4zh4er.js.br +0 -0
  427. package/web/chunk-gv4zh4er.js.gz +0 -0
  428. package/web/chunk-gw0e69yj.js +0 -1
  429. package/web/chunk-gw0e69yj.js.br +0 -0
  430. package/web/chunk-gw0e69yj.js.gz +0 -0
  431. package/web/chunk-gxwsf4t1.js.br +0 -0
  432. package/web/chunk-gxwsf4t1.js.gz +0 -0
  433. package/web/chunk-hh6vpvar.js.br +0 -0
  434. package/web/chunk-hh6vpvar.js.gz +0 -0
  435. package/web/chunk-hxqqy585.js.br +0 -0
  436. package/web/chunk-hxqqy585.js.gz +0 -0
  437. package/web/chunk-hxsrph02.js.br +0 -0
  438. package/web/chunk-hxsrph02.js.gz +0 -0
  439. package/web/chunk-hxx6ad4x.js +0 -1
  440. package/web/chunk-hxx6ad4x.js.br +0 -0
  441. package/web/chunk-hxx6ad4x.js.gz +0 -0
  442. package/web/chunk-j2gkg76r.js.br +0 -0
  443. package/web/chunk-j2gkg76r.js.gz +0 -0
  444. package/web/chunk-jcbheqv1.js.br +0 -0
  445. package/web/chunk-jcbheqv1.js.gz +0 -0
  446. package/web/chunk-jhx6v9es.js +0 -1
  447. package/web/chunk-jhx6v9es.js.br +0 -0
  448. package/web/chunk-jhx6v9es.js.gz +0 -0
  449. package/web/chunk-jnhem746.js.br +0 -0
  450. package/web/chunk-jnhem746.js.gz +0 -0
  451. package/web/chunk-jr796qsk.js +0 -1
  452. package/web/chunk-jr796qsk.js.br +0 -0
  453. package/web/chunk-jr796qsk.js.gz +0 -0
  454. package/web/chunk-jw92texh.js.br +0 -0
  455. package/web/chunk-jw92texh.js.gz +0 -0
  456. package/web/chunk-mvm0gvwj.js.br +0 -0
  457. package/web/chunk-mvm0gvwj.js.gz +0 -0
  458. package/web/chunk-n033azqs.js.br +0 -0
  459. package/web/chunk-n033azqs.js.gz +0 -0
  460. package/web/chunk-n0fqhrqv.js.br +0 -0
  461. package/web/chunk-n0fqhrqv.js.gz +0 -0
  462. package/web/chunk-n1p03ng0.js.br +0 -0
  463. package/web/chunk-n1p03ng0.js.gz +0 -0
  464. package/web/chunk-nb73fq72.js.br +0 -0
  465. package/web/chunk-nb73fq72.js.gz +0 -0
  466. package/web/chunk-nxnkb0w4.js.br +0 -0
  467. package/web/chunk-nxnkb0w4.js.gz +0 -0
  468. package/web/chunk-nymsmy8d.js.br +0 -0
  469. package/web/chunk-nymsmy8d.js.gz +0 -0
  470. package/web/chunk-nzqxb0ea.js +0 -1
  471. package/web/chunk-nzqxb0ea.js.br +0 -0
  472. package/web/chunk-nzqxb0ea.js.gz +0 -0
  473. package/web/chunk-p26b4zdm.js +0 -1
  474. package/web/chunk-p26b4zdm.js.br +0 -0
  475. package/web/chunk-p26b4zdm.js.gz +0 -0
  476. package/web/chunk-qa0wwff0.js.br +0 -0
  477. package/web/chunk-qa0wwff0.js.gz +0 -0
  478. package/web/chunk-qgv81n98.js.br +0 -0
  479. package/web/chunk-qgv81n98.js.gz +0 -0
  480. package/web/chunk-qtwjt5mm.js.br +0 -0
  481. package/web/chunk-qtwjt5mm.js.gz +0 -0
  482. package/web/chunk-r49dy5vx.js +0 -1
  483. package/web/chunk-r49dy5vx.js.br +0 -0
  484. package/web/chunk-r49dy5vx.js.gz +0 -0
  485. package/web/chunk-r97hd8wk.js.br +0 -0
  486. package/web/chunk-r97hd8wk.js.gz +0 -0
  487. package/web/chunk-sb61aqg8.js.br +0 -0
  488. package/web/chunk-sb61aqg8.js.gz +0 -0
  489. package/web/chunk-scwrkcdw.js.br +0 -0
  490. package/web/chunk-scwrkcdw.js.gz +0 -0
  491. package/web/chunk-shtvhd61.js.br +0 -0
  492. package/web/chunk-shtvhd61.js.gz +0 -0
  493. package/web/chunk-t5e9vh89.js +0 -1
  494. package/web/chunk-t5e9vh89.js.br +0 -0
  495. package/web/chunk-t5e9vh89.js.gz +0 -0
  496. package/web/chunk-tefm9md2.js.br +0 -0
  497. package/web/chunk-tefm9md2.js.gz +0 -0
  498. package/web/chunk-tr7fg3tv.js +0 -8
  499. package/web/chunk-tr7fg3tv.js.br +0 -0
  500. package/web/chunk-tr7fg3tv.js.gz +0 -0
  501. package/web/chunk-v5xf47q0.js +0 -1
  502. package/web/chunk-v5xf47q0.js.br +0 -0
  503. package/web/chunk-v5xf47q0.js.gz +0 -0
  504. package/web/chunk-vwms8c7b.js.br +0 -0
  505. package/web/chunk-vwms8c7b.js.gz +0 -0
  506. package/web/chunk-w2gy2tmp.js.br +0 -0
  507. package/web/chunk-w2gy2tmp.js.gz +0 -0
  508. package/web/chunk-whfh2wev.js.br +0 -0
  509. package/web/chunk-whfh2wev.js.gz +0 -0
  510. package/web/chunk-wjecy48x.js.br +0 -0
  511. package/web/chunk-wjecy48x.js.gz +0 -0
  512. package/web/chunk-wqmyjj6w.js.br +0 -0
  513. package/web/chunk-wqmyjj6w.js.gz +0 -0
  514. package/web/chunk-wv83gygp.js.br +0 -0
  515. package/web/chunk-wv83gygp.js.gz +0 -0
  516. package/web/chunk-x1gr0017.js.br +0 -0
  517. package/web/chunk-x1gr0017.js.gz +0 -0
  518. package/web/chunk-xa9m0mh2.js.br +0 -0
  519. package/web/chunk-xa9m0mh2.js.gz +0 -0
  520. package/web/chunk-xjbxndxz.js.br +0 -0
  521. package/web/chunk-xjbxndxz.js.gz +0 -0
  522. package/web/chunk-xsfmh8rr.js.br +0 -0
  523. package/web/chunk-xsfmh8rr.js.gz +0 -0
  524. package/web/chunk-xvsb3w1f.js +0 -1
  525. package/web/chunk-xvsb3w1f.js.br +0 -0
  526. package/web/chunk-xvsb3w1f.js.gz +0 -0
  527. package/web/chunk-ynpx7j96.js +0 -1
  528. package/web/chunk-ynpx7j96.js.br +0 -0
  529. package/web/chunk-ynpx7j96.js.gz +0 -0
  530. package/web/chunk-z04ncfs3.js.br +0 -0
  531. package/web/chunk-z04ncfs3.js.gz +0 -0
  532. package/web/chunk-zapwrc5k.js.br +0 -0
  533. package/web/chunk-zapwrc5k.js.gz +0 -0
  534. package/web/chunk-zs7physk.js.br +0 -0
  535. package/web/chunk-zs7physk.js.gz +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{z,st,at,t,m,ua,pa,wa,xa,va,$e}from"./chunk-45wfmdts.js";import"./chunk-xpc75mkw.js";import{ot,_t,Un,q,n,l,X,$r,F,S,i,se,s,y,it,b,ye,Vt,Vo,Zi,Wr,es,ts,Te,T,Je,U,Ze,Oe,c,de,mt,Hr,qr,Gr,dr,ht,k,O,G,he,Le,fe,ei,gr,re,yr,br,Z,Vr}from"./chunk-yztc2q9q.js";import"./chunk-bh29df86.js";import{Ge,ur,Dr,Nr,Ur,L,v,Ji,oa,Dn,sa}from"./chunk-ken7ras9.js";import{bi,kr,Cs,Ft,Rs,hn,Is,tr,R,Ms,Bt,rr,to,Si,Os,ro,no,nr,fn,oo,io,so,ao,lo,co,Ls,wi,xi,vi,_i,Ei,Ai,Ti,Pi,kt,gn,Ds,ki,Ci,Ri,Ii,Mi,Oi,P,ve,nt,or}from"./chunk-206g40v9.js";import{Ui,Fs,Bs,go,yo,bo,So,wo}from"./chunk-10x1zefx.js";import"./chunk-qqfdg01g.js";import{A,Ie,xn,mo,ho,vn,fo,Wt}from"./chunk-vnxjcym9.js";import{Gi,Do,No,zi,ji}from"./chunk-tzbefwf0.js";import{ut,He,Ss,cn,un,Xn,Jn,pn,Zn,mn}from"./chunk-x3g1bzq6.js";import{Pr}from"./chunk-j01t6mnq.js";import{yn,Li}from"./chunk-ax823t5v.js";import{zs,Pn,Vi,Rr,Ki,js,Vs}from"./chunk-t7fwvzmh.js";import{h,f,g,Qs,Ys,Js,Zs,ea,ta,ra,na}from"./chunk-acd2cwza.js";import{ze,ae,di,d}from"./chunk-rj6qknjx.js";import{a,r,u}from"./chunk-wwazj6mz.js";var yc=r(function(Xx){Object.defineProperty(Xx,"__esModule",{value:!0});Xx.regexpCode=Xx.getEsmExportName=Xx.getProperty=Xx.safeStringify=Xx.stringify=Xx.strConcat=Xx.addCodeArg=Xx.str=Xx._=Xx.nil=Xx._Code=Xx.Name=Xx.IDENTIFIER=Xx._CodeOrName=void 0;class Ru{}Xx._CodeOrName=Ru;Xx.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Br extends Ru{constructor(e){super();if(!Xx.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Xx.Name=Br;class Ha extends Ru{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((o,p)=>`${o}${p}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((o,p)=>{if(p instanceof Br)o[p.str]=(o[p.str]||0)+1;return o},{})}}Xx._Code=Ha;Xx.nil=new Ha("");function Kx(e,...o){let p=[e[0]],x=0;while(x<o.length)xm(p,o[x]),p.push(e[++x]);return new Ha(p)}Xx._=Kx;var fm=new Ha("+");function Yx(e,...o){let p=[xc(e[0])],x=0;while(x<o.length)p.push(fm),xm(p,o[x]),p.push(fm,xc(e[++x]));return v4(p),new Ha(p)}Xx.str=Yx;function xm(e,o){if(o instanceof Ha)e.push(...o._items);else if(o instanceof Br)e.push(o);else e.push(k4(o))}Xx.addCodeArg=xm;function v4(e){let o=1;while(o<e.length-1){if(e[o]===fm){let p=b4(e[o-1],e[o+1]);if(p!==void 0){e.splice(o-1,3,p);continue}e[o++]="+"}o++}}function b4(e,o){if(o==='""')return e;if(e==='""')return o;if(typeof e=="string"){if(o instanceof Br||e[e.length-1]!=='"')return;if(typeof o!="string")return`${e.slice(0,-1)}${o}"`;if(o[0]==='"')return e.slice(0,-1)+o.slice(1);return}if(typeof o=="string"&&o[0]==='"'&&!(e instanceof Br))return`"${e}${o.slice(1)}`;return}function w4(e,o){return o.emptyStr()?e:e.emptyStr()?o:Yx`${e}${o}`}Xx.strConcat=w4;function k4(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:xc(Array.isArray(e)?e.join(","):e)}function _4(e){return new Ha(xc(e))}Xx.stringify=_4;function xc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Xx.safeStringify=xc;function T4(e){return typeof e=="string"&&Xx.IDENTIFIER.test(e)?new Ha(`.${e}`):Kx`[${e}]`}Xx.getProperty=T4;function S4(e){if(typeof e=="string"&&Xx.IDENTIFIER.test(e))return new Ha(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Xx.getEsmExportName=S4;function E4(e){return new Ha(e.toString())}Xx.regexpCode=E4});var wm=r(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.ValueScope=ty.ValueScopeName=ty.Scope=ty.varKinds=ty.UsedValueState=void 0;var Pt=yc();class Zx extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Mu;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Mu||(ty.UsedValueState=Mu={}));ty.varKinds={const:new Pt.Name("const"),let:new Pt.Name("let"),var:new Pt.Name("var")};class vm{constructor({prefixes:e,parent:o}={}){this._names={},this._prefixes=e,this._parent=o}toName(e){return e instanceof Pt.Name?e:this.name(e)}name(e){return new Pt.Name(this._newName(e))}_newName(e){let o=this._names[e]||this._nameGroup(e);return`${e}${o.index++}`}_nameGroup(e){var o,p;if(((p=(o=this._parent)===null||o===void 0?void 0:o._prefixes)===null||p===void 0?void 0:p.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}ty.Scope=vm;class bm extends Pt.Name{constructor(e,o){super(o);this.prefix=e}setValue(e,{property:o,itemIndex:p}){this.value=e,this.scopePath=Pt._`.${new Pt.Name(o)}[${p}]`}}ty.ValueScopeName=bm;var B4=Pt._`\n`;class ey extends vm{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?B4:Pt.nil}}get(){return this._scope}name(e){return new bm(e,this._newName(e))}value(e,o){var p;if(o.ref===void 0)throw Error("CodeGen: ref must be passed in value");let x=this.toName(e),{prefix:w}=x,_=(p=o.key)!==null&&p!==void 0?p:o.ref,M=this._values[w];if(M){let I=M.get(_);if(I)return I}else M=this._values[w]=new Map;M.set(_,x);let E=this._scope[w]||(this._scope[w]=[]),C=E.length;return E[C]=o.ref,x.setValue(o,{property:w,itemIndex:C}),x}getValue(e,o){let p=this._values[e];if(!p)return;return p.get(o)}scopeRefs(e,o=this._values){return this._reduceValues(o,(p)=>{if(p.scopePath===void 0)throw Error(`CodeGen: name "${p}" has no value`);return Pt._`${e}${p.scopePath}`})}scopeCode(e=this._values,o,p){return this._reduceValues(e,(x)=>{if(x.value===void 0)throw Error(`CodeGen: name "${x}" has no value`);return x.value.code},o,p)}_reduceValues(e,o,p={},x){let w=Pt.nil;for(let _ in e){let M=e[_];if(!M)continue;let E=p[_]=p[_]||new Map;M.forEach((C)=>{if(E.has(C))return;E.set(C,Mu.Started);let I=o(C);if(I){let W=this.opts.es5?ty.varKinds.var:ty.varKinds.const;w=Pt._`${w}${W} ${C} = ${I};${this.opts._n}`}else if(I=x===null||x===void 0?void 0:x(C))w=Pt._`${w}${I}${this.opts._n}`;else throw new Zx(C);E.set(C,Mu.Completed)})}return w}}ty.ValueScope=ey});var wt=r(function(ha){Object.defineProperty(ha,"__esModule",{value:!0});ha.or=ha.and=ha.not=ha.CodeGen=ha.operators=ha.varKinds=ha.ValueScopeName=ha.ValueScope=ha.Scope=ha.Name=ha.regexpCode=ha.stringify=ha.getProperty=ha.nil=ha.strConcat=ha.str=ha._=void 0;var tt=yc(),Zt=wm(),Vn=yc();Object.defineProperty(ha,"_",{enumerable:!0,get:function(){return Vn._}});Object.defineProperty(ha,"str",{enumerable:!0,get:function(){return Vn.str}});Object.defineProperty(ha,"strConcat",{enumerable:!0,get:function(){return Vn.strConcat}});Object.defineProperty(ha,"nil",{enumerable:!0,get:function(){return Vn.nil}});Object.defineProperty(ha,"getProperty",{enumerable:!0,get:function(){return Vn.getProperty}});Object.defineProperty(ha,"stringify",{enumerable:!0,get:function(){return Vn.stringify}});Object.defineProperty(ha,"regexpCode",{enumerable:!0,get:function(){return Vn.regexpCode}});Object.defineProperty(ha,"Name",{enumerable:!0,get:function(){return Vn.Name}});var Ou=wm();Object.defineProperty(ha,"Scope",{enumerable:!0,get:function(){return Ou.Scope}});Object.defineProperty(ha,"ValueScope",{enumerable:!0,get:function(){return Ou.ValueScope}});Object.defineProperty(ha,"ValueScopeName",{enumerable:!0,get:function(){return Ou.ValueScopeName}});Object.defineProperty(ha,"varKinds",{enumerable:!0,get:function(){return Ou.varKinds}});ha.operators={GT:new tt._Code(">"),GTE:new tt._Code(">="),LT:new tt._Code("<"),LTE:new tt._Code("<="),EQ:new tt._Code("==="),NEQ:new tt._Code("!=="),NOT:new tt._Code("!"),OR:new tt._Code("||"),AND:new tt._Code("&&"),ADD:new tt._Code("+")};class Kn{optimizeNodes(){return this}optimizeNames(e,o){return this}}class ay extends Kn{constructor(e,o,p){super();this.varKind=e,this.name=o,this.rhs=p}render({es5:e,_n:o}){let p=e?Zt.varKinds.var:this.varKind,x=this.rhs===void 0?"":` = ${this.rhs}`;return`${p} ${this.name}${x};`+o}optimizeNames(e,o){if(!e[this.name.str])return;if(this.rhs)this.rhs=jr(this.rhs,e,o);return this}get names(){return this.rhs instanceof tt._CodeOrName?this.rhs.names:{}}}class Tm extends Kn{constructor(e,o,p){super();this.lhs=e,this.rhs=o,this.sideEffects=p}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,o){if(this.lhs instanceof tt.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=jr(this.rhs,e,o),this}get names(){let e=this.lhs instanceof tt.Name?{}:{...this.lhs.names};return Du(e,this.rhs)}}class ny extends Tm{constructor(e,o,p,x){super(e,p,x);this.op=o}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class sy extends Kn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class ry extends Kn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class oy extends Kn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class cy extends Kn{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,o){return this.code=jr(this.code,e,o),this}get names(){return this.code instanceof tt._CodeOrName?this.code.names:{}}}class Pu extends Kn{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((o,p)=>o+p.render(e),"")}optimizeNodes(){let{nodes:e}=this,o=e.length;while(o--){let p=e[o].optimizeNodes();if(Array.isArray(p))e.splice(o,1,...p);else if(p)e[o]=p;else e.splice(o,1)}return e.length>0?this:void 0}optimizeNames(e,o){let{nodes:p}=this,x=p.length;while(x--){let w=p[x];if(w.optimizeNames(e,o))continue;z4(e,w.names),p.splice(x,1)}return p.length>0?this:void 0}get names(){return this.nodes.reduce((e,o)=>qs(e,o.names),{})}}class Yn extends Pu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class uy extends Pu{}class vc extends Yn{}vc.kind="else";class In extends Yn{constructor(e,o){super(o);this.condition=e}render(e){let o=`if(${this.condition})`+super.render(e);if(this.else)o+="else "+this.else.render(e);return o}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let o=this.else;if(o){let p=o.optimizeNodes();o=this.else=Array.isArray(p)?new vc(p):p}if(o){if(e===!1)return o instanceof In?o:o.nodes;if(this.nodes.length)return this;return new In(hy(e),o instanceof In?[o]:o.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,o){var p;if(this.else=(p=this.else)===null||p===void 0?void 0:p.optimizeNames(e,o),!(super.optimizeNames(e,o)||this.else))return;return this.condition=jr(this.condition,e,o),this}get names(){let e=super.names;if(Du(e,this.condition),this.else)qs(e,this.else.names);return e}}In.kind="if";class Fr extends Yn{}Fr.kind="for";class py extends Fr{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,o){if(!super.optimizeNames(e,o))return;return this.iteration=jr(this.iteration,e,o),this}get names(){return qs(super.names,this.iteration.names)}}class ly extends Fr{constructor(e,o,p,x){super();this.varKind=e,this.name=o,this.from=p,this.to=x}render(e){let o=e.es5?Zt.varKinds.var:this.varKind,{name:p,from:x,to:w}=this;return`for(${o} ${p}=${x}; ${p}<${w}; ${p}++)`+super.render(e)}get names(){let e=Du(super.names,this.from);return Du(e,this.to)}}class km extends Fr{constructor(e,o,p,x){super();this.loop=e,this.varKind=o,this.name=p,this.iterable=x}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,o){if(!super.optimizeNames(e,o))return;return this.iterable=jr(this.iterable,e,o),this}get names(){return qs(super.names,this.iterable.names)}}class Lu extends Yn{constructor(e,o,p){super();this.name=e,this.args=o,this.async=p}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Lu.kind="func";class Cu extends Pu{render(e){return"return "+super.render(e)}}Cu.kind="return";class dy extends Yn{render(e){let o="try"+super.render(e);if(this.catch)o+=this.catch.render(e);if(this.finally)o+=this.finally.render(e);return o}optimizeNodes(){var e,o;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(o=this.finally)===null||o===void 0||o.optimizeNodes(),this}optimizeNames(e,o){var p,x;return super.optimizeNames(e,o),(p=this.catch)===null||p===void 0||p.optimizeNames(e,o),(x=this.finally)===null||x===void 0||x.optimizeNames(e,o),this}get names(){let e=super.names;if(this.catch)qs(e,this.catch.names);if(this.finally)qs(e,this.finally.names);return e}}class Iu extends Yn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Iu.kind="catch";class Wu extends Yn{render(e){return"finally"+super.render(e)}}Wu.kind="finally";class my{constructor(e,o={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...o,_n:o.lines?`
2
+ import{z,st,at,t,m,ua,pa,wa,xa,va,$e}from"./chunk-45wfmdts.js";import"./chunk-xpc75mkw.js";import{ot,_t,Un,q,n,l,X,$r,F,S,i,se,s,y,it,b,ye,Vt,Vo,Zi,Wr,es,ts,Te,T,Je,U,Ze,Oe,c,de,mt,Hr,qr,Gr,dr,ht,k,O,G,he,Le,fe,ei,gr,re,yr,br,Z,Vr}from"./chunk-yztc2q9q.js";import"./chunk-bh29df86.js";import{Ge,ur,Dr,Nr,Ur,L,v,Ji,oa,Dn,sa}from"./chunk-ken7ras9.js";import{bi,kr,Cs,Ft,Rs,hn,Is,tr,R,Ms,Bt,rr,to,Si,Os,ro,no,nr,fn,oo,io,so,ao,lo,co,Ls,wi,xi,vi,_i,Ei,Ai,Ti,Pi,kt,gn,Ds,ki,Ci,Ri,Ii,Mi,Oi,P,ve,nt,or}from"./chunk-206g40v9.js";import{Ui,Fs,Bs,go,yo,bo,So,wo}from"./chunk-10x1zefx.js";import"./chunk-qqfdg01g.js";import{A,Ie,xn,mo,ho,vn,fo,Wt}from"./chunk-vnxjcym9.js";import{Gi,Do,No,zi,ji}from"./chunk-tzbefwf0.js";import{ut,He,Ss,cn,un,Xn,Jn,pn,Zn,mn}from"./chunk-78yngmvf.js";import{Pr}from"./chunk-j01t6mnq.js";import{yn,Li}from"./chunk-ax823t5v.js";import{zs,Pn,Vi,Rr,Ki,js,Vs}from"./chunk-t7fwvzmh.js";import{h,f,g,Qs,Ys,Js,Zs,ea,ta,ra,na}from"./chunk-acd2cwza.js";import{ze,ae,di,d}from"./chunk-rj6qknjx.js";import{a,r,u}from"./chunk-wwazj6mz.js";var yc=r(function(Xx){Object.defineProperty(Xx,"__esModule",{value:!0});Xx.regexpCode=Xx.getEsmExportName=Xx.getProperty=Xx.safeStringify=Xx.stringify=Xx.strConcat=Xx.addCodeArg=Xx.str=Xx._=Xx.nil=Xx._Code=Xx.Name=Xx.IDENTIFIER=Xx._CodeOrName=void 0;class Ru{}Xx._CodeOrName=Ru;Xx.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Br extends Ru{constructor(e){super();if(!Xx.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Xx.Name=Br;class Ha extends Ru{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((o,p)=>`${o}${p}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((o,p)=>{if(p instanceof Br)o[p.str]=(o[p.str]||0)+1;return o},{})}}Xx._Code=Ha;Xx.nil=new Ha("");function Kx(e,...o){let p=[e[0]],x=0;while(x<o.length)xm(p,o[x]),p.push(e[++x]);return new Ha(p)}Xx._=Kx;var fm=new Ha("+");function Yx(e,...o){let p=[xc(e[0])],x=0;while(x<o.length)p.push(fm),xm(p,o[x]),p.push(fm,xc(e[++x]));return v4(p),new Ha(p)}Xx.str=Yx;function xm(e,o){if(o instanceof Ha)e.push(...o._items);else if(o instanceof Br)e.push(o);else e.push(k4(o))}Xx.addCodeArg=xm;function v4(e){let o=1;while(o<e.length-1){if(e[o]===fm){let p=b4(e[o-1],e[o+1]);if(p!==void 0){e.splice(o-1,3,p);continue}e[o++]="+"}o++}}function b4(e,o){if(o==='""')return e;if(e==='""')return o;if(typeof e=="string"){if(o instanceof Br||e[e.length-1]!=='"')return;if(typeof o!="string")return`${e.slice(0,-1)}${o}"`;if(o[0]==='"')return e.slice(0,-1)+o.slice(1);return}if(typeof o=="string"&&o[0]==='"'&&!(e instanceof Br))return`"${e}${o.slice(1)}`;return}function w4(e,o){return o.emptyStr()?e:e.emptyStr()?o:Yx`${e}${o}`}Xx.strConcat=w4;function k4(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:xc(Array.isArray(e)?e.join(","):e)}function _4(e){return new Ha(xc(e))}Xx.stringify=_4;function xc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Xx.safeStringify=xc;function T4(e){return typeof e=="string"&&Xx.IDENTIFIER.test(e)?new Ha(`.${e}`):Kx`[${e}]`}Xx.getProperty=T4;function S4(e){if(typeof e=="string"&&Xx.IDENTIFIER.test(e))return new Ha(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Xx.getEsmExportName=S4;function E4(e){return new Ha(e.toString())}Xx.regexpCode=E4});var wm=r(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.ValueScope=ty.ValueScopeName=ty.Scope=ty.varKinds=ty.UsedValueState=void 0;var Pt=yc();class Zx extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Mu;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Mu||(ty.UsedValueState=Mu={}));ty.varKinds={const:new Pt.Name("const"),let:new Pt.Name("let"),var:new Pt.Name("var")};class vm{constructor({prefixes:e,parent:o}={}){this._names={},this._prefixes=e,this._parent=o}toName(e){return e instanceof Pt.Name?e:this.name(e)}name(e){return new Pt.Name(this._newName(e))}_newName(e){let o=this._names[e]||this._nameGroup(e);return`${e}${o.index++}`}_nameGroup(e){var o,p;if(((p=(o=this._parent)===null||o===void 0?void 0:o._prefixes)===null||p===void 0?void 0:p.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}ty.Scope=vm;class bm extends Pt.Name{constructor(e,o){super(o);this.prefix=e}setValue(e,{property:o,itemIndex:p}){this.value=e,this.scopePath=Pt._`.${new Pt.Name(o)}[${p}]`}}ty.ValueScopeName=bm;var B4=Pt._`\n`;class ey extends vm{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?B4:Pt.nil}}get(){return this._scope}name(e){return new bm(e,this._newName(e))}value(e,o){var p;if(o.ref===void 0)throw Error("CodeGen: ref must be passed in value");let x=this.toName(e),{prefix:w}=x,_=(p=o.key)!==null&&p!==void 0?p:o.ref,M=this._values[w];if(M){let I=M.get(_);if(I)return I}else M=this._values[w]=new Map;M.set(_,x);let E=this._scope[w]||(this._scope[w]=[]),C=E.length;return E[C]=o.ref,x.setValue(o,{property:w,itemIndex:C}),x}getValue(e,o){let p=this._values[e];if(!p)return;return p.get(o)}scopeRefs(e,o=this._values){return this._reduceValues(o,(p)=>{if(p.scopePath===void 0)throw Error(`CodeGen: name "${p}" has no value`);return Pt._`${e}${p.scopePath}`})}scopeCode(e=this._values,o,p){return this._reduceValues(e,(x)=>{if(x.value===void 0)throw Error(`CodeGen: name "${x}" has no value`);return x.value.code},o,p)}_reduceValues(e,o,p={},x){let w=Pt.nil;for(let _ in e){let M=e[_];if(!M)continue;let E=p[_]=p[_]||new Map;M.forEach((C)=>{if(E.has(C))return;E.set(C,Mu.Started);let I=o(C);if(I){let W=this.opts.es5?ty.varKinds.var:ty.varKinds.const;w=Pt._`${w}${W} ${C} = ${I};${this.opts._n}`}else if(I=x===null||x===void 0?void 0:x(C))w=Pt._`${w}${I}${this.opts._n}`;else throw new Zx(C);E.set(C,Mu.Completed)})}return w}}ty.ValueScope=ey});var wt=r(function(ha){Object.defineProperty(ha,"__esModule",{value:!0});ha.or=ha.and=ha.not=ha.CodeGen=ha.operators=ha.varKinds=ha.ValueScopeName=ha.ValueScope=ha.Scope=ha.Name=ha.regexpCode=ha.stringify=ha.getProperty=ha.nil=ha.strConcat=ha.str=ha._=void 0;var tt=yc(),Zt=wm(),Vn=yc();Object.defineProperty(ha,"_",{enumerable:!0,get:function(){return Vn._}});Object.defineProperty(ha,"str",{enumerable:!0,get:function(){return Vn.str}});Object.defineProperty(ha,"strConcat",{enumerable:!0,get:function(){return Vn.strConcat}});Object.defineProperty(ha,"nil",{enumerable:!0,get:function(){return Vn.nil}});Object.defineProperty(ha,"getProperty",{enumerable:!0,get:function(){return Vn.getProperty}});Object.defineProperty(ha,"stringify",{enumerable:!0,get:function(){return Vn.stringify}});Object.defineProperty(ha,"regexpCode",{enumerable:!0,get:function(){return Vn.regexpCode}});Object.defineProperty(ha,"Name",{enumerable:!0,get:function(){return Vn.Name}});var Ou=wm();Object.defineProperty(ha,"Scope",{enumerable:!0,get:function(){return Ou.Scope}});Object.defineProperty(ha,"ValueScope",{enumerable:!0,get:function(){return Ou.ValueScope}});Object.defineProperty(ha,"ValueScopeName",{enumerable:!0,get:function(){return Ou.ValueScopeName}});Object.defineProperty(ha,"varKinds",{enumerable:!0,get:function(){return Ou.varKinds}});ha.operators={GT:new tt._Code(">"),GTE:new tt._Code(">="),LT:new tt._Code("<"),LTE:new tt._Code("<="),EQ:new tt._Code("==="),NEQ:new tt._Code("!=="),NOT:new tt._Code("!"),OR:new tt._Code("||"),AND:new tt._Code("&&"),ADD:new tt._Code("+")};class Kn{optimizeNodes(){return this}optimizeNames(e,o){return this}}class ay extends Kn{constructor(e,o,p){super();this.varKind=e,this.name=o,this.rhs=p}render({es5:e,_n:o}){let p=e?Zt.varKinds.var:this.varKind,x=this.rhs===void 0?"":` = ${this.rhs}`;return`${p} ${this.name}${x};`+o}optimizeNames(e,o){if(!e[this.name.str])return;if(this.rhs)this.rhs=jr(this.rhs,e,o);return this}get names(){return this.rhs instanceof tt._CodeOrName?this.rhs.names:{}}}class Tm extends Kn{constructor(e,o,p){super();this.lhs=e,this.rhs=o,this.sideEffects=p}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,o){if(this.lhs instanceof tt.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=jr(this.rhs,e,o),this}get names(){let e=this.lhs instanceof tt.Name?{}:{...this.lhs.names};return Du(e,this.rhs)}}class ny extends Tm{constructor(e,o,p,x){super(e,p,x);this.op=o}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class sy extends Kn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class ry extends Kn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class oy extends Kn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class cy extends Kn{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,o){return this.code=jr(this.code,e,o),this}get names(){return this.code instanceof tt._CodeOrName?this.code.names:{}}}class Pu extends Kn{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((o,p)=>o+p.render(e),"")}optimizeNodes(){let{nodes:e}=this,o=e.length;while(o--){let p=e[o].optimizeNodes();if(Array.isArray(p))e.splice(o,1,...p);else if(p)e[o]=p;else e.splice(o,1)}return e.length>0?this:void 0}optimizeNames(e,o){let{nodes:p}=this,x=p.length;while(x--){let w=p[x];if(w.optimizeNames(e,o))continue;z4(e,w.names),p.splice(x,1)}return p.length>0?this:void 0}get names(){return this.nodes.reduce((e,o)=>qs(e,o.names),{})}}class Yn extends Pu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class uy extends Pu{}class vc extends Yn{}vc.kind="else";class In extends Yn{constructor(e,o){super(o);this.condition=e}render(e){let o=`if(${this.condition})`+super.render(e);if(this.else)o+="else "+this.else.render(e);return o}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let o=this.else;if(o){let p=o.optimizeNodes();o=this.else=Array.isArray(p)?new vc(p):p}if(o){if(e===!1)return o instanceof In?o:o.nodes;if(this.nodes.length)return this;return new In(hy(e),o instanceof In?[o]:o.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,o){var p;if(this.else=(p=this.else)===null||p===void 0?void 0:p.optimizeNames(e,o),!(super.optimizeNames(e,o)||this.else))return;return this.condition=jr(this.condition,e,o),this}get names(){let e=super.names;if(Du(e,this.condition),this.else)qs(e,this.else.names);return e}}In.kind="if";class Fr extends Yn{}Fr.kind="for";class py extends Fr{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,o){if(!super.optimizeNames(e,o))return;return this.iteration=jr(this.iteration,e,o),this}get names(){return qs(super.names,this.iteration.names)}}class ly extends Fr{constructor(e,o,p,x){super();this.varKind=e,this.name=o,this.from=p,this.to=x}render(e){let o=e.es5?Zt.varKinds.var:this.varKind,{name:p,from:x,to:w}=this;return`for(${o} ${p}=${x}; ${p}<${w}; ${p}++)`+super.render(e)}get names(){let e=Du(super.names,this.from);return Du(e,this.to)}}class km extends Fr{constructor(e,o,p,x){super();this.loop=e,this.varKind=o,this.name=p,this.iterable=x}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,o){if(!super.optimizeNames(e,o))return;return this.iterable=jr(this.iterable,e,o),this}get names(){return qs(super.names,this.iterable.names)}}class Lu extends Yn{constructor(e,o,p){super();this.name=e,this.args=o,this.async=p}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Lu.kind="func";class Cu extends Pu{render(e){return"return "+super.render(e)}}Cu.kind="return";class dy extends Yn{render(e){let o="try"+super.render(e);if(this.catch)o+=this.catch.render(e);if(this.finally)o+=this.finally.render(e);return o}optimizeNodes(){var e,o;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(o=this.finally)===null||o===void 0||o.optimizeNodes(),this}optimizeNames(e,o){var p,x;return super.optimizeNames(e,o),(p=this.catch)===null||p===void 0||p.optimizeNames(e,o),(x=this.finally)===null||x===void 0||x.optimizeNames(e,o),this}get names(){let e=super.names;if(this.catch)qs(e,this.catch.names);if(this.finally)qs(e,this.finally.names);return e}}class Iu extends Yn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Iu.kind="catch";class Wu extends Yn{render(e){return"finally"+super.render(e)}}Wu.kind="finally";class my{constructor(e,o={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...o,_n:o.lines?`
3
3
  `:""},this._extScope=e,this._scope=new Zt.Scope({parent:e}),this._nodes=[new uy]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,o){let p=this._extScope.value(e,o);return(this._values[p.prefix]||(this._values[p.prefix]=new Set)).add(p),p}getScopeValue(e,o){return this._extScope.getValue(e,o)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,o,p,x){let w=this._scope.toName(o);if(p!==void 0&&x)this._constants[w.str]=p;return this._leafNode(new ay(e,w,p)),w}const(e,o,p){return this._def(Zt.varKinds.const,e,o,p)}let(e,o,p){return this._def(Zt.varKinds.let,e,o,p)}var(e,o,p){return this._def(Zt.varKinds.var,e,o,p)}assign(e,o,p){return this._leafNode(new Tm(e,o,p))}add(e,o){return this._leafNode(new ny(e,ha.operators.ADD,o))}code(e){if(typeof e=="function")e();else if(e!==tt.nil)this._leafNode(new cy(e));return this}object(...e){let o=["{"];for(let[p,x]of e){if(o.length>1)o.push(",");if(o.push(p),p!==x||this.opts.es5)o.push(":"),tt.addCodeArg(o,x)}return o.push("}"),new tt._Code(o)}if(e,o,p){if(this._blockNode(new In(e)),o&&p)this.code(o).else().code(p).endIf();else if(o)this.code(o).endIf();else if(p)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new In(e))}else(){return this._elseNode(new vc)}endIf(){return this._endBlockNode(In,vc)}_for(e,o){if(this._blockNode(e),o)this.code(o).endFor();return this}for(e,o){return this._for(new py(e),o)}forRange(e,o,p,x,w=this.opts.es5?Zt.varKinds.var:Zt.varKinds.let){let _=this._scope.toName(e);return this._for(new ly(w,_,o,p),()=>x(_))}forOf(e,o,p,x=Zt.varKinds.const){let w=this._scope.toName(e);if(this.opts.es5){let _=o instanceof tt.Name?o:this.var("_arr",o);return this.forRange("_i",0,tt._`${_}.length`,(M)=>{this.var(w,tt._`${_}[${M}]`),p(w)})}return this._for(new km("of",x,w,o),()=>p(w))}forIn(e,o,p,x=this.opts.es5?Zt.varKinds.var:Zt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,tt._`Object.keys(${o})`,p);let w=this._scope.toName(e);return this._for(new km("in",x,w,o),()=>p(w))}endFor(){return this._endBlockNode(Fr)}label(e){return this._leafNode(new sy(e))}break(e){return this._leafNode(new ry(e))}return(e){let o=new Cu;if(this._blockNode(o),this.code(e),o.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Cu)}try(e,o,p){if(!o&&!p)throw Error('CodeGen: "try" without "catch" and "finally"');let x=new dy;if(this._blockNode(x),this.code(e),o){let w=this.name("e");this._currNode=x.catch=new Iu(w),o(w)}if(p)this._currNode=x.finally=new Wu,this.code(p);return this._endBlockNode(Iu,Wu)}throw(e){return this._leafNode(new oy(e))}block(e,o){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(o);return this}endBlock(e){let o=this._blockStarts.pop();if(o===void 0)throw Error("CodeGen: not in self-balancing block");let p=this._nodes.length-o;if(p<0||e!==void 0&&p!==e)throw Error(`CodeGen: wrong number of nodes: ${p} vs ${e} expected`);return this._nodes.length=o,this}func(e,o=tt.nil,p,x){if(this._blockNode(new Lu(e,o,p)),x)this.code(x).endFunc();return this}endFunc(){return this._endBlockNode(Lu)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,o){let p=this._currNode;if(p instanceof e||o&&p instanceof o)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${o?`${e.kind}/${o.kind}`:e.kind}"`)}_elseNode(e){let o=this._currNode;if(!(o instanceof In))throw Error('CodeGen: "else" without "if"');return this._currNode=o.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let o=this._nodes;o[o.length-1]=e}}ha.CodeGen=my;function qs(e,o){for(let p in o)e[p]=(e[p]||0)+(o[p]||0);return e}function Du(e,o){return o instanceof tt._CodeOrName?qs(e,o.names):e}function jr(e,o,p){if(e instanceof tt.Name)return x(e);if(!w(e))return e;return new tt._Code(e._items.reduce((_,M)=>{if(M instanceof tt.Name)M=x(M);if(M instanceof tt._Code)_.push(...M._items);else _.push(M);return _},[]));function x(_){let M=p[_.str];if(M===void 0||o[_.str]!==1)return _;return delete o[_.str],M}function w(_){return _ instanceof tt._Code&&_._items.some((M)=>M instanceof tt.Name&&o[M.str]===1&&p[M.str]!==void 0)}}function z4(e,o){for(let p in o)e[p]=(e[p]||0)-(o[p]||0)}function hy(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:tt._`!${_m(e)}`}ha.not=hy;var q4=gy(ha.operators.AND);function $4(...e){return e.reduce(q4)}ha.and=$4;var Q4=gy(ha.operators.OR);function G4(...e){return e.reduce(Q4)}ha.or=G4;function gy(e){return(o,p)=>o===tt.nil?p:p===tt.nil?o:tt._`${_m(o)} ${e} ${_m(p)}`}function _m(e){return e instanceof tt.Name?e:tt._`(${e})`}});var Rt=r(function(Sy){Object.defineProperty(Sy,"__esModule",{value:!0});Sy.checkStrictMode=Sy.getErrorPath=Sy.Type=Sy.useFunc=Sy.setEvaluated=Sy.evaluatedPropsToName=Sy.mergeEvaluated=Sy.eachItem=Sy.unescapeJsonPointer=Sy.escapeJsonPointer=Sy.escapeFragment=Sy.unescapeFragment=Sy.schemaRefOrVal=Sy.schemaHasRulesButRef=Sy.schemaHasRules=Sy.checkUnknownRules=Sy.alwaysValidSchema=Sy.toHash=void 0;var dt=wt(),vy=yc();function X4(e){let o={};for(let p of e)o[p]=!0;return o}Sy.toHash=X4;function J4(e,o){if(typeof o=="boolean")return o;if(Object.keys(o).length===0)return!0;return by(e,o),!wy(o,e.self.RULES.all)}Sy.alwaysValidSchema=J4;function by(e,o=e.schema){let{opts:p,self:x}=e;if(!p.strictSchema)return;if(typeof o==="boolean")return;let w=x.RULES.keywords;for(let _ in o)if(!w[_])Ty(e,`unknown keyword: "${_}"`)}Sy.checkUnknownRules=by;function wy(e,o){if(typeof e=="boolean")return!e;for(let p in e)if(o[p])return!0;return!1}Sy.schemaHasRules=wy;function Z4(e,o){if(typeof e=="boolean")return!e;for(let p in e)if(p!=="$ref"&&o.all[p])return!0;return!1}Sy.schemaHasRulesButRef=Z4;function e3({topSchemaRef:e,schemaPath:o},p,x,w){if(!w){if(typeof p=="number"||typeof p=="boolean")return p;if(typeof p=="string")return dt._`${p}`}return dt._`${e}${o}${dt.getProperty(x)}`}Sy.schemaRefOrVal=e3;function t3(e){return ky(decodeURIComponent(e))}Sy.unescapeFragment=t3;function i3(e){return encodeURIComponent(Em(e))}Sy.escapeFragment=i3;function Em(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Sy.escapeJsonPointer=Em;function ky(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Sy.unescapeJsonPointer=ky;function a3(e,o){if(Array.isArray(e))for(let p of e)o(p);else o(e)}Sy.eachItem=a3;function xy({mergeNames:e,mergeToName:o,mergeValues:p,resultToName:x}){return(w,_,M,E)=>{let C=M===void 0?_:M instanceof dt.Name?(_ instanceof dt.Name?e(w,_,M):o(w,_,M),M):_ instanceof dt.Name?(o(w,M,_),_):p(_,M);return E===dt.Name&&!(C instanceof dt.Name)?x(w,C):C}}Sy.mergeEvaluated={props:xy({mergeNames:(e,o,p)=>e.if(dt._`${p} !== true && ${o} !== undefined`,()=>{e.if(dt._`${o} === true`,()=>e.assign(p,!0),()=>e.assign(p,dt._`${p} || {}`).code(dt._`Object.assign(${p}, ${o})`))}),mergeToName:(e,o,p)=>e.if(dt._`${p} !== true`,()=>{if(o===!0)e.assign(p,!0);else e.assign(p,dt._`${p} || {}`),Rm(e,p,o)}),mergeValues:(e,o)=>e===!0?!0:{...e,...o},resultToName:_y}),items:xy({mergeNames:(e,o,p)=>e.if(dt._`${p} !== true && ${o} !== undefined`,()=>e.assign(p,dt._`${o} === true ? true : ${p} > ${o} ? ${p} : ${o}`)),mergeToName:(e,o,p)=>e.if(dt._`${p} !== true`,()=>e.assign(p,o===!0?!0:dt._`${p} > ${o} ? ${p} : ${o}`)),mergeValues:(e,o)=>e===!0?!0:Math.max(e,o),resultToName:(e,o)=>e.var("items",o)})};function _y(e,o){if(o===!0)return e.var("props",!0);let p=e.var("props",dt._`{}`);if(o!==void 0)Rm(e,p,o);return p}Sy.evaluatedPropsToName=_y;function Rm(e,o,p){Object.keys(p).forEach((x)=>e.assign(dt._`${o}${dt.getProperty(x)}`,!0))}Sy.setEvaluated=Rm;var yy={};function n3(e,o){return e.scopeValue("func",{ref:o,code:yy[o.code]||(yy[o.code]=new vy._Code(o.code))})}Sy.useFunc=n3;var Sm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Sm||(Sy.Type=Sm={}));function s3(e,o,p){if(e instanceof dt.Name){let x=o===Sm.Num;return p?x?dt._`"[" + ${e} + "]"`:dt._`"['" + ${e} + "']"`:x?dt._`"/" + ${e}`:dt._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return p?dt.getProperty(e).toString():"/"+Em(e)}Sy.getErrorPath=s3;function Ty(e,o,p=e.opts.strictSchema){if(!p)return;if(o=`strict mode: ${o}`,p===!0)throw Error(o);e.self.logger.warn(o)}Sy.checkStrictMode=Ty});var Wn=r(function(Ry){Object.defineProperty(Ry,"__esModule",{value:!0});var Mt=wt(),_3={data:new Mt.Name("data"),valCxt:new Mt.Name("valCxt"),instancePath:new Mt.Name("instancePath"),parentData:new Mt.Name("parentData"),parentDataProperty:new Mt.Name("parentDataProperty"),rootData:new Mt.Name("rootData"),dynamicAnchors:new Mt.Name("dynamicAnchors"),vErrors:new Mt.Name("vErrors"),errors:new Mt.Name("errors"),this:new Mt.Name("this"),self:new Mt.Name("self"),scope:new Mt.Name("scope"),json:new Mt.Name("json"),jsonPos:new Mt.Name("jsonPos"),jsonLen:new Mt.Name("jsonLen"),jsonPart:new Mt.Name("jsonPart")};Ry.default=_3});var bc=r(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});Cy.extendErrors=Cy.resetErrorsCount=Cy.reportExtraError=Cy.reportError=Cy.keyword$DataError=Cy.keywordError=void 0;var rt=wt(),is=Rt(),aa=Wn();Cy.keywordError={message:({keyword:e})=>rt.str`must pass "${e}" keyword validation`};Cy.keyword$DataError={message:({keyword:e,schemaType:o})=>o?rt.str`"${e}" keyword must be ${o} ($data)`:rt.str`"${e}" keyword is invalid ($data)`};function S3(e,o=Cy.keywordError,p,x){let{it:w}=e,{gen:_,compositeRule:M,allErrors:E}=w,C=Ly(e,o,p);if(x!==null&&x!==void 0?x:M||E)Ay(_,C);else My(w,rt._`[${C}]`)}Cy.reportError=S3;function E3(e,o=Cy.keywordError,p){let{it:x}=e,{gen:w,compositeRule:_,allErrors:M}=x,E=Ly(e,o,p);if(Ay(w,E),!(_||M))My(x,aa.default.vErrors)}Cy.reportExtraError=E3;function R3(e,o){e.assign(aa.default.errors,o),e.if(rt._`${aa.default.vErrors} !== null`,()=>e.if(o,()=>e.assign(rt._`${aa.default.vErrors}.length`,o),()=>e.assign(aa.default.vErrors,null)))}Cy.resetErrorsCount=R3;function A3({gen:e,keyword:o,schemaValue:p,data:x,errsCount:w,it:_}){if(w===void 0)throw Error("ajv implementation error");let M=e.name("err");e.forRange("i",w,aa.default.errors,(E)=>{if(e.const(M,rt._`${aa.default.vErrors}[${E}]`),e.if(rt._`${M}.instancePath === undefined`,()=>e.assign(rt._`${M}.instancePath`,rt.strConcat(aa.default.instancePath,_.errorPath))),e.assign(rt._`${M}.schemaPath`,rt.str`${_.errSchemaPath}/${o}`),_.opts.verbose)e.assign(rt._`${M}.schema`,p),e.assign(rt._`${M}.data`,x)})}Cy.extendErrors=A3;function Ay(e,o){let p=e.const("err",o);e.if(rt._`${aa.default.vErrors} === null`,()=>e.assign(aa.default.vErrors,rt._`[${p}]`),rt._`${aa.default.vErrors}.push(${p})`),e.code(rt._`${aa.default.errors}++`)}function My(e,o){let{gen:p,validateName:x,schemaEnv:w}=e;if(w.$async)p.throw(rt._`new ${e.ValidationError}(${o})`);else p.assign(rt._`${x}.errors`,o),p.return(!1)}var $s={keyword:new rt.Name("keyword"),schemaPath:new rt.Name("schemaPath"),params:new rt.Name("params"),propertyName:new rt.Name("propertyName"),message:new rt.Name("message"),schema:new rt.Name("schema"),parentSchema:new rt.Name("parentSchema")};function Ly(e,o,p){let{createErrors:x}=e.it;if(x===!1)return rt._`{}`;return M3(e,o,p)}function M3(e,o,p={}){let{gen:x,it:w}=e,_=[L3(w,p),C3(e,p)];return I3(e,o,_),x.object(..._)}function L3({errorPath:e},{instancePath:o}){let p=o?rt.str`${e}${is.getErrorPath(o,is.Type.Str)}`:e;return[aa.default.instancePath,rt.strConcat(aa.default.instancePath,p)]}function C3({keyword:e,it:{errSchemaPath:o}},{schemaPath:p,parentSchema:x}){let w=x?o:rt.str`${o}/${e}`;if(p)w=rt.str`${w}${is.getErrorPath(p,is.Type.Str)}`;return[$s.schemaPath,w]}function I3(e,{params:o,message:p},x){let{keyword:w,data:_,schemaValue:M,it:E}=e,{opts:C,propertyName:I,topSchemaRef:W,schemaPath:D}=E;if(x.push([$s.keyword,w],[$s.params,typeof o=="function"?o(e):o||rt._`{}`]),C.messages)x.push([$s.message,typeof p=="function"?p(e):p]);if(C.verbose)x.push([$s.schema,M],[$s.parentSchema,rt._`${W}${D}`],[aa.default.data,_]);if(I)x.push([$s.propertyName,I])}});var Ny=r(function(Py){Object.defineProperty(Py,"__esModule",{value:!0});Py.boolOrEmptySchema=Py.topBoolOrEmptySchema=void 0;var Wy=bc(),Dy=wt(),U3=Wn(),N3={message:"boolean schema is false"};function B3(e){let{gen:o,schema:p,validateName:x}=e;if(p===!1)Oy(e,!1);else if(typeof p=="object"&&p.$async===!0)o.return(U3.default.data);else o.assign(Dy._`${x}.errors`,null),o.return(!0)}Py.topBoolOrEmptySchema=B3;function H3(e,o){let{gen:p,schema:x}=e;if(x===!1)p.var(o,!1),Oy(e);else p.var(o,!0)}Py.boolOrEmptySchema=H3;function Oy(e,o){let{gen:p,data:x}=e;Wy.reportError({gen:p,keyword:"false schema",data:x,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},N3,void 0,o)}});var Mm=r(function(By){Object.defineProperty(By,"__esModule",{value:!0});By.getRules=By.isJSONType=void 0;var j3=["string","number","integer","boolean","null","object","array"],z3=new Set(j3);function q3(e){return typeof e=="string"&&z3.has(e)}By.isJSONType=q3;function $3(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}By.getRules=$3});var Lm=r(function(zy){Object.defineProperty(zy,"__esModule",{value:!0});zy.shouldUseRule=zy.shouldUseGroup=zy.schemaHasRulesForType=void 0;function G3({schema:e,self:o},p){let x=o.RULES.types[p];return x&&x!==!0&&Fy(e,x)}zy.schemaHasRulesForType=G3;function Fy(e,o){return o.rules.some((p)=>jy(e,p))}zy.shouldUseGroup=Fy;function jy(e,o){var p;return e[o.keyword]!==void 0||((p=o.definition.implements)===null||p===void 0?void 0:p.some((x)=>e[x]!==void 0))}zy.shouldUseRule=jy});var wc=r(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});Yy.reportTypeError=Yy.checkDataTypes=Yy.checkDataType=Yy.coerceAndCheckDataType=Yy.getJSONTypes=Yy.getSchemaTypes=Yy.DataType=void 0;var $y=Mm(),Qy=Lm(),Gy=bc(),Ye=wt(),Nu=Rt(),zr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(zr||(Yy.DataType=zr={}));function Y3(e){let o=Vy(e.type);if(o.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!o.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)o.push("null")}return o}Yy.getSchemaTypes=Y3;function Vy(e){let o=Array.isArray(e)?e:e?[e]:[];if(o.every($y.isJSONType))return o;throw Error("type must be JSONType or JSONType[]: "+o.join(","))}Yy.getJSONTypes=Vy;function X3(e,o){let{gen:p,data:x,opts:w}=e,_=J3(o,w.coerceTypes),M=o.length>0&&!(_.length===0&&o.length===1&&Qy.schemaHasRulesForType(e,o[0]));if(M){let E=Im(o,x,w.strictNumbers,zr.Wrong);p.if(E,()=>{if(_.length)Z3(e,o,_);else Wm(e)})}return M}Yy.coerceAndCheckDataType=X3;var Ky=new Set(["string","number","integer","boolean","null"]);function J3(e,o){return o?e.filter((p)=>Ky.has(p)||o==="array"&&p==="array"):[]}function Z3(e,o,p){let{gen:x,data:w,opts:_}=e,M=x.let("dataType",Ye._`typeof ${w}`),E=x.let("coerced",Ye._`undefined`);if(_.coerceTypes==="array")x.if(Ye._`${M} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>x.assign(w,Ye._`${w}[0]`).assign(M,Ye._`typeof ${w}`).if(Im(o,w,_.strictNumbers),()=>x.assign(E,w)));x.if(Ye._`${E} !== undefined`);for(let I of p)if(Ky.has(I)||I==="array"&&_.coerceTypes==="array")C(I);x.else(),Wm(e),x.endIf(),x.if(Ye._`${E} !== undefined`,()=>{x.assign(w,E),eM(e,E)});function C(I){switch(I){case"string":x.elseIf(Ye._`${M} == "number" || ${M} == "boolean"`).assign(E,Ye._`"" + ${w}`).elseIf(Ye._`${w} === null`).assign(E,Ye._`""`);return;case"number":x.elseIf(Ye._`${M} == "boolean" || ${w} === null
4
4
  || (${M} == "string" && ${w} && ${w} == +${w})`).assign(E,Ye._`+${w}`);return;case"integer":x.elseIf(Ye._`${M} === "boolean" || ${w} === null
5
5
  || (${M} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(E,Ye._`+${w}`);return;case"boolean":x.elseIf(Ye._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(E,!1).elseIf(Ye._`${w} === "true" || ${w} === 1`).assign(E,!0);return;case"null":x.elseIf(Ye._`${w} === "" || ${w} === 0 || ${w} === false`),x.assign(E,null);return;case"array":x.elseIf(Ye._`${M} === "string" || ${M} === "number"
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yr,oi}from"./chunk-45wfmdts.js";var ut={name:"@basalt/cli",version:"0.1.27",private:!0,type:"module",imports:{"#*":"./src/*","#test/*":"./test/*"},bin:{basalt:"./src/main.ts"},scripts:{typecheck:"tsgo --noEmit -p ."},dependencies:{"@basalt/builtins":"workspace:*","@basalt/core":"workspace:*","@basalt/protocol":"workspace:*","@basalt/server":"workspace:*","@basalt/web":"workspace:*","@earendil-works/pi-ai":"1.2.0"},exports:{"./plugin-sdk":"./src/plugin-sdk.ts"}};import{mkdirSync as vt}from"fs";import{join as Tt}from"path";import{existsSync as d,mkdirSync as h,rmSync as f,writeFileSync as T}from"fs";import{homedir as P}from"os";import{dirname as x,join as l}from"path";import{closeSync as J,existsSync as B,mkdirSync as q,openSync as K,readdirSync as X,readFileSync as p,rmSync as Q,writeFileSync as tt}from"fs";import{join as g,resolve as N}from"path";var _=20000,rt=262144;function a(t){return g(t,"basalt.log")}function k(t){try{let r=JSON.parse(p(t,"utf8"));if(typeof r!=="object"||r===null)return;let e=r;if(typeof e.pid!=="number"||!Number.isInteger(e.pid)||e.pid<=0)return;if(typeof e.url!=="string")return;let n=new URL(e.url);if(n.protocol!=="http:"&&n.protocol!=="https:")return;let s=Array.isArray(e.argv)&&e.argv.every((i)=>typeof i==="string")?e.argv.map((i)=>String(i)):void 0;return{pid:e.pid,url:e.url,...typeof e.hwnd==="number"&&Number.isInteger(e.hwnd)&&e.hwnd>0?{hwnd:e.hwnd}:{},...s?{argv:s}:{},...typeof e.cwd==="string"&&e.cwd?{cwd:e.cwd}:{},...typeof e.secret==="string"&&e.secret?{secret:e.secret}:{}}}catch{return}}function A(t){try{return process.kill(t,0),!0}catch{return!1}}async function He(t,r){let e=g(t,"server.json");if(!B(e))return;let n=k(e);if(!n||r!==void 0&&n.pid!==r)return;return v(n.pid)?n:void 0}async function I(t,r=1500){try{return(await fetch(`${t.url}/api/info`,{signal:AbortSignal.timeout(r)})).ok}catch{return!1}}function v(t){if(!u(t))return!1;let r=et(t);return r===void 0||/bun|basalt/i.test(r)}function u(t){if(!A(t))return!1;if(process.platform!=="linux")return!0;try{return p(`/proc/${t}/stat`,"utf8").split(") ")[1]?.[0]!=="Z"}catch{return!0}}function et(t){try{if(process.platform==="linux")return p(`/proc/${t}/cmdline`,"utf8");let r=process.platform==="win32"?Bun.spawnSync(["tasklist","/FI",`PID eq ${t}`,"/FO","CSV","/NH"],{windowsHide:!0}):Bun.spawnSync(["ps","-p",String(t),"-o","command="]);return r.success?r.stdout.toString():void 0}catch{return}}function Ss(t,r){q(t,{recursive:!0});let e=g(t,`${process.pid}.json`);return tt(e,JSON.stringify({dataDir:N(r)})),e}async function j(t){if(!B(t))return[];let r=[];for(let e of X(t)){let n=/^(\d+)\.json$/.exec(e);if(!n)continue;let s=g(t,e),i=Number(n[1]);if(!u(i)){Q(s,{force:!0});continue}let o;try{o=JSON.parse(p(s,"utf8"))}catch{continue}if(!o||typeof o!=="object"||!("dataDir"in o)||typeof o.dataDir!=="string")continue;let c=await He(o.dataDir,i);if(c)r.push({dataDir:o.dataDir,service:c})}return r}async function cn(t,r){if(r?.secret&&r.pid===t){let e=new URL(r.url);if(["127.0.0.1","localhost","[::1]"].includes(e.hostname))try{if((await fetch(new URL("/api/server/shutdown",e),{method:"POST",headers:{authorization:`Bearer ${r.secret}`},redirect:"error",signal:AbortSignal.timeout(2000)})).ok){for(let s=0;s<220&&u(t);s++)await Bun.sleep(100);if(!u(t))return}}catch(n){if(u(t))console.warn("\u6B63\u5E38\u5173\u505C\u8BF7\u6C42\u5931\u8D25\uFF0C\u56DE\u9000\u5230\u8FDB\u7A0B\u4FE1\u53F7\uFF1A",n instanceof Error?n.message:String(n))}}try{process.kill(t,"SIGTERM")}catch{return}for(let e=0;e<50&&u(t);e++)await Bun.sleep(100);if(u(t)){try{process.kill(t,"SIGKILL")}catch(e){if(!(e instanceof Error&&("code"in e)&&e.code==="ESRCH"))console.error(`\u65E0\u6CD5\u5F3A\u5236\u7ED3\u675F\u8FDB\u7A0B ${t}\uFF1A`,e)}await Bun.sleep(200)}}function un(t,r){let e=[];for(let n=0;n<t.length;n++){let s=t[n];if(s===void 0)continue;if(s==="--data"){n++;continue}if(s.startsWith("--data=")||s==="--open"||s==="--replace"||s==="--foreground")continue;e.push(s)}return[...e,"--data",N(r)]}async function H(t){if(t.command.length===0)throw Error("\u7F3A\u5C11\u540E\u53F0\u670D\u52A1\u542F\u52A8\u5165\u53E3");let r=K(a(t.dataDir),"a",384),e;try{e=Bun.spawn([...t.command,...t.args.filter((s)=>s!=="--foreground"),"--foreground"],{cwd:t.cwd??process.cwd(),detached:!0,stdio:["ignore",r,r],windowsHide:!0})}finally{J(r)}e.unref();let n=Date.now()+_;while(Date.now()<n){if(e.exitCode!==null)throw Error(`\u670D\u52A1\u8FDB\u7A0B\u5728\u5C31\u7EEA\u524D\u9000\u51FA\uFF08\u9000\u51FA\u7801 ${e.exitCode}\uFF09`);let s=await He(t.dataDir,e.pid);if(s)return s;await Bun.sleep(100)}throw await cn(e.pid),Error(`\u7B49\u5F85\u670D\u52A1\u5C31\u7EEA\u8D85\u65F6\uFF08${_/1000} \u79D2\uFF09`)}async function M(t){let r=Bun.file(a(t));if(!await r.exists()||r.size===0)return;let e=Math.max(0,r.size-rt),n=await r.slice(e).text();if(e>0){let s=n.indexOf(`
2
+ import{Yr,oi}from"./chunk-45wfmdts.js";var ut={name:"@basalt/cli",version:"0.1.28",private:!0,type:"module",imports:{"#*":"./src/*","#test/*":"./test/*"},bin:{basalt:"./src/main.ts"},scripts:{typecheck:"tsgo --noEmit -p ."},dependencies:{"@basalt/builtins":"workspace:*","@basalt/core":"workspace:*","@basalt/protocol":"workspace:*","@basalt/server":"workspace:*","@basalt/web":"workspace:*","@earendil-works/pi-ai":"1.2.0"},exports:{"./plugin-sdk":"./src/plugin-sdk.ts"}};import{mkdirSync as vt}from"fs";import{join as Tt}from"path";import{existsSync as d,mkdirSync as h,rmSync as f,writeFileSync as T}from"fs";import{homedir as P}from"os";import{dirname as x,join as l}from"path";import{closeSync as J,existsSync as B,mkdirSync as q,openSync as K,readdirSync as X,readFileSync as p,rmSync as Q,writeFileSync as tt}from"fs";import{join as g,resolve as N}from"path";var _=20000,rt=262144;function a(t){return g(t,"basalt.log")}function k(t){try{let r=JSON.parse(p(t,"utf8"));if(typeof r!=="object"||r===null)return;let e=r;if(typeof e.pid!=="number"||!Number.isInteger(e.pid)||e.pid<=0)return;if(typeof e.url!=="string")return;let n=new URL(e.url);if(n.protocol!=="http:"&&n.protocol!=="https:")return;let s=Array.isArray(e.argv)&&e.argv.every((i)=>typeof i==="string")?e.argv.map((i)=>String(i)):void 0;return{pid:e.pid,url:e.url,...typeof e.hwnd==="number"&&Number.isInteger(e.hwnd)&&e.hwnd>0?{hwnd:e.hwnd}:{},...s?{argv:s}:{},...typeof e.cwd==="string"&&e.cwd?{cwd:e.cwd}:{},...typeof e.secret==="string"&&e.secret?{secret:e.secret}:{}}}catch{return}}function A(t){try{return process.kill(t,0),!0}catch{return!1}}async function He(t,r){let e=g(t,"server.json");if(!B(e))return;let n=k(e);if(!n||r!==void 0&&n.pid!==r)return;return v(n.pid)?n:void 0}async function I(t,r=1500){try{return(await fetch(`${t.url}/api/info`,{signal:AbortSignal.timeout(r)})).ok}catch{return!1}}function v(t){if(!u(t))return!1;let r=et(t);return r===void 0||/bun|basalt/i.test(r)}function u(t){if(!A(t))return!1;if(process.platform!=="linux")return!0;try{return p(`/proc/${t}/stat`,"utf8").split(") ")[1]?.[0]!=="Z"}catch{return!0}}function et(t){try{if(process.platform==="linux")return p(`/proc/${t}/cmdline`,"utf8");let r=process.platform==="win32"?Bun.spawnSync(["tasklist","/FI",`PID eq ${t}`,"/FO","CSV","/NH"],{windowsHide:!0}):Bun.spawnSync(["ps","-p",String(t),"-o","command="]);return r.success?r.stdout.toString():void 0}catch{return}}function Ss(t,r){q(t,{recursive:!0});let e=g(t,`${process.pid}.json`);return tt(e,JSON.stringify({dataDir:N(r)})),e}async function j(t){if(!B(t))return[];let r=[];for(let e of X(t)){let n=/^(\d+)\.json$/.exec(e);if(!n)continue;let s=g(t,e),i=Number(n[1]);if(!u(i)){Q(s,{force:!0});continue}let o;try{o=JSON.parse(p(s,"utf8"))}catch{continue}if(!o||typeof o!=="object"||!("dataDir"in o)||typeof o.dataDir!=="string")continue;let c=await He(o.dataDir,i);if(c)r.push({dataDir:o.dataDir,service:c})}return r}async function cn(t,r){if(r?.secret&&r.pid===t){let e=new URL(r.url);if(["127.0.0.1","localhost","[::1]"].includes(e.hostname))try{if((await fetch(new URL("/api/server/shutdown",e),{method:"POST",headers:{authorization:`Bearer ${r.secret}`},redirect:"error",signal:AbortSignal.timeout(2000)})).ok){for(let s=0;s<220&&u(t);s++)await Bun.sleep(100);if(!u(t))return}}catch(n){if(u(t))console.warn("\u6B63\u5E38\u5173\u505C\u8BF7\u6C42\u5931\u8D25\uFF0C\u56DE\u9000\u5230\u8FDB\u7A0B\u4FE1\u53F7\uFF1A",n instanceof Error?n.message:String(n))}}try{process.kill(t,"SIGTERM")}catch{return}for(let e=0;e<50&&u(t);e++)await Bun.sleep(100);if(u(t)){try{process.kill(t,"SIGKILL")}catch(e){if(!(e instanceof Error&&("code"in e)&&e.code==="ESRCH"))console.error(`\u65E0\u6CD5\u5F3A\u5236\u7ED3\u675F\u8FDB\u7A0B ${t}\uFF1A`,e)}await Bun.sleep(200)}}function un(t,r){let e=[];for(let n=0;n<t.length;n++){let s=t[n];if(s===void 0)continue;if(s==="--data"){n++;continue}if(s.startsWith("--data=")||s==="--open"||s==="--replace"||s==="--foreground")continue;e.push(s)}return[...e,"--data",N(r)]}async function H(t){if(t.command.length===0)throw Error("\u7F3A\u5C11\u540E\u53F0\u670D\u52A1\u542F\u52A8\u5165\u53E3");let r=K(a(t.dataDir),"a",384),e;try{e=Bun.spawn([...t.command,...t.args.filter((s)=>s!=="--foreground"),"--foreground"],{cwd:t.cwd??process.cwd(),detached:!0,stdio:["ignore",r,r],windowsHide:!0})}finally{J(r)}e.unref();let n=Date.now()+_;while(Date.now()<n){if(e.exitCode!==null)throw Error(`\u670D\u52A1\u8FDB\u7A0B\u5728\u5C31\u7EEA\u524D\u9000\u51FA\uFF08\u9000\u51FA\u7801 ${e.exitCode}\uFF09`);let s=await He(t.dataDir,e.pid);if(s)return s;await Bun.sleep(100)}throw await cn(e.pid),Error(`\u7B49\u5F85\u670D\u52A1\u5C31\u7EEA\u8D85\u65F6\uFF08${_/1000} \u79D2\uFF09`)}async function M(t){let r=Bun.file(a(t));if(!await r.exists()||r.size===0)return;let e=Math.max(0,r.size-rt),n=await r.slice(e).text();if(e>0){let s=n.indexOf(`
3
3
  `);if(s>=0)n=n.slice(s+1)}return n||void 0}var W="work.basalt",b="basalt.service",nt=`
4
4
  [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
5
5
  $shell = New-Object -ComObject WScript.Shell
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{at}from"./chunk-45wfmdts.js";import{ut,He,ws,dn,xs,yi,vs,_s,Es,As,Ts,Ps,ks}from"./chunk-x3g1bzq6.js";import{qe}from"./chunk-cb3jgak9.js";import{mkdirSync as K}from"fs";import{dirname as z,join as Z}from"path";import{parseArgs as F}from"util";import{readFile as N}from"fs/promises";import{join as H}from"path";async function P(e,t){try{return await B(e,t),console.log(`Plugin ${t} reloaded`),0}catch(r){let a=(r instanceof Error?r.message:String(r)).replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+/gu," ");return console.error(`\u63D2\u4EF6\u91CD\u8F7D\u5931\u8D25\uFF1A${a}`),1}}async function B(e,t){if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(t))throw Error("Invalid plugin id");let r=JSON.parse(await N(H(e,"server.json"),"utf8"));if(!r||typeof r!=="object"||!("url"in r)||typeof r.url!=="string")throw Error("Invalid server record; restart basalt");let a=new URL(r.url);if(a.username||a.password||a.protocol!=="https:"&&!(a.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(a.hostname)))throw Error("Plugin reload requires HTTPS or a local HTTP server");a.pathname=`/api/plugins/${encodeURIComponent(t)}/reload`,a.search="",a.hash="";let A=process.env.BASALT_TOKEN,p=await fetch(a,{method:"POST",redirect:"error",signal:AbortSignal.timeout(30000),headers:A?{Authorization:`Bearer ${A}`}:{}});if(!p.ok){let C=await p.text(),u="";try{let d=JSON.parse(C);if(d&&typeof d==="object"&&"error"in d){let l=d.error;if(typeof l==="string")u=l;else if(l&&typeof l==="object"&&"message"in l&&typeof l.message==="string")u=l.message}}catch{}let L=p.status===401?"\uFF1B\u8BF7\u8BBE\u7F6E BASALT_TOKEN \u4E3A\u5DF2\u914D\u5BF9\u8BBE\u5907\u4EE4\u724C\u540E\u91CD\u8BD5":"";throw Error(`HTTP ${p.status}${u?`\uFF1A${u}`:""}${L}`)}}import{appendFileSync as O,existsSync as y,mkdirSync as D,readFileSync as I}from"fs";import{homedir as T}from"os";import{basename as R,delimiter as U,dirname as S,join as c}from"path";var j=`
3
+ import{at}from"./chunk-45wfmdts.js";import{ut,He,ws,dn,xs,yi,vs,_s,Es,As,Ts,Ps,ks}from"./chunk-78yngmvf.js";import{qe}from"./chunk-cb3jgak9.js";import{mkdirSync as K}from"fs";import{dirname as z,join as Z}from"path";import{parseArgs as F}from"util";import{readFile as N}from"fs/promises";import{join as H}from"path";async function P(e,t){try{return await B(e,t),console.log(`Plugin ${t} reloaded`),0}catch(r){let a=(r instanceof Error?r.message:String(r)).replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+/gu," ");return console.error(`\u63D2\u4EF6\u91CD\u8F7D\u5931\u8D25\uFF1A${a}`),1}}async function B(e,t){if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(t))throw Error("Invalid plugin id");let r=JSON.parse(await N(H(e,"server.json"),"utf8"));if(!r||typeof r!=="object"||!("url"in r)||typeof r.url!=="string")throw Error("Invalid server record; restart basalt");let a=new URL(r.url);if(a.username||a.password||a.protocol!=="https:"&&!(a.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(a.hostname)))throw Error("Plugin reload requires HTTPS or a local HTTP server");a.pathname=`/api/plugins/${encodeURIComponent(t)}/reload`,a.search="",a.hash="";let A=process.env.BASALT_TOKEN,p=await fetch(a,{method:"POST",redirect:"error",signal:AbortSignal.timeout(30000),headers:A?{Authorization:`Bearer ${A}`}:{}});if(!p.ok){let C=await p.text(),u="";try{let d=JSON.parse(C);if(d&&typeof d==="object"&&"error"in d){let l=d.error;if(typeof l==="string")u=l;else if(l&&typeof l==="object"&&"message"in l&&typeof l.message==="string")u=l.message}}catch{}let L=p.status===401?"\uFF1B\u8BF7\u8BBE\u7F6E BASALT_TOKEN \u4E3A\u5DF2\u914D\u5BF9\u8BBE\u5907\u4EE4\u724C\u540E\u91CD\u8BD5":"";throw Error(`HTTP ${p.status}${u?`\uFF1A${u}`:""}${L}`)}}import{appendFileSync as O,existsSync as y,mkdirSync as D,readFileSync as I}from"fs";import{homedir as T}from"os";import{basename as R,delimiter as U,dirname as S,join as c}from"path";var j=`
4
4
  $dir = $env:BASALT_SETUP_DIR.TrimEnd('\\')
5
5
  $current = [Environment]::GetEnvironmentVariable("Path", "User")
6
6
  $parts = if ($current) { $current -split ';' } else { @() }
@@ -47,4 +47,4 @@ ${r}
47
47
  -v, --version \u663E\u793A\u7248\u672C
48
48
  -h, --help \u663E\u793A\u5E2E\u52A9
49
49
  `,{values:o,positionals:s}=F({allowPositionals:!0,options:{host:{type:"string"},port:{type:"string"},"no-auth":{type:"boolean",default:!1},"no-tray":{type:"boolean",default:!1},"insecure-http":{type:"boolean",default:!1},"allow-remote-no-auth":{type:"boolean",default:!1},"allow-origin":{type:"string",multiple:!0,default:[]},"allow-host":{type:"string",multiple:!0,default:[]},"web-url":{type:"string"},model:{type:"string"},demo:{type:"boolean",default:!1},data:{type:"string"},token:{type:"string"},team:{type:"string"},aud:{type:"string"},open:{type:"boolean",default:!1},foreground:{type:"boolean",default:!1},replace:{type:"boolean",default:!1},"no-update-check":{type:"boolean",default:!1},version:{type:"boolean",short:"v",default:!1},help:{type:"boolean",short:"h",default:!1}}});if(o.help||s[0]==="help"&&s.length===1)console.log(G),process.exit(0);if(o.version)console.log(ut.version),process.exit(0);var f=process.argv.slice(2),v=Z(at(),"instances"),n=o.data??(["status","stop","restart","logs","pair","plugin"].includes(s[0]??"")?await xs(at(),v):at()),m=!0,g="@bkm016/basalt",h=m&&!g?[process.execPath]:[process.execPath,Bun.main],i=s[0],V=!o["no-update-check"]&&!process.env.BASALT_NO_UPDATE_CHECK,E=o.host===void 0||qe(o.host),{portNumber:_,portSpecified:q}=ws(o.port),b={loopback:E,insecureHttp:o["insecure-http"],noAuth:o["no-auth"],allowRemoteNoAuth:o["allow-remote-no-auth"],allowedHosts:o["allow-host"],allowedOrigins:o["allow-origin"],webUrl:o["web-url"]};if(i==="update"&&s.length===1)process.exit(await ks(n,{packageDir:z(Bun.main),packageName:g,compiled:m}));if(i==="tunnel"){let{tunnelCommand:e}=await import("./chunk-jp1gqkbp.js");process.exit(await e(n,s[1],s[2],{token:o.token,team:o.team,aud:o.aud,port:_}))}if(i==="setup"&&s.length===1)process.exit(x({compiled:m,npmPackage:g,executable:process.execPath}));if(i==="plugin"){let[,e,t]=s;if(e!=="reload"||!t||s.length!==3)console.error("\u7528\u6CD5: basalt plugin reload <id> [--data <\u76EE\u5F55>]"),process.exit(1);process.exit(await P(n,t))}if(i==="status"&&s.length===1)process.exit(await vs(n));if(i==="stop"&&s.length===1)process.exit(await _s(n));if(i==="restart"&&s.length===1)process.exit(await Es({dataDir:n,rawArgs:f,launchCommand:h,open:o.open,validation:b}));if(i==="logs"&&s.length===1)process.exit(await As(n));if(i==="pair"&&s.length===1)process.exit(await Ts(n));if(i==="autostart"&&s.length===2)process.exit(await Ps({action:s[1]??"",dataDir:n,rawArgs:f,launchCommand:h,validation:b}));if(s.length)console.error(`\u672A\u77E5\u547D\u4EE4\uFF1A${s.join(" ")}
50
- \u8FD0\u884C basalt --help \u67E5\u770B\u53EF\u7528\u547D\u4EE4`),process.exit(1);K(n,{recursive:!0});dn(b);var{NetworkManager:J,resolveNetworkHost:Q}=await import("./chunk-j16smb6d.js"),w=new J(n);w.load();var k;try{k=Q(w.settings(),{host:o.host,auth:!o["no-auth"],insecureHttp:o["insecure-http"],allowRemoteNoAuth:o["allow-remote-no-auth"]})}catch(e){console.error(`\u62D2\u7EDD\u542F\u52A8\uFF1A${e instanceof Error?e.message:String(e)}`),process.exit(1)}if(!o.foreground){let e=await He(n);if(e&&!o.replace){if(!o["no-tray"]&&typeof e.hwnd==="number"){let{notifyExistingTray:t}=await import("./chunk-n9m2pagh.js");t(e.hwnd)}console.log(`basalt \u5DF2\u5728\u8FD0\u884C\uFF1A${e.url}`),process.exit(0)}process.exit(await yi(h,f,n,process.cwd()))}var X=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64url"),{startForegroundServer:Y}=await import("./chunk-ydhdewcv.js");await Y({dataDir:n,instanceRegistry:v,rawArgs:f,launchCommand:h,compiled:m,npmPackage:g,portNumber:_,portSpecified:q,loopback:E,host:k,network:w,args:o,cliSecret:X,autoUpdate:V});
50
+ \u8FD0\u884C basalt --help \u67E5\u770B\u53EF\u7528\u547D\u4EE4`),process.exit(1);K(n,{recursive:!0});dn(b);var{NetworkManager:J,resolveNetworkHost:Q}=await import("./chunk-j16smb6d.js"),w=new J(n);w.load();var k;try{k=Q(w.settings(),{host:o.host,auth:!o["no-auth"],insecureHttp:o["insecure-http"],allowRemoteNoAuth:o["allow-remote-no-auth"]})}catch(e){console.error(`\u62D2\u7EDD\u542F\u52A8\uFF1A${e instanceof Error?e.message:String(e)}`),process.exit(1)}if(!o.foreground){let e=await He(n);if(e&&!o.replace){if(!o["no-tray"]&&typeof e.hwnd==="number"){let{notifyExistingTray:t}=await import("./chunk-n9m2pagh.js");t(e.hwnd)}console.log(`basalt \u5DF2\u5728\u8FD0\u884C\uFF1A${e.url}`),process.exit(0)}process.exit(await yi(h,f,n,process.cwd()))}var X=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64url"),{startForegroundServer:Y}=await import("./chunk-4n4wn5cj.js");await Y({dataDir:n,instanceRegistry:v,rawArgs:f,launchCommand:h,compiled:m,npmPackage:g,portNumber:_,portSpecified:q,loopback:E,host:k,network:w,args:o,cliSecret:X,autoUpdate:V});
package/compiled.js CHANGED
@@ -93,4 +93,4 @@ import{In,Mn,Uo}from"./chunk-82dkdvs9.js";import{V}from"./chunk-bh29df86.js";imp
93
93
  ${r?`<div class="details">${r}</div>`:""}
94
94
  </main>
95
95
  </body>
96
- </html>`}function Ot(e){return Kr({title:"Authentication successful",heading:"Authentication successful",message:e})}function P(e,t){return Kr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function q(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function D(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((g,h)=>{n=g,r=h});s.catch(()=>{return});let i=!1,d=!1,c,u=()=>l({error:Error("Login cancelled")}),l=(g)=>{if(d)return;if(d=!0,c)clearTimeout(c);if(o?.removeEventListener("abort",u),"error"in g)r(g.error);else n(g.value)},p=Md((g,h)=>{(async()=>{let I=new URL(g.url??"/","http://localhost");if(g.method!=="GET"||I.pathname!==e.path){q(h,404,P("Callback route not found."));return}if(e.state!==void 0&&I.searchParams.get("state")!==e.state){q(h,400,P("State mismatch."));return}if(i||d){q(h,409,P("This sign-in has already been handled."));return}let T=I.searchParams.get("error");if(T){let S=I.searchParams.get("error_description")??T;q(h,400,P(`${t} authorization failed.`,S)),l({error:Error(`${t} authorization failed: ${S}`)});return}let R=I.searchParams.get("code");if(!R){q(h,400,P("Missing authorization code."));return}i=!0;try{let S=await e.complete(R);q(h,200,Ot(`Signed in to ${t}. You may now close this page.`)),l({value:S})}catch(S){let M=S instanceof Error?S:Error(String(S));q(h,502,P(`${t} sign-in failed.`,M.message)),l({error:M})}})()});await new Promise((g,h)=>{p.once("error",h),p.listen(e.port,e.host,()=>{p.off("error",h),g()})});let C=p.address();if(!C||typeof C==="string")throw p.close(),Error("OAuth callback server did not bind to TCP");if(p.on("error",(g)=>l({error:g})),o?.addEventListener("abort",u,{once:!0}),e.timeoutMs!==void 0)c=setTimeout(()=>l({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let m=e.redirectHost??e.host;return{redirectUri:`http://${m.includes(":")?`[${m}]`:m}:${C.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)l({value:void 0})},close:()=>{l({error:Error("OAuth callback server closed")}),p.close()}}}async function Se(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let d=await s;if(r)throw r;return{type:"manual",input:d??""}}finally{n.abort()}}function jr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function b(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=jr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=jr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),Gt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Jr="https://claude.ai/oauth/authorize",ve="https://platform.claude.com/v1/oauth/token",Bd=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Yr=53692,Qr="/callback",Dd=`http://localhost:${Yr}${Qr}`,zr="https://platform.claude.com/oauth/code/callback",Xr="browser",qr="copy_code",Zr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function es(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Be(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${Be(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function ts(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function os(e,t,o,n,r){let s;try{s=await ts(ve,{grant_type:"authorization_code",client_id:Gt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(d){throw Error(`Token exchange request failed. url=${ve}; redirect_uri=${n}; response_type=authorization_code; details=${Be(d)}`)}let i;try{i=JSON.parse(s)}catch(d){throw Error(`Token exchange returned invalid JSON. url=${ve}; body=${s}; details=${Be(d)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await b(),n=(i)=>D({providerName:"Anthropic",host:Bd,port:i,path:Qr,redirectHost:"localhost",state:t,complete:async(d)=>d,signal:e.signal}),r=await n(Yr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:s,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let d=await Se(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),c,u=t;if(d.type==="callback")c=d.value;else{let l=es(d.input);if(l.state&&l.state!==t)throw Error("OAuth state mismatch");c=l.code,u=l.state??t}if(!c)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(c,u,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await b(),n=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:zr,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=es(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(s.code,s.state??t,t,zr,e.signal)}async function Hd(e,t){let o;try{o=await ts(ve,{grant_type:"refresh_token",client_id:Gt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${ve}; details=${Be(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${ve}; body=${o}; details=${Be(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var ns={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:Xr,label:"Browser login (default)"},{id:qr,label:"Copy code login (headless)"}]});if(t===qr)return Fd(e);if(t!==Xr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function bt(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function rs(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function G(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await rs(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await rs(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),is=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),co={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},Vd="2026-06-01";function as(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function uo(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function lo(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function $e(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=$e(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((c)=>{let u=$e(c),l=u?.id;if(!u||typeof l!=="string")return[];let p=$e(u.capabilities);if($e(p?.supports)?.tool_calls===!1)return[];return[{id:l,pickerEnabled:u.model_picker_enabled===!0,policyState:$e(u.policy)?.state}]}),r=n.filter((c)=>c.pickerEnabled&&c.policyState!=="disabled").map((c)=>c.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((c)=>c.policyState==="enabled").map((c)=>c.id),d=n.filter((c)=>c.policyState==="unconfigured"&&Object.hasOwn(Pn,c.id)&&(c.pickerEnabled||s)).map((c)=>c.id);return{availableModelIds:i,policyModelIds:d}}async function cs(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let d=0;;d++){let c=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(c.status!==429||d===n.maxRetries)return c;let u=c.headers.get("retry-after"),l=500*2**d;if(u){let p=Number.parseFloat(u);if(l=Number.isNaN(p)?Date.parse(u)-Date.now():p*1000,!Number.isFinite(l))return c}if(l=Math.max(0,l),i!==void 0&&l>=i-Date.now())return c;await c.body?.cancel(),await bt(l,s)}}async function ds(e,t,o,n){let r=lo(e,t),s=r==="https://api.individual.githubcopilot.com",i=await cs(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function po(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=uo(e),n=await po(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:is,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:d,expires_in:c}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||d!==void 0&&typeof d!=="number"||typeof c!=="number")throw Error("Invalid device code response fields");let u;try{u=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(u.protocol!=="https:"&&u.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:u.href,interval:d,expires_in:c}}async function Xd(e,t,o){let n=uo(e);return G({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await po(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:is,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:d}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof d==="number"?d:void 0};let c=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${c}`}}return{status:"failed",message:"Invalid device token response"}}})}async function us(e,t,o){let r=uo(t||"github.com"),s=await po(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:d}=s;if(typeof i!=="string"||typeof d!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:d*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await us(e,t,o),{availableModelIds:r}=await ds(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${lo(e,o)}/models/${t}/policy`,i;try{i=await cs(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...co,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(d){if(n.aborted)throw d;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=as(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),d=await us(i,n??void 0,e.signal),c=await ds(d.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),u=[];if(c.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),u=await Yd(d.access,c.policyModelIds,n??void 0,e.signal);return{...d,availableModelIds:[...new Set([...c.availableModelIds,...u])]}}function ss(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return as(t)??void 0}var ls={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,ss(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:lo(e.access,ss(e))}}};var _o="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,ps=3;function hs(){return(E("KIMI_CODE_OAUTH_HOST")||E("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function ho(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function fo(e){return new URLSearchParams(e).toString()}async function mo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function _s(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o}),signal:ho(t)});if(!o.ok){let l=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${l?`: ${l}`:""}`)}let n=await mo(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,d=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof d!=="string"||!_s(d)||!_s(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let c=n?.interval,u=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:d,intervalSeconds:typeof c==="number"&&Number.isFinite(c)&&c>0?c:tu,expiresInSeconds:typeof u==="number"&&Number.isFinite(u)&&u>0?u:eu}}function fs(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return G({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:ho(o)});if(n.status>=500){let d=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${d?`: ${d}`:""}`}}let r=await mo(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:fs(r,"poll")}}catch(d){return{status:"failed",message:d instanceof Error?d.message:String(d)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let d=r?.interval;return{status:"slow_down",intervalSeconds:typeof d==="number"&&d>0?d:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=ps;r++){if(r>0)await bt(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o,grant_type:"refresh_token",refresh_token:t}),signal:ho(o)})}catch(c){n=c instanceof Error?c:Error(String(c));continue}let i=await mo(s);if(s.ok)return fs(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let c=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${c}`)}if(su(s)&&r<ps){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let d=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${d?`: ${d}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=hs(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var ms={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(hs(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var gs="1031625952748946",Cs="https://auth.meta.com",cu=`${Cs}/oidc/device/authorization/`,du=`${Cs}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function So(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function Eo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function Nt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function go(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function Co(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:gs}).toString(),signal:So(e)}),o=await Eo(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${Nt(o)}`);let n=o?.device_code,r=o?.user_code,s=go(o?.verification_uri_complete)??go(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:Co(o?.interval),expiresInSeconds:Co(o?.expires_in)}}async function hu(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:gs}).toString(),signal:So(t)}),n=await Eo(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:Co(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${Nt(n)}`}}}})}async function Ss(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:So(t)}),n=await Eo(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${Nt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${Nt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=go(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Ss(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var Es={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Ss(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",Ro="https://api.openai.com/v1",Ru=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",yo=1455,As="/auth/callback",ye=`http://127.0.0.1:${yo}${As}`,Ao="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ao}`,xu=180000;function vs(){return mu(32).toString("base64url")}function Rs(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(ye);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${ye}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return Rs(o,t)}function Fe(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((d,c)=>{n=d,r=c}),i=gu((d,c)=>{try{let u=new URL(d.url||"",ye);if(u.pathname!==As){Fe(c,404,P("Callback route not found."));return}let l=u.searchParams.get("error");if(l){Fe(c,400,P("ChatGPT was not connected.",`Error: ${l}`)),r(Error(`ChatGPT authorization failed: ${l}`));return}let p;try{p=Rs(u,e)}catch(C){let m=C instanceof Error?C.message:"Invalid callback";Fe(c,400,P(m));return}Fe(c,200,Ot("ChatGPT authentication completed. You can close this window.")),n(p)}catch{Fe(c,500,P("Internal error while processing the callback."))}});i.once("error",o),i.listen(yo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function ys(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function vo(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function xs(e,t,o){let n=vo(e.access_token,"access_token"),r=vo(e.refresh_token,"refresh_token"),s=vo(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let d=s.trim().split(/\s+/).filter(Boolean);if(!d.includes(Ao))throw Error(`OpenAI OAuth grant did not include ${Ao}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:d}}async function wu(e,t,o,n){let r=await ys(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:ye,resource:Ro}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return xs(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await ys(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:Ro}),t);return xs(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await b(),s=vs(),i=vs(),d=await Tu(s).catch((p)=>{if(!(p instanceof Error&&("code"in p)&&p.code==="EADDRINUSE"))throw p;throw Error(`Port ${yo} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),c=new URL(vu);c.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:ye,resource:Ro,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:c.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let u=new AbortController,l=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:ye,signal:AbortSignal.any([u.signal,e.signal])}).then((p)=>Iu(p,s));try{let p=await Promise.race([d.result,l]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(p.code,n,p.clientId,e.signal)}catch(p){if(e.signal.aborted)throw Error("Login cancelled");throw p}finally{u.abort(),d.server.close(),d.server.closeAllConnections()}}var Is={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var xo=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{xo=e.randomBytes});var Lt="app_EMoamEEZ73f0CkXaXp7hrann",Ie="https://auth.openai.com",Gu=`${Ie}/oauth/authorize`,ks=`${Ie}/oauth/token`,Io="http://localhost:1455/auth/callback",bu=`${Ie}/api/accounts/deviceauth/usercode`,Nu=`${Ie}/api/accounts/deviceauth/token`,Lu=`${Ie}/codex/device`,Mu=`${Ie}/deviceauth/callback`,Os=900,Ts="browser",ws="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!xo)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return xo(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function To(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Ps(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await To(ks,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Lt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Ps(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(ks,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Lt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Ps(o,"refresh")}async function Ku(e){let t=await To(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Lt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:Os,signal:t,poll:async()=>{let o=await To(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await b(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Lt),r.searchParams.set("redirect_uri",Io),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function bs(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Ns(e,t,o,n){return bs(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:Os});let o=await ju(t,e.signal);return Ns(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await D({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await Se(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:Io}),d;if(i.type==="callback")d=i.value;else{let c=Fu(i.input);if(c.state&&c.state!==n)throw Error("State mismatch");d=c.code}if(!d)throw Error("Missing authorization code");return await Ns(d,o,Io,e.signal)}finally{s?.close()}}async function Yu(e,t){return bs(await Vu(e,t))}var Ls={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:Ts,label:"Browser login (default)"},{id:ws,label:"Device code login (headless)"}]});if(o===ws)return qu(e);if(o!==Ts)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ms(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,d={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let c=await i.json();if(c&&typeof c==="object"&&!Array.isArray(c))d=c}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(c){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw c}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let c=rl(d);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${c?`: ${c}`:""}`)}if(typeof d.key!=="string"||d.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:d.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await b(),n=await D({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ms(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await Se(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ms(i,t,e.signal)}finally{n.close()}}var Us={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var $s="127.0.0.1",Fs=1456,Hs="/oauth/callback",wo=`http://${$s}:${Fs}${Hs}`,il=60000,Bs="browser",Ds="device-code",He="pi-gateway",Ws="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class ko extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Vs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new ko(e.status,n,r,t)}async function Oo(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Vs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await b(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:He,redirect_uri:wo,scope:Ws,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let d=await D({providerName:"Radius",host:$s,port:Fs,path:Hs,state:s,complete:(c)=>Oo(e,new URLSearchParams({grant_type:"authorization_code",client_id:He,redirect_uri:wo,code:c,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${wo}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let c=await d.wait();if(!c)throw Error("OAuth callback did not complete.");return c}finally{d.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:He,scope:Ws}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Vs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),G({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await Oo(e,new URLSearchParams({grant_type:al,client_id:He,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof ko))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function js(e){let t=Rr(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Bs,label:"Sign in with browser (recommended)"},{id:Ds,label:"Sign in with device code (when signing in from another device)"}]});if(n===Ds)return ll(t,o);if(n===Bs){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await Oo(t,new URLSearchParams({grant_type:"refresh_token",client_id:He,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Po="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",Xs="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function Ve(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function qs(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function zs(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function Go(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function bo(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?zs(e.verification_uri_complete):void 0;return{deviceCode:Ve(e,"device_code"),userCode:Ve(e,"user_code"),verificationUri:zs(Ve(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:qs(e,"expires_in")}}function Js(e,t){let o=Ve(e,"access_token"),n=e.refresh_token===void 0&&t?t:Ve(e,"refresh_token"),r=e.expires_in===void 0?fl:qs(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await Go(_l,{client_id:Po,scope:pl,referrer:"pi"},e);if(!t.ok)throw bo("device authorization",t);return ml(t.body)}async function Cl(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await Go(Xs,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Po,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:Js(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:bo("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await Go(Xs,{grant_type:"refresh_token",client_id:Po,refresh_token:e},t);if(!o.ok)throw bo("token refresh",o);return Js(o.body,e)}var Ys={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Qs(){Ks({anthropic:()=>ns,openaiCodex:()=>Ls,openaiChatGPT:()=>Is,githubCopilot:()=>ls,openrouter:()=>Us,kimiCoding:()=>ms,meta:()=>Es,xai:()=>Ys,radius:js})}Gs(Vr);Qs();await import("./chunk-jxcghx26.js");
96
+ </html>`}function Ot(e){return Kr({title:"Authentication successful",heading:"Authentication successful",message:e})}function P(e,t){return Kr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function q(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function D(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((g,h)=>{n=g,r=h});s.catch(()=>{return});let i=!1,d=!1,c,u=()=>l({error:Error("Login cancelled")}),l=(g)=>{if(d)return;if(d=!0,c)clearTimeout(c);if(o?.removeEventListener("abort",u),"error"in g)r(g.error);else n(g.value)},p=Md((g,h)=>{(async()=>{let I=new URL(g.url??"/","http://localhost");if(g.method!=="GET"||I.pathname!==e.path){q(h,404,P("Callback route not found."));return}if(e.state!==void 0&&I.searchParams.get("state")!==e.state){q(h,400,P("State mismatch."));return}if(i||d){q(h,409,P("This sign-in has already been handled."));return}let T=I.searchParams.get("error");if(T){let S=I.searchParams.get("error_description")??T;q(h,400,P(`${t} authorization failed.`,S)),l({error:Error(`${t} authorization failed: ${S}`)});return}let R=I.searchParams.get("code");if(!R){q(h,400,P("Missing authorization code."));return}i=!0;try{let S=await e.complete(R);q(h,200,Ot(`Signed in to ${t}. You may now close this page.`)),l({value:S})}catch(S){let M=S instanceof Error?S:Error(String(S));q(h,502,P(`${t} sign-in failed.`,M.message)),l({error:M})}})()});await new Promise((g,h)=>{p.once("error",h),p.listen(e.port,e.host,()=>{p.off("error",h),g()})});let C=p.address();if(!C||typeof C==="string")throw p.close(),Error("OAuth callback server did not bind to TCP");if(p.on("error",(g)=>l({error:g})),o?.addEventListener("abort",u,{once:!0}),e.timeoutMs!==void 0)c=setTimeout(()=>l({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let m=e.redirectHost??e.host;return{redirectUri:`http://${m.includes(":")?`[${m}]`:m}:${C.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)l({value:void 0})},close:()=>{l({error:Error("OAuth callback server closed")}),p.close()}}}async function Se(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let d=await s;if(r)throw r;return{type:"manual",input:d??""}}finally{n.abort()}}function jr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function b(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=jr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=jr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),Gt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Jr="https://claude.ai/oauth/authorize",ve="https://platform.claude.com/v1/oauth/token",Bd=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Yr=53692,Qr="/callback",Dd=`http://localhost:${Yr}${Qr}`,zr="https://platform.claude.com/oauth/code/callback",Xr="browser",qr="copy_code",Zr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function es(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Be(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${Be(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function ts(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function os(e,t,o,n,r){let s;try{s=await ts(ve,{grant_type:"authorization_code",client_id:Gt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(d){throw Error(`Token exchange request failed. url=${ve}; redirect_uri=${n}; response_type=authorization_code; details=${Be(d)}`)}let i;try{i=JSON.parse(s)}catch(d){throw Error(`Token exchange returned invalid JSON. url=${ve}; body=${s}; details=${Be(d)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await b(),n=(i)=>D({providerName:"Anthropic",host:Bd,port:i,path:Qr,redirectHost:"localhost",state:t,complete:async(d)=>d,signal:e.signal}),r=await n(Yr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:s,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let d=await Se(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),c,u=t;if(d.type==="callback")c=d.value;else{let l=es(d.input);if(l.state&&l.state!==t)throw Error("OAuth state mismatch");c=l.code,u=l.state??t}if(!c)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(c,u,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await b(),n=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:zr,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=es(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(s.code,s.state??t,t,zr,e.signal)}async function Hd(e,t){let o;try{o=await ts(ve,{grant_type:"refresh_token",client_id:Gt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${ve}; details=${Be(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${ve}; body=${o}; details=${Be(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var ns={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:Xr,label:"Browser login (default)"},{id:qr,label:"Copy code login (headless)"}]});if(t===qr)return Fd(e);if(t!==Xr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function bt(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function rs(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function G(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await rs(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await rs(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),is=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),co={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},Vd="2026-06-01";function as(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function uo(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function lo(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function $e(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=$e(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((c)=>{let u=$e(c),l=u?.id;if(!u||typeof l!=="string")return[];let p=$e(u.capabilities);if($e(p?.supports)?.tool_calls===!1)return[];return[{id:l,pickerEnabled:u.model_picker_enabled===!0,policyState:$e(u.policy)?.state}]}),r=n.filter((c)=>c.pickerEnabled&&c.policyState!=="disabled").map((c)=>c.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((c)=>c.policyState==="enabled").map((c)=>c.id),d=n.filter((c)=>c.policyState==="unconfigured"&&Object.hasOwn(Pn,c.id)&&(c.pickerEnabled||s)).map((c)=>c.id);return{availableModelIds:i,policyModelIds:d}}async function cs(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let d=0;;d++){let c=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(c.status!==429||d===n.maxRetries)return c;let u=c.headers.get("retry-after"),l=500*2**d;if(u){let p=Number.parseFloat(u);if(l=Number.isNaN(p)?Date.parse(u)-Date.now():p*1000,!Number.isFinite(l))return c}if(l=Math.max(0,l),i!==void 0&&l>=i-Date.now())return c;await c.body?.cancel(),await bt(l,s)}}async function ds(e,t,o,n){let r=lo(e,t),s=r==="https://api.individual.githubcopilot.com",i=await cs(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function po(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=uo(e),n=await po(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:is,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:d,expires_in:c}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||d!==void 0&&typeof d!=="number"||typeof c!=="number")throw Error("Invalid device code response fields");let u;try{u=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(u.protocol!=="https:"&&u.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:u.href,interval:d,expires_in:c}}async function Xd(e,t,o){let n=uo(e);return G({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await po(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:is,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:d}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof d==="number"?d:void 0};let c=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${c}`}}return{status:"failed",message:"Invalid device token response"}}})}async function us(e,t,o){let r=uo(t||"github.com"),s=await po(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...co},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:d}=s;if(typeof i!=="string"||typeof d!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:d*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await us(e,t,o),{availableModelIds:r}=await ds(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${lo(e,o)}/models/${t}/policy`,i;try{i=await cs(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...co,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(d){if(n.aborted)throw d;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=as(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),d=await us(i,n??void 0,e.signal),c=await ds(d.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),u=[];if(c.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),u=await Yd(d.access,c.policyModelIds,n??void 0,e.signal);return{...d,availableModelIds:[...new Set([...c.availableModelIds,...u])]}}function ss(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return as(t)??void 0}var ls={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,ss(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:lo(e.access,ss(e))}}};var _o="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,ps=3;function hs(){return(E("KIMI_CODE_OAUTH_HOST")||E("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function ho(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function fo(e){return new URLSearchParams(e).toString()}async function mo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function _s(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o}),signal:ho(t)});if(!o.ok){let l=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${l?`: ${l}`:""}`)}let n=await mo(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,d=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof d!=="string"||!_s(d)||!_s(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let c=n?.interval,u=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:d,intervalSeconds:typeof c==="number"&&Number.isFinite(c)&&c>0?c:tu,expiresInSeconds:typeof u==="number"&&Number.isFinite(u)&&u>0?u:eu}}function fs(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return G({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:ho(o)});if(n.status>=500){let d=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${d?`: ${d}`:""}`}}let r=await mo(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:fs(r,"poll")}}catch(d){return{status:"failed",message:d instanceof Error?d.message:String(d)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let d=r?.interval;return{status:"slow_down",intervalSeconds:typeof d==="number"&&d>0?d:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=ps;r++){if(r>0)await bt(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:fo({client_id:_o,grant_type:"refresh_token",refresh_token:t}),signal:ho(o)})}catch(c){n=c instanceof Error?c:Error(String(c));continue}let i=await mo(s);if(s.ok)return fs(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let c=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${c}`)}if(su(s)&&r<ps){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let d=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${d?`: ${d}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=hs(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var ms={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(hs(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var gs="1031625952748946",Cs="https://auth.meta.com",cu=`${Cs}/oidc/device/authorization/`,du=`${Cs}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function So(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function Eo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function Nt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function go(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function Co(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:gs}).toString(),signal:So(e)}),o=await Eo(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${Nt(o)}`);let n=o?.device_code,r=o?.user_code,s=go(o?.verification_uri_complete)??go(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:Co(o?.interval),expiresInSeconds:Co(o?.expires_in)}}async function hu(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:gs}).toString(),signal:So(t)}),n=await Eo(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:Co(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${Nt(n)}`}}}})}async function Ss(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:So(t)}),n=await Eo(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${Nt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${Nt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=go(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Ss(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var Es={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Ss(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",Ro="https://api.openai.com/v1",Ru=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",yo=1455,As="/auth/callback",ye=`http://127.0.0.1:${yo}${As}`,Ao="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ao}`,xu=180000;function vs(){return mu(32).toString("base64url")}function Rs(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(ye);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${ye}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return Rs(o,t)}function Fe(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((d,c)=>{n=d,r=c}),i=gu((d,c)=>{try{let u=new URL(d.url||"",ye);if(u.pathname!==As){Fe(c,404,P("Callback route not found."));return}let l=u.searchParams.get("error");if(l){Fe(c,400,P("ChatGPT was not connected.",`Error: ${l}`)),r(Error(`ChatGPT authorization failed: ${l}`));return}let p;try{p=Rs(u,e)}catch(C){let m=C instanceof Error?C.message:"Invalid callback";Fe(c,400,P(m));return}Fe(c,200,Ot("ChatGPT authentication completed. You can close this window.")),n(p)}catch{Fe(c,500,P("Internal error while processing the callback."))}});i.once("error",o),i.listen(yo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function ys(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function vo(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function xs(e,t,o){let n=vo(e.access_token,"access_token"),r=vo(e.refresh_token,"refresh_token"),s=vo(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let d=s.trim().split(/\s+/).filter(Boolean);if(!d.includes(Ao))throw Error(`OpenAI OAuth grant did not include ${Ao}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:d}}async function wu(e,t,o,n){let r=await ys(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:ye,resource:Ro}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return xs(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await ys(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:Ro}),t);return xs(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await b(),s=vs(),i=vs(),d=await Tu(s).catch((p)=>{if(!(p instanceof Error&&("code"in p)&&p.code==="EADDRINUSE"))throw p;throw Error(`Port ${yo} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),c=new URL(vu);c.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:ye,resource:Ro,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:c.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let u=new AbortController,l=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:ye,signal:AbortSignal.any([u.signal,e.signal])}).then((p)=>Iu(p,s));try{let p=await Promise.race([d.result,l]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(p.code,n,p.clientId,e.signal)}catch(p){if(e.signal.aborted)throw Error("Login cancelled");throw p}finally{u.abort(),d.server.close(),d.server.closeAllConnections()}}var Is={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var xo=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{xo=e.randomBytes});var Lt="app_EMoamEEZ73f0CkXaXp7hrann",Ie="https://auth.openai.com",Gu=`${Ie}/oauth/authorize`,ks=`${Ie}/oauth/token`,Io="http://localhost:1455/auth/callback",bu=`${Ie}/api/accounts/deviceauth/usercode`,Nu=`${Ie}/api/accounts/deviceauth/token`,Lu=`${Ie}/codex/device`,Mu=`${Ie}/deviceauth/callback`,Os=900,Ts="browser",ws="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!xo)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return xo(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function To(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Ps(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await To(ks,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Lt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Ps(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(ks,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Lt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Ps(o,"refresh")}async function Ku(e){let t=await To(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Lt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:Os,signal:t,poll:async()=>{let o=await To(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await b(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Lt),r.searchParams.set("redirect_uri",Io),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function bs(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Ns(e,t,o,n){return bs(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:Os});let o=await ju(t,e.signal);return Ns(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await D({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await Se(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:Io}),d;if(i.type==="callback")d=i.value;else{let c=Fu(i.input);if(c.state&&c.state!==n)throw Error("State mismatch");d=c.code}if(!d)throw Error("Missing authorization code");return await Ns(d,o,Io,e.signal)}finally{s?.close()}}async function Yu(e,t){return bs(await Vu(e,t))}var Ls={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:Ts,label:"Browser login (default)"},{id:ws,label:"Device code login (headless)"}]});if(o===ws)return qu(e);if(o!==Ts)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ms(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,d={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let c=await i.json();if(c&&typeof c==="object"&&!Array.isArray(c))d=c}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(c){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw c}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let c=rl(d);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${c?`: ${c}`:""}`)}if(typeof d.key!=="string"||d.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:d.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await b(),n=await D({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ms(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await Se(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ms(i,t,e.signal)}finally{n.close()}}var Us={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var $s="127.0.0.1",Fs=1456,Hs="/oauth/callback",wo=`http://${$s}:${Fs}${Hs}`,il=60000,Bs="browser",Ds="device-code",He="pi-gateway",Ws="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class ko extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Vs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new ko(e.status,n,r,t)}async function Oo(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Vs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await b(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:He,redirect_uri:wo,scope:Ws,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let d=await D({providerName:"Radius",host:$s,port:Fs,path:Hs,state:s,complete:(c)=>Oo(e,new URLSearchParams({grant_type:"authorization_code",client_id:He,redirect_uri:wo,code:c,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${wo}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let c=await d.wait();if(!c)throw Error("OAuth callback did not complete.");return c}finally{d.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:He,scope:Ws}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Vs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),G({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await Oo(e,new URLSearchParams({grant_type:al,client_id:He,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof ko))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function js(e){let t=Rr(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Bs,label:"Sign in with browser (recommended)"},{id:Ds,label:"Sign in with device code (when signing in from another device)"}]});if(n===Ds)return ll(t,o);if(n===Bs){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await Oo(t,new URLSearchParams({grant_type:"refresh_token",client_id:He,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Po="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",Xs="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function Ve(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function qs(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function zs(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function Go(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function bo(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?zs(e.verification_uri_complete):void 0;return{deviceCode:Ve(e,"device_code"),userCode:Ve(e,"user_code"),verificationUri:zs(Ve(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:qs(e,"expires_in")}}function Js(e,t){let o=Ve(e,"access_token"),n=e.refresh_token===void 0&&t?t:Ve(e,"refresh_token"),r=e.expires_in===void 0?fl:qs(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await Go(_l,{client_id:Po,scope:pl,referrer:"pi"},e);if(!t.ok)throw bo("device authorization",t);return ml(t.body)}async function Cl(e,t){return G({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await Go(Xs,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Po,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:Js(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:bo("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await Go(Xs,{grant_type:"refresh_token",client_id:Po,refresh_token:e},t);if(!o.ok)throw bo("token refresh",o);return Js(o.body,e)}var Ys={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Qs(){Ks({anthropic:()=>ns,openaiCodex:()=>Ls,openaiChatGPT:()=>Is,githubCopilot:()=>ls,openrouter:()=>Us,kimiCoding:()=>ms,meta:()=>Es,xai:()=>Ys,radius:js})}Gs(Vr);Qs();await import("./chunk-a454ntda.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bkm016/basalt",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Local-first AI software engineering agent runtime and web workbench",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,2 +1,2 @@
1
- import{t,i,Y,J}from"./chunk-eq59kad4.js";import{ge}from"./chunk-508cpafz.js";var n={parse:t(async(r)=>{let e=await ge("info",r);i.debug(e)},"parse")},s={version:"12.2.0"},p=t(()=>s.version,"getVersion"),g={getVersion:p},m=t((r,e,o)=>{i.debug(`rendering info diagram
1
+ import{t,i,Y,J}from"./chunk-h4bzgvbg.js";import{ge}from"./chunk-9qdx0ekk.js";var n={parse:t(async(r)=>{let e=await ge("info",r);i.debug(e)},"parse")},s={version:"12.2.0"},p=t(()=>s.version,"getVersion"),g={getVersion:p},m=t((r,e,o)=>{i.debug(`rendering info diagram
2
2
  `+r);let a=J(e);Y(a,100,400,!0),a.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),v={draw:m},y={parser:n,db:g,renderer:v};export{y as diagram};
Binary file
Binary file
@@ -0,0 +1 @@
1
+ import{Os}from"./chunk-9qdx0ekk.js";export{Os as createInfoServices};
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- import{t,nr,i,Ie,C,L,M,R,P,I,O,D,d,g,H,kt,Hi,De,Ne,Me,dn,He,Ue}from"./chunk-eq59kad4.js";import{$n}from"./chunk-7devrtv4.js";import{ze}from"./chunk-37hn49td.js";import{Re}from"./chunk-tefm9md2.js";var Fe=function(){var s=t(function(j,o,c,p){for(c=c||{},p=j.length;p--;c[j[p]]=o);return c},"o"),l=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],b=[2,2],n=[1,7],h=[1,9],k=[1,10],S=[1,11],y=[1,12],T=[1,30],f=[1,23],_=[1,24],w=[1,25],q=[1,26],X=[1,27],N=[1,19],G=[1,28],te=[1,29],V=[1,20],F=[1,18],Y=[1,21],z=[1,22],Ye=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],Se=[1,36],Te=[1,37],Ce=[1,38],Oe=[1,39],xe=[1,40],se=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],U=[1,46],K=[1,47],ie=[1,57],re=[43,51,53,54,55,74,75],ae=[1,70],ne=[1,68],Z=[1,65],oe=[1,69],le=[1,71],ue=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],de=[1,78],be=[1,77],pe=[1,76],Pe=[69,70,71,72,73],Ke=[1,91],Ze=[6,9,45,50],J=[6,9,12,44,45,50,51,52],fe=[1,101],ke=[1,100],ge=[1,99],ce=[18,61],je=[1,110],qe=[1,109],We=[20,43,51,53,54,55],Ae=[18,61,64,66],ve={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:t(function(o,c,p,a,m,e,he){var r=e.length-1;switch(m){case 1:break;case 2:this.$=[];break;case 3:this.$=e[r-1].concat(e[r]);break;case 4:this.$=e[r];break;case 5:case 6:this.$=[];break;case 7:a.addEntity(e[r-4]),a.addEntity(e[r-2]),a.addRelationship(e[r-4],e[r],e[r-2],e[r-3]),this.$=[e[r-4],e[r-2]];break;case 8:a.addEntity(e[r-8]),a.addEntity(e[r-4]),a.addRelationship(e[r-8],e[r],e[r-4],e[r-5]),a.setClass([e[r-8]],e[r-6]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-8],e[r-4]];break;case 9:a.addEntity(e[r-6]),a.addEntity(e[r-2]),a.addRelationship(e[r-6],e[r],e[r-2],e[r-3]),a.setClass([e[r-6]],e[r-4]),this.$=[e[r-6],e[r-2]];break;case 10:a.addEntity(e[r-6]),a.addEntity(e[r-4]),a.addRelationship(e[r-6],e[r],e[r-4],e[r-5]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-6],e[r-4]];break;case 11:a.addEntity(e[r-3]),a.addAttributes(e[r-3],e[r-1]),this.$=[e[r-3]];break;case 12:a.addEntity(e[r-5]),a.addAttributes(e[r-5],e[r-1]),a.setClass([e[r-5]],e[r-3]),this.$=[e[r-5]];break;case 13:a.addEntity(e[r-2]),this.$=[e[r-2]];break;case 14:a.addEntity(e[r-4]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-4]];break;case 15:a.addEntity(e[r]),this.$=[e[r]];break;case 16:a.addEntity(e[r-2]),a.setClass([e[r-2]],e[r]),this.$=[e[r-2]];break;case 17:a.addEntity(e[r-6],e[r-4]),a.addAttributes(e[r-6],e[r-1]),this.$=[e[r-6]];break;case 18:a.addEntity(e[r-8],e[r-6]),a.addAttributes(e[r-8],e[r-1]),a.setClass([e[r-8]],e[r-3]),this.$=[e[r-8]];break;case 19:a.addEntity(e[r-5],e[r-3]),this.$=[e[r-5]];break;case 20:a.addEntity(e[r-7],e[r-5]),a.setClass([e[r-7]],e[r-2]),this.$=[e[r-7]];break;case 21:a.addEntity(e[r-3],e[r-1]);break;case 22:a.addEntity(e[r-5],e[r-3]),a.setClass([e[r-5]],e[r]);break;case 23:case 24:this.$=e[r].trim(),a.setAccTitle(this.$);break;case 25:case 26:this.$=e[r].trim(),a.setAccDescription(this.$);break;case 27:if(!a.subgraphDepth)a.setDirection(e[r].value),this.$=[];else this.$=e[r];break;case 31:a.subgraphDepth=(a.subgraphDepth||1)-1,this.$=a.addSubGraph({text:e[r-2].id},e[r-1],{text:e[r-2].text});break;case 32:a.subgraphDepth=(a.subgraphDepth||0)+1,this.$={id:e[r-1],text:e[r-1]};break;case 33:a.subgraphDepth=(a.subgraphDepth||0)+1,this.$={id:e[r-4],text:e[r-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=e[r];break;case 35:this.$=e[r-1]+" "+e[r];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=e[r-3],a.addClass(e[r-2],e[r-1]);break;case 41:case 42:case 63:case 72:this.$=[e[r]];break;case 43:case 44:this.$=e[r-2].concat([e[r]]);break;case 45:this.$=e[r-2],a.setClass(e[r-1],e[r]);break;case 46:this.$=e[r-3],a.addCssStyles(e[r-2],e[r-1]);break;case 47:this.$=[e[r]];break;case 48:e[r-2].push(e[r]),this.$=e[r-2];break;case 50:this.$=e[r-1]+e[r];break;case 58:case 84:case 85:this.$=e[r].replace(/"/g,"");break;case 64:e[r].push(e[r-1]),this.$=e[r];break;case 65:this.$={type:e[r-1],name:e[r]};break;case 66:this.$={type:e[r-2],name:e[r-1],keys:e[r]};break;case 67:this.$={type:e[r-2],name:e[r-1],comment:e[r]};break;case 68:this.$={type:e[r-3],name:e[r-2],keys:e[r-1],comment:e[r]};break;case 69:case 71:case 74:this.$=e[r];break;case 70:this.$=e[r-1]+e[r];break;case 73:e[r-2].push(e[r]),this.$=e[r-2];break;case 75:this.$=e[r].replace(/"/g,"");break;case 76:this.$={cardA:e[r],relType:e[r-1],cardB:e[r-2]};break;case 77:this.$=a.Cardinality.ZERO_OR_ONE;break;case 78:this.$=a.Cardinality.ZERO_OR_MORE;break;case 79:this.$=a.Cardinality.ONE_OR_MORE;break;case 80:this.$=a.Cardinality.ONLY_ONE;break;case 81:this.$=a.Cardinality.MD_PARENT;break;case 82:this.$=a.Identification.NON_IDENTIFYING;break;case 83:this.$=a.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(l,b,{5:3}),{6:[1,4],7:5,8:6,9:n,10:8,21:h,23:k,25:S,27:y,28:13,29:14,30:15,31:16,32:17,34:T,37:f,38:_,39:w,40:q,41:X,43:N,46:G,47:te,51:V,53:F,54:Y,55:z},s(l,Ye,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:Se,70:Te,71:Ce,72:Oe,73:xe}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,b,{5:44}),s(se,[2,58]),s(se,[2,59]),s(se,[2,60]),s(se,[2,61]),s(se,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:U,44:K},{15:48,43:U,44:K},{15:49,43:U,44:K},{10:50,43:N,51:V,53:F,54:Y,55:z},{10:51,43:N,51:V,53:F,54:Y,55:z},{15:52,43:U,44:K},{17:53,18:[1,54],56:55,57:56,61:ie},{10:58,43:N,51:V,53:F,54:Y,55:z},{68:59,74:[1,60],75:[1,61]},s(re,[2,77]),s(re,[2,78]),s(re,[2,79]),s(re,[2,80]),s(re,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:n,10:8,21:h,23:k,25:S,27:y,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:T,37:f,38:_,39:w,40:q,41:X,43:N,46:G,47:te,51:V,53:F,54:Y,55:z},{12:ae,42:64,44:ne,45:Z,48:66,49:67,51:oe,52:le},s(ue,[2,41]),s(ue,[2,42]),{15:72,43:U,44:K,45:Z},{12:ae,42:73,44:ne,45:Z,48:66,49:67,51:oe,52:le},{6:de,9:be,19:[1,75],35:74,50:pe},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:Z,69:Se,70:Te,71:Ce,72:Oe,73:xe}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:ie},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:Se,70:Te,71:Ce,72:Oe,73:xe},s(Pe,[2,82]),s(Pe,[2,83]),s(u,[2,31]),s(u,Ye),{6:de,9:be,35:90,45:Ke,50:pe},{43:[1,92],44:[1,93]},s(Ze,[2,47],{49:94,12:ae,44:ne,51:oe,52:le}),s(J,[2,49]),s(J,[2,54]),s(J,[2,55]),s(J,[2,56]),s(J,[2,57]),s(u,[2,45],{45:Z}),{6:de,9:be,35:95,45:Ke,50:pe},s(u,[2,32]),{10:97,36:96,43:N,51:V,53:F,54:Y,55:z},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:fe,53:ke,76:ge},{15:102,43:U,44:K},{10:103,43:N,51:V,53:F,54:Y,55:z},{17:104,18:[1,105],56:55,57:56,61:ie},s(u,[2,11]),{18:[2,64]},s(ce,[2,65],{59:106,60:107,63:108,65:je,66:qe}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:ae,44:ne,48:113,49:67,51:oe,52:le},s(ue,[2,43]),s(ue,[2,44]),s(J,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:N,51:V,53:F,54:Y,55:z},s(We,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:Z},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(ce,[2,66],{60:120,64:[1,121],66:qe}),s(ce,[2,67]),s(Ae,[2,72]),s(ce,[2,75]),s(Ae,[2,74]),{17:122,18:[1,123],56:55,57:56,61:ie},{15:124,43:U,44:K},s(Ze,[2,48],{49:94,12:ae,44:ne,51:oe,52:le}),{6:de,9:be,35:125,50:pe},s(We,[2,35]),{13:126,43:fe,53:ke,76:ge},{15:127,43:U,44:K},{13:128,43:fe,53:ke,76:ge},s(u,[2,12]),s(ce,[2,68]),{63:129,65:je},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:Z}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:Z},s(u,[2,9]),s(Ae,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:ie},{13:135,43:fe,53:ke,76:ge},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:t(function(o,c){if(c.recoverable)this.trace(o);else{var p=Error(o);throw p.hash=c,p}},"parseError"),parse:t(function(o){var c=this,p=[0],a=[],m=[null],e=[],he=this.table,r="",_e=0,Qe=0,Xe=0,rt=2,Je=1,at=e.slice.call(arguments,1),E=Object.create(this.lexer),W={yy:{}};for(var Le in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,Le))W.yy[Le]=this.yy[Le];if(E.setInput(o,W.yy),W.yy.lexer=E,W.yy.parser=this,typeof E.yylloc>"u")E.yylloc={};var we=E.yylloc;e.push(we);var nt=E.options&&E.options.ranges;if(typeof W.yy.parseError==="function")this.parseError=W.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function ot(v){p.length=p.length-2*v,m.length=m.length-v,e.length=e.length-v}t(ot,"popStack");function $e(){var v=a.pop()||E.lex()||Je;if(typeof v!=="number"){if(v instanceof Array)a=v,v=a.pop();v=c.symbols_[v]||v}return v}t($e,"lex");var x,Ve,Q,A,pt,Be,ee={},me,B,et,Ee;while(!0){if(Q=p[p.length-1],this.defaultActions[Q])A=this.defaultActions[Q];else{if(x===null||typeof x>"u")x=$e();A=he[Q]&&he[Q][x]}if(typeof A>"u"||!A.length||!A[0]){var Ge="";Ee=[];for(me in he[Q])if(this.terminals_[me]&&me>rt)Ee.push("'"+this.terminals_[me]+"'");if(E.showPosition)Ge="Parse error on line "+(_e+1)+`:
1
+ import{t,nr,i,Ie,C,L,M,R,P,I,O,D,d,g,H,kt,Hi,De,Ne,Me,dn,He,Ue}from"./chunk-h4bzgvbg.js";import{$n}from"./chunk-j0dyf1g8.js";import{ze}from"./chunk-r7afv22v.js";import{Re}from"./chunk-qv5d69fn.js";var Fe=function(){var s=t(function(j,o,c,p){for(c=c||{},p=j.length;p--;c[j[p]]=o);return c},"o"),l=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],b=[2,2],n=[1,7],h=[1,9],k=[1,10],S=[1,11],y=[1,12],T=[1,30],f=[1,23],_=[1,24],w=[1,25],q=[1,26],X=[1,27],N=[1,19],G=[1,28],te=[1,29],V=[1,20],F=[1,18],Y=[1,21],z=[1,22],Ye=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],Se=[1,36],Te=[1,37],Ce=[1,38],Oe=[1,39],xe=[1,40],se=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],U=[1,46],K=[1,47],ie=[1,57],re=[43,51,53,54,55,74,75],ae=[1,70],ne=[1,68],Z=[1,65],oe=[1,69],le=[1,71],ue=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],de=[1,78],be=[1,77],pe=[1,76],Pe=[69,70,71,72,73],Ke=[1,91],Ze=[6,9,45,50],J=[6,9,12,44,45,50,51,52],fe=[1,101],ke=[1,100],ge=[1,99],ce=[18,61],je=[1,110],qe=[1,109],We=[20,43,51,53,54,55],Ae=[18,61,64,66],ve={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:t(function(o,c,p,a,m,e,he){var r=e.length-1;switch(m){case 1:break;case 2:this.$=[];break;case 3:this.$=e[r-1].concat(e[r]);break;case 4:this.$=e[r];break;case 5:case 6:this.$=[];break;case 7:a.addEntity(e[r-4]),a.addEntity(e[r-2]),a.addRelationship(e[r-4],e[r],e[r-2],e[r-3]),this.$=[e[r-4],e[r-2]];break;case 8:a.addEntity(e[r-8]),a.addEntity(e[r-4]),a.addRelationship(e[r-8],e[r],e[r-4],e[r-5]),a.setClass([e[r-8]],e[r-6]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-8],e[r-4]];break;case 9:a.addEntity(e[r-6]),a.addEntity(e[r-2]),a.addRelationship(e[r-6],e[r],e[r-2],e[r-3]),a.setClass([e[r-6]],e[r-4]),this.$=[e[r-6],e[r-2]];break;case 10:a.addEntity(e[r-6]),a.addEntity(e[r-4]),a.addRelationship(e[r-6],e[r],e[r-4],e[r-5]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-6],e[r-4]];break;case 11:a.addEntity(e[r-3]),a.addAttributes(e[r-3],e[r-1]),this.$=[e[r-3]];break;case 12:a.addEntity(e[r-5]),a.addAttributes(e[r-5],e[r-1]),a.setClass([e[r-5]],e[r-3]),this.$=[e[r-5]];break;case 13:a.addEntity(e[r-2]),this.$=[e[r-2]];break;case 14:a.addEntity(e[r-4]),a.setClass([e[r-4]],e[r-2]),this.$=[e[r-4]];break;case 15:a.addEntity(e[r]),this.$=[e[r]];break;case 16:a.addEntity(e[r-2]),a.setClass([e[r-2]],e[r]),this.$=[e[r-2]];break;case 17:a.addEntity(e[r-6],e[r-4]),a.addAttributes(e[r-6],e[r-1]),this.$=[e[r-6]];break;case 18:a.addEntity(e[r-8],e[r-6]),a.addAttributes(e[r-8],e[r-1]),a.setClass([e[r-8]],e[r-3]),this.$=[e[r-8]];break;case 19:a.addEntity(e[r-5],e[r-3]),this.$=[e[r-5]];break;case 20:a.addEntity(e[r-7],e[r-5]),a.setClass([e[r-7]],e[r-2]),this.$=[e[r-7]];break;case 21:a.addEntity(e[r-3],e[r-1]);break;case 22:a.addEntity(e[r-5],e[r-3]),a.setClass([e[r-5]],e[r]);break;case 23:case 24:this.$=e[r].trim(),a.setAccTitle(this.$);break;case 25:case 26:this.$=e[r].trim(),a.setAccDescription(this.$);break;case 27:if(!a.subgraphDepth)a.setDirection(e[r].value),this.$=[];else this.$=e[r];break;case 31:a.subgraphDepth=(a.subgraphDepth||1)-1,this.$=a.addSubGraph({text:e[r-2].id},e[r-1],{text:e[r-2].text});break;case 32:a.subgraphDepth=(a.subgraphDepth||0)+1,this.$={id:e[r-1],text:e[r-1]};break;case 33:a.subgraphDepth=(a.subgraphDepth||0)+1,this.$={id:e[r-4],text:e[r-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=e[r];break;case 35:this.$=e[r-1]+" "+e[r];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=e[r-3],a.addClass(e[r-2],e[r-1]);break;case 41:case 42:case 63:case 72:this.$=[e[r]];break;case 43:case 44:this.$=e[r-2].concat([e[r]]);break;case 45:this.$=e[r-2],a.setClass(e[r-1],e[r]);break;case 46:this.$=e[r-3],a.addCssStyles(e[r-2],e[r-1]);break;case 47:this.$=[e[r]];break;case 48:e[r-2].push(e[r]),this.$=e[r-2];break;case 50:this.$=e[r-1]+e[r];break;case 58:case 84:case 85:this.$=e[r].replace(/"/g,"");break;case 64:e[r].push(e[r-1]),this.$=e[r];break;case 65:this.$={type:e[r-1],name:e[r]};break;case 66:this.$={type:e[r-2],name:e[r-1],keys:e[r]};break;case 67:this.$={type:e[r-2],name:e[r-1],comment:e[r]};break;case 68:this.$={type:e[r-3],name:e[r-2],keys:e[r-1],comment:e[r]};break;case 69:case 71:case 74:this.$=e[r];break;case 70:this.$=e[r-1]+e[r];break;case 73:e[r-2].push(e[r]),this.$=e[r-2];break;case 75:this.$=e[r].replace(/"/g,"");break;case 76:this.$={cardA:e[r],relType:e[r-1],cardB:e[r-2]};break;case 77:this.$=a.Cardinality.ZERO_OR_ONE;break;case 78:this.$=a.Cardinality.ZERO_OR_MORE;break;case 79:this.$=a.Cardinality.ONE_OR_MORE;break;case 80:this.$=a.Cardinality.ONLY_ONE;break;case 81:this.$=a.Cardinality.MD_PARENT;break;case 82:this.$=a.Identification.NON_IDENTIFYING;break;case 83:this.$=a.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(l,b,{5:3}),{6:[1,4],7:5,8:6,9:n,10:8,21:h,23:k,25:S,27:y,28:13,29:14,30:15,31:16,32:17,34:T,37:f,38:_,39:w,40:q,41:X,43:N,46:G,47:te,51:V,53:F,54:Y,55:z},s(l,Ye,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:Se,70:Te,71:Ce,72:Oe,73:xe}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,b,{5:44}),s(se,[2,58]),s(se,[2,59]),s(se,[2,60]),s(se,[2,61]),s(se,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:U,44:K},{15:48,43:U,44:K},{15:49,43:U,44:K},{10:50,43:N,51:V,53:F,54:Y,55:z},{10:51,43:N,51:V,53:F,54:Y,55:z},{15:52,43:U,44:K},{17:53,18:[1,54],56:55,57:56,61:ie},{10:58,43:N,51:V,53:F,54:Y,55:z},{68:59,74:[1,60],75:[1,61]},s(re,[2,77]),s(re,[2,78]),s(re,[2,79]),s(re,[2,80]),s(re,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:n,10:8,21:h,23:k,25:S,27:y,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:T,37:f,38:_,39:w,40:q,41:X,43:N,46:G,47:te,51:V,53:F,54:Y,55:z},{12:ae,42:64,44:ne,45:Z,48:66,49:67,51:oe,52:le},s(ue,[2,41]),s(ue,[2,42]),{15:72,43:U,44:K,45:Z},{12:ae,42:73,44:ne,45:Z,48:66,49:67,51:oe,52:le},{6:de,9:be,19:[1,75],35:74,50:pe},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:Z,69:Se,70:Te,71:Ce,72:Oe,73:xe}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:ie},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:Se,70:Te,71:Ce,72:Oe,73:xe},s(Pe,[2,82]),s(Pe,[2,83]),s(u,[2,31]),s(u,Ye),{6:de,9:be,35:90,45:Ke,50:pe},{43:[1,92],44:[1,93]},s(Ze,[2,47],{49:94,12:ae,44:ne,51:oe,52:le}),s(J,[2,49]),s(J,[2,54]),s(J,[2,55]),s(J,[2,56]),s(J,[2,57]),s(u,[2,45],{45:Z}),{6:de,9:be,35:95,45:Ke,50:pe},s(u,[2,32]),{10:97,36:96,43:N,51:V,53:F,54:Y,55:z},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:fe,53:ke,76:ge},{15:102,43:U,44:K},{10:103,43:N,51:V,53:F,54:Y,55:z},{17:104,18:[1,105],56:55,57:56,61:ie},s(u,[2,11]),{18:[2,64]},s(ce,[2,65],{59:106,60:107,63:108,65:je,66:qe}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:ae,44:ne,48:113,49:67,51:oe,52:le},s(ue,[2,43]),s(ue,[2,44]),s(J,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:N,51:V,53:F,54:Y,55:z},s(We,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:Z},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(ce,[2,66],{60:120,64:[1,121],66:qe}),s(ce,[2,67]),s(Ae,[2,72]),s(ce,[2,75]),s(Ae,[2,74]),{17:122,18:[1,123],56:55,57:56,61:ie},{15:124,43:U,44:K},s(Ze,[2,48],{49:94,12:ae,44:ne,51:oe,52:le}),{6:de,9:be,35:125,50:pe},s(We,[2,35]),{13:126,43:fe,53:ke,76:ge},{15:127,43:U,44:K},{13:128,43:fe,53:ke,76:ge},s(u,[2,12]),s(ce,[2,68]),{63:129,65:je},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:Z}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:Z},s(u,[2,9]),s(Ae,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:ie},{13:135,43:fe,53:ke,76:ge},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:t(function(o,c){if(c.recoverable)this.trace(o);else{var p=Error(o);throw p.hash=c,p}},"parseError"),parse:t(function(o){var c=this,p=[0],a=[],m=[null],e=[],he=this.table,r="",_e=0,Qe=0,Xe=0,rt=2,Je=1,at=e.slice.call(arguments,1),E=Object.create(this.lexer),W={yy:{}};for(var Le in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,Le))W.yy[Le]=this.yy[Le];if(E.setInput(o,W.yy),W.yy.lexer=E,W.yy.parser=this,typeof E.yylloc>"u")E.yylloc={};var we=E.yylloc;e.push(we);var nt=E.options&&E.options.ranges;if(typeof W.yy.parseError==="function")this.parseError=W.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function ot(v){p.length=p.length-2*v,m.length=m.length-v,e.length=e.length-v}t(ot,"popStack");function $e(){var v=a.pop()||E.lex()||Je;if(typeof v!=="number"){if(v instanceof Array)a=v,v=a.pop();v=c.symbols_[v]||v}return v}t($e,"lex");var x,Ve,Q,A,pt,Be,ee={},me,B,et,Ee;while(!0){if(Q=p[p.length-1],this.defaultActions[Q])A=this.defaultActions[Q];else{if(x===null||typeof x>"u")x=$e();A=he[Q]&&he[Q][x]}if(typeof A>"u"||!A.length||!A[0]){var Ge="";Ee=[];for(me in he[Q])if(this.terminals_[me]&&me>rt)Ee.push("'"+this.terminals_[me]+"'");if(E.showPosition)Ge="Parse error on line "+(_e+1)+`:
2
2
  `+E.showPosition()+`
3
3
  Expecting `+Ee.join(", ")+", got '"+(this.terminals_[x]||x)+"'";else Ge="Parse error on line "+(_e+1)+": Unexpected "+(x==Je?"end of input":"'"+(this.terminals_[x]||x)+"'");this.parseError(Ge,{text:E.match,token:this.terminals_[x]||x,line:E.yylineno,loc:we,expected:Ee})}if(A[0]instanceof Array&&A.length>1)throw Error("Parse Error: multiple actions possible at state: "+Q+", token: "+x);switch(A[0]){case 1:if(p.push(x),m.push(E.yytext),e.push(E.yylloc),p.push(A[1]),x=null,!Ve){if(Qe=E.yyleng,r=E.yytext,_e=E.yylineno,we=E.yylloc,Xe>0)Xe--}else x=Ve,Ve=null;break;case 2:if(B=this.productions_[A[1]][1],ee.$=m[m.length-B],ee._$={first_line:e[e.length-(B||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(B||1)].first_column,last_column:e[e.length-1].last_column},nt)ee._$.range=[e[e.length-(B||1)].range[0],e[e.length-1].range[1]];if(Be=this.performAction.apply(ee,[r,Qe,_e,W.yy,A[1],m,e].concat(at)),typeof Be<"u")return Be;if(B)p=p.slice(0,-1*B*2),m=m.slice(0,-1*B),e=e.slice(0,-1*B);p.push(this.productions_[A[1]][0]),m.push(ee.$),e.push(ee._$),et=he[p[p.length-2]][p[p.length-1]],p.push(et);break;case 3:return!0}}return!0},"parse")},it=function(){var j={EOF:1,parseError:t(function(c,p){if(this.yy.parser)this.yy.parser.parseError(c,p);else throw Error(c)},"parseError"),setInput:t(function(o,c){if(this.yy=c||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var c=o.match(/(?:\r\n?|\n).*/g);if(c)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),o},"input"),unput:t(function(o){var c=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var a=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1)this.yylineno-=p.length-1;var m=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===a.length?this.yylloc.first_column:0)+a[a.length-p.length].length-p[0].length:this.yylloc.first_column-c},this.options.ranges)this.yylloc.range=[m[0],m[0]+this.yyleng-c];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(o){this.unput(this.match.slice(o))},"less"),pastInput:t(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var o=this.match;if(o.length<20)o+=this._input.substr(0,20-o.length);return(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var o=this.pastInput(),c=Array(o.length+1).join("-");return o+this.upcomingInput()+`
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- import{t,Y,L,M,R,P,I,O,D,d,g}from"./chunk-eq59kad4.js";import{hr,Ei,fc,jt}from"./chunk-c1s7faqj.js";import{yn}from"./chunk-7rs26q98.js";import{Et}from"./chunk-6ktmzq32.js";var nt=function(){var e=t(function(h,n,s,l){for(s=s||{},l=h.length;l--;s[h[l]]=n);return s},"o"),r=[6,8,10,11,12,14,16,17,18],a=[1,9],p=[1,10],i=[1,11],u=[1,12],m=[1,13],o=[1,14],x={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:t(function(n,s,l,y,f,c,w){var _=c.length-1;switch(f){case 1:return c[_-1];case 2:this.$=[];break;case 3:c[_-1].push(c[_]),this.$=c[_-1];break;case 4:case 5:this.$=c[_];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[_].substr(6)),this.$=c[_].substr(6);break;case 9:this.$=c[_].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[_].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[_].substr(8)),this.$=c[_].substr(8);break;case 13:y.addTask(c[_-1],c[_]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(r,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:p,14:i,16:u,17:m,18:o},e(r,[2,7],{1:[2,1]}),e(r,[2,3]),{9:15,11:a,12:p,14:i,16:u,17:m,18:o},e(r,[2,5]),e(r,[2,6]),e(r,[2,8]),{13:[1,16]},{15:[1,17]},e(r,[2,11]),e(r,[2,12]),{19:[1,18]},e(r,[2,4]),e(r,[2,9]),e(r,[2,10]),e(r,[2,13])],defaultActions:{},parseError:t(function(n,s){if(s.recoverable)this.trace(n);else{var l=Error(n);throw l.hash=s,l}},"parseError"),parse:t(function(n){var s=this,l=[0],y=[],f=[null],c=[],w=this.table,_="",B=0,ot=0,ct=0,_t=2,ht=1,vt=c.slice.call(arguments,1),v=Object.create(this.lexer),N={yy:{}};for(var K in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,K))N.yy[K]=this.yy[K];if(v.setInput(n,N.yy),N.yy.lexer=v,N.yy.parser=this,typeof v.yylloc>"u")v.yylloc={};var Q=v.yylloc;c.push(Q);var wt=v.options&&v.options.ranges;if(typeof N.yy.parseError==="function")this.parseError=N.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Tt(E){l.length=l.length-2*E,f.length=f.length-E,c.length=c.length-E}t(Tt,"popStack");function ut(){var E=y.pop()||v.lex()||ht;if(typeof E!=="number"){if(E instanceof Array)y=E,E=y.pop();E=s.symbols_[E]||E}return E}t(ut,"lex");var T,tt,z,S,Ht,et,W={},U,F,yt,Z;while(!0){if(z=l[l.length-1],this.defaultActions[z])S=this.defaultActions[z];else{if(T===null||typeof T>"u")T=ut();S=w[z]&&w[z][T]}if(typeof S>"u"||!S.length||!S[0]){var rt="";Z=[];for(U in w[z])if(this.terminals_[U]&&U>_t)Z.push("'"+this.terminals_[U]+"'");if(v.showPosition)rt="Parse error on line "+(B+1)+`:
1
+ import{t,Y,L,M,R,P,I,O,D,d,g}from"./chunk-h4bzgvbg.js";import{hr,Ei,fc,jt}from"./chunk-shtkgxz6.js";import{yn}from"./chunk-dsffzc1e.js";import{Et}from"./chunk-cgwnzse1.js";var nt=function(){var e=t(function(h,n,s,l){for(s=s||{},l=h.length;l--;s[h[l]]=n);return s},"o"),r=[6,8,10,11,12,14,16,17,18],a=[1,9],p=[1,10],i=[1,11],u=[1,12],m=[1,13],o=[1,14],x={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:t(function(n,s,l,y,f,c,w){var _=c.length-1;switch(f){case 1:return c[_-1];case 2:this.$=[];break;case 3:c[_-1].push(c[_]),this.$=c[_-1];break;case 4:case 5:this.$=c[_];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[_].substr(6)),this.$=c[_].substr(6);break;case 9:this.$=c[_].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[_].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[_].substr(8)),this.$=c[_].substr(8);break;case 13:y.addTask(c[_-1],c[_]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(r,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:p,14:i,16:u,17:m,18:o},e(r,[2,7],{1:[2,1]}),e(r,[2,3]),{9:15,11:a,12:p,14:i,16:u,17:m,18:o},e(r,[2,5]),e(r,[2,6]),e(r,[2,8]),{13:[1,16]},{15:[1,17]},e(r,[2,11]),e(r,[2,12]),{19:[1,18]},e(r,[2,4]),e(r,[2,9]),e(r,[2,10]),e(r,[2,13])],defaultActions:{},parseError:t(function(n,s){if(s.recoverable)this.trace(n);else{var l=Error(n);throw l.hash=s,l}},"parseError"),parse:t(function(n){var s=this,l=[0],y=[],f=[null],c=[],w=this.table,_="",B=0,ot=0,ct=0,_t=2,ht=1,vt=c.slice.call(arguments,1),v=Object.create(this.lexer),N={yy:{}};for(var K in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,K))N.yy[K]=this.yy[K];if(v.setInput(n,N.yy),N.yy.lexer=v,N.yy.parser=this,typeof v.yylloc>"u")v.yylloc={};var Q=v.yylloc;c.push(Q);var wt=v.options&&v.options.ranges;if(typeof N.yy.parseError==="function")this.parseError=N.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Tt(E){l.length=l.length-2*E,f.length=f.length-E,c.length=c.length-E}t(Tt,"popStack");function ut(){var E=y.pop()||v.lex()||ht;if(typeof E!=="number"){if(E instanceof Array)y=E,E=y.pop();E=s.symbols_[E]||E}return E}t(ut,"lex");var T,tt,z,S,Ht,et,W={},U,F,yt,Z;while(!0){if(z=l[l.length-1],this.defaultActions[z])S=this.defaultActions[z];else{if(T===null||typeof T>"u")T=ut();S=w[z]&&w[z][T]}if(typeof S>"u"||!S.length||!S[0]){var rt="";Z=[];for(U in w[z])if(this.terminals_[U]&&U>_t)Z.push("'"+this.terminals_[U]+"'");if(v.showPosition)rt="Parse error on line "+(B+1)+`:
2
2
  `+v.showPosition()+`
3
3
  Expecting `+Z.join(", ")+", got '"+(this.terminals_[T]||T)+"'";else rt="Parse error on line "+(B+1)+": Unexpected "+(T==ht?"end of input":"'"+(this.terminals_[T]||T)+"'");this.parseError(rt,{text:v.match,token:this.terminals_[T]||T,line:v.yylineno,loc:Q,expected:Z})}if(S[0]instanceof Array&&S.length>1)throw Error("Parse Error: multiple actions possible at state: "+z+", token: "+T);switch(S[0]){case 1:if(l.push(T),f.push(v.yytext),c.push(v.yylloc),l.push(S[1]),T=null,!tt){if(ot=v.yyleng,_=v.yytext,B=v.yylineno,Q=v.yylloc,ct>0)ct--}else T=tt,tt=null;break;case 2:if(F=this.productions_[S[1]][1],W.$=f[f.length-F],W._$={first_line:c[c.length-(F||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(F||1)].first_column,last_column:c[c.length-1].last_column},wt)W._$.range=[c[c.length-(F||1)].range[0],c[c.length-1].range[1]];if(et=this.performAction.apply(W,[_,ot,B,N.yy,S[1],f,c].concat(vt)),typeof et<"u")return et;if(F)l=l.slice(0,-1*F*2),f=f.slice(0,-1*F),c=c.slice(0,-1*F);l.push(this.productions_[S[1]][0]),f.push(W.$),c.push(W._$),yt=w[l[l.length-2]][l[l.length-1]],l.push(yt);break;case 3:return!0}}return!0},"parse")},k=function(){var h={EOF:1,parseError:t(function(s,l){if(this.yy.parser)this.yy.parser.parseError(s,l);else throw Error(s)},"parseError"),setInput:t(function(n,s){if(this.yy=s||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var s=n.match(/(?:\r\n?|\n).*/g);if(s)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),n},"input"),unput:t(function(n){var s=n.length,l=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var y=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1)this.yylineno-=l.length-1;var f=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-s},this.options.ranges)this.yylloc.range=[f[0],f[0]+this.yyleng-s];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(n){this.unput(this.match.slice(n))},"less"),pastInput:t(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var n=this.match;if(n.length<20)n+=this._input.substr(0,20-n.length);return(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var n=this.pastInput(),s=Array(n.length+1).join("-");return n+this.upcomingInput()+`
Binary file
Binary file