@qitqode/qitqode-android-arm64 0.1.30 → 0.1.32

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 (417) hide show
  1. package/bundle/{chunk-37n34pzd.js → chunk-01my2y0c.js} +1 -1
  2. package/bundle/{chunk-ejjea8hh.js → chunk-02jtpxe0.js} +1 -1
  3. package/bundle/{chunk-6qy1ghrx.js → chunk-05mce0j3.js} +1 -1
  4. package/bundle/chunk-096pd6c4.js +2 -0
  5. package/bundle/{chunk-g1dwbvkg.js → chunk-0bbs01f0.js} +1 -1
  6. package/bundle/chunk-0c2p3a6v.js +2 -0
  7. package/bundle/chunk-0c5rxty9.js +2 -0
  8. package/bundle/{chunk-j6emx6jn.js → chunk-0dt0bxz6.js} +2 -2
  9. package/bundle/chunk-0e86gt9r.js +2 -0
  10. package/bundle/{chunk-mskwkcgj.js → chunk-0mx2psfc.js} +1 -1
  11. package/bundle/chunk-0p27fvfr.js +2 -0
  12. package/bundle/chunk-0qs1vx97.js +2 -0
  13. package/bundle/{chunk-f45tp3e3.js → chunk-0v0vqbn5.js} +1 -1
  14. package/bundle/{chunk-be216spx.js → chunk-10bjs581.js} +2 -2
  15. package/bundle/{chunk-bss414qz.js → chunk-12vef2pr.js} +1 -1
  16. package/bundle/{chunk-jm1ptn8n.js → chunk-15hw2z9t.js} +1 -1
  17. package/bundle/chunk-15j5cn4t.js +2 -0
  18. package/bundle/{chunk-srh4xvsj.js → chunk-1gx18dm5.js} +1 -1
  19. package/bundle/chunk-1r95p0tp.js +2 -0
  20. package/bundle/chunk-1rhhhm88.js +2 -0
  21. package/bundle/{chunk-b0syck9r.js → chunk-1sgahe1s.js} +1 -1
  22. package/bundle/{chunk-26nfphsg.js → chunk-1vb79bw1.js} +1 -1
  23. package/bundle/chunk-1wbjh23g.js +2 -0
  24. package/bundle/chunk-20702epe.js +2 -0
  25. package/bundle/{chunk-371r2111.js → chunk-24jg9d61.js} +1 -1
  26. package/bundle/chunk-257me4z3.js +800 -0
  27. package/bundle/{chunk-1sgby720.js → chunk-2hc5z7b5.js} +1 -1
  28. package/bundle/{chunk-yq3m8190.js → chunk-2maqde7w.js} +2 -2
  29. package/bundle/{chunk-mrw279k3.js → chunk-2phz0bn9.js} +1 -1
  30. package/bundle/{chunk-b8tw709r.js → chunk-2vn41ecx.js} +1 -1
  31. package/bundle/chunk-2wajs9xv.js +2 -0
  32. package/bundle/{chunk-w87a3mzm.js → chunk-2zq4k837.js} +1 -1
  33. package/bundle/{chunk-1bhvt33f.js → chunk-31qrzrwy.js} +1 -1
  34. package/bundle/{chunk-d5bxan80.js → chunk-326p5b10.js} +2 -2
  35. package/bundle/{chunk-0df4kede.js → chunk-33e9y2aw.js} +1 -1
  36. package/bundle/{chunk-zcm2jdr5.js → chunk-35xk4g91.js} +1 -1
  37. package/bundle/{chunk-5fz8tph5.js → chunk-3632wgg1.js} +1 -1
  38. package/bundle/{chunk-1ngtxja9.js → chunk-3bxg5bta.js} +1 -1
  39. package/bundle/{chunk-mgk9sh16.js → chunk-3c6p8tm3.js} +1 -1
  40. package/bundle/{chunk-fqw4y7x0.js → chunk-3nx7112w.js} +2 -2
  41. package/bundle/{chunk-n26yf3he.js → chunk-3wetyrjs.js} +1 -1
  42. package/bundle/{chunk-2jmxt3fb.js → chunk-40efytmk.js} +1 -1
  43. package/bundle/chunk-42p59wm4.js +2 -0
  44. package/bundle/chunk-4512pvca.js +2 -0
  45. package/bundle/chunk-456bmaww.js +2 -0
  46. package/bundle/{chunk-c5e6sk9c.js → chunk-48ge2ryx.js} +1 -1
  47. package/bundle/chunk-48pajrnt.js +2 -0
  48. package/bundle/{chunk-12bssxd4.js → chunk-4cnwn1rh.js} +2 -2
  49. package/bundle/chunk-4fy9c54h.js +2 -0
  50. package/bundle/{chunk-4tbwha3m.js → chunk-4jtxtkj7.js} +2 -2
  51. package/bundle/chunk-4sc82a27.js +2 -0
  52. package/bundle/chunk-52bam8g7.js +2 -0
  53. package/bundle/{chunk-6fp8a9ek.js → chunk-53bqcctj.js} +1 -1
  54. package/bundle/{chunk-hwbyqezq.js → chunk-56z7x7h4.js} +2 -2
  55. package/bundle/chunk-59y8q9m5.js +2 -0
  56. package/bundle/chunk-59yqvk48.js +3 -0
  57. package/bundle/{chunk-a1pw9r6f.js → chunk-5hw6xa49.js} +2 -2
  58. package/bundle/{chunk-8qkhddq3.js → chunk-5jx0yadh.js} +2 -2
  59. package/bundle/chunk-5pb551dx.js +2 -0
  60. package/bundle/{chunk-qrey2gwb.js → chunk-5q4harvc.js} +2 -2
  61. package/bundle/chunk-5tray1fw.js +3 -0
  62. package/bundle/{chunk-my6sz5d6.js → chunk-60v5jvgt.js} +1 -1
  63. package/bundle/chunk-634pnryq.js +2 -0
  64. package/bundle/chunk-64ezpbwt.js +2 -0
  65. package/bundle/{chunk-5fgx6fa4.js → chunk-69nzndk7.js} +1 -1
  66. package/bundle/{chunk-k8ss3135.js → chunk-6aqyhfag.js} +218 -218
  67. package/bundle/{chunk-chmrvbbj.js → chunk-6d5rrre9.js} +1 -1
  68. package/bundle/{chunk-g3dhsmbt.js → chunk-6hpgb8h4.js} +3 -3
  69. package/bundle/{chunk-drs1gv2b.js → chunk-6kp07m7p.js} +1 -1
  70. package/bundle/{chunk-wy46mbwt.js → chunk-6phh70sp.js} +1 -1
  71. package/bundle/{chunk-v2zp22r3.js → chunk-70ck4v3t.js} +1 -1
  72. package/bundle/{chunk-2tnarng3.js → chunk-71sjjjr8.js} +1 -1
  73. package/bundle/{chunk-ds69qc8b.js → chunk-71xz70r9.js} +1 -1
  74. package/bundle/{chunk-2dzk5txw.js → chunk-73e409hd.js} +1 -1
  75. package/bundle/chunk-764fksh3.js +2 -0
  76. package/bundle/{chunk-g7rjtehn.js → chunk-78ymd20x.js} +1 -1
  77. package/bundle/{chunk-szr0f7k2.js → chunk-7avcnwv8.js} +1 -1
  78. package/bundle/{chunk-z8v2tsz2.js → chunk-7hm0c2yg.js} +1 -1
  79. package/bundle/chunk-7mke41x0.js +2 -0
  80. package/bundle/chunk-7ry9cvby.js +2 -0
  81. package/bundle/chunk-7tr9ejyk.js +7 -0
  82. package/bundle/chunk-7wczs9mx.js +2 -0
  83. package/bundle/{chunk-aztre27e.js → chunk-7xm75w1e.js} +1 -1
  84. package/bundle/{chunk-s3yna2wm.js → chunk-7z5jh4ra.js} +1 -1
  85. package/bundle/chunk-7z777y9k.js +2 -0
  86. package/bundle/{chunk-vj62pc0h.js → chunk-81qwdg5s.js} +1 -1
  87. package/bundle/chunk-85wcc1tp.js +3 -0
  88. package/bundle/chunk-89w3yhf8.js +2 -0
  89. package/bundle/chunk-8dwq41q1.js +28 -0
  90. package/bundle/{chunk-6hv59ere.js → chunk-8hytwgwf.js} +1 -1
  91. package/bundle/{chunk-wz0zcddf.js → chunk-8n20thvd.js} +2 -2
  92. package/bundle/{chunk-s07j8hfy.js → chunk-8qswepp2.js} +1 -1
  93. package/bundle/{chunk-bpbptx89.js → chunk-8r6ht39z.js} +1 -1
  94. package/bundle/chunk-8v96pmqn.js +2 -0
  95. package/bundle/chunk-8y2scz6z.js +2 -0
  96. package/bundle/chunk-8zx7vnx6.js +2 -0
  97. package/bundle/{chunk-qhc90p4a.js → chunk-93p131d5.js} +1 -1
  98. package/bundle/chunk-94a76f8w.js +2 -0
  99. package/bundle/{chunk-ppfjf7qx.js → chunk-9emq67vc.js} +1 -1
  100. package/bundle/{chunk-bvkq0a5q.js → chunk-9f1z9xce.js} +1 -1
  101. package/bundle/{chunk-dcvatax2.js → chunk-9gazyynx.js} +2 -2
  102. package/bundle/chunk-9ng7jjp7.js +2 -0
  103. package/bundle/chunk-9tpgnjy8.js +2 -0
  104. package/bundle/{chunk-mk6cddvd.js → chunk-a1wdeapb.js} +1 -1
  105. package/bundle/{chunk-qjn86fc0.js → chunk-a7amey9s.js} +1 -1
  106. package/bundle/chunk-a7ym9f0v.js +2 -0
  107. package/bundle/chunk-a8f2xvy3.js +2 -0
  108. package/bundle/chunk-a99cvwta.js +2 -0
  109. package/bundle/{chunk-42f7p0hq.js → chunk-ad72gb5f.js} +2 -2
  110. package/bundle/{chunk-89v6dgpp.js → chunk-ag8kz1e7.js} +2 -2
  111. package/bundle/{chunk-zv6pjtz1.js → chunk-avf8v3hb.js} +1 -1
  112. package/bundle/chunk-avys5mnz.js +2 -0
  113. package/bundle/chunk-axvjd10y.js +2 -0
  114. package/bundle/{chunk-m612agnk.js → chunk-ay8emwym.js} +1 -1
  115. package/bundle/chunk-b4pphqab.js +2 -0
  116. package/bundle/chunk-b6087ak4.js +2 -0
  117. package/bundle/{chunk-msegx0t7.js → chunk-b8gjz6bk.js} +1 -1
  118. package/bundle/{chunk-gf0pdgjs.js → chunk-bh53dz71.js} +1 -1
  119. package/bundle/chunk-bn0h9dny.js +10 -0
  120. package/bundle/chunk-brkqxbjy.js +2 -0
  121. package/bundle/{chunk-09kba1hg.js → chunk-c11d28qn.js} +2 -2
  122. package/bundle/chunk-c26qxt5g.js +2 -0
  123. package/bundle/chunk-c6zscb38.js +2 -0
  124. package/bundle/{chunk-ddnpx1yx.js → chunk-caj1b9y7.js} +5 -5
  125. package/bundle/{chunk-pekm54ce.js → chunk-cfgvm15x.js} +1 -1
  126. package/bundle/{chunk-v4xcysh0.js → chunk-chpr8ekb.js} +1 -1
  127. package/bundle/chunk-cjww2jmv.js +3 -0
  128. package/bundle/{chunk-m67tcnk4.js → chunk-ck2gfaba.js} +1 -1
  129. package/bundle/{chunk-9j1qqdr2.js → chunk-cphrgyp6.js} +1 -1
  130. package/bundle/{chunk-eb9mytjq.js → chunk-ctaze2hn.js} +1 -1
  131. package/bundle/{chunk-5qam3c8r.js → chunk-cxnfy6qk.js} +1 -1
  132. package/bundle/{chunk-cafzcmrg.js → chunk-d07p6fpk.js} +2 -2
  133. package/bundle/chunk-d0damw6y.js +2 -0
  134. package/bundle/{chunk-b8bytvka.js → chunk-d3ermm6d.js} +2 -2
  135. package/bundle/{chunk-4qqkqrn9.js → chunk-d6ry9418.js} +2 -2
  136. package/bundle/{chunk-sn4nez18.js → chunk-d9hbhkbq.js} +2 -2
  137. package/bundle/{chunk-ztc3gm8y.js → chunk-dactgryw.js} +1 -1
  138. package/bundle/chunk-dafmkrhn.js +2 -0
  139. package/bundle/{chunk-dfnv7vkn.js → chunk-db405hjg.js} +1 -1
  140. package/bundle/chunk-dgprdym0.js +2 -0
  141. package/bundle/{chunk-7yrhe3xq.js → chunk-dnwefyhv.js} +1 -1
  142. package/bundle/chunk-dryzt12j.js +2 -0
  143. package/bundle/chunk-dsamees2.js +2 -0
  144. package/bundle/{chunk-xpc2zgj7.js → chunk-dxpj0cxh.js} +2 -2
  145. package/bundle/{chunk-yjtdgcq5.js → chunk-dynv30gm.js} +1 -1
  146. package/bundle/chunk-dyqpxx3b.js +2 -0
  147. package/bundle/{chunk-2rs39vj2.js → chunk-e01wnqvc.js} +1 -1
  148. package/bundle/{chunk-2vepzgek.js → chunk-e10py6yr.js} +1 -1
  149. package/bundle/chunk-e5mv5wnt.js +2 -0
  150. package/bundle/{chunk-qv2s39dv.js → chunk-e7ny0b3x.js} +1 -1
  151. package/bundle/{chunk-n8h6x2en.js → chunk-ejrhvy38.js} +1 -1
  152. package/bundle/{chunk-dq9kpj4a.js → chunk-enpzvmtc.js} +1 -1
  153. package/bundle/chunk-ew9pdrp9.js +3 -0
  154. package/bundle/{chunk-gj3hzx3d.js → chunk-ezfy0b6q.js} +2 -2
  155. package/bundle/{chunk-2km50rd3.js → chunk-fgg9txzb.js} +1 -1
  156. package/bundle/{chunk-b9za12y1.js → chunk-fn9h4ync.js} +1 -1
  157. package/bundle/{chunk-ngchsw2g.js → chunk-fvzwbjh8.js} +1 -1
  158. package/bundle/{chunk-nzehfpxp.js → chunk-g10d6x57.js} +1 -1
  159. package/bundle/{chunk-zyhdxggp.js → chunk-g5rabwre.js} +2 -2
  160. package/bundle/{chunk-kfsb2stm.js → chunk-g7ccdh7r.js} +1 -1
  161. package/bundle/{chunk-phxrg7aw.js → chunk-gagtmjmp.js} +2 -2
  162. package/bundle/{chunk-yp0a8q29.js → chunk-gb00fh4z.js} +3 -3
  163. package/bundle/{chunk-hw1dmx28.js → chunk-gbpvs0fx.js} +1 -1
  164. package/bundle/{chunk-j8efst22.js → chunk-gj0wt0cy.js} +1 -1
  165. package/bundle/{chunk-2q96x1t5.js → chunk-gsar6xda.js} +1 -1
  166. package/bundle/{chunk-xs3xtz6x.js → chunk-gt31468k.js} +1 -1
  167. package/bundle/{chunk-ecn8gbtz.js → chunk-gwp17r03.js} +1 -1
  168. package/bundle/chunk-gwzw92jt.js +2 -0
  169. package/bundle/chunk-gz8sz7z1.js +9 -0
  170. package/bundle/{chunk-2bn4b42t.js → chunk-h2afsbm1.js} +1 -1
  171. package/bundle/{chunk-tj78jsp9.js → chunk-h4j5xzc8.js} +1 -1
  172. package/bundle/chunk-h6f3kbz2.js +2 -0
  173. package/bundle/{chunk-b3dqcbsc.js → chunk-hbbsbyyq.js} +1 -1
  174. package/bundle/{chunk-2gerf08b.js → chunk-hnvn2c25.js} +2 -2
  175. package/bundle/{chunk-vn7nkrqb.js → chunk-hnzegjgv.js} +1 -1
  176. package/bundle/chunk-hp7tssgv.js +2 -0
  177. package/bundle/chunk-ht0hbdmx.js +2 -0
  178. package/bundle/{chunk-j9pcnkkq.js → chunk-ht5w06x7.js} +2 -2
  179. package/bundle/{chunk-a1p2f16h.js → chunk-htz93dsd.js} +2 -2
  180. package/bundle/{chunk-q6ztpfcs.js → chunk-jbx3s7nw.js} +2 -2
  181. package/bundle/{chunk-hxz2rdjq.js → chunk-jdynx7m6.js} +1 -1
  182. package/bundle/{chunk-h9pvnp5c.js → chunk-jef04wyf.js} +1 -1
  183. package/bundle/{chunk-ct48575c.js → chunk-jh0bw59r.js} +1 -1
  184. package/bundle/{chunk-knpt9n8f.js → chunk-jrqb0jwy.js} +1 -1
  185. package/bundle/{chunk-1dwcga8g.js → chunk-js1n8tgv.js} +1 -1
  186. package/bundle/chunk-k1txw65h.js +2 -0
  187. package/bundle/chunk-k5atbdbm.js +2 -0
  188. package/bundle/chunk-k75jqg60.js +3 -0
  189. package/bundle/{chunk-yn6sbycg.js → chunk-k7aenxan.js} +2 -2
  190. package/bundle/{chunk-1rp1cvmc.js → chunk-kf167jw7.js} +1 -1
  191. package/bundle/{chunk-wsy0m70r.js → chunk-kfxv5rfg.js} +1 -1
  192. package/bundle/{chunk-btz9jvec.js → chunk-kj20f048.js} +1 -1
  193. package/bundle/{chunk-j5kb0y1m.js → chunk-kq6b222y.js} +1 -1
  194. package/bundle/{chunk-1t9jne14.js → chunk-ktzq4ha1.js} +1 -1
  195. package/bundle/{chunk-5v4py9p2.js → chunk-m2q317gh.js} +1 -1
  196. package/bundle/chunk-mahgmbt9.js +2 -0
  197. package/bundle/{chunk-1qshjfzm.js → chunk-mk1bfzg5.js} +1 -1
  198. package/bundle/{chunk-2y90ad1v.js → chunk-mqd1jsg2.js} +1 -1
  199. package/bundle/{chunk-t12xrrfr.js → chunk-mzs2pjyc.js} +2 -2
  200. package/bundle/{chunk-m02zt1a3.js → chunk-n9xns8by.js} +2 -2
  201. package/bundle/chunk-ngm6pqyt.js +2 -0
  202. package/bundle/chunk-ngtavamt.js +2 -0
  203. package/bundle/chunk-nkhc32s3.js +2 -0
  204. package/bundle/{chunk-wpajh5s5.js → chunk-nkkch4h7.js} +1 -1
  205. package/bundle/chunk-npse2xrd.js +2 -0
  206. package/bundle/{chunk-k7gq9bra.js → chunk-nv3eyyaj.js} +1 -1
  207. package/bundle/{chunk-ab6cabxh.js → chunk-p18axz0m.js} +1 -1
  208. package/bundle/{chunk-jje0srjq.js → chunk-p62gb4wj.js} +1 -1
  209. package/bundle/chunk-p6e4vqy7.js +2 -0
  210. package/bundle/{chunk-m1h5a4vg.js → chunk-p9qfbr02.js} +1 -1
  211. package/bundle/{chunk-ggqst87g.js → chunk-pe29yy6s.js} +1 -1
  212. package/bundle/{chunk-yy526n9c.js → chunk-pje60pj2.js} +1 -1
  213. package/bundle/{chunk-3n1324bt.js → chunk-pp2eqkse.js} +1 -1
  214. package/bundle/{chunk-x067eetw.js → chunk-pp6vhqrr.js} +1 -1
  215. package/bundle/chunk-pqkjhn8h.js +2 -0
  216. package/bundle/{chunk-ezja6njs.js → chunk-pv67gwce.js} +1 -1
  217. package/bundle/{chunk-b3rpzkcb.js → chunk-q7vasbxn.js} +1 -1
  218. package/bundle/chunk-qadw6j20.js +2 -0
  219. package/bundle/{chunk-89q1y7tc.js → chunk-qc8rsn4v.js} +1 -1
  220. package/bundle/chunk-qd8w2gkd.js +2 -0
  221. package/bundle/chunk-qggcszs2.js +2 -0
  222. package/bundle/{chunk-q1v2pytx.js → chunk-qrsveve6.js} +1 -1
  223. package/bundle/chunk-r7sqdfad.js +2 -0
  224. package/bundle/chunk-r8m7rtfc.js +2 -0
  225. package/bundle/{chunk-7ppd2phw.js → chunk-rbk8seme.js} +1 -1
  226. package/bundle/chunk-rf12t4n5.js +2 -0
  227. package/bundle/{chunk-04tw0r4s.js → chunk-rg0mrprz.js} +1 -1
  228. package/bundle/{chunk-cdhmc0t0.js → chunk-rjd8gbs5.js} +1 -1
  229. package/bundle/chunk-rkyf0cp8.js +2 -0
  230. package/bundle/chunk-rpgne7xh.js +2 -0
  231. package/bundle/chunk-rvgj1vky.js +2 -0
  232. package/bundle/{chunk-c01z3cvg.js → chunk-rvkrgkeq.js} +1 -1
  233. package/bundle/chunk-rza530gm.js +5 -0
  234. package/bundle/{chunk-2ahqhh4z.js → chunk-rzhdkkpz.js} +1 -1
  235. package/bundle/chunk-s3mnrhbx.js +5 -0
  236. package/bundle/chunk-s6ktx2sx.js +2 -0
  237. package/bundle/{chunk-kqn9h2gk.js → chunk-skqbaadf.js} +1 -1
  238. package/bundle/chunk-ss2jvqrg.js +2 -0
  239. package/bundle/{chunk-ydp0q1hk.js → chunk-ss2ms1r3.js} +1 -1
  240. package/bundle/{chunk-1fbeendk.js → chunk-t56r99hp.js} +1 -1
  241. package/bundle/{chunk-xc5044tm.js → chunk-t8m74g39.js} +1 -1
  242. package/bundle/{chunk-s6bar2f9.js → chunk-t9mz17gb.js} +2 -2
  243. package/bundle/{chunk-cvdxgsq1.js → chunk-tq0239xp.js} +1 -1
  244. package/bundle/{chunk-whxjkz9a.js → chunk-tqj69nh6.js} +2 -2
  245. package/bundle/{chunk-hj5y7fvk.js → chunk-tt30dybd.js} +1 -1
  246. package/bundle/{chunk-5a5t01ka.js → chunk-tvdmnee6.js} +1 -1
  247. package/bundle/chunk-tvwwq4b3.js +2 -0
  248. package/bundle/{chunk-dhjp0zx2.js → chunk-v1xjc3s8.js} +1 -1
  249. package/bundle/chunk-v2n26eg4.js +2 -0
  250. package/bundle/chunk-vcw00k0n.js +3 -0
  251. package/bundle/{chunk-7jbz3dgt.js → chunk-vhe0tth1.js} +1 -1
  252. package/bundle/{chunk-yfkvjphe.js → chunk-vvxmwyrw.js} +1 -1
  253. package/bundle/{chunk-p68rwmhc.js → chunk-vxyy2dp3.js} +2 -2
  254. package/bundle/{chunk-y2v09y71.js → chunk-vywnd5sf.js} +1 -1
  255. package/bundle/{chunk-0jgsp4c2.js → chunk-w18xs2h5.js} +1 -1
  256. package/bundle/{chunk-fjgyrsbw.js → chunk-w7vh8cxt.js} +1 -1
  257. package/bundle/chunk-w8saweey.js +2 -0
  258. package/bundle/chunk-we9cv8we.js +8 -0
  259. package/bundle/chunk-wezarrvy.js +2 -0
  260. package/bundle/{chunk-d6r4xwtg.js → chunk-wfb608qf.js} +3 -3
  261. package/bundle/{chunk-3g1yz39h.js → chunk-whe7h2mj.js} +1 -1
  262. package/bundle/chunk-wmqsdt2c.js +3 -0
  263. package/bundle/chunk-wqj0xasg.js +2 -0
  264. package/bundle/chunk-wr42tphe.js +2 -0
  265. package/bundle/chunk-x24y7qyd.js +2 -0
  266. package/bundle/{chunk-07g7cybt.js → chunk-x25zkrz7.js} +1 -1
  267. package/bundle/{chunk-tr8sf0dk.js → chunk-x3y2xzhn.js} +1 -1
  268. package/bundle/{chunk-27yxgy03.js → chunk-x4sp99g6.js} +1 -1
  269. package/bundle/{chunk-3nwve06r.js → chunk-x562b0xk.js} +1 -1
  270. package/bundle/{chunk-61c62e5s.js → chunk-x7k5yeey.js} +1 -1
  271. package/bundle/{chunk-fkgv2hqd.js → chunk-x9rbv6p6.js} +1 -1
  272. package/bundle/{chunk-wnqwb6fd.js → chunk-xcmgkc57.js} +1 -1
  273. package/bundle/chunk-xj765svc.js +3 -0
  274. package/bundle/{chunk-gm85xefs.js → chunk-xm7wascx.js} +1 -1
  275. package/bundle/{chunk-whcg14sc.js → chunk-xrs18kzn.js} +1 -1
  276. package/bundle/{chunk-6nbzdb0r.js → chunk-xthkjax9.js} +1 -1
  277. package/bundle/{chunk-scnz207s.js → chunk-xvwvd4kq.js} +2 -2
  278. package/bundle/{chunk-zb0me4kk.js → chunk-xzrb857v.js} +1 -1
  279. package/bundle/chunk-y2d0w09y.js +2 -0
  280. package/bundle/{chunk-3nyqh1d6.js → chunk-y3b4k38p.js} +1 -1
  281. package/bundle/{chunk-svvgv1s0.js → chunk-y6123zvq.js} +1 -1
  282. package/bundle/chunk-y7sy3w6z.js +2 -0
  283. package/bundle/{chunk-vg2fmyje.js → chunk-y9q0hb7b.js} +2 -2
  284. package/bundle/chunk-yb79f79m.js +2 -0
  285. package/bundle/{chunk-fnbpap62.js → chunk-yek0sk2q.js} +1 -1
  286. package/bundle/{chunk-wfs4pcwa.js → chunk-ygs5pzk7.js} +4 -4
  287. package/bundle/{chunk-3bmzjznz.js → chunk-yhbcbjfk.js} +1 -1
  288. package/bundle/{chunk-sermjas1.js → chunk-yjf3kyej.js} +1 -1
  289. package/bundle/chunk-yjnyzpmt.js +2 -0
  290. package/bundle/{chunk-0a0vat1h.js → chunk-yp5bypsp.js} +2 -2
  291. package/bundle/{chunk-h0rpmne5.js → chunk-yp8wyzzm.js} +1 -1
  292. package/bundle/chunk-yqbcnsa1.js +2 -0
  293. package/bundle/{chunk-4xh1qm90.js → chunk-yv0xrnn9.js} +1 -1
  294. package/bundle/chunk-z3mra3nm.js +2 -0
  295. package/bundle/chunk-za7mwbye.js +2 -0
  296. package/bundle/chunk-zaks8cae.js +11 -0
  297. package/bundle/{chunk-0fmbz83g.js → chunk-zcsgqk9f.js} +1 -1
  298. package/bundle/chunk-zqqx96jx.js +3 -0
  299. package/bundle/{chunk-snm5q21k.js → chunk-zs8kqdsf.js} +2 -2
  300. package/bundle/{chunk-y062spw2.js → chunk-zscer8rc.js} +1 -1
  301. package/bundle/{chunk-qjjch1zt.js → chunk-zw815d68.js} +2 -2
  302. package/bundle/chunk-zy9w1vkc.js +2 -0
  303. package/bundle/index.js +3 -3
  304. package/bundle/parser.worker.js +2 -2
  305. package/bundle/worker.js +1 -1
  306. package/package.json +1 -1
  307. package/bundle/chunk-07ws99b1.js +0 -2
  308. package/bundle/chunk-09c4ngag.js +0 -2
  309. package/bundle/chunk-0ch32p4c.js +0 -3
  310. package/bundle/chunk-0jgst767.js +0 -2
  311. package/bundle/chunk-0psrr9vp.js +0 -2
  312. package/bundle/chunk-1j73cnvz.js +0 -2
  313. package/bundle/chunk-1yddn03z.js +0 -2
  314. package/bundle/chunk-27dgtm8r.js +0 -2
  315. package/bundle/chunk-2ec6ps8r.js +0 -5
  316. package/bundle/chunk-38g8yzw0.js +0 -2
  317. package/bundle/chunk-3bkd0ar3.js +0 -2
  318. package/bundle/chunk-3f4zht9e.js +0 -2
  319. package/bundle/chunk-3pxnp6jb.js +0 -2
  320. package/bundle/chunk-3szwfy7w.js +0 -3
  321. package/bundle/chunk-426dt7be.js +0 -2
  322. package/bundle/chunk-4amgp4yd.js +0 -3
  323. package/bundle/chunk-4p5e5tsz.js +0 -28
  324. package/bundle/chunk-4pjm21a5.js +0 -2
  325. package/bundle/chunk-4sz3jbc5.js +0 -2
  326. package/bundle/chunk-58x5seqn.js +0 -2
  327. package/bundle/chunk-5xe6x2rt.js +0 -2
  328. package/bundle/chunk-618tmyx9.js +0 -2
  329. package/bundle/chunk-6d9wsjxm.js +0 -2
  330. package/bundle/chunk-730a2d1k.js +0 -2
  331. package/bundle/chunk-76wrw0cs.js +0 -2
  332. package/bundle/chunk-7bd0x9vf.js +0 -2
  333. package/bundle/chunk-7czkntef.js +0 -2
  334. package/bundle/chunk-7ex57nyh.js +0 -2
  335. package/bundle/chunk-7gpczxbh.js +0 -2
  336. package/bundle/chunk-7j0bgeh2.js +0 -2
  337. package/bundle/chunk-7py443fe.js +0 -2
  338. package/bundle/chunk-90q5sae0.js +0 -2
  339. package/bundle/chunk-9amwe0ed.js +0 -2
  340. package/bundle/chunk-9grvepmd.js +0 -2
  341. package/bundle/chunk-9hrh15p2.js +0 -2
  342. package/bundle/chunk-a0v55ywn.js +0 -8
  343. package/bundle/chunk-a2qz9m10.js +0 -2
  344. package/bundle/chunk-av6ezvxm.js +0 -2
  345. package/bundle/chunk-beksar7w.js +0 -2
  346. package/bundle/chunk-bg66rqrx.js +0 -2
  347. package/bundle/chunk-bn15mzd7.js +0 -2
  348. package/bundle/chunk-bt6yw07v.js +0 -2
  349. package/bundle/chunk-cy9s1ma5.js +0 -2
  350. package/bundle/chunk-d0nkvp57.js +0 -2
  351. package/bundle/chunk-dvk2wwjj.js +0 -2
  352. package/bundle/chunk-dxe29jj6.js +0 -2
  353. package/bundle/chunk-e0jy9qxd.js +0 -2
  354. package/bundle/chunk-eercqt72.js +0 -2
  355. package/bundle/chunk-efxd6b2k.js +0 -2
  356. package/bundle/chunk-eneawsj8.js +0 -2
  357. package/bundle/chunk-f72pppr7.js +0 -2
  358. package/bundle/chunk-feyphhxd.js +0 -2
  359. package/bundle/chunk-fnnch1e9.js +0 -2
  360. package/bundle/chunk-ft93f33g.js +0 -3
  361. package/bundle/chunk-gk34kh8p.js +0 -2
  362. package/bundle/chunk-gn50xqbd.js +0 -2
  363. package/bundle/chunk-h6rv626m.js +0 -2
  364. package/bundle/chunk-h7s2w1e2.js +0 -2
  365. package/bundle/chunk-hmv2cdnz.js +0 -2
  366. package/bundle/chunk-ht81ensf.js +0 -2
  367. package/bundle/chunk-hxpgs78j.js +0 -5
  368. package/bundle/chunk-j59ktwny.js +0 -2
  369. package/bundle/chunk-jmz2mq3t.js +0 -2
  370. package/bundle/chunk-jvqbvgjy.js +0 -11
  371. package/bundle/chunk-k309zez0.js +0 -3
  372. package/bundle/chunk-k3fn3yed.js +0 -2
  373. package/bundle/chunk-kpw6nghv.js +0 -2
  374. package/bundle/chunk-m5ghbt5y.js +0 -2
  375. package/bundle/chunk-mj4bepvj.js +0 -2
  376. package/bundle/chunk-mn41f9qv.js +0 -2
  377. package/bundle/chunk-mqjf9sbm.js +0 -2
  378. package/bundle/chunk-n5gwrrbb.js +0 -2
  379. package/bundle/chunk-nfjhem1c.js +0 -2
  380. package/bundle/chunk-ngytjdg2.js +0 -3
  381. package/bundle/chunk-nj4d554m.js +0 -11
  382. package/bundle/chunk-nrc3bj9p.js +0 -2
  383. package/bundle/chunk-nt4e3em9.js +0 -3
  384. package/bundle/chunk-nxyyn2ra.js +0 -2
  385. package/bundle/chunk-p5tceb4k.js +0 -2
  386. package/bundle/chunk-pvpy9kq1.js +0 -800
  387. package/bundle/chunk-qjgm3e2p.js +0 -2
  388. package/bundle/chunk-qt80mhdn.js +0 -2
  389. package/bundle/chunk-qtw5nrr4.js +0 -2
  390. package/bundle/chunk-rc9ex3vt.js +0 -2
  391. package/bundle/chunk-s9672vvv.js +0 -2
  392. package/bundle/chunk-sbyey0qb.js +0 -2
  393. package/bundle/chunk-shpq6es1.js +0 -3
  394. package/bundle/chunk-sj5v361q.js +0 -2
  395. package/bundle/chunk-ta3k9syc.js +0 -2
  396. package/bundle/chunk-tk5afan4.js +0 -2
  397. package/bundle/chunk-tpndnprb.js +0 -2
  398. package/bundle/chunk-v965rsr8.js +0 -3
  399. package/bundle/chunk-vcmrrt8b.js +0 -3
  400. package/bundle/chunk-vcrn3v70.js +0 -2
  401. package/bundle/chunk-vwxfgea7.js +0 -2
  402. package/bundle/chunk-w0kgcz1t.js +0 -2
  403. package/bundle/chunk-wgpsmxqx.js +0 -7
  404. package/bundle/chunk-wksczmes.js +0 -2
  405. package/bundle/chunk-wsxta33r.js +0 -2
  406. package/bundle/chunk-xck0sq3k.js +0 -2
  407. package/bundle/chunk-xjyhtm8r.js +0 -2
  408. package/bundle/chunk-xm08fc2q.js +0 -3
  409. package/bundle/chunk-ygc5qegv.js +0 -2
  410. package/bundle/chunk-yjqmzm51.js +0 -2
  411. package/bundle/chunk-yzc53n88.js +0 -2
  412. package/bundle/chunk-yzjc15vp.js +0 -9
  413. package/bundle/chunk-z7y9pdj7.js +0 -2
  414. package/bundle/chunk-z8g819cz.js +0 -2
  415. package/bundle/chunk-z8r65yw3.js +0 -2
  416. package/bundle/chunk-zt1nbwmm.js +0 -2
  417. package/bundle/chunk-zz36xg2n.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import"./chunk-aztre27e.js";function BX(G){if(G===void 0)return{BS_PRIVATE_NESTED_SOME_NONE:0};else if(G!==null&&G.BS_PRIVATE_NESTED_SOME_NONE!==void 0)return{BS_PRIVATE_NESTED_SOME_NONE:G.BS_PRIVATE_NESTED_SOME_NONE+1|0};else return G}function qG(G){if(G===null||G.BS_PRIVATE_NESTED_SOME_NONE===void 0)return G;let Q=G.BS_PRIVATE_NESTED_SOME_NONE;if(Q===0)return;else return{BS_PRIVATE_NESTED_SOME_NONE:Q-1|0}}function _Y(G){if(Array.isArray(G))return{TAG:"Array",_0:G};else return{TAG:"Single",_0:G}}var IY={classify:_Y},MQ={};function vY(G){let Q=MQ[G];if(Q!==void 0){let X=Q+1|0;return MQ[G]=X,G+("/"+X)}return MQ[G]=1,G}var DX={},gQ=[];function OY(G){return G.slice(0,1).toUpperCase()+G.slice(1)}var JQ=(G)=>({...G});function YG(G){let Q=0;while(!0){let X=Q,Y=G[X];if(Y===void 0)return'"'+G+'"';switch(Y){case'"':case`
2
+ import"./chunk-7xm75w1e.js";function BX(G){if(G===void 0)return{BS_PRIVATE_NESTED_SOME_NONE:0};else if(G!==null&&G.BS_PRIVATE_NESTED_SOME_NONE!==void 0)return{BS_PRIVATE_NESTED_SOME_NONE:G.BS_PRIVATE_NESTED_SOME_NONE+1|0};else return G}function qG(G){if(G===null||G.BS_PRIVATE_NESTED_SOME_NONE===void 0)return G;let Q=G.BS_PRIVATE_NESTED_SOME_NONE;if(Q===0)return;else return{BS_PRIVATE_NESTED_SOME_NONE:Q-1|0}}function _Y(G){if(Array.isArray(G))return{TAG:"Array",_0:G};else return{TAG:"Single",_0:G}}var IY={classify:_Y},MQ={};function vY(G){let Q=MQ[G];if(Q!==void 0){let X=Q+1|0;return MQ[G]=X,G+("/"+X)}return MQ[G]=1,G}var DX={},gQ=[];function OY(G){return G.slice(0,1).toUpperCase()+G.slice(1)}var JQ=(G)=>({...G});function YG(G){let Q=0;while(!0){let X=Q,Y=G[X];if(Y===void 0)return'"'+G+'"';switch(Y){case'"':case`
3
3
  `:return JSON.stringify(G);default:Q=X+1|0;continue}}}function WX(G){if(G==="")return[];else return JSON.parse(G.split('"]["').join('","'))}var fQ="sury",HQ=Symbol(fQ),qQ=Symbol(fQ+":item"),jY=vY("Sury.Error"),b="const";function xY(G){switch(G.type){case"undefined":return!0;case"union":return"undefined"in G.has;default:return!1}}function wX(G,Q){return(G&Q)!==0}var y={unknown:1,string:2,number:4,boolean:8,undefined:16,null:32,object:64,array:128,union:256,ref:512,bigint:1024,nan:2048,function:4096,instance:8192,never:16384,symbol:32768};function eG(G){let Q=y[typeof G];if(Q&16)return"undefined";if(!(Q&64))if(Q&2)return'"'+G+'"';else if(Q&1024)return G+"n";else return G.toString();if(G===null)return"null";if(Array.isArray(G)){let Z="[";for(let J=0,H=G.length;J<H;++J){if(J!==0)Z=Z+", ";Z=Z+eG(G[J])}return Z+"]"}if(G.constructor!==Object)return Object.prototype.toString.call(G);let X=Object.keys(G),Y="{ ";for(let Z=0,J=X.length;Z<J;++Z){let H=X[Z],q=G[H];Y=Y+H+": "+eG(q)+"; "}return Y+"}"}function j(G){let{type:Q,const:X,name:Y}=G;if(Y!==void 0)return Y;if(X!==void 0)return eG(X);let{format:Z,anyOf:J}=G;if(J!==void 0)return J.map(j).join(" | ");if(Z!==void 0)return Z;switch(Q){case"nan":return"NaN";case"object":let{additionalItems:H,properties:q}=G,U=Object.keys(q);if(U.length===0)if(typeof H==="object")return"{ [key: string]: "+j(H)+"; }";else return"{}";else return"{ "+U.map((z)=>z+": "+j(q[z])+";").join(" ")+" }";default:if(G.b)return Q;switch(Q){case"instance":return G.class.name;case"array":let{additionalItems:z,items:K}=G;if(typeof z!=="object")return"["+K.map((B)=>j(B.schema)).join(", ")+"]";let D=j(z);return(z.type==="union"?"("+D+")":D)+"[]";default:return Q}}}class BG extends Error{constructor(G,Q,X){super();this.flag=Q,this.code=G,this.path=X}}var TG=Object.defineProperty,dG=BG.prototype;TG(dG,"message",{get(){return LX(this)}});TG(dG,"reason",{get(){return UQ(this)}});TG(dG,"name",{value:"SuryError"});TG(dG,"s",{value:HQ});TG(dG,"_1",{get(){return this}});TG(dG,"RE_EXN_ID",{value:jY});var F=function(G){this.type=G},bQ=Object.create(null);TG(bQ,"with",{get(){return(G,...Q)=>G(this,...Q)}});F.prototype=bQ;function zQ(G){if(G&&G.s===HQ)return G;throw G}function UQ(G,Q){let X=Q!==void 0?Q:0,Y=G.code;if(typeof Y!=="object")return"Encountered unexpected async transform or refine. Use parseAsyncOrThrow operation instead";switch(Y.TAG){case"OperationFailed":return Y._0;case"InvalidOperation":return Y.description;case"InvalidType":let Z=Y.unionErrors,J="Expected "+j(Y.expected)+", received "+eG(Y.received);if(Z!==void 0){let H=`
4
4
  `+" ".repeat(X<<1),q={};for(let U=0,z=Z.length;U<z;++U){let K=Z[U],D=UQ(K,X+1),B=K.path,w="- "+(B===""?"":"At "+B+": ")+D;if(!q[w])q[w]=1,J=J+H+w}}return J;case"UnsupportedTransformation":return"Unsupported transformation from "+j(Y.from)+" to "+j(Y.to);case"ExcessField":return'Unrecognized key "'+Y._0+'"';case"InvalidJsonSchema":return j(Y._0)+" is not valid JSON"}}function LX(G){let Q=G.flag,X="Failed ";if(Q&2)X=X+"async ";if(X=X+(Q&1?Q&4?"asserting":"parsing":"converting"),Q&8)X=X+" to JSON"+(Q&16?" string":"");let Y=G.path,Z=Y===""?"":" at "+Y;return X+Z+": "+UQ(G,void 0)}var f={m:LX,d:void 0,a:"strip",n:!1},hG="as",VY={get:(G,Q)=>{let X=G[hG];if(X===void 0)return G[Q];if(Q===hG)return G[Q];let Y=qG(X),Z="Schema S."+Y+" is not enabled. To start using it, add S.enable"+OY(Y)+"() at the project root.";throw Error("[Sury] "+Z)}};function PX(G){let Q=new F("never");return Q[hG]=G,new Proxy(Q,VY)}var ZG=new F("unknown"),KQ=new F("boolean"),RX=new F("symbol"),c=new F("string"),yG=new F("number");yG.format="int32";var AG=new F("number"),EX=new F("bigint"),s=new F("undefined");s.const=void 0;var h=(G)=>{let Q=new F(G.type);for(let X in G)if(X>"a"||X==="$ref"||X==="$defs")Q[X]=G[X];return Q};function n(G,Q){let X=h(G),Y=X;while(Y.to){let Z=h(Y.to);Y.to=Z,Y=Z}return Q(Y),X}var yY=(G)=>{for(let Q in G)if(Number(Q[0]))delete G[Q]},SY=BG;function $Y(G,Q,X){return new BG(G,Q,X)}var NX={value:SY,constructor:$Y};function _(G,Q){let X=G.g.e,Y=X.length;return X[Y]=Q,"e["+Y+"]"}function BQ(G,Q){let X=y[Q.type],Y=Q.const;if(X&16)return"void 0";else if(X&2)return YG(Y);else if(X&1024)return Y+"n";else if(X&45056)return _(G,Q.const);else return Y}function UG(G,Q){let X='"'+Q+'"',Y=G.g[X];if(Y!==void 0)return Y;let Z=YG(Q);return G.g[X]=Z,Z}function gY(G){let Q=this;Q.l=Q.l+","+G}function JG(G){let Q=this;Q.l=G,Q.a=gY}function TX(G,Q){let X={c:"",l:"",a:JG,v:-1,o:G,f:"",e:[],d:Q};return X.g=X,X}function DG(G){delete G.a;let Q=G.l;if(Q==="")return G.f+G.c;else return G.f+"let "+Q+";"+G.c}function u(G){let Q=G.v+1;return G.v=Q,"v"+Q}function EG(G){return this.i}function i(G){let Q=this,X=u(G.g),Y=Q.i;if(Y==="")Q.b.a(X);else if(G.a!==void 0)G.a(X+"="+Y);else G.c=G.c+(X+"="+Y+";"),G.g.a(X);return Q.v=EG,Q.i=X,X}function GQ(G,Q){let X=u(G.g);return G.a(X),{b:G,v:EG,i:X,f:0,type:Q.type}}function $(G,Q,X){return{b:G,v:i,i:Q,f:0,type:X.type}}function RG(G,Q){return{b:G,v:i,i:BQ(G,Q),f:0,type:Q.type,const:Q.const}}function lG(G,Q){return{b:G,v:i,i:Q,f:2,type:"unknown"}}function fY(G,Q){return G+":"+Q+","}function bY(G,Q){return Q+","}function $G(G,Q){return{b:G,v:i,i:"",f:0,type:Q?"array":"object",properties:{},additionalItems:"strict",j:Q?bY:fY,c:0,r:""}}function _G(G,Q,X){let Y=UG(G.b,Q);if(G.properties[Q]=X,X.f&2)G.r=G.r+X.i+",",G.i=G.i+G.j(Y,"a["+G.c+++"]");else G.i=G.i+G.j(Y,X.i)}function dY(G,Q){let X=Object.keys(Q.properties);for(let Y=0,Z=X.length;Y<Z;++Y){let J=X[Y];_G(G,J,Q.properties[J])}}function gG(G,Q){if(G.i=Q?"["+G.i+"]":"{"+G.i+"}",G.c)G.f=G.f|2,G.i="Promise.all(["+G.r+"]).then(a=>("+G.i+"))";return G.additionalItems="strict",G}function dQ(G,Q,X,Y){return Q.v(G)+"["+X+"]="+Y.i}function JX(G,Q,X){if(Q===X)return"";let Y=Q.v(G),Z=Q.f&2,J=X.f&2;if(Z){if(!J)return Y+"=Promise.resolve("+X.i+")"}else if(J)return Q.f=Q.f|2,Y+"="+X.i;return Y+"="+X.i}function fG(G,Q,X){let Y=Q.properties,Z=Y[X];if(Z!==void 0)return Z;let J=Q.additionalItems,H;if(J==="strip"||J==="strict"){if(J==="strip")throw Error("[Sury] The schema doesn't have additional items");throw Error("[Sury] The schema doesn't have additional items")}else H=J;let q={b:G,v:i,i:Q.v(G)+("["+YG(X)+"]"),f:0,type:H.type};return Y[X]=q,q}function lY(G,Q,X){return Q.v(G)+"="+X}function kX(G,Q){return{b:Q.b,v:i,i:G+"("+Q.i+")",f:0,type:"unknown"}}function OG(G,Q,X){throw new BG(Q,G.g.o,X)}function CQ(G,Q,X){if(Q.f&2)return lG(Q.b,Q.i+".then("+_(G,X)+")");else return kX(_(G,X),Q)}function QG(G,Q,X,Y){return _(G,(Z)=>OG(G,X(Z),Q))+"("+Y+")"}function S(G,Q,X){return _(G,()=>OG(G,{TAG:"OperationFailed",_0:Q},X))+"()"}function FQ(G,Q,X){return{schema:Q,fail:(Y,Z)=>{return OG(G,{TAG:"OperationFailed",_0:Y},X+(Z!==void 0?Z:""))}}}function tG(G,Q,X){return OG(G,{TAG:"InvalidOperation",description:X},Q)}function sG(G,Q,X,Y,Z,J){if(X===""&&Y===void 0)return J(G,Q,X);try{let H=(E,N)=>{E.c=N+".path="+YG(X)+"+"+(Y!==void 0?`'["'+`+Y+`+'"]'+`:"")+N+".path"},q=(E)=>J(E,Q,""),U=G.c;G.c="";let z=u(G.g),K=H(G,z),D="if("+(z+"&&"+z+".s===s")+"){"+G.c;G.c="";let B={c:"",l:"",a:JG,f:"",g:G.g},W=q(B);G.c=G.c+DG(B);let w=W.i===Q.i&&G.c==="";if(Z!==void 0)Z(G,W);if(w)return W;let L=W.f&2,R=Q===W?Q:Z!==void 0?W:{b:G,v:i,i:"",f:L?2:0,type:"unknown"},P=K!==void 0?(E)=>D+(E===1?"return "+K.i:JX(G,R,K))+("}else{throw "+z+"}"):(E)=>D+"}throw "+z;return G.c=U+("try{"+G.c+(L?lY(G,R,W.i+".catch("+z+"=>{"+P(1)+"})"):JX(G,R,W))+"}catch("+z+"){"+P(0)+"}"),R}catch(H){let q=zQ(H);throw new BG(q.code,q.flag,X+"[]"+q.path)}}function SG(G,Q,X,Y){let Z=Y?"!==":"===",J=Y?"||":"&&",H=Y?"!":"",q=X.type,U=y[q];if(U&2048)return H+("Number.isNaN("+Q+")");if(b in X)return Q+Z+BQ(G,X);if(U&4)return"typeof "+Q+Z+'"'+q+'"';if(U&64)return"typeof "+Q+Z+'"'+q+'"'+J+H+Q;if(U&128)return H+"Array.isArray("+Q+")";if(!(U&8192))return"typeof "+Q+Z+'"'+q+'"';let z=Q+" instanceof "+_(G,X.class);if(Y)return"!("+z+")";else return z}function oG(G,Q,X,Y){let Z=Y?"!==":"===",J=Y?"||":"&&",H=Y?"":"!",q=Y?">":"<",U=Y?"<":">",z=X.type,K,D=0;if(X.const!==void 0)return"";let W=X.format;if(W!==void 0)switch(W){case"int32":return J+Q+q+"2147483647"+J+Q+U+"-2147483648"+J+Q+"%1"+Z+"0";case"port":case"json":D=2;break}else D=2;if(D===2)switch(z){case"number":if(f.n)return"";else return J+H+"Number.isNaN("+Q+")";case"array":case"object":K=z;break;default:return""}let{additionalItems:w,items:L}=X,R=L.length,P=K==="array"?w==="strip"||w==="strict"?w==="strip"?J+Q+".length"+U+R:J+Q+".length"+Z+R:"":w==="strip"?"":J+H+"Array.isArray("+Q+")";for(let E=0,N=L.length;E<N;++E){let M=L[E],C=M.location,T=M.schema,k;if(b in T||X.unnest){let A=UG(G,C);k=SG(G,Q+("["+A+"]"),T,Y)}else if(T.items){let A=UG(G,C),I=Q+("["+A+"]");k=SG(G,I,T,Y)+oG(G,I,T,Y)}else k="";if(k!=="")P=P+J+k}return P}function MX(G,Q,X){let Y={b:G,v:Q.v,i:Q.i,f:Q.f,type:X.type},Z=(J,H)=>{if(b in H)J.const=H.const;let q=H.items;if(q===void 0)return;let U={};q.forEach((z)=>{let K=z.schema,D=b in K;if(!(D||K.items))return;let B;if(D)B=BQ(G,K);else{let w=UG(G,z.location);B=J.v(G)+("["+w+"]")}let W={b:J.b,v:i,i:B,f:0,type:K.type};Z(W,K),U[z.location]=W}),J.properties=U,J.additionalItems=ZG};return Z(Y,X),Y}function _Q(G,Q,X,Y){if(Q.noValidation||y[Q.type]&17153)return"";let Z=X.v(G);return"if("+SG(G,Z,Q,!0)+oG(G,Z,Q,!0)+"){"+QG(G,Y,(J)=>({TAG:"InvalidType",expected:Q,received:J}),Z)+"}"}function DQ(G,Q,X,Y){return OG(G,{TAG:"UnsupportedTransformation",from:Q,to:X},Y)}function uY(G){return G}function CX(G,Q){G[Q==="union"||Q==="ref"?"unknown":Q]=!0}var LG="JSON",GG=PX("jsonString");function IQ(G,Q){return $(G,'""+'+Q.i,c)}function d(G,Q,X,Y){let Z={c:"",l:"",a:JG,f:"",g:G.g};if(Q.$defs)Z.g.d=Q.$defs;let J=X,H=b in J,q=b in Q,U=J.type===Q.type,z=y[Q.type],K=y[J.type],D=!1;if(!(z&257||Q.format==="json")){if(Q.name===LG&&!(K&1)){if(!(K&14))if(K&1024)J=IQ(Z,J);else D=!0}else if(q)if(H){if(J.const!==Q.const)J=RG(Z,Q)}else if(K&2&&z&3132){let w=J.v(Z);Z.f=Q.noValidation?"":J.i+'==="'+Q.const+'"||'+QG(Z,Y,(L)=>({TAG:"InvalidType",expected:Q,received:L}),w)+";",J=RG(Z,Q)}else if(Q.noValidation)J=RG(Z,Q);else Z.f=_Q(G,Q,J,Y),J.type=Q.type,J.const=Q.const;else if(H&&!q){if(!U)if(z&2&&K&3132){let w=""+J.const;J={b:Z,v:i,i:'"'+w+'"',f:0,type:"string",const:w}}else D=!0}else if(K&1){let w=Q.$ref;if(w!==void 0){let L=Z.g.d,R=w.slice(8),P=L[R],E=Q.noValidation?(Z.g.o|1)^1:Z.g.o,N=P[E],M;if(N!==void 0){let C=qG(N);M=C===0?_(Z,P)+("["+E+"]"):_(Z,C)}else{P[E]=0;let C=AX(P,E,Z.g.d);P[E]=C,M=_(Z,C)}J=sG(Z,J,Y,void 0,void 0,(C,T,k)=>{let A=kX(M,T);if(P.isAsync===void 0){let I=JQ(L);I[R]=ZG,pY(P,I)}if(P.isAsync)A.f=A.f|2;return A}),J.v(Z)}else{if(Z.g.o&1)Z.f=_Q(G,Q,J,Y);let L=MX(Z,J,Q);if(J.type=L.type,J.i=L.i,J.v=L.v,J.additionalItems=L.additionalItems,J.properties=L.properties,b in L)J.const=L.const}}else if(z&2&&K&1036)J=IQ(Z,J);else if(!U)if(K&2){let w=J.v(Z);if(z&8){let L=GQ(Z,Q);Z.c=Z.c+("("+L.i+"="+w+'==="true")||'+w+'==="false"||'+QG(Z,Y,(R)=>({TAG:"InvalidType",expected:Q,received:R}),w)+";"),J=L}else if(z&4){let L=$(Z,"+"+w,Q),R=L.v(Z),P=Q.format;Z.c=Z.c+(P!==void 0?"("+oG(Z,R,Q,!0).slice(2)+")":"Number.isNaN("+R+")")+("&&"+QG(Z,Y,(E)=>({TAG:"InvalidType",expected:Q,received:E}),w)+";"),J=L}else if(z&1024){let L=GQ(Z,Q);Z.c=Z.c+("try{"+L.i+"=BigInt("+w+")}catch(_){"+QG(Z,Y,(R)=>({TAG:"InvalidType",expected:Q,received:R}),w)+"}"),J=L}else D=!0}else if(K&4&&z&1024)J=$(Z,"BigInt("+J.i+")",Q);else D=!0}if(D)DQ(Z,J,Q,Y);let B=Q.compiler;if(B!==void 0)J=B(Z,J,Q,Y);if(J.t!==!0){let w=Q.refiner;if(w!==void 0)Z.c=Z.c+w(Z,J.v(Z),Q,Y)}let W=Q.to;if(W!==void 0){let w=Q.parser;if(w!==void 0)J=w(Z,J,Q,Y);if(J.t!==!0)J=d(Z,W,J,Y)}return G.c=G.c+DG(Z),J}function KG(G){while(!0){let Q=G,X=Q.to;if(X===void 0)return Q;G=X;continue}}function PG(G,Q,X,Y){let Z=y[G.type];if(Z&48129||Z&16&&Q.type!=="object")throw new BG({TAG:"InvalidJsonSchema",_0:Q},Y,X);if(Z&256){G.anyOf.forEach((q)=>PG(q,Q,X,Y));return}if(!(Z&192))return;let J=G.additionalItems;if(J==="strip"||J==="strict");else PG(J,Q,X,Y);let H=G.properties;if(H!==void 0){let q=Object.keys(H);for(let U=0,z=q.length;U<z;++U){let K=q[U];PG(H[K],Q,X,Y)}return}G.items.forEach((q)=>PG(q.schema,G,X+("["+YG(q.location)+"]"),Y))}function XG(G){let Q,X=G;while(X){let Y=h(X),Z=Y.to,J=Q;if(J!==void 0)Y.to=J;else delete Y.to;let{parser:H,serializer:q}=Y;if(q!==void 0)Y.parser=q;else delete Y.parser;if(H!==void 0)Y.serializer=H;else delete Y.serializer;let{fromDefault:U,default:z}=Y;if(z!==void 0)Y.fromDefault=z;else delete Y.fromDefault;if(U!==void 0)Y.default=U;else delete Y.default;let K=Y.items;if(K!==void 0){let W={},w=Array(K.length);for(let R=0,P=K.length;R<P;++R){let E=K[R],N=XG(E.schema),M=E.location,C={schema:N,location:M};if(E.r)C.r=E.r;W[E.location]=N,w[R]=C}if(Y.items=w,Y.properties!==void 0)Y.properties=W}if(typeof Y.additionalItems==="object")Y.additionalItems=XG(Y.additionalItems);let D=Y.anyOf;if(D!==void 0){let W={},w=[];for(let L=0,R=D.length;L<R;++L){let P=D[L],E=XG(P);w.push(E),CX(W,E.type)}Y.has=W,Y.anyOf=w}let B=Y.$defs;if(B!==void 0){let W={};for(let w=0,L=Object.keys(B).length;w<L;++w){let R=Object.keys(B)[w];W[R]=XG(B[R])}Y.$defs=W}Q=Y,X=Z}return Q}function AX(G,Q,X){let Y=TX(Q,X);if(Q&8){let B=XG(G);PG(B,B,"",Q)}let Z={b:Y,v:EG,i:"i",f:0,type:"unknown"},J=Q&4?n(G,(B)=>{let W=new F(s.type);W.const=s.const,W.noValidation=!0,B.to=W}):Q&16?n(G,(B)=>{B.to=GG}):G,H=d(Y,J,Z,""),q=DG(Y),U=wX(H.f,2);if(J.isAsync=U,q===""&&H===Z&&!(Q&2))return uY;let z=H.i;if(Q&2&&!U&&!X)z="Promise.resolve("+z+")";let K="i=>{"+q+"return "+z+"}",D=Y.g.e;return Function("e","s","return "+K)(D,HQ)}function pY(G,Q){try{let X=TX(2,Q),Z=d(X,G,{b:X,v:EG,i:"i",f:0,type:"unknown"},""),J=wX(Z.f,2);return G.isAsync=J,J}catch(X){return zQ(X),!1}}function o(G,Q){if(Q in G)return G[Q];let X=AX(Q&32?XG(G):G,Q,0);return G[Q]=X,X}TG(bQ,"~standard",{get:function(){let G=this;return{version:1,vendor:fQ,validate:(Q)=>{try{return{value:o(G,1)(Q)}}catch(X){let Y=zQ(X);return{issues:[{message:UQ(Y,void 0),path:Y.path===""?void 0:WX(Y.path)}]}}}}}});function FX(G,Q,X,Y,Z){let J=Z!==void 0?Z:!0,H=0,q=0;switch(X){case"Output":case"Input":q=1;break;case"Assert":H=H|4;break;case"Json":H=H|8;break;case"JsonString":H=H|24;break}if(q===1&&X===Q)throw Error("[Sury] Can't compile operation to converting value to self");if(Y!=="Sync")H=H|2;if(J)H=H|1;if(Q==="Output")H=H|32;let U=o(G,H);if(Q!=="JsonString")return U;let z=H;return(K)=>{try{return U(JSON.parse(K))}catch(D){throw new BG({TAG:"OperationFailed",_0:D.message},z,"")}}}function WQ(G,Q){return o(Q,1)(G)}function _X(G,Q){let X;try{X=JSON.parse(G)}catch(Y){throw new BG({TAG:"OperationFailed",_0:Y.message},1,"")}return WQ(X,Q)}function IX(G,Q){return o(Q,3)(G)}function vX(G,Q){return o(Q,0)(G)}function OX(G,Q){return o(Q,8)(G)}function jX(G,Q){return o(Q,24)(G)}function xX(G,Q){return o(Q,32)(G)}function lQ(G,Q){return o(Q,40)(G)}function VX(G,Q,X){let Y=X!==void 0?X:0;return JSON.stringify(lQ(G,Q),null,Y)}function wG(G,Q){return o(Q,5)(G)}var wQ=new F("null");wQ.const=null;function IG(G){if(G===null)return wQ;let Q=typeof G,X;if(Q==="object"){let Y=new F("instance");Y.class=G.constructor,X=Y}else X=Q==="undefined"?s:Q==="number"?Number.isNaN(G)?new F("nan"):new F(Q):new F(Q);return X.const=G,X}function vQ(G){if(G&&G.s===HQ)return{success:!1,error:G};throw G}function yX(G){try{return{success:!0,value:G()}}catch(Q){return vQ(Q)}}function SX(G){try{return G().then((Q)=>({success:!0,value:Q}),vQ)}catch(Q){return Promise.resolve(vQ(Q))}}function uQ(G,Q,X){let Y=h(G);return Y[Q]=X,Y}var pQ="#/$defs/";function $X(G,Q){let X=pQ+G,Y=new F("ref");Y.$ref=X,Y.name=G;let Z=f.d;if(!Z)f.d={};let J=Q(Y);if(J.name)Y.name=J.name;else J.name=G;if(f.d[G]=J,Z)return Y;let H=new F("ref");return H.name=J.name,H.$ref=X,H.$defs=f.d,f.d=void 0,H}function gX(G,Q){let X=h(G);return X.noValidation=Q,X}function fX(G,Q){if(G!==void 0)return(X,Y,Z,J)=>G(X,Y,Z,J)+Q(X,Y,Z,J);else return Q}function rQ(G,Q){return n(G,(X)=>{X.refiner=fX(X.refiner,Q)})}function rG(G,Q){return rQ(G,(X,Y,Z,J)=>_(X,Q(FQ(X,Z,J)))+"("+Y+");")}function g(G,Q,X,Y){let Z=G[Q];return rQ(uQ(G,Q,Z!==void 0?Z.concat(X):[X]),Y)}function LQ(G,Q){return n(G,(X)=>{X.parser=(Z,J,H,q)=>{let U=Q(FQ(Z,H,q)),z=U.p;if(z!==void 0)if(U.a!==void 0)return tG(Z,q,"The S.transform doesn't allow parser and asyncParser at the same time. Remove parser in favor of asyncParser");else return CQ(Z,J,z);let K=U.a;if(K!==void 0){if(!(Z.g.o&2))OG(Z,"UnexpectedAsync","");let D=CQ(Z,J,K);return D.f=D.f|2,D}else if(U.s!==void 0)return tG(Z,q,"The S.transform parser is missing");else return J};let Y=new F("unknown");X.to=(Y.serializer=(Z,J,H,q)=>{let U=Q(FQ(Z,H,q)),z=U.s;if(z!==void 0)return CQ(Z,J,z);else if(U.a!==void 0||U.p!==void 0)return tG(Z,q,"The S.transform serializer is missing");else return J},Y),delete X.isAsync})}var PQ=new F("null");PQ.const=null;PQ.to=s;function OQ(G,Q,X,Y){return G.c=G.c+QG(G,Y,(Z)=>({TAG:"InvalidType",expected:X,received:Z}),Q.i)+";",Q}var RQ=new F("never");RQ.compiler=OQ;var FG="BS_PRIVATE_NESTED_SOME_NONE";function AQ(G,Q,X,Y,Z,J){try{let H=G.g.o;if(Z)G.g.o=H|1;let q={c:"",l:"",a:JG,f:"",g:G.g},U=Z?JQ(X):MX(q,X,Q),z=d(q,Q,U,J);if(z!==U){if(z.b=q,z.f&2)Y.f=Y.f|2;q.c=q.c+(Y.v(G)+"="+z.i)}return G.g.o=H,DG(q)}catch(H){return"throw "+_(G,zQ(H))}}function HX(G,Q){if(G&8320&&"object"in Q)return!0;else if(G&2048)return"number"in Q;else return!1}function rY(G,Q){return Q.every((X,Y)=>{let Z=G[Y];if(Z!==void 0&&!(y[X.type]&9152)&&X.type===Z.type)return X.const===Z.const;else return!1})}function bX(G,Q,X,Y){let Z=X.anyOf,J=Q.anyOf;if(J!==void 0)if(rY(Z,J))return Q;else return DQ(G,Q,X,Y);let H=(T)=>_(G,function(){let k=arguments;return OG(G,{TAG:"InvalidType",expected:X,received:k[0],unionErrors:k.length>1?Array.from(k).slice(1):void 0},Y)})+"("+Q.v(G)+T+")",q=G.g.o&1,U=Q.i,z=-1,K=Z.length-1|0,D={},B=[];for(let T=0;T<=K;++T){let k=X.to,A=k!==void 0&&!X.parser&&k.type!=="union"?n(Z[T],(p)=>{let V=X.refiner;if(V!==void 0)p.refiner=fX(p.refiner,V);p.to=k}):Z[T],I=A.type,x=y[I];if(!(x&16&&("fromDefault"in X)))if(x&17153||!(y[Q.type]&1)&&Q.type!==I)z=T,D={},B=[];else{let p=x&8192?A.class.name:I,V=D[p];if(V!==void 0){if(x&64&&FG in A.properties)V.unshift(A);else if(!(x&2096))V.push(A)}else{if(HX(x,D))B.unshift(p);else B.push(p);D[p]=[A]}}}let W=z,w=D,L=B,R="",P="",E="",N=!1;if(W!==-1){for(let T=0;T<=W;++T)if(!N){let k=Z[T],A=AQ(G,k,Q,Q,!0,Y);if(A){let I="e"+T;R=R+("try{"+A+"}catch("+I+"){"),P="}"+P,E=E+","+I}else N=!0}}if(!N){let T=!1,k="";for(let A=0,I=L.length;A<I;++A){let x=w[L[A]],p=x.length>1,V=x[0],WG=0,kG;if(p){let l=Q.v(G),O="",uG="",HG=!1,a={contents:""},mG="",jG={},MG=0,TQ=x.length-1|0;while(MG<=TQ){let r=x[MG],t=(b in r?SG(G,l,r,!1):"")+oG(G,l,r,!1).slice(2),xG=AQ(G,r,Q,Q,!1,Y);if(t)if(xG){let e=jG[t];if(e!==void 0)if(typeof e==="string")jG[t]=[e,xG];else e.push(xG);else jG[t]=xG}else a.contents=a.contents?a.contents+"||"+t:t;if(!t||MG===TQ){let e=Object.keys(jG);for(let iG=0,CY=e.length;iG<CY;++iG){let YX=e[iG];O=O+(HG?"else if":"if")+("("+YX+"){");let pG=jG[YX];if(typeof pG==="string")O=O+pG+"}";else{let kQ="";for(let aG=0,AY=pG.length;aG<AY;++aG){let FY=pG[aG],ZX="e"+aG;O=O+("try{"+FY+"}catch("+ZX+"){"),kQ=kQ+","+ZX}O=O+H(kQ)+"}".repeat(pG.length)+"}"}HG=!0}jG={}}if(!t)if(xG){if(a.contents)O=O+(HG?"else if":"if")+("(!("+a.contents+")){"),uG="}"+uG,a.contents="",HG=!1;let e="e"+MG;O=O+((HG?"else{":"")+"try{"+xG+"}catch("+e+"){"),uG=(HG?"}":"")+"}"+uG,mG=mG+","+e,HG=!1}else a.contents="",MG=TQ;MG=MG+1}if(WG=(r)=>SG(G,r,{type:V.type,parser:0},!1),a.contents)if(O){if(q)O=O+(HG?"else if":"if")+("(!("+a.contents+")){"+H(mG)+"}")}else{let r=WG;WG=(t)=>r(t)+("&&("+a.contents+")")}else if(q&&O){let r=H(mG);O=O+(HG?"else{"+r+"}":r)}kG=O+uG}else WG=(l)=>SG(G,l,V,!1)+oG(G,l,V,!1),kG=AQ(G,V,Q,Q,!1,Y);if(kG||HX(y[V.type],w))R=R+(T?"else if":"if")+("("+WG(Q.v(G))+"){"+kG+"}"),T=!0;else if(q){let l=WG(Q.v(G));k=k?k+"||"+l:l}}if(q||W===K){let A=H(E),I;if(k)I=(T?"else if":"if")+("(!("+k+")){"+A+"}");else I=T?"else{"+A+"}":A;R=R+I}}G.c=G.c+R+P;let M=Q.f&2?lG(G,"Promise.resolve("+Q.i+")"):Q.v===EG?G.c===""&&Q.b.c===""&&(Q.b.l===Q.i+"="+U||U==="i")?(Q.b.l="",Q.b.a=JG,Q.v=i,Q.i=U,Q):JQ(Q):Q;M.anyOf=X.anyOf;let C=X.to;return M.type=C!==void 0&&C.type!=="union"?(M.t=!0,KG(C).type):"union",M}function zG(G){let Q=G.length;if(Q===1)return G[0];if(Q!==0){let X={},Y=new Set;for(let J=0,H=G.length;J<H;++J){let q=G[J];if(q.type==="union"&&q.to===void 0)q.anyOf.forEach((U)=>{Y.add(U)}),Object.assign(X,q.has);else Y.add(q),CX(X,q.type)}let Z=new F("union");return Z.anyOf=Array.from(Y),Z.compiler=bX,Z.has=X,Z}throw Error("[Sury] S.union requires at least one item")}function hY(){let G=IG(0),Q={schema:G,location:FG},X={};return X[FG]=G,{type:"object",serializer:(Y,Z,J,H)=>RG(Y,J.to),additionalItems:"strip",items:[Q],properties:X}}function oY(G,Q,X,Y){return $(G,"{"+FG+":"+KG(X).items[0].schema.const+"}",X.to)}function qX(G){return n(G,(Q)=>{Q.to=hY(),Q.parser=oY})}function EQ(G,Q){let X=Q!==void 0?Q:s,Y=KG(G);switch(Y.type){case"undefined":return zG([X,qX(G)]);case"union":let{has:J,anyOf:H}=Y;return n(G,(q)=>{let U=JQ(J),z=[];for(let K=0,D=H.length;K<D;++K){let B=H[K],W=KG(B),w=W.type,L;if(w==="undefined")U[X.type]=!0,z.push(X),L=qX(B);else{let R=W.properties;if(R!==void 0){let P=R[FG];L=P!==void 0?n(B,(E)=>{let N={type:P.type,parser:P.parser,const:P.const+1},M={schema:N,location:FG},C={};C[FG]=N,E.items=[M],E.properties=C}):B}else L=B}z.push(L)}if(z.length===H.length)U[X.type]=!0,z.push(X);q.anyOf=z,q.has=U});default:return zG([G,X])}}function vG(G,Q){return n(G,(X)=>{let Y=X.anyOf;if(Y!==void 0){let Z,J;for(let K=0,D=Y.length;K<D;++K){let B=Y[K],W=KG(B);if(W.type!=="undefined"){if(Z!==void 0){let R="Can't set default for "+j(X);throw Error("[Sury] "+R)}Z=B,J=W}}let H=Z,q;if(H!==void 0)q=H;else{let K="Can't set default for "+j(X);throw Error("[Sury] "+K)}X.parser=(K,D,B,W)=>{let w=(N,M)=>{let C=M.v(N),T;return T=Q.TAG==="Value"?BQ(N,IG(Q._0)):_(N,Q._0)+"()",$(N,C+"===void 0?"+T+":"+C,B.to)};if(!(D.f&2))return w(K,D);let L={c:"",l:"",a:JG,f:"",g:K.g},R={b:K,v:EG,i:u(L.g),f:0,type:"unknown"},P=w(L,R),E=DG(L);return lG(D.b,D.i+".then("+R.v(K)+"=>{"+E+"return "+P.i+"})")};let U=h(J),z=U.compiler;if(z!==void 0)U.serializer=z,delete U.compiler;else U.serializer=(K,D,B,W)=>D;if(X.to=U,Q.TAG!=="Value")return;try{X.default=o(q,32)(Q._0);return}catch(K){return}}else{let Z="Can't set default for "+j(X);throw Error("[Sury] "+Z)}})}var NQ="m:Array.refinements";function cY(G){let Q=G[NQ];if(Q!==void 0)return Q;else return[]}function sY(G,Q,X,Y){let Z=X.additionalItems,J=Q.v(G),H=u(G.g),q={c:"",l:"",a:JG,f:"",g:G.g},U=$(q,J+"["+H+"]",ZG),z=sG(q,U,Y,H,void 0,(W,w,L)=>d(W,Z,w,L)),K=DG(q),D=U!==z,B=D?$(G,"new Array("+J+".length)",X):Q;if(B.type=X.type,B.additionalItems=X.additionalItems,D||K!=="")G.c=G.c+("for(let "+H+"=0;"+H+"<"+J+".length;++"+H+"){"+K+(D?dQ(G,B,H,z):"")+"}");if(z.f&2)return lG(B.b,"Promise.all("+B.i+")");else return B}function cG(G){let Q=new F("array");return Q.additionalItems=G,Q.items=gQ,Q.compiler=sY,Q}function nG(G,Q,X){let Y=G.additionalItems;if(Y===void 0)return G;let Z=G.items;if(Y===Q||typeof Y==="object")return G;let J=h(G);if(J.additionalItems=Q,X){let H=[],q={};for(let U=0,z=Z.length;U<z;++U){let K=Z[U],D=nG(K.schema,Q,X),B=D===K.schema?K:{schema:D,location:K.location};q[K.location]=D,H.push(B)}J.items=H,J.properties=q}return J}function dX(G){return nG(G,"strip",!1)}function lX(G){return nG(G,"strip",!0)}function QQ(G){return nG(G,"strict",!1)}function uX(G){return nG(G,"strict",!0)}function nY(G,Q,X,Y){let Z=X.additionalItems,J=Q.v(G),H=u(G.g),q={c:"",l:"",a:JG,f:"",g:G.g},U=$(q,J+"["+H+"]",ZG),z=sG(q,U,Y,H,void 0,(E,N,M)=>d(E,Z,N,M)),K=DG(q),D=U!==z,B=D?$(G,"{}",X):Q;if(B.type=X.type,B.additionalItems=X.additionalItems,D||K!=="")G.c=G.c+("for(let "+H+" in "+J+"){"+K+(D?dQ(G,B,H,z):"")+"}");if(!(z.f&2))return B;let W=u(G.g),w=u(G.g),L=u(G.g),R=u(G.g),P=B.v(G);return lG(G,"new Promise(("+W+","+w+")=>{let "+R+"=Object.keys("+P+").length;for(let "+H+" in "+P+"){"+P+"["+H+"].then("+L+"=>{"+P+"["+H+"]="+L+";if("+R+"--===1){"+W+"("+P+")}},"+w+")}})")}function XQ(G){let Q=new F("object");return Q.properties=DX,Q.items=gQ,Q.additionalItems=G,Q.compiler=nY,Q}var m="m:String.refinements";function mY(G){let Q=G[m];if(Q!==void 0)return Q;else return[]}var iY=/^c[^\s-]{8,}$/i,aY=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,tY=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eY=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,v=PX("json");function pX(){if(!v[hG])return;delete v.as;let G=new F("ref");G.$ref=pQ+LG,G.name=LG,v.type=G.type,v.$ref=G.$ref,v.name=LG;let Q={};Q[LG]={type:"union",compiler:bX,name:LG,has:{string:!0,boolean:!0,number:!0,null:!0,object:!0,array:!0},anyOf:[c,KQ,AG,wQ,XQ(G),cG(G)]},v.$defs=Q}function zX(G,Q,X,Y){let Z=y[Q.type],J=Q.const;if(Z&48)return'"null"';else if(Z&2)return JSON.stringify(YG(J));else if(Z&1024)return'"\\"'+J+'\\""';else if(Z&12)return'"'+J+'"';else return DQ(G,Q,X,Y)}function rX(){if(GG[hG]){delete GG.as,GG.type="string",GG.format="json",GG.name=LG+" string",GG.compiler=(G,Q,X,Y)=>{let Z=y[Q.type],J=Q;if(Z&1){let H=X.to;if(H&&b in H){let q=J.v(G);G.f=q+"==="+zX(G,H,X,Y)+"||"+QG(G,Y,(U)=>({TAG:"InvalidType",expected:H,received:U}),q)+";",J=RG(G,H)}else if(!(H&&H.format==="json")){let q=J.v(G),U=G.g.o&1;if(U)G.f=_Q(G,c,J,Y);if(H||U){let z;if(H){PG(H,H,Y,G.g.o);let K=GQ(G,ZG);J=K,z=K.i+"="}else z="";G.c=G.c+("try{"+z+"JSON.parse("+q+")}catch(t){"+QG(G,Y,(K)=>({TAG:"InvalidType",expected:X,received:K}),q)+"}")}}}else{if(b in J)J=$(G,zX(G,J,X,Y),c);else if(Z&2){if(J.format!=="json")J=$(G,"JSON.stringify("+J.i+")",c)}else if(Z&12)J=IQ(G,J);else if(Z&1024)J=$(G,'"\\""+'+J.i+'+"\\""',c);else if(Z&192){PG(J,J,Y,G.g.o);let H=X.space;J=$(G,"JSON.stringify("+J.i+(H!==void 0&&H!==0?",null,"+H:"")+")",c)}else DQ(G,J,X,Y);J.format="json"}return J};return}}function hX(G){let Q=h(GG);return Q.space=G,Q}var hQ="m:Int.refinements";function GZ(G){let Q=G[hQ];if(Q!==void 0)return Q;else return[]}var oQ="m:Float.refinements";function QZ(G){let Q=G[oQ];if(Q!==void 0)return Q;else return[]}function oX(G,Q){if(G===Q)return G;else return n(G,(X)=>{X.to=Q})}function cX(G){let Q=new F("instance");return Q.class=G,Q}function cQ(G,Q){let X=h(G),Y=Q.name;if(Y!==void 0)if(Y==="")X.name=void 0;else X.name=Y;let Z=Q.title;if(Z!==void 0)if(Z==="")X.title=void 0;else X.title=Z;let J=Q.description;if(J!==void 0)if(J==="")X.description=void 0;else X.description=J;let H=Q.deprecated;if(H!==void 0)X.deprecated=H;let q=Q.examples;if(q!==void 0)if(q.length!==0)X.examples=q.map(o(G,32));else X.examples=void 0;return X}function sX(G,Q){let X=h(G);return X.name=Q,X}function nX(G){switch(G.k){case 0:return"["+YG(G.location)+"]";case 1:return nX(G.of)+G.p;case 2:return G.p}}function sQ(G,Q,X,Y){if(b in Y)return RG(G,Y);let Z=Q[qQ];if(Z!==void 0)return X(Z);let J=y[Y.type]&128,H=$G(G,J);return Y.items.forEach((q)=>_G(H,q.location,sQ(G,Q[q.location],X,q.schema))),gG(H,J)}function nQ(G,Q,X,Y,Z){if(!(Y.type==="object"&&Y.additionalItems==="strict"&&G.g.o&1))return;let H=GQ(G,ZG).i;if(G.c=G.c+("for("+H+" in "+Q.v(G)+"){if("),X.length!==0)for(let q=0,U=X.length;q<U;++q){let z=X[q];if(q!==0)G.c=G.c+"&&";G.c=G.c+(H+"!=="+UG(G,z.location))}else G.c=G.c+"true";G.c=G.c+("){"+QG(G,Z,(q)=>({TAG:"ExcessField",_0:q}),H)+"}}")}function bG(G){return new Proxy(DX,{get:(Q,X)=>{if(X===qQ)return G;let Y=YG(X),Z=KG(G.schema),J=Z.items,H=Z.properties,q;if(H!==void 0)q=H[X];else if(J!==void 0){let U=J[X];q=U!==void 0?U.schema:void 0}else q=void 0;if(q===void 0){let U="Cannot read property "+Y+" of "+j(Z);throw Error("[Sury] "+U)}return bG({k:1,location:X,schema:q,of:G,p:"["+Y+"]"})}})}function YQ(G,Q,X,Y){let{additionalItems:Z,items:J}=X,H=y[X.type]&128;if(G.g.o&64){let U=$G(G,H);for(let z=0,K=J.length;z<K;++z){let B=J[z].location;_G(U,B,Q.properties[B])}return gG(U,H)}let q=$G(G,H);for(let U=0,z=J.length;U<z;++U){let K=J[U],D=K.location,B=fG(G,Q,D),W=UG(G,D),w=Y+("["+W+"]");_G(q,D,d(G,K.schema,B,w))}if(nQ(G,Q,J,X,Y),(Z!=="strip"||G.g.o&32)&&J.every((U)=>q.properties[U.location]===Q.properties[U.location]))return Q.additionalItems="strip",Q;else return gG(q,H)}function mX(G){let Q=this,X="~"+G,Y=Q[X];if(Y!==void 0)return qG(Y);let Z={},J=[],H=new F("object");H.items=J,H.properties=Z,H.additionalItems=f.a,H.compiler=YQ;let q=Q.f(G,H)[qQ],U=(W,w)=>{let L=YG(W);if(W in Z)throw Error("[Sury] "+("The field "+L+" defined twice"));let R="["+L+"]",P={k:1,location:W,schema:w,of:q,p:R};return Z[W]=w,J.push(P),bG(P)},B={field:U,f:U,fieldOr:(W,w,L)=>{let R=EQ(w,void 0);return U(W,vG(R,{TAG:"Value",_0:L}))},tag:(W,w)=>{U(W,NG(w))},nested:mX,flatten:(W)=>{if(W.type==="object"){let{to:R,items:P}=W;if(R){let N="Unsupported nested flatten for transformed object schema "+j(W);throw Error("[Sury] "+N)}let E={};for(let N=0,M=P.length;N<M;++N){let C=P[N];E[C.location]=U(C.location,C.schema)}return E}let L="Can't flatten "+j(W)+" schema";throw Error("[Sury] "+L)}};return Q[X]=B,B}function NG(G){if(typeof G!=="object"||G===null)return IG(G);if(G["~standard"])return G;if(Array.isArray(G)){for(let q=0,U=G.length;q<U;++q){let z=NG(G[q]),K=q.toString();G[q]={schema:z,location:K}}let H=new F("array");return H.items=G,H.additionalItems="strict",H.compiler=YQ,H}let Q=G.constructor;if(Q&&Q!==Object)return{type:"instance",const:G,class:Q};let X=Object.keys(G),Y=X.length,Z=[];for(let H=0;H<Y;++H){let q=X[H],U=NG(G[q]),z={schema:U,location:q};G[q]=U,Z[H]=z}let J=new F("object");return J.items=Z,J.properties=G,J.additionalItems=f.a,J.compiler=YQ,J}function jQ(G,Q,X){if(typeof G!=="object"||G===null)return{k:1,p:Q,s:h(IG(G))};let Y=G[qQ];if(Y!==void 0){let U=h(KG(Y.schema));delete U.serializer;let z={k:0,p:Q,s:U};return Y.r=z,X[nX(Y)]=z,z}if(Array.isArray(G)){let U=[];for(let K=0,D=G.length;K<D;++K){let B=K.toString(),W='"'+B+'"',R={schema:jQ(G[K],Q+("["+W+"]"),X).s,location:B};U[K]=R}let z=new F("array");return{k:2,p:Q,s:(z.items=U,z.additionalItems="strict",z.serializer=OQ,z)}}let Z=Object.keys(G),J={},H=[];for(let U=0,z=Z.length;U<z;++U){let K=Z[U],D=YG(K),W=jQ(G[K],Q+("["+D+"]"),X).s,w={schema:W,location:K};H[U]=w,J[K]=W}let q=new F("object");return{k:2,p:Q,s:(q.items=H,q.properties=J,q.additionalItems=f.a,q.serializer=OQ,q)}}function mQ(G,Q,X){let Y={},J=jQ(G,"",Y).s;return delete J.refiner,delete J.compiler,J.serializer=(H,q,U,z)=>{let K=(P)=>{let E=P.p;if(E==="")return q;let N=q,M=WX(E);while(!0){let C=M,T=N;if(C.length===0)return T;let k=C[0];M=C.slice(1),N=fG(H,T,k);continue}},D=(P,E)=>{let N=KG(P);if(b in N)return RG(H,N);if(b in P)return d(H,P,RG(H,P),z);let{type:M,additionalItems:C,items:T}=N;if(T!==void 0&&typeof C==="string"){let A=y[M]&128,I=$G(H,A);for(let x=0,p=T.length;x<p;++x){let V=T[x],WG=UG(H,V.location),kG=E+("["+WG+"]"),l=Y[kG],O=l!==void 0?d(H,V.schema,K(l),l.p):D(V.schema,kG);_G(I,V.location,O)}return gG(I,A)}let k=E===""?"Schema isn't registered":"Schema for "+E+" isn't registered";return tG(H,z,k)},B=(P,E,N)=>{let M=P.r;if(M===void 0)return D(P.schema,E);let C=N?XG(P.schema):E===""?KG(P.schema):P.schema,T=K(M),k=z+M.p;return d(H,C,T,k)};if(Q!==void 0)return B(Q,"",!1);let W=U.to;nQ(H,q,U.items,U,z);let w=W.type==="array",L=W.items,R=$G(H,w);if(X!==void 0)for(let P=0,E=X.length;P<E;++P)dY(R,B(X[P],"",!0));for(let P=0,E=L.length;P<E;++P){let N=L[P];if(!(N.location in R.properties)){let M=UG(H,N.location);_G(R,N.location,B(N,"["+M+"]",!1))}}return gG(R,w)},J}function iX(G,Q){return(X,Y,Z,J)=>{let H=X.g.o&64,q=H?Y.properties:{};if(!H){let z=Z.items;for(let K=0,D=z.length;K<D;++K){let B=z[K],W=B.location,w=fG(X,Y,W),L=UG(X,W),R=J+("["+L+"]");q[W]=d(X,B.schema,w,R)}nQ(X,Y,z,Z,J)}if(Q!==void 0){let z=X.g.o;X.g.o=z|64;for(let K=0,D=Q.length;K<D;++K){let B=Q[K];q[B.i]=d(X,B.schema,Y,J)}X.g.o=z}let U=(z)=>{switch(z.k){case 0:return q[z.location];case 1:return fG(X,U(z.of),z.location);case 2:return q[z.i]}};return sQ(X,G,U,Z.to)}}function aX(G,Q){return n(G,(X)=>{let Y={k:2,schema:G,p:"",i:0},Z=Q(bG(Y));X.parser=(J,H,q,U)=>{let z=(K)=>{switch(K.k){case 1:return fG(J,z(K.of),K.location);case 0:case 2:return H}};return sQ(J,Z,z,q.to)},X.to=mQ(Z,Y,void 0)})}function ZQ(G){let Q=void 0,X=[],Y={},Z=(D)=>{if(D.type==="object"){let w=D.items;for(let E=0,N=w.length;E<N;++E){let M=w[E],C=M.location,T=M.schema,k=Y[C];if(k!==void 0){if(k!==T)throw Error("[Sury] "+('The field "'+C+'" defined twice with incompatible schemas'))}else{let A={k:0,schema:T,location:C};X.push(A),Y[C]=T}}let L=Q||(Q=[]),R=L.length,P={k:2,schema:D,p:"",i:R};return L.push(P),bG(P)}let W="The '"+j(D)+"' schema can't be flattened";throw Error("[Sury] "+W)},J=(D,B)=>{if(D in Y)throw Error("[Sury] "+('The field "'+D+'" defined twice with incompatible schemas'));let W={k:0,schema:B,location:D};return Y[D]=B,X.push(W),bG(W)},z=G({field:J,f:J,fieldOr:(D,B,W)=>{let w=EQ(B,void 0);return J(D,vG(w,{TAG:"Value",_0:W}))},tag:(D,B)=>{J(D,NG(B))},nested:mX,flatten:Z}),K=new F("object");return K.items=X,K.properties=Y,K.additionalItems=f.a,K.parser=iX(z,Q),K.to=mQ(z,void 0,Q),K}function iQ(G){let Q=[],X=(q,U)=>{let z=q.toString();if(Q[q])throw Error("[Sury] "+("The item ["+z+"] is defined multiple times"));let K={k:0,schema:U,location:z};return Q[q]=K,bG(K)},J=G({item:X,tag:(q,U)=>{X(q,NG(U))}});for(let q=0,U=Q.length;q<U;++q)if(!Q[q]){let z=q.toString(),K={schema:s,location:z};Q[q]=K}let H=new F("array");return H.items=Q,H.additionalItems="strict",H.parser=iX(J,void 0),H.to=mQ(J,void 0,void 0),H}function XZ(G){return EQ(G,PQ)}var aQ=NG;function YZ(G,Q,X,Y){let Z=X.additionalItems,J=Z.items,H=Q.v(G),q=u(G.g),U=u(G.g),z={c:"",l:"",a:JG,f:"",g:G.g},K={b:z,v:EG,i:H+"["+q+"]",f:0,type:"unknown"},D=sG(z,K,Y,q,(W,w)=>{let L="",R="";for(let P=0,E=J.length;P<E;++P){let N=J[P];L=L+("new Array("+H+".length),"),R=R+(U+"["+P+"]["+q+"]="+fG(G,w,N.location).i+";")}G.a(U+"=["+L+"]"),W.c=W.c+R},(W,w,L)=>d(W,Z,w,L)),B=DG(z);if(G.c=G.c+("for(let "+q+"=0;"+q+"<"+H+".length;++"+q+"){"+B+"}"),D.f&2)return{b:G,v:i,i:"Promise.all("+U+")",f:2,type:"array"};else return{b:G,v:EG,i:U,f:0,type:"array"}}function tX(G){if(G.type==="object"){let Q=G.items;if(Q.length===0)throw Error("[Sury] Invalid empty object for S.unnest schema.");let X=new F("array");X.items=Q.map((Z,J)=>{let H=J.toString();return{schema:cG(Z.schema),location:H}}),X.additionalItems="strict",X.parser=(Z,J,H,q)=>{let U=J.v(Z),z=u(Z.g),K={c:"",l:"",a:JG,f:"",g:Z.g},D=$G(K,!1),B="";for(let P=0,E=Q.length;P<E;++P){let N=Q[P];_G(D,N.location,$(K,U+"["+P+"]["+z+"]",ZG)),B=B+(U+"["+P+"].length,")}let W=$(Z,"new Array(Math.max("+B+"))",H.to),w=W.v(Z),L=sG(K,gG(D,!1),q,z,(P,E)=>{P.c=P.c+dQ(P,W,z,E)+";"},(P,E,N)=>d(P,G,E,N)),R=DG(K);if(Z.c=Z.c+("for(let "+z+"=0;"+z+"<"+w+".length;++"+z+"){"+R+"}"),L.f&2)return lG(W.b,"Promise.all("+W.i+")");else return W};let Y=new F("array");return Y.items=gQ,Y.additionalItems=G,Y.serializer=YZ,X.unnest=!0,X.to=Y,X}throw Error("[Sury] S.unnest supports only object schemas.")}function UX(G){return EQ(G,s)}function xQ(G,Q,X){let Y=X!==void 0?X:"Number must be greater than or equal to "+Q;return g(G,hQ,{kind:{TAG:"Min",value:Q},message:Y},(Z,J,H,q)=>"if("+J+"<"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function VQ(G,Q,X){let Y=X!==void 0?X:"Number must be lower than or equal to "+Q;return g(G,hQ,{kind:{TAG:"Max",value:Q},message:Y},(Z,J,H,q)=>"if("+J+">"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function eX(G,Q){let X=rQ(G,(Y,Z,J,H)=>Z+">0&&"+Z+"<65536&&"+Z+"%1===0||"+(Q!==void 0?S(Y,Q,H):QG(Y,H,(q)=>({TAG:"InvalidType",expected:J,received:q}),Z))+";");return X.format="port",XG(X).format="port",X}function yQ(G,Q,X){let Y=X!==void 0?X:"Number must be greater than or equal to "+Q;return g(G,oQ,{kind:{TAG:"Min",value:Q},message:Y},(Z,J,H,q)=>"if("+J+"<"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function SQ(G,Q,X){let Y=X!==void 0?X:"Number must be lower than or equal to "+Q;return g(G,oQ,{kind:{TAG:"Max",value:Q},message:Y},(Z,J,H,q)=>"if("+J+">"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function GY(G,Q,X){let Y=X!==void 0?X:"Array must be "+Q+" or more items long";return g(G,NQ,{kind:{TAG:"Min",length:Q},message:Y},(Z,J,H,q)=>"if("+J+".length<"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function QY(G,Q,X){let Y=X!==void 0?X:"Array must be "+Q+" or fewer items long";return g(G,NQ,{kind:{TAG:"Max",length:Q},message:Y},(Z,J,H,q)=>"if("+J+".length>"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function XY(G,Q,X){let Y=X!==void 0?X:"String must be "+Q+" or more characters long";return g(G,m,{kind:{TAG:"Min",length:Q},message:Y},(Z,J,H,q)=>"if("+J+".length<"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function YY(G,Q,X){let Y=X!==void 0?X:"String must be "+Q+" or fewer characters long";return g(G,m,{kind:{TAG:"Max",length:Q},message:Y},(Z,J,H,q)=>"if("+J+".length>"+_(Z,Q)+"){"+S(Z,Y,q)+"}")}function tQ(G,Q){let X=Q!==void 0?Q:"Invalid email address";return g(G,m,{kind:"Email",message:X},(Y,Z,J,H)=>"if(!"+_(Y,tY)+".test("+Z+")){"+S(Y,X,H)+"}")}function eQ(G,Q){let X=Q!==void 0?Q:"Invalid UUID";return g(G,m,{kind:"Uuid",message:X},(Y,Z,J,H)=>"if(!"+_(Y,aY)+".test("+Z+")){"+S(Y,X,H)+"}")}function ZY(G,Q){let X=Q!==void 0?Q:"Invalid CUID";return g(G,m,{kind:"Cuid",message:X},(Y,Z,J,H)=>"if(!"+_(Y,iY)+".test("+Z+")){"+S(Y,X,H)+"}")}function GX(G,Q){let X=Q!==void 0?Q:"Invalid url";return g(G,m,{kind:"Url",message:X},(Y,Z,J,H)=>"try{new URL("+Z+")}catch(_){"+S(Y,X,H)+"}")}function QX(G,Q,X){let Y=X!==void 0?X:"Invalid";return g(G,m,{kind:{TAG:"Pattern",re:Q},message:Y},(Z,J,H,q)=>(Q.global?_(Z,Q)+".lastIndex=0;":"")+("if(!"+_(Z,Q)+".test("+J+")){"+S(Z,Y,q)+"}"))}function XX(G,Q){let X=Q!==void 0?Q:"Invalid datetime string! Expected UTC",Y={kind:"Datetime",message:X},Z=G[m];return LQ(uQ(G,m,Z!==void 0?Z.concat(Y):[Y]),(J)=>({p:(H)=>{if(!eY.test(H))J.fail(X,void 0);return new Date(H)},s:(H)=>H.toISOString()}))}function JY(G){let Q=(X)=>X.trim();return LQ(G,(X)=>({p:Q,s:Q}))}function HY(G){return zG([G,s,wQ])}function qY(G){return zG(G.map(NG))}function zY(G,Q,X){return LQ(G,(Y)=>({p:Q!==void 0?(Z)=>Q(Z,Y):void 0,s:X!==void 0?(Z)=>X(Z,Y):void 0}))}function UY(G,Q){return rG(G,(X)=>(Y)=>Q(Y,X))}function ZZ(G){return G}function KY(G,Q){return LQ(G,(X)=>({a:(Y)=>Q(Y,X).then(()=>Y),s:ZZ}))}function BY(G,Q){let X=zG([G,s]);if(Q===void 0)return X;let Y=qG(Q);if(typeof Y==="function")return vG(X,{TAG:"Callback",_0:Y});else return vG(X,{TAG:"Value",_0:Y})}function DY(G,Q){let X=zG([G,PQ]);if(Q===void 0)return X;let Y=qG(Q);if(typeof Y==="function")return vG(X,{TAG:"Callback",_0:Y});else return vG(X,{TAG:"Value",_0:Y})}function WY(G,Q){let X;if(G.type==="object"&&Q.type==="object"){let Y=G.additionalItems;if(typeof Y==="string"&&typeof Q.additionalItems==="string"&&!G.to&&!Q.to){let Z=Q.items,J=G.items,H={},q=[],U=[];for(let K=0,D=J.length;K<D;++K){let B=J[K];q.push(B.location),H[B.location]=B.schema}for(let K=0,D=Z.length;K<D;++K){let B=Z[K];if(!(B.location in H))q.push(B.location);H[B.location]=B.schema}for(let K=0,D=q.length;K<D;++K){let B=q[K];U.push({schema:H[B],location:B})}let z=new F("object");z.items=U,z.properties=H,z.additionalItems=Y,z.compiler=YQ,X=z}else X=void 0}else X=void 0;if(X!==void 0)return X;throw Error("[Sury] The merge supports only structured object schemas without transformations")}function wY(G){let Q=G.defaultAdditionalItems;f.a=Q!==void 0?Q:"strip";let X=f.n,Y=G.disableNanNumberValidation;if(f.n=Y!==void 0?Y:!1,X!==f.n)return yY(AG)}var $Q="m:JSONSchema";function CG(G,Q){let X={};switch(G.type){case"never":X.not={};break;case"unknown":break;case"string":let z=G.const;if(X.type="string",mY(G).forEach((T)=>{let k=T.kind;if(typeof k!=="object")switch(k){case"Email":X.format="email";return;case"Uuid":X.format="uuid";return;case"Cuid":return;case"Url":X.format="uri";return;case"Datetime":X.format="date-time";return}else switch(k.TAG){case"Min":X.minLength=k.length;return;case"Max":X.maxLength=k.length;return;case"Length":let A=k.length;X.minLength=A,X.maxLength=A;return;case"Pattern":X.pattern=String(k.re);return}}),z!==void 0)X.const=z;break;case"number":let{format:K,const:D}=G;if(K!==void 0)if(K==="int32")X.type="integer",GZ(G).forEach((T)=>{let k=T.kind;if(k.TAG==="Min")X.minimum=k.value;else X.maximum=k.value});else X.type="integer",X.maximum=65535,X.minimum=0;else X.type="number",QZ(G).forEach((T)=>{let k=T.kind;if(k.TAG==="Min")X.minimum=k.value;else X.maximum=k.value});if(D!==void 0)X.const=D;break;case"boolean":let B=G.const;if(X.type="boolean",B!==void 0)X.const=B;break;case"null":X.type="null";break;case"array":let W=G.additionalItems,w=0;if(W==="strip"||W==="strict")w=1;else X.items=CG(W,Q),X.type="array",cY(G).forEach((T)=>{let k=T.kind;switch(k.TAG){case"Min":X.minItems=k.length;return;case"Max":X.maxItems=k.length;return;case"Length":let A=k.length;X.maxItems=A,X.minItems=A;return}});if(w===1){let T=G.items.map((A)=>CG(A.schema,Q)),k=T.length;X.items=BX(T),X.type="array",X.minItems=k,X.maxItems=k}break;case"object":let L=G.additionalItems,R=0;if(L==="strip"||L==="strict")R=1;else X.type="object",X.additionalProperties=CG(L,Q);if(R===1){let T={},k=[];G.items.forEach((I)=>{let x=CG(I.schema,Q);if(!xY(I.schema))k.push(I.location);T[I.location]=x}),X.type="object",X.properties=T;let A;if(A=L==="strip"||L==="strict"?L==="strip":!0,X.additionalProperties=A,k.length!==0)X.required=k}break;case"union":let P=[],E=[];G.anyOf.forEach((T)=>{if(T.type==="undefined")return;if(E.push(CG(T,Q)),b in T){P.push(T.const);return}});let N=E.length,M=G.default;if(M!==void 0)X.default=qG(M);if(N===1)Object.assign(X,E[0]);else if(P.length===N)X.enum=P;else X.anyOf=E;break;case"ref":let C=G.$ref;if(C===pQ+LG);else X.$ref=C;break;default:throw Error("[Sury] Unexpected schema type")}let Y=G.description;if(Y!==void 0)X.description=Y;let Z=G.title;if(Z!==void 0)X.title=Z;let J=G.deprecated;if(J!==void 0)X.deprecated=J;let H=G.examples;if(H!==void 0)X.examples=H;let q=G.$defs;if(q!==void 0)Object.assign(Q,q);let U=G[$Q];if(U!==void 0)Object.assign(X,U);return X}function LY(G){PG(G,G,"",8);let Q={},X=CG(G,Q);delete Q.JSON;let Y=Object.keys(Q);if(Y.length)Y.forEach((Z)=>{Q[Z]=CG(Q[Z],0)}),X.$defs=Q;return X}function PY(G,Q){let X=G[$Q];return uQ(G,$Q,X!==void 0?Object.assign({},X,Q):Q)}var JZ=IG;function KX(G){let Q=G.minimum,X;if(Q!==void 0)X=xQ(yG,Q|0,void 0);else{let J=G.exclusiveMinimum;X=J!==void 0?xQ(yG,J+1|0,void 0):yG}let Y=G.maximum;if(Y!==void 0)return VQ(X,Y|0,void 0);let Z=G.exclusiveMinimum;if(Z!==void 0)return VQ(X,Z-1|0,void 0);else return X}function HZ(G){if(typeof G!=="object")return;else return G.default}function VG(G){let Q=(H)=>{if(typeof H!=="object")if(H===!1)return RQ;else return v;else return VG(H)},X=G.type,Y,Z=0,J=0;if(G.nullable)Y=XZ(VG(Object.assign({},G,{nullable:!1})));else if(X!==void 0){let H=qG(X);if(H==="object"){let q=G.properties;if(q!==void 0){let U=ZQ((K)=>{let D={};return Object.keys(q).forEach((B)=>{let W=q[B],w=Q(W),L=G.required,R,P=0;if(L!==void 0&&L.includes(B))R=w;else P=1;if(P===1){let E=HZ(W);if(E!==void 0){let N=UX(w);R=vG(N,{TAG:"Value",_0:E})}else R=UX(w)}D[B]=K.f(B,R)}),D});Y=G.additionalProperties===!1?QQ(U):U}else{let U=G.additionalProperties;Y=U!==void 0?typeof U!=="object"?U===!1?QQ(ZQ((z)=>{})):XQ(v):XQ(VG(U)):NG()}}else if(H==="array"){let q=G.items,U;if(q!==void 0){let B=IY.classify(qG(q));if(B.TAG==="Single")U=cG(Q(B._0));else{let W=B._0;U=iQ((w)=>W.map((L,R)=>w.item(R,Q(L))))}}else U=cG(v);let z=G.minItems,K=z!==void 0?GY(U,z,void 0):U,D=G.maxItems;Y=D!==void 0?QY(K,D,void 0):K}else J=2}else J=2;if(J===2){let{enum:H,allOf:q,anyOf:U}=G;if(U!==void 0){let z=U.length;Y=z!==1?z!==0?zG(U.map(Q)):v:Q(U[0])}else if(q!==void 0){let z=q.length;Y=z!==1?z!==0?rG(v,(K)=>(D)=>{q.forEach((B)=>{try{return wG(D,Q(B))}catch(W){return K.fail("Should pass for all schemas of the allOf property.",void 0)}})}):v:Q(q[0])}else{let z=G.oneOf;if(z!==void 0){let K=z.length;Y=K!==1?K!==0?rG(v,(D)=>(B)=>{let W={contents:!1};if(z.forEach((w)=>{let L;try{wG(B,Q(w)),L=!0}catch(R){L=!1}if(L){if(W.contents)D.fail("Should pass single schema according to the oneOf property.",void 0);W.contents=!0;return}}),!W.contents)return D.fail("Should pass at least one schema according to the oneOf property.",void 0)}):v:Q(z[0])}else{let K=G.not;if(K!==void 0)Y=rG(v,(D)=>(B)=>{let W;try{wG(B,Q(K)),W=!0}catch(w){W=!1}if(W)return D.fail("Should NOT be valid against schema in the not property.",void 0)});else if(H!==void 0){let D=H.length;Y=D!==1?D!==0?zG(H.map(JZ)):v:IG(H[0])}else{let D=G.const;if(D!==void 0)Y=IG(D);else if(X!==void 0){let B=qG(X),W=0,w=0;if(Array.isArray(B))Y=zG(B.map((L)=>VG(Object.assign({},G,{type:BX(L)}))));else if(B==="string"){let L=G.pattern,R=L!==void 0?QX(c,new RegExp(L),void 0):c,P=G.minLength,E=P!==void 0?XY(R,P,void 0):R,N=G.maxLength,M=N!==void 0?YY(E,N,void 0):E;switch(G.format){case"date-time":Y=XX(M,void 0);break;case"email":Y=tQ(M,void 0);break;case"uri":Y=GX(M,void 0);break;case"uuid":Y=eQ(M,void 0);break;default:Y=M}}else if(B==="integer"||G.format==="int64"&&B==="number")Y=KX(G);else w=4;if(w===4)if(G.multipleOf!==1||B!=="number")W=3;else Y=KX(G);if(W===3)if(B==="number"){let L=G.minimum,R;if(L!==void 0)R=yQ(AG,L,void 0);else{let E=G.exclusiveMinimum;R=E!==void 0?yQ(AG,E+1,void 0):AG}let P=G.maximum;if(P!==void 0)Y=SQ(R,P,void 0);else{let E=G.exclusiveMinimum;Y=E!==void 0?SQ(R,E-1,void 0):R}}else if(B==="boolean")Y=KQ;else if(B==="null")Y=aQ(null);else Z=1}else Z=1}}}}if(Z===1){let H=G.if;if(H!==void 0){let q=G.then;if(q!==void 0){let U=G.else;if(U!==void 0){let z=Q(H),K=Q(q),D=Q(U);Y=rG(v,(B)=>(W)=>{let w;try{wG(W,z),w=!0}catch(L){w=!1}if(w)return wG(W,K);else return wG(W,D)})}else Y=v}else Y=v}else Y=v}if(G.description===void 0&&G.deprecated===void 0&&G.examples===void 0&&G.title===void 0)return Y;return cQ(Y,{title:G.title,description:G.description,deprecated:G.deprecated,examples:G.examples})}function RY(G,Q,X){switch(G.type){case"string":return XY(G,Q,X);case"number":if(G.format!==void 0)return xQ(G,Q,X);else return yQ(G,Q,X);case"array":return GY(G,Q,X);default:let Y="S.min is not supported for "+j(G)+" schema. Coerce the schema to string, number or array using S.to first.";throw Error("[Sury] "+Y)}}function EY(G,Q,X){switch(G.type){case"string":return YY(G,Q,X);case"number":if(G.format!==void 0)return VQ(G,Q,X);else return SQ(G,Q,X);case"array":return QY(G,Q,X);default:let Y="S.max is not supported for "+j(G)+" schema. Coerce the schema to string, number or array using S.to first.";throw Error("[Sury] "+Y)}}function NY(G,Q,X){switch(G.type){case"string":let Y=X!==void 0?X:"String must be exactly "+Q+" characters long";return g(G,m,{kind:{TAG:"Length",length:Q},message:Y},(H,q,U,z)=>"if("+q+".length!=="+_(H,Q)+"){"+S(H,Y,z)+"}");case"array":let Z=X!==void 0?X:"Array must be exactly "+Q+" items long";return g(G,NQ,{kind:{TAG:"Length",length:Q},message:Z},(H,q,U,z)=>"if("+q+".length!=="+_(H,Q)+"){"+S(H,Z,z)+"}");default:let J="S.length is not supported for "+j(G)+" schema. Coerce the schema to string or array using S.to first.";throw Error("[Sury] "+J)}}var TY=cG,kY=XQ;var MY=WQ;var UZ=NX.value,KZ=c,BZ=KQ,DZ=yG,WZ=AG,wZ=EX,LZ=RX,PZ=v,RZ=RQ,EZ=ZG,NZ=ZG,TZ=BY,kZ=DY,MZ=HY,CZ=TY,AZ=cX,FZ=tX,_Z=kY,IZ=GG,vZ=hX,OZ=qY,jZ=ZQ,xZ=aQ,VZ=yX,yZ=SX,SZ=XG,$Z=vX,gZ=OX,fZ=jX,bZ=xX,dZ=lQ,lZ=VX,uZ=WQ,pZ=MY,rZ=_X,hZ=IX,oZ=wG,cZ=$X,sZ=WY,nZ=QQ,mZ=uX,iZ=dX,aZ=lX,tZ=oX,eZ=LY,G0=VG,Q0=PY,X0=aX,Y0=iQ,Z0=KY,J0=UY,H0=zY,q0=cQ,z0=j,U0=gX,K0=FX,B0=eX,D0=RY,W0=EY,w0=NY,L0=tQ,P0=eQ,R0=ZY,E0=GX,N0=QX,T0=XX,k0=JY,M0=pX,C0=rX,A0=wY,F0=sX;export{s as void,P0 as uuid,E0 as url,FZ as unnest,EZ as unknown,OZ as union,Y0 as tuple,k0 as trim,H0 as transform,eZ as toJSONSchema,z0 as toExpression,tZ as to,LZ as symbol,iZ as strip,KZ as string,nZ as strict,X0 as shape,xZ as schema,yZ as safeAsync,VZ as safe,lZ as reverseConvertToJsonStringOrThrow,dZ as reverseConvertToJsonOrThrow,bZ as reverseConvertOrThrow,SZ as reverse,J0 as refine,cZ as recursive,_Z as record,B0 as port,N0 as pattern,uZ as parseOrThrow,rZ as parseJsonStringOrThrow,pZ as parseJsonOrThrow,hZ as parseAsyncOrThrow,TZ as optional,jZ as object,WZ as number,MZ as nullish,kZ as nullable,U0 as noValidation,RZ as never,D0 as min,q0 as meta,sZ as merge,W0 as max,w0 as length,vZ as jsonStringWithSpace,IZ as jsonString,PZ as json,DZ as int32,AZ as instance,A0 as global,G0 as fromJSONSchema,Q0 as extendJSONSchema,C0 as enableJsonString,M0 as enableJson,L0 as email,aZ as deepStrip,mZ as deepStrict,T0 as datetime,R0 as cuid,fZ as convertToJsonStringOrThrow,gZ as convertToJsonOrThrow,$Z as convertOrThrow,K0 as compile,F0 as brand,BZ as boolean,wZ as bigint,Z0 as asyncParserRefine,oZ as assertOrThrow,CZ as array,NZ as any,UZ as Error};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-7xm75w1e.js";var k="./opentui-drfwd3v7.dll";export{k as default};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{di as I,ei as B,fi as Y,gi as Z,hi as j,ii as F,ji as K,li as U,mi as V,ni as W}from"./chunk-z8v2tsz2.js";var N=class extends F{async evalCodeAsync(b,q="eval.js",D){let w=D===void 0?1:0,G=j(D),$=0;try{$=await this.memory.newHeapCharPointer(b).consume((X)=>this.ffi.QTS_Eval_MaybeAsync(this.ctx.value,X.value.ptr,X.value.strlen,q,w,G))}catch(X){throw this.runtime.debugLog("QTS_Eval_MaybeAsync threw",X),X}let E=this.ffi.QTS_ResolveException(this.ctx.value,$);return E?(this.ffi.QTS_FreeValuePointer(this.ctx.value,$),this.fail(this.memory.heapValueHandle(E))):this.success(this.memory.heapValueHandle($))}newAsyncifiedFunction(b,q){return this.newFunction(b,q)}},O=class extends K{constructor(b){super(b)}newContext(b={}){let q=Z(b.intrinsics),D=new B(this.ffi.QTS_NewContext(this.rt.value,q),void 0,(G)=>{this.contextMap.delete(G),this.callbacks.deleteContext(G),this.ffi.QTS_FreeContext(G)}),w=new N({module:this.module,ctx:D,ffi:this.ffi,rt:this.rt,ownedLifetimes:[],runtime:this,callbacks:this.callbacks});return this.contextMap.set(D.value,w),w}setModuleLoader(b,q){super.setModuleLoader(b,q)}setMaxStackSize(b){return super.setMaxStackSize(b)}},z=class extends W{constructor(b,q){super(b,q);this.ffi=q,this.module=b}newRuntime(b={}){let q=new B(this.ffi.QTS_NewRuntime(),void 0,(w)=>{this.callbacks.deleteRuntime(w),this.ffi.QTS_FreeRuntime(w)}),D=new O({module:this.module,ffi:this.ffi,rt:q,callbacks:this.callbacks});return U(D,b),b.moduleLoader&&D.setModuleLoader(b.moduleLoader),D}newContext(b={}){let q=this.newRuntime(),D=b.ownedLifetimes?b.ownedLifetimes.concat([q]):[q],w=q.newContext({...b,ownedLifetimes:D});return q.context=w,w}evalCode(){throw new I("QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead")}evalCodeAsync(b,q){return Y.withScopeAsync(async(D)=>{let w=D.manage(this.newContext());V(w.runtime,q);let G=await w.evalCodeAsync(b,"eval.js");if(q.memoryLimitBytes!==void 0&&w.runtime.setMemoryLimit(-1),G.error)throw w.dump(D.manage(G.error));return w.dump(D.manage(G.value))})}};
3
- export{z as ci};
2
+ import{ci as I,di as B,ei as Y,fi as Z,gi as j,hi as F,ii as K,ki as U,li as V,mi as W}from"./chunk-7hm0c2yg.js";var N=class extends F{async evalCodeAsync(b,q="eval.js",D){let w=D===void 0?1:0,G=j(D),$=0;try{$=await this.memory.newHeapCharPointer(b).consume((X)=>this.ffi.QTS_Eval_MaybeAsync(this.ctx.value,X.value.ptr,X.value.strlen,q,w,G))}catch(X){throw this.runtime.debugLog("QTS_Eval_MaybeAsync threw",X),X}let E=this.ffi.QTS_ResolveException(this.ctx.value,$);return E?(this.ffi.QTS_FreeValuePointer(this.ctx.value,$),this.fail(this.memory.heapValueHandle(E))):this.success(this.memory.heapValueHandle($))}newAsyncifiedFunction(b,q){return this.newFunction(b,q)}},O=class extends K{constructor(b){super(b)}newContext(b={}){let q=Z(b.intrinsics),D=new B(this.ffi.QTS_NewContext(this.rt.value,q),void 0,(G)=>{this.contextMap.delete(G),this.callbacks.deleteContext(G),this.ffi.QTS_FreeContext(G)}),w=new N({module:this.module,ctx:D,ffi:this.ffi,rt:this.rt,ownedLifetimes:[],runtime:this,callbacks:this.callbacks});return this.contextMap.set(D.value,w),w}setModuleLoader(b,q){super.setModuleLoader(b,q)}setMaxStackSize(b){return super.setMaxStackSize(b)}},z=class extends W{constructor(b,q){super(b,q);this.ffi=q,this.module=b}newRuntime(b={}){let q=new B(this.ffi.QTS_NewRuntime(),void 0,(w)=>{this.callbacks.deleteRuntime(w),this.ffi.QTS_FreeRuntime(w)}),D=new O({module:this.module,ffi:this.ffi,rt:q,callbacks:this.callbacks});return U(D,b),b.moduleLoader&&D.setModuleLoader(b.moduleLoader),D}newContext(b={}){let q=this.newRuntime(),D=b.ownedLifetimes?b.ownedLifetimes.concat([q]):[q],w=q.newContext({...b,ownedLifetimes:D});return q.context=w,w}evalCode(){throw new I("QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead")}evalCodeAsync(b,q){return Y.withScopeAsync(async(D)=>{let w=D.manage(this.newContext());V(w.runtime,q);let G=await w.evalCodeAsync(b,"eval.js");if(q.memoryLimitBytes!==void 0&&w.runtime.setMemoryLimit(-1),G.error)throw w.dump(D.manage(G.error));return w.dump(D.manage(G.value))})}};
3
+ export{z as bi};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Qr as DG}from"./chunk-jm1ptn8n.js";import{Tu as lb}from"./chunk-89v6dgpp.js";import{$P as oI,aQ as jb,dQ as zb}from"./chunk-aztre27e.js";var tI=jb((Q1,pI)=>{var{PassThrough:Db}=zb("stream");pI.exports=function(){var I=[],G=new Db({objectMode:!0});return G.setMaxListeners(0),G.add=b,G.isEmpty=S,G.on("unpipe",$),Array.prototype.slice.call(arguments).forEach(b),G;function b(V){if(Array.isArray(V))return V.forEach(b),this;return I.push(V),V.once("end",$.bind(null,V)),V.once("error",G.emit.bind(G,"error")),V.pipe(G,{end:!1}),this}function S(){return I.length==0}function $(V){if(I=I.filter(function(H){return H!==V}),!I.length&&G.readable)G.end()}}});import zG from"process";var qG=oI(lb(),1);import{Buffer as ab}from"buffer";import ib from"path";import JI from"child_process";import u from"process";function l(I){let G=typeof I==="string"?`
2
+ import{qq as DG}from"./chunk-15hw2z9t.js";import{tt as lb}from"./chunk-ag8kz1e7.js";import{BO as oI,CO as jb,FO as zb}from"./chunk-7xm75w1e.js";var tI=jb((Q1,pI)=>{var{PassThrough:Db}=zb("stream");pI.exports=function(){var I=[],G=new Db({objectMode:!0});return G.setMaxListeners(0),G.add=b,G.isEmpty=S,G.on("unpipe",$),Array.prototype.slice.call(arguments).forEach(b),G;function b(V){if(Array.isArray(V))return V.forEach(b),this;return I.push(V),V.once("end",$.bind(null,V)),V.once("error",G.emit.bind(G,"error")),V.pipe(G,{end:!1}),this}function S(){return I.length==0}function $(V){if(I=I.filter(function(H){return H!==V}),!I.length&&G.readable)G.end()}}});import zG from"process";var qG=oI(lb(),1);import{Buffer as ab}from"buffer";import ib from"path";import JI from"child_process";import u from"process";function l(I){let G=typeof I==="string"?`
3
3
  `:`
4
4
  `.charCodeAt(),b=typeof I==="string"?"\r":"\r".charCodeAt();if(I[I.length-1]===G)I=I.slice(0,-1);if(I[I.length-1]===b)I=I.slice(0,-1);return I}import B from"process";import A from"path";import{fileURLToPath as yI}from"url";function O(I={}){let{env:G=process.env,platform:b=process.platform}=I;if(b!=="win32")return"PATH";return Object.keys(G).reverse().find((S)=>S.toUpperCase()==="PATH")||"Path"}var EG=({cwd:I=B.cwd(),path:G=B.env[O()],preferLocal:b=!0,execPath:S=B.execPath,addExecPath:$=!0}={})=>{let V=I instanceof URL?yI(I):I,H=A.resolve(V),U=[];if(b)OG(U,H);if($)BG(U,S,H);return[...U,G].join(A.delimiter)},OG=(I,G)=>{let b;while(b!==G)I.push(A.join(G,"node_modules/.bin")),b=G,G=A.resolve(G,"..")},BG=(I,G,b)=>{let S=G instanceof URL?yI(G):G;I.push(A.resolve(b,S,".."))},TI=({env:I=B.env,...G}={})=>{I={...I};let b=O({env:I});return G.path=I[b],I[b]=EG(G),I};var vG=(I,G,b,S)=>{if(b==="length"||b==="prototype")return;if(b==="arguments"||b==="caller")return;let $=Object.getOwnPropertyDescriptor(I,b),V=Object.getOwnPropertyDescriptor(G,b);if(!PG($,V)&&S)return;Object.defineProperty(I,b,V)},PG=function(I,G){return I===void 0||I.configurable||I.writable===G.writable&&I.enumerable===G.enumerable&&I.configurable===G.configurable&&(I.writable||I.value===G.value)},CG=(I,G)=>{let b=Object.getPrototypeOf(G);if(b===Object.getPrototypeOf(I))return;Object.setPrototypeOf(I,b)},wG=(I,G)=>`/* Wrapped ${I}*/
5
5
  ${G}`,xG=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),kG=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),cG=(I,G,b)=>{let S=b===""?"":`with ${b.trim()}() `,$=wG.bind(null,S,G.toString());Object.defineProperty($,"name",kG),Object.defineProperty(I,"toString",{...xG,value:$})};function a(I,G,{ignoreNonConfigurable:b=!1}={}){let{name:S}=I;for(let $ of Reflect.ownKeys(G))vG(I,G,$,b);return CG(I,G),cG(I,G,S),I}var v=new WeakMap,KI=(I,G={})=>{if(typeof I!=="function")throw TypeError("Expected a function");let b,S=0,$=I.displayName||I.name||"<anonymous>",V=function(...H){if(v.set(V,++S),S===1)b=I.apply(this,H),I=null;else if(G.throw===!0)throw Error(`Function \`${$}\` can only be called once`);return b};return a(V,I),v.set(V,S),V};KI.callCount=(I)=>{if(!v.has(I))throw Error(`The given function \`${I.name}\` is not wrapped by the \`onetime\` package`);return v.get(I)};var _I=KI;import iG from"process";import{constants as mG}from"os";var LI=()=>{let I=i-jI+1;return Array.from({length:I},fG)},fG=(I,G)=>({name:`SIGRT${G+1}`,number:jI+G,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),jI=34,i=64;import{constants as hG}from"os";var zI=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var p=()=>{let I=LI();return[...zI,...I].map(uG)},uG=({name:I,number:G,description:b,action:S,forced:$=!1,standard:V})=>{let{signals:{[I]:H}}=hG,U=H!==void 0;return{name:I,number:U?H:G,description:b,supported:U,action:S,forced:$,standard:V}};var gG=()=>{let I=p();return Object.fromEntries(I.map(dG))},dG=({name:I,number:G,description:b,supported:S,action:$,forced:V,standard:H})=>[I,{name:I,number:G,description:b,supported:S,action:$,forced:V,standard:H}],DI=gG(),nG=()=>{let I=p(),G=i+1,b=Array.from({length:G},(S,$)=>lG($,I));return Object.assign({},...b)},lG=(I,G)=>{let b=aG(I,G);if(b===void 0)return{};let{name:S,description:$,supported:V,action:H,forced:U,standard:W}=b;return{[I]:{name:S,number:I,description:$,supported:V,action:H,forced:U,standard:W}}},aG=(I,G)=>{let b=G.find(({name:S})=>mG.signals[S]===I);if(b!==void 0)return b;return G.find((S)=>S.number===I)},ES=nG();var pG=({timedOut:I,timeout:G,errorCode:b,signal:S,signalDescription:$,exitCode:V,isCanceled:H})=>{if(I)return`timed out after ${G} milliseconds`;if(H)return"was canceled";if(b!==void 0)return`failed with ${b}`;if(S!==void 0)return`was killed with ${S} (${$})`;if(V!==void 0)return`failed with exit code ${V}`;return"failed"},F=({stdout:I,stderr:G,all:b,error:S,signal:$,exitCode:V,command:H,escapedCommand:U,timedOut:W,isCanceled:Y,killed:q,parsed:{options:{timeout:L,cwd:N=iG.cwd()}}})=>{V=V===null?void 0:V,$=$===null?void 0:$;let Q=$===void 0?void 0:DI[$].description,J=S&&S.code,j=`Command ${pG({timedOut:W,timeout:L,errorCode:J,signal:$,signalDescription:Q,exitCode:V,isCanceled:Y})}: ${H}`,z=Object.prototype.toString.call(S)==="[object Error]",D=z?`${j}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Cf as a}from"./chunk-dryzt12j.js";import"./chunk-ywkvq7zb.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-7xm75w1e.js";export{a as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{yd as a}from"./chunk-j5ymkhry.js";import"./chunk-bzgj60w4.js";import"./chunk-aztre27e.js";export{a as dict};
2
+ import{yd as a}from"./chunk-j5ymkhry.js";import"./chunk-bzgj60w4.js";import"./chunk-7xm75w1e.js";export{a as dict};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-7xm75w1e.js";var _="./libopentui-smaejjb8.so";export{_ as default};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ed as d}from"./chunk-x25zkrz7.js";import{Rd as f}from"./chunk-yajd975f.js";import{Vf as e}from"./chunk-rbk8seme.js";import{gh as l}from"./chunk-caj1b9y7.js";import"./chunk-ygs5pzk7.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{Cl as u,kk as m}from"./chunk-257me4z3.js";import"./chunk-nkkch4h7.js";import"./chunk-s3mnrhbx.js";import"./chunk-ezfy0b6q.js";import"./chunk-bn0h9dny.js";import"./chunk-hnvn2c25.js";import"./chunk-3nx7112w.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-we9cv8we.js";import"./chunk-2hc5z7b5.js";import"./chunk-9gazyynx.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-d9hbhkbq.js";import"./chunk-ad72gb5f.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import"./chunk-xj765svc.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";var v=f({command:"usage [sessionID]",describe:"show per-turn token/cost breakdown for a session (debug/verification tool)",builder:(o)=>{return o.positional("sessionID",{describe:"session ID to inspect (default: most recently updated session)",type:"string"}).option("format",{describe:"output format",type:"string",choices:["table","json"],default:"table"}).option("limit",{describe:"number of most recent turns to show (default: all)",type:"number"})},handler:async(o)=>{await d(process.cwd(),async()=>{let a=o.sessionID?m.make(o.sessionID):[...u.list({roots:!1,limit:1})][0]?.id;if(!a)e.error("No sessions found"),process.exit(1);let p=(await l.runPromise(u.Service.use((s)=>s.messages({sessionID:a,agentID:"*"})))).filter((s)=>s.info.role==="assistant").map((s)=>{let t=s.info,c=s.parts.filter((n)=>n.type==="step-finish");return{messageID:t.id,provider:t.providerID,model:t.modelID,finish:t.finish,cost:t.cost??0,tokens:t.tokens??{input:0,output:0,reasoning:0,cache:{read:0,write:0}},steps:c.map((n)=>({cost:n.cost,tokens:n.tokens}))}}),r=o.limit?p.slice(-o.limit):p;if(r.length===0){e.println("No assistant turns found for this session");return}if(o.format==="json"){console.log(JSON.stringify({sessionID:a,turns:r},null,2));return}e.println(`Session ${a} \u2014 ${r.length} turn(s)`),e.println("");for(let s of r){let t=s.tokens,c=t.input+t.cache.read+t.cache.write,n=t.output+t.reasoning;if(e.println(`${s.messageID} ${s.provider}/${s.model} finish=${s.finish??"-"}`),e.println(` tokens input=${t.input} cache.read=${t.cache.read} cache.write=${t.cache.write} output=${t.output} reasoning=${t.reasoning} (in=${c} out=${n})`),e.println(` cost $${s.cost.toFixed(6)}`),s.steps.length>1)e.println(` steps ${s.steps.length}`),s.steps.forEach((i,g)=>{e.println(` [${g}] input=${i.tokens.input} output=${i.tokens.output} cache.read=${i.tokens.cache.read} cache.write=${i.tokens.cache.write} reasoning=${i.tokens.reasoning} cost=$${i.cost.toFixed(6)}`)});e.println("")}let h=r.reduce((s,t)=>s+t.cost,0);e.println(`Total cost for shown turns: $${h.toFixed(6)}`),e.println("(source: Session.getUsage(), same numbers persisted to the message record \u2014 see session.usage log tag)")})}});export{v as UsageCommand};
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ import{h as x}from"./chunk-zqqx96jx.js";import{j as N}from"./chunk-rvkrgkeq.js";import{H as S}from"./chunk-whe7h2mj.js";import{I as k,J as A}from"./chunk-t9mz17gb.js";import{Rd as P}from"./chunk-yajd975f.js";import{Vf as j}from"./chunk-rbk8seme.js";import{Cg as K,Dg as F,Fg as R,sg as Y,tg as _,ug as O,vg as b,zg as v}from"./chunk-gz8sz7z1.js";import{gh as $}from"./chunk-caj1b9y7.js";import{Xj as D}from"./chunk-257me4z3.js";import{qo as G,vo as W}from"./chunk-we9cv8we.js";import{pH as H}from"./chunk-zs8kqdsf.js";var X="forgewise",p=(J,z=process.env)=>J.trim()||z.QLEX_API_KEY?.trim()||"",U=(J)=>H.gen(function*(){let z=J.trim();if(!z)yield*H.sync(()=>{j.println(j.Style.TEXT_DANGER+"Error: API key cannot be empty."+j.Style.TEXT_NORMAL)}),process.exit(1);yield*(yield*D.Service).set(X,{type:"api",key:z,metadata:{method:"api-key"}}),yield*N(j.Style.TEXT_SUCCESS+"Signed in with API key."+j.Style.TEXT_NORMAL)}).pipe(H.withSpan("forgewise.login.apikey"));async function u(){let J=!O();try{return await K({tryOpen:J,onCode:(z)=>{if(process.stdout.write(`
3
+ `),process.stdout.write(" To sign in, open: "+z.verificationUri+`
4
+ `),process.stdout.write(" and enter code: "+z.userCode+`
5
+ `),z.verificationUriComplete)process.stdout.write(`
6
+ Or open this link directly:
7
+ `+z.verificationUriComplete+`
8
+ `);process.stdout.write(`
9
+ Waiting for approval... (ctrl+c to cancel)
10
+ `)}})}catch(z){if(z instanceof _)return F();throw z}}var I=(J=u)=>H.gen(function*(){let z=yield*H.tryPromise({try:()=>b(),catch:(V)=>V}).pipe(H.catch((V)=>H.succeed(V)));if(z instanceof Error){let V=z;if(V instanceof Y)return yield*H.sync(()=>{j.println(j.Style.TEXT_DANGER+"Error: "+V.message+j.Style.TEXT_NORMAL),process.exit(1)});throw V}let M=yield*H.tryPromise({try:()=>J(),catch:(V)=>V});if(M instanceof Error)yield*H.sync(()=>{j.println(j.Style.TEXT_DANGER+"Login failed: "+M.message+j.Style.TEXT_NORMAL)}),process.exit(1);let T=yield*D.Service,Z=yield*H.promise(()=>R(M.access_token));if(Z)yield*T.set(X,A(M,Z));else yield*T.set(X,k(M,{rotateRefreshToken:!0}));yield*N(j.Style.TEXT_SUCCESS+`Signed in as ${M.name||M.email} (${M.email})`+j.Style.TEXT_NORMAL)}).pipe(H.withSpan("forgewise.login")),l=()=>H.gen(function*(){let J=yield*D.Service;if(!(yield*J.get(X))){yield*H.sync(()=>j.println("Not signed in to Forgewise."));return}yield*J.remove(X),yield*N("Signed out from Forgewise.")}).pipe(H.withSpan("forgewise.logout")),w=(J)=>H.gen(function*(){let z=yield*H.tryPromise({try:()=>v(J),catch:(T)=>T}).pipe(H.map((T)=>({ok:!0,result:T})),H.catch((T)=>H.succeed({ok:!1,error:T})));if(!z.ok&&z.error instanceof W)return j.Style.TEXT_DIM+" | "+j.Style.TEXT_NORMAL+j.Style.TEXT_DIM+"Qredits: no account linked to this credential"+j.Style.TEXT_NORMAL;let M=z.ok?z.result:null;if(M)return j.Style.TEXT_DIM+" | "+j.Style.TEXT_NORMAL+"Qredits: "+j.Style.TEXT_HIGHLIGHT_BOLD+S(M.balance)+j.Style.TEXT_NORMAL;return j.Style.TEXT_DIM+" | "+j.Style.TEXT_NORMAL+j.Style.TEXT_DIM+"Qredits: unavailable"+j.Style.TEXT_NORMAL}),E=()=>H.gen(function*(){if((yield*x())==="revoked")return;let J=yield*H.promise(()=>G());if(!J){yield*H.sync(()=>j.println("Forgewise: Not signed in"));return}let M=yield*(yield*D.Service).get(X),T=(M&&M.type==="api"?M.metadata:void 0)??{};if(J.method==="api-key"){let L=T.email,d=L?`Signed in as ${L} (API key)`:"Signed in with API key",q=Number(T.access_token_expires_at??0),m=q>0&&Date.now()>q?j.Style.TEXT_DIM+" (account session expired \u2014 run `qitqode auth login` to refresh it)"+j.Style.TEXT_NORMAL:"",s=yield*w(J);yield*H.sync(()=>j.println(j.Style.TEXT_SUCCESS+"Forgewise: "+j.Style.TEXT_NORMAL+d+m+s));return}let Z=T.email??"(unknown)",V=T.name??"",y=T.sub,Q=Number(T.expires_at??0),B=Q>0&&Date.now()>Q,h=V?`${V} (${Z})`:Z,g=B?j.Style.TEXT_WARNING+" [token expired \u2014 run `qitqode auth login` to refresh]"+j.Style.TEXT_NORMAL:j.Style.TEXT_DIM+` (expires ${new Date(Q).toLocaleString()})`+j.Style.TEXT_NORMAL,C="";if(!B&&y)C=yield*w({key:J.key,method:"sso"});yield*H.sync(()=>j.println(j.Style.TEXT_SUCCESS+"Forgewise: "+j.Style.TEXT_NORMAL+h+g+C))}).pipe(H.withSpan("forgewise.status")),Mj=P({command:"auth <command>",describe:"Sign in or out of Forgewise",builder:(J)=>J.command(P({command:"login",describe:"Sign in with Forgewise Accounts (opens browser) or a Qortex API key",builder:(z)=>z.option("api-key",{type:"string",describe:"Sign in by pasting a Qortex API key instead of using the browser (defaults to $QLEX_API_KEY when the flag is passed without a value)"}),async handler(z){j.empty();let M=z.apiKey;if(M!==void 0){let T=p(M);await $.runPromise(U(T));return}await $.runPromise(I())}})).command(P({command:"logout",describe:"Sign out from Forgewise",builder:(z)=>z,async handler(){j.empty(),await $.runPromise(l())}})).command(P({command:"status",describe:"Show current Forgewise sign-in status",builder:(z)=>z,async handler(){j.empty(),await $.runPromise(E())}})).demandCommand(),async handler(){}});
11
+ export{p as a,U as b,u as c,I as d,l as e,E as f,Mj as g};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Cd as W$}from"./chunk-5v4py9p2.js";import{Ed as j$}from"./chunk-07g7cybt.js";import{Rd as A$}from"./chunk-yajd975f.js";import{Of as J$}from"./chunk-ezja6njs.js";import{ag as Z$}from"./chunk-yn6sbycg.js";import"./chunk-bpbptx89.js";import"./chunk-2y90ad1v.js";import"./chunk-yzjc15vp.js";import"./chunk-4amgp4yd.js";import"./chunk-nfg7nt13.js";import"./chunk-scnz207s.js";import"./chunk-b8bytvka.js";import{hh as MD}from"./chunk-ddnpx1yx.js";import{Vh as hD}from"./chunk-wfs4pcwa.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import{ql as _$,rl as U,sk as sD,tl as G$,yk as k,zk as P}from"./chunk-pvpy9kq1.js";import"./chunk-wpajh5s5.js";import"./chunk-2ec6ps8r.js";import"./chunk-gj3hzx3d.js";import"./chunk-nj4d554m.js";import"./chunk-2gerf08b.js";import"./chunk-fqw4y7x0.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import{Lp as X$,Op as Y$}from"./chunk-a0v55ywn.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-dcvatax2.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import{yr as f$}from"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-sn4nez18.js";import"./chunk-42f7p0hq.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import{ku as w$,tt as Q$,yu as H}from"./chunk-3szwfy7w.js";import{Su as kD}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import{qv as D}from"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import{bQ as ow}from"./chunk-aztre27e.js";var O={authenticate:"authenticate",initialize:"initialize",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},F={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"};var K$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminal:D.boolean().optional().default(!1)}),B$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),label:D.string().nullish(),name:D.string(),optional:D.boolean().optional().default(!1),secret:D.boolean().optional().default(!0)}),O$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),name:D.string()}),N$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),link:D.string().nullish(),name:D.string(),vars:D.array(B$)}),F$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),description:D.string().nullish(),env:D.record(D.string(),D.string()).optional(),id:D.string(),name:D.string()}),L$=D.union([N$.and(D.object({type:D.literal("env_var")})),F$.and(D.object({type:D.literal("terminal")})),O$]),n=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),methodId:D.string()}),x$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),V$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),blob:D.string(),mimeType:D.string().nullish(),uri:D.string()}),H$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),P$=D.object({amount:D.number(),currency:D.string()}),k$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),T$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),newText:D.string(),oldText:D.string().nullish(),path:D.string()}),vD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),U$=D.union([D.literal(-32700),D.literal(-32600),D.literal(-32601),D.literal(-32602),D.literal(-32603),D.literal(-32800),D.literal(-32000),D.literal(-32002),D.number().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),ID=D.object({code:U$,data:D.unknown().optional(),message:D.string()}),qD=D.unknown(),SD=D.unknown(),RD=D.unknown(),b$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),readTextFile:D.boolean().optional().default(!1),writeTextFile:D.boolean().optional().default(!1)}),h$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),auth:K$.optional().default({terminal:!1}),fs:b$.optional().default({readTextFile:!1,writeTextFile:!1}),terminal:D.boolean().optional().default(!1)}),cD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),uD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),title:D.string().nullish(),version:D.string()}),M$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),t=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cursor:D.string().nullish(),cwd:D.string().nullish()}),C$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),http:D.boolean().optional().default(!1),sse:D.boolean().optional().default(!1)}),E$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),v$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),I$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()),command:D.string(),env:D.array(vD),name:D.string()}),I=D.union([E$.and(D.object({type:D.literal("http")})),v$.and(D.object({type:D.literal("sse")})),I$]),o=D.string(),q$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),modelId:o,name:D.string()}),r=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I)}),gD=D.string(),S$=D.union([D.literal("allow_once"),D.literal("allow_always"),D.literal("reject_once"),D.literal("reject_always")]),R$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),kind:S$,name:D.string(),optionId:gD}),c$=D.union([D.literal("high"),D.literal("medium"),D.literal("low")]),u$=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed")]),g$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),priority:c$,status:u$}),l$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),entries:D.array(g$)}),d$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audio:D.boolean().optional().default(!1),embeddedContext:D.boolean().optional().default(!1),image:D.boolean().optional().default(!1)}),lD=D.number().int().gte(0).lte(65535),z=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),clientCapabilities:h$.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:uD.nullish(),protocolVersion:lD}),i$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string()}),m$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),T=D.union([D.number(),D.string()]).nullable(),sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),requestId:T}),p$=D.enum(["assistant","user"]),E=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audience:D.array(p$).nullish(),lastModified:D.string().nullish(),priority:D.number().nullish()}),n$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string()}),t$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string(),uri:D.string().nullish()}),o$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),description:D.string().nullish(),mimeType:D.string().nullish(),name:D.string(),size:D.number().nullish(),title:D.string().nullish(),uri:D.string()}),r$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),optionId:gD}),z$=D.union([D.object({outcome:D.literal("cancelled")}),r$.and(D.object({outcome:D.literal("selected")}))]),a$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),outcome:z$}),s$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),e$=D.object({currentValue:D.boolean()}),Dw=D.string(),dD=D.string(),$w=D.union([D.literal("mode"),D.literal("model"),D.literal("thought_level"),D.string()]),a=D.string(),iD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),name:D.string(),value:a}),ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),group:Dw,name:D.string(),options:D.array(iD)}),Qw=D.union([D.array(iD),D.array(ww)]),fw=D.object({currentValue:a,options:Qw}),M=D.intersection(D.union([fw.and(D.object({type:D.literal("select")})),e$.and(D.object({type:D.literal("boolean")}))]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),category:$w.nullish(),description:D.string().nullish(),id:dD,name:D.string()})),_w=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),Gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),N=D.string(),s=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),ew=D.object({method:D.string(),params:D.union([s,qD]).nullish()}),e=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),DD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),command:D.string(),cwd:D.string().nullish(),env:D.array(vD).optional(),outputByteLimit:D.number().nullish(),sessionId:N}),$D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),wD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),QD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I),sessionId:N}),fD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),limit:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string(),sessionId:N}),_D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),GD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),Jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),sessionId:N,title:D.string().nullish(),updatedAt:D.string().nullish()}),Xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),nextCursor:D.string().nullish(),sessions:D.array(Jw)}),Yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),title:D.string().nullish(),updatedAt:D.string().nullish()}),Zw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),q=D.string(),jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),currentModeId:q}),Aw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:q,name:D.string()}),S=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModes:D.array(Aw),currentModeId:q}),R=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModels:D.array(q$),currentModelId:o}),Ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),Bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Ow=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Nw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),close:s$.nullish(),fork:Gw.nullish(),list:Zw.nullish(),resume:Ow.nullish()}),Fw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),loadSession:D.boolean().optional().default(!1),mcpCapabilities:C$.optional().default({http:!1,sse:!1}),promptCapabilities:d$.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:Nw.optional().default({})}),Lw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),agentCapabilities:Fw.optional().default({loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:uD.nullish(),authMethods:D.array(L$).optional().default([]),protocolVersion:lD}),JD=D.intersection(D.union([D.object({type:D.literal("boolean"),value:D.boolean()}),D.object({value:a})]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configId:dD,sessionId:N})),xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),XD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modeId:q,sessionId:N}),Vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),YD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modelId:o,sessionId:N}),Hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Pw=D.union([D.literal("end_turn"),D.literal("max_tokens"),D.literal("max_turn_requests"),D.literal("refusal"),D.literal("cancelled")]),kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),Tw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),ZD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),Uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitStatus:Tw.nullish(),output:D.string(),truncated:D.boolean()}),bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),text:D.string()}),hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),mimeType:D.string().nullish(),text:D.string(),uri:D.string()}),Mw=D.union([hw,V$]),Cw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),resource:Mw}),jD=D.union([bw.and(D.object({type:D.literal("text")})),t$.and(D.object({type:D.literal("image")})),n$.and(D.object({type:D.literal("audio")})),o$.and(D.object({type:D.literal("resource_link")})),Cw.and(D.object({type:D.literal("resource")}))]),Ew=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD}),p=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD,messageId:D.string().nullish()}),AD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),messageId:D.string().nullish(),prompt:D.array(jD),sessionId:N}),DQ=D.object({id:T,method:D.string(),params:D.union([z,n,r,QD,t,$D,GD,e,XD,JD,AD,YD,SD]).nullish()}),mD=D.union([Ew.and(D.object({type:D.literal("content")})),T$.and(D.object({type:D.literal("diff")})),kw.and(D.object({type:D.literal("terminal")}))]),pD=D.string(),nD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string()}),tD=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed"),D.literal("failed")]),oD=D.union([D.literal("read"),D.literal("edit"),D.literal("delete"),D.literal("move"),D.literal("search"),D.literal("execute"),D.literal("think"),D.literal("fetch"),D.literal("switch_mode"),D.literal("other")]),vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).optional(),kind:oD.optional(),locations:D.array(nD).optional(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.optional(),title:D.string(),toolCallId:pD}),rD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).nullish(),kind:oD.nullish(),locations:D.array(nD).nullish(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.nullish(),title:D.string().nullish(),toolCallId:pD}),WD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),options:D.array(R$),sessionId:N,toolCall:rD}),Iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),hint:D.string()}),qw=Iw,Sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string(),input:qw.nullish(),name:D.string()}),Rw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableCommands:D.array(Sw)}),cw=D.object({cachedReadTokens:D.number().nullish(),cachedWriteTokens:D.number().nullish(),inputTokens:D.number(),outputTokens:D.number(),thoughtTokens:D.number().nullish(),totalTokens:D.number()}),uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),stopReason:Pw,usage:cw.nullish(),userMessageId:D.string().nullish()}),$Q=D.union([D.object({id:T,result:D.union([Lw,x$,Kw,yw,Xw,Ww,Bw,H$,Vw,xw,uw,Hw,RD])}),D.object({error:ID,id:T})]),gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cost:P$.nullish(),size:D.number(),used:D.number()}),lw=D.union([p.and(D.object({sessionUpdate:D.literal("user_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_thought_chunk")})),vw.and(D.object({sessionUpdate:D.literal("tool_call")})),rD.and(D.object({sessionUpdate:D.literal("tool_call_update")})),l$.and(D.object({sessionUpdate:D.literal("plan")})),Rw.and(D.object({sessionUpdate:D.literal("available_commands_update")})),jw.and(D.object({sessionUpdate:D.literal("current_mode_update")})),_w.and(D.object({sessionUpdate:D.literal("config_option_update")})),Yw.and(D.object({sessionUpdate:D.literal("session_info_update")})),gw.and(D.object({sessionUpdate:D.literal("usage_update")}))]),yD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,update:lw}),wQ=D.object({method:D.string(),params:D.union([yD,qD]).nullish()}),KD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),dw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),BD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),path:D.string(),sessionId:N}),QQ=D.object({id:T,method:D.string(),params:D.union([BD,fD,WD,DD,ZD,_D,KD,wD,SD]).nullish()}),iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),fQ=D.union([D.object({id:T,result:D.union([iw,i$,a$,k$,Uw,m$,dw,M$,RD])}),D.object({error:ID,id:T})]);function zD($,Q){let w=new TextEncoder,f=new TextDecoder,X=new ReadableStream({async start(_){let J="",j=Q.getReader();try{while(!0){let{value:B,done:Y}=await j.read();if(Y)break;if(!B)continue;J+=f.decode(B,{stream:!0});let Z=J.split(`
2
+ import{Cd as W$}from"./chunk-m2q317gh.js";import{Ed as j$}from"./chunk-x25zkrz7.js";import{Rd as A$}from"./chunk-yajd975f.js";import{Of as J$}from"./chunk-pv67gwce.js";import{ag as Z$}from"./chunk-k7aenxan.js";import"./chunk-8r6ht39z.js";import"./chunk-mqd1jsg2.js";import"./chunk-gz8sz7z1.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-d3ermm6d.js";import{gh as MD}from"./chunk-caj1b9y7.js";import{Uh as hD}from"./chunk-ygs5pzk7.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import{ql as _$,rl as U,sk as sD,tl as G$,yk as k,zk as P}from"./chunk-257me4z3.js";import"./chunk-nkkch4h7.js";import"./chunk-s3mnrhbx.js";import"./chunk-ezfy0b6q.js";import"./chunk-bn0h9dny.js";import"./chunk-hnvn2c25.js";import"./chunk-3nx7112w.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import{no as X$,qo as Y$}from"./chunk-we9cv8we.js";import"./chunk-2hc5z7b5.js";import"./chunk-9gazyynx.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import{_p as f$}from"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-d9hbhkbq.js";import"./chunk-ad72gb5f.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import{Ms as w$,Vr as Q$,_s as H}from"./chunk-xj765svc.js";import{st as kD}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import{St as D}from"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import{DO as ow}from"./chunk-7xm75w1e.js";var O={authenticate:"authenticate",initialize:"initialize",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},F={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"};var K$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminal:D.boolean().optional().default(!1)}),B$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),label:D.string().nullish(),name:D.string(),optional:D.boolean().optional().default(!1),secret:D.boolean().optional().default(!0)}),O$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),name:D.string()}),N$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:D.string(),link:D.string().nullish(),name:D.string(),vars:D.array(B$)}),F$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),description:D.string().nullish(),env:D.record(D.string(),D.string()).optional(),id:D.string(),name:D.string()}),L$=D.union([N$.and(D.object({type:D.literal("env_var")})),F$.and(D.object({type:D.literal("terminal")})),O$]),n=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),methodId:D.string()}),x$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),V$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),blob:D.string(),mimeType:D.string().nullish(),uri:D.string()}),H$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),P$=D.object({amount:D.number(),currency:D.string()}),k$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),T$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),newText:D.string(),oldText:D.string().nullish(),path:D.string()}),vD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),U$=D.union([D.literal(-32700),D.literal(-32600),D.literal(-32601),D.literal(-32602),D.literal(-32603),D.literal(-32800),D.literal(-32000),D.literal(-32002),D.number().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),ID=D.object({code:U$,data:D.unknown().optional(),message:D.string()}),qD=D.unknown(),SD=D.unknown(),RD=D.unknown(),b$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),readTextFile:D.boolean().optional().default(!1),writeTextFile:D.boolean().optional().default(!1)}),h$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),auth:K$.optional().default({terminal:!1}),fs:b$.optional().default({readTextFile:!1,writeTextFile:!1}),terminal:D.boolean().optional().default(!1)}),cD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),value:D.string()}),uD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),name:D.string(),title:D.string().nullish(),version:D.string()}),M$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),t=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cursor:D.string().nullish(),cwd:D.string().nullish()}),C$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),http:D.boolean().optional().default(!1),sse:D.boolean().optional().default(!1)}),E$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),v$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),headers:D.array(cD),name:D.string(),url:D.string()}),I$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()),command:D.string(),env:D.array(vD),name:D.string()}),I=D.union([E$.and(D.object({type:D.literal("http")})),v$.and(D.object({type:D.literal("sse")})),I$]),o=D.string(),q$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),modelId:o,name:D.string()}),r=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I)}),gD=D.string(),S$=D.union([D.literal("allow_once"),D.literal("allow_always"),D.literal("reject_once"),D.literal("reject_always")]),R$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),kind:S$,name:D.string(),optionId:gD}),c$=D.union([D.literal("high"),D.literal("medium"),D.literal("low")]),u$=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed")]),g$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),priority:c$,status:u$}),l$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),entries:D.array(g$)}),d$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audio:D.boolean().optional().default(!1),embeddedContext:D.boolean().optional().default(!1),image:D.boolean().optional().default(!1)}),lD=D.number().int().gte(0).lte(65535),z=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),clientCapabilities:h$.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:uD.nullish(),protocolVersion:lD}),i$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string()}),m$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),T=D.union([D.number(),D.string()]).nullable(),sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),requestId:T}),p$=D.enum(["assistant","user"]),E=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),audience:D.array(p$).nullish(),lastModified:D.string().nullish(),priority:D.number().nullish()}),n$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string()}),t$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),data:D.string(),mimeType:D.string(),uri:D.string().nullish()}),o$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),description:D.string().nullish(),mimeType:D.string().nullish(),name:D.string(),size:D.number().nullish(),title:D.string().nullish(),uri:D.string()}),r$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),optionId:gD}),z$=D.union([D.object({outcome:D.literal("cancelled")}),r$.and(D.object({outcome:D.literal("selected")}))]),a$=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),outcome:z$}),s$=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),e$=D.object({currentValue:D.boolean()}),Dw=D.string(),dD=D.string(),$w=D.union([D.literal("mode"),D.literal("model"),D.literal("thought_level"),D.string()]),a=D.string(),iD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),name:D.string(),value:a}),ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),group:Dw,name:D.string(),options:D.array(iD)}),Qw=D.union([D.array(iD),D.array(ww)]),fw=D.object({currentValue:a,options:Qw}),M=D.intersection(D.union([fw.and(D.object({type:D.literal("select")})),e$.and(D.object({type:D.literal("boolean")}))]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),category:$w.nullish(),description:D.string().nullish(),id:dD,name:D.string()})),_w=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),Gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),N=D.string(),s=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),ew=D.object({method:D.string(),params:D.union([s,qD]).nullish()}),e=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N}),DD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),args:D.array(D.string()).optional(),command:D.string(),cwd:D.string().nullish(),env:D.array(vD).optional(),outputByteLimit:D.number().nullish(),sessionId:N}),$D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),wD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),QD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I),sessionId:N}),fD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),limit:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string(),sessionId:N}),_D=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),GD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),mcpServers:D.array(I).optional(),sessionId:N}),Jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cwd:D.string(),sessionId:N,title:D.string().nullish(),updatedAt:D.string().nullish()}),Xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),nextCursor:D.string().nullish(),sessions:D.array(Jw)}),Yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),title:D.string().nullish(),updatedAt:D.string().nullish()}),Zw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),q=D.string(),jw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),currentModeId:q}),Aw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string().nullish(),id:q,name:D.string()}),S=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModes:D.array(Aw),currentModeId:q}),R=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableModels:D.array(q$),currentModelId:o}),Ww=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),yw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish(),sessionId:N}),Bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M).nullish(),models:R.nullish(),modes:S.nullish()}),Ow=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Nw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),close:s$.nullish(),fork:Gw.nullish(),list:Zw.nullish(),resume:Ow.nullish()}),Fw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),loadSession:D.boolean().optional().default(!1),mcpCapabilities:C$.optional().default({http:!1,sse:!1}),promptCapabilities:d$.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:Nw.optional().default({})}),Lw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),agentCapabilities:Fw.optional().default({loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:uD.nullish(),authMethods:D.array(L$).optional().default([]),protocolVersion:lD}),JD=D.intersection(D.union([D.object({type:D.literal("boolean"),value:D.boolean()}),D.object({value:a})]),D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configId:dD,sessionId:N})),xw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),configOptions:D.array(M)}),XD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modeId:q,sessionId:N}),Vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),YD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),modelId:o,sessionId:N}),Hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),Pw=D.union([D.literal("end_turn"),D.literal("max_tokens"),D.literal("max_turn_requests"),D.literal("refusal"),D.literal("cancelled")]),kw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),terminalId:D.string()}),Tw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),ZD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),Uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitStatus:Tw.nullish(),output:D.string(),truncated:D.boolean()}),bw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),text:D.string()}),hw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),mimeType:D.string().nullish(),text:D.string(),uri:D.string()}),Mw=D.union([hw,V$]),Cw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),annotations:E.nullish(),resource:Mw}),jD=D.union([bw.and(D.object({type:D.literal("text")})),t$.and(D.object({type:D.literal("image")})),n$.and(D.object({type:D.literal("audio")})),o$.and(D.object({type:D.literal("resource_link")})),Cw.and(D.object({type:D.literal("resource")}))]),Ew=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD}),p=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:jD,messageId:D.string().nullish()}),AD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),messageId:D.string().nullish(),prompt:D.array(jD),sessionId:N}),DQ=D.object({id:T,method:D.string(),params:D.union([z,n,r,QD,t,$D,GD,e,XD,JD,AD,YD,SD]).nullish()}),mD=D.union([Ew.and(D.object({type:D.literal("content")})),T$.and(D.object({type:D.literal("diff")})),kw.and(D.object({type:D.literal("terminal")}))]),pD=D.string(),nD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),line:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:D.string()}),tD=D.union([D.literal("pending"),D.literal("in_progress"),D.literal("completed"),D.literal("failed")]),oD=D.union([D.literal("read"),D.literal("edit"),D.literal("delete"),D.literal("move"),D.literal("search"),D.literal("execute"),D.literal("think"),D.literal("fetch"),D.literal("switch_mode"),D.literal("other")]),vw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).optional(),kind:oD.optional(),locations:D.array(nD).optional(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.optional(),title:D.string(),toolCallId:pD}),rD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.array(mD).nullish(),kind:oD.nullish(),locations:D.array(nD).nullish(),rawInput:D.unknown().optional(),rawOutput:D.unknown().optional(),status:tD.nullish(),title:D.string().nullish(),toolCallId:pD}),WD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),options:D.array(R$),sessionId:N,toolCall:rD}),Iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),hint:D.string()}),qw=Iw,Sw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),description:D.string(),input:qw.nullish(),name:D.string()}),Rw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),availableCommands:D.array(Sw)}),cw=D.object({cachedReadTokens:D.number().nullish(),cachedWriteTokens:D.number().nullish(),inputTokens:D.number(),outputTokens:D.number(),thoughtTokens:D.number().nullish(),totalTokens:D.number()}),uw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),stopReason:Pw,usage:cw.nullish(),userMessageId:D.string().nullish()}),$Q=D.union([D.object({id:T,result:D.union([Lw,x$,Kw,yw,Xw,Ww,Bw,H$,Vw,xw,uw,Hw,RD])}),D.object({error:ID,id:T})]),gw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),cost:P$.nullish(),size:D.number(),used:D.number()}),lw=D.union([p.and(D.object({sessionUpdate:D.literal("user_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_message_chunk")})),p.and(D.object({sessionUpdate:D.literal("agent_thought_chunk")})),vw.and(D.object({sessionUpdate:D.literal("tool_call")})),rD.and(D.object({sessionUpdate:D.literal("tool_call_update")})),l$.and(D.object({sessionUpdate:D.literal("plan")})),Rw.and(D.object({sessionUpdate:D.literal("available_commands_update")})),jw.and(D.object({sessionUpdate:D.literal("current_mode_update")})),_w.and(D.object({sessionUpdate:D.literal("config_option_update")})),Yw.and(D.object({sessionUpdate:D.literal("session_info_update")})),gw.and(D.object({sessionUpdate:D.literal("usage_update")}))]),yD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,update:lw}),wQ=D.object({method:D.string(),params:D.union([yD,qD]).nullish()}),KD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),sessionId:N,terminalId:D.string()}),dw=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),exitCode:D.number().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:D.string().nullish()}),BD=D.object({_meta:D.record(D.string(),D.unknown()).nullish(),content:D.string(),path:D.string(),sessionId:N}),QQ=D.object({id:T,method:D.string(),params:D.union([BD,fD,WD,DD,ZD,_D,KD,wD,SD]).nullish()}),iw=D.object({_meta:D.record(D.string(),D.unknown()).nullish()}),fQ=D.union([D.object({id:T,result:D.union([iw,i$,a$,k$,Uw,m$,dw,M$,RD])}),D.object({error:ID,id:T})]);function zD($,Q){let w=new TextEncoder,f=new TextDecoder,X=new ReadableStream({async start(_){let J="",j=Q.getReader();try{while(!0){let{value:B,done:Y}=await j.read();if(Y)break;if(!B)continue;J+=f.decode(B,{stream:!0});let Z=J.split(`
3
3
  `);J=Z.pop()||"";for(let A of Z){let y=A.trim();if(y)try{let W=JSON.parse(y);_.enqueue(W)}catch(W){console.error("Failed to parse JSON message:",y,W)}}}}finally{j.releaseLock(),_.close()}}}),G=new WritableStream({async write(_){let J=JSON.stringify(_)+`
4
4
  `,j=$.getWriter();try{await j.write(w.encode(J))}finally{j.releaseLock()}}});return{readable:X,writable:G}}class OD{#D;constructor($,Q){let w=$(this),f=async(G,_)=>{switch(G){case O.initialize:{let J=z.parse(_);return w.initialize(J)}case O.session_new:{let J=r.parse(_);return w.newSession(J)}case O.session_load:{if(!w.loadSession)throw K.methodNotFound(G);let J=QD.parse(_);return w.loadSession(J)}case O.session_list:{if(!w.listSessions)throw K.methodNotFound(G);let J=t.parse(_);return w.listSessions(J)}case O.session_fork:{if(!w.unstable_forkSession)throw K.methodNotFound(G);let J=$D.parse(_);return w.unstable_forkSession(J)}case O.session_resume:{if(!w.unstable_resumeSession)throw K.methodNotFound(G);let J=GD.parse(_);return w.unstable_resumeSession(J)}case O.session_close:{if(!w.unstable_closeSession)throw K.methodNotFound(G);let J=e.parse(_);return w.unstable_closeSession(J)}case O.session_set_mode:{if(!w.setSessionMode)throw K.methodNotFound(G);let J=XD.parse(_);return await w.setSessionMode(J)??{}}case O.authenticate:{let J=n.parse(_);return await w.authenticate(J)??{}}case O.session_prompt:{let J=AD.parse(_);return w.prompt(J)}case O.session_set_model:{if(!w.unstable_setSessionModel)throw K.methodNotFound(G);let J=YD.parse(_);return await w.unstable_setSessionModel(J)??{}}case O.session_set_config_option:{if(!w.setSessionConfigOption)throw K.methodNotFound(G);let J=JD.parse(_);return w.setSessionConfigOption(J)}default:if(w.extMethod)return w.extMethod(G,_);throw K.methodNotFound(G)}},X=async(G,_)=>{switch(G){case O.session_cancel:{let J=s.parse(_);return w.cancel(J)}default:if(w.extNotification)return w.extNotification(G,_);throw K.methodNotFound(G)}};this.#D=new ND(f,X,Q)}async sessionUpdate($){return await this.#D.sendNotification(F.session_update,$)}async requestPermission($){return await this.#D.sendRequest(F.session_request_permission,$)}async readTextFile($){return await this.#D.sendRequest(F.fs_read_text_file,$)}async writeTextFile($){return await this.#D.sendRequest(F.fs_write_text_file,$)??{}}async createTerminal($){let Q=await this.#D.sendRequest(F.terminal_create,$);return new aD(Q.terminalId,$.sessionId,this.#D)}async extMethod($,Q){return await this.#D.sendRequest($,Q)}async extNotification($,Q){return await this.#D.sendNotification($,Q)}get signal(){return this.#D.signal}get closed(){return this.#D.closed}}class aD{id;#D;#$;constructor($,Q,w){this.id=$,this.#D=Q,this.#$=w}async currentOutput(){return await this.#$.sendRequest(F.terminal_output,{sessionId:this.#D,terminalId:this.id})}async waitForExit(){return await this.#$.sendRequest(F.terminal_wait_for_exit,{sessionId:this.#D,terminalId:this.id})}async kill(){return await this.#$.sendRequest(F.terminal_kill,{sessionId:this.#D,terminalId:this.id})??{}}async release(){return await this.#$.sendRequest(F.terminal_release,{sessionId:this.#D,terminalId:this.id})??{}}async[Symbol.asyncDispose](){await this.release()}}class pw{#D;constructor($,Q){let w=$(this),f=async(G,_)=>{switch(G){case F.fs_write_text_file:{let J=BD.parse(_);return w.writeTextFile?.(J)}case F.fs_read_text_file:{let J=fD.parse(_);return w.readTextFile?.(J)}case F.session_request_permission:{let J=WD.parse(_);return w.requestPermission(J)}case F.terminal_create:{let J=DD.parse(_);return w.createTerminal?.(J)}case F.terminal_output:{let J=ZD.parse(_);return w.terminalOutput?.(J)}case F.terminal_release:{let J=_D.parse(_);return await w.releaseTerminal?.(J)??{}}case F.terminal_wait_for_exit:{let J=KD.parse(_);return w.waitForTerminalExit?.(J)}case F.terminal_kill:{let J=wD.parse(_);return await w.killTerminal?.(J)??{}}default:if(w.extMethod)return w.extMethod(G,_);throw K.methodNotFound(G)}},X=async(G,_)=>{switch(G){case F.session_update:{let J=yD.parse(_);return w.sessionUpdate(J)}default:if(w.extNotification)return w.extNotification(G,_);throw K.methodNotFound(G)}};this.#D=new ND(f,X,Q)}async initialize($){return await this.#D.sendRequest(O.initialize,$)}async newSession($){return await this.#D.sendRequest(O.session_new,$)}async loadSession($){return await this.#D.sendRequest(O.session_load,$)??{}}async unstable_forkSession($){return await this.#D.sendRequest(O.session_fork,$)}async listSessions($){return await this.#D.sendRequest(O.session_list,$)}async unstable_resumeSession($){return await this.#D.sendRequest(O.session_resume,$)}async unstable_closeSession($){return await this.#D.sendRequest(O.session_close,$)}async setSessionMode($){return await this.#D.sendRequest(O.session_set_mode,$)??{}}async unstable_setSessionModel($){return await this.#D.sendRequest(O.session_set_model,$)??{}}async setSessionConfigOption($){return await this.#D.sendRequest(O.session_set_config_option,$)}async authenticate($){return await this.#D.sendRequest(O.authenticate,$)??{}}async prompt($){return await this.#D.sendRequest(O.session_prompt,$)}async cancel($){return await this.#D.sendNotification(O.session_cancel,$)}async extMethod($,Q){return await this.#D.sendRequest($,Q)}async extNotification($,Q){return await this.#D.sendNotification($,Q)}get signal(){return this.#D.signal}get closed(){return this.#D.closed}}class ND{#D=new Map;#$=0;#G;#J;#Q;#f=Promise.resolve();#_=new AbortController;#X;constructor($,Q,w){this.#G=$,this.#J=Q,this.#Q=w,this.#X=new Promise((f)=>{this.#_.signal.addEventListener("abort",()=>f())}),this.#Y()}get signal(){return this.#_.signal}get closed(){return this.#X}async#Y(){let $=this.#Q.readable.getReader();try{while(!0){let{value:Q,done:w}=await $.read();if(w)break;if(!Q)continue;try{this.#Z(Q)}catch(f){if(console.error("Unexpected error during message processing:",Q,f),"id"in Q&&Q.id!==void 0)this.#w({jsonrpc:"2.0",id:Q.id,error:{code:-32700,message:"Parse error"}})}}}finally{$.releaseLock(),this.#_.abort()}}async#Z($){if("method"in $&&"id"in $){let Q=await this.#j($.method,$.params);if("error"in Q)console.error("Error handling request",$,Q.error);await this.#w({jsonrpc:"2.0",id:$.id,...Q})}else if("method"in $){let Q=await this.#A($.method,$.params);if("error"in Q)console.error("Error handling notification",$,Q.error)}else if("id"in $)this.#W($);else console.error("Invalid message",{message:$})}async#j($,Q){try{return{result:await this.#G($,Q)??null}}catch(w){if(w instanceof K)return w.toResult();if(w instanceof D.ZodError)return K.invalidParams(w.format()).toResult();let f;if(w instanceof Error)f=w.message;else if(typeof w==="object"&&w!=null&&"message"in w&&typeof w.message==="string")f=w.message;try{return K.internalError(f?JSON.parse(f):{}).toResult()}catch{return K.internalError({details:f}).toResult()}}}async#A($,Q){try{return await this.#J($,Q),{result:null}}catch(w){if(w instanceof K)return w.toResult();if(w instanceof D.ZodError)return K.invalidParams(w.format()).toResult();let f;if(w instanceof Error)f=w.message;else if(typeof w==="object"&&w!=null&&"message"in w&&typeof w.message==="string")f=w.message;try{return K.internalError(f?JSON.parse(f):{}).toResult()}catch{return K.internalError({details:f}).toResult()}}}#W($){let Q=this.#D.get($.id);if(Q){if("result"in $)Q.resolve($.result);else if("error"in $)Q.reject($.error);this.#D.delete($.id)}else console.error("Got response to unknown request",$.id)}async sendRequest($,Q){let w=this.#$++,f=new Promise((X,G)=>{this.#D.set(w,{resolve:X,reject:G})});return await this.#w({jsonrpc:"2.0",id:w,method:$,params:Q}),f}async sendNotification($,Q){await this.#w({jsonrpc:"2.0",method:$,params:Q})}async#w($){return this.#f=this.#f.then(async()=>{let Q=this.#Q.writable.getWriter();try{await Q.write($)}finally{Q.releaseLock()}}).catch((Q)=>{console.error("ACP write error:",Q)}),this.#f}}class K extends Error{code;data;constructor($,Q,w){super(Q);this.code=$,this.name="RequestError",this.data=w}static parseError($,Q){return new K(-32700,`Parse error${Q?`: ${Q}`:""}`,$)}static invalidRequest($,Q){return new K(-32600,`Invalid request${Q?`: ${Q}`:""}`,$)}static methodNotFound($){return new K(-32601,`"Method not found": ${$}`,{method:$})}static invalidParams($,Q){return new K(-32602,`Invalid params${Q?`: ${Q}`:""}`,$)}static internalError($,Q){return new K(-32603,`Internal error${Q?`: ${Q}`:""}`,$)}static authRequired($,Q){return new K(-32000,`Authentication required${Q?`: ${Q}`:""}`,$)}static resourceNotFound($){return new K(-32002,`Resource not found${$?`: ${$}`:""}`,$&&{uri:$})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}var v={};ow(v,{init:()=>zw,Agent:()=>CD,ACP:()=>v});var FD=H.create({service:"acp-session-manager"});class LD{sessions=new Map;sdk;constructor($){this.sdk=$}tryGet($){return this.sessions.get($)}async create($,Q,w){let X=(await this.sdk.session.create({directory:$},{throwOnError:!0}).then((J)=>J.data)).id,_={id:X,cwd:$,mcpServers:Q,createdAt:new Date,model:w};return FD.info("creating_session",{state:_}),this.sessions.set(X,_),_}async load($,Q,w,f){let X=await this.sdk.session.get({sessionID:$,directory:Q},{throwOnError:!0}).then((J)=>J.data),G=f,_={id:$,cwd:Q,mcpServers:w,createdAt:new Date(X.time.created),model:G};return FD.info("loading_session",{state:_}),this.sessions.set($,_),_}get($){let Q=this.sessions.get($);if(!Q)throw FD.error("session not found",{sessionId:$}),K.invalidParams(JSON.stringify({error:`Session not found: ${$}`}));return Q}getModel($){return this.get($).model}setModel($,Q){let w=this.get($);return w.model=Q,this.sessions.set($,w),w}getVariant($){return this.get($).variant}setVariant($,Q){let w=this.get($);return w.variant=Q,this.sessions.set($,w),w}setMode($,Q){let w=this.get($);return w.modeId=Q,this.sessions.set($,w),w}}import{pathToFileURL as c}from"url";var nw=H.create({service:"acp-message-translator"}),tw="default";function b($){switch($.toLocaleLowerCase()){case"bash":return"execute";case"webfetch":return"fetch";case"edit":case"patch":case"write":return"edit";case"grep":case"glob":case"context7_resolve_library_id":case"context7_get_library_docs":return"search";case"read":return"read";default:return"other"}}function u($,Q){switch($.toLocaleLowerCase()){case"read":case"edit":case"write":return Q.filePath?[{path:Q.filePath}]:[];case"glob":case"grep":return Q.path?[{path:Q.path}]:[];case"bash":return[];default:return[]}}function g($){try{if($.startsWith("file://")){let Q=$.slice(7),w=Q.split("/").pop()||Q;return{type:"file",url:$,filename:w,mime:"text/plain"}}if($.startsWith("zed://")){let w=new URL($).searchParams.get("path");if(w){let f=w.split("/").pop()||w;return{type:"file",url:c(w).href,filename:f,mime:"text/plain"}}}return{type:"text",text:$}}catch{return{type:"text",text:$}}}function eD($,Q){let w=sD($,Q);if(w===!1){nw.error("Failed to apply unified diff (context mismatch)");return}return w}function xD($){if($.tool!=="bash")return;if(!("metadata"in $.state)||!$.state.metadata||typeof $.state.metadata!=="object")return;let Q=$.state.metadata.output;if(typeof Q!=="string")return;return Q}function l($){return[...$].sort((Q,w)=>{let f=Q.name.toLowerCase(),X=w.name.toLowerCase();if(f<X)return-1;if(f>X)return 1;return 0})}function VD($,Q){let w=$.find((X)=>X.id===Q.providerID);if(!w)return[];let f=w.models[Q.modelID];if(!f?.variants)return[];return Object.keys(f.variants)}function D$($,Q={}){let w=Q.includeVariants??!1;return $.flatMap((f)=>{let X=Object.values(f.models);return U.sort(X).flatMap((_)=>{let J={modelId:`${f.id}/${_.id}`,name:`${f.name}/${_.name}`};if(!w||!_.variants)return[J];let B=Object.keys(_.variants).filter((Y)=>Y!==tw).map((Y)=>({modelId:`${f.id}/${_.id}/${Y}`,name:`${f.name}/${_.name} (${Y})`}));return[J,...B]})})}function d($,Q,w,f){let X=`${$.providerID}/${$.modelID}`;if(!f||!Q||!w.includes(Q))return X;return`${X}/${Q}`}function HD($){return{opencode:{modelId:`${$.model.providerID}/${$.model.modelID}`,variant:$.variant??null,availableVariants:$.availableVariants}}}function PD($,Q){let w=U.parseModel($),f=Q.find((G)=>G.id===w.providerID);if(!f)return{model:w,variant:void 0};if(f.models[w.modelID])return{model:w,variant:void 0};let X=w.modelID.split("/");if(X.length>1){let G=X[X.length-1],_=X.slice(0,-1).join("/"),J=f.models[_];if(J?.variants&&G in J.variants)return{model:{providerID:w.providerID,modelID:P.make(_)},variant:G}}return{model:w,variant:void 0}}function i($){let Q=[{id:"model",name:"Model",category:"model",type:"select",currentValue:$.currentModelId,options:$.availableModels.map((w)=>({value:w.modelId,name:w.name}))}];if($.modes)Q.push({id:"mode",name:"Session Mode",category:"mode",type:"select",currentValue:$.modes.currentModeId,options:$.modes.availableModes.map((w)=>({value:w.id,name:w.name,...w.description?{description:w.description}:{}}))});return Q}var $$=H.create({service:"acp-permissions"});class TD{connection;sdk;sessionManager;permissionQueues=new Map;permissionOptions=[{optionId:"once",kind:"allow_once",name:"Allow once"},{optionId:"always",kind:"allow_always",name:"Always allow"},{optionId:"reject",kind:"reject_once",name:"Reject"}];constructor($,Q,w){this.connection=$;this.sdk=Q;this.sessionManager=w}handle($){let Q=this.sessionManager.tryGet($.sessionID);if(!Q)return;let f=(this.permissionQueues.get($.sessionID)??Promise.resolve()).then(async()=>{let X=Q.cwd,G=await this.connection.requestPermission({sessionId:$.sessionID,toolCall:{toolCallId:$.tool?.callID??$.id,status:"pending",title:$.permission,rawInput:$.metadata,kind:b($.permission),locations:u($.permission,$.metadata??{})},options:this.permissionOptions}).catch(async(_)=>{$$.error("failed to request permission from ACP",{error:_,permissionID:$.id,sessionID:$.sessionID}),await this.sdk.permission.reply({requestID:$.id,reply:"reject",directory:X});return});if(!G)return;if(G.outcome.outcome!=="selected"){await this.sdk.permission.reply({requestID:$.id,reply:"reject",directory:X});return}if(G.outcome.optionId!=="reject"&&$.permission=="edit"){let _=$.metadata||{},J=typeof _.filepath==="string"?_.filepath:"",j=typeof _.diff==="string"?_.diff:"",B=await kD.exists(J)?await kD.readText(J):"",Y=eD(B,j);if(Y)this.connection.writeTextFile({sessionId:Q.id,path:J,content:Y})}await this.sdk.permission.reply({requestID:$.id,reply:G.outcome.optionId,directory:X})}).catch((X)=>{$$.error("failed to handle permission",{error:X,permissionID:$.id})}).finally(()=>{if(this.permissionQueues.get($.sessionID)===f)this.permissionQueues.delete($.sessionID)});this.permissionQueues.set($.sessionID,f)}}var L=H.create({service:"acp-event-bridge"});class UD{connection;sdk;sessionManager;eventAbort=new AbortController;eventStarted=!1;bashSnapshots=new Map;toolStarts=new Set;permissionHandler;constructor($,Q,w){this.connection=$;this.sdk=Q;this.sessionManager=w;this.permissionHandler=new TD($,Q,w)}start(){if(this.eventStarted)return;this.eventStarted=!0,this.runEventSubscription().catch(($)=>{if(this.eventAbort.signal.aborted)return;L.error("event subscription failed",{error:$})})}stop(){this.eventAbort.abort()}async runEventSubscription(){while(!0){if(this.eventAbort.signal.aborted)return;let $=await this.sdk.global.event({signal:this.eventAbort.signal,sseMaxRetryAttempts:0});for await(let Q of $.stream){if(this.eventAbort.signal.aborted)return;let w=Q?.payload;if(!w)continue;await this.handleEvent(w).catch((f)=>{L.error("failed to handle event",{error:f,type:w.type})})}if(this.eventAbort.signal.aborted)return;await new Promise((Q)=>{let w=()=>{clearTimeout(f),this.eventAbort.signal.removeEventListener("abort",w),Q()},f=setTimeout(w,1000);if(this.eventAbort.signal.addEventListener("abort",w,{once:!0}),this.eventAbort.signal.aborted)w()})}}async handleEvent($){switch($.type){case"permission.asked":{this.permissionHandler.handle($.properties);return}case"message.part.updated":{L.info("message part updated",{event:$.properties});let w=$.properties.part,f=this.sessionManager.tryGet(w.sessionID);if(!f)return;let X=f.id;if(w.type==="tool")switch(await this.toolStart(X,w),w.state.status){case"pending":this.bashSnapshots.delete(w.callID);return;case"running":{let G=xD(w),_=[];if(G){let J=w$.fast(G);if(w.tool==="bash"){if(this.bashSnapshots.get(w.callID)===J){await this.sendToolInProgress(X,w,w.state,[]);return}this.bashSnapshots.set(w.callID,J)}_.push({type:"content",content:{type:"text",text:G}})}await this.sendToolInProgress(X,w,w.state,_);return}case"completed":await this.sendToolCompleted(X,w,w.state);return;case"error":await this.sendToolError(X,w,w.state);return}if(w.type!=="text"&&w.type!=="file")return;return}case"message.part.delta":{let Q=$.properties,w=this.sessionManager.tryGet(Q.sessionID);if(!w)return;let f=w.id,X=await this.sdk.session.message({sessionID:Q.sessionID,messageID:Q.messageID,directory:w.cwd},{throwOnError:!0}).then((_)=>_.data).catch((_)=>{L.error("unexpected error when fetching message",{error:_});return});if(!X||X.info.role!=="assistant")return;let G=X.parts.find((_)=>_.id===Q.partID);if(!G)return;if(G.type==="text"&&Q.field==="text"&&G.ignored!==!0){await this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"agent_message_chunk",messageId:Q.messageID,content:{type:"text",text:Q.delta}}}).catch((_)=>{L.error("failed to send text delta to ACP",{error:_})});return}if(G.type==="reasoning"&&Q.field==="text")await this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"agent_thought_chunk",messageId:Q.messageID,content:{type:"text",text:Q.delta}}}).catch((_)=>{L.error("failed to send reasoning delta to ACP",{error:_})});return}}}async sendToolInProgress($,Q,w,f){await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"in_progress",kind:b(Q.tool),title:Q.tool,locations:u(Q.tool,w.input),rawInput:w.input,...f.length>0&&{content:f}}}).catch((X)=>{L.error("failed to send tool in_progress to ACP",{error:X})})}async sendToolCompleted($,Q,w){this.toolStarts.delete(Q.callID),this.bashSnapshots.delete(Q.callID);let f=b(Q.tool),X=[{type:"content",content:{type:"text",text:w.output}}];if(f==="edit"){let G=w.input,_=typeof G.filePath==="string"?G.filePath:"",J=typeof G.oldString==="string"?G.oldString:"",j=typeof G.newString==="string"?G.newString:typeof G.content==="string"?G.content:"";X.push({type:"diff",path:_,oldText:J,newText:j})}await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"completed",kind:f,content:X,title:w.title,rawInput:w.input,rawOutput:{output:w.output,metadata:w.metadata}}}).catch((G)=>{L.error("failed to send tool completed to ACP",{error:G})})}async sendToolError($,Q,w){this.toolStarts.delete(Q.callID),this.bashSnapshots.delete(Q.callID),await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call_update",toolCallId:Q.callID,status:"failed",kind:b(Q.tool),title:Q.tool,rawInput:w.input,content:[{type:"content",content:{type:"text",text:w.error}}],rawOutput:{error:w.error,metadata:w.metadata}}}).catch((f)=>{L.error("failed to send tool error to ACP",{error:f})})}async toolStart($,Q){if(this.toolStarts.has(Q.callID))return;this.toolStarts.add(Q.callID),await this.connection.sessionUpdate({sessionId:$,update:{sessionUpdate:"tool_call",toolCallId:Q.callID,title:Q.tool,kind:b(Q.tool),status:"pending",locations:[],rawInput:{}}}).catch((w)=>{L.error("failed to send tool pending to ACP",{error:w})})}async processMessage($){if(L.debug("process message",$),$.info.role!=="assistant"&&$.info.role!=="user")return;let Q=$.info.sessionID;for(let w of $.parts)if(w.type==="tool")switch(await this.toolStart(Q,w),w.state.status){case"pending":this.bashSnapshots.delete(w.callID);break;case"running":{let f=xD(w),X=[];if(f)X.push({type:"content",content:{type:"text",text:f}});await this.sendToolInProgress(Q,w,w.state,X);break}case"completed":await this.sendToolCompleted(Q,w,w.state);break;case"error":await this.sendToolError(Q,w,w.state);break}else if(w.type==="text"){if(w.text){let f=w.synthetic?["assistant"]:w.ignored?["user"]:void 0;await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:$.info.role==="user"?"user_message_chunk":"agent_message_chunk",messageId:$.info.id,content:{type:"text",text:w.text,...f&&{annotations:{audience:f}}}}}).catch((X)=>{L.error("failed to send text to ACP",{error:X})})}}else if(w.type==="file"){let f=w.url,X=w.filename??"file",G=w.mime||"application/octet-stream",_=$.info.role==="user"?"user_message_chunk":"agent_message_chunk";if(f.startsWith("file://"))await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"resource_link",uri:f,name:X,mimeType:G}}}).catch((J)=>{L.error("failed to send resource_link to ACP",{error:J})});else if(f.startsWith("data:")){let J=f.match(/^data:([^;]+);base64,(.*)$/),j=J?.[1],B=J?.[2]??"",Y=j||G;if(Y.startsWith("image/"))await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"image",mimeType:Y,data:B,uri:c(X).href}}}).catch((Z)=>{L.error("failed to send image to ACP",{error:Z})});else{let Z=Y.startsWith("text/")||Y==="application/json",A=c(X).href,y=Z?{uri:A,mimeType:Y,text:Buffer.from(B,"base64").toString("utf-8")}:{uri:A,mimeType:Y,blob:B};await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:_,messageId:$.info.id,content:{type:"resource",resource:y}}}).catch((W)=>{L.error("failed to send resource to ACP",{error:W})})}}}else if(w.type==="reasoning"){if(w.text)await this.connection.sessionUpdate({sessionId:Q,update:{sessionUpdate:"agent_thought_chunk",messageId:$.info.id,content:{type:"text",text:w.text}}}).catch((f)=>{L.error("failed to send reasoning to ACP",{error:f})})}}}var V=H.create({service:"acp-agent"});async function rw($,Q,w,f){return(await $.config.providers({directory:f}).then((J)=>J.data?.providers??[]).catch((J)=>{return V.error("failed to get providers for context limit",{error:J}),[]})).find((J)=>J.id===Q)?.models[w]?.limit.context??null}async function bD($,Q,w,f){let X=await Q.session.messages({sessionID:w,directory:f,agent_id:"main"},{throwOnError:!0}).then((Z)=>Z.data).catch((Z)=>{V.error("failed to fetch messages for usage update",{error:Z});return});if(!X)return;let G=X.filter((Z)=>Z.info.role==="assistant"),_=G[G.length-1];if(!_)return;let J=_.info;if(!J.providerID||!J.modelID)return;let j=await rw(Q,k.make(J.providerID),P.make(J.modelID),f);if(!j)return;let B=J.tokens.input+(J.tokens.cache?.read??0),Y=G.reduce((Z,A)=>Z+A.info.cost,0);await $.sessionUpdate({sessionId:w,update:{sessionUpdate:"usage_update",used:B,size:j,cost:{amount:Y,currency:"USD"}}}).catch((Z)=>{V.error("failed to send usage update",{error:Z})})}async function zw({sdk:$}){return{create:(Q,w)=>{return new CD(Q,w)}}}class CD{connection;config;sdk;sessionManager;eventBridge;constructor($,Q){this.connection=$,this.config=Q,this.sdk=Q.sdk,this.sessionManager=new LD(this.sdk),this.eventBridge=new UD($,this.sdk,this.sessionManager),this.eventBridge.start()}async initialize($){V.info("initialize",{protocolVersion:$.protocolVersion});let Q={description:"Run `qitqode auth login` in the terminal",name:"Login with qitqode",id:"qitqode-login"};if($.clientCapabilities?._meta?.["terminal-auth"]===!0)Q._meta={"terminal-auth":{command:"qitqode",args:["auth","login"],label:"QitQode Login"}};return{protocolVersion:1,agentCapabilities:{loadSession:!0,mcpCapabilities:{http:!0,sse:!0},promptCapabilities:{embeddedContext:!0,image:!0},sessionCapabilities:{fork:{},list:{},resume:{}}},authMethods:[Q],agentInfo:{name:"QitQode",version:Q$}}}async authenticate($){throw Error("Authentication not implemented")}rethrowSessionError($){let Q=G$.fromError($,{providerID:k.make(this.config.defaultModel?.providerID??"unknown")});if(f$.isInstance(Q))throw K.authRequired();throw $}fetchSessionMessages($,Q){return this.sdk.session.messages({sessionID:$,directory:Q,agent_id:"main"},{throwOnError:!0}).then((w)=>w.data).catch((w)=>{V.error("unexpected error when fetching message",{error:w});return})}loadSessionProviders($){return this.sdk.config.providers({directory:$},{throwOnError:!0}).then((Q)=>Q.data.providers)}async newSession($){let Q=$.cwd;try{let w=await h(this.config,Q),X=(await this.sessionManager.create($.cwd,$.mcpServers,w)).id;V.info("creating_session",{sessionId:X,mcpServers:$.mcpServers.length});let G=await this.loadSessionMode({cwd:Q,mcpServers:$.mcpServers,sessionId:X});return{sessionId:X,configOptions:G.configOptions,models:G.models,modes:G.modes,_meta:G._meta}}catch(w){this.rethrowSessionError(w)}}async loadSession($){let{cwd:Q,sessionId:w}=$;try{let f=await h(this.config,Q);await this.sessionManager.load(w,$.cwd,$.mcpServers,f),V.info("load_session",{sessionId:w,mcpServers:$.mcpServers.length});let X=await this.loadSessionMode({cwd:Q,mcpServers:$.mcpServers,sessionId:w}),G=await this.fetchSessionMessages(w,Q),_=G?.findLast((J)=>J.info.role==="user")?.info;if(_?.role==="user"){if(X.models.currentModelId=`${_.model.providerID}/${_.model.modelID}`,this.sessionManager.setModel(w,{providerID:k.make(_.model.providerID),modelID:P.make(_.model.modelID)}),X.modes?.availableModes.some((J)=>J.id===_.agent))X.modes.currentModeId=_.agent,this.sessionManager.setMode(w,_.agent);X.configOptions=i({currentModelId:X.models.currentModelId,availableModels:X.models.availableModels,modes:X.modes})}return await this.replayMessagesAndSendUsage(G,w,Q),X}catch(f){this.rethrowSessionError(f)}}async listSessions($){try{let w=await this.sdk.session.list({directory:$.cwd??void 0,roots:!0},{throwOnError:!0}).then((Z)=>Z.data??[]),f=$.cursor?Number($.cursor):void 0,X=w.toSorted((Z,A)=>A.time.updated-Z.time.updated),G=f?X.filter((Z)=>Z.time.updated<f):X,_=G.slice(0,100),J=_.map((Z)=>({sessionId:Z.id,cwd:Z.directory,title:Z.title,updatedAt:new Date(Z.time.updated).toISOString()})),j=_[_.length-1],B=G.length>100&&j?String(j.time.updated):void 0,Y={sessions:J};if(B)Y.nextCursor=B;return Y}catch(Q){this.rethrowSessionError(Q)}}async unstable_forkSession($){let Q=$.cwd,w=$.mcpServers??[];try{let f=await h(this.config,Q),X=await this.sdk.session.fork({sessionID:$.sessionId,directory:Q},{throwOnError:!0}).then((j)=>j.data);if(!X)throw Error("Fork session returned no data");let G=X.id;await this.sessionManager.load(G,Q,w,f),V.info("fork_session",{sessionId:G,mcpServers:w.length});let _=await this.loadSessionMode({cwd:Q,mcpServers:w,sessionId:G}),J=await this.fetchSessionMessages(G,Q);return await this.replayMessagesAndSendUsage(J,G,Q),_}catch(f){this.rethrowSessionError(f)}}async unstable_resumeSession($){let{cwd:Q,sessionId:w}=$,f=$.mcpServers??[];try{let X=await h(this.config,Q);await this.sessionManager.load(w,Q,f,X),V.info("resume_session",{sessionId:w,mcpServers:f.length});let G=await this.loadSessionMode({cwd:Q,mcpServers:f,sessionId:w});return await bD(this.connection,this.sdk,w,Q),G}catch(X){this.rethrowSessionError(X)}}async loadAvailableModes($){return(await this.config.sdk.app.agents({directory:$},{throwOnError:!0}).then((w)=>w.data)).filter((w)=>w.mode!=="subagent"&&!w.hidden).map((w)=>({id:w.name,name:w.name,description:w.description}))}async resolveModeState($,Q){let w=await this.loadAvailableModes($),f=this.sessionManager.get(Q).modeId||await(async()=>{if(!w.length)return;let X=await MD.runPromise(hD.Service.use((_)=>_.defaultAgent())),G=w.find((_)=>_.name===X)?.id??w[0].id;return this.sessionManager.setMode(Q,G),G})();return{availableModes:w,currentModeId:f}}async replayMessagesAndSendUsage($,Q,w){for(let f of $??[])V.debug("replay message",f),await this.eventBridge.processMessage(f);await bD(this.connection,this.sdk,Q,w)}async resolveModelsAndModes($){let Q=VD($.entries,$.model);$.onVariants?.(Q);let w=D$($.entries,{includeVariants:!0}),f=await this.resolveModeState($.directory,$.sessionId),X=f.currentModeId?{availableModes:f.availableModes,currentModeId:f.currentModeId}:void 0;return{availableVariants:Q,availableModels:w,modes:X}}async loadSessionMode($){let Q=$.cwd,w=await h(this.config,Q),f=$.sessionId,X=await this.sdk.config.providers({directory:Q}).then((W)=>W.data.providers),G=l(X),_=this.sessionManager.getVariant(f),{availableVariants:J,availableModels:j,modes:B}=await this.resolveModelsAndModes({entries:G,model:w,directory:Q,sessionId:f,onVariants:(W)=>{if(_&&!W.includes(_))this.sessionManager.setVariant(f,void 0)}}),Z=(await this.config.sdk.command.list({directory:Q},{throwOnError:!0}).then((W)=>W.data)).map((W)=>({name:W.name,description:W.description??""}));if(!new Set(Z.map((W)=>W.name)).has("compact"))Z.push({name:"compact",description:"summarize the session to reduce context"});let y={};for(let W of $.mcpServers)if("type"in W)y[W.name]={url:W.url,headers:W.headers.reduce((x,{name:C,value:m})=>{return x[C]=m,x},{}),type:"remote"};else y[W.name]={type:"local",command:[W.command,...W.args],environment:W.env.reduce((x,{name:C,value:m})=>{return x[C]=m,x},{})};return await Promise.all(Object.entries(y).map(async([W,x])=>{await this.sdk.mcp.add({directory:Q,name:W,config:x},{throwOnError:!0}).catch((C)=>{V.error("failed to add mcp server",{name:W,error:C})})})),setTimeout(()=>{this.connection.sessionUpdate({sessionId:f,update:{sessionUpdate:"available_commands_update",availableCommands:Z}})},0),{sessionId:f,models:{currentModelId:d(w,_,J,!0),availableModels:j},modes:B,configOptions:i({currentModelId:d(w,_,J,!0),availableModels:j,modes:B}),_meta:HD({model:w,variant:this.sessionManager.getVariant(f),availableVariants:J})}}async unstable_setSessionModel($){let Q=this.sessionManager.get($.sessionId),w=await this.loadSessionProviders(Q.cwd),f=PD($.modelId,w);this.sessionManager.setModel(Q.id,f.model),this.sessionManager.setVariant(Q.id,f.variant);let X=l(w),G=VD(X,f.model);return{_meta:HD({model:f.model,variant:f.variant,availableVariants:G})}}async setSessionMode($){let Q=this.sessionManager.get($.sessionId);if(!(await this.loadAvailableModes(Q.cwd)).some((f)=>f.id===$.modeId))throw Error(`Agent not found: ${$.modeId}`);this.sessionManager.setMode($.sessionId,$.modeId)}async setSessionConfigOption($){let Q=this.sessionManager.get($.sessionId),w=await this.loadSessionProviders(Q.cwd),f=l(w);if($.configId==="model"){if(typeof $.value!=="string")throw K.invalidParams("model value must be a string");let Y=PD($.value,w);this.sessionManager.setModel(Q.id,Y.model),this.sessionManager.setVariant(Q.id,Y.variant)}else if($.configId==="mode"){if(typeof $.value!=="string")throw K.invalidParams("mode value must be a string");if(!(await this.loadAvailableModes(Q.cwd)).some((Z)=>Z.id===$.value))throw K.invalidParams(JSON.stringify({error:`Mode not found: ${$.value}`}));this.sessionManager.setMode(Q.id,$.value)}else throw K.invalidParams(JSON.stringify({error:`Unknown config option: ${$.configId}`}));let X=this.sessionManager.get(Q.id),G=X.model??await h(this.config,Q.cwd),{availableVariants:_,availableModels:J,modes:j}=await this.resolveModelsAndModes({entries:f,model:G,directory:Q.cwd,sessionId:Q.id}),B=d(G,X.variant,_,!0);return{configOptions:i({currentModelId:B,availableModels:J,modes:j})}}async prompt($){let Q=$.sessionId,w=this.sessionManager.get(Q),f=w.cwd,X=w.model,G=X??await h(this.config,f);if(!X)this.sessionManager.setModel(w.id,G);let _=w.modeId??await MD.runPromise(hD.Service.use((A)=>A.defaultAgent())),J=[];for(let A of $.prompt)switch(A.type){case"text":{let y=A.annotations?.audience,W=y?.length===1&&y[0]==="assistant",x=y?.length===1&&y[0]==="user";J.push({type:"text",text:A.text,...W&&{synthetic:!0},...x&&{ignored:!0}});break}case"image":{let y=g(A.uri??""),W=y.type==="file"?y.filename:"image";if(A.data)J.push({type:"file",url:`data:${A.mimeType};base64,${A.data}`,filename:W,mime:A.mimeType});else if(A.uri&&A.uri.startsWith("http:"))J.push({type:"file",url:A.uri,filename:W,mime:A.mimeType});break}case"resource_link":{let y=g(A.uri);if(A.name&&y.type==="file")y.filename=A.name;J.push(y);break}case"resource":{let y=A.resource;if("text"in y&&y.text)J.push({type:"text",text:y.text});else if("blob"in y&&y.blob&&y.mimeType){let W=g(y.uri??""),x=W.type==="file"?W.filename:"file";J.push({type:"file",url:`data:${y.mimeType};base64,${y.blob}`,filename:x,mime:y.mimeType})}break}default:break}V.info("parts",{parts:J});let j=(()=>{let A=J.filter((x)=>x.type==="text").map((x)=>x.text).join("").trim();if(!A.startsWith("/"))return;let[y,...W]=A.slice(1).split(/\s+/);return{name:y,args:W.join(" ").trim()}})(),B=(A)=>({totalTokens:A.tokens.input+A.tokens.output+A.tokens.reasoning+(A.tokens.cache?.read??0)+(A.tokens.cache?.write??0),inputTokens:A.tokens.input,outputTokens:A.tokens.output,thoughtTokens:A.tokens.reasoning||void 0,cachedReadTokens:A.tokens.cache?.read||void 0,cachedWriteTokens:A.tokens.cache?.write||void 0}),Y,Z=!1;if(!j)Z=!0,Y=(await this.sdk.session.prompt({sessionID:Q,model:{providerID:G.providerID,modelID:G.modelID},variant:this.sessionManager.getVariant(Q),parts:J,agent:_,directory:f})).data?.info;else{let A=await this.config.sdk.command.list({directory:f},{throwOnError:!0}).then((y)=>y.data.find((W)=>W.name===j.name));if(A)Z=!0,Y=(await this.sdk.session.command({sessionID:Q,command:A.name,arguments:j.args,model:G.providerID+"/"+G.modelID,agent:_,directory:f})).data?.info;else switch(j.name){case"compact":await this.config.sdk.session.summarize({sessionID:Q,directory:f,providerID:G.providerID,modelID:G.modelID},{throwOnError:!0});break}}return await bD(this.connection,this.sdk,Q,f),{stopReason:"end_turn",...Z?{usage:Y?B(Y):void 0}:{},_meta:{}}}async cancel($){let Q=this.sessionManager.get($.sessionId);await this.config.sdk.session.abort({sessionID:$.sessionId,directory:Q.cwd},{throwOnError:!0})}}async function h($,Q){let{sdk:w,defaultModel:f}=$;if(f)return f;let X=Q??process.cwd(),G=await w.config.get({directory:X},{throwOnError:!0}).then((Y)=>{let Z=Y.data;if(!Z||!Z.model)return;return U.parseModel(Z.model)}).catch((Y)=>{V.error("failed to load user config for default model",{error:Y});return}),_=await w.config.providers({directory:X},{throwOnError:!0}).then((Y)=>Y.data?.providers??[]).catch((Y)=>{return V.error("failed to list providers for default model",{error:Y}),[]});if(G&&_.length){let Y=_.find((Z)=>Z.id===G.providerID);if(Y&&Y.models[G.modelID])return G}if(G&&!_.length)return G;let J=_.find((Y)=>Y.id==="opencode");if(J){if(J.models["big-pickle"])return{providerID:k.opencode,modelID:P.make("big-pickle")};let[Y]=U.sort(Object.values(J.models));if(Y)return{providerID:k.make(Y.providerID),modelID:P.make(Y.id)}}for(let Y of["default","fast","economical","power"]){let Z=_$[Y];if(!Z)continue;if(_.find((y)=>y.id===Z.providerID)?.models[Z.modelID])return{providerID:k.make(Z.providerID),modelID:P.make(Z.modelID)}}let j=_.flatMap((Y)=>Object.values(Y.models)),[B]=U.sort(j);if(B)return{providerID:k.make(B.providerID),modelID:P.make(B.id)};if(G)return G;return{providerID:k.opencode,modelID:P.make("big-pickle")}}var ED=H.create({service:"acp-command"}),sQ=A$({command:"acp",describe:"start ACP (Agent Client Protocol) server",builder:($)=>{return J$($).option("cwd",{describe:"working directory",type:"string",default:process.cwd()})},handler:async($)=>{if(process.env.QITQODE_CLIENT="acp",process.env.QITQODE_KEY)ED.info("Using QITQODE_KEY for authentication.");else if(!await Y$())ED.warn("No QitQode credential found. AI features will not work until you sign in (`qitqode auth login`) or set QITQODE_KEY.");await j$(process.cwd(),async()=>{let Q=await W$($),w=await Z$.listen(Q),f=X$({baseUrl:`http://${w.hostname}:${w.port}`}),X=new WritableStream({write(j){return new Promise((B,Y)=>{process.stdout.write(j,(Z)=>{if(Z)Y(Z);else B()})})}}),G=new ReadableStream({start(j){process.stdin.on("data",(B)=>{j.enqueue(new Uint8Array(B))}),process.stdin.on("end",()=>j.close()),process.stdin.on("error",(B)=>j.error(B))}}),_=zD(X,G),J=await v.init({sdk:f});new OD((j)=>{return J.create(j,{sdk:f})},_),ED.info("setup connection"),process.stdin.resume(),await new Promise((j,B)=>{process.stdin.on("end",j),process.stdin.on("error",B)})})}});export{sQ as AcpCommand};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{I as M}from"./chunk-t9mz17gb.js";import{Vf as X}from"./chunk-rbk8seme.js";import{Ag as N,Bg as V,Eg as x,vg as C,yg as L}from"./chunk-gz8sz7z1.js";import{Xj as B}from"./chunk-257me4z3.js";import{qo as G}from"./chunk-we9cv8we.js";import{pH as z}from"./chunk-zs8kqdsf.js";var Z="forgewise";function A(j){if(!j||j.type!=="api")return"skip";if(j.method==="api-key")return"skip";if(L(j.expiresAt))return"skip";return"probe"}function F(j){if(j===null)return"skipped";if(!j)return"revoked";return"valid"}function U(j){if(!j||j.type!=="api")return{kind:"skip"};if(j.method==="api-key")return{kind:"skip"};if(!L(j.expiresAt))return{kind:"skip"};if(j.refreshToken)return{kind:"refresh-token",refreshToken:j.refreshToken};return{kind:"browser"}}function T(j){if(j==="invalid_grant")return{kind:"revoked"};if(j===null)return{kind:"transient"};return{kind:"persist",credential:M(j,{rotateRefreshToken:!0})}}var b=1e4;function P(j){if(!j)return;if(j.type!=="api")return{type:j.type,expiresAt:0};return{type:j.type,method:j.metadata?.method,expiresAt:Number(j.metadata?.expires_at??0),refreshToken:j.metadata?.refresh_token}}function w(){if(process.platform==="linux")return Boolean(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);return process.platform==="win32"||process.platform==="darwin"}var K=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return});if(A(P(D))==="skip")return"skipped";if(!D||D.type!=="api")return"skipped";let J=yield*z.orElseSucceed(z.tryPromise({try:()=>C(),catch:()=>{return}}).pipe(z.map((Q)=>Q.issuer)),()=>{return});if(!J)return"skipped";let $=yield*z.promise(()=>N(J,D.key)),H=F($);if(H==="revoked")yield*z.orElseSucceed(j.remove(Z),()=>{return});return H}).pipe(z.withSpan("forgewise.validateStoredToken")),W=()=>z.gen(function*(){let j=yield*B.Service,D=yield*z.orElseSucceed(j.get(Z),()=>{return}),J=U(P(D));if(J.kind==="skip")return"skipped";if(J.kind==="refresh-token"){let _=yield*z.promise(()=>V(J.refreshToken).catch(()=>null)),q=T(_);if(q.kind==="revoked")return yield*z.orElseSucceed(j.remove(Z),()=>{return}),"failed";if(q.kind==="persist")return(yield*j.set(Z,q.credential).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}if(!w())return"skipped";let $=new AbortController,H=setTimeout(()=>$.abort(),b),Q=yield*z.promise(()=>x({signal:$.signal}).catch(()=>null).finally(()=>clearTimeout(H)));if(!Q)return"failed";let Y=M(Q,{rotateRefreshToken:!1});return(yield*j.set(Z,Y).pipe(z.map(()=>!0),z.catch(()=>z.succeed(!1))))?"ok":"failed"}).pipe(z.withSpan("forgewise.refreshIfNeeded"));var E=()=>z.gen(function*(){if((yield*z.promise(()=>G()))?.method!=="sso")return"ok";if((yield*K())==="revoked")return yield*z.sync(()=>X.println(X.Style.TEXT_DANGER+"Your session was revoked (signed out from another device or by an admin action). Run `qitqode auth login` to sign in again."+X.Style.TEXT_NORMAL)),"revoked";if((yield*W())==="failed")yield*z.sync(()=>X.println(X.Style.TEXT_DIM+"(Session refresh failed \u2014 run `qitqode auth login` to re-authenticate)"+X.Style.TEXT_NORMAL));return"ok"});
3
+ export{E as h};