@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{UP as L,VP as I,YP as D}from"./chunk-xpc2zgj7.js";import{dQ as F}from"./chunk-aztre27e.js";import{mkdir as W}from"fs/promises";import*as M from"path";import{mkdir as R,readFile as N,writeFile as k}from"fs/promises";import*as U from"path";import{isMainThread as y}from"worker_threads";import{basename as P,join as h}from"path";import{mkdir as p,writeFile as d}from"fs/promises";import{dirname as j,isAbsolute as c,resolve as l}from"path";import{fileURLToPath as H}from"url";class w{static hashUrl(J){let K=0;for(let Z=0;Z<J.length;Z++){let Y=J.charCodeAt(Z);K=(K<<5)-K+Y,K=K&K}return Math.abs(K).toString(16)}static async downloadOrLoad(J,K,Z,Y,X=!0,V){if(J.startsWith("http://")||J.startsWith("https://")){let $;if(X){let B=this.hashUrl(J);$=V?`${V}-${B}${Y}`:`${B}${Y}`}else $=U.basename(J);let Q=U.join(K,Z,$);await R(U.dirname(Q),{recursive:!0});try{let B=await N(Q);if(B.byteLength>0)return console.log(`Loaded from cache: ${Q} (${J})`),{content:B,filePath:Q}}catch(B){}try{console.log(`Downloading from URL: ${J}`);let B=await fetch(J);if(!B.ok)return{error:`Failed to fetch from ${J}: ${B.statusText}`};let G=Buffer.from(await B.arrayBuffer());try{await k(Q,Buffer.from(G)),console.log(`Cached: ${J}`)}catch(v){console.warn(`Failed to cache: ${v}`)}return{content:G,filePath:Q}}catch(B){return{error:`Error downloading from ${J}: ${B}`}}}else try{return console.log(`Loading from local path: ${J}`),{content:await N(J),filePath:J}}catch($){return{error:`Error loading from local path ${J}: ${$}`}}}static async downloadToPath(J,K){let Z=J.startsWith("http://")||J.startsWith("https://");if(await R(U.dirname(K),{recursive:!0}),Z)try{console.log(`Downloading from URL: ${J}`);let Y=await fetch(J);if(!Y.ok)return{error:`Failed to fetch from ${J}: ${Y.statusText}`};let X=Buffer.from(await Y.arrayBuffer());return await k(K,Buffer.from(X)),console.log(`Downloaded: ${J} -> ${K}`),{content:X,filePath:K}}catch(Y){return{error:`Error downloading from ${J}: ${Y}`}}else try{console.log(`Copying from local path: ${J}`);let Y=await N(J);return await k(K,Buffer.from(Y)),{content:Y,filePath:K}}catch(Y){return{error:`Error copying from local path ${J}: ${Y}`}}}static async fetchHighlightQueries(J,K,Z){let Y=J.map((z)=>this.fetchHighlightQuery(z,K,Z));return(await Promise.all(Y)).filter((z)=>z.trim().length>0).join(`
3
- `)}static async fetchHighlightQuery(J,K,Z){let Y=await this.downloadOrLoad(J,K,"queries",".scm",!0,Z);if(Y.error)return console.error(`Error fetching highlight query from ${J}:`,Y.error),"";if(Y.content)return new TextDecoder().decode(Y.content);return""}}function f(J){return J.includes("$bunfs")||/^B:[\\/]~BUN/i.test(J)}function u(){return process.platform==="win32"?"B:\\~BUN\\root":"/$bunfs/root"}function g(J){return h(u(),P(J))}function o({onlyFirst:J=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",J?void 0:"g")}var s=o();function b(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(s,"")}function n(J){return J===161||J===164||J===167||J===168||J===170||J===173||J===174||J>=176&&J<=180||J>=182&&J<=186||J>=188&&J<=191||J===198||J===208||J===215||J===216||J>=222&&J<=225||J===230||J>=232&&J<=234||J===236||J===237||J===240||J===242||J===243||J>=247&&J<=250||J===252||J===254||J===257||J===273||J===275||J===283||J===294||J===295||J===299||J>=305&&J<=307||J===312||J>=319&&J<=322||J===324||J>=328&&J<=331||J===333||J===338||J===339||J===358||J===359||J===363||J===462||J===464||J===466||J===468||J===470||J===472||J===474||J===476||J===593||J===609||J===708||J===711||J>=713&&J<=715||J===717||J===720||J>=728&&J<=731||J===733||J===735||J>=768&&J<=879||J>=913&&J<=929||J>=931&&J<=937||J>=945&&J<=961||J>=963&&J<=969||J===1025||J>=1040&&J<=1103||J===1105||J===8208||J>=8211&&J<=8214||J===8216||J===8217||J===8220||J===8221||J>=8224&&J<=8226||J>=8228&&J<=8231||J===8240||J===8242||J===8243||J===8245||J===8251||J===8254||J===8308||J===8319||J>=8321&&J<=8324||J===8364||J===8451||J===8453||J===8457||J===8467||J===8470||J===8481||J===8482||J===8486||J===8491||J===8531||J===8532||J>=8539&&J<=8542||J>=8544&&J<=8555||J>=8560&&J<=8569||J===8585||J>=8592&&J<=8601||J===8632||J===8633||J===8658||J===8660||J===8679||J===8704||J===8706||J===8707||J===8711||J===8712||J===8715||J===8719||J===8721||J===8725||J===8730||J>=8733&&J<=8736||J===8739||J===8741||J>=8743&&J<=8748||J===8750||J>=8756&&J<=8759||J===8764||J===8765||J===8776||J===8780||J===8786||J===8800||J===8801||J>=8804&&J<=8807||J===8810||J===8811||J===8814||J===8815||J===8834||J===8835||J===8838||J===8839||J===8853||J===8857||J===8869||J===8895||J===8978||J>=9312&&J<=9449||J>=9451&&J<=9547||J>=9552&&J<=9587||J>=9600&&J<=9615||J>=9618&&J<=9621||J===9632||J===9633||J>=9635&&J<=9641||J===9650||J===9651||J===9654||J===9655||J===9660||J===9661||J===9664||J===9665||J>=9670&&J<=9672||J===9675||J>=9678&&J<=9681||J>=9698&&J<=9701||J===9711||J===9733||J===9734||J===9737||J===9742||J===9743||J===9756||J===9758||J===9792||J===9794||J===9824||J===9825||J>=9827&&J<=9829||J>=9831&&J<=9834||J===9836||J===9837||J===9839||J===9886||J===9887||J===9919||J>=9926&&J<=9933||J>=9935&&J<=9939||J>=9941&&J<=9953||J===9955||J===9960||J===9961||J>=9963&&J<=9969||J===9972||J>=9974&&J<=9977||J===9979||J===9980||J===9982||J===9983||J===10045||J>=10102&&J<=10111||J>=11094&&J<=11097||J>=12872&&J<=12879||J>=57344&&J<=63743||J>=65024&&J<=65039||J===65533||J>=127232&&J<=127242||J>=127248&&J<=127277||J>=127280&&J<=127337||J>=127344&&J<=127373||J===127375||J===127376||J>=127387&&J<=127404||J>=917760&&J<=917999||J>=983040&&J<=1048573||J>=1048576&&J<=1114109}function i(J){return J===12288||J>=65281&&J<=65376||J>=65504&&J<=65510}function r(J){return J>=4352&&J<=4447||J===8986||J===8987||J===9001||J===9002||J>=9193&&J<=9196||J===9200||J===9203||J===9725||J===9726||J===9748||J===9749||J>=9776&&J<=9783||J>=9800&&J<=9811||J===9855||J>=9866&&J<=9871||J===9875||J===9889||J===9898||J===9899||J===9917||J===9918||J===9924||J===9925||J===9934||J===9940||J===9962||J===9970||J===9971||J===9973||J===9978||J===9981||J===9989||J===9994||J===9995||J===10024||J===10060||J===10062||J>=10067&&J<=10069||J===10071||J>=10133&&J<=10135||J===10160||J===10175||J===11035||J===11036||J===11088||J===11093||J>=11904&&J<=11929||J>=11931&&J<=12019||J>=12032&&J<=12245||J>=12272&&J<=12287||J>=12289&&J<=12350||J>=12353&&J<=12438||J>=12441&&J<=12543||J>=12549&&J<=12591||J>=12593&&J<=12686||J>=12688&&J<=12773||J>=12783&&J<=12830||J>=12832&&J<=12871||J>=12880&&J<=42124||J>=42128&&J<=42182||J>=43360&&J<=43388||J>=44032&&J<=55203||J>=63744&&J<=64255||J>=65040&&J<=65049||J>=65072&&J<=65106||J>=65108&&J<=65126||J>=65128&&J<=65131||J>=94176&&J<=94180||J>=94192&&J<=94198||J>=94208&&J<=101589||J>=101631&&J<=101662||J>=101760&&J<=101874||J>=110576&&J<=110579||J>=110581&&J<=110587||J===110589||J===110590||J>=110592&&J<=110882||J===110898||J>=110928&&J<=110930||J===110933||J>=110948&&J<=110951||J>=110960&&J<=111355||J>=119552&&J<=119638||J>=119648&&J<=119670||J===126980||J===127183||J===127374||J>=127377&&J<=127386||J>=127488&&J<=127490||J>=127504&&J<=127547||J>=127552&&J<=127560||J===127568||J===127569||J>=127584&&J<=127589||J>=127744&&J<=127776||J>=127789&&J<=127797||J>=127799&&J<=127868||J>=127870&&J<=127891||J>=127904&&J<=127946||J>=127951&&J<=127955||J>=127968&&J<=127984||J===127988||J>=127992&&J<=128062||J===128064||J>=128066&&J<=128252||J>=128255&&J<=128317||J>=128331&&J<=128334||J>=128336&&J<=128359||J===128378||J===128405||J===128406||J===128420||J>=128507&&J<=128591||J>=128640&&J<=128709||J===128716||J>=128720&&J<=128722||J>=128725&&J<=128728||J>=128732&&J<=128735||J===128747||J===128748||J>=128756&&J<=128764||J>=128992&&J<=129003||J===129008||J>=129292&&J<=129338||J>=129340&&J<=129349||J>=129351&&J<=129535||J>=129648&&J<=129660||J>=129664&&J<=129674||J>=129678&&J<=129734||J===129736||J>=129741&&J<=129756||J>=129759&&J<=129770||J>=129775&&J<=129784||J>=131072&&J<=196605||J>=196608&&J<=262141}function a(J){if(!Number.isSafeInteger(J))throw TypeError(`Expected a code point, got \`${typeof J}\`.`)}function t(J,{ambiguousAsWide:K=!1}={}){if(a(J),i(J)||r(J)||K&&n(J))return 2;return 1}var x=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g},e=new Intl.Segmenter,JJ=/^\p{Default_Ignorable_Code_Point}$/u;function KJ(J,K={}){if(typeof J!=="string"||J.length===0)return 0;let{ambiguousIsNarrow:Z=!0,countAnsiEscapeCodes:Y=!1}=K;if(!Y)J=b(J);if(J.length===0)return 0;let X=0,V={ambiguousAsWide:!Z};for(let{segment:z}of e.segment(J)){let $=z.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(JJ.test(z))continue;if(x().test(z)){X+=2;continue}X+=t($,V)}return X}var YJ=new TextEncoder,C=globalThis.Bun,AJ=C?.sleep??$J,vJ=C?.stringWidth??KJ,OJ=C?.stripANSI??b,MJ=C?.write??XJ;async function ZJ(J,K,Z){if(!C){let X=typeof K==="function"?K():K;return H(X instanceof URL?X:new URL(X,Z))}let Y=(await J()).default;if(Y.startsWith("file:"))return H(Y);if(c(Y))return Y;return l(j(H(Z)),Y)}function $J(J){let K=J instanceof Date?J.getTime()-Date.now():J;return new Promise((Z)=>setTimeout(Z,K))}async function XJ(J,K,Z){let Y=J instanceof URL?H(J):J;if(Z?.createPath)await p(j(Y),{recursive:!0});let X=typeof K==="string"?YJ.encode(K):new Uint8Array(K.buffer,K.byteOffset,K.byteLength);return await d(Y,X,{mode:Z?.mode}),X.byteLength}var A=globalThis;class S{bufferParsers=new Map;filetypeParserOptions=new Map;filetypeAliases=new Map;filetypeParsers=new Map;filetypeParserPromises=new Map;reusableParsers=new Map;reusableParserPromises=new Map;initializePromise;performance;dataPath;tsDataPath;initialized=!1;constructor(){this.performance={averageParseTime:0,parseTimes:[],averageQueryTime:0,queryTimes:[]}}async fetchQueries(J,K){if(!this.tsDataPath)return"";return w.fetchHighlightQueries(J,this.tsDataPath,K)}async initialize({dataPath:J}){if(this.initializePromise)return this.initializePromise;return this.initializePromise=(async()=>{this.dataPath=J,this.tsDataPath=M.join(J,"tree-sitter"),await W(M.join(this.tsDataPath,"languages"),{recursive:!0}),await W(M.join(this.tsDataPath,"queries"),{recursive:!0});let K=await ZJ(()=>import("./chunk-j59ktwny.js",{with:{type:"wasm"}}),()=>import.meta.resolve("web-tree-sitter/tree-sitter.wasm"),import.meta.url);if(f(K))K=g(M.parse(K).base);await D.init({locateFile(){return K}}),this.initialized=!0})(),this.initializePromise}addFiletypeParser(J){let K=this.filetypeParserOptions.get(J.filetype)?.aliases??[];for(let Y of K)if(this.filetypeAliases.get(Y)===J.filetype)this.filetypeAliases.delete(Y);let Z=[...new Set((J.aliases??[]).filter((Y)=>Y!==J.filetype))];this.filetypeAliases.delete(J.filetype),this.filetypeParserOptions.set(J.filetype,{...J,aliases:Z});for(let Y of Z)this.filetypeAliases.set(Y,J.filetype);this.invalidateParserCaches(J.filetype)}resolveCanonicalFiletype(J){if(this.filetypeParserOptions.has(J))return J;return this.filetypeAliases.get(J)??J}invalidateParserCaches(J){this.filetypeParsers.delete(J),this.filetypeParserPromises.delete(J);let K=this.reusableParsers.get(J);if(K)K.parser.delete(),this.reusableParsers.delete(J);this.reusableParserPromises.delete(J)}async createQueries(J,K){try{let Z=await this.fetchQueries(J.queries.highlights,J.filetype);if(!Z){console.error("Failed to fetch highlight queries for:",J.filetype);return}let X={highlights:new L(K,Z)};if(J.queries.injections&&J.queries.injections.length>0){let V=await this.fetchQueries(J.queries.injections,J.filetype);if(V)X.injections=new L(K,V)}return X}catch(Z){console.error("Error creating queries for",J.filetype,J.queries),console.error(Z);return}}async loadLanguage(J){if(!this.initialized||!this.tsDataPath)return;let K=await w.downloadOrLoad(J,this.tsDataPath,"languages",".wasm",!1);if(K.error){console.error(`Error loading language ${J}:`,K.error);return}if(!K.filePath)return;let Z=K.filePath.replaceAll("\\","/");try{return await I.load(Z)}catch(Y){console.error(`Error loading language from ${Z}:`,Y);return}}async resolveFiletypeParser(J){let K=this.resolveCanonicalFiletype(J);if(this.filetypeParsers.has(K))return this.filetypeParsers.get(K);if(this.filetypeParserPromises.has(K))return this.filetypeParserPromises.get(K);let Z=this.loadFiletypeParser(K);this.filetypeParserPromises.set(K,Z);try{let Y=await Z;if(Y)this.filetypeParsers.set(K,Y);return Y}finally{this.filetypeParserPromises.delete(K)}}async loadFiletypeParser(J){let K=this.filetypeParserOptions.get(J);if(!K)return;let Z=await this.loadLanguage(K.wasm);if(!Z)return;let Y=await this.createQueries(K,Z);if(!Y){console.error("Failed to create queries for:",J);return}return{...K,queries:Y,language:Z}}async preloadParser(J){return this.resolveFiletypeParser(J)}async getReusableParser(J){let K=this.resolveCanonicalFiletype(J);if(this.reusableParsers.has(K))return this.reusableParsers.get(K);if(this.reusableParserPromises.has(K))return this.reusableParserPromises.get(K);let Z=this.createReusableParser(K);this.reusableParserPromises.set(K,Z);try{let Y=await Z;if(Y)this.reusableParsers.set(K,Y);return Y}finally{this.reusableParserPromises.delete(K)}}async createReusableParser(J){let K=await this.resolveFiletypeParser(J);if(!K)return;let Z=new D;return Z.setLanguage(K.language),{parser:Z,filetypeParser:K,queries:K.queries}}async handleInitializeParser(J,K,Z,Y,X){let V=await this.resolveFiletypeParser(Y);if(!V){A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!1,warning:`No parser available for filetype ${Y}`});return}let z=new D;z.setLanguage(V.language);let $=z.parse(Z);if(!$){A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!1,error:"Failed to parse buffer"});return}let Q={parser:z,tree:$,queries:V.queries,filetype:Y,content:Z,injectionMapping:V.injectionMapping};this.bufferParsers.set(J,Q),A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!0});let B=await this.initialQuery(Q);A.postMessage({type:"HIGHLIGHT_RESPONSE",bufferId:J,version:K,...B})}async initialQuery(J){let Z=J.queries.highlights.captures(J.tree.rootNode),Y=new Map;if(J.queries.injections){let X=await this.processInjections(J);Z.push(...X.captures),Y=X.injectionRanges}return this.getHighlights(J,Z,Y)}getNodeText(J,K){return K.substring(J.startIndex,J.endIndex)}async processInjections(J){let K=[],Z=new Map;if(!J.queries.injections)return{captures:K,injectionRanges:Z};let Y=J.content,X=J.queries.injections.captures(J.tree.rootNode),V=new Map,z=J.injectionMapping;for(let $ of X){let Q=$.name;if(Q==="injection.content"||Q.includes("injection")){let B=$.node.type,G;if(z?.nodeTypes&&z.nodeTypes[B])G=z.nodeTypes[B];else if(B==="code_fence_content"){let v=$.node.parent;if(v){let O=v.children.find((E)=>E.type==="info_string");if(O){let E=O.children.find((q)=>q.type==="language");if(E){let q=this.getNodeText(E,Y);if(z?.infoStringMap&&z.infoStringMap[q])G=z.infoStringMap[q];else G=q}}}}if(G){if(!V.has(G))V.set(G,[]);V.get(G).push({node:$.node,name:$.name})}}}for(let[$,Q]of V.entries()){let B=await this.getReusableParser($);if(!B){console.warn(`No parser found for injection language: ${$}`);continue}if(!Z.has($))Z.set($,[]);let G=B.parser;for(let{node:v}of Q)try{Z.get($).push({start:v.startIndex,end:v.endIndex});let O=this.getNodeText(v,Y),E=G.parse(O);if(E){let q=B.queries.highlights.captures(E.rootNode);for(let _ of q){let T={name:_.name,patternIndex:_.patternIndex,_injectedQuery:B.queries.highlights,node:{..._.node,startPosition:{row:_.node.startPosition.row+v.startPosition.row,column:_.node.startPosition.row===0?_.node.startPosition.column+v.startPosition.column:_.node.startPosition.column},endPosition:{row:_.node.endPosition.row+v.startPosition.row,column:_.node.endPosition.row===0?_.node.endPosition.column+v.startPosition.column:_.node.endPosition.column},startIndex:_.node.startIndex+v.startIndex,endIndex:_.node.endIndex+v.startIndex}};K.push(T)}E.delete()}}catch(O){console.error(`Error processing injection for language ${$}:`,O)}}return{captures:K,injectionRanges:Z}}editToRange(J){return{startPosition:{column:J.startPosition.column,row:J.startPosition.row},endPosition:{column:J.newEndPosition.column,row:J.newEndPosition.row},startIndex:J.startIndex,endIndex:J.newEndIndex}}async handleEdits(J,K,Z){let Y=this.bufferParsers.get(J);if(!Y)return{warning:"No parser state found for buffer"};Y.content=K;for(let q of Z)Y.tree.edit(q);let X=performance.now(),V=Y.parser.parse(K,Y.tree),$=performance.now()-X;if(this.performance.parseTimes.push($),this.performance.parseTimes.length>10)this.performance.parseTimes.shift();if(this.performance.averageParseTime=this.performance.parseTimes.reduce((q,_)=>q+_,0)/this.performance.parseTimes.length,!V)return{error:"Failed to parse buffer"};let Q=Y.tree.getChangedRanges(V);Y.tree=V;let B=performance.now(),G=[];if(Q.length===0)Z.forEach((q)=>{let _=this.editToRange(q);Q.push(_)});for(let q of Q){let _=Y.tree.rootNode.descendantForPosition(q.startPosition,q.endPosition);if(!_)continue;if(_.equals(Y.tree.rootNode)){let m=Y.queries.highlights.captures(_,{startIndex:q.startIndex-100,endIndex:q.endIndex+1000});G.push(...m);continue}while(_&&!this.nodeContainsRange(_,q))_=_.parent;if(!_)_=Y.tree.rootNode;let T=Y.queries.highlights.captures(_);G.push(...T)}let v=new Map;if(Y.queries.injections){let q=await this.processInjections(Y);G.push(...q.captures),v=q.injectionRanges}let E=performance.now()-B;if(this.performance.queryTimes.push(E),this.performance.queryTimes.length>10)this.performance.queryTimes.shift();return this.performance.averageQueryTime=this.performance.queryTimes.reduce((q,_)=>q+_,0)/this.performance.queryTimes.length,this.getHighlights(Y,G,v)}nodeContainsRange(J,K){return J.startPosition.row<=K.startPosition.row&&J.endPosition.row>=K.endPosition.row&&(J.startPosition.row<K.startPosition.row||J.startPosition.column<=K.startPosition.column)&&(J.endPosition.row>K.endPosition.row||J.endPosition.column>=K.endPosition.column)}getHighlights(J,K,Z){let Y=new Map,X=new Map;for(let V of K){let z=V.node,$=z.startPosition.row,Q=z.endPosition.row,B={startCol:z.startPosition.column,endCol:z.endPosition.column,group:V.name};if(!Y.has($))Y.set($,new Map),X.set($,new Map);if(Y.get($)?.has(z.id))X.get($)?.set(z.id,Y.get($)?.get(z.id));if(Y.get($)?.set(z.id,B),$!==Q)for(let G=$+1;G<=Q;G++){if(!Y.has(G))Y.set(G,new Map);let v={startCol:0,endCol:z.endPosition.column,group:V.name};Y.get(G)?.set(z.id,v)}}return{highlights:Array.from(Y.entries()).map(([V,z])=>({line:V,highlights:Array.from(z.values()),droppedHighlights:X.get(V)?Array.from(X.get(V).values()):[]}))}}getSimpleHighlights(J,K){let Z=[],Y=[];for(let[X,V]of K.entries())for(let z of V)Y.push({...z,lang:X});for(let X of J){let V=X.node,z=!1,$,Q=!1;for(let q of Y)if(V.startIndex>=q.start&&V.endIndex<=q.end){z=!0,$=q.lang;break}else if(V.startIndex<=q.start&&V.endIndex>=q.end){Q=!0;break}let G=X._injectedQuery?.setProperties?.[X.patternIndex],v=G?.conceal??X.setProperties?.conceal,O=G?.conceal_lines??X.setProperties?.conceal_lines,E={};if(z&&$)E.isInjection=!0,E.injectionLang=$;if(Q)E.containsInjection=!0;if(v!==void 0)E.conceal=v;if(O!==void 0)E.concealLines=O;if(Object.keys(E).length>0)Z.push([V.startIndex,V.endIndex,X.name,E]);else Z.push([V.startIndex,V.endIndex,X.name])}return Z.sort((X,V)=>X[0]-V[0]),Z}async handleResetBuffer(J,K,Z){let Y=this.bufferParsers.get(J);if(!Y)return{warning:"No parser state found for buffer"};Y.content=Z;let X=Y.parser.parse(Z);if(!X)return{error:"Failed to parse buffer during reset"};Y.tree=X;let V=Y.queries.highlights.captures(Y.tree.rootNode),z=new Map;if(Y.queries.injections){let $=await this.processInjections(Y);V.push(...$.captures),z=$.injectionRanges}return this.getHighlights(Y,V,z)}disposeBuffer(J){let K=this.bufferParsers.get(J);if(!K)return;K.tree.delete(),K.parser.delete(),this.bufferParsers.delete(J)}async handleOneShotHighlight(J,K,Z){let Y=await this.getReusableParser(K);if(!Y){A.postMessage({type:"ONESHOT_HIGHLIGHT_RESPONSE",messageId:Z,hasParser:!1,warning:`No parser available for filetype ${K}`});return}let X=K==="markdown"&&J.endsWith("```")?J+`
2
+ import{uO as L,vO as I,yO as D}from"./chunk-dxpj0cxh.js";import{FO as F}from"./chunk-7xm75w1e.js";import{mkdir as W}from"fs/promises";import*as M from"path";import{mkdir as R,readFile as N,writeFile as k}from"fs/promises";import*as U from"path";import{isMainThread as y}from"worker_threads";import{basename as P,join as h}from"path";import{mkdir as p,writeFile as d}from"fs/promises";import{dirname as j,isAbsolute as c,resolve as l}from"path";import{fileURLToPath as H}from"url";class w{static hashUrl(J){let K=0;for(let Z=0;Z<J.length;Z++){let Y=J.charCodeAt(Z);K=(K<<5)-K+Y,K=K&K}return Math.abs(K).toString(16)}static async downloadOrLoad(J,K,Z,Y,X=!0,V){if(J.startsWith("http://")||J.startsWith("https://")){let $;if(X){let B=this.hashUrl(J);$=V?`${V}-${B}${Y}`:`${B}${Y}`}else $=U.basename(J);let Q=U.join(K,Z,$);await R(U.dirname(Q),{recursive:!0});try{let B=await N(Q);if(B.byteLength>0)return console.log(`Loaded from cache: ${Q} (${J})`),{content:B,filePath:Q}}catch(B){}try{console.log(`Downloading from URL: ${J}`);let B=await fetch(J);if(!B.ok)return{error:`Failed to fetch from ${J}: ${B.statusText}`};let G=Buffer.from(await B.arrayBuffer());try{await k(Q,Buffer.from(G)),console.log(`Cached: ${J}`)}catch(v){console.warn(`Failed to cache: ${v}`)}return{content:G,filePath:Q}}catch(B){return{error:`Error downloading from ${J}: ${B}`}}}else try{return console.log(`Loading from local path: ${J}`),{content:await N(J),filePath:J}}catch($){return{error:`Error loading from local path ${J}: ${$}`}}}static async downloadToPath(J,K){let Z=J.startsWith("http://")||J.startsWith("https://");if(await R(U.dirname(K),{recursive:!0}),Z)try{console.log(`Downloading from URL: ${J}`);let Y=await fetch(J);if(!Y.ok)return{error:`Failed to fetch from ${J}: ${Y.statusText}`};let X=Buffer.from(await Y.arrayBuffer());return await k(K,Buffer.from(X)),console.log(`Downloaded: ${J} -> ${K}`),{content:X,filePath:K}}catch(Y){return{error:`Error downloading from ${J}: ${Y}`}}else try{console.log(`Copying from local path: ${J}`);let Y=await N(J);return await k(K,Buffer.from(Y)),{content:Y,filePath:K}}catch(Y){return{error:`Error copying from local path ${J}: ${Y}`}}}static async fetchHighlightQueries(J,K,Z){let Y=J.map((z)=>this.fetchHighlightQuery(z,K,Z));return(await Promise.all(Y)).filter((z)=>z.trim().length>0).join(`
3
+ `)}static async fetchHighlightQuery(J,K,Z){let Y=await this.downloadOrLoad(J,K,"queries",".scm",!0,Z);if(Y.error)return console.error(`Error fetching highlight query from ${J}:`,Y.error),"";if(Y.content)return new TextDecoder().decode(Y.content);return""}}function f(J){return J.includes("$bunfs")||/^B:[\\/]~BUN/i.test(J)}function u(){return process.platform==="win32"?"B:\\~BUN\\root":"/$bunfs/root"}function g(J){return h(u(),P(J))}function o({onlyFirst:J=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",J?void 0:"g")}var s=o();function b(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(s,"")}function n(J){return J===161||J===164||J===167||J===168||J===170||J===173||J===174||J>=176&&J<=180||J>=182&&J<=186||J>=188&&J<=191||J===198||J===208||J===215||J===216||J>=222&&J<=225||J===230||J>=232&&J<=234||J===236||J===237||J===240||J===242||J===243||J>=247&&J<=250||J===252||J===254||J===257||J===273||J===275||J===283||J===294||J===295||J===299||J>=305&&J<=307||J===312||J>=319&&J<=322||J===324||J>=328&&J<=331||J===333||J===338||J===339||J===358||J===359||J===363||J===462||J===464||J===466||J===468||J===470||J===472||J===474||J===476||J===593||J===609||J===708||J===711||J>=713&&J<=715||J===717||J===720||J>=728&&J<=731||J===733||J===735||J>=768&&J<=879||J>=913&&J<=929||J>=931&&J<=937||J>=945&&J<=961||J>=963&&J<=969||J===1025||J>=1040&&J<=1103||J===1105||J===8208||J>=8211&&J<=8214||J===8216||J===8217||J===8220||J===8221||J>=8224&&J<=8226||J>=8228&&J<=8231||J===8240||J===8242||J===8243||J===8245||J===8251||J===8254||J===8308||J===8319||J>=8321&&J<=8324||J===8364||J===8451||J===8453||J===8457||J===8467||J===8470||J===8481||J===8482||J===8486||J===8491||J===8531||J===8532||J>=8539&&J<=8542||J>=8544&&J<=8555||J>=8560&&J<=8569||J===8585||J>=8592&&J<=8601||J===8632||J===8633||J===8658||J===8660||J===8679||J===8704||J===8706||J===8707||J===8711||J===8712||J===8715||J===8719||J===8721||J===8725||J===8730||J>=8733&&J<=8736||J===8739||J===8741||J>=8743&&J<=8748||J===8750||J>=8756&&J<=8759||J===8764||J===8765||J===8776||J===8780||J===8786||J===8800||J===8801||J>=8804&&J<=8807||J===8810||J===8811||J===8814||J===8815||J===8834||J===8835||J===8838||J===8839||J===8853||J===8857||J===8869||J===8895||J===8978||J>=9312&&J<=9449||J>=9451&&J<=9547||J>=9552&&J<=9587||J>=9600&&J<=9615||J>=9618&&J<=9621||J===9632||J===9633||J>=9635&&J<=9641||J===9650||J===9651||J===9654||J===9655||J===9660||J===9661||J===9664||J===9665||J>=9670&&J<=9672||J===9675||J>=9678&&J<=9681||J>=9698&&J<=9701||J===9711||J===9733||J===9734||J===9737||J===9742||J===9743||J===9756||J===9758||J===9792||J===9794||J===9824||J===9825||J>=9827&&J<=9829||J>=9831&&J<=9834||J===9836||J===9837||J===9839||J===9886||J===9887||J===9919||J>=9926&&J<=9933||J>=9935&&J<=9939||J>=9941&&J<=9953||J===9955||J===9960||J===9961||J>=9963&&J<=9969||J===9972||J>=9974&&J<=9977||J===9979||J===9980||J===9982||J===9983||J===10045||J>=10102&&J<=10111||J>=11094&&J<=11097||J>=12872&&J<=12879||J>=57344&&J<=63743||J>=65024&&J<=65039||J===65533||J>=127232&&J<=127242||J>=127248&&J<=127277||J>=127280&&J<=127337||J>=127344&&J<=127373||J===127375||J===127376||J>=127387&&J<=127404||J>=917760&&J<=917999||J>=983040&&J<=1048573||J>=1048576&&J<=1114109}function i(J){return J===12288||J>=65281&&J<=65376||J>=65504&&J<=65510}function r(J){return J>=4352&&J<=4447||J===8986||J===8987||J===9001||J===9002||J>=9193&&J<=9196||J===9200||J===9203||J===9725||J===9726||J===9748||J===9749||J>=9776&&J<=9783||J>=9800&&J<=9811||J===9855||J>=9866&&J<=9871||J===9875||J===9889||J===9898||J===9899||J===9917||J===9918||J===9924||J===9925||J===9934||J===9940||J===9962||J===9970||J===9971||J===9973||J===9978||J===9981||J===9989||J===9994||J===9995||J===10024||J===10060||J===10062||J>=10067&&J<=10069||J===10071||J>=10133&&J<=10135||J===10160||J===10175||J===11035||J===11036||J===11088||J===11093||J>=11904&&J<=11929||J>=11931&&J<=12019||J>=12032&&J<=12245||J>=12272&&J<=12287||J>=12289&&J<=12350||J>=12353&&J<=12438||J>=12441&&J<=12543||J>=12549&&J<=12591||J>=12593&&J<=12686||J>=12688&&J<=12773||J>=12783&&J<=12830||J>=12832&&J<=12871||J>=12880&&J<=42124||J>=42128&&J<=42182||J>=43360&&J<=43388||J>=44032&&J<=55203||J>=63744&&J<=64255||J>=65040&&J<=65049||J>=65072&&J<=65106||J>=65108&&J<=65126||J>=65128&&J<=65131||J>=94176&&J<=94180||J>=94192&&J<=94198||J>=94208&&J<=101589||J>=101631&&J<=101662||J>=101760&&J<=101874||J>=110576&&J<=110579||J>=110581&&J<=110587||J===110589||J===110590||J>=110592&&J<=110882||J===110898||J>=110928&&J<=110930||J===110933||J>=110948&&J<=110951||J>=110960&&J<=111355||J>=119552&&J<=119638||J>=119648&&J<=119670||J===126980||J===127183||J===127374||J>=127377&&J<=127386||J>=127488&&J<=127490||J>=127504&&J<=127547||J>=127552&&J<=127560||J===127568||J===127569||J>=127584&&J<=127589||J>=127744&&J<=127776||J>=127789&&J<=127797||J>=127799&&J<=127868||J>=127870&&J<=127891||J>=127904&&J<=127946||J>=127951&&J<=127955||J>=127968&&J<=127984||J===127988||J>=127992&&J<=128062||J===128064||J>=128066&&J<=128252||J>=128255&&J<=128317||J>=128331&&J<=128334||J>=128336&&J<=128359||J===128378||J===128405||J===128406||J===128420||J>=128507&&J<=128591||J>=128640&&J<=128709||J===128716||J>=128720&&J<=128722||J>=128725&&J<=128728||J>=128732&&J<=128735||J===128747||J===128748||J>=128756&&J<=128764||J>=128992&&J<=129003||J===129008||J>=129292&&J<=129338||J>=129340&&J<=129349||J>=129351&&J<=129535||J>=129648&&J<=129660||J>=129664&&J<=129674||J>=129678&&J<=129734||J===129736||J>=129741&&J<=129756||J>=129759&&J<=129770||J>=129775&&J<=129784||J>=131072&&J<=196605||J>=196608&&J<=262141}function a(J){if(!Number.isSafeInteger(J))throw TypeError(`Expected a code point, got \`${typeof J}\`.`)}function t(J,{ambiguousAsWide:K=!1}={}){if(a(J),i(J)||r(J)||K&&n(J))return 2;return 1}var x=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g},e=new Intl.Segmenter,JJ=/^\p{Default_Ignorable_Code_Point}$/u;function KJ(J,K={}){if(typeof J!=="string"||J.length===0)return 0;let{ambiguousIsNarrow:Z=!0,countAnsiEscapeCodes:Y=!1}=K;if(!Y)J=b(J);if(J.length===0)return 0;let X=0,V={ambiguousAsWide:!Z};for(let{segment:z}of e.segment(J)){let $=z.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(JJ.test(z))continue;if(x().test(z)){X+=2;continue}X+=t($,V)}return X}var YJ=new TextEncoder,C=globalThis.Bun,AJ=C?.sleep??$J,vJ=C?.stringWidth??KJ,OJ=C?.stripANSI??b,MJ=C?.write??XJ;async function ZJ(J,K,Z){if(!C){let X=typeof K==="function"?K():K;return H(X instanceof URL?X:new URL(X,Z))}let Y=(await J()).default;if(Y.startsWith("file:"))return H(Y);if(c(Y))return Y;return l(j(H(Z)),Y)}function $J(J){let K=J instanceof Date?J.getTime()-Date.now():J;return new Promise((Z)=>setTimeout(Z,K))}async function XJ(J,K,Z){let Y=J instanceof URL?H(J):J;if(Z?.createPath)await p(j(Y),{recursive:!0});let X=typeof K==="string"?YJ.encode(K):new Uint8Array(K.buffer,K.byteOffset,K.byteLength);return await d(Y,X,{mode:Z?.mode}),X.byteLength}var A=globalThis;class S{bufferParsers=new Map;filetypeParserOptions=new Map;filetypeAliases=new Map;filetypeParsers=new Map;filetypeParserPromises=new Map;reusableParsers=new Map;reusableParserPromises=new Map;initializePromise;performance;dataPath;tsDataPath;initialized=!1;constructor(){this.performance={averageParseTime:0,parseTimes:[],averageQueryTime:0,queryTimes:[]}}async fetchQueries(J,K){if(!this.tsDataPath)return"";return w.fetchHighlightQueries(J,this.tsDataPath,K)}async initialize({dataPath:J}){if(this.initializePromise)return this.initializePromise;return this.initializePromise=(async()=>{this.dataPath=J,this.tsDataPath=M.join(J,"tree-sitter"),await W(M.join(this.tsDataPath,"languages"),{recursive:!0}),await W(M.join(this.tsDataPath,"queries"),{recursive:!0});let K=await ZJ(()=>import("./chunk-hp7tssgv.js",{with:{type:"wasm"}}),()=>import.meta.resolve("web-tree-sitter/tree-sitter.wasm"),import.meta.url);if(f(K))K=g(M.parse(K).base);await D.init({locateFile(){return K}}),this.initialized=!0})(),this.initializePromise}addFiletypeParser(J){let K=this.filetypeParserOptions.get(J.filetype)?.aliases??[];for(let Y of K)if(this.filetypeAliases.get(Y)===J.filetype)this.filetypeAliases.delete(Y);let Z=[...new Set((J.aliases??[]).filter((Y)=>Y!==J.filetype))];this.filetypeAliases.delete(J.filetype),this.filetypeParserOptions.set(J.filetype,{...J,aliases:Z});for(let Y of Z)this.filetypeAliases.set(Y,J.filetype);this.invalidateParserCaches(J.filetype)}resolveCanonicalFiletype(J){if(this.filetypeParserOptions.has(J))return J;return this.filetypeAliases.get(J)??J}invalidateParserCaches(J){this.filetypeParsers.delete(J),this.filetypeParserPromises.delete(J);let K=this.reusableParsers.get(J);if(K)K.parser.delete(),this.reusableParsers.delete(J);this.reusableParserPromises.delete(J)}async createQueries(J,K){try{let Z=await this.fetchQueries(J.queries.highlights,J.filetype);if(!Z){console.error("Failed to fetch highlight queries for:",J.filetype);return}let X={highlights:new L(K,Z)};if(J.queries.injections&&J.queries.injections.length>0){let V=await this.fetchQueries(J.queries.injections,J.filetype);if(V)X.injections=new L(K,V)}return X}catch(Z){console.error("Error creating queries for",J.filetype,J.queries),console.error(Z);return}}async loadLanguage(J){if(!this.initialized||!this.tsDataPath)return;let K=await w.downloadOrLoad(J,this.tsDataPath,"languages",".wasm",!1);if(K.error){console.error(`Error loading language ${J}:`,K.error);return}if(!K.filePath)return;let Z=K.filePath.replaceAll("\\","/");try{return await I.load(Z)}catch(Y){console.error(`Error loading language from ${Z}:`,Y);return}}async resolveFiletypeParser(J){let K=this.resolveCanonicalFiletype(J);if(this.filetypeParsers.has(K))return this.filetypeParsers.get(K);if(this.filetypeParserPromises.has(K))return this.filetypeParserPromises.get(K);let Z=this.loadFiletypeParser(K);this.filetypeParserPromises.set(K,Z);try{let Y=await Z;if(Y)this.filetypeParsers.set(K,Y);return Y}finally{this.filetypeParserPromises.delete(K)}}async loadFiletypeParser(J){let K=this.filetypeParserOptions.get(J);if(!K)return;let Z=await this.loadLanguage(K.wasm);if(!Z)return;let Y=await this.createQueries(K,Z);if(!Y){console.error("Failed to create queries for:",J);return}return{...K,queries:Y,language:Z}}async preloadParser(J){return this.resolveFiletypeParser(J)}async getReusableParser(J){let K=this.resolveCanonicalFiletype(J);if(this.reusableParsers.has(K))return this.reusableParsers.get(K);if(this.reusableParserPromises.has(K))return this.reusableParserPromises.get(K);let Z=this.createReusableParser(K);this.reusableParserPromises.set(K,Z);try{let Y=await Z;if(Y)this.reusableParsers.set(K,Y);return Y}finally{this.reusableParserPromises.delete(K)}}async createReusableParser(J){let K=await this.resolveFiletypeParser(J);if(!K)return;let Z=new D;return Z.setLanguage(K.language),{parser:Z,filetypeParser:K,queries:K.queries}}async handleInitializeParser(J,K,Z,Y,X){let V=await this.resolveFiletypeParser(Y);if(!V){A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!1,warning:`No parser available for filetype ${Y}`});return}let z=new D;z.setLanguage(V.language);let $=z.parse(Z);if(!$){A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!1,error:"Failed to parse buffer"});return}let Q={parser:z,tree:$,queries:V.queries,filetype:Y,content:Z,injectionMapping:V.injectionMapping};this.bufferParsers.set(J,Q),A.postMessage({type:"PARSER_INIT_RESPONSE",bufferId:J,messageId:X,hasParser:!0});let B=await this.initialQuery(Q);A.postMessage({type:"HIGHLIGHT_RESPONSE",bufferId:J,version:K,...B})}async initialQuery(J){let Z=J.queries.highlights.captures(J.tree.rootNode),Y=new Map;if(J.queries.injections){let X=await this.processInjections(J);Z.push(...X.captures),Y=X.injectionRanges}return this.getHighlights(J,Z,Y)}getNodeText(J,K){return K.substring(J.startIndex,J.endIndex)}async processInjections(J){let K=[],Z=new Map;if(!J.queries.injections)return{captures:K,injectionRanges:Z};let Y=J.content,X=J.queries.injections.captures(J.tree.rootNode),V=new Map,z=J.injectionMapping;for(let $ of X){let Q=$.name;if(Q==="injection.content"||Q.includes("injection")){let B=$.node.type,G;if(z?.nodeTypes&&z.nodeTypes[B])G=z.nodeTypes[B];else if(B==="code_fence_content"){let v=$.node.parent;if(v){let O=v.children.find((E)=>E.type==="info_string");if(O){let E=O.children.find((q)=>q.type==="language");if(E){let q=this.getNodeText(E,Y);if(z?.infoStringMap&&z.infoStringMap[q])G=z.infoStringMap[q];else G=q}}}}if(G){if(!V.has(G))V.set(G,[]);V.get(G).push({node:$.node,name:$.name})}}}for(let[$,Q]of V.entries()){let B=await this.getReusableParser($);if(!B){console.warn(`No parser found for injection language: ${$}`);continue}if(!Z.has($))Z.set($,[]);let G=B.parser;for(let{node:v}of Q)try{Z.get($).push({start:v.startIndex,end:v.endIndex});let O=this.getNodeText(v,Y),E=G.parse(O);if(E){let q=B.queries.highlights.captures(E.rootNode);for(let _ of q){let T={name:_.name,patternIndex:_.patternIndex,_injectedQuery:B.queries.highlights,node:{..._.node,startPosition:{row:_.node.startPosition.row+v.startPosition.row,column:_.node.startPosition.row===0?_.node.startPosition.column+v.startPosition.column:_.node.startPosition.column},endPosition:{row:_.node.endPosition.row+v.startPosition.row,column:_.node.endPosition.row===0?_.node.endPosition.column+v.startPosition.column:_.node.endPosition.column},startIndex:_.node.startIndex+v.startIndex,endIndex:_.node.endIndex+v.startIndex}};K.push(T)}E.delete()}}catch(O){console.error(`Error processing injection for language ${$}:`,O)}}return{captures:K,injectionRanges:Z}}editToRange(J){return{startPosition:{column:J.startPosition.column,row:J.startPosition.row},endPosition:{column:J.newEndPosition.column,row:J.newEndPosition.row},startIndex:J.startIndex,endIndex:J.newEndIndex}}async handleEdits(J,K,Z){let Y=this.bufferParsers.get(J);if(!Y)return{warning:"No parser state found for buffer"};Y.content=K;for(let q of Z)Y.tree.edit(q);let X=performance.now(),V=Y.parser.parse(K,Y.tree),$=performance.now()-X;if(this.performance.parseTimes.push($),this.performance.parseTimes.length>10)this.performance.parseTimes.shift();if(this.performance.averageParseTime=this.performance.parseTimes.reduce((q,_)=>q+_,0)/this.performance.parseTimes.length,!V)return{error:"Failed to parse buffer"};let Q=Y.tree.getChangedRanges(V);Y.tree=V;let B=performance.now(),G=[];if(Q.length===0)Z.forEach((q)=>{let _=this.editToRange(q);Q.push(_)});for(let q of Q){let _=Y.tree.rootNode.descendantForPosition(q.startPosition,q.endPosition);if(!_)continue;if(_.equals(Y.tree.rootNode)){let m=Y.queries.highlights.captures(_,{startIndex:q.startIndex-100,endIndex:q.endIndex+1000});G.push(...m);continue}while(_&&!this.nodeContainsRange(_,q))_=_.parent;if(!_)_=Y.tree.rootNode;let T=Y.queries.highlights.captures(_);G.push(...T)}let v=new Map;if(Y.queries.injections){let q=await this.processInjections(Y);G.push(...q.captures),v=q.injectionRanges}let E=performance.now()-B;if(this.performance.queryTimes.push(E),this.performance.queryTimes.length>10)this.performance.queryTimes.shift();return this.performance.averageQueryTime=this.performance.queryTimes.reduce((q,_)=>q+_,0)/this.performance.queryTimes.length,this.getHighlights(Y,G,v)}nodeContainsRange(J,K){return J.startPosition.row<=K.startPosition.row&&J.endPosition.row>=K.endPosition.row&&(J.startPosition.row<K.startPosition.row||J.startPosition.column<=K.startPosition.column)&&(J.endPosition.row>K.endPosition.row||J.endPosition.column>=K.endPosition.column)}getHighlights(J,K,Z){let Y=new Map,X=new Map;for(let V of K){let z=V.node,$=z.startPosition.row,Q=z.endPosition.row,B={startCol:z.startPosition.column,endCol:z.endPosition.column,group:V.name};if(!Y.has($))Y.set($,new Map),X.set($,new Map);if(Y.get($)?.has(z.id))X.get($)?.set(z.id,Y.get($)?.get(z.id));if(Y.get($)?.set(z.id,B),$!==Q)for(let G=$+1;G<=Q;G++){if(!Y.has(G))Y.set(G,new Map);let v={startCol:0,endCol:z.endPosition.column,group:V.name};Y.get(G)?.set(z.id,v)}}return{highlights:Array.from(Y.entries()).map(([V,z])=>({line:V,highlights:Array.from(z.values()),droppedHighlights:X.get(V)?Array.from(X.get(V).values()):[]}))}}getSimpleHighlights(J,K){let Z=[],Y=[];for(let[X,V]of K.entries())for(let z of V)Y.push({...z,lang:X});for(let X of J){let V=X.node,z=!1,$,Q=!1;for(let q of Y)if(V.startIndex>=q.start&&V.endIndex<=q.end){z=!0,$=q.lang;break}else if(V.startIndex<=q.start&&V.endIndex>=q.end){Q=!0;break}let G=X._injectedQuery?.setProperties?.[X.patternIndex],v=G?.conceal??X.setProperties?.conceal,O=G?.conceal_lines??X.setProperties?.conceal_lines,E={};if(z&&$)E.isInjection=!0,E.injectionLang=$;if(Q)E.containsInjection=!0;if(v!==void 0)E.conceal=v;if(O!==void 0)E.concealLines=O;if(Object.keys(E).length>0)Z.push([V.startIndex,V.endIndex,X.name,E]);else Z.push([V.startIndex,V.endIndex,X.name])}return Z.sort((X,V)=>X[0]-V[0]),Z}async handleResetBuffer(J,K,Z){let Y=this.bufferParsers.get(J);if(!Y)return{warning:"No parser state found for buffer"};Y.content=Z;let X=Y.parser.parse(Z);if(!X)return{error:"Failed to parse buffer during reset"};Y.tree=X;let V=Y.queries.highlights.captures(Y.tree.rootNode),z=new Map;if(Y.queries.injections){let $=await this.processInjections(Y);V.push(...$.captures),z=$.injectionRanges}return this.getHighlights(Y,V,z)}disposeBuffer(J){let K=this.bufferParsers.get(J);if(!K)return;K.tree.delete(),K.parser.delete(),this.bufferParsers.delete(J)}async handleOneShotHighlight(J,K,Z){let Y=await this.getReusableParser(K);if(!Y){A.postMessage({type:"ONESHOT_HIGHLIGHT_RESPONSE",messageId:Z,hasParser:!1,warning:`No parser available for filetype ${K}`});return}let X=K==="markdown"&&J.endsWith("```")?J+`
4
4
  `:J,V=Y.parser.parse(X);if(!V){A.postMessage({type:"ONESHOT_HIGHLIGHT_RESPONSE",messageId:Z,hasParser:!1,error:"Failed to parse content"});return}try{let z=Y.filetypeParser.queries.highlights.captures(V.rootNode),$=new Map;if(Y.filetypeParser.queries.injections){let B={parser:Y.parser,tree:V,queries:Y.filetypeParser.queries,filetype:K,content:J,injectionMapping:Y.filetypeParser.injectionMapping},G=await this.processInjections(B);z.push(...G.captures),$=G.injectionRanges}let Q=this.getSimpleHighlights(z,$);A.postMessage({type:"ONESHOT_HIGHLIGHT_RESPONSE",messageId:Z,hasParser:!0,highlights:Q})}finally{V.delete()}}async updateDataPath(J){this.dataPath=J,this.tsDataPath=M.join(J,"tree-sitter");try{await W(M.join(this.tsDataPath,"languages"),{recursive:!0}),await W(M.join(this.tsDataPath,"queries"),{recursive:!0})}catch(K){throw Error(`Failed to update data path: ${K}`)}}async clearCache(){if(!this.dataPath||!this.tsDataPath)throw Error("No data path configured");let{rm:J}=await import("fs/promises");try{let K=M.join(this.dataPath,"tree-sitter");await J(K,{recursive:!0,force:!0}),await W(M.join(K,"languages"),{recursive:!0}),await W(M.join(K,"queries"),{recursive:!0}),this.filetypeParsers.clear(),this.filetypeParserPromises.clear(),this.reusableParsers.clear(),this.reusableParserPromises.clear()}catch(K){throw Error(`Failed to clear cache: ${K}`)}}}if(!y){let J=function(Z,...Y){A.postMessage({type:"WORKER_LOG",logType:Z,data:Y})},K=new S;console.log=(...Z)=>J("log",...Z),console.error=(...Z)=>J("error",...Z),console.warn=(...Z)=>J("warn",...Z),A.onmessage=async(Z)=>{let{type:Y,bufferId:X,version:V,content:z,filetype:$,edits:Q,filetypeParser:B,messageId:G,dataPath:v}=Z.data;try{switch(Y){case"INIT":try{await K.initialize({dataPath:v}),A.postMessage({type:"INIT_RESPONSE"})}catch(_){A.postMessage({type:"INIT_RESPONSE",error:_ instanceof Error?_.stack||_.message:String(_)})}break;case"ADD_FILETYPE_PARSER":K.addFiletypeParser(B);break;case"PRELOAD_PARSER":let O=await K.preloadParser($);A.postMessage({type:"PRELOAD_PARSER_RESPONSE",messageId:G,hasParser:!!O});break;case"INITIALIZE_PARSER":await K.handleInitializeParser(X,V,z,$,G);break;case"HANDLE_EDITS":let E=await K.handleEdits(X,z,Q);if(E.highlights&&E.highlights.length>0)A.postMessage({type:"HIGHLIGHT_RESPONSE",bufferId:X,version:V,...E});else if(E.warning)A.postMessage({type:"WARNING",bufferId:X,warning:E.warning});else if(E.error)A.postMessage({type:"ERROR",bufferId:X,error:E.error});break;case"GET_PERFORMANCE":A.postMessage({type:"PERFORMANCE_RESPONSE",performance:K.performance,messageId:G});break;case"RESET_BUFFER":let q=await K.handleResetBuffer(X,V,z);if(q.highlights&&q.highlights.length>0)A.postMessage({type:"HIGHLIGHT_RESPONSE",bufferId:X,version:V,...q});else if(q.warning)A.postMessage({type:"WARNING",bufferId:X,warning:q.warning});else if(q.error)A.postMessage({type:"ERROR",bufferId:X,error:q.error});break;case"DISPOSE_BUFFER":K.disposeBuffer(X),A.postMessage({type:"BUFFER_DISPOSED",bufferId:X});break;case"ONESHOT_HIGHLIGHT":await K.handleOneShotHighlight(z,$,G);break;case"UPDATE_DATA_PATH":try{await K.updateDataPath(v),A.postMessage({type:"UPDATE_DATA_PATH_RESPONSE",messageId:G})}catch(_){A.postMessage({type:"UPDATE_DATA_PATH_RESPONSE",messageId:G,error:_ instanceof Error?_.message:String(_)})}break;case"CLEAR_CACHE":try{await K.clearCache(),A.postMessage({type:"CLEAR_CACHE_RESPONSE",messageId:G})}catch(_){A.postMessage({type:"CLEAR_CACHE_RESPONSE",messageId:G,error:_ instanceof Error?_.message:String(_)})}break;default:A.postMessage({type:"ERROR",bufferId:X,error:`Unknown message type: ${Y}`})}}catch(O){A.postMessage({type:"ERROR",bufferId:X,error:O instanceof Error?O.stack||O.message:String(O)})}}}
package/bundle/worker.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xf as H}from"./chunk-svvgv1s0.js";import{ag as x}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{Xg as V,hh as O}from"./chunk-ddnpx1yx.js";import"./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{Dl as Z,Xj as Y}from"./chunk-pvpy9kq1.js";import{Fl as N}from"./chunk-wpajh5s5.js";import{Ql as C,lm as q}from"./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"./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"./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{pt as k}from"./chunk-hwbyqezq.js";import"./chunk-12bssxd4.js";import"./chunk-z8r65yw3.js";import{Yt as j,iu as z,pu as T,tt as X,wt as G,yu as W}from"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";var $=W.create({service:"upgrade"});function L(D,E){if(D===!1)return"disabled";if(D===!0&&E==="patch")return"install";return"notify"}async function M(){if(G)return;let D=await O.runPromise(Z.Service.use((J)=>J.getGlobal())),E=await O.runPromise(N.Service.use((J)=>J.method())),K=await O.runPromise(N.Service.use((J)=>J.latest(E))).catch((J)=>{$.warn("failed to check for updates",{method:E,error:String(J)})});if(!K)return;if(!N.isNewerVersion(X,K)){$.warn("ignoring non-newer update version",{current:X,latest:K});return}if(T.QITQODE_ALWAYS_NOTIFY_UPDATE){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(T.QITQODE_DISABLE_AUTOUPDATE)return;let _=N.getReleaseType(X,K),Q=L(D.autoupdate,_);if(Q==="disabled")return;if(Q==="notify"){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(E==="unknown")return;await O.runPromise(N.Service.use((J)=>J.upgrade(E,K))).then(()=>Y.publish(N.Event.Updated,{version:K})).catch((J)=>{$.warn("auto-upgrade failed",{method:E,target:K,error:String(J)})})}import{writeHeapSnapshot as P}from"v8";j("worker");await W.init({print:process.argv.includes("--print-logs"),dev:N.isLocal(),level:(()=>{if(N.isLocal())return"DEBUG";return"INFO"})()});H.start();k("worker");C.on("event",(D)=>{z.emit("global.event",D)});var U,S={async fetch(D){let E={...D.headers},K=w();if(K&&!E.authorization&&!E.Authorization)E.Authorization=K;let _=new Request(D.url,{method:D.method,headers:E,body:D.body}),Q=await x.Default().app.fetch(_),J=await Q.text();return{status:Q.status,headers:Object.fromEntries(Q.headers.entries()),body:J}},snapshot(){return P("server.heapsnapshot")},async server(D){if(U)await U.stop(!0);return U=await x.listen(D),{url:U.url.toString()}},async checkUpgrade(D){await q.provide({directory:D.directory,init:()=>O.runPromise(V),fn:async()=>{await M().catch(()=>{})}})},async reload(){await O.runPromise(Z.Service.use((D)=>D.invalidate(!0)))},async shutdown(){if(W.Default.info("worker shutting down"),await q.disposeAll(),U)await U.stop(!0)}};z.listen(S);function w(){let D=T.QITQODE_SERVER_PASSWORD;if(!D)return;let E=T.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${btoa(`${E}:${D}`)}`}export{S as rpc};
2
+ import{Xf as H}from"./chunk-y6123zvq.js";import{ag as x}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{Wg as V,gh as O}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{Dl as Z,Wj as Y}from"./chunk-257me4z3.js";import{Fl as N}from"./chunk-nkkch4h7.js";import{Ql as C,lm as q}from"./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{Rr as k}from"./chunk-56z7x7h4.js";import"./chunk-4cnwn1rh.js";import"./chunk-764fksh3.js";import{Ks as z,Rs as T,Vr as X,Yr as G,_s as W,ys as j}from"./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 $=W.create({service:"upgrade"});function L(D,E){if(D===!1)return"disabled";if(D===!0&&E==="patch")return"install";return"notify"}async function M(){if(G)return;let D=await O.runPromise(Z.Service.use((J)=>J.getGlobal())),E=await O.runPromise(N.Service.use((J)=>J.method())),K=await O.runPromise(N.Service.use((J)=>J.latest(E))).catch((J)=>{$.warn("failed to check for updates",{method:E,error:String(J)})});if(!K)return;if(!N.isNewerVersion(X,K)){$.warn("ignoring non-newer update version",{current:X,latest:K});return}if(T.QITQODE_ALWAYS_NOTIFY_UPDATE){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(T.QITQODE_DISABLE_AUTOUPDATE)return;let _=N.getReleaseType(X,K),Q=L(D.autoupdate,_);if(Q==="disabled")return;if(Q==="notify"){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(E==="unknown")return;await O.runPromise(N.Service.use((J)=>J.upgrade(E,K))).then(()=>Y.publish(N.Event.Updated,{version:K})).catch((J)=>{$.warn("auto-upgrade failed",{method:E,target:K,error:String(J)})})}import{writeHeapSnapshot as P}from"v8";j("worker");await W.init({print:process.argv.includes("--print-logs"),dev:N.isLocal(),level:(()=>{if(N.isLocal())return"DEBUG";return"INFO"})()});H.start();k("worker");C.on("event",(D)=>{z.emit("global.event",D)});var U,S={async fetch(D){let E={...D.headers},K=w();if(K&&!E.authorization&&!E.Authorization)E.Authorization=K;let _=new Request(D.url,{method:D.method,headers:E,body:D.body}),Q=await x.Default().app.fetch(_),J=await Q.text();return{status:Q.status,headers:Object.fromEntries(Q.headers.entries()),body:J}},snapshot(){return P("server.heapsnapshot")},async server(D){if(U)await U.stop(!0);return U=await x.listen(D),{url:U.url.toString()}},async checkUpgrade(D){await q.provide({directory:D.directory,init:()=>O.runPromise(V),fn:async()=>{await M().catch(()=>{})}})},async reload(){await O.runPromise(Z.Service.use((D)=>D.invalidate(!0)))},async shutdown(){if(W.Default.info("worker shutting down"),await q.disposeAll(),U)await U.stop(!0)}};z.listen(S);function w(){let D=T.QITQODE_SERVER_PASSWORD;if(!D)return;let E=T.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${btoa(`${E}:${D}`)}`}export{S as rpc};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qitqode/qitqode-android-arm64",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Android arm64 runtime for @qitqode/cli.",
5
5
  "license": "MIT",
6
6
  "author": "QitQode",
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{dQ as t}from"./chunk-aztre27e.js";var e=await import("./chunk-09c4ngag.js",{with:{type:"file"}}),a=e.default;export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-aztre27e.js";var _="./libopentui-smaejjb8.so";export{_ as default};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{O as o}from"./chunk-6p7yg5sr.js";import{P as i}from"./chunk-n26yf3he.js";import{Ed as p}from"./chunk-07g7cybt.js";import{Rd as n}from"./chunk-yajd975f.js";import{Vf as B}from"./chunk-7ppd2phw.js";import{ag as l}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 g}from"./chunk-ddnpx1yx.js";import{Vh as d}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{rl as f}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 D}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"./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{fu as u,pu as I,yu as x}from"./chunk-3szwfy7w.js";import{Su as y}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";import Q from"path";import{pathToFileURL as a}from"url";import{EOL as O}from"os";function $(j){let K=j.state;return{input:K.input,metadata:"metadata"in K?K.metadata:{},part:j}}function C(j){let K=j.description?B.Style.TEXT_DIM+` ${j.description}`+B.Style.TEXT_NORMAL:"";B.println(B.Style.TEXT_NORMAL+j.icon,B.Style.TEXT_NORMAL+j.title+K)}function b(j,K){if(B.empty(),C(j),!K?.trim())return;B.println(K),B.empty()}function c(j){let K=j.state,V="input"in K?K.input:void 0,Y=("title"in K&&K.title?K.title:void 0)||(V&&typeof V==="object"&&Object.keys(V).length>0?JSON.stringify(V):"Unknown");C({icon:"\u2699",title:`${j.tool} ${Y}`})}function t(j){let K=j.path??"",V=`${j.kind} "${j.pattern}"`,Y=K?`in ${T(K)}`:"",H=j.count===void 0?Y:`${Y}${Y?" \xB7 ":""}${j.count} ${j.count===1?"match":"matches"}`;C({icon:"\u2731",title:V,...H&&{description:H}})}function r(j){t({kind:"Glob",pattern:j.input.pattern,path:j.input.path,count:j.metadata.count})}function jj(j){t({kind:"Grep",pattern:j.input.pattern,path:j.input.path,count:j.metadata.matches})}function Bj(j){let K=T(j.input.filePath),V=Object.entries(j.input).filter(([H,S])=>{if(H==="filePath")return!1;return typeof S==="string"||typeof S==="number"||typeof S==="boolean"}),Y=V.length?`[${V.map(([H,S])=>`${H}=${S}`).join(", ")}]`:void 0;C({icon:"\u2192",title:`Read ${K}`,...Y&&{description:Y}})}function Gj(j){b({icon:"\u2190",title:`Write ${T(j.input.filePath)}`},j.part.state.status==="completed"?j.part.state.output:void 0)}function Jj(j){C({icon:"%",title:`WebFetch ${j.input.url}`})}function Kj(j){let K=T(j.input.filePath),V=j.metadata.diff;b({icon:"\u2190",title:`Edit ${K}`},V)}function Mj(j){C({icon:"\u25C7",title:`Exa Code Search "${j.input.query}"`})}function Nj(j){C({icon:"\u25C8",title:`Web Search "${j.input.query}"`})}function k(j){let K=j.part.state.input?.operation??j.part.state.input,V=j.part.state.status,Y=typeof K?.subagent_type==="string"&&K.subagent_type.trim().length>0?K.subagent_type:"unknown",H=u.titlecase(Y),S=typeof K?.description==="string"&&K.description.trim().length>0?K.description:void 0,w=V==="error"?"\u2717":V==="running"?"\u2022":"\u2713",L=S??`${H} Task`;C({icon:w,title:L,description:S?`${H} Agent`:void 0})}function Vj(j){C({icon:"\u2192",title:`Skill "${j.input.name}"`})}function Xj(j){let K=j.part.state.status==="completed"?j.part.state.output?.trim():void 0;b({icon:"$",title:`${j.input.command}`},K)}function T(j){if(!j)return"";if(Q.isAbsolute(j))return Q.relative(process.cwd(),j)||".";return j}var Tj=n({command:"run [message..]",describe:"run qitqode with a message",builder:(j)=>{return j.positional("message",{describe:"message to send",type:"string",array:!0,default:[]}).option("command",{describe:"the command to run, use message for args",type:"string"}).option("continue",{alias:["c"],describe:"continue the last session",type:"boolean"}).option("session",{alias:["s"],describe:"session id to continue",type:"string"}).option("fork",{describe:"fork the session before continuing (requires --continue or --session)",type:"boolean"}).option("share",{type:"boolean",describe:"share the session"}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}).option("agent",{type:"string",describe:"agent to use"}).option("format",{type:"string",choices:["default","json"],default:"default",describe:"format: default (formatted) or json (raw JSON events)"}).option("file",{alias:["f"],type:"string",array:!0,describe:"file(s) to attach to message"}).option("title",{type:"string",describe:"title for the session (uses truncated prompt if no value provided)"}).option("attach",{type:"string",describe:"attach to a running qitqode server (e.g., http://localhost:4096)"}).option("password",{alias:["p"],type:"string",describe:"basic auth password (defaults to QITQODE_SERVER_PASSWORD)"}).option("dir",{type:"string",describe:"directory to run in, path on remote server if attaching"}).option("port",{type:"number",describe:"port for the local server (defaults to random port if no value provided)"}).option("variant",{type:"string",describe:"model variant (provider-specific reasoning effort, e.g., high, max, minimal)"}).option("thinking",{type:"boolean",describe:"show thinking blocks",default:!1}).option("dangerously-skip-permissions",{type:"boolean",describe:"auto-approve permissions that are not explicitly denied (dangerous!)",default:!1})},handler:async(j)=>{let K=[...j.message,...j["--"]||[]].join(" "),V=(()=>{if(!j.dir)return;if(j.attach)return j.dir;try{return process.chdir(j.dir),process.cwd()}catch{B.error("Failed to change directory to "+j.dir),process.exit(1)}})(),Y=[];if(j.file){let M=Array.isArray(j.file)?j.file:[j.file];for(let X of M){let N=Q.resolve(process.cwd(),X);if(!await y.exists(N))B.error(`File not found: ${X}`),process.exit(1);let W=await y.isDir(N)?"application/x-directory":"text/plain";Y.push({type:"file",url:a(N).href,filename:Q.basename(N),mime:W})}}if(!process.stdin.isTTY)K+=`
3
- `+await Bun.stdin.text();if(K.trim().length===0&&!j.command)B.error("You must provide a message or a command"),process.exit(1);if(j.fork&&!j.continue&&!j.session)B.error("--fork requires --continue or --session"),process.exit(1);let H=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}];function S(){if(j.title===void 0)return;if(j.title!=="")return j.title;return K.slice(0,50)+(K.length>50?"...":"")}async function w(M){let X=j.continue?(await M.session.list()).data?.find((Z)=>!Z.parentID)?.id:j.session;if(X&&j.fork)return(await M.session.fork({sessionID:X})).data?.id;if(X)return X;let N=S();return(await M.session.create({title:N,permission:H})).data?.id}async function L(M,X){let N=await M.config.get();if(!N.data)return;if(N.data.share!=="auto"&&!I.QITQODE_AUTO_SHARE&&!j.share)return;let W=await M.session.share({sessionID:X}).catch((Z)=>{if(Z instanceof Error&&Z.message.includes("disabled"))B.println(B.Style.TEXT_DANGER_BOLD+"! "+Z.message);return{error:Z}});if(!W.error&&"data"in W&&W.data?.share?.url)B.println(B.Style.TEXT_INFO_BOLD+"~ "+W.data.share.url)}async function h(M){function X(G){try{if(G.tool==="bash")return Xj($(G));if(G.tool==="glob")return r($(G));if(G.tool==="grep")return jj($(G));if(G.tool==="read")return Bj($(G));if(G.tool==="write")return Gj($(G));if(G.tool==="webfetch")return Jj($(G));if(G.tool==="edit")return Kj($(G));if(G.tool==="codesearch")return Mj($(G));if(G.tool==="websearch")return Nj($(G));if(G.tool==="actor")return k($(G));if(G.tool==="skill")return Vj($(G));return c(G)}catch{return c(G)}}function N(G,q){if(j.format==="json")return process.stdout.write(JSON.stringify({type:G,timestamp:Date.now(),sessionID:A,...q})+O),!0;return!1}let W=await M.event.subscribe(),Z;async function e(G){let q=new Map,z=x.create({service:"cli.run"}),E=W.stream[Symbol.asyncIterator](),F=G.completion.then(()=>"DONE");try{while(!0){let P=await Promise.race([E.next(),F]);if(P==="DONE")break;if(P.done)break;let _=P.value;if(G.onEvent(_),z.debug("event received",{type:_.type}),_.type==="message.updated"&&_.properties.info.role==="assistant"&&j.format!=="json"&&q.get("start")!==!0)B.empty(),B.println(`> ${_.properties.info.agent} \xB7 ${_.properties.info.modelID}`),B.empty(),q.set("start",!0);if(_.type==="message.part.updated"){let J=_.properties.part;if(J.sessionID!==A)continue;if(J.type==="tool"&&(J.state.status==="completed"||J.state.status==="error")){if(N("tool_use",{part:J}))continue;if(J.state.status==="completed"){X(J);continue}C({icon:"\u2717",title:`${J.tool} failed`}),B.error(J.state.error)}if(J.type==="tool"&&J.tool==="actor"&&J.state.status==="running"&&j.format!=="json"){if(q.get(J.id)===!0)continue;k($(J)),q.set(J.id,!0)}if(J.type==="step-start"){if(N("step_start",{part:J}))continue}if(J.type==="step-finish"){if(N("step_finish",{part:J}))continue}if(J.type==="text"&&J.time?.end){if(N("text",{part:J}))continue;let R=J.text.trim();if(!R)continue;if(!process.stdout.isTTY){process.stdout.write(R+O);continue}B.empty(),B.println(R),B.empty()}if(J.type==="reasoning"&&J.time?.end&&j.thinking){if(N("reasoning",{part:J}))continue;let R=J.text.trim();if(!R)continue;let U=`Thinking: ${R}`;if(process.stdout.isTTY){B.empty(),B.println(`${B.Style.TEXT_DIM}\x1B[3m${U}\x1B[0m${B.Style.TEXT_NORMAL}`),B.empty();continue}process.stdout.write(U+O)}}if(_.type==="session.error"){let J=_.properties;if(J.sessionID!==A||!J.error)continue;let R=String(J.error.name);if("data"in J.error&&J.error.data&&"message"in J.error.data)R=String(J.error.data.message);if(Z=Z?Z+O+R:R,N("error",{error:J.error}))continue;B.error(R)}if(_.type==="permission.asked"){let J=_.properties;if(J.sessionID!==A)continue;if(j["dangerously-skip-permissions"])await M.permission.reply({requestID:J.id,reply:"once"});else B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL+`permission requested: ${J.permission} (${J.patterns.join(", ")}); auto-rejecting`),await M.permission.reply({requestID:J.id,reply:"reject"})}}}finally{G.stop(),await E.return?.(void 0).catch(()=>{})}}let v=await(async()=>{if(!j.agent)return;let G=j.agent;if(j.attach){let z=await M.app.agents(void 0,{throwOnError:!0}).then((F)=>F.data??[]).catch(()=>{return});if(!z){B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL,`failed to list agents from ${j.attach}. Falling back to default agent`);return}let E=z.find((F)=>F.name===G);if(!E){B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL,`agent "${G}" not found. Falling back to default agent`);return}if(E.mode==="subagent"){B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL,`agent "${G}" is a subagent, not a primary agent. Falling back to default agent`);return}return G}let q=await g.runPromise(d.Service.use((z)=>z.get(G)));if(!q){B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL,`agent "${G}" not found. Falling back to default agent`);return}if(q.mode==="subagent"){B.println(B.Style.TEXT_WARNING_BOLD+"!",B.Style.TEXT_NORMAL,`agent "${G}" is a subagent, not a primary agent. Falling back to default agent`);return}return G})(),A=await w(M);if(!A)B.error("Session not found"),process.exit(1);await L(M,A);let s=x.create({service:"cli.run.poll"}),m=o({sessionID:A,query:async()=>{try{return(await M.session.status()).data?.[A]}catch(G){throw s.debug("session.status query failed",{error:G}),G}}});if(e(m).catch((G)=>{console.error(G),process.exit(1)}),j.command)await M.session.command({sessionID:A,agent:v,model:j.model,command:j.command,arguments:K,variant:j.variant});else{let G=j.model?f.parseModel(j.model):void 0;await M.session.prompt({sessionID:A,agent:v,model:G,variant:j.variant,parts:[...Y,{type:"text",text:K}]})}m.markStarted()}if(j.attach){let M=i({password:j.password}),X=D({baseUrl:j.attach,directory:V,headers:M});return await h(X)}await p(process.cwd(),async()=>{let X=D({baseUrl:"http://qitqode.internal",fetch:async(N,W)=>{let Z=new Request(N,W);return l.Default().app.fetch(Z)}});await h(X)})}});export{Tj as RunCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{dQ as t}from"./chunk-aztre27e.js";var e=await import("./chunk-6d9wsjxm.js",{with:{type:"file"}}),a=e.default;export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Rr as a,Sr as b}from"./chunk-c5e6sk9c.js";import"./chunk-aztre27e.js";export{a as generateSecret,b as generateCodeChallengeFromVerifier};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-aztre27e.js";var l="./tree-sitter-javascript-nd0q4pe9.wasm";export{l as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-aztre27e.js";var t="./highlights-ghv9g403.scm";export{t as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Cd as H,Dd as I}from"./chunk-5v4py9p2.js";import{Rd as G}from"./chunk-yajd975f.js";import{Of as B}from"./chunk-ezja6njs.js";import{ag as E}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"./chunk-ddnpx1yx.js";import"./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"./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{Op as D}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"./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{pu as f}from"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";var T=G({command:"serve",builder:(b)=>B(b).option("auto-password",{type:"boolean",default:!1,describe:"generate a random ephemeral QITQODE_SERVER_PASSWORD for this run and print it"}),describe:"starts a headless qitqode server",handler:async(b)=>{let A=await H(b);if(b["auto-password"]&&!f.QITQODE_SERVER_PASSWORD){let z=crypto.randomUUID();process.env.QITQODE_SERVER_PASSWORD=z,console.log('Generated ephemeral server password (basic auth, username "qitqode"):'),console.log(` ${z}`)}if(I(A,f.QITQODE_SERVER_PASSWORD))console.error("ERROR: Binding to non-loopback address without QITQODE_SERVER_PASSWORD is not allowed."),console.error("Set QITQODE_SERVER_PASSWORD, pass --auto-password, or pass --no-auth to override (DANGEROUS)."),process.exit(1);if(!f.QITQODE_SERVER_PASSWORD)console.error(""),console.error("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.error("\u2551 WARNING: server is running WITHOUT authentication. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Any process or browser page that can reach this address can read \u2551"),console.error("\u2551 project files, run shell commands, and open terminals as you. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Set QITQODE_SERVER_PASSWORD, or restart with --auto-password to \u2551"),console.error("\u2551 generate an ephemeral password for this run. \u2551"),console.error("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.error("");if(process.env.QITQODE_KEY)console.log("Using QITQODE_KEY for authentication.");else if(!await D())console.error("Warning: no QitQode credential found. AI features will not work until you sign in (`qitqode auth login`) or set QITQODE_KEY.");let j=await E.listen(A);console.log(`qitqode server listening on http://${j.hostname}:${j.port}`),await new Promise(()=>{}),await j.stop()}});export{T as ServeCommand};
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{rm as no,sm as Vi,tm as oo,um as ci,wm as $i,xm as Qi}from"./chunk-gj3hzx3d.js";import{$m as Ur,$n as At,Am as En,An as a,Ao as Yt,Bm as Wn,Bn as Q,Bo as zt,Cm as Nr,Cn as fn,Co as kt,Dm as Tr,Dn as yn,Do as Vt,Em as lr,En as Yo,Eo as ct,Fn as ut,Fo as wt,Gm as Ar,Gn as X,Go as qt,Hm as Or,Hn as so,Ho as Ft,Im as dr,In as Pn,Io as at,Jm as $r,Jn as po,Jo as jt,Km as Qr,Kn as _o,Ko as bt,Lm as Br,Ln as No,Lo as ht,Mm as Dr,Mn as To,Mo as ni,Nm as Ir,Nn as lo,No as oi,Om as Lr,On as Ao,Oo as ri,Pm as Gr,Pn as Oo,Po as ti,Qm as Mr,Qn as st,Qo as ii,Rm as xr,Rn as $o,Ro as ei,Sm as Cr,Sn as Qo,So as mi,Tm as Jr,Tn as Bo,To as yi,Um as Hr,Un as pt,Uo as ao,Vm as Kr,Vn as Do,Vo as fi,Wm as Rr,Wn as _t,Wo as gi,Xm as Sr,Xn as Io,Xo as ui,Ym as Er,Yn as Nt,Zm as Wr,Zn as Tt,_m as Pr,_n as lt,an as Zr,ao as Ot,ap as Zi,bn as vr,bo as dt,cn as Xr,co as Lo,dn as Yr,do as Go,en as H,eo as $t,fn as zr,fo as Qt,gn as kr,go as Bt,hn as Vr,ho as Dt,in as cr,io as It,jn as wr,jo as Lt,kn as qr,ko as Gt,ln as Fr,lo as Mt,mn as ar,mo as xt,nn as jr,no as Ct,on as br,oo as Jt,pn as hr,po as Ht,qn as nt,qo as Kt,rn as ot,ro as Rt,sn as rt,so as St,tn as tt,to as Et,un as it,uo as Wt,vn as et,vo as Pt,wn as mt,wo as Ut,xn as yt,xo as Zt,ym as pr,yn as ft,yo as vt,zm as _r,zn as gt,zo as Xt}from"./chunk-nj4d554m.js";import{Gp as bn}from"./chunk-nt4e3em9.js";import{$p as hn}from"./chunk-v965rsr8.js";import{aq as Yi}from"./chunk-1sgby720.js";import{bq as Jo}from"./chunk-dcvatax2.js";import{ds as Xn,es as ro,fs as Nn,gs as Hi,hs as Wi,js as Ki}from"./chunk-sn4nez18.js";import{ks as Si}from"./chunk-42f7p0hq.js";import{qt as eo}from"./chunk-12bssxd4.js";import{eu as un,ou as dn,pu as nn,ut as Wo,yu as V}from"./chunk-3szwfy7w.js";import{Ku as di,Nu as wo,Ou as c,Su as go}from"./chunk-whxjkz9a.js";import{Uu as j}from"./chunk-k309zez0.js";import{JA as Tn,RA as Cn,dB as Kn}from"./chunk-phxrg7aw.js";import{AP as Oi,BF as kn,BO as vo,IF as sn,PI as r,UC as wn,YF as Ai,ZD as Qn,cK as Ln,mG as h,pO as N,uF as Eo}from"./chunk-snm5q21k.js";import{bQ as On}from"./chunk-aztre27e.js";var qo={};On(qo,{run:()=>ji});var mn={time_created:a().notNull().$default(()=>Date.now()),time_updated:a().notNull().$onUpdate(()=>Date.now())};var x=yn("project",{id:Q().$type().primaryKey(),worktree:Q().notNull(),vcs:Q(),name:Q(),icon_url:Q(),icon_color:Q(),...mn,time_initialized:a(),sandboxes:Q({mode:"json"}).notNull().$type(),commands:Q({mode:"json"}).$type()});var gn=yn("session",{id:Q().$type().primaryKey(),project_id:Q().$type().notNull().references(()=>x.id,{onDelete:"cascade"}),workspace_id:Q().$type(),parent_id:Q().$type(),context_from:Q().$type(),context_watermark:Q().$type(),slug:Q().notNull(),directory:Q().notNull(),title:Q().notNull(),version:Q().notNull(),share_url:Q(),summary_additions:a(),summary_deletions:a(),summary_files:a(),summary_diffs:Q({mode:"json"}).$type(),revert:Q({mode:"json"}).$type(),permission:Q({mode:"json"}).$type(),...mn,time_compacting:a(),time_archived:a(),last_checkpoint_message_id:Q().$type()},(n)=>[fn("session_project_idx").on(n.project_id),fn("session_workspace_idx").on(n.workspace_id),fn("session_parent_idx").on(n.parent_id),fn("session_context_from_idx").on(n.context_from)]),fo=yn("message",{id:Q().$type().primaryKey(),session_id:Q().$type().notNull().references(()=>gn.id,{onDelete:"cascade"}),agent_id:Q().notNull().default("main"),...mn,data:Q({mode:"json"}).notNull().$type()},(n)=>[fn("message_session_time_created_id_idx").on(n.session_id,n.time_created,n.id),fn("message_session_agent_idx").on(n.session_id,n.agent_id,n.id)]),zo=yn("part",{id:Q().$type().primaryKey(),message_id:Q().$type().notNull().references(()=>fo.id,{onDelete:"cascade"}),session_id:Q().$type().notNull(),...mn,data:Q({mode:"json"}).notNull().$type()},(n)=>[fn("part_message_id_id_idx").on(n.message_id,n.id),fn("part_session_idx").on(n.session_id)]),ko=yn("todo",{session_id:Q().$type().notNull().references(()=>gn.id,{onDelete:"cascade"}),content:Q().notNull(),status:Q().notNull(),position:a().notNull(),...mn},(n)=>[Yo({columns:[n.session_id,n.position]}),fn("todo_session_idx").on(n.session_id)]),Vo=yn("permission",{project_id:Q().primaryKey().references(()=>x.id,{onDelete:"cascade"}),...mn,data:Q({mode:"json"}).notNull().$type()});var co=yn("session_share",{session_id:Q().primaryKey().references(()=>gn.id,{onDelete:"cascade"}),id:Q().notNull(),secret:Q().notNull(),url:Q().notNull(),...mn});import k from"path";var v=V.create({service:"json-migration"});async function ji(n,o){let t=k.join(dn.Path.data,"storage");if(!await go.exists(t))return v.info("storage directory does not exist, skipping migration"),{projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]};v.info("starting json to sqlite migration",{storageDir:t});let s=performance.now();n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = OFF"),n.run("PRAGMA cache_size = 10000"),n.run("PRAGMA temp_store = MEMORY");let e={projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]},l={sessions:0,todos:0,permissions:0,shares:0},_=e.errors,A=1000,C=Date.now();async function S(g){return wo.scan(g,{cwd:t,absolute:!0})}async function K(g,G,J){let B=J-G,T=Array(B);for(let P=0;P<B;P++)T[P]=go.readJson(g[G+P]);let M=await Promise.allSettled(T),Z=Array(B);for(let P=0;P<M.length;P++){let w=M[P];if(w.status==="fulfilled"){Z[P]=w.value;continue}_.push(`failed to read ${g[G+P]}: ${w.reason}`)}return Z}function R(g,G,J){if(g.length===0)return 0;try{return n.insert(G).values(g).onConflictDoNothing().run(),g.length}catch(B){return _.push(`failed to migrate ${J} batch: ${B}`),0}}v.info("scanning files...");let[E,d,D,L,u,p,m]=await Promise.all([S("project/*.json"),S("session/*/*.json"),S("message/*/*.json"),S("part/*/*.json"),S("todo/*.json"),S("permission/*.json"),S("session_share/*.json")]);v.info("file scan complete",{projects:E.length,sessions:d.length,messages:D.length,parts:L.length,todos:u.length,permissions:p.length,shares:m.length});let f=Math.max(1,E.length+d.length+D.length+L.length+u.length+p.length+m.length),i=o?.progress,y=0,$=(g,G)=>{y=Math.min(f,y+G),i?.({current:y,total:f,label:g})};i?.({current:y,total:f,label:"starting"}),n.run("BEGIN TRANSACTION");let I=new Set,O=[];for(let g=0;g<E.length;g+=A){let G=Math.min(g+A,E.length),J=await K(E,g,G);O.length=0;for(let B=0;B<J.length;B++){let T=J[B];if(!T)continue;let M=k.basename(E[g+B],".json");I.add(M),O.push({id:M,worktree:T.worktree??"/",vcs:T.vcs,name:T.name??void 0,icon_url:T.icon?.url,icon_color:T.icon?.color,time_created:T.time?.created??C,time_updated:T.time?.updated??C,time_initialized:T.time?.initialized,sandboxes:T.sandboxes??[],commands:T.commands})}e.projects+=R(O,x,"project"),$("projects",G-g)}v.info("migrated projects",{count:e.projects,duration:Math.round(performance.now()-s)});let U=d.map((g)=>k.basename(k.dirname(g))),z=new Set,en=[];for(let g=0;g<d.length;g+=A){let G=Math.min(g+A,d.length),J=await K(d,g,G);en.length=0;for(let B=0;B<J.length;B++){let T=J[B];if(!T)continue;let M=k.basename(d[g+B],".json"),Z=U[g+B];if(!I.has(Z)){l.sessions++;continue}z.add(M),en.push({id:M,project_id:Z,parent_id:T.parentID??null,slug:T.slug??"",directory:T.directory??"",title:T.title??"",version:T.version??"",share_url:T.share?.url??null,summary_additions:T.summary?.additions??null,summary_deletions:T.summary?.deletions??null,summary_files:T.summary?.files??null,summary_diffs:T.summary?.diffs??null,revert:T.revert??null,permission:T.permission??null,time_created:T.time?.created??C,time_updated:T.time?.updated??C,time_compacting:T.time?.compacting??null,time_archived:T.time?.archived??null})}e.sessions+=R(en,gn,"session"),$("sessions",G-g)}if(v.info("migrated sessions",{count:e.sessions}),l.sessions>0)v.warn("skipped orphaned sessions",{count:l.sessions});let pn=[],W=[],qn=new Map;for(let g of D){let G=k.basename(k.dirname(g));if(!z.has(G))continue;pn.push(g),W.push(G)}for(let g=0;g<pn.length;g+=A){let G=Math.min(g+A,pn.length),J=await K(pn,g,G),B=Array(J.length),T=0;for(let M=0;M<J.length;M++){let Z=J[M];if(!Z)continue;let P=pn[g+M],w=k.basename(P,".json"),Sn=W[g+M];qn.set(w,Sn);let Bn=Z;delete Bn.id,delete Bn.sessionID,B[T++]={id:w,session_id:Sn,time_created:Z.time?.created??C,time_updated:Z.time?.updated??C,data:Bn}}B.length=T,e.messages+=R(B,fo,"message"),$("messages",G-g)}v.info("migrated messages",{count:e.messages});for(let g=0;g<L.length;g+=A){let G=Math.min(g+A,L.length),J=await K(L,g,G),B=Array(J.length),T=0;for(let M=0;M<J.length;M++){let Z=J[M];if(!Z)continue;let P=L[g+M],w=k.basename(P,".json"),Sn=k.basename(k.dirname(P)),Bn=qn.get(Sn);if(!Bn){_.push(`part missing message session: ${P}`);continue}if(!z.has(Bn))continue;let jn=Z;delete jn.id,delete jn.messageID,delete jn.sessionID,B[T++]={id:w,message_id:Sn,session_id:Bn,time_created:Z.time?.created??C,time_updated:Z.time?.updated??C,data:jn}}B.length=T,e.parts+=R(B,zo,"part"),$("parts",G-g)}v.info("migrated parts",{count:e.parts});let An=u.map((g)=>k.basename(g,".json"));for(let g=0;g<u.length;g+=A){let G=Math.min(g+A,u.length),J=await K(u,g,G),B=[];for(let T=0;T<J.length;T++){let M=J[T];if(!M)continue;let Z=An[g+T];if(!z.has(Z)){l.todos++;continue}if(!Array.isArray(M)){_.push(`todo not an array: ${u[g+T]}`);continue}for(let P=0;P<M.length;P++){let w=M[P];if(!w?.content||!w?.status)continue;B.push({session_id:Z,content:w.content,status:w.status,position:P,time_created:C,time_updated:C})}}e.todos+=R(B,ko,"todo"),$("todos",G-g)}if(v.info("migrated todos",{count:e.todos}),l.todos>0)v.warn("skipped orphaned todos",{count:l.todos});let Fn=p.map((g)=>k.basename(g,".json")),Rn=[];for(let g=0;g<p.length;g+=A){let G=Math.min(g+A,p.length),J=await K(p,g,G);Rn.length=0;for(let B=0;B<J.length;B++){let T=J[B];if(!T)continue;let M=Fn[g+B];if(!I.has(M)){l.permissions++;continue}Rn.push({project_id:M,data:T})}e.permissions+=R(Rn,Vo,"permission"),$("permissions",G-g)}if(v.info("migrated permissions",{count:e.permissions}),l.permissions>0)v.warn("skipped orphaned permissions",{count:l.permissions});let an=m.map((g)=>k.basename(g,".json")),Gn=[];for(let g=0;g<m.length;g+=A){let G=Math.min(g+A,m.length),J=await K(m,g,G);Gn.length=0;for(let B=0;B<J.length;B++){let T=J[B];if(!T)continue;let M=an[g+B];if(!z.has(M)){l.shares++;continue}if(!T?.id||!T?.secret||!T?.url){_.push(`session_share missing id/secret/url: ${m[g+B]}`);continue}Gn.push({session_id:M,id:T.id,secret:T.secret,url:T.url})}e.shares+=R(Gn,co,"session_share"),$("shares",G-g)}if(v.info("migrated session shares",{count:e.shares}),l.shares>0)v.warn("skipped orphaned session shares",{count:l.shares});if(n.run("COMMIT"),v.info("json migration complete",{projects:e.projects,sessions:e.sessions,messages:e.messages,parts:e.parts,todos:e.todos,permissions:e.permissions,shares:e.shares,errorCount:e.errors.length,duration:Math.round(performance.now()-s)}),e.errors.length>0)v.warn("migration errors",{errors:e.errors.slice(0,20)});return i?.({current:f,total:f,label:"complete"}),e}var In={};On(In,{use:()=>Je,transaction:()=>Ke,textDecoder:()=>mt,sumDistinct:()=>tr,sum:()=>rr,sql:()=>H,relationsOrderToSQL:()=>ii,relationsFilterToSQL:()=>ti,relationToSQL:()=>mi,relationExtrasToSQL:()=>ei,processRelations:()=>Wt,placeholder:()=>kr,param:()=>Yr,orderSelectedFields:()=>ar,orderByOperators:()=>Vt,or:()=>po,operators:()=>kt,notLike:()=>Nt,notInArray:()=>st,notIlike:()=>lt,notExists:()=>pt,notBetween:()=>_t,not:()=>_o,noopMapper:()=>vr,noopEncoder:()=>Zr,noopDecoder:()=>Ur,ne:()=>so,name:()=>Wr,min:()=>er,max:()=>ir,mapUpdateSet:()=>br,mapResultRow:()=>Fr,mapRelationalRow:()=>wt,mapColumnsInSQLToAlias:()=>Ht,mapColumnsInAliasedSQLToAlias:()=>Jt,lte:()=>Ao,lt:()=>lo,like:()=>Io,l2Distance:()=>mr,l1Distance:()=>yr,jaccardDistance:()=>sr,isWithEnum:()=>ft,isView:()=>wr,isTable:()=>Lr,isSQLWrapper:()=>Kr,isNull:()=>$o,isNotNull:()=>Qo,isDriverValueEncoder:()=>Pr,isConfig:()=>et,is:()=>En,innerProduct:()=>fr,inArray:()=>Oo,ilike:()=>Tt,haveSameKeys:()=>jr,hasOwnEntityKind:()=>_r,hammingDistance:()=>ur,gte:()=>To,gt:()=>No,getViewSelectedFields:()=>ot,getViewName:()=>qr,getTableUniqueName:()=>Mr,getTableName:()=>Gr,getTableLikeName:()=>tt,getTableColumns:()=>nt,getTableAsAliasSQL:()=>yi,getOriginalColumnFromAlias:()=>Kt,getOrderByOperators:()=>ct,getColumns:()=>rt,getColumnTable:()=>Nr,getColumnNameAndConfig:()=>it,getChannelPath:()=>zi,fillPlaceholders:()=>Vr,fieldSelectionToSQL:()=>ri,extractTablesFromSchema:()=>ht,extractExtendedColumnType:()=>Tr,exists:()=>Bo,eq:()=>X,entityKind:()=>pr,effect:()=>He,desc:()=>Go,defineRelationsPart:()=>oi,defineRelations:()=>ni,createRelationsHelper:()=>bt,countDistinct:()=>ho,count:()=>uo,cosineDistance:()=>gr,close:()=>Ce,buildRelationsParts:()=>Ut,buildRelations:()=>Pt,bindIfParam:()=>ut,between:()=>Do,avgDistinct:()=>or,avg:()=>nr,assertUnreachable:()=>yt,asc:()=>Lo,arrayOverlaps:()=>dt,arrayContains:()=>At,arrayContained:()=>Ot,applyMixins:()=>hr,and:()=>Pn,aliasedTableColumn:()=>Ct,aliasedTable:()=>Gt,aliasedRelation:()=>xt,aliasedColumn:()=>Mt,WithSubquery:()=>Cr,ViewSelectionAliasProxyHandler:()=>Bt,ViewBaseConfig:()=>Jr,View:()=>cr,TransactionRollbackError:()=>Et,TableSchema:()=>Ar,TableColumns:()=>Or,TableAliasProxyHandler:()=>Dt,Table:()=>Ir,Subquery:()=>xr,StringChunk:()=>Rr,SQL:()=>Sr,RelationsHelperStatic:()=>jt,RelationsBuilderTable:()=>qt,RelationsBuilderJunctionColumn:()=>at,RelationsBuilderColumn:()=>Ft,RelationTableAliasProxyHandler:()=>Lt,Relation:()=>Zt,QueryPromise:()=>$t,Placeholder:()=>zr,Path:()=>Po,Param:()=>Xr,OriginalName:()=>$r,One:()=>vt,NotFoundError:()=>xe,NoopLogger:()=>ui,Name:()=>Er,Many:()=>Xt,IsAlias:()=>Br,FakePrimitiveParam:()=>Hr,ExtraConfigColumns:()=>dr,ExtraConfigBuilder:()=>Dr,DrizzleQueryError:()=>St,DrizzleError:()=>Rt,DefaultLogger:()=>gi,Count:()=>zt,ConsoleLogWriter:()=>fi,ColumnTableAliasProxyHandler:()=>Qt,ColumnBuilder:()=>lr,ColumnAliasProxyHandler:()=>It,Column:()=>Wn,Client:()=>Jn,CONSTANTS:()=>gt,BaseName:()=>Qr,AggregatedField:()=>Yt});import bi from"crypto";import Fo,{existsSync as hi,readdirSync as ne}from"fs";import{join as oe}from"path";function jo(n){if(Fo.existsSync(`${n.migrationsFolder}/meta/_journal.json`))throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');let o=n.migrationsFolder,t=[],s=ne(o).map((e)=>({path:oe(o,e,"migration.sql"),name:e})).filter((e)=>hi(e.path));s.sort((e,l)=>e.name.localeCompare(l.name));for(let e of s){let l=e.path,_=e.name.slice(0,14),A=Fo.readFileSync(l).toString(),C=A.split("--> statement-breakpoint").map((K)=>{return K}),S=ao(_);t.push({sql:C,bps:!0,folderMillis:S,hash:bi.createHash("sha256").update(A).digest("hex"),name:e.name})}return t}function bo(n,o){if(Array.isArray(o)||"migrationsJournal"in o){let s=Array.isArray(o)?o:o.migrationsJournal,e=Array.isArray(o)?void 0:o.migrationsTable,l=s.map((_)=>({sql:_.sql.split("--> statement-breakpoint"),folderMillis:_.timestamp,hash:"",bps:!0,name:_.name}));return n.dialect.migrate(l,n.session,{migrationsTable:e})}let t=jo(o);return n.dialect.migrate(t,n.session,o)}function uo(n){return H`count(${n||H.raw("*")})`.mapWith(Number)}function ho(n){return H`count(distinct ${n})`.mapWith(Number)}function nr(n){return H`avg(${n})`.mapWith(String)}function or(n){return H`avg(distinct ${n})`.mapWith(String)}function rr(n){return H`sum(${n})`.mapWith(String)}function tr(n){return H`sum(distinct ${n})`.mapWith(String)}function ir(n){return H`max(${n})`.mapWith(En(n,Wn)?n:String)}function er(n){return H`min(${n})`.mapWith(En(n,Wn)?n:String)}function Mn(n){return JSON.stringify(n)}function mr(n,o){if(Array.isArray(o))return H`${n} <-> ${Mn(o)}`;return H`${n} <-> ${o}`}function yr(n,o){if(Array.isArray(o))return H`${n} <+> ${Mn(o)}`;return H`${n} <+> ${o}`}function fr(n,o){if(Array.isArray(o))return H`${n} <#> ${Mn(o)}`;return H`${n} <#> ${o}`}function gr(n,o){if(Array.isArray(o))return H`${n} <=> ${Mn(o)}`;return H`${n} <=> ${o}`}function ur(n,o){if(Array.isArray(o))return H`${n} <~> ${Mn(o)}`;return H`${n} <~> ${o}`}function sr(n,o){if(Array.isArray(o))return H`${n} <%> ${Mn(o)}`;return H`${n} <%> ${o}`}import io from"path";var Yn={};On(Yn,{workspaceID:()=>de,useEffect:()=>Be,use:()=>Qe,make:()=>$e,invalidate:()=>Ie,has:()=>De,get:()=>So,directory:()=>to,context:()=>Ro,bind:()=>Oe});import{EventEmitter as re}from"events";var Un=new re;var Mo=new Set;function si(n){return Mo.add(n),()=>{Mo.delete(n)}}async function xo(n){await Promise.allSettled([...Mo].map((o)=>o(n)))}function Zn(n){return n()}var xi={};On(xi,{setInitialized:()=>se,list:()=>ge,layer:()=>Mi,get:()=>ue,fromRow:()=>_n,defaultLayer:()=>Ko,UpdateInput:()=>fe,Service:()=>xn,Info:()=>Li,Event:()=>Gi});import*as F from"fs/promises";import*as Bi from"os";import*as $n from"path";var te=N.String.pipe(N.brand("ProjectID")),q=te.pipe(bn((n)=>({global:n.make("global"),zod:j.string().pipe(j.custom())})));import*as Dn from"fs/promises";import*as b from"path";import*as Ni from"crypto";async function Co(n){let o=b.resolve(n);while(!0){let t=b.join(o,".git"),s=await Dn.stat(t).catch(()=>null);if(s){if(s.isDirectory())return t;let _=(await Dn.readFile(t,"utf-8")).trim().match(/^gitdir:\s*(.+)$/);if(!_)return null;let A=b.isAbsolute(_[1])?_[1]:b.resolve(o,_[1]);return b.resolve(A,"../..")}let e=b.dirname(o);if(e===o)return null;o=e}}async function pi(n){let o=await Dn.readFile(n,"utf-8").catch(()=>null);if(o===null)return null;return o.trim()||null}async function _i(n){let o=await pi(n);if(o)return o;let t=Ni.randomUUID();try{return await Dn.writeFile(n,t,{flag:"wx"}),t}catch(s){if(s.code!=="EEXIST")throw s;let e=await pi(n);if(e)return e;throw Error(`Project ID file was concurrently created but is empty: ${n}`)}}async function Ti(n){let o=await Co(n);if(o){let s=b.join(o,"qitqode-project-id");return q.make(await _i(s))}let t=b.join(n,".qitqode-project-id");return q.make(await _i(t))}async function ee(n){let o=await Co(n);if(!o)return;let t=$n.join(n,".qitqode-project-id"),s=$n.join(o,"qitqode-project-id"),e=(A)=>F.access(A).then(()=>!0).catch(()=>!1);if(await e(t)){if(!await e(s)){let A=await F.readFile(t,"utf-8");await F.writeFile(s,A)}await F.unlink(t).catch(()=>{})}let l=$n.join(o,"info","exclude");if(await F.mkdir($n.dirname(l),{recursive:!0}),!(await F.readFile(l,"utf-8").catch(()=>"")).includes(".qitqode-project-id"))await F.appendFile(l,`
3
- .qitqode-project-id
4
- `)}var li=V.create({service:"project"}),me=262144,Ho=N.Literal("git"),Di=N.Struct({url:N.optional(N.String),override:N.optional(N.String),color:N.optional(N.String)}),Ii=N.Struct({start:N.optional(N.String.annotate({description:"Startup script to run when creating a new workspace (worktree)"}))}),ye=N.Struct({created:N.Number,updated:N.Number,initialized:N.optional(N.Number)}),Li=N.Struct({id:q,worktree:N.String,vcs:N.optional(Ho),name:N.optional(N.String),icon:N.optional(Di),commands:N.optional(Ii),time:ye,sandboxes:N.Array(N.String)}).annotate({identifier:"Project"}).pipe(bn((n)=>({zod:hn(n)}))),Gi={Updated:Qi.define("project.updated",Li.zod)};function _n(n){let o=n.icon_url||n.icon_color?{url:n.icon_url??void 0,color:n.icon_color??void 0}:void 0;return{id:n.id,worktree:n.worktree,vcs:n.vcs?N.decodeUnknownSync(Ho)(n.vcs):void 0,name:n.name??void 0,icon:o,time:{created:n.time_created,updated:n.time_updated,initialized:n.time_initialized??void 0},sandboxes:n.sandboxes,commands:n.commands??void 0}}var fe=j.object({projectID:q.zod,name:j.string().optional(),icon:hn(Di).optional(),commands:hn(Ii).optional()});class xn extends Qn.Service()("@qitqode/Project"){}var Mi=h.effect(xn,r.gen(function*(){let n=yield*c.Service,o=yield*Oi.Path,t=yield*no.ChildProcessSpawner,s=r.fnUntraced(function*(i,y){return yield*$i(t,i,y)},r.catch(()=>r.succeed({code:1,text:"",stderr:""}))),e=(i)=>r.sync(()=>In.use(i)),l=(i)=>r.sync(()=>Un.emit("event",{directory:"global",project:i.id,payload:{type:Gi.Updated.type,properties:i}})),_=N.decodeUnknownSync(N.optional(Ho))(nn.QITQODE_FAKE_VCS),A=(i,y)=>{if(!y)return i;if(y=y.replace(/[\r\n]+$/,""),!y)return i;if(y=c.windowsPath(y),o.isAbsolute(y))return o.normalize(y);return o.resolve(i,y)},C=yield*Ai.Scope,S=r.fn("Project.fromDirectory")(function*(i){li.info("fromDirectory",{directory:i});let y=yield*r.gen(function*(){if(nn.QITQODE_DISABLE_GIT)return{id:q.global,worktree:i,sandbox:i,vcs:_};let z=(yield*n.up({targets:[".git"],start:i}).pipe(r.orDie))[0];if(!z)return{id:q.global,worktree:"/",sandbox:"/",vcs:_};let en=o.dirname(z),pn=process.env.HOME??process.env.USERPROFILE??Bi.homedir();if(en===pn||$n.parse(en).root===en)return li.warn("ignoring .git at home or filesystem root, snapshots disabled",{dotgit:z}),{id:q.global,worktree:i,sandbox:i,vcs:_};let W=en,qn=yield*r.sync(()=>Jo("git")),An;if(!qn)return{id:An??q.global,worktree:W,sandbox:W,vcs:_};let Fn=yield*s(["rev-parse","--git-common-dir"],{cwd:W});if(Fn.code!==0)return{id:An??q.global,worktree:W,sandbox:W,vcs:_};let Rn=(()=>{let Gn=A(W,Fn.text.trim());return Gn===W?W:o.dirname(Gn)})();if(An==null)yield*r.promise(()=>ee(W)),An=yield*r.promise(()=>Ti(W));let an=yield*s(["rev-parse","--show-toplevel"],{cwd:W});if(an.code!==0)return{id:An,worktree:W,sandbox:W,vcs:_};return W=A(W,an.text.trim()),{id:An,sandbox:W,worktree:Rn,vcs:"git"}}),$=yield*e((U)=>U.select().from(x).where(X(x.id,y.id)).get()),I=$?_n($):{id:y.id,worktree:y.worktree,vcs:y.vcs,sandboxes:[],time:{created:Date.now(),updated:Date.now()}};if(nn.QITQODE_EXPERIMENTAL_ICON_DISCOVERY)yield*K(I).pipe(r.ignore,r.forkIn(C));let O={...I,worktree:y.worktree,vcs:y.vcs,time:{...I.time,updated:Date.now()}};if(y.sandbox!==O.worktree&&!O.sandboxes.includes(y.sandbox))O.sandboxes.push(y.sandbox);if(O.sandboxes=yield*r.forEach(O.sandboxes,(U)=>n.exists(U).pipe(r.orDie,r.map((z)=>z?U:void 0)),{concurrency:16}).pipe(r.map((U)=>U.filter((z)=>z!==void 0))),yield*e((U)=>U.insert(x).values({id:O.id,worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_created:O.time.created,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}).onConflictDoUpdate({target:x.id,set:{worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}}).run()),y.id!==q.global)yield*e((U)=>U.update(gn).set({project_id:y.id}).where(Pn(X(gn.project_id,q.global),X(gn.directory,y.worktree))).run());return yield*l(O),{project:O,sandbox:y.sandbox}}),K=r.fn("Project.discover")(function*(i){if(i.vcs!=="git")return;if(i.icon?.override)return;if(i.icon?.url)return;let $=(yield*n.glob("**/favicon.{ico,png,svg,jpg,jpeg,webp}",{cwd:i.worktree,absolute:!0,include:"file"}).pipe(r.orDie)).sort((pn,W)=>pn.length-W.length)[0];if(!$)return;let I=yield*n.stat($).pipe(r.orDie);if(Number(I.size)>me)return;let O=yield*n.readFile($).pipe(r.orDie),U=Buffer.from(O).toString("base64"),en=`data:${c.mimeType($)};base64,${U}`;yield*d({projectID:i.id,icon:{url:en}})}),R=r.fn("Project.list")(function*(){return yield*e((i)=>i.select().from(x).all().map(_n))}),E=r.fn("Project.get")(function*(i){let y=yield*e(($)=>$.select().from(x).where(X(x.id,i)).get());return y?_n(y):void 0}),d=r.fn("Project.update")(function*(i){let y=yield*e((I)=>I.update(x).set({name:i.name,icon_url:i.icon?.url,icon_color:i.icon?.color,commands:i.commands,time_updated:Date.now()}).where(X(x.id,i.projectID)).returning().get());if(!y)throw Error(`Project not found: ${i.projectID}`);let $=_n(y);return yield*l($),$}),D=r.fn("Project.initGit")(function*(i){if(i.project.vcs==="git")return i.project;if(!(yield*r.sync(()=>Jo("git"))))throw Error("Git is not installed");let y=yield*s(["init","--quiet"],{cwd:i.directory});if(y.code!==0)throw Error(y.stderr.trim()||y.text.trim()||"Failed to initialize git repository");let{project:$}=yield*S(i.directory);return $}),L=r.fn("Project.setInitialized")(function*(i){yield*e((y)=>y.update(x).set({time_initialized:Date.now()}).where(X(x.id,i)).run())}),u=r.fn("Project.sandboxes")(function*(i){let y=yield*e((I)=>I.select().from(x).where(X(x.id,i)).get());if(!y)return[];let $=_n(y);return yield*r.forEach($.sandboxes,(I)=>n.isDir(I).pipe(r.orDie,r.map((O)=>O?I:void 0)),{concurrency:16}).pipe(r.map((I)=>I.filter((O)=>O!==void 0)))}),p=r.fnUntraced(function*(i,y){let $=yield*e((I)=>I.update(x).set({sandboxes:y,time_updated:Date.now()}).where(X(x.id,i)).returning().get());if(!$)throw Error(`Project not found: ${i}`);yield*l(_n($))}),m=r.fn("Project.addSandbox")(function*(i,y){let $=yield*e((O)=>O.select().from(x).where(X(x.id,i)).get());if(!$)throw Error(`Project not found: ${i}`);let I=[...$.sandboxes];if(!I.includes(y))I.push(y);yield*p(i,I)}),f=r.fn("Project.removeSandbox")(function*(i,y){let $=yield*e((O)=>O.select().from(x).where(X(x.id,i)).get());if(!$)throw Error(`Project not found: ${i}`);let I=$.sandboxes.filter((O)=>O!==y);yield*p(i,I)});return xn.of({fromDirectory:S,discover:K,list:R,get:E,update:d,initGit:D,setInitialized:L,sandboxes:u,addSandbox:m,removeSandbox:f})})),Ko=Mi.pipe(h.provide(oo),h.provide(c.defaultLayer),h.provide(di.layer));function ge(){return In.use((n)=>n.select().from(x).all().map((o)=>_n(o)))}function ue(n){let o=In.use((t)=>t.select().from(x).where(X(x.id,n)).get());if(!o)return;return _n(o)}function se(n){In.use((o)=>o.update(x).set({time_initialized:Date.now()}).where(X(x.id,n)).run())}import{parse as pe}from"path";var rn=un.create("instance");Hi(()=>rn.use());var tn=new Map,_e=Ki(xn,Ko),Ne=new Set(["/etc","/proc","/sys","/dev","/boot","/root","/var","/private/etc","/private/var"]);function Te(n){if(n===pe(n).root)return"filesystem root is not a valid project directory";for(let o of Ne)if(n===o||c.contains(o,n))return"target is a protected system directory";return null}function le(n){let o=Te(n);if(o)throw Error("Access denied: "+o)}var vn={all:void 0};function Ci(n){return Zn(async()=>{let o=n.project&&n.worktree?{directory:n.directory,worktree:n.worktree,project:n.project}:await _e.runPromise((t)=>t.fromDirectory(n.directory)).then(({project:t,sandbox:s})=>({directory:n.directory,worktree:s,project:t}));return await rn.provide(o,async()=>{await n.init?.()}),o})}function Ji(n,o){let t=o.catch((s)=>{if(tn.get(n)===t)tn.delete(n);throw s});return tn.set(n,t),t}var on={async provide(n){let o=c.resolve(n.directory);le(o);let t=tn.get(o);if(!t)V.Default.info("creating instance",{directory:o}),t=Ji(o,Ci({directory:o,init:n.init}));let s=await t;return rn.provide(s,async()=>{return n.fn()})},get current(){return rn.use()},get directory(){return rn.use().directory},get worktree(){return rn.use().worktree},get project(){return rn.use().project},containsPath(n,o){let t=o??on;if(c.contains(t.directory,n))return!0;if(t.worktree==="/")return!1;return c.contains(t.worktree,n)},bind(n){let o=rn.use();return(...t)=>rn.provide(o,()=>n(...t))},restore(n,o){return rn.provide(n,o)},async reload(n){let o=c.resolve(n.directory);V.Default.info("reloading instance",{directory:o}),await xo(o),tn.delete(o);let t=Ji(o,Ci({...n,directory:o}));return Un.emit("event",{directory:o,project:n.project?.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:o}}}),await t},async dispose(){let{directory:n,project:o}=on;V.Default.info("disposing instance",{directory:n}),await xo(n),tn.delete(n),Un.emit("event",{directory:n,project:o.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:n}}})},async disposeAll(){if(vn.all)return vn.all;return vn.all=Zn(async()=>{V.Default.info("disposing all instances");let n=[...tn.entries()];for(let[o,t]of n){if(tn.get(o)!==t)continue;let s=await t.catch((e)=>{V.Default.warn("instance dispose failed",{key:o,error:e});return});if(!s){if(tn.get(o)===t)tn.delete(o);continue}if(tn.get(o)!==t)continue;await rn.provide(s,async()=>{await on.dispose()})}}).finally(()=>{vn.all=void 0}),vn.all}};var Ri="~qitqode/InstanceState",Oe=(n)=>{try{return on.bind(n)}catch(s){if(!(s instanceof un.NotFound))throw s}let o=Ln.getCurrent(),t=o?Qn.getReferenceUnsafe(o.context,Xn):void 0;if(!t)return n;return(...s)=>on.restore(t,()=>n(...s))},Ro=r.gen(function*(){return(yield*Xn)??on.current}),de=r.gen(function*(){return(yield*ro)??Nn.workspaceID}),to=r.map(Ro,(n)=>n.directory),$e=(n)=>r.gen(function*(){let o=yield*Cn.make({capacity:Number.POSITIVE_INFINITY,lookup:()=>r.gen(function*(){return yield*n(yield*Ro)})}),t=si((s)=>r.runPromise(Cn.invalidate(o,s).pipe(r.provide(Si))));return yield*r.addFinalizer(()=>r.sync(t)),{[Ri]:Ri,cache:o}}),So=(n)=>r.gen(function*(){return yield*Cn.get(n.cache,yield*to)}),Qe=(n,o)=>r.map(So(n),o),Be=(n,o)=>r.flatMap(So(n),o),De=(n)=>r.gen(function*(){return yield*Cn.has(n.cache,yield*to)}),Ie=(n)=>r.gen(function*(){return yield*Cn.invalidate(n.cache,yield*to)});var Pi={};On(Pi,{make:()=>Le});function Ei(n,o,t){if(n&&o!==void 0)return Nn.restore(o,()=>on.restore(n,t));if(n)return on.restore(n,t);if(o!==void 0)return Nn.restore(o,t);return t()}function Le(){return r.gen(function*(){let n=yield*r.context(),t=(yield*Xn)??(()=>{try{return on.current}catch(_){if(!(_ instanceof un.NotFound))throw _}})(),s=(yield*ro)??Nn.workspaceID,e=(_)=>Wi(_,{instance:t,workspace:s}),l=(_)=>e(_).pipe(r.provide(n));return{promise:(_)=>Ei(t,s,()=>r.runPromise(l(_))),fork:(_)=>Ei(t,s,()=>r.runFork(l(_)))}})}var Ui={};On(Ui,{make:()=>Ge,Cancelled:()=>zn});class zn extends N.TaggedErrorClass()("RunnerCancelled",{}){}var Ge=(n,o)=>{let t=Tn.makeUnsafe({_tag:"Idle"}),s=o?.onIdle??r.void,e=o?.onBusy??r.void,l=o?.onInterrupt,_=0,A=()=>Tn.getUnsafe(t),C=()=>{return _+=1,_},S=(m,f)=>kn.isFailure(f)&&Eo.hasInterruptsOnly(f.cause)?sn.fail(m,new zn).pipe(r.asVoid):sn.done(m,f).pipe(r.asVoid),K=()=>Tn.modify(t,(m)=>[m._tag==="Idle"?s:r.void,m]).pipe(r.flatten),R=(m,f,i)=>Tn.modify(t,(y)=>[r.gen(function*(){if(y._tag==="Running"&&y.run.id===m)yield*s;yield*S(f,i)}),y._tag==="Running"&&y.run.id===m?{_tag:"Idle"}:y]).pipe(r.flatten),E=(m,f)=>r.gen(function*(){let i=C(),y=yield*m.pipe(r.onExit(($)=>R(i,f,$)),r.forkIn(n));return{id:i,done:f,fiber:y}}),d=(m)=>Tn.modifyEffect(t,r.fnUntraced(function*(f){if(f._tag==="Shell"&&f.shell.id===m)return[s,{_tag:"Idle"}];if(f._tag==="ShellThenRun"&&f.shell.id===m){let i=yield*E(f.run.work,f.run.done);return[r.void,{_tag:"Running",run:i}]}return[r.void,f]})).pipe(r.flatten),D=(m)=>Ln.interrupt(m.fiber),L=(m)=>Tn.modifyEffect(t,r.fnUntraced(function*(f){switch(f._tag){case"Running":case"ShellThenRun":if(o?.onReentryWarn)yield*o.onReentryWarn({label:o.label??"(unlabeled)",existingRunId:f.run.id});return[sn.await(f.run.done),f];case"Shell":{let i={id:C(),done:yield*sn.make(),work:m};return[sn.await(i.done),{_tag:"ShellThenRun",shell:f.shell,run:i}]}case"Idle":{let i=yield*sn.make(),y=yield*E(m,i);return[sn.await(i),{_tag:"Running",run:y}]}}})).pipe(r.flatten,r.catch((f)=>f instanceof zn?l??r.die(f):r.fail(f))),u=(m)=>Tn.modifyEffect(t,r.fnUntraced(function*(f){if(f._tag!=="Idle")return[r.sync(()=>{if(o?.busy)o.busy();throw Error("Runner is busy")}),f];yield*e;let i=C(),y=yield*m.pipe(r.ensuring(d(i)),r.forkChild),$={id:i,fiber:y};return[r.gen(function*(){let I=yield*Ln.await(y);if(kn.isSuccess(I))return I.value;if(Eo.hasInterruptsOnly(I.cause)&&l)return yield*l;return yield*r.failCause(I.cause)}),{_tag:"Shell",shell:$}]})).pipe(r.flatten),p=Tn.modify(t,(m)=>{switch(m._tag){case"Idle":return[r.void,m];case"Running":return[r.gen(function*(){yield*Ln.interrupt(m.run.fiber);let f=yield*Ln.await(m.run.fiber);yield*S(m.run.done,f),yield*sn.await(m.run.done).pipe(r.exit,r.asVoid),yield*K()}),{_tag:"Idle"}];case"Shell":return[r.gen(function*(){yield*D(m.shell),yield*K()}),{_tag:"Idle"}];case"ShellThenRun":return[r.gen(function*(){yield*sn.fail(m.run.done,new zn).pipe(r.asVoid),yield*D(m.shell),yield*K()}),{_tag:"Idle"}]}}).pipe(r.flatten);return{get state(){return A()},get busy(){return A()._tag!=="Idle"},ensureRunning:L,startShell:u,cancel:p}};import{Database as Me}from"bun:sqlite";function vi(n){let o=new Me(n,{create:!0});return Zi({client:o})}var xe=eo.create("NotFoundError",j.object({message:j.string()})),Xi=V.create({service:"db"});function zi(){if(["latest","beta","prod"].includes(Wo)||nn.QITQODE_DISABLE_CHANNEL_DB)return io.join(dn.Path.data,"qitqode.db");let n=Wo.replace(/[^a-zA-Z0-9._-]/g,"-");return io.join(dn.Path.data,`qitqode-${n}.db`)}var Po=Zn(()=>{if(nn.QITQODE_DB){if(nn.QITQODE_DB===":memory:"||io.isAbsolute(nn.QITQODE_DB))return nn.QITQODE_DB;return io.join(dn.Path.data,nn.QITQODE_DB)}return zi()}),Jn=Yi(()=>{Xi.info("opening database",{path:Po});let n=vi(Po);n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = NORMAL"),n.run("PRAGMA busy_timeout = 5000"),n.run("PRAGMA cache_size = -64000"),n.run("PRAGMA foreign_keys = ON"),n.run("PRAGMA wal_checkpoint(PASSIVE)");let o=[{sql:"CREATE TABLE `project` (\n\t`id` text PRIMARY KEY,\n\t`worktree` text NOT NULL,\n\t`vcs` text,\n\t`name` text,\n\t`icon_url` text,\n\t`icon_color` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_initialized` integer,\n\t`sandboxes` text NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `message` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `part` (\n\t`id` text PRIMARY KEY,\n\t`message_id` text NOT NULL,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_part_message_id_message_id_fk` FOREIGN KEY (`message_id`) REFERENCES `message`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `permission` (\n\t`project_id` text PRIMARY KEY,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session` (\n\t`id` text PRIMARY KEY,\n\t`project_id` text NOT NULL,\n\t`parent_id` text,\n\t`slug` text NOT NULL,\n\t`directory` text NOT NULL,\n\t`title` text NOT NULL,\n\t`version` text NOT NULL,\n\t`share_url` text,\n\t`summary_additions` integer,\n\t`summary_deletions` integer,\n\t`summary_files` integer,\n\t`summary_diffs` text,\n\t`revert` text,\n\t`permission` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_compacting` integer,\n\t`time_archived` integer,\n\tCONSTRAINT `fk_session_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `todo` (\n\t`session_id` text NOT NULL,\n\t`content` text NOT NULL,\n\t`status` text NOT NULL,\n\t`priority` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `todo_pk` PRIMARY KEY(`session_id`, `position`),\n\tCONSTRAINT `fk_todo_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session_share` (\n\t`session_id` text PRIMARY KEY,\n\t`id` text NOT NULL,\n\t`secret` text NOT NULL,\n\t`url` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `fk_session_share_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `message_session_idx` ON `message` (`session_id`);--> statement-breakpoint\nCREATE INDEX `part_message_idx` ON `part` (`message_id`);--> statement-breakpoint\nCREATE INDEX `part_session_idx` ON `part` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_project_idx` ON `session` (`project_id`);--> statement-breakpoint\nCREATE INDEX `session_parent_idx` ON `session` (`parent_id`);--> statement-breakpoint\nCREATE INDEX `todo_session_idx` ON `todo` (`session_id`);",timestamp:1769552633000,name:"20260127222353_familiar_lady_ursula"},{sql:"ALTER TABLE `project` ADD `commands` text;",timestamp:1770830228000,name:"20260211171708_add_project_commands"},{sql:"CREATE TABLE `control_account` (\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`active` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `control_account_pk` PRIMARY KEY(`email`, `url`)\n);\n",timestamp:1770993676000,name:"20260213144116_wakeful_the_professor"},{sql:"CREATE TABLE `workspace` (\n\t`id` text PRIMARY KEY,\n\t`branch` text,\n\t`project_id` text NOT NULL,\n\t`config` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n",timestamp:1772056728000,name:"20260225215848_workspace"},{sql:"ALTER TABLE `session` ADD `workspace_id` text;--> statement-breakpoint\nCREATE INDEX `session_workspace_idx` ON `session` (`workspace_id`);",timestamp:1772228279000,name:"20260227213759_add_session_workspace_id"},{sql:"CREATE TABLE `account` (\n\t`id` text PRIMARY KEY,\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`selected_org_id` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `account_state` (\n\t`id` integer PRIMARY KEY NOT NULL,\n\t`active_account_id` text,\n\tFOREIGN KEY (`active_account_id`) REFERENCES `account`(`id`) ON UPDATE no action ON DELETE set null\n);\n",timestamp:1772310750000,name:"20260228203230_blue_harpoon"},{sql:"ALTER TABLE `workspace` ADD `type` text NOT NULL;--> statement-breakpoint\nALTER TABLE `workspace` ADD `name` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `directory` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `extra` text;--> statement-breakpoint\nALTER TABLE `workspace` DROP COLUMN `config`;",timestamp:1772579546000,name:"20260303231226_add_workspace_fields"},{sql:"ALTER TABLE `account_state` ADD `active_org_id` text;--> statement-breakpoint\nUPDATE `account_state` SET `active_org_id` = (SELECT `selected_org_id` FROM `account` WHERE `account`.`id` = `account_state`.`active_account_id`);--> statement-breakpoint\nALTER TABLE `account` DROP COLUMN `selected_org_id`;\n",timestamp:1773097200000,name:"20260309230000_move_org_to_state"},{sql:"DROP INDEX IF EXISTS `message_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `part_message_idx`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `part_message_id_id_idx` ON `part` (`message_id`,`id`);",timestamp:1773290071000,name:"20260312043431_session_message_cursor"},{sql:"CREATE TABLE `event_sequence` (\n\t`aggregate_id` text PRIMARY KEY,\n\t`seq` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `event` (\n\t`id` text PRIMARY KEY,\n\t`aggregate_id` text NOT NULL,\n\t`seq` integer NOT NULL,\n\t`type` text NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE\n);\n",timestamp:1774309702000,name:"20260323234822_events"},{sql:"PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_workspace` (\n\t`id` text PRIMARY KEY,\n\t`type` text NOT NULL,\n\t`name` text DEFAULT '' NOT NULL,\n\t`branch` text,\n\t`directory` text,\n\t`extra` text,\n\t`project_id` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nINSERT INTO `__new_workspace`(`id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id`) SELECT `id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id` FROM `workspace`;--> statement-breakpoint\nDROP TABLE `workspace`;--> statement-breakpoint\nALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;",timestamp:1775843113000,name:"20260410174513_workspace-name"},{sql:"CREATE TABLE `session_entry` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`type` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_session_entry_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `session_entry_session_idx` ON `session_entry` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_entry_session_type_idx` ON `session_entry` (`session_id`,`type`);--> statement-breakpoint\nCREATE INDEX `session_entry_time_created_idx` ON `session_entry` (`time_created`);",timestamp:1776103196000,name:"20260413175956_chief_energizer"},{sql:"ALTER TABLE `session` ADD `context_from` text;--> statement-breakpoint\nALTER TABLE `session` ADD `context_watermark` text;--> statement-breakpoint\nCREATE INDEX `session_context_from_idx` ON `session` (`context_from`);\n",timestamp:1776873600000,name:"20260422160000_context_inheritance"},{sql:"CREATE TABLE `task_registry` (\n `id` text PRIMARY KEY,\n `parent_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `background` integer NOT NULL,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `task_registry_parent_idx` ON `task_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_idx` ON `task_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_last_turn_idx` ON `task_registry` (`status`, `last_turn_time`);\n",timestamp:1776877200000,name:"20260422170000_task_registry"},{sql:"DROP INDEX IF EXISTS `session_entry_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_session_type_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_time_created_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `session_entry`;\n",timestamp:1776956061000,name:"20260423145421_remove_session_entry"},{sql:"DROP INDEX IF EXISTS `task_registry_parent_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_last_turn_idx`;--> statement-breakpoint\nALTER TABLE `task_registry` RENAME TO `actor_registry`;--> statement-breakpoint\nCREATE INDEX `actor_registry_parent_idx` ON `actor_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1778803200000,name:"20260515000000_actor_rename"},{sql:"CREATE TABLE `memory_fts` (\n `path` text PRIMARY KEY NOT NULL,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);\n--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1778806800000,name:"20260515010000_memory_fts"},{sql:"CREATE TABLE `task` (\n `id` text NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `parent_task_id` text,\n `kind` text NOT NULL DEFAULT 'user',\n `status` text NOT NULL,\n `focus` integer NOT NULL DEFAULT 0,\n `summary` text NOT NULL,\n `created_at` integer NOT NULL,\n `last_event_at` integer NOT NULL,\n `ended_at` integer,\n `cleanup_after` integer,\n PRIMARY KEY (`session_id`, `id`)\n);--> statement-breakpoint\nCREATE INDEX `task_session_idx` ON `task` (`session_id`);--> statement-breakpoint\nCREATE INDEX `task_parent_idx` ON `task` (`session_id`, `parent_task_id`);--> statement-breakpoint\nCREATE INDEX `task_status_idx` ON `task` (`status`);--> statement-breakpoint\nCREATE INDEX `task_kind_idx` ON `task` (`kind`);--> statement-breakpoint\nCREATE UNIQUE INDEX `task_focus_per_session_idx` ON `task` (`session_id`) WHERE focus = 1;--> statement-breakpoint\nCREATE TABLE `task_event` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `task_id` text NOT NULL,\n `at` integer NOT NULL,\n `kind` text NOT NULL,\n `summary` text,\n FOREIGN KEY (`session_id`, `task_id`) REFERENCES `task`(`session_id`, `id`) ON DELETE CASCADE\n);--> statement-breakpoint\nCREATE INDEX `task_event_task_idx` ON `task_event` (`session_id`, `task_id`, `at`);\n",timestamp:1778810400000,name:"20260515020000_user_task"},{sql:"ALTER TABLE `session` ADD `last_checkpoint_message_id` text;\n",timestamp:1779148800000,name:"20260519000000_last_checkpoint_message_id"},{sql:"ALTER TABLE `message` ADD `agent_id` text;--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779321600000,name:"20260521000000_message_agent_id"},{sql:"DROP TABLE `actor_registry`;--> statement-breakpoint\nCREATE TABLE `actor_registry` (\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `actor_id` text NOT NULL,\n `mode` text NOT NULL,\n `parent_actor_id` text,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `context_watermark` text,\n `background` integer NOT NULL,\n `tools` text,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n PRIMARY KEY (`session_id`, `actor_id`)\n);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_agent_idx` ON `actor_registry` (`session_id`, `agent`);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_parent_idx` ON `actor_registry` (`session_id`, `parent_actor_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1779321660000,name:"20260521000100_actor_registry_v6"},{sql:"DROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts`;--> statement-breakpoint\nCREATE TABLE `memory_fts` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `path` text NOT NULL UNIQUE,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='id',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779325200000,name:"20260521010000_memory_fts_v6"},{sql:"-- Fix v6.1 trigger pattern: external content FTS5 vtab requires the 'delete'\n-- magic command to remove OLD body's tokens, NOT a plain DELETE FROM the vtab.\n-- The previous DELETE FROM pattern was contentless-mode syntax misapplied to\n-- external-content mode, leaving stale tokens accumulating until vtab corrupts.\nDROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779328800000,name:"20260521020000_memory_fts_triggers"},{sql:"UPDATE `message` SET `agent_id` = 'main' WHERE `agent_id` IS NULL;--> statement-breakpoint\nCREATE TABLE `message_new` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `agent_id` text NOT NULL DEFAULT 'main',\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL\n);--> statement-breakpoint\nINSERT INTO `message_new` SELECT `id`, `session_id`, COALESCE(`agent_id`, 'main'), `time_created`, `time_updated`, `data` FROM `message`;--> statement-breakpoint\nDROP TABLE `message`;--> statement-breakpoint\nALTER TABLE `message_new` RENAME TO `message`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779753600000,name:"20260526000000_agent_id_main"},{sql:"ALTER TABLE `actor_registry` ADD COLUMN `last_outcome` text;--> statement-breakpoint\nALTER TABLE `actor_registry` ADD COLUMN `lifecycle` text NOT NULL DEFAULT 'ephemeral';--> statement-breakpoint\nALTER TABLE `actor_registry` RENAME COLUMN `error` TO `last_error`;--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'success' WHERE `status` = 'completed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'failure' WHERE `status` = 'failed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'cancelled' WHERE `status` = 'cancelled';--> statement-breakpoint\nUPDATE `actor_registry` SET `status` = 'idle' WHERE `status` IN ('completed','failed','cancelled');--> statement-breakpoint\nUPDATE `actor_registry` SET `lifecycle` = CASE `mode` WHEN 'peer' THEN 'persistent' WHEN 'main' THEN 'persistent' ELSE 'ephemeral' END;\n",timestamp:1779840000000,name:"20260527000000_actor_lifecycle"},{sql:"CREATE TABLE `inbox` (\n `id` text PRIMARY KEY NOT NULL,\n `receiver_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `receiver_actor_id` text NOT NULL,\n `sender_session_id` text,\n `sender_actor_id` text,\n `type` text NOT NULL DEFAULT 'text',\n `content` text NOT NULL,\n `created_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `inbox_receiver_idx` ON `inbox` (`receiver_session_id`,`receiver_actor_id`,`id`);--> statement-breakpoint\nCREATE INDEX `inbox_created_idx` ON `inbox` (`created_at`);\n",timestamp:1779840060000,name:"20260527000100_inbox"},{sql:"-- todo: drop priority column\nALTER TABLE `todo` DROP COLUMN `priority`;\n--> statement-breakpoint\n\n-- task: drop focus-dependent index before dropping its column\nDROP INDEX `task_focus_per_session_idx`;\n--> statement-breakpoint\nDROP INDEX `task_kind_idx`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `focus`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `kind`;\n--> statement-breakpoint\n\n-- migrate status values: proposed/active -> open\nUPDATE `task` SET `status` = 'open' WHERE `status` IN ('proposed', 'active');\n",timestamp:1780012800000,name:"20260529000000_task_todo_redesign"},{sql:"ALTER TABLE `task` ADD COLUMN `owner` text;\n",timestamp:1780444800000,name:"20260603000000_task_in_progress_owner"},{sql:"CREATE TABLE `workflow_run` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `name` text NOT NULL,\n `status` text NOT NULL,\n `running` integer NOT NULL DEFAULT 0,\n `succeeded` integer NOT NULL DEFAULT 0,\n `failed` integer NOT NULL DEFAULT 0,\n `current_phase` text,\n `parent_actor_id` text,\n `args` text,\n `error` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `workflow_run_session_idx` ON `workflow_run` (`session_id`);--> statement-breakpoint\nCREATE INDEX `workflow_run_status_idx` ON `workflow_run` (`status`);\n",timestamp:1780444800000,name:"20260603000000_workflow_run"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `script_sha` text;\n",timestamp:1780531200000,name:"20260604000000_workflow_script_sha"},{sql:"CREATE TABLE `claude_import` (\n `source_uuid` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL\n);\n",timestamp:1780876800000,name:"20260608000000_claude_import"},{sql:"ALTER TABLE `claude_import` ADD `message_ids` text;\n",timestamp:1780880400000,name:"20260608010000_claude_import_message_ids"},{sql:"CREATE TABLE `history_fts` (\n `part_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `message_id` text NOT NULL,\n `project_id` text NOT NULL,\n `kind` text NOT NULL,\n `tool_name` text,\n `body` text NOT NULL,\n `time_created` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `history_fts_session_idx` ON `history_fts` (`session_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_project_idx` ON `history_fts` (`project_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_message_idx` ON `history_fts` (`message_id`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `history_fts_idx` USING fts5(\n body,\n content='history_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `history_fts_ai` AFTER INSERT ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_ad` AFTER DELETE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_au` AFTER UPDATE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1780963200000,name:"20260609000000_history_fts"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `agent_timeout_ms` integer;\n",timestamp:1781046000000,name:"20260609230000_workflow_agent_timeout"},{sql:"CREATE TABLE `external_import` (\n `source` text NOT NULL,\n `source_key` text NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL,\n `message_ids` text,\n PRIMARY KEY (`source`, `source_key`)\n);\n\nINSERT INTO `external_import` (`source`, `source_key`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`)\nSELECT 'cc', `source_uuid`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`\nFROM `claude_import`;\n\nDROP TABLE `claude_import`;\n",timestamp:1781222400000,name:"20260612000000_external_import"}];if(o.length>0){if(Xi.info("applying migrations",{count:o.length,mode:"bundled"}),nn.QITQODE_SKIP_MIGRATIONS)for(let t of o)t.sql="select 1;";bo(n,o)}return n});function Ce(){Jn().$client.close(),Jn.reset()}var Vn=un.create("database");function Je(n){try{return n(Vn.use().tx)}catch(o){if(o instanceof un.NotFound){let t=[],s=Vn.provide({effects:t,tx:Jn()},()=>n(Jn()));for(let e of t)e();return s}throw o}}function He(n){let o=Yn.bind(n);try{Vn.use().effects.push(o)}catch{o()}}function Ke(n,o){try{return n(Vn.use().tx)}catch(t){if(t instanceof un.NotFound){let s=[],e=Yn.bind((_)=>Vn.provide({tx:_,effects:s},()=>n(_))),l=Jn().transaction(e,{behavior:o?.behavior});for(let _ of s)_();return l}throw t}}var ai={};On(ai,{layer:()=>Fi,defaultLayer:()=>we,Service:()=>yo,NotFoundError:()=>Xo});import Y from"path";var Hn={};On(Hn,{layer:()=>wi,defaultLayer:()=>Ee,Service:()=>mo,Git:()=>Hn});var Re=["--no-optional-locks","-c","core.autocrlf=false","-c","core.fsmonitor=false","-c","core.longpaths=true","-c","core.symlinks=true","-c","core.quotepath=false"],cn=(n)=>n.text().trim(),Uo=(n)=>n.split("\x00").filter(Boolean),Se=(n)=>({exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:Buffer.from(n instanceof Error?n.message:String(n))}),ki=(n)=>{if(n==="??")return"added";if(n.includes("U"))return"modified";if(n.includes("A")&&!n.includes("D"))return"added";if(n.includes("D")&&!n.includes("A"))return"deleted";return"modified"};class mo extends Qn.Service()("@qitqode/Git"){}var wi=h.effect(mo,r.gen(function*(){let n=yield*no.ChildProcessSpawner,o=r.fn("Git.run")(function*(u,p){let m=Vi.make("git",[...Re,...u],{cwd:p.cwd,env:p.env,extendEnv:!0,stdin:"ignore",stdout:"pipe",stderr:"pipe"}),f=yield*ci(n,m);return{exitCode:f.code,text:()=>f.text,stdout:Buffer.from(f.text),stderr:Buffer.from(f.stderr)}},r.scoped,r.catch((u)=>r.succeed(Se(u)))),t=r.fn("Git.text")(function*(u,p){return(yield*o(u,p)).text()}),s=r.fn("Git.lines")(function*(u,p){return(yield*t(u,p)).split(/\r?\n/).map((m)=>m.trim()).filter(Boolean)}),e=r.fnUntraced(function*(u){return yield*s(["for-each-ref","--format=%(refname:short)","refs/heads"],{cwd:u})}),l=r.fnUntraced(function*(u,p){let m=yield*o(["config","init.defaultBranch"],{cwd:u}),f=cn(m);if(!f||!p.includes(f))return;return{name:f,ref:f}}),_=r.fnUntraced(function*(u){let p=yield*s(["remote"],{cwd:u});if(p.includes("origin"))return"origin";if(p.length===1)return p[0];if(p.includes("upstream"))return"upstream";return p[0]}),A=r.fn("Git.branch")(function*(u){let p=yield*o(["symbolic-ref","--quiet","--short","HEAD"],{cwd:u});if(p.exitCode!==0)return;return cn(p)||void 0}),C=r.fn("Git.prefix")(function*(u){let p=yield*o(["rev-parse","--show-prefix"],{cwd:u});if(p.exitCode!==0)return"";return cn(p)}),S=r.fn("Git.defaultBranch")(function*(u){let p=yield*_(u);if(p){let i=yield*o(["symbolic-ref",`refs/remotes/${p}/HEAD`],{cwd:u});if(i.exitCode===0){let y=cn(i).replace(/^refs\/remotes\//,""),$=y.startsWith(`${p}/`)?y.slice(`${p}/`.length):"";if($)return{name:$,ref:y}}}let m=yield*e(u),f=yield*l(u,m);if(f)return f;if(m.includes("main"))return{name:"main",ref:"main"};if(m.includes("master"))return{name:"master",ref:"master"}}),K=r.fn("Git.hasHead")(function*(u){return(yield*o(["rev-parse","--verify","HEAD"],{cwd:u})).exitCode===0}),R=r.fn("Git.mergeBase")(function*(u,p,m="HEAD"){let f=yield*o(["merge-base",p,m],{cwd:u});if(f.exitCode!==0)return;return cn(f)||void 0}),E=r.fn("Git.show")(function*(u,p,m,f=""){let i=f?`${f}${m}`:m,y=yield*o(["show",`${p}:${i}`],{cwd:u});if(y.exitCode!==0)return"";if(y.stdout.includes(0))return"";return y.text()}),d=r.fn("Git.status")(function*(u){return Uo(yield*t(["status","--porcelain=v1","--untracked-files=all","--no-renames","-z","--","."],{cwd:u})).flatMap((p)=>{let m=p.slice(3);if(!m)return[];let f=p.slice(0,2);return[{file:m,code:f,status:ki(f)}]})}),D=r.fn("Git.diff")(function*(u,p){let m=Uo(yield*t(["diff","--no-ext-diff","--no-renames","--name-status","-z",p,"--","."],{cwd:u}));return m.flatMap((f,i)=>{if(i%2!==0)return[];let y=m[i+1];if(!f||!y)return[];return[{file:y,code:f,status:ki(f)}]})}),L=r.fn("Git.stats")(function*(u,p){return Uo(yield*t(["diff","--no-ext-diff","--no-renames","--numstat","-z",p,"--","."],{cwd:u})).flatMap((m)=>{let f=m.indexOf("\t"),i=m.indexOf("\t",f+1);if(f===-1||i===-1)return[];let y=m.slice(i+1);if(!y)return[];let $=m.slice(0,f),I=m.slice(f+1,i),O=$==="-"?0:Number.parseInt($||"0",10),U=I==="-"?0:Number.parseInt(I||"0",10);return[{file:y,additions:Number.isFinite(O)?O:0,deletions:Number.isFinite(U)?U:0}]})});return mo.of({run:o,branch:A,prefix:C,defaultBranch:S,hasHead:K,mergeBase:R,show:E,status:d,diff:D,stats:L})})),Ee=wi.pipe(h.provide(oo));var ln=V.create({service:"storage"}),Xo=eo.create("NotFoundError",j.object({message:j.string()})),We=N.Struct({path:N.optional(N.Struct({root:N.optional(N.String)}))}),Pe=N.Struct({id:N.String}),Ue=N.Struct({id:N.String}),Ze=N.Struct({additions:N.Number,deletions:N.Number}),ve=N.Struct({id:N.String,projectID:N.String,summary:N.Struct({diffs:N.Array(Ze)})}),Xe=N.decodeUnknownOption(We),Ye=N.decodeUnknownOption(Pe),ze=N.decodeUnknownOption(Ue),ke=N.decodeUnknownOption(ve);class yo extends Qn.Service()("@qitqode/Storage"){}function Ve(n,o){return Y.join(n,...o)+".json"}function Zo(n){if(!n||typeof n!=="object")return!1;if("code"in n&&n.code==="ENOENT")return!0;if("reason"in n&&n.reason&&typeof n.reason==="object"&&"_tag"in n.reason)return n.reason._tag==="NotFound";return!1}function ce(n){let o=Number.parseInt(n,10);return Number.isNaN(o)?0:o}var qi=[r.fn("Storage.migration.1")(function*(n,o,t){let s=Y.resolve(n,"../project");if(!(yield*o.isDir(s)))return;let e=yield*o.glob("*",{cwd:s,include:"all"});for(let l of e){let _=Y.join(s,l);if(!(yield*o.isDir(_)))continue;ln.info(`migrating project ${l}`);let A=l,C="/";if(A!=="global"){for(let R of yield*o.glob("storage/session/message/*/*.json",{cwd:_,absolute:!0})){let E=Xe(yield*o.readJson(R),{onExcessProperty:"preserve"}),d=wn.isSome(E)?E.value.path?.root:void 0;if(!d)continue;C=d;break}if(!C)continue;if(!(yield*o.isDir(C)))continue;let S=yield*t.run(["rev-list","--max-parents=0","--all"],{cwd:C}),[K]=S.text().split(`
5
- `).filter(Boolean).map((R)=>R.trim()).toSorted();if(!K)continue;A=K,yield*o.writeWithDirs(Y.join(n,"project",A+".json"),JSON.stringify({id:K,vcs:"git",worktree:C,time:{created:Date.now(),initialized:Date.now()}},null,2)),ln.info(`migrating sessions for project ${A}`);for(let R of yield*o.glob("storage/session/info/*.json",{cwd:_,absolute:!0})){let E=Y.join(n,"session",A,Y.basename(R));ln.info("copying",{sessionFile:R,dest:E});let d=yield*o.readJson(R),D=Ye(d,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(E,JSON.stringify(d,null,2)),wn.isNone(D))continue;ln.info(`migrating messages for session ${D.value.id}`);for(let L of yield*o.glob(`storage/session/message/${D.value.id}/*.json`,{cwd:_,absolute:!0})){let u=Y.join(n,"message",D.value.id,Y.basename(L));ln.info("copying",{msgFile:L,dest:u});let p=yield*o.readJson(L),m=ze(p,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(u,JSON.stringify(p,null,2)),wn.isNone(m))continue;ln.info(`migrating parts for message ${m.value.id}`);for(let f of yield*o.glob(`storage/session/part/${D.value.id}/${m.value.id}/*.json`,{cwd:_,absolute:!0})){let i=Y.join(n,"part",m.value.id,Y.basename(f)),y=yield*o.readJson(f);ln.info("copying",{partFile:f,dest:i}),yield*o.writeWithDirs(i,JSON.stringify(y,null,2))}}}}}}),r.fn("Storage.migration.2")(function*(n,o){for(let t of yield*o.glob("session/*/*.json",{cwd:n,absolute:!0})){let s=yield*o.readJson(t),e=ke(s,{onExcessProperty:"preserve"});if(wn.isNone(e))continue;let l=e.value.summary.diffs;yield*o.writeWithDirs(Y.join(n,"session_diff",e.value.id+".json"),JSON.stringify(l,null,2)),yield*o.writeWithDirs(Y.join(n,"session",e.value.projectID,e.value.id+".json"),JSON.stringify({...s,summary:{additions:l.reduce((_,A)=>_+A.additions,0),deletions:l.reduce((_,A)=>_+A.deletions,0)}},null,2))}})],Fi=h.effect(yo,r.gen(function*(){let n=yield*c.Service,o=yield*Hn.Service,t=yield*vo.make({lookup:()=>Kn.make(),idleTimeToLive:0}),s=yield*r.cached(r.gen(function*(){let d=Y.join(dn.Path.data,"storage"),D=Y.join(d,"migration"),L=yield*n.readFileString(D).pipe(r.map(ce),r.catchIf(Zo,()=>r.succeed(0)),r.orElseSucceed(()=>0));for(let u=L;u<qi.length;u++){ln.info("running migration",{index:u});let p=qi[u],m=yield*r.exit(p(d,n,o));if(kn.isFailure(m)){ln.error("failed to run migration",{index:u,cause:m.cause});break}yield*n.writeWithDirs(D,String(u+1))}return{dir:d}})),e=(d)=>r.fail(new Xo({message:`Resource not found: ${d}`})),l=(d,D)=>D.pipe(r.catchIf(Zo,()=>e(d))),_=r.fnUntraced(function*(d,D){yield*n.writeWithDirs(d,JSON.stringify(D,null,2))}),A=(d,D)=>r.scoped(r.gen(function*(){let L=Ve((yield*s).dir,d);return yield*D(L,yield*vo.get(t,L))})),C=r.fn("Storage.remove")(function*(d){yield*A(d,(D,L)=>Kn.withWriteLock(L,n.remove(D).pipe(r.catchIf(Zo,()=>r.void))))}),S=(d)=>r.gen(function*(){return yield*A(d,(L,u)=>Kn.withReadLock(u,l(L,n.readJson(L))))}),K=(d,D)=>r.gen(function*(){return yield*A(d,(u,p)=>Kn.withWriteLock(p,r.gen(function*(){let m=yield*l(u,n.readJson(u));return D(m),yield*_(u,m),m})))}),R=(d,D)=>r.gen(function*(){yield*A(d,(L,u)=>Kn.withWriteLock(u,_(L,D)))}),E=r.fn("Storage.list")(function*(d){let D=(yield*s).dir,L=Y.join(D,...d);return(yield*n.glob("**/*",{cwd:L,include:"file"}).pipe(r.catch(()=>r.succeed([])))).map((p)=>[...d,...p.slice(0,-5).split(Y.sep)]).toSorted((p,m)=>p.join("/").localeCompare(m.join("/")))});return yo.of({remove:C,read:S,update:K,write:R,list:E})})),we=Fi.pipe(h.provide(c.defaultLayer),h.provide(Hn.defaultLayer));export{Un as Ql,si as Rl,Zn as Sl,mn as Tl,x as Ul,gn as Vl,fo as Wl,zo as Xl,ko as Yl,Vo as Zl,co as _l,qo as $l,uo as am,In as bm,Hn as cm,Xo as dm,ai as em,q as fm,Co as gm,Ti as hm,se as im,xi as jm,Te as km,on as lm,Yn as mm,Le as nm,Pi as om,Ui as pm};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{dQ as t}from"./chunk-aztre27e.js";var e=await import("./chunk-ht81ensf.js",{with:{type:"file"}}),a=e.default;export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-aztre27e.js";var E="./tree-sitter-markdown_inline-j5349f42.wasm";export{E as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{bq as a}from"./chunk-dcvatax2.js";import"./chunk-be216spx.js";import"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-aztre27e.js";export{a as which};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ed as d}from"./chunk-07g7cybt.js";import{Rd as f}from"./chunk-yajd975f.js";import{Vf as e}from"./chunk-7ppd2phw.js";import{hh as l}from"./chunk-ddnpx1yx.js";import"./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{Cl as u,kk as m}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"./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"./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"./chunk-3szwfy7w.js";import"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.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};