@caspian2026/agent-sdk 0.0.25 → 0.0.27

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 (362) hide show
  1. package/dist/gateway/index.js +98 -22
  2. package/dist/gateway/worker.js +1005 -982
  3. package/dist/sdk/query.cjs +2 -362
  4. package/dist/sdk/query.js +2 -367
  5. package/package.json +126 -128
  6. package/dist/chunk-04n4fe72.js +0 -107
  7. package/dist/chunk-04ys66ej.js +0 -344
  8. package/dist/chunk-07069jq1.js +0 -30
  9. package/dist/chunk-0731m51q.js +0 -8
  10. package/dist/chunk-086x4ct4.js +0 -26
  11. package/dist/chunk-0btqb97n.js +0 -295
  12. package/dist/chunk-0paqc2yw.js +0 -15
  13. package/dist/chunk-0r1rjydx.js +0 -145
  14. package/dist/chunk-0r5bb9j4.js +0 -477
  15. package/dist/chunk-0t81d427.js +0 -41
  16. package/dist/chunk-0teq2mz0.js +0 -420
  17. package/dist/chunk-0vkfrmqm.js +0 -690
  18. package/dist/chunk-0vp3wfab.js +0 -12
  19. package/dist/chunk-0warp8dx.js +0 -253
  20. package/dist/chunk-0xjaqda8.js +0 -1124
  21. package/dist/chunk-10gzv316.js +0 -62
  22. package/dist/chunk-11pq9n08.js +0 -168
  23. package/dist/chunk-1ae3nt9j.js +0 -31
  24. package/dist/chunk-1fmb0njn.js +0 -396
  25. package/dist/chunk-1gx78081.js +0 -66
  26. package/dist/chunk-1h2famwb.js +0 -49
  27. package/dist/chunk-1ng8xwxz.js +0 -276
  28. package/dist/chunk-1v7jp29h.js +0 -206
  29. package/dist/chunk-1xxy5zhb.js +0 -673
  30. package/dist/chunk-20b73w7w.js +0 -117
  31. package/dist/chunk-20qxd83a.js +0 -1161
  32. package/dist/chunk-2239ny9q.js +0 -90
  33. package/dist/chunk-22d4rnef.js +0 -226
  34. package/dist/chunk-26wtxbdc.js +0 -13870
  35. package/dist/chunk-27225bjh.js +0 -618
  36. package/dist/chunk-2b0e32an.js +0 -5822
  37. package/dist/chunk-2bfa9w1y.js +0 -323
  38. package/dist/chunk-2epq04w1.js +0 -63
  39. package/dist/chunk-2fwze72g.js +0 -24
  40. package/dist/chunk-2gzv8nrw.js +0 -205
  41. package/dist/chunk-2mexte1r.js +0 -349
  42. package/dist/chunk-2mzaqh5g.js +0 -338
  43. package/dist/chunk-2tb6mzfc.js +0 -81
  44. package/dist/chunk-2xq0g43w.js +0 -558
  45. package/dist/chunk-334aeqg9.js +0 -90
  46. package/dist/chunk-34jx4rjd.js +0 -995
  47. package/dist/chunk-35w5nhex.js +0 -132
  48. package/dist/chunk-3c25bcsw.js +0 -17
  49. package/dist/chunk-3eaxj8dg.js +0 -151
  50. package/dist/chunk-3fdgrwd2.js +0 -111
  51. package/dist/chunk-3jw0r58d.js +0 -121
  52. package/dist/chunk-3mgywd32.js +0 -8
  53. package/dist/chunk-3nk79af8.js +0 -8
  54. package/dist/chunk-3vy1jt9p.js +0 -1010
  55. package/dist/chunk-3x78pd4j.js +0 -153
  56. package/dist/chunk-47x3dsmn.js +0 -95
  57. package/dist/chunk-49pqt48n.js +0 -108
  58. package/dist/chunk-4f7m9fjw.js +0 -317
  59. package/dist/chunk-4jm600zv.js +0 -13
  60. package/dist/chunk-4k9d7gxv.js +0 -118
  61. package/dist/chunk-4net8san.js +0 -155
  62. package/dist/chunk-4pbx3g7s.js +0 -26
  63. package/dist/chunk-4v125j4z.js +0 -58
  64. package/dist/chunk-4vxkv5vz.js +0 -1438
  65. package/dist/chunk-51fqpjy3.js +0 -121
  66. package/dist/chunk-52e64f2h.js +0 -439
  67. package/dist/chunk-52e9mdjv.js +0 -684
  68. package/dist/chunk-55raexh7.js +0 -14358
  69. package/dist/chunk-59pq5122.js +0 -269
  70. package/dist/chunk-5bsj67v1.js +0 -349
  71. package/dist/chunk-5ccdsxgy.js +0 -74
  72. package/dist/chunk-5ekyhb1w.js +0 -422
  73. package/dist/chunk-5gcqdn8x.js +0 -867
  74. package/dist/chunk-5h5kx2jd.js +0 -34
  75. package/dist/chunk-5hf3werb.js +0 -193
  76. package/dist/chunk-5n1jc02d.js +0 -87
  77. package/dist/chunk-5wfxvxm8.js +0 -127
  78. package/dist/chunk-5wjebwmn.js +0 -89
  79. package/dist/chunk-5z28bqne.js +0 -6748
  80. package/dist/chunk-5zwsxpjn.js +0 -671
  81. package/dist/chunk-60phw466.js +0 -29
  82. package/dist/chunk-64c1avct.js +0 -13
  83. package/dist/chunk-64r16v22.js +0 -162
  84. package/dist/chunk-65t1r7zs.js +0 -418
  85. package/dist/chunk-66zry909.js +0 -11
  86. package/dist/chunk-67hxjjgc.js +0 -731
  87. package/dist/chunk-68ffk5qa.js +0 -14
  88. package/dist/chunk-69dr6rrd.js +0 -177
  89. package/dist/chunk-69n11zng.js +0 -436
  90. package/dist/chunk-6dj5t602.js +0 -341
  91. package/dist/chunk-6dngjwkh.js +0 -63
  92. package/dist/chunk-6dp8sz55.js +0 -3561
  93. package/dist/chunk-6hqgg0sv.js +0 -103
  94. package/dist/chunk-6nsd9606.js +0 -790
  95. package/dist/chunk-6p0hbwz3.js +0 -65
  96. package/dist/chunk-6ywdv5vg.js +0 -97
  97. package/dist/chunk-6zc758qw.js +0 -640
  98. package/dist/chunk-7aw745vx.js +0 -40175
  99. package/dist/chunk-7fxaphbq.js +0 -116
  100. package/dist/chunk-7sgtxrsc.js +0 -1059
  101. package/dist/chunk-7wm5s02e.js +0 -216
  102. package/dist/chunk-7xdk4109.js +0 -442
  103. package/dist/chunk-7xyswgjh.js +0 -8
  104. package/dist/chunk-83hfzbx3.js +0 -10
  105. package/dist/chunk-87m69h0v.js +0 -219
  106. package/dist/chunk-8g5pe1gr.js +0 -37
  107. package/dist/chunk-8jbw0fnf.js +0 -167
  108. package/dist/chunk-8jf9se66.js +0 -321
  109. package/dist/chunk-8p65embj.js +0 -875
  110. package/dist/chunk-8qrmaff1.js +0 -2669
  111. package/dist/chunk-8r975mwc.js +0 -93
  112. package/dist/chunk-8yhf030a.js +0 -69
  113. package/dist/chunk-93emz367.js +0 -107
  114. package/dist/chunk-948mn975.js +0 -460
  115. package/dist/chunk-99chkt7r.js +0 -54
  116. package/dist/chunk-9f7c1hzz.js +0 -50
  117. package/dist/chunk-9fk9ps1g.js +0 -178
  118. package/dist/chunk-9rh0k0aq.js +0 -90
  119. package/dist/chunk-9x5zgy22.js +0 -12
  120. package/dist/chunk-a0k2vj5b.js +0 -460
  121. package/dist/chunk-a0m57ssq.js +0 -325
  122. package/dist/chunk-a0nsmmz1.js +0 -133
  123. package/dist/chunk-a25jh1v4.js +0 -105
  124. package/dist/chunk-a4j5ekv0.js +0 -83
  125. package/dist/chunk-a8k3zf58.js +0 -313
  126. package/dist/chunk-ah0zarbq.js +0 -260
  127. package/dist/chunk-ase86y73.js +0 -15
  128. package/dist/chunk-b0kf00ff.js +0 -637
  129. package/dist/chunk-b1kcd3ss.js +0 -27
  130. package/dist/chunk-b8kcqqds.js +0 -93
  131. package/dist/chunk-bg4x9ex0.js +0 -21
  132. package/dist/chunk-bh5zqvyc.js +0 -36
  133. package/dist/chunk-bqrkfekw.js +0 -267
  134. package/dist/chunk-brjd9zmk.js +0 -42
  135. package/dist/chunk-byfawrfx.js +0 -121
  136. package/dist/chunk-c6sjhj89.js +0 -1284
  137. package/dist/chunk-c7e5yv0q.js +0 -212
  138. package/dist/chunk-c7jwbe76.js +0 -29030
  139. package/dist/chunk-cb5v8w7k.js +0 -289
  140. package/dist/chunk-cdef9v7b.js +0 -27
  141. package/dist/chunk-cdz5yb0r.js +0 -57
  142. package/dist/chunk-cgfdkzhb.js +0 -12
  143. package/dist/chunk-cgqw4x5z.js +0 -155
  144. package/dist/chunk-cnsj3vq2.js +0 -35
  145. package/dist/chunk-cqxm7ggc.js +0 -123
  146. package/dist/chunk-cxrktb5g.js +0 -51
  147. package/dist/chunk-d089t7dk.js +0 -312
  148. package/dist/chunk-d1z934cp.js +0 -71
  149. package/dist/chunk-d4mdda98.js +0 -94
  150. package/dist/chunk-d7xw8v91.js +0 -332
  151. package/dist/chunk-dc06c3rw.js +0 -1154
  152. package/dist/chunk-ddsjkqs4.js +0 -39
  153. package/dist/chunk-dfzkwynj.js +0 -5368
  154. package/dist/chunk-dnmp7s85.js +0 -20
  155. package/dist/chunk-dqqwjkv3.js +0 -8583
  156. package/dist/chunk-dt2mr4vf.js +0 -2962
  157. package/dist/chunk-dztm97gg.js +0 -150
  158. package/dist/chunk-e0abab5b.js +0 -445
  159. package/dist/chunk-e0ragz46.js +0 -209386
  160. package/dist/chunk-e9w9zc0g.js +0 -392
  161. package/dist/chunk-ebwskmsr.js +0 -107
  162. package/dist/chunk-efztk52j.js +0 -114
  163. package/dist/chunk-ehd8wacx.js +0 -40
  164. package/dist/chunk-ehtwnxpg.js +0 -1591
  165. package/dist/chunk-eqp1rfft.js +0 -17
  166. package/dist/chunk-etdt1xz3.js +0 -19
  167. package/dist/chunk-eva785x8.js +0 -88
  168. package/dist/chunk-ewadzrm8.js +0 -103
  169. package/dist/chunk-f2ajmcav.js +0 -92
  170. package/dist/chunk-fajg8x36.js +0 -8158
  171. package/dist/chunk-fbv4apne.js +0 -51
  172. package/dist/chunk-fcynwjpm.js +0 -1072
  173. package/dist/chunk-fev86f95.js +0 -1052
  174. package/dist/chunk-feyzykye.js +0 -10
  175. package/dist/chunk-ff85rwvc.js +0 -180
  176. package/dist/chunk-fk6ktvg2.js +0 -275
  177. package/dist/chunk-fqak69ft.js +0 -458
  178. package/dist/chunk-fqwas4jk.js +0 -281
  179. package/dist/chunk-fs35fdpj.js +0 -439
  180. package/dist/chunk-fvr3f9s3.js +0 -55
  181. package/dist/chunk-fyc5fepv.js +0 -10
  182. package/dist/chunk-g2g9cwt9.js +0 -54
  183. package/dist/chunk-g4znz46v.js +0 -2335
  184. package/dist/chunk-g5ts4e6k.js +0 -697
  185. package/dist/chunk-g6een9wr.js +0 -654
  186. package/dist/chunk-g7cmtx8r.js +0 -77
  187. package/dist/chunk-g9f19ttm.js +0 -15
  188. package/dist/chunk-gc7ap41t.js +0 -516
  189. package/dist/chunk-gdwdqewd.js +0 -19
  190. package/dist/chunk-gg14h3n4.js +0 -131
  191. package/dist/chunk-gg55fns0.js +0 -6440
  192. package/dist/chunk-gq7zab4e.js +0 -418
  193. package/dist/chunk-gydw3qy3.js +0 -169
  194. package/dist/chunk-gz1e8y1w.js +0 -33
  195. package/dist/chunk-h19r628d.js +0 -91
  196. package/dist/chunk-h2k8mt3z.js +0 -329
  197. package/dist/chunk-h9n54swm.js +0 -27
  198. package/dist/chunk-hakdhagh.js +0 -16606
  199. package/dist/chunk-hc2chp3g.js +0 -308
  200. package/dist/chunk-hemcv9t7.js +0 -153
  201. package/dist/chunk-hm62ntv3.js +0 -20
  202. package/dist/chunk-hmq09ytj.js +0 -100
  203. package/dist/chunk-hmv4hhqt.js +0 -2718
  204. package/dist/chunk-hwfknpxv.js +0 -39
  205. package/dist/chunk-j5bth84e.js +0 -97
  206. package/dist/chunk-j64ga6ta.js +0 -8035
  207. package/dist/chunk-j6v3w4yf.js +0 -244
  208. package/dist/chunk-jc29d2nm.js +0 -130
  209. package/dist/chunk-jd32zbps.js +0 -15
  210. package/dist/chunk-jd4sx4wh.js +0 -594
  211. package/dist/chunk-jha8n8b9.js +0 -33118
  212. package/dist/chunk-jj71qx7m.js +0 -122
  213. package/dist/chunk-jka9vpak.js +0 -114
  214. package/dist/chunk-jkf6ayv0.js +0 -32
  215. package/dist/chunk-jpz6t2tt.js +0 -61
  216. package/dist/chunk-jqt3sw12.js +0 -9114
  217. package/dist/chunk-jswd1q63.js +0 -101
  218. package/dist/chunk-jtc4aa2y.js +0 -1543
  219. package/dist/chunk-jyx3h86z.js +0 -635
  220. package/dist/chunk-jzthz1bx.js +0 -15
  221. package/dist/chunk-k0p9w03v.js +0 -4957
  222. package/dist/chunk-k6x3s7x5.js +0 -211
  223. package/dist/chunk-k7kmvnnx.js +0 -942
  224. package/dist/chunk-k8vp0atq.js +0 -2331
  225. package/dist/chunk-k9vm6x6z.js +0 -257
  226. package/dist/chunk-kb1edvhs.js +0 -120
  227. package/dist/chunk-kbhbe33q.js +0 -113
  228. package/dist/chunk-kgcgpp7z.js +0 -140
  229. package/dist/chunk-kvywbvqs.js +0 -261
  230. package/dist/chunk-kwekc97v.js +0 -18
  231. package/dist/chunk-kwyk9zp1.js +0 -74
  232. package/dist/chunk-ky1z78ve.js +0 -119
  233. package/dist/chunk-mcws22k3.js +0 -42
  234. package/dist/chunk-mr2z79r3.js +0 -1385
  235. package/dist/chunk-mst9nmns.js +0 -642
  236. package/dist/chunk-mswx2nma.js +0 -103
  237. package/dist/chunk-n1e3fjpz.js +0 -266
  238. package/dist/chunk-n6vjp9yg.js +0 -138
  239. package/dist/chunk-n84tqtvv.js +0 -120
  240. package/dist/chunk-n8ssddbw.js +0 -105
  241. package/dist/chunk-na35whkd.js +0 -227
  242. package/dist/chunk-netzwgv1.js +0 -154
  243. package/dist/chunk-ng7j0yy1.js +0 -100
  244. package/dist/chunk-nmgj86tt.js +0 -24
  245. package/dist/chunk-ns7x6xam.js +0 -22820
  246. package/dist/chunk-p7vkh4wx.js +0 -15
  247. package/dist/chunk-p8na2wwp.js +0 -14
  248. package/dist/chunk-pe3rkfp2.js +0 -74
  249. package/dist/chunk-pf0152j3.js +0 -40
  250. package/dist/chunk-pgtnj1mt.js +0 -705
  251. package/dist/chunk-ppwjyveh.js +0 -8
  252. package/dist/chunk-pq5qp2y4.js +0 -388
  253. package/dist/chunk-pqqxdk5f.js +0 -543
  254. package/dist/chunk-ps49ymvj.js +0 -43
  255. package/dist/chunk-pws8gq7m.js +0 -7422
  256. package/dist/chunk-pwwa7s62.js +0 -11
  257. package/dist/chunk-pyq0fabn.js +0 -860
  258. package/dist/chunk-q0p1m40t.js +0 -79
  259. package/dist/chunk-q0vhv550.js +0 -393
  260. package/dist/chunk-q7r0kt08.js +0 -1809
  261. package/dist/chunk-qajrkk97.js +0 -298
  262. package/dist/chunk-qatfdxvd.js +0 -34
  263. package/dist/chunk-qb6k2afy.js +0 -153
  264. package/dist/chunk-qg2qgx8h.js +0 -266
  265. package/dist/chunk-qkczt8cr.js +0 -24
  266. package/dist/chunk-qnfx3qtx.js +0 -617
  267. package/dist/chunk-qp2qdcda.js +0 -100
  268. package/dist/chunk-qtwgzej9.js +0 -85
  269. package/dist/chunk-r1dh0ymt.js +0 -91
  270. package/dist/chunk-r36xvgvv.js +0 -407
  271. package/dist/chunk-r48he8g3.js +0 -251
  272. package/dist/chunk-r63tqmtk.js +0 -146
  273. package/dist/chunk-rbdd3q5k.js +0 -101
  274. package/dist/chunk-rmbbmd3s.js +0 -68
  275. package/dist/chunk-rn0v1hk8.js +0 -34
  276. package/dist/chunk-rnxctq9p.js +0 -1646
  277. package/dist/chunk-rrs2mchs.js +0 -183
  278. package/dist/chunk-rtrybvnp.js +0 -209
  279. package/dist/chunk-rw2wkn45.js +0 -494
  280. package/dist/chunk-s4kzkdhd.js +0 -847
  281. package/dist/chunk-s7a0zn7b.js +0 -55
  282. package/dist/chunk-s8gy4ky9.js +0 -122
  283. package/dist/chunk-s8kj6ajy.js +0 -32
  284. package/dist/chunk-sag785ad.js +0 -283
  285. package/dist/chunk-scqjyben.js +0 -174
  286. package/dist/chunk-sd36yzx8.js +0 -954
  287. package/dist/chunk-sdtqm0nm.js +0 -374
  288. package/dist/chunk-sg60xg0x.js +0 -52
  289. package/dist/chunk-sgpmpn90.js +0 -35
  290. package/dist/chunk-sh02d2qn.js +0 -38
  291. package/dist/chunk-sz9y6z13.js +0 -61
  292. package/dist/chunk-szj5wvdy.js +0 -28
  293. package/dist/chunk-t29a6zb5.js +0 -45
  294. package/dist/chunk-t2b49hcf.js +0 -87
  295. package/dist/chunk-t2wqdppz.js +0 -445
  296. package/dist/chunk-t4khqff1.js +0 -16
  297. package/dist/chunk-t70t2gne.js +0 -121
  298. package/dist/chunk-t9p85zff.js +0 -24
  299. package/dist/chunk-tkrstmwz.js +0 -94
  300. package/dist/chunk-tnyb4exc.js +0 -74
  301. package/dist/chunk-tpn8jsvw.js +0 -71
  302. package/dist/chunk-tt7x5j1q.js +0 -111
  303. package/dist/chunk-tw1p628z.js +0 -984
  304. package/dist/chunk-twvdafcz.js +0 -528
  305. package/dist/chunk-tzwjafgn.js +0 -24
  306. package/dist/chunk-v140t8ay.js +0 -152
  307. package/dist/chunk-v1kzp02e.js +0 -785
  308. package/dist/chunk-v4t6dyyh.js +0 -9076
  309. package/dist/chunk-v78fj8by.js +0 -145
  310. package/dist/chunk-v8kjswxt.js +0 -61
  311. package/dist/chunk-v9smspw2.js +0 -4301
  312. package/dist/chunk-vcfbjkk9.js +0 -201
  313. package/dist/chunk-ve167rcs.js +0 -148
  314. package/dist/chunk-vf612n57.js +0 -472
  315. package/dist/chunk-vhffyae8.js +0 -895
  316. package/dist/chunk-vkhrrvfq.js +0 -44
  317. package/dist/chunk-vybkmfhf.js +0 -91
  318. package/dist/chunk-vyjeh50y.js +0 -2149
  319. package/dist/chunk-w6m6trzq.js +0 -58
  320. package/dist/chunk-w9b6kngq.js +0 -234
  321. package/dist/chunk-wa8yn2p0.js +0 -2007
  322. package/dist/chunk-wanceff6.js +0 -2840
  323. package/dist/chunk-wcze2nea.js +0 -336
  324. package/dist/chunk-wgk9sxk7.js +0 -329
  325. package/dist/chunk-wnxcgfsd.js +0 -253
  326. package/dist/chunk-wyjerrr6.js +0 -565
  327. package/dist/chunk-wz9brkq5.js +0 -60
  328. package/dist/chunk-x47h283a.js +0 -56
  329. package/dist/chunk-x59j3x9c.js +0 -98
  330. package/dist/chunk-x6r4v44b.js +0 -8
  331. package/dist/chunk-x7fdwq3d.js +0 -33
  332. package/dist/chunk-x8d2ehd7.js +0 -19
  333. package/dist/chunk-xeb6075z.js +0 -3435
  334. package/dist/chunk-xfw2pxwd.js +0 -223
  335. package/dist/chunk-xh06jc72.js +0 -200
  336. package/dist/chunk-xhfmdq1y.js +0 -147
  337. package/dist/chunk-xkwyg1d2.js +0 -195
  338. package/dist/chunk-xv3era3s.js +0 -8
  339. package/dist/chunk-xyapc58m.js +0 -87
  340. package/dist/chunk-xzgnc76g.js +0 -107
  341. package/dist/chunk-y1784krc.js +0 -19
  342. package/dist/chunk-y4ca9kqz.js +0 -3830
  343. package/dist/chunk-y9bhjjdz.js +0 -145
  344. package/dist/chunk-yb3bxv3w.js +0 -30
  345. package/dist/chunk-yddek6xk.js +0 -146
  346. package/dist/chunk-ypaq3d12.js +0 -4265
  347. package/dist/chunk-yq8z040g.js +0 -111
  348. package/dist/chunk-yqs481qq.js +0 -1163
  349. package/dist/chunk-ys9a9c9h.js +0 -105
  350. package/dist/chunk-yyex5gsf.js +0 -269
  351. package/dist/chunk-yzn396hn.js +0 -89
  352. package/dist/chunk-z2dp53wn.js +0 -17
  353. package/dist/chunk-zay4xp4n.js +0 -251
  354. package/dist/chunk-zc8bwy57.js +0 -212
  355. package/dist/chunk-zhx88cfx.js +0 -97
  356. package/dist/chunk-zkh6f4ct.js +0 -385
  357. package/dist/chunk-zq56gcca.js +0 -206
  358. package/dist/chunk-zrkefd22.js +0 -490
  359. package/dist/chunk-zs5p0yq1.js +0 -1030
  360. package/dist/chunk-zxh62ved.js +0 -31
  361. package/dist/chunk-zzm33q8x.js +0 -8
  362. package/dist/cli.js +0 -220
@@ -1,1646 +0,0 @@
1
- // @bun
2
- import {
3
- init_lazySchema,
4
- lazySchema
5
- } from "./chunk-64c1avct.js";
6
- import {
7
- init_v4
8
- } from "./chunk-4pbx3g7s.js";
9
- import {
10
- exports_external
11
- } from "./chunk-26wtxbdc.js";
12
- import {
13
- init_memoize,
14
- memoizeWithLRU
15
- } from "./chunk-vkhrrvfq.js";
16
- import {
17
- init_log,
18
- init_slowOperations,
19
- jsonStringify,
20
- logError
21
- } from "./chunk-gg55fns0.js";
22
- import {
23
- __callDispose,
24
- __esm,
25
- __using
26
- } from "./chunk-qp2qdcda.js";
27
-
28
- // src/utils/jsonRead.ts
29
- function stripBOM(content) {
30
- return content.startsWith(UTF8_BOM) ? content.slice(1) : content;
31
- }
32
- var UTF8_BOM = "\uFEFF";
33
- var init_jsonRead = () => {};
34
-
35
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
36
- function createScanner(text, ignoreTrivia = false) {
37
- const len = text.length;
38
- let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
39
- function scanHexDigits(count, exact) {
40
- let digits = 0;
41
- let value2 = 0;
42
- while (digits < count || !exact) {
43
- let ch = text.charCodeAt(pos);
44
- if (ch >= 48 && ch <= 57) {
45
- value2 = value2 * 16 + ch - 48;
46
- } else if (ch >= 65 && ch <= 70) {
47
- value2 = value2 * 16 + ch - 65 + 10;
48
- } else if (ch >= 97 && ch <= 102) {
49
- value2 = value2 * 16 + ch - 97 + 10;
50
- } else {
51
- break;
52
- }
53
- pos++;
54
- digits++;
55
- }
56
- if (digits < count) {
57
- value2 = -1;
58
- }
59
- return value2;
60
- }
61
- function setPosition(newPosition) {
62
- pos = newPosition;
63
- value = "";
64
- tokenOffset = 0;
65
- token = 16;
66
- scanError = 0;
67
- }
68
- function scanNumber() {
69
- let start = pos;
70
- if (text.charCodeAt(pos) === 48) {
71
- pos++;
72
- } else {
73
- pos++;
74
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
75
- pos++;
76
- }
77
- }
78
- if (pos < text.length && text.charCodeAt(pos) === 46) {
79
- pos++;
80
- if (pos < text.length && isDigit(text.charCodeAt(pos))) {
81
- pos++;
82
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
83
- pos++;
84
- }
85
- } else {
86
- scanError = 3;
87
- return text.substring(start, pos);
88
- }
89
- }
90
- let end = pos;
91
- if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
92
- pos++;
93
- if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
94
- pos++;
95
- }
96
- if (pos < text.length && isDigit(text.charCodeAt(pos))) {
97
- pos++;
98
- while (pos < text.length && isDigit(text.charCodeAt(pos))) {
99
- pos++;
100
- }
101
- end = pos;
102
- } else {
103
- scanError = 3;
104
- }
105
- }
106
- return text.substring(start, end);
107
- }
108
- function scanString() {
109
- let result = "", start = pos;
110
- while (true) {
111
- if (pos >= len) {
112
- result += text.substring(start, pos);
113
- scanError = 2;
114
- break;
115
- }
116
- const ch = text.charCodeAt(pos);
117
- if (ch === 34) {
118
- result += text.substring(start, pos);
119
- pos++;
120
- break;
121
- }
122
- if (ch === 92) {
123
- result += text.substring(start, pos);
124
- pos++;
125
- if (pos >= len) {
126
- scanError = 2;
127
- break;
128
- }
129
- const ch2 = text.charCodeAt(pos++);
130
- switch (ch2) {
131
- case 34:
132
- result += '"';
133
- break;
134
- case 92:
135
- result += "\\";
136
- break;
137
- case 47:
138
- result += "/";
139
- break;
140
- case 98:
141
- result += "\b";
142
- break;
143
- case 102:
144
- result += "\f";
145
- break;
146
- case 110:
147
- result += `
148
- `;
149
- break;
150
- case 114:
151
- result += "\r";
152
- break;
153
- case 116:
154
- result += "\t";
155
- break;
156
- case 117:
157
- const ch3 = scanHexDigits(4, true);
158
- if (ch3 >= 0) {
159
- result += String.fromCharCode(ch3);
160
- } else {
161
- scanError = 4;
162
- }
163
- break;
164
- default:
165
- scanError = 5;
166
- }
167
- start = pos;
168
- continue;
169
- }
170
- if (ch >= 0 && ch <= 31) {
171
- if (isLineBreak(ch)) {
172
- result += text.substring(start, pos);
173
- scanError = 2;
174
- break;
175
- } else {
176
- scanError = 6;
177
- }
178
- }
179
- pos++;
180
- }
181
- return result;
182
- }
183
- function scanNext() {
184
- value = "";
185
- scanError = 0;
186
- tokenOffset = pos;
187
- lineStartOffset = lineNumber;
188
- prevTokenLineStartOffset = tokenLineStartOffset;
189
- if (pos >= len) {
190
- tokenOffset = len;
191
- return token = 17;
192
- }
193
- let code = text.charCodeAt(pos);
194
- if (isWhiteSpace(code)) {
195
- do {
196
- pos++;
197
- value += String.fromCharCode(code);
198
- code = text.charCodeAt(pos);
199
- } while (isWhiteSpace(code));
200
- return token = 15;
201
- }
202
- if (isLineBreak(code)) {
203
- pos++;
204
- value += String.fromCharCode(code);
205
- if (code === 13 && text.charCodeAt(pos) === 10) {
206
- pos++;
207
- value += `
208
- `;
209
- }
210
- lineNumber++;
211
- tokenLineStartOffset = pos;
212
- return token = 14;
213
- }
214
- switch (code) {
215
- case 123:
216
- pos++;
217
- return token = 1;
218
- case 125:
219
- pos++;
220
- return token = 2;
221
- case 91:
222
- pos++;
223
- return token = 3;
224
- case 93:
225
- pos++;
226
- return token = 4;
227
- case 58:
228
- pos++;
229
- return token = 6;
230
- case 44:
231
- pos++;
232
- return token = 5;
233
- case 34:
234
- pos++;
235
- value = scanString();
236
- return token = 10;
237
- case 47:
238
- const start = pos - 1;
239
- if (text.charCodeAt(pos + 1) === 47) {
240
- pos += 2;
241
- while (pos < len) {
242
- if (isLineBreak(text.charCodeAt(pos))) {
243
- break;
244
- }
245
- pos++;
246
- }
247
- value = text.substring(start, pos);
248
- return token = 12;
249
- }
250
- if (text.charCodeAt(pos + 1) === 42) {
251
- pos += 2;
252
- const safeLength = len - 1;
253
- let commentClosed = false;
254
- while (pos < safeLength) {
255
- const ch = text.charCodeAt(pos);
256
- if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
257
- pos += 2;
258
- commentClosed = true;
259
- break;
260
- }
261
- pos++;
262
- if (isLineBreak(ch)) {
263
- if (ch === 13 && text.charCodeAt(pos) === 10) {
264
- pos++;
265
- }
266
- lineNumber++;
267
- tokenLineStartOffset = pos;
268
- }
269
- }
270
- if (!commentClosed) {
271
- pos++;
272
- scanError = 1;
273
- }
274
- value = text.substring(start, pos);
275
- return token = 13;
276
- }
277
- value += String.fromCharCode(code);
278
- pos++;
279
- return token = 16;
280
- case 45:
281
- value += String.fromCharCode(code);
282
- pos++;
283
- if (pos === len || !isDigit(text.charCodeAt(pos))) {
284
- return token = 16;
285
- }
286
- case 48:
287
- case 49:
288
- case 50:
289
- case 51:
290
- case 52:
291
- case 53:
292
- case 54:
293
- case 55:
294
- case 56:
295
- case 57:
296
- value += scanNumber();
297
- return token = 11;
298
- default:
299
- while (pos < len && isUnknownContentCharacter(code)) {
300
- pos++;
301
- code = text.charCodeAt(pos);
302
- }
303
- if (tokenOffset !== pos) {
304
- value = text.substring(tokenOffset, pos);
305
- switch (value) {
306
- case "true":
307
- return token = 8;
308
- case "false":
309
- return token = 9;
310
- case "null":
311
- return token = 7;
312
- }
313
- return token = 16;
314
- }
315
- value += String.fromCharCode(code);
316
- pos++;
317
- return token = 16;
318
- }
319
- }
320
- function isUnknownContentCharacter(code) {
321
- if (isWhiteSpace(code) || isLineBreak(code)) {
322
- return false;
323
- }
324
- switch (code) {
325
- case 125:
326
- case 93:
327
- case 123:
328
- case 91:
329
- case 34:
330
- case 58:
331
- case 44:
332
- case 47:
333
- return false;
334
- }
335
- return true;
336
- }
337
- function scanNextNonTrivia() {
338
- let result;
339
- do {
340
- result = scanNext();
341
- } while (result >= 12 && result <= 15);
342
- return result;
343
- }
344
- return {
345
- setPosition,
346
- getPosition: () => pos,
347
- scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
348
- getToken: () => token,
349
- getTokenValue: () => value,
350
- getTokenOffset: () => tokenOffset,
351
- getTokenLength: () => pos - tokenOffset,
352
- getTokenStartLine: () => lineStartOffset,
353
- getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
354
- getTokenError: () => scanError
355
- };
356
- }
357
- function isWhiteSpace(ch) {
358
- return ch === 32 || ch === 9;
359
- }
360
- function isLineBreak(ch) {
361
- return ch === 10 || ch === 13;
362
- }
363
- function isDigit(ch) {
364
- return ch >= 48 && ch <= 57;
365
- }
366
- var CharacterCodes;
367
- var init_scanner = __esm(() => {
368
- (function(CharacterCodes2) {
369
- CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
370
- CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
371
- CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
372
- CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
373
- CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
374
- CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
375
- CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
376
- CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
377
- CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
378
- CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
379
- CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
380
- CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
381
- CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
382
- CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
383
- CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
384
- CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
385
- CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
386
- CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
387
- CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
388
- CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
389
- CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
390
- CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
391
- CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
392
- CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
393
- CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
394
- CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
395
- CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
396
- CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
397
- CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
398
- CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
399
- CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
400
- CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
401
- CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
402
- CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
403
- CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
404
- CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
405
- CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
406
- CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
407
- CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
408
- CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
409
- CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
410
- CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
411
- CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
412
- CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
413
- CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
414
- CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
415
- CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
416
- CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
417
- CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
418
- CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
419
- CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
420
- CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
421
- CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
422
- CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
423
- CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
424
- CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
425
- CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
426
- CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
427
- CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
428
- CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
429
- CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
430
- CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
431
- CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
432
- CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
433
- CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
434
- CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
435
- CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
436
- CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
437
- CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
438
- CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
439
- CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
440
- CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
441
- CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
442
- CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
443
- CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
444
- CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
445
- CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
446
- CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
447
- CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
448
- CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
449
- })(CharacterCodes || (CharacterCodes = {}));
450
- });
451
-
452
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
453
- var cachedSpaces, maxCachedValues = 200, cachedBreakLinesWithSpaces, supportedEols;
454
- var init_string_intern = __esm(() => {
455
- cachedSpaces = new Array(20).fill(0).map((_, index) => {
456
- return " ".repeat(index);
457
- });
458
- cachedBreakLinesWithSpaces = {
459
- " ": {
460
- "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
461
- return `
462
- ` + " ".repeat(index);
463
- }),
464
- "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
465
- return "\r" + " ".repeat(index);
466
- }),
467
- "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
468
- return `\r
469
- ` + " ".repeat(index);
470
- })
471
- },
472
- "\t": {
473
- "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
474
- return `
475
- ` + "\t".repeat(index);
476
- }),
477
- "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
478
- return "\r" + "\t".repeat(index);
479
- }),
480
- "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
481
- return `\r
482
- ` + "\t".repeat(index);
483
- })
484
- }
485
- };
486
- supportedEols = [`
487
- `, "\r", `\r
488
- `];
489
- });
490
-
491
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
492
- function format(documentText, range, options) {
493
- let initialIndentLevel;
494
- let formatText;
495
- let formatTextStart;
496
- let rangeStart;
497
- let rangeEnd;
498
- if (range) {
499
- rangeStart = range.offset;
500
- rangeEnd = rangeStart + range.length;
501
- formatTextStart = rangeStart;
502
- while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
503
- formatTextStart--;
504
- }
505
- let endOffset = rangeEnd;
506
- while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
507
- endOffset++;
508
- }
509
- formatText = documentText.substring(formatTextStart, endOffset);
510
- initialIndentLevel = computeIndentLevel(formatText, options);
511
- } else {
512
- formatText = documentText;
513
- initialIndentLevel = 0;
514
- formatTextStart = 0;
515
- rangeStart = 0;
516
- rangeEnd = documentText.length;
517
- }
518
- const eol = getEOL(options, documentText);
519
- const eolFastPathSupported = supportedEols.includes(eol);
520
- let numberLineBreaks = 0;
521
- let indentLevel = 0;
522
- let indentValue;
523
- if (options.insertSpaces) {
524
- indentValue = cachedSpaces[options.tabSize || 4] ?? repeat(cachedSpaces[1], options.tabSize || 4);
525
- } else {
526
- indentValue = "\t";
527
- }
528
- const indentType = indentValue === "\t" ? "\t" : " ";
529
- let scanner = createScanner(formatText, false);
530
- let hasError = false;
531
- function newLinesAndIndent() {
532
- if (numberLineBreaks > 1) {
533
- return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);
534
- }
535
- const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);
536
- if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {
537
- return eol + repeat(indentValue, initialIndentLevel + indentLevel);
538
- }
539
- if (amountOfSpaces <= 0) {
540
- return eol;
541
- }
542
- return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];
543
- }
544
- function scanNext() {
545
- let token = scanner.scan();
546
- numberLineBreaks = 0;
547
- while (token === 15 || token === 14) {
548
- if (token === 14 && options.keepLines) {
549
- numberLineBreaks += 1;
550
- } else if (token === 14) {
551
- numberLineBreaks = 1;
552
- }
553
- token = scanner.scan();
554
- }
555
- hasError = token === 16 || scanner.getTokenError() !== 0;
556
- return token;
557
- }
558
- const editOperations = [];
559
- function addEdit(text, startOffset, endOffset) {
560
- if (!hasError && (!range || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
561
- editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
562
- }
563
- }
564
- let firstToken = scanNext();
565
- if (options.keepLines && numberLineBreaks > 0) {
566
- addEdit(repeat(eol, numberLineBreaks), 0, 0);
567
- }
568
- if (firstToken !== 17) {
569
- let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
570
- let initialIndent = indentValue.length * initialIndentLevel < 20 && options.insertSpaces ? cachedSpaces[indentValue.length * initialIndentLevel] : repeat(indentValue, initialIndentLevel);
571
- addEdit(initialIndent, formatTextStart, firstTokenStart);
572
- }
573
- while (firstToken !== 17) {
574
- let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
575
- let secondToken = scanNext();
576
- let replaceContent = "";
577
- let needsLineBreak = false;
578
- while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
579
- let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
580
- addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);
581
- firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
582
- needsLineBreak = secondToken === 12;
583
- replaceContent = needsLineBreak ? newLinesAndIndent() : "";
584
- secondToken = scanNext();
585
- }
586
- if (secondToken === 2) {
587
- if (firstToken !== 1) {
588
- indentLevel--;
589
- }
590
- if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
591
- replaceContent = newLinesAndIndent();
592
- } else if (options.keepLines) {
593
- replaceContent = cachedSpaces[1];
594
- }
595
- } else if (secondToken === 4) {
596
- if (firstToken !== 3) {
597
- indentLevel--;
598
- }
599
- if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
600
- replaceContent = newLinesAndIndent();
601
- } else if (options.keepLines) {
602
- replaceContent = cachedSpaces[1];
603
- }
604
- } else {
605
- switch (firstToken) {
606
- case 3:
607
- case 1:
608
- indentLevel++;
609
- if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
610
- replaceContent = newLinesAndIndent();
611
- } else {
612
- replaceContent = cachedSpaces[1];
613
- }
614
- break;
615
- case 5:
616
- if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
617
- replaceContent = newLinesAndIndent();
618
- } else {
619
- replaceContent = cachedSpaces[1];
620
- }
621
- break;
622
- case 12:
623
- replaceContent = newLinesAndIndent();
624
- break;
625
- case 13:
626
- if (numberLineBreaks > 0) {
627
- replaceContent = newLinesAndIndent();
628
- } else if (!needsLineBreak) {
629
- replaceContent = cachedSpaces[1];
630
- }
631
- break;
632
- case 6:
633
- if (options.keepLines && numberLineBreaks > 0) {
634
- replaceContent = newLinesAndIndent();
635
- } else if (!needsLineBreak) {
636
- replaceContent = cachedSpaces[1];
637
- }
638
- break;
639
- case 10:
640
- if (options.keepLines && numberLineBreaks > 0) {
641
- replaceContent = newLinesAndIndent();
642
- } else if (secondToken === 6 && !needsLineBreak) {
643
- replaceContent = "";
644
- }
645
- break;
646
- case 7:
647
- case 8:
648
- case 9:
649
- case 11:
650
- case 2:
651
- case 4:
652
- if (options.keepLines && numberLineBreaks > 0) {
653
- replaceContent = newLinesAndIndent();
654
- } else {
655
- if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
656
- replaceContent = cachedSpaces[1];
657
- } else if (secondToken !== 5 && secondToken !== 17) {
658
- hasError = true;
659
- }
660
- }
661
- break;
662
- case 16:
663
- hasError = true;
664
- break;
665
- }
666
- if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
667
- replaceContent = newLinesAndIndent();
668
- }
669
- }
670
- if (secondToken === 17) {
671
- if (options.keepLines && numberLineBreaks > 0) {
672
- replaceContent = newLinesAndIndent();
673
- } else {
674
- replaceContent = options.insertFinalNewline ? eol : "";
675
- }
676
- }
677
- const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
678
- addEdit(replaceContent, firstTokenEnd, secondTokenStart);
679
- firstToken = secondToken;
680
- }
681
- return editOperations;
682
- }
683
- function repeat(s, count) {
684
- let result = "";
685
- for (let i = 0;i < count; i++) {
686
- result += s;
687
- }
688
- return result;
689
- }
690
- function computeIndentLevel(content, options) {
691
- let i = 0;
692
- let nChars = 0;
693
- const tabSize = options.tabSize || 4;
694
- while (i < content.length) {
695
- let ch = content.charAt(i);
696
- if (ch === cachedSpaces[1]) {
697
- nChars++;
698
- } else if (ch === "\t") {
699
- nChars += tabSize;
700
- } else {
701
- break;
702
- }
703
- i++;
704
- }
705
- return Math.floor(nChars / tabSize);
706
- }
707
- function getEOL(options, text) {
708
- for (let i = 0;i < text.length; i++) {
709
- const ch = text.charAt(i);
710
- if (ch === "\r") {
711
- if (i + 1 < text.length && text.charAt(i + 1) === `
712
- `) {
713
- return `\r
714
- `;
715
- }
716
- return "\r";
717
- } else if (ch === `
718
- `) {
719
- return `
720
- `;
721
- }
722
- }
723
- return options && options.eol || `
724
- `;
725
- }
726
- function isEOL(text, offset) {
727
- return `\r
728
- `.indexOf(text.charAt(offset)) !== -1;
729
- }
730
- var init_format = __esm(() => {
731
- init_scanner();
732
- init_string_intern();
733
- });
734
-
735
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
736
- function parse(text, errors = [], options = ParseOptions.DEFAULT) {
737
- let currentProperty = null;
738
- let currentParent = [];
739
- const previousParents = [];
740
- function onValue(value) {
741
- if (Array.isArray(currentParent)) {
742
- currentParent.push(value);
743
- } else if (currentProperty !== null) {
744
- currentParent[currentProperty] = value;
745
- }
746
- }
747
- const visitor = {
748
- onObjectBegin: () => {
749
- const object = {};
750
- onValue(object);
751
- previousParents.push(currentParent);
752
- currentParent = object;
753
- currentProperty = null;
754
- },
755
- onObjectProperty: (name) => {
756
- currentProperty = name;
757
- },
758
- onObjectEnd: () => {
759
- currentParent = previousParents.pop();
760
- },
761
- onArrayBegin: () => {
762
- const array = [];
763
- onValue(array);
764
- previousParents.push(currentParent);
765
- currentParent = array;
766
- currentProperty = null;
767
- },
768
- onArrayEnd: () => {
769
- currentParent = previousParents.pop();
770
- },
771
- onLiteralValue: onValue,
772
- onError: (error, offset, length) => {
773
- errors.push({ error, offset, length });
774
- }
775
- };
776
- visit(text, visitor, options);
777
- return currentParent[0];
778
- }
779
- function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
780
- let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
781
- function ensurePropertyComplete(endOffset) {
782
- if (currentParent.type === "property") {
783
- currentParent.length = endOffset - currentParent.offset;
784
- currentParent = currentParent.parent;
785
- }
786
- }
787
- function onValue(valueNode) {
788
- currentParent.children.push(valueNode);
789
- return valueNode;
790
- }
791
- const visitor = {
792
- onObjectBegin: (offset) => {
793
- currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
794
- },
795
- onObjectProperty: (name, offset, length) => {
796
- currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
797
- currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
798
- },
799
- onObjectEnd: (offset, length) => {
800
- ensurePropertyComplete(offset + length);
801
- currentParent.length = offset + length - currentParent.offset;
802
- currentParent = currentParent.parent;
803
- ensurePropertyComplete(offset + length);
804
- },
805
- onArrayBegin: (offset, length) => {
806
- currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
807
- },
808
- onArrayEnd: (offset, length) => {
809
- currentParent.length = offset + length - currentParent.offset;
810
- currentParent = currentParent.parent;
811
- ensurePropertyComplete(offset + length);
812
- },
813
- onLiteralValue: (value, offset, length) => {
814
- onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
815
- ensurePropertyComplete(offset + length);
816
- },
817
- onSeparator: (sep, offset, length) => {
818
- if (currentParent.type === "property") {
819
- if (sep === ":") {
820
- currentParent.colonOffset = offset;
821
- } else if (sep === ",") {
822
- ensurePropertyComplete(offset);
823
- }
824
- }
825
- },
826
- onError: (error, offset, length) => {
827
- errors.push({ error, offset, length });
828
- }
829
- };
830
- visit(text, visitor, options);
831
- const result = currentParent.children[0];
832
- if (result) {
833
- delete result.parent;
834
- }
835
- return result;
836
- }
837
- function findNodeAtLocation(root, path) {
838
- if (!root) {
839
- return;
840
- }
841
- let node = root;
842
- for (let segment of path) {
843
- if (typeof segment === "string") {
844
- if (node.type !== "object" || !Array.isArray(node.children)) {
845
- return;
846
- }
847
- let found = false;
848
- for (const propertyNode of node.children) {
849
- if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
850
- node = propertyNode.children[1];
851
- found = true;
852
- break;
853
- }
854
- }
855
- if (!found) {
856
- return;
857
- }
858
- } else {
859
- const index = segment;
860
- if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
861
- return;
862
- }
863
- node = node.children[index];
864
- }
865
- }
866
- return node;
867
- }
868
- function visit(text, visitor, options = ParseOptions.DEFAULT) {
869
- const _scanner = createScanner(text, false);
870
- const _jsonPath = [];
871
- let suppressedCallbacks = 0;
872
- function toNoArgVisit(visitFunction) {
873
- return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
874
- }
875
- function toOneArgVisit(visitFunction) {
876
- return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
877
- }
878
- function toOneArgVisitWithPath(visitFunction) {
879
- return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
880
- }
881
- function toBeginVisit(visitFunction) {
882
- return visitFunction ? () => {
883
- if (suppressedCallbacks > 0) {
884
- suppressedCallbacks++;
885
- } else {
886
- let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
887
- if (cbReturn === false) {
888
- suppressedCallbacks = 1;
889
- }
890
- }
891
- } : () => true;
892
- }
893
- function toEndVisit(visitFunction) {
894
- return visitFunction ? () => {
895
- if (suppressedCallbacks > 0) {
896
- suppressedCallbacks--;
897
- }
898
- if (suppressedCallbacks === 0) {
899
- visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
900
- }
901
- } : () => true;
902
- }
903
- const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
904
- const disallowComments = options && options.disallowComments;
905
- const allowTrailingComma = options && options.allowTrailingComma;
906
- function scanNext() {
907
- while (true) {
908
- const token = _scanner.scan();
909
- switch (_scanner.getTokenError()) {
910
- case 4:
911
- handleError(14);
912
- break;
913
- case 5:
914
- handleError(15);
915
- break;
916
- case 3:
917
- handleError(13);
918
- break;
919
- case 1:
920
- if (!disallowComments) {
921
- handleError(11);
922
- }
923
- break;
924
- case 2:
925
- handleError(12);
926
- break;
927
- case 6:
928
- handleError(16);
929
- break;
930
- }
931
- switch (token) {
932
- case 12:
933
- case 13:
934
- if (disallowComments) {
935
- handleError(10);
936
- } else {
937
- onComment();
938
- }
939
- break;
940
- case 16:
941
- handleError(1);
942
- break;
943
- case 15:
944
- case 14:
945
- break;
946
- default:
947
- return token;
948
- }
949
- }
950
- }
951
- function handleError(error, skipUntilAfter = [], skipUntil = []) {
952
- onError(error);
953
- if (skipUntilAfter.length + skipUntil.length > 0) {
954
- let token = _scanner.getToken();
955
- while (token !== 17) {
956
- if (skipUntilAfter.indexOf(token) !== -1) {
957
- scanNext();
958
- break;
959
- } else if (skipUntil.indexOf(token) !== -1) {
960
- break;
961
- }
962
- token = scanNext();
963
- }
964
- }
965
- }
966
- function parseString(isValue) {
967
- const value = _scanner.getTokenValue();
968
- if (isValue) {
969
- onLiteralValue(value);
970
- } else {
971
- onObjectProperty(value);
972
- _jsonPath.push(value);
973
- }
974
- scanNext();
975
- return true;
976
- }
977
- function parseLiteral() {
978
- switch (_scanner.getToken()) {
979
- case 11:
980
- const tokenValue = _scanner.getTokenValue();
981
- let value = Number(tokenValue);
982
- if (isNaN(value)) {
983
- handleError(2);
984
- value = 0;
985
- }
986
- onLiteralValue(value);
987
- break;
988
- case 7:
989
- onLiteralValue(null);
990
- break;
991
- case 8:
992
- onLiteralValue(true);
993
- break;
994
- case 9:
995
- onLiteralValue(false);
996
- break;
997
- default:
998
- return false;
999
- }
1000
- scanNext();
1001
- return true;
1002
- }
1003
- function parseProperty() {
1004
- if (_scanner.getToken() !== 10) {
1005
- handleError(3, [], [2, 5]);
1006
- return false;
1007
- }
1008
- parseString(false);
1009
- if (_scanner.getToken() === 6) {
1010
- onSeparator(":");
1011
- scanNext();
1012
- if (!parseValue()) {
1013
- handleError(4, [], [2, 5]);
1014
- }
1015
- } else {
1016
- handleError(5, [], [2, 5]);
1017
- }
1018
- _jsonPath.pop();
1019
- return true;
1020
- }
1021
- function parseObject() {
1022
- onObjectBegin();
1023
- scanNext();
1024
- let needsComma = false;
1025
- while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
1026
- if (_scanner.getToken() === 5) {
1027
- if (!needsComma) {
1028
- handleError(4, [], []);
1029
- }
1030
- onSeparator(",");
1031
- scanNext();
1032
- if (_scanner.getToken() === 2 && allowTrailingComma) {
1033
- break;
1034
- }
1035
- } else if (needsComma) {
1036
- handleError(6, [], []);
1037
- }
1038
- if (!parseProperty()) {
1039
- handleError(4, [], [2, 5]);
1040
- }
1041
- needsComma = true;
1042
- }
1043
- onObjectEnd();
1044
- if (_scanner.getToken() !== 2) {
1045
- handleError(7, [2], []);
1046
- } else {
1047
- scanNext();
1048
- }
1049
- return true;
1050
- }
1051
- function parseArray() {
1052
- onArrayBegin();
1053
- scanNext();
1054
- let isFirstElement = true;
1055
- let needsComma = false;
1056
- while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
1057
- if (_scanner.getToken() === 5) {
1058
- if (!needsComma) {
1059
- handleError(4, [], []);
1060
- }
1061
- onSeparator(",");
1062
- scanNext();
1063
- if (_scanner.getToken() === 4 && allowTrailingComma) {
1064
- break;
1065
- }
1066
- } else if (needsComma) {
1067
- handleError(6, [], []);
1068
- }
1069
- if (isFirstElement) {
1070
- _jsonPath.push(0);
1071
- isFirstElement = false;
1072
- } else {
1073
- _jsonPath[_jsonPath.length - 1]++;
1074
- }
1075
- if (!parseValue()) {
1076
- handleError(4, [], [4, 5]);
1077
- }
1078
- needsComma = true;
1079
- }
1080
- onArrayEnd();
1081
- if (!isFirstElement) {
1082
- _jsonPath.pop();
1083
- }
1084
- if (_scanner.getToken() !== 4) {
1085
- handleError(8, [4], []);
1086
- } else {
1087
- scanNext();
1088
- }
1089
- return true;
1090
- }
1091
- function parseValue() {
1092
- switch (_scanner.getToken()) {
1093
- case 3:
1094
- return parseArray();
1095
- case 1:
1096
- return parseObject();
1097
- case 10:
1098
- return parseString(true);
1099
- default:
1100
- return parseLiteral();
1101
- }
1102
- }
1103
- scanNext();
1104
- if (_scanner.getToken() === 17) {
1105
- if (options.allowEmptyContent) {
1106
- return true;
1107
- }
1108
- handleError(4, [], []);
1109
- return false;
1110
- }
1111
- if (!parseValue()) {
1112
- handleError(4, [], []);
1113
- return false;
1114
- }
1115
- if (_scanner.getToken() !== 17) {
1116
- handleError(9, [], []);
1117
- }
1118
- return true;
1119
- }
1120
- function getNodeType(value) {
1121
- switch (typeof value) {
1122
- case "boolean":
1123
- return "boolean";
1124
- case "number":
1125
- return "number";
1126
- case "string":
1127
- return "string";
1128
- case "object": {
1129
- if (!value) {
1130
- return "null";
1131
- } else if (Array.isArray(value)) {
1132
- return "array";
1133
- }
1134
- return "object";
1135
- }
1136
- default:
1137
- return "null";
1138
- }
1139
- }
1140
- var ParseOptions;
1141
- var init_parser = __esm(() => {
1142
- init_scanner();
1143
- (function(ParseOptions2) {
1144
- ParseOptions2.DEFAULT = {
1145
- allowTrailingComma: false
1146
- };
1147
- })(ParseOptions || (ParseOptions = {}));
1148
- });
1149
-
1150
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
1151
- function setProperty(text, originalPath, value, options) {
1152
- const path = originalPath.slice();
1153
- const errors = [];
1154
- const root = parseTree(text, errors);
1155
- let parent = undefined;
1156
- let lastSegment = undefined;
1157
- while (path.length > 0) {
1158
- lastSegment = path.pop();
1159
- parent = findNodeAtLocation(root, path);
1160
- if (parent === undefined && value !== undefined) {
1161
- if (typeof lastSegment === "string") {
1162
- value = { [lastSegment]: value };
1163
- } else {
1164
- value = [value];
1165
- }
1166
- } else {
1167
- break;
1168
- }
1169
- }
1170
- if (!parent) {
1171
- if (value === undefined) {
1172
- throw new Error("Can not delete in empty document");
1173
- }
1174
- return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
1175
- } else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
1176
- const existing = findNodeAtLocation(parent, [lastSegment]);
1177
- if (existing !== undefined) {
1178
- if (value === undefined) {
1179
- if (!existing.parent) {
1180
- throw new Error("Malformed AST");
1181
- }
1182
- const propertyIndex = parent.children.indexOf(existing.parent);
1183
- let removeBegin;
1184
- let removeEnd = existing.parent.offset + existing.parent.length;
1185
- if (propertyIndex > 0) {
1186
- let previous = parent.children[propertyIndex - 1];
1187
- removeBegin = previous.offset + previous.length;
1188
- } else {
1189
- removeBegin = parent.offset + 1;
1190
- if (parent.children.length > 1) {
1191
- let next = parent.children[1];
1192
- removeEnd = next.offset;
1193
- }
1194
- }
1195
- return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
1196
- } else {
1197
- return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
1198
- }
1199
- } else {
1200
- if (value === undefined) {
1201
- return [];
1202
- }
1203
- const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
1204
- const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
1205
- let edit;
1206
- if (index > 0) {
1207
- let previous = parent.children[index - 1];
1208
- edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1209
- } else if (parent.children.length === 0) {
1210
- edit = { offset: parent.offset + 1, length: 0, content: newProperty };
1211
- } else {
1212
- edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
1213
- }
1214
- return withFormatting(text, edit, options);
1215
- }
1216
- } else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
1217
- const insertIndex = lastSegment;
1218
- if (insertIndex === -1) {
1219
- const newProperty = `${JSON.stringify(value)}`;
1220
- let edit;
1221
- if (parent.children.length === 0) {
1222
- edit = { offset: parent.offset + 1, length: 0, content: newProperty };
1223
- } else {
1224
- const previous = parent.children[parent.children.length - 1];
1225
- edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1226
- }
1227
- return withFormatting(text, edit, options);
1228
- } else if (value === undefined && parent.children.length >= 0) {
1229
- const removalIndex = lastSegment;
1230
- const toRemove = parent.children[removalIndex];
1231
- let edit;
1232
- if (parent.children.length === 1) {
1233
- edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
1234
- } else if (parent.children.length - 1 === removalIndex) {
1235
- let previous = parent.children[removalIndex - 1];
1236
- let offset = previous.offset + previous.length;
1237
- let parentEndOffset = parent.offset + parent.length;
1238
- edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
1239
- } else {
1240
- edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
1241
- }
1242
- return withFormatting(text, edit, options);
1243
- } else if (value !== undefined) {
1244
- let edit;
1245
- const newProperty = `${JSON.stringify(value)}`;
1246
- if (!options.isArrayInsertion && parent.children.length > lastSegment) {
1247
- const toModify = parent.children[lastSegment];
1248
- edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
1249
- } else if (parent.children.length === 0 || lastSegment === 0) {
1250
- edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
1251
- } else {
1252
- const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
1253
- const previous = parent.children[index - 1];
1254
- edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
1255
- }
1256
- return withFormatting(text, edit, options);
1257
- } else {
1258
- throw new Error(`Can not ${value === undefined ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
1259
- }
1260
- } else {
1261
- throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
1262
- }
1263
- }
1264
- function withFormatting(text, edit, options) {
1265
- if (!options.formattingOptions) {
1266
- return [edit];
1267
- }
1268
- let newText = applyEdit(text, edit);
1269
- let begin = edit.offset;
1270
- let end = edit.offset + edit.content.length;
1271
- if (edit.length === 0 || edit.content.length === 0) {
1272
- while (begin > 0 && !isEOL(newText, begin - 1)) {
1273
- begin--;
1274
- }
1275
- while (end < newText.length && !isEOL(newText, end)) {
1276
- end++;
1277
- }
1278
- }
1279
- const edits = format(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
1280
- for (let i = edits.length - 1;i >= 0; i--) {
1281
- const edit2 = edits[i];
1282
- newText = applyEdit(newText, edit2);
1283
- begin = Math.min(begin, edit2.offset);
1284
- end = Math.max(end, edit2.offset + edit2.length);
1285
- end += edit2.content.length - edit2.length;
1286
- }
1287
- const editLength = text.length - (newText.length - end) - begin;
1288
- return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
1289
- }
1290
- function applyEdit(text, edit) {
1291
- return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
1292
- }
1293
- var init_edit = __esm(() => {
1294
- init_format();
1295
- init_parser();
1296
- });
1297
-
1298
- // node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
1299
- function modify(text, path, value, options) {
1300
- return setProperty(text, path, value, options);
1301
- }
1302
- function applyEdits(text, edits) {
1303
- let sortedEdits = edits.slice(0).sort((a, b) => {
1304
- const diff = a.offset - b.offset;
1305
- if (diff === 0) {
1306
- return a.length - b.length;
1307
- }
1308
- return diff;
1309
- });
1310
- let lastModifiedOffset = text.length;
1311
- for (let i = sortedEdits.length - 1;i >= 0; i--) {
1312
- let e = sortedEdits[i];
1313
- if (e.offset + e.length <= lastModifiedOffset) {
1314
- text = applyEdit(text, e);
1315
- } else {
1316
- throw new Error("Overlapping edit");
1317
- }
1318
- lastModifiedOffset = e.offset;
1319
- }
1320
- return text;
1321
- }
1322
- var ScanError, SyntaxKind, parse2, ParseErrorCode;
1323
- var init_main = __esm(() => {
1324
- init_format();
1325
- init_edit();
1326
- init_scanner();
1327
- init_parser();
1328
- (function(ScanError2) {
1329
- ScanError2[ScanError2["None"] = 0] = "None";
1330
- ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
1331
- ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
1332
- ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
1333
- ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
1334
- ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
1335
- ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
1336
- })(ScanError || (ScanError = {}));
1337
- (function(SyntaxKind2) {
1338
- SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
1339
- SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
1340
- SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
1341
- SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
1342
- SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
1343
- SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
1344
- SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
1345
- SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
1346
- SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
1347
- SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
1348
- SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
1349
- SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
1350
- SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
1351
- SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
1352
- SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
1353
- SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
1354
- SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
1355
- })(SyntaxKind || (SyntaxKind = {}));
1356
- parse2 = parse;
1357
- (function(ParseErrorCode2) {
1358
- ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
1359
- ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
1360
- ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
1361
- ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
1362
- ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
1363
- ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
1364
- ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
1365
- ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
1366
- ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
1367
- ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
1368
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
1369
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
1370
- ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
1371
- ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
1372
- ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
1373
- ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
1374
- })(ParseErrorCode || (ParseErrorCode = {}));
1375
- });
1376
-
1377
- // src/utils/json.ts
1378
- import { open, readFile, stat } from "fs/promises";
1379
- function parseJSONUncached(json, shouldLogError) {
1380
- try {
1381
- return { ok: true, value: JSON.parse(stripBOM(json)) };
1382
- } catch (e) {
1383
- if (shouldLogError) {
1384
- logError(e);
1385
- }
1386
- return { ok: false };
1387
- }
1388
- }
1389
- function safeParseJSONC(json) {
1390
- if (!json) {
1391
- return null;
1392
- }
1393
- try {
1394
- return parse2(stripBOM(json));
1395
- } catch (e) {
1396
- logError(e);
1397
- return null;
1398
- }
1399
- }
1400
- function parseJSONLBun(data) {
1401
- const parse3 = bunJSONLParse;
1402
- const len = data.length;
1403
- const result = parse3(data);
1404
- if (!result.error || result.done || result.read >= len) {
1405
- return result.values;
1406
- }
1407
- let values = result.values;
1408
- let offset = result.read;
1409
- while (offset < len) {
1410
- const newlineIndex = typeof data === "string" ? data.indexOf(`
1411
- `, offset) : data.indexOf(10, offset);
1412
- if (newlineIndex === -1)
1413
- break;
1414
- offset = newlineIndex + 1;
1415
- const next = parse3(data, offset);
1416
- if (next.values.length > 0) {
1417
- values = values.concat(next.values);
1418
- }
1419
- if (!next.error || next.done || next.read >= len)
1420
- break;
1421
- offset = next.read;
1422
- }
1423
- return values;
1424
- }
1425
- function parseJSONLBuffer(buf) {
1426
- const bufLen = buf.length;
1427
- let start = 0;
1428
- if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) {
1429
- start = 3;
1430
- }
1431
- const results = [];
1432
- while (start < bufLen) {
1433
- let end = buf.indexOf(10, start);
1434
- if (end === -1)
1435
- end = bufLen;
1436
- const line = buf.toString("utf8", start, end).trim();
1437
- start = end + 1;
1438
- if (!line)
1439
- continue;
1440
- try {
1441
- results.push(JSON.parse(line));
1442
- } catch {}
1443
- }
1444
- return results;
1445
- }
1446
- function parseJSONLString(data) {
1447
- const stripped = stripBOM(data);
1448
- const len = stripped.length;
1449
- let start = 0;
1450
- const results = [];
1451
- while (start < len) {
1452
- let end = stripped.indexOf(`
1453
- `, start);
1454
- if (end === -1)
1455
- end = len;
1456
- const line = stripped.substring(start, end).trim();
1457
- start = end + 1;
1458
- if (!line)
1459
- continue;
1460
- try {
1461
- results.push(JSON.parse(line));
1462
- } catch {}
1463
- }
1464
- return results;
1465
- }
1466
- function parseJSONL(data) {
1467
- if (bunJSONLParse) {
1468
- return parseJSONLBun(data);
1469
- }
1470
- if (typeof data === "string") {
1471
- return parseJSONLString(data);
1472
- }
1473
- return parseJSONLBuffer(data);
1474
- }
1475
- async function readJSONLFile(filePath) {
1476
- let __stack = [];
1477
- try {
1478
- const { size } = await stat(filePath);
1479
- if (size <= MAX_JSONL_READ_BYTES) {
1480
- return parseJSONL(await readFile(filePath));
1481
- }
1482
- const fd = __using(__stack, await open(filePath, "r"), 1);
1483
- const buf = Buffer.allocUnsafe(MAX_JSONL_READ_BYTES);
1484
- let totalRead = 0;
1485
- const fileOffset = size - MAX_JSONL_READ_BYTES;
1486
- while (totalRead < MAX_JSONL_READ_BYTES) {
1487
- const { bytesRead } = await fd.read(buf, totalRead, MAX_JSONL_READ_BYTES - totalRead, fileOffset + totalRead);
1488
- if (bytesRead === 0)
1489
- break;
1490
- totalRead += bytesRead;
1491
- }
1492
- const newlineIndex = buf.indexOf(10);
1493
- if (newlineIndex !== -1 && newlineIndex < totalRead - 1) {
1494
- return parseJSONL(buf.subarray(newlineIndex + 1, totalRead));
1495
- }
1496
- return parseJSONL(buf.subarray(0, totalRead));
1497
- } catch (_catch) {
1498
- var _err = _catch, _hasErr = 1;
1499
- } finally {
1500
- var _promise = __callDispose(__stack, _err, _hasErr);
1501
- _promise && await _promise;
1502
- }
1503
- }
1504
- function addItemToJSONCArray(content, newItem) {
1505
- try {
1506
- if (!content || content.trim() === "") {
1507
- return jsonStringify([newItem], null, 4);
1508
- }
1509
- const cleanContent = stripBOM(content);
1510
- const parsedContent = parse2(cleanContent);
1511
- if (Array.isArray(parsedContent)) {
1512
- const arrayLength = parsedContent.length;
1513
- const isEmpty = arrayLength === 0;
1514
- const insertPath = isEmpty ? [0] : [arrayLength];
1515
- const edits = modify(cleanContent, insertPath, newItem, {
1516
- formattingOptions: { insertSpaces: true, tabSize: 4 },
1517
- isArrayInsertion: true
1518
- });
1519
- if (!edits || edits.length === 0) {
1520
- const copy = [...parsedContent, newItem];
1521
- return jsonStringify(copy, null, 4);
1522
- }
1523
- return applyEdits(cleanContent, edits);
1524
- } else {
1525
- return jsonStringify([newItem], null, 4);
1526
- }
1527
- } catch (e) {
1528
- logError(e);
1529
- return jsonStringify([newItem], null, 4);
1530
- }
1531
- }
1532
- var PARSE_CACHE_MAX_KEY_BYTES, parseJSONCached, safeParseJSON, bunJSONLParse, MAX_JSONL_READ_BYTES;
1533
- var init_json = __esm(() => {
1534
- init_main();
1535
- init_jsonRead();
1536
- init_log();
1537
- init_memoize();
1538
- init_slowOperations();
1539
- PARSE_CACHE_MAX_KEY_BYTES = 8 * 1024;
1540
- parseJSONCached = memoizeWithLRU(parseJSONUncached, (json) => json, 50);
1541
- safeParseJSON = Object.assign(function safeParseJSON2(json, shouldLogError = true) {
1542
- if (!json)
1543
- return null;
1544
- const result = json.length > PARSE_CACHE_MAX_KEY_BYTES ? parseJSONUncached(json, shouldLogError) : parseJSONCached(json, shouldLogError);
1545
- return result.ok ? result.value : null;
1546
- }, { cache: parseJSONCached.cache });
1547
- bunJSONLParse = (() => {
1548
- if (typeof Bun === "undefined")
1549
- return false;
1550
- const b = Bun;
1551
- const jsonl = b.JSONL;
1552
- if (!jsonl?.parseChunk)
1553
- return false;
1554
- return jsonl.parseChunk;
1555
- })();
1556
- MAX_JSONL_READ_BYTES = 100 * 1024 * 1024;
1557
- });
1558
-
1559
- // src/services/mcp/types.ts
1560
- var ConfigScopeSchema, TransportSchema, McpStdioServerConfigSchema, McpXaaConfigSchema, McpOAuthConfigSchema, McpSSEServerConfigSchema, McpSSEIDEServerConfigSchema, McpWebSocketIDEServerConfigSchema, McpHTTPServerConfigSchema, McpWebSocketServerConfigSchema, McpSdkServerConfigSchema, McpClaudeAIProxyServerConfigSchema, McpServerConfigSchema, McpJsonConfigSchema;
1561
- var init_types = __esm(() => {
1562
- init_v4();
1563
- init_lazySchema();
1564
- ConfigScopeSchema = lazySchema(() => exports_external.enum([
1565
- "local",
1566
- "user",
1567
- "project",
1568
- "dynamic",
1569
- "enterprise",
1570
- "claudeai",
1571
- "managed"
1572
- ]));
1573
- TransportSchema = lazySchema(() => exports_external.enum(["stdio", "sse", "sse-ide", "http", "ws", "sdk"]));
1574
- McpStdioServerConfigSchema = lazySchema(() => exports_external.object({
1575
- type: exports_external.literal("stdio").optional(),
1576
- command: exports_external.string().min(1, "Command cannot be empty"),
1577
- args: exports_external.array(exports_external.string()).default([]),
1578
- env: exports_external.record(exports_external.string(), exports_external.string()).optional()
1579
- }));
1580
- McpXaaConfigSchema = lazySchema(() => exports_external.boolean());
1581
- McpOAuthConfigSchema = lazySchema(() => exports_external.object({
1582
- clientId: exports_external.string().optional(),
1583
- callbackPort: exports_external.number().int().positive().optional(),
1584
- authServerMetadataUrl: exports_external.string().url().startsWith("https://", {
1585
- message: "authServerMetadataUrl must use https://"
1586
- }).optional(),
1587
- xaa: McpXaaConfigSchema().optional()
1588
- }));
1589
- McpSSEServerConfigSchema = lazySchema(() => exports_external.object({
1590
- type: exports_external.literal("sse"),
1591
- url: exports_external.string(),
1592
- headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
1593
- headersHelper: exports_external.string().optional(),
1594
- oauth: McpOAuthConfigSchema().optional()
1595
- }));
1596
- McpSSEIDEServerConfigSchema = lazySchema(() => exports_external.object({
1597
- type: exports_external.literal("sse-ide"),
1598
- url: exports_external.string(),
1599
- ideName: exports_external.string(),
1600
- ideRunningInWindows: exports_external.boolean().optional()
1601
- }));
1602
- McpWebSocketIDEServerConfigSchema = lazySchema(() => exports_external.object({
1603
- type: exports_external.literal("ws-ide"),
1604
- url: exports_external.string(),
1605
- ideName: exports_external.string(),
1606
- authToken: exports_external.string().optional(),
1607
- ideRunningInWindows: exports_external.boolean().optional()
1608
- }));
1609
- McpHTTPServerConfigSchema = lazySchema(() => exports_external.object({
1610
- type: exports_external.literal("http"),
1611
- url: exports_external.string(),
1612
- headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
1613
- headersHelper: exports_external.string().optional(),
1614
- oauth: McpOAuthConfigSchema().optional()
1615
- }));
1616
- McpWebSocketServerConfigSchema = lazySchema(() => exports_external.object({
1617
- type: exports_external.literal("ws"),
1618
- url: exports_external.string(),
1619
- headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
1620
- headersHelper: exports_external.string().optional()
1621
- }));
1622
- McpSdkServerConfigSchema = lazySchema(() => exports_external.object({
1623
- type: exports_external.literal("sdk"),
1624
- name: exports_external.string()
1625
- }));
1626
- McpClaudeAIProxyServerConfigSchema = lazySchema(() => exports_external.object({
1627
- type: exports_external.literal("claudeai-proxy"),
1628
- url: exports_external.string(),
1629
- id: exports_external.string()
1630
- }));
1631
- McpServerConfigSchema = lazySchema(() => exports_external.union([
1632
- McpStdioServerConfigSchema(),
1633
- McpSSEServerConfigSchema(),
1634
- McpSSEIDEServerConfigSchema(),
1635
- McpWebSocketIDEServerConfigSchema(),
1636
- McpHTTPServerConfigSchema(),
1637
- McpWebSocketServerConfigSchema(),
1638
- McpSdkServerConfigSchema(),
1639
- McpClaudeAIProxyServerConfigSchema()
1640
- ]));
1641
- McpJsonConfigSchema = lazySchema(() => exports_external.object({
1642
- mcpServers: exports_external.record(exports_external.string(), McpServerConfigSchema())
1643
- }));
1644
- });
1645
-
1646
- export { stripBOM, init_jsonRead, safeParseJSON, safeParseJSONC, parseJSONL, readJSONLFile, addItemToJSONCArray, init_json, ConfigScopeSchema, McpStdioServerConfigSchema, McpServerConfigSchema, McpJsonConfigSchema, init_types };