@stigmer/server-slim 0.1.0

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 (564) hide show
  1. package/README.md +3 -0
  2. package/console/404.html +1 -0
  3. package/console/__next.__PAGE__.txt +54 -0
  4. package/console/__next._full.txt +71 -0
  5. package/console/__next._index.txt +62 -0
  6. package/console/__next._tree.txt +6 -0
  7. package/console/_next/static/GjBokeF86FffwftazOhh6/_buildManifest.js +11 -0
  8. package/console/_next/static/GjBokeF86FffwftazOhh6/_clientMiddlewareManifest.js +1 -0
  9. package/console/_next/static/GjBokeF86FffwftazOhh6/_ssgManifest.js +1 -0
  10. package/console/_next/static/chunks/0376wi8qbsw94.js +1 -0
  11. package/console/_next/static/chunks/04cglffeuwumk.js +1 -0
  12. package/console/_next/static/chunks/04d276dp3qb52.js +1 -0
  13. package/console/_next/static/chunks/05526ws9tzwim.js +1 -0
  14. package/console/_next/static/chunks/05t5235u7o-c4.js +25 -0
  15. package/console/_next/static/chunks/06fz-g9t73bd6.js +4 -0
  16. package/console/_next/static/chunks/0789xt7opwvm-.js +24 -0
  17. package/console/_next/static/chunks/07twy5plc911w.js +1 -0
  18. package/console/_next/static/chunks/08-p5zefc1rea.js +1 -0
  19. package/console/_next/static/chunks/085db4op75mf5.js +1 -0
  20. package/console/_next/static/chunks/0923388wak11-.js +1 -0
  21. package/console/_next/static/chunks/0_7s7fzux7kiv.js +1 -0
  22. package/console/_next/static/chunks/0_bjj6hug8d9a.js +1 -0
  23. package/console/_next/static/chunks/0_zscrk6o0d0-.js +1 -0
  24. package/console/_next/static/chunks/0a4x97q7frgj3.js +1 -0
  25. package/console/_next/static/chunks/0ab5jlm8l0aud.js +1 -0
  26. package/console/_next/static/chunks/0c_c2b4z1yc02.js +1 -0
  27. package/console/_next/static/chunks/0cuyycns49hl4.js +1 -0
  28. package/console/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
  29. package/console/_next/static/chunks/0d8f3-znyc_to.js +1 -0
  30. package/console/_next/static/chunks/0e-f1rkyz_u2k.js +1 -0
  31. package/console/_next/static/chunks/0ffx83gbnwq09.js +28 -0
  32. package/console/_next/static/chunks/0fyno0jk61txk.js +115 -0
  33. package/console/_next/static/chunks/0ggwoicp90w_s.js +1 -0
  34. package/console/_next/static/chunks/0h_7_i44vofe3.js +1 -0
  35. package/console/_next/static/chunks/0hagmppwo8s-f.js +1 -0
  36. package/console/_next/static/chunks/0hfvbn6c9k3pf.js +1 -0
  37. package/console/_next/static/chunks/0hw7vilkfpzlc.js +1 -0
  38. package/console/_next/static/chunks/0kb63xcvghh_3.js +1 -0
  39. package/console/_next/static/chunks/0ko5wsi6kukgd.js +1 -0
  40. package/console/_next/static/chunks/0kq99qin4db-q.js +1 -0
  41. package/console/_next/static/chunks/0kqg4u5n17gje.js +1 -0
  42. package/console/_next/static/chunks/0ky9qppyx1n57.js +62 -0
  43. package/console/_next/static/chunks/0og4_5pph-mhm.js +1 -0
  44. package/console/_next/static/chunks/0p7p-bpdrqx75.js +1 -0
  45. package/console/_next/static/chunks/0q2bnr94vvuc2.js +1 -0
  46. package/console/_next/static/chunks/0q3sxhnylk_gn.js +1 -0
  47. package/console/_next/static/chunks/0qg6l3tattq3j.js +1 -0
  48. package/console/_next/static/chunks/0qwyk_70quvjh.js +1 -0
  49. package/console/_next/static/chunks/0qzyqii8_m5r2.js +1 -0
  50. package/console/_next/static/chunks/0rlfx91598uvc.js +1 -0
  51. package/console/_next/static/chunks/0s9njms3lumhx.js +1 -0
  52. package/console/_next/static/chunks/0srualwd948m1.js +29 -0
  53. package/console/_next/static/chunks/0u4m2805tgi7x.js +1 -0
  54. package/console/_next/static/chunks/0udcs-1vq74rp.js +1 -0
  55. package/console/_next/static/chunks/0vno04lmwdchj.js +1 -0
  56. package/console/_next/static/chunks/0vt1_fu_q116n.js +1 -0
  57. package/console/_next/static/chunks/0vuq85gcb9zcl.js +1 -0
  58. package/console/_next/static/chunks/0wxazby0i4xu3.js +5 -0
  59. package/console/_next/static/chunks/0yeh2zqwmmec0.js +22 -0
  60. package/console/_next/static/chunks/0zvl88sijsrqk.js +1 -0
  61. package/console/_next/static/chunks/110bgpy30m6m6.js +1 -0
  62. package/console/_next/static/chunks/14ipylvs6qyyw.js +1 -0
  63. package/console/_next/static/chunks/1745jt9onokna.js +1 -0
  64. package/console/_next/static/chunks/177rfq0tsoku9.js +4 -0
  65. package/console/_next/static/chunks/17mfsiiquey1d.js +1 -0
  66. package/console/_next/static/chunks/197iuvi8udifl.js +1 -0
  67. package/console/_next/static/chunks/1_2-z0tjk0xio.js +1 -0
  68. package/console/_next/static/chunks/1_gh5a14dqnji.js +1 -0
  69. package/console/_next/static/chunks/1ame8n7x9g3xc.js +1 -0
  70. package/console/_next/static/chunks/1apepr-7dz16b.js +1 -0
  71. package/console/_next/static/chunks/1dtukwrl8nulc.js +1 -0
  72. package/console/_next/static/chunks/1e0br64ibniud.js +24 -0
  73. package/console/_next/static/chunks/1fm-45g777ifx.js +1 -0
  74. package/console/_next/static/chunks/1g_iha5barqef.js +1 -0
  75. package/console/_next/static/chunks/1glr_lki18csr.js +2 -0
  76. package/console/_next/static/chunks/1hl355w6m5bp5.js +1 -0
  77. package/console/_next/static/chunks/1id3p9v9v5knn.js +1 -0
  78. package/console/_next/static/chunks/1j6kp4gg0_ylt.js +80 -0
  79. package/console/_next/static/chunks/1jssq3ch7qgd6.js +60 -0
  80. package/console/_next/static/chunks/1jzfyfh-3gqlb.js +1 -0
  81. package/console/_next/static/chunks/1k3d5c49mpp-2.js +1 -0
  82. package/console/_next/static/chunks/1kte_bxw9m-ie.js +1 -0
  83. package/console/_next/static/chunks/1lw52jm27gon2.js +1 -0
  84. package/console/_next/static/chunks/1m9e28v8syzxx.js +34 -0
  85. package/console/_next/static/chunks/1mrmq_pigo_yb.js +1 -0
  86. package/console/_next/static/chunks/1muf1a96cgbv5.js +1 -0
  87. package/console/_next/static/chunks/1n1x0ykt8by6w.js +1 -0
  88. package/console/_next/static/chunks/1qu0tqybdtj0_.js +1 -0
  89. package/console/_next/static/chunks/1r8itpdfffwxa.js +1 -0
  90. package/console/_next/static/chunks/1r_opkrpbuykx.js +1 -0
  91. package/console/_next/static/chunks/1tl0h3c_bp62t.js +1 -0
  92. package/console/_next/static/chunks/1v1m1fr8f0yle.js +1 -0
  93. package/console/_next/static/chunks/1v34vj52v7q0g.js +1 -0
  94. package/console/_next/static/chunks/1wztfxoxnu5_9.js +1 -0
  95. package/console/_next/static/chunks/1x7exm5d_hhb8.js +153 -0
  96. package/console/_next/static/chunks/1xwdphzrhi9cn.js +1 -0
  97. package/console/_next/static/chunks/1yc4gdqzxa5ie.js +1 -0
  98. package/console/_next/static/chunks/1zunrzvni97zi.js +1 -0
  99. package/console/_next/static/chunks/1zv6mtmekep40.js +36 -0
  100. package/console/_next/static/chunks/2-jaie5wchnsy.js +1 -0
  101. package/console/_next/static/chunks/20aa5hen470pm.js +1 -0
  102. package/console/_next/static/chunks/2116ko93nwgx8.js +1 -0
  103. package/console/_next/static/chunks/23vk0ig36j0he.js +1 -0
  104. package/console/_next/static/chunks/245vlws7l85dk.js +1 -0
  105. package/console/_next/static/chunks/24__o4dkdytc8.js +1 -0
  106. package/console/_next/static/chunks/24iwqo9ejhxl8.js +127 -0
  107. package/console/_next/static/chunks/24o9ia1be2cze.js +1 -0
  108. package/console/_next/static/chunks/25aea0bgjydel.css +1 -0
  109. package/console/_next/static/chunks/26-p2jxr4f20d.js +1 -0
  110. package/console/_next/static/chunks/28c--yt2jaxxf.js +1 -0
  111. package/console/_next/static/chunks/28vym848oh1ng.js +1 -0
  112. package/console/_next/static/chunks/29ou6qb6p1lni.js +1 -0
  113. package/console/_next/static/chunks/2aalpmeu_tni-.js +3 -0
  114. package/console/_next/static/chunks/2c4ifddi2dal0.js +20 -0
  115. package/console/_next/static/chunks/2ckm4edha_gkb.js +43 -0
  116. package/console/_next/static/chunks/2d5ods6a8n6yd.js +1 -0
  117. package/console/_next/static/chunks/2dm5g7ylrulvb.js +15 -0
  118. package/console/_next/static/chunks/2dtosus35_o5k.js +1 -0
  119. package/console/_next/static/chunks/2e0_cm1_wv-b4.js +1 -0
  120. package/console/_next/static/chunks/2fh_0n31hibdi.js +226 -0
  121. package/console/_next/static/chunks/2fjsaw5pgjcqb.js +1 -0
  122. package/console/_next/static/chunks/2h5pk3yu15nwr.js +1 -0
  123. package/console/_next/static/chunks/2i7w4yyf77gzw.js +1 -0
  124. package/console/_next/static/chunks/2jo3q7mfk65kd.js +1 -0
  125. package/console/_next/static/chunks/2jutbapb-t64n.js +31 -0
  126. package/console/_next/static/chunks/2k6tx8-w1creu.js +148 -0
  127. package/console/_next/static/chunks/2kh_m5onqedc5.js +1 -0
  128. package/console/_next/static/chunks/2ltzdgpjq3v6a.js +1 -0
  129. package/console/_next/static/chunks/2o2ftjhtb8od3.js +2 -0
  130. package/console/_next/static/chunks/2pyn841-jq-oo.js +10 -0
  131. package/console/_next/static/chunks/2rn289343m-y_.js +139 -0
  132. package/console/_next/static/chunks/2t2l3h2w_04bb.js +1 -0
  133. package/console/_next/static/chunks/2v11hooq3xd5t.js +15 -0
  134. package/console/_next/static/chunks/2vsg5t3fnqmfn.js +1 -0
  135. package/console/_next/static/chunks/2wayafjfoiq7q.css +6 -0
  136. package/console/_next/static/chunks/2xsvteosdtsb-.js +1 -0
  137. package/console/_next/static/chunks/2y-x8nhnufxzb.js +1 -0
  138. package/console/_next/static/chunks/2za4b-si894xj.js +1 -0
  139. package/console/_next/static/chunks/3-igvp1-n4pxs.js +104 -0
  140. package/console/_next/static/chunks/3-k25f-adpe5f.js +1 -0
  141. package/console/_next/static/chunks/3-pzmot7dbrfa.js +1 -0
  142. package/console/_next/static/chunks/3-x5lrgs3wcpl.js +80 -0
  143. package/console/_next/static/chunks/30nrkrr9518_z.js +1 -0
  144. package/console/_next/static/chunks/316lh1-hzgnod.js +1 -0
  145. package/console/_next/static/chunks/31wj1au8smjge.js +1 -0
  146. package/console/_next/static/chunks/329o6uup9qmb3.js +1 -0
  147. package/console/_next/static/chunks/34_1w929-5o6r.js +287 -0
  148. package/console/_next/static/chunks/35szx1ga574xu.js +1 -0
  149. package/console/_next/static/chunks/36tg522pkl8hm.js +1 -0
  150. package/console/_next/static/chunks/37-y9fgnir35a.js +1 -0
  151. package/console/_next/static/chunks/39wss1g0ffaqt.js +1 -0
  152. package/console/_next/static/chunks/3_cv0gj1bm3l6.js +1 -0
  153. package/console/_next/static/chunks/3_f8gd_6816re.js +101 -0
  154. package/console/_next/static/chunks/3a4qfuhsxefh2.js +12 -0
  155. package/console/_next/static/chunks/3asb3ztrvogwl.js +1 -0
  156. package/console/_next/static/chunks/3bsxbw10qhvqo.js +1 -0
  157. package/console/_next/static/chunks/3by94g38ljxl1.js +1 -0
  158. package/console/_next/static/chunks/3c_6owv8m4rta.js +90 -0
  159. package/console/_next/static/chunks/3ea2eo8b5gmju.js +2 -0
  160. package/console/_next/static/chunks/3ercnb2rksl_a.js +1 -0
  161. package/console/_next/static/chunks/3esxfmmm0ypxb.js +2 -0
  162. package/console/_next/static/chunks/3exiw74xbmika.js +1 -0
  163. package/console/_next/static/chunks/3f88-tc5u2heg.js +1 -0
  164. package/console/_next/static/chunks/3f_axahrombdp.js +1 -0
  165. package/console/_next/static/chunks/3gz91kn_v2lfa.js +1 -0
  166. package/console/_next/static/chunks/3i9z3x7tka5x2.js +1 -0
  167. package/console/_next/static/chunks/3ih4kfufd47st.js +1 -0
  168. package/console/_next/static/chunks/3itfi41ayfopd.js +15 -0
  169. package/console/_next/static/chunks/3iwgig-fgcscf.js +15 -0
  170. package/console/_next/static/chunks/3jf8qh1ev3gb4.js +2 -0
  171. package/console/_next/static/chunks/3l6svfyqdsq6o.js +1 -0
  172. package/console/_next/static/chunks/3lj0i-qlb4ah2.js +64 -0
  173. package/console/_next/static/chunks/3lmx6tkunfd3u.js +1 -0
  174. package/console/_next/static/chunks/3lp4d64he__am.js +152 -0
  175. package/console/_next/static/chunks/3m_jz3b2j38nn.js +1 -0
  176. package/console/_next/static/chunks/3oe9w1b39nzmn.js +3 -0
  177. package/console/_next/static/chunks/3on7r_d8o-kna.js +1 -0
  178. package/console/_next/static/chunks/3pbpowf3kdu5z.js +119 -0
  179. package/console/_next/static/chunks/3pwwv0u29nk8c.js +23 -0
  180. package/console/_next/static/chunks/3rweyye6o1z6b.js +79 -0
  181. package/console/_next/static/chunks/3sdqgrmvxm_u4.js +201 -0
  182. package/console/_next/static/chunks/3t3vbs-x5hixj.js +1 -0
  183. package/console/_next/static/chunks/3thqnz0a5zy-h.js +9 -0
  184. package/console/_next/static/chunks/3udubdawo7583.js +1 -0
  185. package/console/_next/static/chunks/3uz4lg6e199sb.js +1 -0
  186. package/console/_next/static/chunks/3v2mkz_46uei2.js +1 -0
  187. package/console/_next/static/chunks/3w5crjmhb-3um.js +1 -0
  188. package/console/_next/static/chunks/3waxhrmr_82j5.js +93 -0
  189. package/console/_next/static/chunks/3zmlzef_jxopu.js +1 -0
  190. package/console/_next/static/chunks/3zqvalj8nr-1y.js +1 -0
  191. package/console/_next/static/chunks/40igag4gq4k0a.js +77 -0
  192. package/console/_next/static/chunks/40wq034qcdji_.js +1 -0
  193. package/console/_next/static/chunks/44crhetqymq_e.js +34 -0
  194. package/console/_next/static/chunks/44q2pv6a3w19q.js +1 -0
  195. package/console/_next/static/chunks/turbopack-2u1d16houkiyo.js +1 -0
  196. package/console/_next/static/media/GeistMono_Variable-s.p.21mfa-4xv0w3g.woff2 +0 -0
  197. package/console/_next/static/media/Geist_Variable-s.p.217kyf1h_p0cg.woff2 +0 -0
  198. package/console/_next/static/media/IBMPlexMono_Medium-s.2v25u5rd2tsaf.woff2 +0 -0
  199. package/console/_next/static/media/IBMPlexMono_Regular-s.09u63wo58kris.woff2 +0 -0
  200. package/console/_next/static/media/IBMPlexSans_Bold-s.3iicodgz0epim.woff2 +0 -0
  201. package/console/_next/static/media/IBMPlexSans_Light-s.3ntejfdcyftfg.woff2 +0 -0
  202. package/console/_next/static/media/IBMPlexSans_Medium-s.3n25cgfiu6qss.woff2 +0 -0
  203. package/console/_next/static/media/IBMPlexSans_Regular-s.2e_-c_m03txvi.woff2 +0 -0
  204. package/console/_next/static/media/IBMPlexSans_SemiBold-s.2sutjpuns2xc5.woff2 +0 -0
  205. package/console/_next/static/media/Inter_Variable-s.2-lfiv6s83kzn.woff2 +0 -0
  206. package/console/_next/static/media/Nunito_Variable-s.3r4_r9s3kxd_-.woff2 +0 -0
  207. package/console/_not-found/__next._full.txt +73 -0
  208. package/console/_not-found/__next._index.txt +62 -0
  209. package/console/_not-found/__next._not-found.__PAGE__.txt +61 -0
  210. package/console/_not-found/__next._tree.txt +5 -0
  211. package/console/_not-found.html +1 -0
  212. package/console/_not-found.txt +73 -0
  213. package/console/apple-touch-icon-dark.png +0 -0
  214. package/console/apple-touch-icon-light.png +0 -0
  215. package/console/auth/callback/__next._full.txt +82 -0
  216. package/console/auth/callback/__next._index.txt +62 -0
  217. package/console/auth/callback/__next._tree.txt +8 -0
  218. package/console/auth/callback/__next.auth.callback.__PAGE__.txt +67 -0
  219. package/console/auth/callback.html +1 -0
  220. package/console/auth/callback.txt +82 -0
  221. package/console/auth/oauth/callback/__next._full.txt +84 -0
  222. package/console/auth/oauth/callback/__next._index.txt +62 -0
  223. package/console/auth/oauth/callback/__next._tree.txt +9 -0
  224. package/console/auth/oauth/callback/__next.auth.oauth.callback.__PAGE__.txt +69 -0
  225. package/console/auth/oauth/callback.html +1 -0
  226. package/console/auth/oauth/callback.txt +84 -0
  227. package/console/brand-avatar.png +0 -0
  228. package/console/chat/__placeholder__/__next._full.txt +80 -0
  229. package/console/chat/__placeholder__/__next._index.txt +62 -0
  230. package/console/chat/__placeholder__/__next._tree.txt +8 -0
  231. package/console/chat/__placeholder__/__next.chat.$d$channel.__PAGE__.txt +65 -0
  232. package/console/chat/__placeholder__.html +1 -0
  233. package/console/chat/__placeholder__.txt +80 -0
  234. package/console/connect/__placeholder__/__next._full.txt +79 -0
  235. package/console/connect/__placeholder__/__next._index.txt +62 -0
  236. package/console/connect/__placeholder__/__next._tree.txt +8 -0
  237. package/console/connect/__placeholder__/__next.connect.$d$token.__PAGE__.txt +64 -0
  238. package/console/connect/__placeholder__.html +1 -0
  239. package/console/connect/__placeholder__.txt +79 -0
  240. package/console/conversations/__next._full.txt +79 -0
  241. package/console/conversations/__next._index.txt +62 -0
  242. package/console/conversations/__next._tree.txt +7 -0
  243. package/console/conversations/__next.conversations.__PAGE__.txt +64 -0
  244. package/console/conversations/__placeholder__/__placeholder__/__next._full.txt +83 -0
  245. package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +62 -0
  246. package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +9 -0
  247. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.__PAGE__.txt +68 -0
  248. package/console/conversations/__placeholder__/__placeholder__.html +1 -0
  249. package/console/conversations/__placeholder__/__placeholder__.txt +83 -0
  250. package/console/conversations.html +1 -0
  251. package/console/conversations.txt +79 -0
  252. package/console/dashboard/__next._full.txt +77 -0
  253. package/console/dashboard/__next._index.txt +62 -0
  254. package/console/dashboard/__next._tree.txt +7 -0
  255. package/console/dashboard/__next.dashboard.__PAGE__.txt +62 -0
  256. package/console/dashboard.html +1 -0
  257. package/console/dashboard.txt +77 -0
  258. package/console/desktop/billing/__next._full.txt +82 -0
  259. package/console/desktop/billing/__next._index.txt +62 -0
  260. package/console/desktop/billing/__next._tree.txt +8 -0
  261. package/console/desktop/billing/__next.desktop.billing.__PAGE__.txt +67 -0
  262. package/console/desktop/billing.html +1 -0
  263. package/console/desktop/billing.txt +82 -0
  264. package/console/embed.js +1 -0
  265. package/console/favicon-dark-16x16.png +0 -0
  266. package/console/favicon-dark-32x32.png +0 -0
  267. package/console/favicon-dark.ico +0 -0
  268. package/console/favicon-dark.svg +1 -0
  269. package/console/favicon-light-16x16.png +0 -0
  270. package/console/favicon-light-32x32.png +0 -0
  271. package/console/favicon-light.ico +0 -0
  272. package/console/favicon-light.svg +1 -0
  273. package/console/index.html +1 -0
  274. package/console/index.txt +71 -0
  275. package/console/invite/__placeholder__/__next._full.txt +80 -0
  276. package/console/invite/__placeholder__/__next._index.txt +62 -0
  277. package/console/invite/__placeholder__/__next._tree.txt +8 -0
  278. package/console/invite/__placeholder__/__next.invite.$d$token.__PAGE__.txt +65 -0
  279. package/console/invite/__placeholder__.html +1 -0
  280. package/console/invite/__placeholder__.txt +80 -0
  281. package/console/library/__next._full.txt +89 -0
  282. package/console/library/__next._index.txt +62 -0
  283. package/console/library/__next._tree.txt +7 -0
  284. package/console/library/__next.library.__PAGE__.txt +74 -0
  285. package/console/library/agents/__next._full.txt +94 -0
  286. package/console/library/agents/__next._index.txt +62 -0
  287. package/console/library/agents/__next._tree.txt +8 -0
  288. package/console/library/agents/__next.library.agents.__PAGE__.txt +79 -0
  289. package/console/library/agents/__placeholder__/__placeholder__/__next._full.txt +96 -0
  290. package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +62 -0
  291. package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +10 -0
  292. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.__PAGE__.txt +81 -0
  293. package/console/library/agents/__placeholder__/__placeholder__.html +1 -0
  294. package/console/library/agents/__placeholder__/__placeholder__.txt +96 -0
  295. package/console/library/agents/new/__next._full.txt +99 -0
  296. package/console/library/agents/new/__next._index.txt +62 -0
  297. package/console/library/agents/new/__next._tree.txt +9 -0
  298. package/console/library/agents/new/__next.library.agents.new.__PAGE__.txt +84 -0
  299. package/console/library/agents/new.html +1 -0
  300. package/console/library/agents/new.txt +99 -0
  301. package/console/library/agents.html +1 -0
  302. package/console/library/agents.txt +94 -0
  303. package/console/library/environments/__next._full.txt +95 -0
  304. package/console/library/environments/__next._index.txt +62 -0
  305. package/console/library/environments/__next._tree.txt +8 -0
  306. package/console/library/environments/__next.library.environments.__PAGE__.txt +80 -0
  307. package/console/library/environments/__placeholder__/__placeholder__/__next._full.txt +97 -0
  308. package/console/library/environments/__placeholder__/__placeholder__/__next._index.txt +62 -0
  309. package/console/library/environments/__placeholder__/__placeholder__/__next._tree.txt +10 -0
  310. package/console/library/environments/__placeholder__/__placeholder__/__next.library.environments.$d$org.$d$slug.__PAGE__.txt +82 -0
  311. package/console/library/environments/__placeholder__/__placeholder__.html +1 -0
  312. package/console/library/environments/__placeholder__/__placeholder__.txt +97 -0
  313. package/console/library/environments/new/__next._full.txt +99 -0
  314. package/console/library/environments/new/__next._index.txt +62 -0
  315. package/console/library/environments/new/__next._tree.txt +9 -0
  316. package/console/library/environments/new/__next.library.environments.new.__PAGE__.txt +84 -0
  317. package/console/library/environments/new.html +1 -0
  318. package/console/library/environments/new.txt +99 -0
  319. package/console/library/environments.html +1 -0
  320. package/console/library/environments.txt +95 -0
  321. package/console/library/files/__next._full.txt +94 -0
  322. package/console/library/files/__next._index.txt +62 -0
  323. package/console/library/files/__next._tree.txt +8 -0
  324. package/console/library/files/__next.library.files.__PAGE__.txt +79 -0
  325. package/console/library/files.html +1 -0
  326. package/console/library/files.txt +94 -0
  327. package/console/library/plugins/__next._full.txt +94 -0
  328. package/console/library/plugins/__next._index.txt +62 -0
  329. package/console/library/plugins/__next._tree.txt +8 -0
  330. package/console/library/plugins/__next.library.plugins.__PAGE__.txt +79 -0
  331. package/console/library/plugins/__placeholder__/__placeholder__/__next._full.txt +97 -0
  332. package/console/library/plugins/__placeholder__/__placeholder__/__next._index.txt +62 -0
  333. package/console/library/plugins/__placeholder__/__placeholder__/__next._tree.txt +10 -0
  334. package/console/library/plugins/__placeholder__/__placeholder__/__next.library.plugins.$d$org.$d$slug.__PAGE__.txt +82 -0
  335. package/console/library/plugins/__placeholder__/__placeholder__.html +1 -0
  336. package/console/library/plugins/__placeholder__/__placeholder__.txt +97 -0
  337. package/console/library/plugins/upload/__next._full.txt +99 -0
  338. package/console/library/plugins/upload/__next._index.txt +62 -0
  339. package/console/library/plugins/upload/__next._tree.txt +9 -0
  340. package/console/library/plugins/upload/__next.library.plugins.upload.__PAGE__.txt +84 -0
  341. package/console/library/plugins/upload.html +1 -0
  342. package/console/library/plugins/upload.txt +99 -0
  343. package/console/library/plugins.html +1 -0
  344. package/console/library/plugins.txt +94 -0
  345. package/console/library/routines/__next._full.txt +94 -0
  346. package/console/library/routines/__next._index.txt +62 -0
  347. package/console/library/routines/__next._tree.txt +8 -0
  348. package/console/library/routines/__next.library.routines.__PAGE__.txt +79 -0
  349. package/console/library/routines/__placeholder__/__placeholder__/__next._full.txt +97 -0
  350. package/console/library/routines/__placeholder__/__placeholder__/__next._index.txt +62 -0
  351. package/console/library/routines/__placeholder__/__placeholder__/__next._tree.txt +10 -0
  352. package/console/library/routines/__placeholder__/__placeholder__/__next.library.routines.$d$org.$d$slug.__PAGE__.txt +82 -0
  353. package/console/library/routines/__placeholder__/__placeholder__.html +1 -0
  354. package/console/library/routines/__placeholder__/__placeholder__.txt +97 -0
  355. package/console/library/routines/new/__next._full.txt +98 -0
  356. package/console/library/routines/new/__next._index.txt +62 -0
  357. package/console/library/routines/new/__next._tree.txt +9 -0
  358. package/console/library/routines/new/__next.library.routines.new.__PAGE__.txt +83 -0
  359. package/console/library/routines/new.html +1 -0
  360. package/console/library/routines/new.txt +98 -0
  361. package/console/library/routines.html +1 -0
  362. package/console/library/routines.txt +94 -0
  363. package/console/library/skills/__next._full.txt +94 -0
  364. package/console/library/skills/__next._index.txt +62 -0
  365. package/console/library/skills/__next._tree.txt +8 -0
  366. package/console/library/skills/__next.library.skills.__PAGE__.txt +79 -0
  367. package/console/library/skills/__placeholder__/__placeholder__/__next._full.txt +96 -0
  368. package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +62 -0
  369. package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +10 -0
  370. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.__PAGE__.txt +81 -0
  371. package/console/library/skills/__placeholder__/__placeholder__.html +1 -0
  372. package/console/library/skills/__placeholder__/__placeholder__.txt +96 -0
  373. package/console/library/skills/new/__next._full.txt +98 -0
  374. package/console/library/skills/new/__next._index.txt +62 -0
  375. package/console/library/skills/new/__next._tree.txt +9 -0
  376. package/console/library/skills/new/__next.library.skills.new.__PAGE__.txt +83 -0
  377. package/console/library/skills/new.html +1 -0
  378. package/console/library/skills/new.txt +98 -0
  379. package/console/library/skills.html +1 -0
  380. package/console/library/skills.txt +94 -0
  381. package/console/library.html +1 -0
  382. package/console/library.txt +89 -0
  383. package/console/login/__next._full.txt +81 -0
  384. package/console/login/__next._index.txt +62 -0
  385. package/console/login/__next._tree.txt +7 -0
  386. package/console/login/__next.login.__PAGE__.txt +66 -0
  387. package/console/login.html +1 -0
  388. package/console/login.txt +81 -0
  389. package/console/marketplace/__next._full.txt +81 -0
  390. package/console/marketplace/__next._index.txt +62 -0
  391. package/console/marketplace/__next._tree.txt +7 -0
  392. package/console/marketplace/__next.marketplace.__PAGE__.txt +66 -0
  393. package/console/marketplace.html +1 -0
  394. package/console/marketplace.txt +81 -0
  395. package/console/models/__next._full.txt +77 -0
  396. package/console/models/__next._index.txt +62 -0
  397. package/console/models/__next._tree.txt +7 -0
  398. package/console/models/__next.models.__PAGE__.txt +62 -0
  399. package/console/models.html +1 -0
  400. package/console/models.txt +77 -0
  401. package/console/oauth/slack/callback/__next._full.txt +84 -0
  402. package/console/oauth/slack/callback/__next._index.txt +62 -0
  403. package/console/oauth/slack/callback/__next._tree.txt +9 -0
  404. package/console/oauth/slack/callback/__next.oauth.slack.callback.__PAGE__.txt +69 -0
  405. package/console/oauth/slack/callback.html +1 -0
  406. package/console/oauth/slack/callback.txt +84 -0
  407. package/console/runs/__placeholder__/__next._full.txt +77 -0
  408. package/console/runs/__placeholder__/__next._index.txt +62 -0
  409. package/console/runs/__placeholder__/__next._tree.txt +8 -0
  410. package/console/runs/__placeholder__/__next.runs.$d$id.__PAGE__.txt +62 -0
  411. package/console/runs/__placeholder__.html +1 -0
  412. package/console/runs/__placeholder__.txt +77 -0
  413. package/console/sessions/__placeholder__/__next._full.txt +77 -0
  414. package/console/sessions/__placeholder__/__next._index.txt +62 -0
  415. package/console/sessions/__placeholder__/__next._tree.txt +8 -0
  416. package/console/sessions/__placeholder__/__next.sessions.$d$id.__PAGE__.txt +62 -0
  417. package/console/sessions/__placeholder__.html +1 -0
  418. package/console/sessions/__placeholder__.txt +77 -0
  419. package/console/settings/__next._full.txt +85 -0
  420. package/console/settings/__next._index.txt +62 -0
  421. package/console/settings/__next._tree.txt +7 -0
  422. package/console/settings/__next.settings.__PAGE__.txt +70 -0
  423. package/console/settings/access-history/__next._full.txt +87 -0
  424. package/console/settings/access-history/__next._index.txt +62 -0
  425. package/console/settings/access-history/__next._tree.txt +8 -0
  426. package/console/settings/access-history/__next.settings.access-history.__PAGE__.txt +72 -0
  427. package/console/settings/access-history.html +1 -0
  428. package/console/settings/access-history.txt +87 -0
  429. package/console/settings/account-preferences/__next._full.txt +87 -0
  430. package/console/settings/account-preferences/__next._index.txt +62 -0
  431. package/console/settings/account-preferences/__next._tree.txt +8 -0
  432. package/console/settings/account-preferences/__next.settings.account-preferences.__PAGE__.txt +72 -0
  433. package/console/settings/account-preferences.html +1 -0
  434. package/console/settings/account-preferences.txt +87 -0
  435. package/console/settings/api-keys/__next._full.txt +86 -0
  436. package/console/settings/api-keys/__next._index.txt +62 -0
  437. package/console/settings/api-keys/__next._tree.txt +8 -0
  438. package/console/settings/api-keys/__next.settings.api-keys.__PAGE__.txt +71 -0
  439. package/console/settings/api-keys.html +1 -0
  440. package/console/settings/api-keys.txt +86 -0
  441. package/console/settings/billing/__next._full.txt +89 -0
  442. package/console/settings/billing/__next._index.txt +62 -0
  443. package/console/settings/billing/__next._tree.txt +8 -0
  444. package/console/settings/billing/__next.settings.billing.__PAGE__.txt +74 -0
  445. package/console/settings/billing.html +1 -0
  446. package/console/settings/billing.txt +89 -0
  447. package/console/settings/channel-apps/__next._full.txt +87 -0
  448. package/console/settings/channel-apps/__next._index.txt +62 -0
  449. package/console/settings/channel-apps/__next._tree.txt +8 -0
  450. package/console/settings/channel-apps/__next.settings.channel-apps.__PAGE__.txt +72 -0
  451. package/console/settings/channel-apps.html +1 -0
  452. package/console/settings/channel-apps.txt +87 -0
  453. package/console/settings/federation-issuers/__next._full.txt +88 -0
  454. package/console/settings/federation-issuers/__next._index.txt +62 -0
  455. package/console/settings/federation-issuers/__next._tree.txt +8 -0
  456. package/console/settings/federation-issuers/__next.settings.federation-issuers.__PAGE__.txt +73 -0
  457. package/console/settings/federation-issuers.html +1 -0
  458. package/console/settings/federation-issuers.txt +88 -0
  459. package/console/settings/invitations/__next._full.txt +87 -0
  460. package/console/settings/invitations/__next._index.txt +62 -0
  461. package/console/settings/invitations/__next._tree.txt +8 -0
  462. package/console/settings/invitations/__next.settings.invitations.__PAGE__.txt +72 -0
  463. package/console/settings/invitations.html +1 -0
  464. package/console/settings/invitations.txt +87 -0
  465. package/console/settings/licenses/__next._full.txt +90 -0
  466. package/console/settings/licenses/__next._index.txt +62 -0
  467. package/console/settings/licenses/__next._tree.txt +8 -0
  468. package/console/settings/licenses/__next.settings.licenses.__PAGE__.txt +75 -0
  469. package/console/settings/licenses.html +1 -0
  470. package/console/settings/licenses.txt +90 -0
  471. package/console/settings/members/__next._full.txt +86 -0
  472. package/console/settings/members/__next._index.txt +62 -0
  473. package/console/settings/members/__next._tree.txt +8 -0
  474. package/console/settings/members/__next.settings.members.__PAGE__.txt +71 -0
  475. package/console/settings/members.html +1 -0
  476. package/console/settings/members.txt +86 -0
  477. package/console/settings/memory/__next._full.txt +86 -0
  478. package/console/settings/memory/__next._index.txt +62 -0
  479. package/console/settings/memory/__next._tree.txt +8 -0
  480. package/console/settings/memory/__next.settings.memory.__PAGE__.txt +71 -0
  481. package/console/settings/memory.html +1 -0
  482. package/console/settings/memory.txt +86 -0
  483. package/console/settings/model-catalog/__next._full.txt +89 -0
  484. package/console/settings/model-catalog/__next._index.txt +62 -0
  485. package/console/settings/model-catalog/__next._tree.txt +8 -0
  486. package/console/settings/model-catalog/__next.settings.model-catalog.__PAGE__.txt +74 -0
  487. package/console/settings/model-catalog.html +1 -0
  488. package/console/settings/model-catalog.txt +89 -0
  489. package/console/settings/notifications/__next._full.txt +89 -0
  490. package/console/settings/notifications/__next._index.txt +62 -0
  491. package/console/settings/notifications/__next._tree.txt +8 -0
  492. package/console/settings/notifications/__next.settings.notifications.__PAGE__.txt +74 -0
  493. package/console/settings/notifications.html +1 -0
  494. package/console/settings/notifications.txt +89 -0
  495. package/console/settings/oauth-apps/__next._full.txt +87 -0
  496. package/console/settings/oauth-apps/__next._index.txt +62 -0
  497. package/console/settings/oauth-apps/__next._tree.txt +8 -0
  498. package/console/settings/oauth-apps/__next.settings.oauth-apps.__PAGE__.txt +72 -0
  499. package/console/settings/oauth-apps.html +1 -0
  500. package/console/settings/oauth-apps.txt +87 -0
  501. package/console/settings/org-embedding/__next._full.txt +87 -0
  502. package/console/settings/org-embedding/__next._index.txt +62 -0
  503. package/console/settings/org-embedding/__next._tree.txt +8 -0
  504. package/console/settings/org-embedding/__next.settings.org-embedding.__PAGE__.txt +72 -0
  505. package/console/settings/org-embedding.html +1 -0
  506. package/console/settings/org-embedding.txt +87 -0
  507. package/console/settings/org-policies/__next._full.txt +87 -0
  508. package/console/settings/org-policies/__next._index.txt +62 -0
  509. package/console/settings/org-policies/__next._tree.txt +8 -0
  510. package/console/settings/org-policies/__next.settings.org-policies.__PAGE__.txt +72 -0
  511. package/console/settings/org-policies.html +1 -0
  512. package/console/settings/org-policies.txt +87 -0
  513. package/console/settings/org-preferences/__next._full.txt +87 -0
  514. package/console/settings/org-preferences/__next._index.txt +62 -0
  515. package/console/settings/org-preferences/__next._tree.txt +8 -0
  516. package/console/settings/org-preferences/__next.settings.org-preferences.__PAGE__.txt +72 -0
  517. package/console/settings/org-preferences.html +1 -0
  518. package/console/settings/org-preferences.txt +87 -0
  519. package/console/settings/org-profile/__next._full.txt +89 -0
  520. package/console/settings/org-profile/__next._index.txt +62 -0
  521. package/console/settings/org-profile/__next._tree.txt +8 -0
  522. package/console/settings/org-profile/__next.settings.org-profile.__PAGE__.txt +74 -0
  523. package/console/settings/org-profile.html +1 -0
  524. package/console/settings/org-profile.txt +89 -0
  525. package/console/settings/plans/__next._full.txt +89 -0
  526. package/console/settings/plans/__next._index.txt +62 -0
  527. package/console/settings/plans/__next._tree.txt +8 -0
  528. package/console/settings/plans/__next.settings.plans.__PAGE__.txt +74 -0
  529. package/console/settings/plans.html +1 -0
  530. package/console/settings/plans.txt +89 -0
  531. package/console/settings/service-accounts/__next._full.txt +87 -0
  532. package/console/settings/service-accounts/__next._index.txt +62 -0
  533. package/console/settings/service-accounts/__next._tree.txt +8 -0
  534. package/console/settings/service-accounts/__next.settings.service-accounts.__PAGE__.txt +72 -0
  535. package/console/settings/service-accounts.html +1 -0
  536. package/console/settings/service-accounts.txt +87 -0
  537. package/console/settings/teams/__next._full.txt +86 -0
  538. package/console/settings/teams/__next._index.txt +62 -0
  539. package/console/settings/teams/__next._tree.txt +8 -0
  540. package/console/settings/teams/__next.settings.teams.__PAGE__.txt +71 -0
  541. package/console/settings/teams.html +1 -0
  542. package/console/settings/teams.txt +86 -0
  543. package/console/settings/usage/__next._full.txt +86 -0
  544. package/console/settings/usage/__next._index.txt +62 -0
  545. package/console/settings/usage/__next._tree.txt +8 -0
  546. package/console/settings/usage/__next.settings.usage.__PAGE__.txt +71 -0
  547. package/console/settings/usage.html +1 -0
  548. package/console/settings/usage.txt +86 -0
  549. package/console/settings/vaults/__next._full.txt +86 -0
  550. package/console/settings/vaults/__next._index.txt +62 -0
  551. package/console/settings/vaults/__next._tree.txt +8 -0
  552. package/console/settings/vaults/__next.settings.vaults.__PAGE__.txt +71 -0
  553. package/console/settings/vaults.html +1 -0
  554. package/console/settings/vaults.txt +86 -0
  555. package/console/settings.html +1 -0
  556. package/console/settings.txt +85 -0
  557. package/main.js +1656 -0
  558. package/mappings.wasm +0 -0
  559. package/package.json +25 -0
  560. package/workflow-bundle-agent-execution.js +29297 -0
  561. package/workflow-bundle-evals.js +11997 -0
  562. package/workflow-bundle-grading.js +11155 -0
  563. package/workflow-bundle-routine.js +11300 -0
  564. package/workflow-worker-thread.cjs +111 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,936636,e=>{"use strict";var t=e.i(974265),s=e.i(651023),r=e.i(537097),n=e.i(475254);let i=(0,n.f)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);var a=e.i(893976),o=e.i(910304),l=e.i(255817),c=e.i(616701),u=e.i(102508),d=e.i(36634),g=e.i(683738),h=e.i(846696),f=e.i(297098),x=e.i(796545),m=e.i(776526),p=e.i(188482),b=e.i(503353),v=e.i(869803),y=e.i(781836),j=e.i(469196);let k=new Map;function w(e){return`${e.id}\0${e.readRef??e.gitBranch??""}`}async function N(e,t,s={}){var r;let n,i,a;if(!s.bustCache){let t=k.get(w(e));if(t)return t}let o=await t(e);if(null===o)return null;let l=(n=(r=o).some(e=>!0===e.notice),i=r.filter(e=>!e.notice),a=(0,j.f)(i.filter(e=>!e.isDirectory)),{files:i,tree:a,truncated:n});return k.set(w(e),l),l}function C(e,t){return e.isBasenameHit!==t.isBasenameHit?e.isBasenameHit?-1:1:e.matchStart!==t.matchStart?e.matchStart-t.matchStart:e.path.length!==t.path.length?e.path.length-t.path.length:e.path.localeCompare(t.path)}let S=[];function O({entries:e,lister:r,onOpenFile:n,selectedFile:i,className:o}){let[l,c]=(0,s.useState)(""),[u,d]=(0,s.useState)(-1),g=(0,s.useRef)(null),h=(0,s.useId)(),f=(0,s.useCallback)(e=>`${h}-opt-${e}`,[h]),{groups:x,totalMatches:m,isLoading:p,isUnsupported:b}=function({entries:e,lister:t,query:r}){let[n,i]=(0,s.useState)({}),a=(0,s.useRef)(e);a.current=e;let o=e.map(e=>`${e.id}\x01${e.readRef??""}`).join("\0"),l=(0,s.useRef)(0);return(0,s.useEffect)(()=>{if(!t)return void i({});let e=a.current,s=++l.current;for(let r of(i(t=>{let s={};for(let r of e)s[r.id]=t[r.id]??{status:"loading"};return s}),e))N(r,t).then(e=>{l.current===s&&i(t=>({...t,[r.id]:null===e?{status:"unsupported"}:{status:"ready",listing:e}}))}).catch(e=>{l.current===s&&i(t=>({...t,[r.id]:{status:"error",error:(0,y.f)(e)}}))})},[o,t]),(0,s.useMemo)(()=>{if(!t)return{groups:S,totalMatches:0,isLoading:!1,isUnsupported:!0,error:null};let s=[],i=0,a=!1,o=null,l=0;for(let t of e){let e=n[t.id];if(!e||"loading"===e.status){a=!0;continue}if("unsupported"===e.status){l+=1;continue}let c="error"===e.status?e.error??null:null;c&&!o&&(o=c);let u=e.listing?.truncated??!1,d=e.listing?function(e,t){let s=t.trim();if(0===s.length)return[];let r=s.toLowerCase(),n=[];for(let t of e){if(t.isDirectory||t.notice)continue;let e=t.path.toLowerCase().indexOf(r);if(-1===e)continue;let s=t.path.lastIndexOf("/");n.push({path:t.path,matchStart:e,matchEnd:e+r.length,isBasenameHit:e>=s+1})}return n.sort(C),n.map(({path:e,matchStart:t,matchEnd:s})=>({path:e,matchStart:t,matchEnd:s}))}(e.listing.files,r):[];i+=d.length,(d.length>0||c||u)&&s.push({entry:t,matches:d,truncated:u,error:c})}return{groups:s,totalMatches:i,isLoading:a,isUnsupported:e.length>0&&l===e.length,error:o}},[e,n,r,t])}({entries:e,lister:r,query:l}),j=(0,s.useMemo)(()=>{let e=[];for(let t of x)for(let s of t.matches){if(e.length>=200)return e;e.push({entryId:t.entry.id,entry:t.entry,match:s})}return e},[x]);(0,s.useEffect)(()=>{d(-1)},[l]),(0,s.useEffect)(()=>{g.current?.focus()},[]),(0,s.useEffect)(()=>{if(u<0)return;let e="u">typeof document?document.getElementById(f(u)):null;e?.scrollIntoView?.({block:"nearest"})},[u,f]);let k=(0,s.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),d(e=>e<j.length-1?e+1:e);else if("ArrowUp"===e.key)e.preventDefault(),d(e=>e>0?e-1:-1);else if("Enter"===e.key){e.preventDefault();let t=j[u];t&&n(t.entryId,t.match.path)}},[j,u,n]),w=l.trim(),L=x.length>1,D=b||0===w.length?"":p&&0===m&&0===x.length?"Searching files…":0===x.length?`No files matching ${w}.`:m>j.length?`Showing the first ${j.length} of ${m} matching files.`:`${j.length} matching ${1===j.length?"file":"files"}.`;return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:h-full stg:flex-col",o),children:[(0,t.jsx)("div",{role:"status","aria-live":"polite",className:"stg:sr-only",children:D}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:[(0,t.jsx)(F,{}),(0,t.jsx)("input",{ref:g,type:"text",role:"combobox","aria-expanded":!0,"aria-controls":h,"aria-activedescendant":u>=0?f(u):void 0,value:l,onChange:e=>c(e.target.value),onKeyDown:k,placeholder:"Search files by name…",disabled:b,className:(0,a.f)("stg:min-w-0 stg:flex-1 stg:bg-transparent stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:disabled:cursor-not-allowed"),"aria-label":"Search workspace files by name"}),w.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{c(""),g.current?.focus()},className:"stg:shrink-0 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground","aria-label":"Clear search",children:(0,t.jsx)(T,{})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:b?(0,t.jsx)(A,{children:"File search isn’t available here."}):0===w.length?(0,t.jsx)(A,{children:"Search files by name across the whole workspace."}):p&&0===m&&0===x.length?(0,t.jsx)(A,{children:"Searching…"}):0===x.length?(0,t.jsxs)(A,{children:["No files matching “",w,"”."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{id:h,role:"listbox","aria-label":"Search results",className:(0,a.f)(v.J,"stg:py-0.5"),children:function({groups:e,showGroupHeaders:s,selectedFile:r,focusIndex:n,optionId:i,onOpenFile:a}){let o=[],l=0;for(let c of e){for(let e of(s&&o.push((0,t.jsx)(E,{name:c.entry.name},`h:${c.entry.id}`)),c.matches)){if(l>=200)break;let s=l++,u=r?.entryId===c.entry.id&&r.path===e.path;o.push((0,t.jsx)(M,{id:i(s),match:e,isFocused:s===n,isOpen:u,onOpen:()=>a(c.entry.id,e.path)},`${c.entry.id}:${e.path}`))}if(c.truncated&&o.push((0,t.jsx)(I,{children:"Partial listing — too many files to search in full."},`t:${c.entry.id}`)),c.error&&o.push((0,t.jsxs)(I,{isError:!0,children:["Couldn’t list files: ",c.error.message]},`e:${c.entry.id}`)),l>=200)break}return o}({groups:x,showGroupHeaders:L,selectedFile:i??null,focusIndex:u,optionId:f,onOpenFile:n})}),m>j.length&&(0,t.jsxs)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:["Showing the first ",j.length," of ",m," matches — refine your search to narrow the list."]})]})})]})}function M({id:e,match:s,isFocused:r,isOpen:n,onOpen:i}){let o=s.path.lastIndexOf("/"),l=s.path.slice(o+1),c=o>=0?s.path.slice(0,o):"";return(0,t.jsxs)("li",{id:e,role:"option","aria-selected":r,"aria-current":n?"true":void 0,onClick:i,className:(0,a.f)("stg:flex stg:cursor-pointer stg:items-baseline stg:gap-1.5 stg:px-3 stg:py-1 stg:text-xs stg:transition-colors",r&&"stg:bg-muted",n&&"stg:bg-muted stg:font-medium stg:text-foreground",!r&&!n&&"stg:hover:bg-muted"),children:[(0,t.jsx)("span",{className:"stg:truncate stg:text-foreground",children:(0,t.jsx)(L,{text:l,offset:o+1,matchStart:s.matchStart,matchEnd:s.matchEnd})}),c&&(0,t.jsx)("span",{className:"stg:truncate stg:text-2xs stg:text-muted-foreground",children:(0,t.jsx)(L,{text:c,offset:0,matchStart:s.matchStart,matchEnd:s.matchEnd})})]})}function L({text:e,offset:s,matchStart:r,matchEnd:n}){let i=Math.max(0,r-s),a=Math.min(e.length,n-s);return i>=a?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsxs)(t.Fragment,{children:[e.slice(0,i),(0,t.jsx)("span",{className:"stg:font-semibold stg:text-foreground",children:e.slice(i,a)}),e.slice(a)]})}function E({name:e}){return(0,t.jsx)("li",{role:"presentation",className:"stg:truncate stg:px-3 stg:pb-0.5 stg:pt-2 stg:text-2xs stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e})}function I({children:e,isError:s}){return(0,t.jsx)("li",{role:"presentation",className:(0,a.f)("stg:px-3 stg:py-1 stg:text-2xs",s?"stg:text-destructive":"stg:text-muted-foreground"),children:e})}function A({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function F(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"5.25",cy:"5.25",r:"3.5"}),(0,t.jsx)("path",{d:"M7.75 7.75L10.5 10.5"})]})}function T(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 3L9 9M9 3L3 9"})})}let D=[];function R({entries:e,searcher:r,onOpenFile:n,selectedFile:i,className:o}){let[l,c]=(0,s.useState)(""),[u,d]=(0,s.useState)(-1),g=(0,s.useRef)(null),h=(0,s.useId)(),f=(0,s.useCallback)(e=>`${h}-opt-${e}`,[h]),{groups:x,totalMatches:m,isLoading:p,isRefetching:b,isUnsupported:j}=function({entries:e,searcher:t,query:r,debounceMs:n=300,minLength:i=2}){let[a,o]=(0,s.useState)({}),[l,c]=(0,s.useState)(!1),[u,d]=(0,s.useState)(r);(0,s.useEffect)(()=>{let e=setTimeout(()=>d(r),n);return()=>clearTimeout(e)},[r,n]);let g=(0,s.useRef)(e);g.current=e;let h=e.map(e=>e.id).join("\0"),f=(0,s.useRef)(0),x=u.trim(),m=x.length<i;return(0,s.useEffect)(()=>{if(!t||m){f.current+=1,o({}),c(!1);return}let e=g.current,s=++f.current;c(!0),Promise.all(e.map(async e=>{try{let s=await t(e,x);if(null===s)return[e.id,{status:"unsupported"}];return[e.id,{status:"ready",matches:s.matches,truncated:s.truncated}]}catch(t){return[e.id,{status:"error",error:(0,y.f)(t)}]}})).then(e=>{if(f.current!==s)return;let t={};for(let[s,r]of e)t[s]=r;o(t),c(!1)})},[h,t,x,m]),(0,s.useMemo)(()=>{if(!t)return{groups:D,totalMatches:0,isLoading:!1,isRefetching:!1,isUnsupported:!0,error:null};let s=[],r=0,n=null,i=0,o=0;for(let t of e){let e=a[t.id];if(e){if(o+=1,"unsupported"===e.status){i+=1;continue}if("error"===e.status){n||(n=e.error),s.push({entry:t,matches:[],truncated:!1,error:e.error});continue}r+=e.matches.length,(e.matches.length>0||e.truncated)&&s.push({entry:t,matches:e.matches,truncated:e.truncated,error:null})}}let c=o>0;return{groups:s,totalMatches:r,isLoading:l&&!c,isRefetching:l&&c,isUnsupported:e.length>0&&i===e.length,error:n}},[e,a,l,t])}({entries:e,searcher:r,query:l,minLength:2}),k=(0,s.useMemo)(()=>{let e=[];for(let t of x)for(let s of t.matches){if(e.length>=200)return e;e.push({entryId:t.entry.id,match:s})}return e},[x]);(0,s.useEffect)(()=>{d(-1)},[l]),(0,s.useEffect)(()=>{g.current?.focus()},[]),(0,s.useEffect)(()=>{if(u<0)return;let e="u">typeof document?document.getElementById(f(u)):null;e?.scrollIntoView?.({block:"nearest"})},[u,f]);let w=(0,s.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),d(e=>e<k.length-1?e+1:e);else if("ArrowUp"===e.key)e.preventDefault(),d(e=>e>0?e-1:-1);else if("Enter"===e.key){e.preventDefault();let t=k[u];t&&n(t.entryId,t.match.path,{line:t.match.line})}},[k,u,n]),N=l.trim(),C=N.length>0&&N.length<2,S=x.length>1,O=j||0===N.length?"":C?"Type at least 2 characters to search.":p?"Searching file contents…":0===x.length?`No files containing ${N}.`:m>k.length?`Showing the first ${k.length} of ${m} matches.`:`${m} ${1===m?"match":"matches"}.`;return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:h-full stg:flex-col",o),children:[(0,t.jsx)("div",{role:"status","aria-live":"polite",className:"stg:sr-only",children:O}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:[(0,t.jsx)(U,{}),(0,t.jsx)("input",{ref:g,type:"text",role:"combobox","aria-expanded":!0,"aria-controls":h,"aria-activedescendant":u>=0?f(u):void 0,value:l,onChange:e=>c(e.target.value),onKeyDown:w,placeholder:"Search text in files…",disabled:j,className:(0,a.f)("stg:min-w-0 stg:flex-1 stg:bg-transparent stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:disabled:cursor-not-allowed"),"aria-label":"Search text in workspace files"}),b&&(0,t.jsx)(K,{}),N.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{c(""),g.current?.focus()},className:"stg:shrink-0 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground","aria-label":"Clear search",children:(0,t.jsx)(H,{})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:j?(0,t.jsx)(W,{children:"Text search isn’t available here."}):0===N.length?(0,t.jsx)(W,{children:"Search file contents across the whole workspace."}):C?(0,t.jsxs)(W,{children:["Type at least ",2," characters to search."]}):p?(0,t.jsx)(W,{children:"Searching…"}):0===x.length?(0,t.jsxs)(W,{children:["No files containing “",N,"”."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("ul",{id:h,role:"listbox","aria-label":"Search results",className:(0,a.f)(v.J,"stg:py-0.5"),children:function({groups:e,query:s,showEntryHeaders:r,selectedFile:n,focusIndex:i,optionId:a,onOpenFile:o}){let l=[],c=0;for(let u of e){r&&l.push((0,t.jsx)(q,{name:u.entry.name},`entry:${u.entry.id}`));let e=null;for(let r of u.matches){if(c>=200)break;r.path!==e&&(e=r.path,l.push((0,t.jsx)(z,{path:r.path},`file:${u.entry.id}:${r.path}`)));let d=c++,g=n?.entryId===u.entry.id&&n.path===r.path;l.push((0,t.jsx)(P,{id:a(d),match:r,query:s,isFocused:d===i,isOpen:g,onOpen:()=>o(u.entry.id,r.path,{line:r.line})},`line:${u.entry.id}:${r.path}:${r.line}`))}if(u.truncated&&l.push((0,t.jsx)($,{children:"Partial results — more matches exist than shown for this workspace."},`t:${u.entry.id}`)),u.error&&l.push((0,t.jsxs)($,{isError:!0,children:["Couldn’t search: ",u.error.message]},`e:${u.entry.id}`)),c>=200)break}return l}({groups:x,query:N,showEntryHeaders:S,selectedFile:i??null,focusIndex:u,optionId:f,onOpenFile:n})}),m>k.length&&(0,t.jsxs)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:["Showing the first ",k.length," of ",m," matches — refine your search to narrow the list."]})]})})]})}function P({id:e,match:s,query:r,isFocused:n,isOpen:i,onOpen:o}){return(0,t.jsxs)("li",{id:e,role:"option","aria-selected":n,"aria-current":i?"true":void 0,onClick:o,className:(0,a.f)("stg:flex stg:cursor-pointer stg:items-baseline stg:gap-2 stg:py-0.5 stg:pl-6 stg:pr-3 stg:text-xs stg:transition-colors",n&&"stg:bg-muted",i&&"stg:bg-muted",!n&&!i&&"stg:hover:bg-muted"),children:[(0,t.jsx)("span",{className:"stg:w-8 stg:shrink-0 stg:text-right stg:font-mono stg:text-2xs stg:tabular-nums stg:text-muted-foreground-subtle",children:s.line}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:font-mono stg:text-muted-foreground",children:(0,t.jsx)(B,{text:s.preview,query:r})})]})}function B({text:e,query:s}){let r=function(e,t){let s=t.trim().toLowerCase();if(0===s.length)return[];let r=e.toLowerCase(),n=[],i=0;for(;;){let e=r.indexOf(s,i);if(-1===e)break;let t=e+s.length;n.push({start:e,end:t}),i=t}return n}(e,s);if(0===r.length)return(0,t.jsx)(t.Fragment,{children:e});let n=[],i=0;return r.forEach((s,r)=>{s.start>i&&n.push(e.slice(i,s.start)),n.push((0,t.jsx)("span",{className:"stg:font-semibold stg:text-foreground",children:e.slice(s.start,s.end)},r)),i=s.end}),i<e.length&&n.push(e.slice(i)),(0,t.jsx)(t.Fragment,{children:n})}function q({name:e}){return(0,t.jsx)("li",{role:"presentation",className:"stg:truncate stg:px-3 stg:pb-0.5 stg:pt-2 stg:text-2xs stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground",children:e})}function z({path:e}){let s=e.lastIndexOf("/"),r=s>=0?e.slice(s+1):e,n=s>=0?e.slice(0,s):"";return(0,t.jsxs)("li",{role:"presentation",className:"stg:flex stg:items-baseline stg:gap-1.5 stg:px-3 stg:pb-0.5 stg:pt-1.5 stg:text-xs",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:font-medium stg:text-foreground",children:r}),n&&(0,t.jsx)("span",{className:"stg:truncate stg:text-2xs stg:text-muted-foreground",children:n})]})}function $({children:e,isError:s}){return(0,t.jsx)("li",{role:"presentation",className:(0,a.f)("stg:px-3 stg:py-1 stg:text-2xs",s?"stg:text-destructive":"stg:text-muted-foreground"),children:e})}function W({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function U(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"5.25",cy:"5.25",r:"3.5"}),(0,t.jsx)("path",{d:"M7.75 7.75L10.5 10.5"})]})}function H(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M3 3L9 9M9 3L3 9"})})}function K(){return(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:h-3 stg:w-3 stg:shrink-0 stg:animate-spin stg:rounded-full stg:border stg:border-muted-foreground stg:border-t-transparent"})}var V=e.i(309826),Q=e.i(615132),_=e.i(108417),G=e.i(353799),Y=e.i(57841),J=e.i(933221),Z=e.i(996675);let X={content:null},ee={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",ico:"image/x-icon"};function et(e){let t=e.lastIndexOf(".");return -1===t?null:ee[e.slice(t+1).toLowerCase()]??null}class es extends Error{constructor(e){super(`"${e}" doesn't exist at the workspace's current ref.`),this.name="WorkspaceFileNotFoundError"}}let er=[85,72,90,65,78,88,70,82],en=(0,s.forwardRef)(function({selectedFile:e,entries:r,reader:n,change:i,reveal:o,onClose:l,showHeader:u=!0,className:d},g){let h=r.find(t=>t.id===e.entryId)??null,f=e.path,{content:x,isLoading:m,error:p,isUnsupported:b,refetch:v}=function({entry:e,path:t,reader:r}){let n=!!(r&&e&&t),{data:i,isLoading:a,isRefetching:o,error:l,refetch:u}=(0,c.f)(n?()=>r(e,t).then(e=>({content:e})):null,[e?.id??null,e?.readRef??null,t??null,r],X),d=!r||n&&!a&&!l&&null===i.content;return(0,s.useMemo)(()=>({content:i.content,isLoading:a,isRefetching:o,error:l,isUnsupported:d,refetch:u}),[i.content,a,o,l,d,u])}({entry:h,path:f,reader:n});(0,s.useImperativeHandle)(g,()=>({refresh:v}),[v]);let y=void 0!==n&&i?.changeType!=="deleted",j=void 0!==i&&y,[k,w]=(0,s.useState)(o?"file":void 0!==i?"diff":"file");(0,s.useEffect)(()=>{o&&w("file")},[o?.nonce]);let N=i?y?k:"diff":"file",C=(0,s.useCallback)(e=>{"Escape"===e.key&&l&&(e.stopPropagation(),l())},[l]),S=f.lastIndexOf("/"),O=S>=0?f.slice(S+1):f,M=S>=0?f.slice(0,S):"";return h?(0,t.jsxs)("div",{role:"region","aria-label":"File viewer",tabIndex:-1,className:(0,a.f)("stg:flex stg:h-full stg:flex-col stg:focus:outline-none",d),onKeyDown:C,children:[u&&(0,t.jsx)(eu,{basename:O,dir:M,onRefresh:"file"!==N||b?void 0:v,onClose:l}),j&&(0,t.jsx)(ei,{value:k,onChange:w}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto",children:"diff"===N&&i?(0,t.jsx)("div",{className:"stg:p-3",children:(0,t.jsx)(G.f,{change:i,showFileName:!1,showStats:!0})}):(0,t.jsx)(ea,{basename:O,content:x,isLoading:m,isUnsupported:b,error:p,onRetry:v,reveal:o,change:i})})]}):(0,t.jsxs)("div",{role:"region","aria-label":"File viewer",className:(0,a.f)("stg:flex stg:h-full stg:flex-col",d),onKeyDown:C,children:[u&&(0,t.jsx)(eu,{basename:O,dir:M,onRefresh:void 0,onClose:l}),(0,t.jsx)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:"This file is no longer in the workspace."})]})});function ei({value:e,onChange:r}){let n=(0,s.useRef)([]),i=(0,s.useCallback)(e=>{r(e),n.current[+("diff"!==e)]?.focus()},[r]),o=(0,s.useCallback)(e=>{"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),i("file")):("ArrowLeft"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),i("diff"))},[i]);return(0,t.jsx)("div",{className:"stg:border-b stg:border-border stg:px-3 stg:py-1.5",children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"File view",className:"stg:inline-flex stg:rounded-md stg:bg-muted stg:p-0.5",children:[{value:"diff",label:"Diff"},{value:"file",label:"File"}].map((s,i)=>{let l=e===s.value;return(0,t.jsx)("button",{ref:e=>{n.current[i]=e},type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,onClick:()=>r(s.value),onKeyDown:o,className:(0,a.f)("stg:inline-flex stg:cursor-pointer stg:items-center stg:rounded-sm stg:px-2 stg:py-0.5 stg:text-xs stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",l?"stg:bg-background stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground"),children:s.label},s.value)})})})}function ea({basename:e,content:s,isLoading:r,isUnsupported:n,error:i,onRetry:a,reveal:o,change:l}){var c;let u=i instanceof es;if((n||u)&&void 0!==(c=l)&&"deleted"!==c.changeType&&void 0!==c.after)return(0,t.jsx)(el,{change:l,basename:e,reveal:o});if(n)return(0,t.jsx)(ed,{children:"Preview isn’t available for this file here."});if(r)return(0,t.jsx)(ec,{});if(u)return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:p-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"This file isn’t available in the workspace source yet. The agent’s latest changes may still be syncing."}),(0,t.jsx)("button",{type:"button",onClick:a,className:"stg:text-xs stg:font-medium stg:text-foreground stg:underline stg:underline-offset-2 stg:hover:text-muted-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm",children:"Check again"})]});if(i)return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:p-8 stg:text-center",children:[(0,t.jsx)(em,{}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-destructive",children:i.message}),(0,t.jsx)("button",{type:"button",onClick:a,className:"stg:text-xs stg:font-medium stg:text-foreground stg:underline stg:underline-offset-2 stg:hover:text-muted-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm",children:"Retry"})]});if(!s)return(0,t.jsx)(ed,{children:"Content not available for preview."});let d=et(e);return s.bytes&&d?(0,t.jsx)(eo,{bytes:s.bytes,mime:d,basename:e,size:s.size,change:l}):s.isBinary?(0,t.jsxs)(ed,{children:["Binary file — not shown",s.size?` (${eg(s.size)})`:"","."]}):null===s.text&&s.truncated?(0,t.jsxs)(ed,{children:["This file is too large to preview",s.size?` (${eg(s.size)})`:"","."]}):null===s.text?(0,t.jsx)(ed,{children:"This file can’t be displayed as text."}):(0,t.jsxs)(t.Fragment,{children:[l&&(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:"Live — may differ from the reviewed change."}),(0,t.jsx)(_.f,{content:s.text,fileName:e,isTruncated:s.truncated,reveal:o})]})}function eo({bytes:e,mime:r,basename:n,size:i,change:o}){let l=(0,s.useMemo)(()=>new Blob([e],{type:r}),[e,r]),c=(0,Q.f)(l),[u,d]=(0,s.useState)(!1),[g,h]=(0,s.useState)(!1);return u?(0,t.jsxs)(ed,{children:["Binary file — not shown",i?` (${eg(i)})`:"","."]}):(0,t.jsxs)(t.Fragment,{children:[o&&(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:"Live — may differ from the reviewed change."}),(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:p-4",children:[c?(0,t.jsx)("button",{type:"button",onClick:()=>h(!0),"aria-label":`Preview ${n} at full size`,className:(0,a.f)(J.s,"stg:max-w-full stg:rounded-md stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)("img",{src:c,alt:n,onError:()=>d(!0),className:"stg:max-h-[70vh] stg:max-w-full stg:rounded-md stg:border stg:border-border stg:object-contain"})}):(0,t.jsx)("div",{className:"stg:h-48 stg:w-72 stg:max-w-full stg:animate-pulse stg:rounded-md stg:bg-muted","aria-hidden":"true"}),(0,t.jsxs)("p",{className:"stg:text-2xs stg:tabular-nums stg:text-muted-foreground",children:[r,i?` \xb7 ${eg(i)}`:""]})]}),(0,t.jsx)(V.f,{src:c,filename:n,open:g,onClose:()=>h(!1)})]})}function el({change:e,basename:s,reveal:r}){let{afterText:n,isBinary:i,isLoading:a,error:o}=(0,Y.f)(e);return a?(0,t.jsx)(ec,{}):i?(0,t.jsx)(ed,{children:"Binary file — not shown."}):o||null===n?(0,t.jsx)(ed,{children:"Content not available for preview."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"stg:border-b stg:border-border-muted stg:px-4 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:"As of the agent’s last change — not yet in the workspace source."}),(0,t.jsx)(_.f,{content:n,fileName:s,reveal:r})]})}function ec(){return(0,t.jsx)(Z.f,{className:"stg:space-y-2 stg:p-4",label:"Loading file",children:er.map((e,s)=>(0,t.jsx)("div",{className:"stg:h-4 stg:animate-pulse stg:rounded stg:bg-muted",style:{width:`${e}%`},"aria-hidden":"true"},s))})}function eu({basename:e,dir:s,onRefresh:r,onClose:n}){return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-border stg:px-3 stg:py-2",children:[(0,t.jsx)(eh,{}),(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-baseline stg:gap-1.5",children:[(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("span",{className:"stg:truncate stg:text-xs stg:font-semibold stg:text-foreground"}),children:e}),(0,t.jsx)(p.Y,{side:"top",className:"stg:break-all",children:s?`${s}/${e}`:e})]}),s&&(0,t.jsx)("span",{className:"stg:truncate stg:text-2xs stg:text-muted-foreground",children:s})]}),r&&(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":`Reload ${e}`,className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring",children:(0,t.jsx)(ex,{})}),n&&(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Close file viewer",className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring",children:(0,t.jsx)(ef,{})})]})}function ed({children:e}){return(0,t.jsx)("div",{className:"stg:flex stg:h-full stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function eg(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function eh(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9.5 1.5H5C4.17 1.5 3.5 2.17 3.5 3V13C3.5 13.83 4.17 14.5 5 14.5H11C11.83 14.5 12.5 13.83 12.5 13V4.5L9.5 1.5Z"}),(0,t.jsx)("path",{d:"M9.5 1.5V4.5H12.5"})]})}function ef(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 3L11 11"}),(0,t.jsx)("path",{d:"M11 3L3 11"})]})}function ex(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 6a4.5 4.5 0 017.794-3.073M10.5 6a4.5 4.5 0 01-7.794 3.073"}),(0,t.jsx)("path",{d:"M9.5 1v2.5H7M2.5 11V8.5H5"})]})}function em(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:text-destructive","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.5"}),(0,t.jsx)("path",{d:"M8 5.5V8.5"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor",stroke:"none"})]})}function ep(e,t){return`${e}${encodeURIComponent(t)}`}function eb({editors:e,activeKey:r,onActivate:n,onPin:i,onClose:o,panelId:l,tabIdPrefix:c,className:u}){let d=(0,s.useCallback)((t,s)=>{let r=t+s;if(r<0||r>=e.length)return;let i=e[r];n(i.entryId,i.path)},[e,n]);return(0,t.jsx)(p.g,{children:(0,t.jsx)("div",{role:"tablist","aria-label":"Open editors","aria-orientation":"horizontal",className:(0,a.f)("stg:flex stg:shrink-0 stg:items-stretch stg:overflow-x-auto stg:border-b stg:border-border",u),children:e.map((e,s)=>{let u=(0,b.z)(e.entryId,e.path),g=u===r,h=e.path.lastIndexOf("/"),f=h>=0?e.path.slice(h+1):e.path;return(0,t.jsxs)(p.W,{children:[(0,t.jsxs)(p.y,{render:(0,t.jsx)("div",{role:"tab",id:c?ep(c,u):void 0,"aria-selected":g,"aria-controls":l,tabIndex:g?0:-1,onClick:()=>n(e.entryId,e.path),onDoubleClick:()=>i(e.entryId,e.path),onAuxClick:t=>{1===t.button&&(t.preventDefault(),o(e.entryId,e.path))},onKeyDown:t=>{"ArrowRight"===t.key?(t.preventDefault(),d(s,1)):"ArrowLeft"===t.key?(t.preventDefault(),d(s,-1)):"Enter"===t.key||" "===t.key?(t.preventDefault(),n(e.entryId,e.path)):("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),o(e.entryId,e.path))},className:(0,a.f)("stg:group stg:flex stg:max-w-[12rem] stg:shrink-0 stg:cursor-pointer stg:items-center stg:gap-1.5 stg:border-r stg:border-border stg:px-3 stg:py-1.5 stg:text-xs stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring",g?"stg:bg-background stg:text-foreground":"stg:bg-muted-faint stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground")}),children:[(0,t.jsx)("span",{className:(0,a.f)("stg:truncate",e.preview&&"stg:italic"),children:f}),(0,t.jsx)("span",{"aria-hidden":"true",onClick:t=>{t.stopPropagation(),o(e.entryId,e.path)},className:(0,a.f)("stg:shrink-0 stg:cursor-pointer stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-opacity stg:hover:bg-accent-hover stg:hover:text-foreground",g?"stg:opacity-100":"stg:opacity-0 stg:group-hover:opacity-100"),children:(0,t.jsx)(ev,{})})]}),(0,t.jsx)(p.Y,{side:"top",className:"stg:break-all",children:e.path})]},u)})})})}function ev(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3.5 3.5L10.5 10.5"}),(0,t.jsx)("path",{d:"M10.5 3.5L3.5 10.5"})]})}var ey=e.i(536907);let ej=[];function ek({entries:e,lister:s,selectedFile:r,onOpenFile:n,onActivateFile:i,onRemoveEntry:a}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,o)=>(0,t.jsx)(ew,{entry:e,lister:s,defaultExpanded:0===o,selectedPath:r?.entryId===e.id?r.path:void 0,onOpenFile:n,onActivateFile:i,onRemove:a},e.id))})}function ew({entry:e,lister:r,defaultExpanded:n,selectedPath:i,onOpenFile:o,onActivateFile:l,onRemove:c}){let[u,d]=(0,s.useState)(n),{tree:g,isLoading:h,error:f,truncated:x,refresh:m}=function({entry:e,lister:t}){let[r,n]=(0,s.useState)(!1),[i,a]=(0,s.useState)(null),[o,l]=(0,s.useState)(ej),[c,u]=(0,s.useState)(!1),d=(0,s.useRef)(0),g=(0,s.useCallback)(async(e,s)=>{if(!t)return;if(!s){let t=k.get(w(e));if(t){l(t.tree),u(t.truncated),a(null),n(!1);return}}let r=++d.current;n(!0),a(null);try{let i=await N(e,t,{bustCache:s});if(d.current!==r)return;if(null===i){l(ej),u(!1),n(!1);return}l(i.tree),u(i.truncated),n(!1)}catch(e){if(d.current!==r)return;a((0,y.f)(e)),l(ej),u(!1),n(!1)}},[t]);(0,s.useEffect)(()=>{if(!e||!t){l(ej),u(!1),n(!1),a(null);return}g(e,!1)},[e,t,g]);let h=(0,s.useCallback)(()=>{e&&t&&g(e,!0)},[e,t,g]);return(0,s.useMemo)(()=>({tree:o,isLoading:r,error:i,truncated:c,refresh:h}),[o,r,i,c,h])}({entry:u?e:null,lister:r});return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:group/root stg:flex stg:items-stretch",children:[(0,t.jsxs)(p.W,{children:[(0,t.jsxs)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),"aria-expanded":u,className:(0,a.f)("stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-1.5 stg:px-1.5 stg:py-1 stg:text-left stg:text-2xs stg:font-semibold stg:uppercase stg:tracking-wide stg:text-foreground stg:transition-colors stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:text-2xs stg:text-muted-foreground-subtle",children:u?"▼":"▶"}),(0,t.jsx)("span",{className:"stg:truncate",children:e.name})]}),(0,t.jsx)(p.Y,{side:"top",className:"stg:break-all",children:"local"===e.type?e.localPath:e.gitUrl})]}),c&&(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:()=>c(e.id),"aria-label":`Remove ${e.name} from workspace`,className:(0,a.f)("stg:shrink-0 stg:px-1.5 stg:text-muted-foreground stg:opacity-0 stg:transition-opacity","stg:group-hover/root:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-destructive stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:(0,t.jsx)(eC,{})}),(0,t.jsx)(p.Y,{side:"top",children:`Remove ${e.name} from workspace`})]})]}),u&&(0,t.jsx)(eN,{entryName:e.name,entryId:e.id,tree:g,isLoading:h,error:f,truncated:x,selectedPath:i,onOpenFile:o,onActivateFile:l,onRetry:m})]})}function eN({entryName:e,entryId:s,tree:r,isLoading:n,error:i,truncated:o,selectedPath:l,onOpenFile:c,onActivateFile:u,onRetry:d}){return n?(0,t.jsx)(Z.f,{className:"stg:space-y-1.5 stg:px-2 stg:py-2",label:`Loading files for ${e}`,children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"stg:h-3.5 stg:animate-pulse stg:rounded stg:bg-muted",style:{width:`${50+10*e}%`},"aria-hidden":"true"},e))}):i?(0,t.jsxs)("div",{className:"stg:px-2 stg:py-2 stg:text-xs stg:text-destructive",children:["Failed to list files: ",i.message,(0,t.jsx)("button",{type:"button",onClick:d,className:"stg:ml-2 stg:rounded-sm stg:underline stg:transition-colors stg:hover:text-destructive stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Retry"})]}):0===r.length?(0,t.jsx)("p",{className:"stg:px-3 stg:py-2 stg:text-xs stg:text-muted-foreground",children:"No files found."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("nav",{"aria-label":`File tree for ${e}`,children:(0,t.jsx)("ul",{className:(0,a.f)(v.J,"stg:py-0.5 stg:pl-1.5"),role:"tree",children:r.map(e=>(0,t.jsx)(ey.B,{node:e,selectedPath:l??"",onSelect:e=>c(s,e),onActivate:e=>u(s,e),depth:0,enableDrag:!0,showIcons:!0,indentGuides:!0,maxInitialDepth:0},e.path))})}),o&&(0,t.jsx)("p",{className:"stg:px-3 stg:py-1.5 stg:text-2xs stg:text-muted-foreground",children:"Showing a partial listing — too many files to load in full."})]})}function eC(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4L10 10M10 4L4 10"})})}let eS=["files","search"];function eO({entries:e,lister:r,reader:n,searcher:i,view:o,onViewChange:l,builtInViews:c=eS,extraViews:u,virtualDocuments:d,onRemoveEntry:g,onAddLocalFolder:h,editors:f,selectedFile:x,onOpenFile:p,onActivateEditor:b,onPinEditor:v,onCloseEditor:y,onCollapse:j,change:k,reveal:w,className:N}){let[C,S]=(0,s.useState)("files"),O=o??C,M=(0,s.useCallback)(e=>{S(e),l?.(e)},[l]),L=c.includes(O)||(u?.some(e=>e.id===O)??!1),E=c[0]??u?.[0]?.id??"files",I=L?O:E,A=u?.find(e=>e.id===I);return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:h-full stg:min-h-0",N),children:[(0,t.jsx)(eM,{view:I,onViewChange:M,builtInViews:c,extraViews:u}),(0,t.jsx)(m.f,{resizablePane:"primary",defaultSize:288,minSize:200,maxSize:560,storageKey:"stgm-workspace-sidebar-width",ariaLabel:"Resize sidebar",className:"stg:min-h-0 stg:min-w-0 stg:flex-1",primary:A?(0,t.jsx)(eA,{view:A}):"search"===I?(0,t.jsx)(eE,{entries:e,lister:r,searcher:i,selectedFile:x,onOpenFile:p}):(0,t.jsx)(eL,{entries:e,lister:r,selectedFile:x,onOpenFile:p,onActivateFile:v,onRemoveEntry:g,onAddLocalFolder:h}),secondary:(0,t.jsx)(eF,{entries:e,reader:n,editors:f,selectedFile:x,virtualDocuments:d,change:k,reveal:w,onActivateEditor:b,onPinEditor:v,onCloseEditor:y,onCollapse:j})})]})}function eM({view:e,onViewChange:r,builtInViews:n,extraViews:i}){let o=[...[{id:"files",label:"Explorer",icon:(0,t.jsx)(eB,{})},{id:"search",label:"Search",icon:(0,t.jsx)(eq,{})}].filter(e=>n.includes(e.id)),...i??[]],l=(0,s.useRef)([]),c=(0,s.useCallback)((e,t)=>{let s=null;"ArrowDown"===e.key||"ArrowRight"===e.key?s=Math.min(t+1,o.length-1):"ArrowUp"===e.key||"ArrowLeft"===e.key?s=Math.max(t-1,0):"Home"===e.key?s=0:"End"===e.key&&(s=o.length-1),null!==s&&s!==t&&(e.preventDefault(),r(o[s].id),l.current[s]?.focus())},[o,r]);return(0,t.jsx)(p.g,{children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"Workspace view","aria-orientation":"vertical",className:"stg:flex stg:w-11 stg:shrink-0 stg:flex-col stg:items-center stg:gap-1 stg:border-r stg:border-border stg:bg-muted-faint stg:py-2",children:o.map((s,n)=>{let i=e===s.id,o=null!=s.badge&&s.badge>0;return(0,t.jsxs)(p.W,{children:[(0,t.jsxs)(p.y,{render:(0,t.jsx)("button",{ref:e=>{l.current[n]=e},type:"button",role:"radio","aria-checked":i,"aria-label":o?`${s.label} (${s.badge})`:s.label,tabIndex:i?0:-1,onClick:()=>r(s.id),onKeyDown:e=>c(e,n),className:(0,a.f)("stg:relative stg:flex stg:h-9 stg:w-9 stg:items-center stg:justify-center stg:rounded-md stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",i?"stg:bg-accent stg:text-foreground":"stg:text-muted-foreground stg:hover:bg-accent-hover stg:hover:text-foreground")}),children:[s.icon,o&&(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:absolute stg:-right-0.5 stg:-top-0.5 stg:inline-flex stg:min-w-[0.875rem] stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-1 stg:py-px stg:text-2xs stg:font-medium stg:leading-none stg:text-primary-foreground",children:s.badge})]}),(0,t.jsx)(p.Y,{side:"right",children:s.label})]},s.id)})})})}function eL({entries:e,lister:s,selectedFile:r,onOpenFile:n,onActivateFile:i,onRemoveEntry:a,onAddLocalFolder:o}){return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(eR,{title:"Explorer"}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:py-1.5",children:s&&0!==e.length?(0,t.jsx)(ek,{entries:e,lister:s,selectedFile:r,onOpenFile:n,onActivateFile:i,onRemoveEntry:a}):(0,t.jsx)(eP,{children:"No workspace attached."})}),o&&(0,t.jsx)("div",{className:"stg:shrink-0 stg:border-t stg:border-border-muted stg:p-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:o,className:"stg:flex stg:w-full stg:items-center stg:gap-2 stg:rounded-md stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground stg:transition-colors stg:hover:bg-accent-hover stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:[(0,t.jsx)(ez,{}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-left",children:"Add Folder"})]})})]})}function eE({entries:e,lister:r,searcher:n,selectedFile:i,onOpenFile:a}){let[o,l]=(0,s.useState)("name");return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(eR,{title:"Search"}),n&&(0,t.jsx)(eI,{value:o,onChange:l}),n&&"text"===o?(0,t.jsx)(R,{entries:e,searcher:n,onOpenFile:a,selectedFile:i,className:"stg:min-h-0 stg:flex-1"}):(0,t.jsx)(O,{entries:e,lister:r,onOpenFile:a,selectedFile:i,className:"stg:min-h-0 stg:flex-1"})]})}function eI({value:e,onChange:r}){let n=(0,s.useRef)([]),i=(0,s.useCallback)(e=>{r(e),n.current[+("name"!==e)]?.focus()},[r]),o=(0,s.useCallback)(e=>{"ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),i("text")):("ArrowLeft"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),i("name"))},[i]);return(0,t.jsx)("div",{className:"stg:shrink-0 stg:border-b stg:border-border stg:px-2 stg:py-1.5",children:(0,t.jsx)("div",{role:"radiogroup","aria-label":"Search mode",className:"stg:inline-flex stg:rounded-md stg:bg-muted stg:p-0.5",children:[{value:"name",label:"Name"},{value:"text",label:"Text"}].map((s,i)=>{let l=e===s.value;return(0,t.jsx)("button",{ref:e=>{n.current[i]=e},type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,onClick:()=>r(s.value),onKeyDown:o,className:(0,a.f)("stg:rounded stg:px-2.5 stg:py-0.5 stg:text-2xs stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",l?"stg:bg-background stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground"),children:s.label},s.value)})})})}function eA({view:e}){return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col stg:border-r stg:border-border",children:[(0,t.jsx)(eR,{title:e.label}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:px-3 stg:py-3",children:e.content})]})}function eF({entries:e,reader:r,editors:n,selectedFile:i,virtualDocuments:o,change:l,reveal:c,onActivateEditor:u,onPinEditor:d,onCloseEditor:g,onCollapse:h}){let f=(0,s.useRef)(null),x=(0,s.useId)(),m=`${x}editor-panel`,v=`${x}editor-tab-`,y=i?(0,b.z)(i.entryId,i.path):null,j=null!==y?o?.find(e=>(0,b.z)(e.entryId,e.path)===y):void 0,k=i?e.find(e=>e.id===i.entryId)?.name:void 0;return(0,t.jsxs)("div",{className:"stg:flex stg:h-full stg:min-h-0 stg:flex-col",children:[(0,t.jsxs)("div",{className:(0,a.f)(eD,"stg:flex stg:shrink-0 stg:items-stretch stg:border-b stg:border-border stg:pr-24"),children:[(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:h,"aria-label":"Back to chat",className:"stg:flex stg:shrink-0 stg:items-center stg:border-r stg:border-border stg:px-2 stg:text-muted-foreground stg:transition-colors stg:hover:bg-accent-hover stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"}),children:(0,t.jsx)(e$,{})}),(0,t.jsx)(p.Y,{side:"top",children:"Back to chat"})]}),n.length>0&&(0,t.jsx)(eb,{editors:n,activeKey:y,onActivate:u,onPin:d,onClose:g,panelId:m,tabIdPrefix:v,className:"stg:min-w-0 stg:flex-1 stg:border-b-0"})]}),(0,t.jsx)("div",{className:"stg:flex stg:min-h-0 stg:min-w-0 stg:flex-1 stg:flex-col",...y?{role:"tabpanel",id:m,"aria-labelledby":ep(v,y)}:{},children:j?(0,t.jsx)("div",{className:"stg:min-h-0 stg:min-w-0 stg:flex-1 stg:overflow-y-auto stg:overflow-x-hidden",children:j.content},y??void 0):i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eT,{entryName:k,path:i.path,onRefresh:r?()=>f.current?.refresh():void 0}),(0,t.jsx)(en,{ref:f,selectedFile:i,entries:e,reader:r,change:l,reveal:c,onClose:h,showHeader:!1,className:"stg:min-h-0 stg:flex-1"},y??void 0)]}):(0,t.jsx)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:justify-center stg:p-8 stg:text-center stg:text-xs stg:text-muted-foreground",children:"Select a file to view its contents."})})]})}function eT({entryName:e,path:s,onRefresh:r}){let n=s.split("/").filter(Boolean),i=e?[e,...n]:n;return(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1 stg:border-b stg:border-border-muted stg:px-3 stg:py-1 stg:text-2xs stg:text-muted-foreground",children:[(0,t.jsx)("nav",{"aria-label":"File location",className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-1",children:i.map((e,s)=>{let r=s===i.length-1;return(0,t.jsxs)("span",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1",children:[s>0&&(0,t.jsx)("span",{className:"stg:text-muted-foreground-subtle","aria-hidden":"true",children:"›"}),(0,t.jsx)("span",{className:(0,a.f)("stg:truncate",r&&"stg:text-foreground"),children:e})]},s)})}),r&&(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Reload file",className:"stg:shrink-0 stg:rounded stg:p-0.5 stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring"}),children:(0,t.jsx)(eW,{})}),(0,t.jsx)(p.Y,{side:"top",children:"Reload file"})]})]})}let eD="stg:h-8";function eR({title:e}){return(0,t.jsx)("div",{className:(0,a.f)(eD,"stg:flex stg:shrink-0 stg:items-center stg:border-b stg:border-border stg:px-3 stg:text-2xs stg:font-semibold stg:uppercase stg:tracking-wide stg:text-muted-foreground"),children:e})}function eP({children:e}){return(0,t.jsx)("div",{className:"stg:px-2 stg:py-6 stg:text-center stg:text-xs stg:text-muted-foreground",children:e})}function eB(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M13 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,t.jsx)("path",{d:"M13 3v5h5"})]})}function eq(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,t.jsx)("path",{d:"M21 21l-4.3-4.3"})]})}function ez(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0 stg:text-muted-foreground","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 3.5V11a1 1 0 001 1h9a1 1 0 001-1V5.5a1 1 0 00-1-1H7L5.5 3H2.5a1 1 0 00-1 .5z"}),(0,t.jsx)("path",{d:"M7 7v3M5.5 8.5h3"})]})}function e$(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 3L5 8L10 13"})})}function eW(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M1.5 6a4.5 4.5 0 017.794-3.073M10.5 6a4.5 4.5 0 01-7.794 3.073"}),(0,t.jsx)("path",{d:"M9.5 1v2.5H7M2.5 11V8.5H5"})]})}function eU({workspace:e,panel:r,onBrowseLocalFolder:n,workspaceFileLister:i,workspaceFileReader:a,workspaceContentSearcher:o}){let{editors:l,activeKey:c,activeFile:u,reveal:d}=(0,x.d)(r.editorsStore),g=d&&d.key===c?d:void 0,h=e.addLocalPath,f=(0,s.useCallback)(async()=>{let e=await n?.();e&&h(e)},[n,h]);return(0,t.jsx)(eO,{entries:e.entries,lister:i,reader:a,searcher:o,view:r.view,onViewChange:r.setView,onRemoveEntry:e.remove,onAddLocalFolder:n?f:void 0,editors:l,selectedFile:u,onOpenFile:r.openFile,onActivateEditor:r.activateEditor,onPinEditor:r.pinEditor,onCloseEditor:r.closeEditor,onCollapse:r.closePanel,reveal:g,className:"stg:h-full"})}var eH=e.i(300868),eK=e.i(526935),eV=e.i(319745),eQ=e.i(873428);let e_=[];var eG=e.i(578021),eY=e.i(918789),eJ=e.i(61855),eZ=e.i(152254),eX=e.i(251568),e0=e.i(14480);function e1({plan:e,draft:r,onBuildFromPlan:n,buildDisabled:i,readOnly:o}){let[l,c]=(0,s.useState)("rendered"),u=!o&&void 0!==n,d=(0,eX.f)(u?n:void 0,i),{content:g,isTruncated:h,isLoading:f,error:x,refetch:m}=(0,eZ.f)(e.file.metadata?.id??null),p=o?void 0:r,b=p?.draftText??g,v=void 0!==p&&(!h||p.isEdited),y="edit"!==l||v?l:"rendered";return f?(0,t.jsx)(e2,{children:(0,t.jsx)(e3,{})}):x||null===b?(0,t.jsx)(e2,{children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Couldn’t load the plan",x?`: ${x.message}`:"."]}),(0,t.jsx)("button",{type:"button",onClick:m,className:"stg:rounded stg:text-xs stg:font-medium stg:text-foreground stg:underline-offset-2 stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Retry"})]})}):(0,t.jsxs)(e2,{onKeyDown:d,children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-2",children:[(0,t.jsxs)("div",{className:"stg:inline-flex stg:shrink-0 stg:rounded-md stg:bg-muted stg:p-0.5",role:"tablist","aria-label":"Plan view",children:[(0,t.jsx)(e4,{active:"rendered"===y,onClick:()=>c("rendered"),label:"Rendered"}),(0,t.jsx)(e4,{active:"source"===y,onClick:()=>c("source"),label:"Source"}),void 0!==p&&(0,t.jsx)(e4,{active:"edit"===y,onClick:()=>c("edit"),label:"Edit",disabled:!v})]}),(0,t.jsx)("span",{className:"stg:text-2xs stg:tabular-nums stg:text-muted-foreground",children:(0,e0.f)(e.file.status?.sizeBytes??BigInt(0))}),void 0!==p&&!v&&(0,t.jsx)("span",{className:"stg:min-w-0 stg:text-2xs stg:text-muted-foreground",children:"This plan is too large to edit in place — download it instead."}),(0,t.jsxs)("div",{className:"stg:ml-auto stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-3",children:[p?.isEdited&&(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-2",children:[(0,t.jsx)("span",{className:"stg:rounded-md stg:bg-accent stg:px-1.5 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-muted-foreground",children:"Edited"}),(0,t.jsx)("button",{type:"button",onClick:()=>p.setDraft(null),className:"stg:rounded stg:text-2xs stg:font-medium stg:text-muted-foreground stg:underline-offset-2 stg:hover:text-foreground stg:hover:underline stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",children:"Revert"})]}),o?(0,t.jsx)("span",{role:"status",className:"stg:rounded-md stg:bg-muted stg:px-2 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-muted-foreground",children:"Superseded by a newer plan"}):n&&(0,t.jsxs)("button",{type:"button",disabled:i,onClick:n,className:(0,a.f)("stg:inline-flex stg:min-w-0 stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5","stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:[(0,t.jsx)(e6,{}),(0,t.jsx)("span",{className:"stg:truncate",children:i?"Starting build…":"Build"})]})]})]}),"rendered"===y&&(0,t.jsx)(e5,{text:b}),"source"===y&&(0,t.jsx)("pre",{className:"stg:overflow-x-auto stg:rounded-md stg:bg-muted stg:p-3 stg:font-mono stg:text-xs stg:whitespace-pre-wrap stg:text-foreground",children:b}),"edit"===y&&void 0!==p&&(0,t.jsx)("textarea",{value:b,onChange:e=>p.setDraft(e.target.value),"aria-label":"Edit plan",spellCheck:!1,rows:28,className:(0,a.f)("stg:w-full stg:flex-1 stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-card stg:p-3","stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")}),h&&(0,t.jsx)("p",{role:"status",className:"stg:text-2xs stg:text-muted-foreground",children:"Preview truncated — download the plan for the full text."})]})}function e2({children:e,onKeyDown:s}){return(0,t.jsx)("div",{role:"article","aria-label":"Plan document",onKeyDown:s,className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:gap-3 stg:px-4 stg:py-3",children:e})}function e5({text:e}){let{title:r,body:n}=(0,s.useMemo)(()=>(0,eJ.w)((0,eJ.B)(e,!0)),[e]);return(0,t.jsxs)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border-muted stg:bg-card",children:[r&&(0,t.jsx)("header",{className:"stg:border-b stg:border-border-muted stg:bg-muted-faint stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-semibold stg:text-foreground",children:r})}),(0,t.jsx)("div",{className:"stgm-prose stg:px-4 stg:py-4",children:(0,t.jsx)(eY.f,{remarkPlugins:eJ.Z,components:eJ.r,children:n})})]})}function e3(){return(0,t.jsxs)("div",{className:"stg:space-y-2 stg:py-2","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"stg:h-8 stg:w-full stg:animate-pulse stg:rounded-md stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-2/3 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-full stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-5/6 stg:animate-pulse stg:rounded stg:bg-muted"})]})}function e4({active:e,onClick:s,label:r,disabled:n}){return(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":e,onClick:s,disabled:n,className:(0,a.f)("stg:rounded stg:px-2 stg:py-0.5 stg:text-2xs stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",e?"stg:bg-card stg:text-foreground stg:shadow-sm":"stg:text-muted-foreground stg:hover:text-foreground","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:r})}function e6(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 6h8M7 3l3 3-3 3"})})}e.i(146696);var e8=e.i(644731);function e7({displayText:e}){let{title:r,body:n}=(0,s.useMemo)(()=>(0,eJ.w)(e),[e]);return(0,t.jsxs)("div",{role:"article","aria-label":"Plan document","aria-busy":"true",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:gap-3 stg:px-4 stg:py-3",children:[(0,t.jsx)("div",{className:"stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-2",children:(0,t.jsxs)("span",{role:"status",className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:bg-muted stg:px-2 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-muted-foreground",children:[(0,t.jsx)(e9,{}),"Writing…"]})}),(0,t.jsxs)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border-muted stg:bg-card",children:[r&&(0,t.jsx)("header",{className:"stg:border-b stg:border-border-muted stg:bg-muted-faint stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-semibold stg:text-foreground",children:r})}),(0,t.jsx)("div",{className:"stgm-prose stg:px-4 stg:py-4",children:(0,t.jsx)(e8.f,{components:eJ.r,isAnimating:!0,caret:"block",children:n})})]})]})}function e9(){return(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:size-1.5 stg:animate-pulse stg:rounded-full stg:bg-primary"})}var te=e.i(900950),tt=e.i(894696),ts=e.i(843645),tr=e.i(586570),tn=e.i(657630),ti=e.i(456388),ta=e.i(209803);function to({file:e,org:s,isTerminal:r,onApplied:n,onDeleted:i,className:o}){let l=(0,ts.f)(e,s,{onApplied:n}),{download:c,isDownloading:u}=(0,ta.G)(),d=e.spec?.filename??"",g=null!==l.content;return(0,t.jsxs)("div",{role:"article","aria-label":`File ${d}`,className:(0,a.f)("stg:flex stg:min-h-0 stg:min-w-0 stg:flex-1 stg:flex-col",o),children:[(0,t.jsxs)("div",{className:"stg:sticky stg:top-0 stg:z-10 stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-x-3 stg:gap-y-1.5 stg:border-b stg:border-border stg:bg-background stg:px-4 stg:py-2",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:(0,t.jsx)(tu,{})}),(0,t.jsx)("span",{className:"stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:d}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-2xs stg:tabular-nums stg:text-muted-foreground",children:(0,e0.f)(e.status?.sizeBytes??BigInt(0))}),l.isDetecting&&!l.detectionLabel&&(0,t.jsx)("span",{className:"stg:h-4 stg:w-24 stg:shrink-0 stg:animate-pulse stg:rounded-full stg:bg-muted","aria-hidden":"true"}),l.detectionLabel&&(0,t.jsx)("span",{className:"stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-full stg:bg-primary-subtle stg:px-2 stg:py-0.5 stg:text-xs stg:font-medium stg:text-primary",children:l.detectionLabel}),(0,t.jsxs)("div",{className:"stg:ml-auto stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-3",children:[g&&(0,t.jsxs)("button",{type:"button",onClick:l.copy,"aria-label":l.copied?"Copied to clipboard":"Copy content",className:(0,a.f)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:transition-colors",l.copied?"stg:text-status-ready":"stg:text-muted-foreground stg:hover:text-foreground",tc),children:[l.copied?(0,t.jsx)(th,{}):(0,t.jsx)(td,{}),l.copied?"Copied":"Copy"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>c(e.metadata?.id??"",d),disabled:u,className:(0,a.f)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:disabled:opacity-50",tc),children:[(0,t.jsx)(tg,{}),u?"Preparing…":"Download"]}),(0,t.jsx)(ti.V,{file:e,onAdded:n}),i&&(0,t.jsx)(ti.q,{file:e,onDeleted:i}),(0,t.jsx)(tl,{isDetected:l.isDetected,ctaLabel:l.ctaLabel,isTerminal:r,isApplying:l.isApplying,applyResult:l.applyResult,applyError:l.applyError,onApply:l.apply})]})]}),(0,t.jsx)(tr.f,{file:e,content:l.content,contentType:l.contentType,isLoading:l.isLoading,error:l.error,isTruncated:l.isTruncated,className:"stg:min-w-0"}),(0,t.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"stg:sr-only",children:l.copied&&"Content copied to clipboard"})]})}function tl({isDetected:e,ctaLabel:s,isTerminal:r,isApplying:n,applyResult:i,applyError:o,onApply:l}){return i?(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:font-medium stg:text-status-ready",children:[(0,t.jsx)(th,{}),"Applied ","·"," ",i.name||i.kind]}):o?(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-2",role:"alert",children:[(0,t.jsx)("span",{className:"stg:text-xs stg:text-destructive",children:o.message}),(0,t.jsx)("button",{type:"button",onClick:l,className:(0,a.f)("stg:text-xs stg:font-medium stg:text-destructive stg:underline stg:transition-colors stg:hover:text-destructive-muted",tc),children:"Retry"})]}):e&&s?(0,t.jsx)("span",{"data-cursor-target":"apply-resource-button",children:(0,t.jsx)(tn.f,{label:s,isTerminal:r,isApplying:n,onApply:l})}):null}let tc="stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:focus-visible:rounded-sm";function tu(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9.5 1.5H5C4.17 1.5 3.5 2.17 3.5 3V13C3.5 13.83 4.17 14.5 5 14.5H11C11.83 14.5 12.5 13.83 12.5 13V4.5L9.5 1.5Z"}),(0,t.jsx)("path",{d:"M9.5 1.5V4.5H12.5"})]})}function td(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1"}),(0,t.jsx)("path",{d:"M8 4V2.5C8 1.95 7.55 1.5 7 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V7C1.5 7.55 1.95 8 2.5 8H4"})]})}function tg(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M6 1.5V8.5"}),(0,t.jsx)("path",{d:"M3 6L6 9L9 6"}),(0,t.jsx)("path",{d:"M2 10.5H10"})]})}function th(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2 6.5L4.5 9L10 3"})})}var tf=e.i(758804),tx=e.i(442346),tm=e.i(196739),tp=e.i(676951),tb=e.i(364802),tv=e.i(193799);let ty=/^(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?$/;function tj(e){let t=e.split("\n");for(let e=t.length-1;e>=0;e--){let s=t[e].trim();if(s)return s}return null}let tk=/^https?:\/\/[^/]+\/([^/]+)\/([^/]+)\/pull\/\d+/;function tw({writeBack:e,className:s}){let r=e.phase===tm.I.WORKSPACE_WRITE_BACK_FAILED,n=!!e.pullRequestUrl,i=function(e){if(e.workspaceEntryName)return e.workspaceEntryName;let t=tk.exec(e.pullRequestUrl);return t?`${t[1]}/${t[2]}`:"Workspace"}(e);return(0,t.jsxs)("div",{role:"article","aria-label":`Write-back: ${i}`,className:(0,a.f)("stg:flex stg:flex-col",s),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1",children:[(0,t.jsx)(tb.f,{text:i,className:"stg:min-w-0 stg:flex-1 stg:text-xs stg:font-medium stg:text-foreground"}),(0,t.jsx)(tN,{phase:e.phase,pullRequestNumber:e.pullRequestNumber})]}),n&&(0,t.jsx)(tC,{url:e.pullRequestUrl,number:e.pullRequestNumber}),e.branchName&&(0,t.jsx)(tS,{branchName:e.branchName,baseBranch:e.baseBranch}),e.error&&(0,t.jsx)("div",{className:(0,a.f)("stg:mx-2 stg:my-1 stg:rounded stg:px-2 stg:py-1 stg:text-xs",r?"stg:bg-destructive-subtle stg:text-destructive":"stg:bg-status-degraded-subtle stg:text-status-degraded"),children:e.error}),e.diffSummary&&(0,t.jsx)(tO,{diffSummary:e.diffSummary})]})}function tN({phase:e,pullRequestNumber:s}){let r;switch(e){case tm.I.WORKSPACE_WRITE_BACK_COMMITTED:r="Committed";break;case tm.I.WORKSPACE_WRITE_BACK_PUSHED:r="Pushed";break;case tm.I.WORKSPACE_WRITE_BACK_PR_CREATED:r=s>0?`PR #${s}`:"PR created";break;case tm.I.WORKSPACE_WRITE_BACK_FAILED:r="Failed";break;default:return null}return(0,t.jsx)("span",{className:(0,a.f)("stg:shrink-0 stg:text-2xs stg:font-medium stg:tabular-nums",e===tm.I.WORKSPACE_WRITE_BACK_FAILED?"stg:text-destructive":"stg:text-muted-foreground"),children:r})}function tC({url:e,number:s}){return(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:(0,a.f)("stg:group stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-xs stg:text-muted-foreground stg:transition-colors","stg:hover:bg-muted stg:hover:text-foreground",tM),children:[(0,t.jsx)("span",{className:"stg:shrink-0",children:(0,t.jsx)(tE,{})}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-foreground",children:s>0?`Pull Request #${s}`:"Pull Request"}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:opacity-0 stg:transition-opacity stg:group-hover:opacity-100 stg:group-focus-visible:opacity-100","aria-hidden":"true",children:(0,t.jsx)(tI,{})})]})}function tS({branchName:e,baseBranch:r}){let{copy:n,copied:i}=(0,tv.f)(),o=(0,s.useCallback)(()=>{n(e)},[n,e]);return(0,t.jsxs)("div",{className:"stg:group stg:flex stg:items-stretch",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:(0,t.jsx)(tL,{})}),(0,t.jsx)(tb.f,{text:e,className:"stg:min-w-0 stg:font-mono stg:text-foreground"}),r&&(0,t.jsxs)("span",{className:"stg:shrink-0 stg:font-mono stg:text-muted-foreground-faint",children:["← ",r]})]}),(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:o,"aria-label":i?"Branch name copied":`Copy branch name ${e}`,className:(0,a.f)("stg:flex stg:shrink-0 stg:items-center stg:px-2 stg:text-muted-foreground stg:transition-opacity",i?"stg:opacity-100":"stg:opacity-0 stg:group-hover:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:i?(0,t.jsx)(tF,{}):(0,t.jsx)(tA,{})}),(0,t.jsx)(p.Y,{side:"top",children:i?"Copied":"Copy branch name"})]})]})}function tO({diffSummary:e}){let s=function(e){let t=tj(e);if(null===t)return null;let s=ty.exec(t);return s?{filesChanged:Number(s[1]),insertions:Number(s[2]??0),deletions:Number(s[3]??0)}:null}(e);if(s)return(0,t.jsx)(tp.f,{fileCount:s.filesChanged,additions:s.insertions,deletions:s.deletions,className:"stg:px-2 stg:py-1"});let r=tj(e);return r?(0,t.jsx)("div",{className:"stg:px-2 stg:py-1 stg:font-mono stg:text-xs stg:text-muted-foreground",children:r}):null}let tM="stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring";function tL(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"4",cy:"3.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"4",cy:"10.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"10",cy:"5.5",r:"1.5"}),(0,t.jsx)("path",{d:"M4 5V9"}),(0,t.jsx)("path",{d:"M10 7V5.5"}),(0,t.jsx)("path",{d:"M4 5C4 5 4 7 7 7C10 7 10 5.5 10 5.5"})]})}function tE(){return(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"3.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"3.5",cy:"10.5",r:"1.5"}),(0,t.jsx)("circle",{cx:"10.5",cy:"10.5",r:"1.5"}),(0,t.jsx)("path",{d:"M3.5 5V9"}),(0,t.jsx)("path",{d:"M7 3.5H8.5C9.6 3.5 10.5 4.4 10.5 5.5V9"})]})}function tI(){return(0,t.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M9 3L3 9"}),(0,t.jsx)("path",{d:"M5 3H9V7"}),(0,t.jsx)("path",{d:"M9 8V10H2V3H4"})]})}function tA(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"4",y:"4",width:"6.5",height:"6.5",rx:"1"}),(0,t.jsx)("path",{d:"M8 4V2.5C8 1.95 7.55 1.5 7 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V7C1.5 7.55 1.95 8 2.5 8H4"})]})}function tF(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M2.5 6.5L5 9L9.5 3.5"})})}function tT({runs:e,expectsWriteBack:s=!1,isSettled:r=!1}){let{writeBacks:n,hasWriteBacks:i}=(0,tf.f)(e);return i?(0,t.jsx)("ul",{role:"list",className:`${v.J} stg:flex stg:flex-col stg:gap-3`,children:n.map(e=>(0,t.jsx)("li",{children:(0,t.jsx)(tw,{writeBack:e.writeBack})},e.writeBack.workspaceEntryName))}):s?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:r?"No changes have been pushed yet. When the agent changes files and you approve them, they are pushed to a branch and pull request here.":"Changes stay in the session workspace while you review them. Approved changes are pushed to a branch and pull request here."})}):(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No changes yet. Pull requests will appear here once the agent pushes its work back to your repository."})})}var tD=e.i(17616),tR=e.i(206398),tP=e.i(344087),tB=e.i(354999),tq=e.i(879049);function tz({item:e,onOpen:s,onActivate:r,onDownload:n,isDownloading:i,className:o}){return(0,t.jsxs)("li",{className:(0,a.f)("stg:group stg:flex stg:items-stretch",o),children:[(0,t.jsxs)(p.W,{children:[(0,t.jsxs)(p.y,{render:(0,t.jsx)("button",{type:"button",onClick:s,onDoubleClick:r,className:(0,a.f)("stg:flex stg:min-w-0 stg:flex-1 stg:items-center stg:gap-2 stg:px-2 stg:py-1 stg:text-left stg:text-xs stg:text-muted-foreground stg:transition-colors","stg:hover:bg-muted stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring")}),children:[(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-muted-foreground",children:(0,t.jsx)(tq.U,{fileName:e.name})}),(0,t.jsxs)("span",{className:"stg:min-w-0 stg:flex-1 stg:truncate stg:text-foreground",children:[e.name,e.subtitlePath&&(0,t.jsx)("span",{className:"stg:ml-1.5 stg:text-2xs stg:text-muted-foreground",children:e.subtitlePath})]}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-2xs stg:text-muted-foreground-faint",children:(0,e0.f)(e.sizeBytes)})]}),(0,t.jsx)(p.Y,{side:"top",className:"stg:break-all",children:e.tooltip})]}),(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:(0,t.jsx)("span",{className:"stg:flex stg:shrink-0"}),children:(0,t.jsx)("button",{type:"button",onClick:n,disabled:i,"aria-label":i?`Preparing ${e.name}`:`Download ${e.name}`,className:(0,a.f)("stg:flex stg:shrink-0 stg:items-center stg:px-2 stg:text-muted-foreground stg:opacity-0 stg:transition-opacity","stg:group-hover:opacity-100 stg:focus-visible:opacity-100","stg:hover:text-foreground stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:(0,t.jsx)(t$,{})})}),(0,t.jsx)(p.Y,{side:"top",children:"Download"})]})]})}function t$(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:shrink-0","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M6 1.5V8.5"}),(0,t.jsx)("path",{d:"M3 6L6 9L9 6"}),(0,t.jsx)("path",{d:"M2 10.5H10"})]})}function tW({file:e,place:r,hasNameCollision:n=!1,onOpen:i,onActivate:a,className:o}){let{download:l,isDownloading:c}=(0,ta.G)(),u=(0,s.useMemo)(()=>(function(e,t=!1,s){let r=e.spec?.filename??"",n=s||e.status?.outputPath||"";return{name:(n?n.slice(n.lastIndexOf("/")+1):r)||r,tooltip:n||r,subtitlePath:t&&n?function(e){let t=e.lastIndexOf("/");if(t<=0)return null;let s=e.slice(0,t),r=s.slice(s.lastIndexOf("/")+1);return r?`${r}/`:null}(n):null,sizeBytes:e.status?.sizeBytes??BigInt(0)}})(e,n,r),[e,n,r]);return(0,t.jsx)(tz,{item:u,onOpen:i,onActivate:a,onDownload:()=>l(e.metadata?.id??"",u.name),isDownloading:c,className:o})}var tU=e.i(361353);function tH({outputs:e,given:r,org:n,onShown:i,onApplied:a,onDeleted:o,onImplementPlan:l,onOpenPlan:c,onOpenFileDocument:u,onActivateFileDocument:d}){let[g,h]=(0,s.useState)(null),f=(0,s.useRef)(i);f.current=i,(0,s.useEffect)(()=>{f.current?.()},[]);let x=(0,s.useCallback)(e=>{c&&(0,eK.k)(e.file)?c(e.runId):u?u((0,tR.q)(e.file)):h({file:e.file,isTerminal:e.isTerminal})},[c,u]),m=(0,s.useCallback)(e=>{c&&(0,eK.k)(e.file)?c(e.runId):d?.((0,tR.q)(e.file))},[c,d]),p=(0,s.useCallback)(e=>{u?u((0,tP.q)(e)):h({file:e.file,isTerminal:!0})},[u]),b=(0,s.useCallback)(()=>{h(null),o?.()},[o]);return 0===e.length&&0===r.length?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No files yet. Files you give the conversation, and files the agent saves for you, appear here."})}):(0,t.jsxs)(t.Fragment,{children:[e.length>0&&(0,t.jsx)(tK,{title:"Saved by the agent",children:e.map(e=>(0,t.jsx)(tV,{entry:e,onOpen:()=>x(e),onActivate:d?()=>m(e):void 0,onOpenEarlier:e=>h({file:e,isTerminal:!0})},(0,tR.q)(e.file)))}),r.length>0&&(0,t.jsx)(tK,{title:"Given to the conversation",children:r.map(e=>(0,t.jsx)(tW,{file:e.file,place:e.place,onOpen:()=>p(e),onActivate:d?()=>d((0,tP.q)(e)):void 0},e.file.metadata?.id??(0,tP.q)(e)))}),g&&(0,t.jsx)(tB.f,{file:g.file,isTerminal:g.isTerminal,org:n,open:!0,onClose:()=>h(null),onApplied:a,onDeleted:o?b:void 0,onImplement:(0,eK.k)(g.file)?l:void 0})]})}function tK({title:e,children:s}){return(0,t.jsxs)("section",{"aria-label":e,className:"stg:flex stg:flex-col stg:pb-2",children:[(0,t.jsx)("h3",{className:"stg:px-2 stg:pb-1 stg:pt-2 stg:text-2xs stg:font-medium stg:uppercase stg:tracking-wide stg:text-muted-foreground-faint",children:e}),(0,t.jsx)("ul",{role:"list",className:`${v.J} stg:flex stg:flex-col`,children:s})]})}function tV({entry:e,onOpen:r,onActivate:n,onOpenEarlier:i}){let[a,o]=(0,s.useState)(!1),l=e.earlier.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tW,{file:e.file,hasNameCollision:e.hasNameCollision,onOpen:r,onActivate:n}),l>0&&(0,t.jsxs)("li",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:()=>o(e=>!e),className:"stg:self-start stg:px-2 stg:pb-1 stg:pl-8 stg:text-2xs stg:text-muted-foreground stg:transition-colors stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring",children:[a?"Hide":"Show"," ",l," earlier ",1===l?"version":"versions"]}),a&&(0,t.jsx)("ul",{role:"list","aria-label":`Earlier versions of ${e.file.spec?.filename??""}`,className:`${v.J} stg:flex stg:flex-col stg:pl-6`,children:e.earlier.map(e=>(0,t.jsx)(tQ,{file:e,onOpen:()=>i(e)},e.metadata?.id??""))})]})]})}function tQ({file:e,onOpen:s}){var r;let n,{download:i,isDownloading:a}=(0,ta.G)(),o=e.status?.audit?.specAudit?.createdAt,l=e.spec?.filename??"";return(0,t.jsx)(tz,{item:{name:l,tooltip:e.status?.outputPath||l,subtitlePath:o?(r=(0,tD.S)(o),"now"===(n=(0,tU.f)(r))?"saved just now":/^\d+[mhd]$/.test(n)?`saved ${n} ago`:`saved ${n}`):null,sizeBytes:e.status?.sizeBytes??BigInt(0)},onOpen:s,onDownload:()=>i(e.metadata?.id??"",l),isDownloading:a})}var t_=e.i(394327),tG=e.i(891287),tY=e.i(269285);let tJ={totalTokens:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,llmCallCount:0,workingSeconds:0,modelBreakdown:[],runBreakdown:[],servedBy:[],primaryModel:"",primaryProvider:"",hasUsage:!1,isEstimated:!1};function tZ(e){return{model:e.model,provider:e.provider,totalTokens:Number(e.totalTokens),inputTokens:Number(e.inputTokens),outputTokens:Number(e.outputTokens),cacheCreationTokens:Number(e.cacheCreationInputTokens),cacheReadTokens:Number(e.cacheReadInputTokens),callCount:e.callCount}}function tX(e){let t=(0,l.f)(),r=(0,s.useMemo)(()=>{let t=e[0]?.spec?.target;return t?.case==="sessionId"?t.value:null},[e]),n=(0,s.useMemo)(()=>e.some(e=>{let t=e.status?.phase;return void 0!==t&&!(0,eH.f)(t)}),[e]),i=(0,s.useCallback)(()=>t.run.getSessionUsageReport((0,tG.f)(tY.O,{sessionId:r})),[r,t]),{data:a,refetch:o}=(0,c.f)(r?i:null,[r,t],null,{cacheKey:r?`session-usage:${r}`:void 0,refetchInterval:!!n&&2500}),u=(0,s.useRef)(n);return(0,s.useEffect)(()=>{u.current&&!n&&o(),u.current=n},[n,o]),(0,s.useMemo)(()=>a?function(e){let t=e.totalUsage;if(!t)return tJ;let s=t.llmCallCount,r=Number(t.totalTokens),n=Number(t.workingSeconds);return{totalTokens:r,inputTokens:Number(t.inputTokens),outputTokens:Number(t.outputTokens),cacheReadTokens:Number(t.cacheReadInputTokens),cacheCreationTokens:Number(t.cacheCreationInputTokens),llmCallCount:s,workingSeconds:n,modelBreakdown:e.modelBreakdown.map(tZ),runBreakdown:e.runs.map(e=>({runId:e.runId,resolvedModel:e.primaryModel,totalTokens:Number(e.totalTokens),isEstimated:e.isEstimated,workingSeconds:Number(e.workingSeconds)})),servedBy:t.servedBy.map(e=>({providerKeySource:e.providerKeySource,totalTokens:Number(e.totalTokens),llmCallCount:e.llmCallCount})),primaryModel:t.primaryModel,primaryProvider:t.primaryProvider,hasUsage:s>0||r>0||n>0,isEstimated:e.isEstimated}}(a):tJ,[a])}var t0=e.i(826782),t1=e.i(105325);function t2({runs:e,className:s}){let r=tX(e);if(!r.hasUsage)return null;let n=r.modelBreakdown.length>1;return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:flex-col stg:gap-1.5",s),role:"region","aria-label":"Session usage summary",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-1.5",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:tabular-nums stg:text-foreground",children:(0,t0.k)(r.totalTokens)}),r.isEstimated&&(0,t.jsx)("span",{className:"stg:rounded stg:bg-muted stg:px-1 stg:py-0.5 stg:text-2xs stg:font-medium stg:leading-none stg:text-muted-foreground",children:"Estimated"})]}),n?(0,t.jsx)(t5,{models:r.modelBreakdown}):(0,t.jsxs)("div",{className:"stg:truncate stg:text-xs stg:text-muted-foreground",children:[r.primaryModel,r.primaryProvider&&` \xb7 ${r.primaryProvider}`]}),r.llmCallCount>0&&(0,t.jsx)("div",{className:"stg:text-xs stg:tabular-nums stg:text-muted-foreground",children:(0,t0.J)(r.llmCallCount)}),(0,t.jsxs)("div",{className:"stg:pl-2 stg:text-xs stg:tabular-nums stg:text-muted-foreground",children:["prompt ",(0,t0.I)(r.inputTokens)," · completion"," ",(0,t0.I)(r.outputTokens)]}),(r.cacheReadTokens>0||r.cacheCreationTokens>0)&&(0,t.jsx)(t3,{readTokens:r.cacheReadTokens,creationTokens:r.cacheCreationTokens}),(0,t.jsx)(t1.f,{rows:r.servedBy})]})}function t5({models:e}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",role:"list","aria-label":"Model token breakdown",children:e.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-baseline stg:justify-between stg:text-xs stg:text-muted-foreground",role:"listitem",children:[(0,t.jsx)("span",{className:"stg:truncate",children:e.model}),(0,t.jsx)("span",{className:"stg:ml-2 stg:shrink-0 stg:tabular-nums",children:(0,t0.k)(e.totalTokens)})]},`${e.model}\0${e.provider}`))})}function t3({readTokens:e,creationTokens:s}){let r=[];return e>0&&r.push(`${(0,t0.I)(e)} read`),s>0&&r.push(`${(0,t0.I)(s)} write`),(0,t.jsxs)("div",{className:"stg:pl-2 stg:text-xs stg:tabular-nums stg:text-muted-foreground",children:["cache ",r.join(" · ")]})}new Intl.NumberFormat("en-US");var t4=e.i(326454);function t6({runs:e}){let s=tX(e);return s.hasUsage?(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-5",children:[(0,t.jsx)(t2,{runs:e}),(0,t.jsxs)(t4.Z,{heading:"Working time",children:[(0,t.jsx)("p",{className:"stg:px-2 stg:text-xs stg:tabular-nums stg:text-foreground",children:(0,t0.Q)(s.workingSeconds)}),(0,t.jsx)("p",{className:"stg:px-2 stg:pt-1 stg:text-2xs stg:text-muted-foreground",children:"Time an agent was working on this session; waiting for a person is not counted."})]}),s.runBreakdown.length>0&&(0,t.jsx)(t8,{entries:s.runBreakdown,runs:e})]}):(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:px-4 stg:py-8 stg:text-center",children:(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"No usage data yet. Token counts will appear here."})})}function t8({entries:e,runs:s}){return(0,t.jsx)(t4.Z,{heading:"Per run",children:(0,t.jsx)("div",{role:"list","aria-label":"Per-run tokens, working time, model and tier",className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let n=function(e,t){let s=e.find(e=>e.metadata?.id===t);switch(s?.status?.streamingUsage?.requestedServiceTier){case t_.h.FAST:return"fast";case t_.h.STANDARD:return"standard";default:return null}}(s,e.runId);return(0,t.jsxs)("div",{className:"stg:flex stg:items-baseline stg:justify-between stg:gap-2 stg:px-2 stg:py-1 stg:text-xs",role:"listitem",children:[(0,t.jsxs)("span",{className:"stg:min-w-0 stg:truncate stg:text-foreground",children:[(0,t.jsxs)("span",{className:"stg:tabular-nums stg:text-muted-foreground",children:["#",r+1]})," ",e.resolvedModel||"—",n&&(0,t.jsxs)(t7,{children:[n," requested"]}),e.isEstimated&&(0,t.jsx)(t7,{children:"Estimated"})]}),(0,t.jsxs)("span",{className:"stg:shrink-0 stg:tabular-nums stg:text-2xs stg:text-muted-foreground",children:[(0,t0.k)(e.totalTokens)," · ",(0,t0.Q)(e.workingSeconds)]})]},e.runId)})})})}function t7({children:e}){return(0,t.jsx)("span",{className:"stg:ml-1 stg:rounded stg:bg-muted stg:px-1 stg:py-0.5 stg:text-2xs stg:font-medium stg:leading-none stg:text-muted-foreground",children:e})}let t9=[],se=[];function st(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,t.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.01a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.01a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.01a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function ss(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"6",cy:"6",r:"2.5"}),(0,t.jsx)("circle",{cx:"6",cy:"18",r:"2.5"}),(0,t.jsx)("circle",{cx:"18",cy:"8",r:"2.5"}),(0,t.jsx)("path",{d:"M6 8.5v7"}),(0,t.jsx)("path",{d:"M18 10.5a7 7 0 0 1-7 5H8.5"})]})}function sr(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 7V4.5A1.5 1.5 0 0 1 9.5 3H15l5 5v9.5a1.5 1.5 0 0 1-1.5 1.5H16"}),(0,t.jsx)("path",{d:"M15 3v5h5"}),(0,t.jsx)("path",{d:"M5.5 7H11l5 5v7.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 4 19.5v-11A1.5 1.5 0 0 1 5.5 7z"}),(0,t.jsx)("path",{d:"M11 7v5h5"})]})}function sn(){return(0,t.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M3 20h18"}),(0,t.jsx)("path",{d:"M6 20v-6"}),(0,t.jsx)("path",{d:"M11 20V9"}),(0,t.jsx)("path",{d:"M16 20v-9"}),(0,t.jsx)("path",{d:"M21 20V5"})]})}function si({flow:e,org:r,panel:n,onApplied:i,onImplementPlan:a,implementPlanDisabled:o,sessionPlan:l,sessionFiles:c,sessionOutputs:u,sessionGiven:d,onFilesShown:g,streamingPlan:h,planDraft:f,openPlanExecutionId:m,onOpenPlan:p,onOpenFileDocument:v,onActivateFileDocument:y,enableLocal:j,onBrowseLocalFolder:k,workspaceFileLister:w,workspaceFileReader:N,workspaceContentSearcher:C}){var S,O;let M,L,{editors:E,activeKey:I,activeFile:A,reveal:F}=(0,x.d)(n.editorsStore),T=F&&F.key===I?F:void 0,D=function(e,t,r,n){var i;let{fileChanges:a}=(i=e?t:e_,(0,s.useMemo)(()=>{let e=(0,eQ.h)(i);return{fileChanges:e,hasFileChanges:e.length>0,fileChangeCount:e.length}},[i]));return(0,s.useMemo)(()=>e&&r?function(e,t,s,r){for(let n of t){let t=(0,eV.f)(n.path,s,r);if(null!==t&&t.entryId===e.entryId&&t.path===e.path)return n}return null}(e,a,r,n)??null:null,[e,a,r,n])}(A&&!(0,b.I)(A.entryId)?A:null,e.allRuns,e.workspace.entries,e.sandboxWorkspaceRoot),R=(0,s.useMemo)(()=>{if(null===m||m===l?.runId)return l;let t=e.allRuns.find(e=>e.metadata?.id===m),s=(0,eK.Y)(c,t);return s?{runId:m,file:s}:l},[m,l,c,e.allRuns]),P=R?.runId===l?.runId,B=(0,s.useMemo)(()=>({entryId:te.$,path:te.H,content:h?(0,t.jsx)(e7,{displayText:h.displayText},`streaming-${h.executionId}`):R?(0,t.jsx)(e1,{plan:R,draft:P?f:void 0,onBuildFromPlan:P?a:void 0,buildDisabled:o,readOnly:!P},(0,eG.U)(R)):(0,t.jsx)(sa,{})}),[h,R,P,f,a,o]),q=(0,s.useMemo)(()=>{let e=new Map;for(let t of u)e.set((0,tR.q)(t.file),t);for(let t of d)e.set((0,tP.q)(t),{file:t.file,isTerminal:!0});return e},[u,d]),z=n.closeEditor,$=(0,s.useMemo)(()=>E.filter(e=>e.entryId===tt.f).map(e=>{let s=q.get(e.path);return{entryId:tt.f,path:e.path,content:s?(0,t.jsx)(to,{file:s.file,org:r,isTerminal:s.isTerminal,onApplied:i,onDeleted:()=>{z(tt.f,e.path),g()}},s.file.metadata?.id||e.path):(0,t.jsx)(so,{})}}),[E,q,r,i,z,g]),W=(0,s.useMemo)(()=>[B,...$],[B,$]),U="cloud"===e.executionTarget&&e.workspace.entries.some(e=>"git"===e.type),H=e.displayRun?.status?.phase??t_.A.RUN_PHASE_UNSPECIFIED,K=function({allRuns:e,outputs:r=t9,given:n=se,onFilesShown:i,onFileDeleted:a,org:o,sessionConfig:l,onApplied:c,onImplementPlan:u,onOpenPlan:d,onOpenFileDocument:g,onActivateFileDocument:h,includeRunFacets:f=!0,expectsWriteBack:x=!1,changesSettled:m=!1}){let{hasWriteBacks:p,writeBackCount:b}=(0,tf.f)(e),v=r.length+n.length;return(0,s.useMemo)(()=>{let s=[];return l&&s.push({id:"configure",label:"Config",icon:(0,t.jsx)(st,{}),content:(0,t.jsx)(tx.I,{...l})}),f&&((p||x)&&s.push({id:"changes",label:"Changes",icon:(0,t.jsx)(ss,{}),badge:b>0?b:void 0,content:(0,t.jsx)(tT,{runs:e,expectsWriteBack:x,isSettled:m})}),v>0&&s.push({id:"conversation-files",label:"Files",icon:(0,t.jsx)(sr,{}),badge:v,content:(0,t.jsx)(tH,{outputs:r,given:n,onShown:i,org:o,onApplied:c,onDeleted:a,onImplementPlan:u,onOpenPlan:d,onOpenFileDocument:g,onActivateFileDocument:h})}),s.push({id:"usage",label:"Usage",icon:(0,t.jsx)(sn,{}),content:(0,t.jsx)(t6,{runs:e})})),s},[l,f,x,m,p,b,v,r,n,i,a,e,o,c,u,d,g,h])}({allRuns:e.allRuns,outputs:u,given:d,onFilesShown:g,onFileDeleted:g,org:r,sessionConfig:void 0,onApplied:i,onImplementPlan:a,onOpenPlan:p,onOpenFileDocument:v,onActivateFileDocument:y,expectsWriteBack:U,changesSettled:(0,eH.f)(H)}),V=j&&!!k,Q=(0,s.useCallback)(async()=>{let t=await k?.();t&&e.workspace.addLocalPath(t)},[k,e.workspace.addLocalPath]),_=(S=e.allRuns,O=e.workspace.entries,L=[...M=function(e){let t=new Map;for(let s of e)for(let e of s.status?.workspaceWriteBacks??[])e.commitSha&&t.set(e.workspaceEntryName,e.commitSha);return t}(S)].map(([e,t])=>`${e}\x01${t}`).join("\0"),(0,s.useMemo)(()=>{if(0===M.size)return O;let e=O.filter(e=>"git"===e.type),t=!1,s=O.map(s=>{let r=function(e,t,s){if("git"!==e.type)return;let r=s.get(e.name);if(r)return r;if(1===t){let e=s.get("");if(e)return e;if(1===s.size)return s.values().next().value}}(s,e.length,M);return r&&r!==s.readRef?(t=!0,{...s,readRef:r}):s});return t?s:O},[O,L]));return(0,t.jsx)(eO,{entries:_,lister:w,reader:N,searcher:C,view:n.view,onViewChange:n.setView,extraViews:K,virtualDocuments:W,onRemoveEntry:e.workspace.remove,onAddLocalFolder:V?Q:void 0,editors:E,selectedFile:A,onOpenFile:n.openFile,onActivateEditor:n.activateEditor,onPinEditor:n.pinEditor,onCloseEditor:n.closeEditor,onCollapse:n.closePanel,change:D??void 0,reveal:T,className:"stg:h-full"})}function sa(){return(0,t.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This turn ended before a plan was completed."}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Any partial plan text remains in the conversation."})]})}function so(){return(0,t.jsxs)("div",{role:"status",className:"stg:mx-auto stg:flex stg:w-full stg:max-w-3xl stg:flex-col stg:items-center stg:gap-1 stg:px-4 stg:py-8 stg:text-center",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:font-medium stg:text-foreground",children:"This file is no longer available."}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"It may have been deleted, or replaced by a newer version."})]})}function sl({workspaceFileLister:e,workspaceFileReader:s,workspaceContentSearcher:r}){let n=(0,f.E)();if(null===n)return null;let i={workspaceFileLister:e,workspaceFileReader:s,workspaceContentSearcher:r};return"session"===n.kind?(0,t.jsx)(si,{...n.scope,...i}):(0,t.jsx)(eU,{...n.scope,...i})}var sc=e.i(275051),su=e.i(113843),sd=e.i(55389);let sg="github.com";function sh(e){let t=e.indexOf(sg);if(-1===t)return null;let s=e[t+sg.length];if("/"!==s&&":"!==s)return null;let r=e.slice(t+sg.length+1).split("/");if(2!==r.length)return null;let[n,i]=r,a=i.endsWith(".git")?i.slice(0,-4):i;return""===n||""===a||a.includes(".")?null:{owner:n,repo:a}}let sf={path:"... (tree truncated by GitHub — repository has too many files)",isDirectory:!1,notice:!0};function sx(e){let t=(0,l.f)(),r=(0,s.useCallback)(async s=>{let r;if("git"!==s.type||!s.gitUrl||!e)return null;let n=sh(s.gitUrl);if(!n)return null;let i=s.readRef||s.gitBranch||"main";try{r=await t.github.getTree({org:e,owner:n.owner,repo:n.repo,ref:i})}catch{return null}let a=r.entries.map(e=>({path:e.path,isDirectory:e.isDirectory}));return r.truncated&&a.push(sf),a},[e,t]);if(e)return r}function sm(e){let t=(0,l.f)(),r=(0,s.useCallback)(async(s,r)=>{let n;if("git"!==s.type||!s.gitUrl||!e)return null;let i=sh(s.gitUrl);if(!i)return null;let a=s.readRef||s.gitBranch||"main";try{n=await t.github.getFileContent({org:e,owner:i.owner,repo:i.repo,ref:a,path:r})}catch(e){if((0,o.c)(e))throw new es(r);throw e}let l=Number(n.size);return n.tooLarge?{text:null,isBinary:!1,size:l,encoding:"none",truncated:!0}:function(e,t,s=null){if(function(e){let t=Math.min(e.length,8e3);for(let s=0;s<t;s++)if(0===e[s])return!0;return!1}(e))return{text:null,isBinary:!0,size:t,encoding:"base64",...null!==s&&e.length<=0xa00000?{bytes:e}:{}};let r=function(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return null}}(e);if(null===r)return{text:null,isBinary:!1,size:t,encoding:"unknown"};let n=e.length>1048576;return{text:n?r.slice(0,1048576):r,isBinary:!1,size:t,encoding:"utf-8",...n?{truncated:!0}:{}}}(n.content,l,et(r))},[e,t]);if(e)return r}var sp=e.i(657328),sb=e.i(971854);function sv(e){let t=(0,sp.f)(),r=(0,sb.T)(),n=e?.hasLocalPicker??!1;return(0,s.useMemo)(()=>"cloud"===(t??("local"===r?"local":"cloud"))?{enableGitHub:!0,enableLocal:!1}:{enableGitHub:!n,enableLocal:!0},[t,r,n])}var sy=e.i(297629),sj=e.i(598292);function sk(){let e=(0,r.useSearchParams)(),n=(0,sy.x)(),i=(0,su.d)(),a=(0,sd.f)(n),{enableGitHub:o,enableLocal:l}=sv(),c=sx(a.readOrg),u=sm(a.readOrg),{navigateToSession:g}=(0,d.useSessionNavigation)(),f=e.get("agent"),x=e.get("plugin"),[m,p]=(0,s.useState)(()=>sw(f)),[b,v]=(0,s.useState)(()=>sw(x));return void 0===m&&f&&p(sw(f)),void 0===b&&x&&v(sw(x)),(0,s.useEffect)(()=>{(f||x)&&window.history.replaceState({},"","/")},[f,x]),(0,t.jsx)(sc.f,{org:n,onSessionCreated:g,onError:(e,t)=>{null===(0,sj.A)(t)&&h.c.error(e)},accountDefaults:i,gitHubConnection:o?a:void 0,enableGitHub:o,enableLocal:l,inspector:(0,t.jsx)(sl,{workspaceFileLister:c,workspaceFileReader:u}),initialAgentRef:m,initialPluginRefs:b?[b]:void 0,rememberPluginPicks:!0,className:"h-full"})}function sw(e){if(!e)return;let t=e.indexOf("/");if(!(t<=0)&&t!==e.length-1)return{org:e.slice(0,t),slug:e.slice(t+1)}}var sN=e.i(849111),sC=e.i(766895),sS=e.i(42592),sO=e.i(553215),sM=e.i(217127),sL=e.i(170255);function sE({id:e}){let{session:r}=(0,sO.f)(e);!function(e){let{orgs:t,activeOrg:r,setActiveOrg:n,isLoading:i}=(0,sy.S)(),a=(0,s.useRef)(null),o=e?.metadata?.id??"",l=e?.metadata?.org??"",c=r?.metadata?.id??"";(0,s.useEffect)(()=>{if(""===o||""===l||i||""===c||a.current===o||(a.current=o,l===c))return;let e=t.find(e=>e.metadata?.id===l);void 0!==e&&n(e)},[o,l,c,i,t,n])}(r);let n=(0,sy.x)(),i=(0,sd.f)(n),{enableGitHub:a,enableLocal:o}=sv(),l=sx(i.readOrg),c=sm(i.readOrg),u=(0,su.d)(),d=(0,sS.b)(),g=(0,sb.T)();return(0,t.jsx)("div",{className:"flex h-full w-full flex-col",children:(0,t.jsx)(sC.SessionViewer,{sessionId:e,org:n,accountDefaults:u,gitHubConnection:a?i:void 0,enableGitHub:a,enableLocal:o,inspector:(0,t.jsx)(sl,{workspaceFileLister:l,workspaceFileReader:c}),routineHref:e=>`/library/routines/${d(e.metadata?.org??"")}/${e.metadata?.slug??""}`,accessSlot:"local"===g?void 0:(0,t.jsx)(sM.f,{resource:{kind:sL.X.session,kindString:"session",id:e,org:n}})})})}e.i(107141),e.i(748008);var sI=e.i(19738),sA=e.i(878894),sF=e.i(367240),sT=e.i(610595);function sD({error:e,onRetry:s}){return(0,t.jsx)("div",{className:"flex min-h-[60vh] flex-col items-center justify-center px-4",children:(0,t.jsxs)("div",{className:"w-full max-w-sm space-y-6 text-center",children:[(0,t.jsx)("div",{className:"bg-destructive-subtle mx-auto flex size-12 items-center justify-center rounded-full",children:(0,t.jsx)(sA.f,{className:"text-destructive size-6"})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h1",{className:"text-lg font-semibold",children:"Failed to load run"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:(0,sT.g)(e)})]}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,t.jsxs)(u.f,{variant:"outline",onClick:s,children:[(0,t.jsx)(sF.f,{className:"mr-1.5 size-3.5"}),"Try again"]}),(0,t.jsx)(sI.default,{href:"/",className:"hover:bg-muted hover:text-foreground inline-flex h-8 items-center justify-center rounded-lg px-2.5 text-sm font-medium transition-colors",children:"Go to Dashboard"})]})]})})}let sR=(0,n.f)("file-question-mark",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);function sP(){return(0,t.jsx)("div",{className:"flex min-h-[60vh] flex-col items-center justify-center px-4",children:(0,t.jsxs)("div",{className:"w-full max-w-sm space-y-6 text-center",children:[(0,t.jsx)("div",{className:"bg-muted mx-auto flex size-12 items-center justify-center rounded-full",children:(0,t.jsx)(sR,{className:"text-muted-foreground size-6"})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h1",{className:"text-lg font-semibold",children:"Run not found"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"The run you're looking for doesn't exist or you don't have access to it."})]}),(0,t.jsx)(sI.default,{href:"/",className:"bg-primary text-primary-foreground hover:bg-primary-hover inline-flex h-8 items-center justify-center rounded-lg px-2.5 text-sm font-medium transition-colors",children:"Go to Dashboard"})]})})}var sB=e.i(440160);let sq=(0,n.f)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var sz=e.i(37727);let s$=[{test:e=>e.endsWith(".dmg"),os:"macos",arch:null,label:"macOS"},{test:e=>e.endsWith("-setup.exe"),os:"windows",arch:"x64",label:"Windows (64-bit)"},{test:e=>e.endsWith(".deb"),os:"linux",arch:"x64",label:"Linux (.deb)"},{test:e=>e.endsWith(".AppImage"),os:"linux",arch:"x64",label:"Linux (.AppImage)"}],sW=null;async function sU(){if(sW)return{ok:!0,release:sW};try{let e=await fetch("https://api.github.com/repos/stigmer/stigmer/releases/latest",{headers:{Accept:"application/vnd.github.v3+json"}});if(!e.ok)return{ok:!1,reason:"fetch-failed",status:e.status};let t=await e.json(),s=(t.tag_name??"").replace(/^v/,""),r=[];for(let e of t.assets??[]){let t=function(e,t){for(let s of s$)if(s.test(e))return{os:s.os,arch:s.arch,url:t,filename:e,label:s.label};return null}(e.name,e.browser_download_url);t&&r.push(t)}if(0===r.length)return{ok:!1,reason:"no-assets"};return sW={version:s,assets:r},{ok:!0,release:sW}}catch{return{ok:!1,reason:"fetch-failed"}}}let sH={macos:"Open the .dmg and drag Stigmer to Applications.",windows:"Run the installer and follow the prompts.",linux:"Install with sudo dpkg -i <filename>."},sK={macos:"macOS",windows:"Windows",linux:"Linux"},sV={label:"Download page",onClick:()=>window.open("https://stigmer.ai/download","_blank","noopener,noreferrer")};async function sQ(){try{let[e,t]=await Promise.all([new Promise(e=>{if("u"<typeof navigator)return void e({os:null,arch:null});let t=navigator.userAgent.toLowerCase(),s=null;t.includes("mac")?s="macos":t.includes("win")?s="windows":t.includes("linux")&&(s="linux");let r=null;if("macos"===s){let t=navigator.userAgentData;if(t)return void t.getHighEntropyValues(["architecture"]).then(t=>{e({os:s,arch:"arm"===t.architecture?"arm64":"x64"})}).catch(()=>{e({os:s,arch:"arm64"})});r="arm64"}else("windows"===s||"linux"===s)&&(r="x64");e({os:s,arch:r})}),sU()]);if(!e.os){console.warn("[desktop-download] Platform detection returned no OS",{userAgent:"u">typeof navigator?navigator.userAgent:"n/a"}),h.c.warning("Couldn’t detect your platform.",{description:"Visit the download page to pick the right installer.",action:sV,duration:8e3});return}if(!t.ok){console.warn("[desktop-download] Release fetch failed",t),h.c.warning("Couldn’t reach the download server.",{description:"Try again in a moment, or visit the download page.",action:sV,duration:8e3});return}let s=function(e,t){if(!t.os)return null;let s=e.filter(e=>e.os===t.os&&(null===e.arch||null===t.arch||e.arch===t.arch));return 0===s.length?null:1===s.length?s[0]:s.find(e=>e.filename.endsWith(".deb"))??s[0]}(t.release.assets,e);if(!s){console.warn("[desktop-download] No matching asset for platform",{platform:e,availableAssets:t.release.assets.map(e=>({os:e.os,arch:e.arch,filename:e.filename}))}),h.c.warning(`No installer found for ${sK[e.os]??e.os}.`,{description:"This platform may not be supported yet. Check all available downloads.",action:sV,duration:8e3});return}let r=document.createElement("a");r.href=s.url,r.download=s.filename,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),function(){try{localStorage.setItem(sY,new Date().toISOString()),window.dispatchEvent(new StorageEvent("storage",{key:sY}))}catch{}}(),h.c.success(`Downloading Stigmer Desktop for ${s.label}`,{description:sH[s.os??""]??"Check your downloads folder for the installer.",duration:8e3})}catch(e){console.warn("[desktop-download] Unexpected error",e),h.c.warning("Something went wrong.",{description:"Visit the download page to download Stigmer Desktop.",action:sV,duration:8e3})}}let s_="stigmer:desktop-banner-first-seen",sG="stigmer:desktop-banner-dismissed",sY="stigmer:desktop-downloaded",sJ="stigmer:has-local-runner",sZ="2026.04",sX=!1;function s0(){try{if(sX||function(){try{if(function(){try{return"__TAURI__"in window}catch{return!1}}()||localStorage.getItem(sY)||localStorage.getItem(sJ))return!0;return!1}catch{return!1}}()||function(){try{let e=localStorage.getItem(sG);if(!e)return!1;let t=JSON.parse(e);return t?.campaign===sZ}catch{return!1}}())return!1;return null!==localStorage.getItem(s_)}catch{return!1}}function s1(){return!1}function s2(e){function t(t){(t.key===s_||t.key===sG||t.key===sY||t.key===sJ)&&e()}return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function s5({onDismiss:e}){return(0,t.jsxs)("aside",{role:"complementary","aria-label":"Desktop app",className:"bg-card border-border-muted flex items-center gap-3 border-b px-4 py-2.5",children:[(0,t.jsx)(sq,{className:"text-muted-foreground size-4 shrink-0"}),(0,t.jsxs)("p",{className:"text-muted-foreground min-w-0 flex-1 text-xs",children:[(0,t.jsx)("span",{className:"text-foreground font-medium",children:"Stigmer Desktop"})," — ","manage runners from your system tray with deep-link launches and native notifications."]}),(0,t.jsxs)("button",{type:"button",onClick:sQ,className:"text-primary hover:text-foreground inline-flex shrink-0 items-center gap-1 text-xs font-medium transition-colors",children:["Download",(0,t.jsx)(sB.f,{className:"text-muted-foreground size-3"})]}),(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Dismiss",className:"text-muted-foreground hover:text-foreground -mr-1 shrink-0 rounded p-0.5 transition-colors",children:(0,t.jsx)(sz.X,{className:"size-3.5"})})]})}var s3=e.i(766354),s4=e.i(607486),s6=e.i(63209),s8=e.i(16715);let s7=(0,n.f)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var s9=e.i(107233),re=e.i(468806),rt=e.i(916624),rs=e.i(379185);function rr({onOrgChanged:e,className:r}){let{orgs:n,activeOrg:i,setActiveOrg:o,isLoading:l,error:c,retry:u,refresh:d}=(0,sy.S)(),[g,h]=(0,s.useState)(!1),f=(0,s.useId)(),x=(0,s.useCallback)(t=>{let s=n.find(e=>e.metadata?.id===t);s&&s.metadata?.id!==i?.metadata?.id&&(o(s),e?.(s))},[n,i,o,e]),m=(0,s.useCallback)(t=>{h(!1),d(t.metadata?.id),e?.(t)},[d,e]);if(l)return(0,t.jsx)(ri,{className:r});if(c)return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1.5",r),children:[(0,t.jsx)(s6.f,{className:"stg:text-destructive stg:size-4 stg:shrink-0"}),(0,t.jsx)("span",{className:"stg:text-destructive stg:truncate stg:text-xs",children:c}),(0,t.jsx)("button",{onClick:u,className:"stg:text-sidebar-muted-foreground stg:hover:text-sidebar-foreground stg:shrink-0 stg:rounded stg:p-0.5 stg:transition-colors","aria-label":"Retry loading organizations",children:(0,t.jsx)(s8.f,{className:"stg:size-3"})})]});let p=n.length>0&&i,b=p&&!n.some(e=>e.metadata?.id===i.metadata?.id)?i:null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(rt.k,{children:[(0,t.jsxs)(rt.g,{"aria-label":"Organization menu",className:(0,a.f)("stg:hover:bg-sidebar-accent stg:flex stg:w-full stg:cursor-pointer stg:items-center stg:gap-2 stg:rounded-lg stg:px-2 stg:py-1.5 stg:text-sm stg:transition-colors stg:focus:outline-none",r),children:[(0,t.jsx)(s4.f,{className:"stg:text-sidebar-muted-foreground stg:mt-0.5 stg:size-4 stg:shrink-0 stg:self-start"}),p?(0,t.jsx)(rn,{org:i,slugClassName:"stg:text-sidebar-muted-foreground"}):(0,t.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate",children:"No organizations"}),(0,t.jsx)(s7,{className:"stg:text-sidebar-muted-foreground stg:ml-auto stg:mt-0.5 stg:size-3.5 stg:shrink-0 stg:self-start"})]}),(0,t.jsxs)(rt.A,{align:"start",side:"bottom",sideOffset:4,children:[p&&(0,t.jsxs)(rt.B,{value:i.metadata?.id??"",onValueChange:x,children:[b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(rt.Z,{value:b.metadata?.id??"",className:"stg:items-start",children:[(0,t.jsx)(s4.f,{className:"stg:mt-0.5 stg:size-3.5 stg:shrink-0"}),(0,t.jsx)(rn,{org:b,detail:function(e,t){let s=e.spec?.parentOrg??"";if(!s)return;let r=(0,sy.I)(t,s),n=r?.metadata?.name||r?.metadata?.slug;return n?`Child of ${n}`:"Child organization"}(b,n)})]}),(0,t.jsx)(rt.a,{})]}),n.map(e=>(0,t.jsxs)(rt.Z,{value:e.metadata?.id??"",className:"stg:items-start",children:[(0,t.jsx)(s4.f,{className:"stg:mt-0.5 stg:size-3.5 stg:shrink-0"}),(0,t.jsx)(rn,{org:e})]},e.metadata?.id))]}),p&&(0,t.jsx)(rt.a,{}),(0,t.jsxs)(rt.d,{onClick:()=>h(!0),children:[(0,t.jsx)(s9.f,{className:"stg:size-4"}),"Create organization"]})]})]}),(0,t.jsx)(re.f,{open:g,onOpenChange:h,width:"md",dismissOnBackdrop:!1,"aria-labelledby":f,children:g&&(0,t.jsxs)("div",{className:"stg:p-6",children:[(0,t.jsx)("h2",{id:f,className:"stg:text-sm stg:font-semibold stg:text-foreground",children:"Create organization"}),(0,t.jsx)("p",{className:"stg:mt-1 stg:mb-4 stg:text-xs stg:text-muted-foreground",children:"Organizations are tenancy boundaries that own agents, vaults, and other resources."}),(0,t.jsx)(rs.f,{onCreated:m,onCancel:()=>h(!1)})]})})]})}function rn({org:e,slugClassName:s,detail:r}){let n=e.metadata?.name||e.metadata?.slug,i=r??e.metadata?.slug;return(0,t.jsxs)("span",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("span",{className:"stg:block stg:truncate stg:text-sm stg:font-medium stg:leading-tight",children:n}),i&&(0,t.jsx)("span",{className:(0,a.f)("stg:block stg:truncate stg:text-xs stg:leading-tight",s??"stg:text-muted-foreground"),children:i})]})}function ri({className:e}){return(0,t.jsxs)("div",{className:(0,a.f)("stg:flex stg:items-center stg:gap-2 stg:px-2 stg:py-1.5",e),children:[(0,t.jsx)("div",{className:"stg:bg-sidebar-muted stg:size-4 stg:animate-pulse stg:rounded"}),(0,t.jsx)("div",{className:"stg:bg-sidebar-muted stg:h-4 stg:w-24 stg:animate-pulse stg:rounded"})]})}var ra=e.i(816418);function ro({ariaLabel:e,isOpen:r=!0,onCollapse:n,onOrgChanged:o,footer:l,children:c}){let u=(0,s.useId)(),d=(0,ra.$)();return(0,t.jsxs)("nav",{id:u,"aria-label":e,className:"stg:bg-sidebar stg:text-sidebar-foreground stg:flex stg:h-full stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:flex-none stg:items-center stg:gap-1 stg:px-2 stg:py-2",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-expanded":r,"aria-controls":u,"aria-label":"Collapse sidebar",className:(0,a.f)("stg:inline-flex stg:size-7 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-md","stg:text-sidebar-foreground stg:transition-colors stg:motion-reduce:transition-none","stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground","stg:aria-expanded:bg-sidebar-accent stg:aria-expanded:text-sidebar-accent-foreground","stg:focus-visible:ring-sidebar-ring stg:focus-visible:ring-2 stg:focus-visible:outline-none"),children:(0,t.jsx)(i,{className:"stg:size-4"})}),(0,t.jsx)("div",{className:"stg:min-w-0 stg:flex-1",children:!1===d&&(0,t.jsx)(rr,{onOrgChanged:o})})]}),c,(0,t.jsx)("div",{className:"stg:border-sidebar-border stg:flex-none stg:border-t stg:px-3 stg:py-2",children:l})]})}function rl(){return(0,t.jsx)("div",{className:"stg:px-3 stg:py-1",children:(0,t.jsx)("div",{className:"stg:bg-sidebar-border stg:h-px"})})}function rc(e){return(0,a.f)("stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-sm stg:leading-4 stg:transition-colors",e?"stg:bg-sidebar-accent stg:text-sidebar-accent-foreground":"stg:text-sidebar-muted-foreground stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground")}function ru(){return"stg:text-sidebar-muted-foreground stg:px-2 stg:text-2xs stg:leading-4 stg:font-medium stg:tracking-wide stg:uppercase"}function rd({groups:e,activePath:s=null,renderLink:r,backHref:n="/",footer:i,isOpen:a=!0,onCollapse:o,onOrgChanged:l}){return(0,t.jsxs)(ro,{ariaLabel:"Management navigation",isOpen:a,onCollapse:o,onOrgChanged:l,footer:i,children:[(0,t.jsx)("div",{className:"stg:flex-none stg:px-3 stg:py-1",children:r({id:"back-to-sessions",href:n,active:!1,className:rc(!1),"aria-current":void 0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s3.f,{className:"stg:size-4 stg:shrink-0"}),"Back to Sessions"]})})}),(0,t.jsx)(rl,{}),(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-5 stg:px-3 stg:py-1",children:e.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,t.jsx)("span",{className:`${ru()} stg:pb-1`,children:e.label}),e.items.map(e=>{let n=null!=s&&(s===e.href||s.startsWith(`${e.href}/`));return(0,t.jsx)(rg,{href:e.href,label:e.label,icon:(0,t.jsx)(e.icon,{className:"stg:size-4 stg:shrink-0"}),active:n,renderLink:r},e.href)})]},e.label))}),(0,t.jsx)("div",{className:"stg:flex-1"})]})}function rg({href:e,label:s,icon:r,active:n,renderLink:i}){return i({id:e.slice(e.lastIndexOf("/")+1),href:e,active:n,className:rc(n),"aria-current":n?"page":void 0,children:(0,t.jsxs)(t.Fragment,{children:[r,s]})})}var rh=e.i(20753),rf=e.i(363178),rx=e.i(292270);let rm=(0,n.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),rp=(0,n.f)("sun-moon",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715",key:"xlf6rm"}],["path",{d:"M16 12a4 4 0 0 0-4-4",key:"6vsxu"}],["path",{d:"m19 5-1.256 1.256",key:"1yg6a6"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);var rb=e.i(284614);function rv({user:e,colorMode:s,onColorModeChange:r,onSettingsClick:n,onSignOut:i,extraItems:o,className:l}){let c=null!=s&&null!=r,u=null!=n,d=u||c||o,g=e?.name??e?.email,h=e?"User menu":"Settings";return(0,t.jsxs)(rt.k,{children:[(0,t.jsxs)(rt.g,{"aria-label":h,className:(0,a.f)("stg:hover:bg-sidebar-accent stg:flex stg:w-full stg:cursor-pointer stg:items-center stg:gap-2 stg:rounded-lg stg:px-2 stg:py-1.5 stg:transition-colors stg:focus:outline-none",l),children:[(0,t.jsx)(rj,{name:g}),e?(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-1 stg:flex-col stg:text-left",children:[e.name&&(0,t.jsx)("span",{className:"stg:truncate stg:text-sm stg:font-medium",children:e.name}),(0,t.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate stg:text-xs",children:e.email})]}):(0,t.jsx)("span",{className:"stg:text-sidebar-muted-foreground stg:truncate stg:text-sm",children:"Local mode"}),(0,t.jsx)(s7,{className:"stg:text-sidebar-muted-foreground stg:ml-auto stg:size-3.5 stg:shrink-0"})]}),(0,t.jsxs)(rt.A,{align:"start",side:"top",sideOffset:8,children:[u&&(0,t.jsxs)(rt.d,{onClick:n,children:[(0,t.jsx)(rm,{className:"stg:size-4"}),"Settings"]}),u&&c&&(0,t.jsx)(rt.a,{}),c&&(0,t.jsx)(ry,{colorMode:s,onColorModeChange:r}),o&&(0,t.jsxs)(t.Fragment,{children:[(u||c)&&(0,t.jsx)(rt.a,{}),o]}),null!=i&&(0,t.jsxs)(t.Fragment,{children:[d&&(0,t.jsx)(rt.a,{}),(0,t.jsxs)(rt.d,{onClick:i,children:[(0,t.jsx)(rx.f,{className:"stg:size-4"}),"Sign out"]})]})]})]})}function ry({colorMode:e,onColorModeChange:s}){return(0,t.jsxs)(rt.F,{"aria-label":"Color scheme",children:[(0,t.jsxs)(rt.U,{children:[(0,t.jsx)(rp,{className:"stg:mr-1 stg:inline stg:size-3 stg:align-[-2px]"}),"Color Scheme"]}),(0,t.jsxs)(rt.B,{value:e,onValueChange:e=>s(e),children:[(0,t.jsx)(rt.Z,{value:"light",children:"Light"}),(0,t.jsx)(rt.Z,{value:"dark",children:"Dark"}),(0,t.jsx)(rt.Z,{value:"system",children:"System"})]})]})}function rj({name:e}){let s=e?e.charAt(0).toUpperCase():null;return(0,t.jsx)("div",{className:(0,a.f)("stg:bg-sidebar-accent stg:text-sidebar-accent-foreground stg:border-sidebar-border","stg:flex stg:size-6 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-full stg:border"),children:s?(0,t.jsx)("span",{className:"stg:text-xs stg:font-medium",children:s}):(0,t.jsx)(rb.f,{className:"stg:size-3.5"})})}e.i(67407);var rk=e.i(800692);e.i(761625),e.i(807004),e.i(292203),e.i(68640),e.i(678120),e.i(330250);var rw=e.i(150630);function rN({className:e,inset:s,variant:r="default",...n}){return(0,t.jsx)(rw.f.Item,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:(0,a.f)("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive-subtle data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function rC(){let{user:e,logout:n}=(0,rk.f)(),{theme:i,setTheme:a}=(0,rf.i)(),o=(0,r.useRouter)(),l=(0,s.useCallback)(()=>{o.push("/settings")},[o]);return(0,t.jsx)(rv,{user:e?{name:e.name,email:e.email}:null,colorMode:i??"system",onColorModeChange:a,onSettingsClick:l,onSignOut:e?n:void 0,extraItems:(0,t.jsx)(rS,{})})}function rS(){return(0,t.jsxs)(rN,{onClick:sQ,children:[(0,t.jsx)(sq,{className:"size-4"}),"Get Desktop App",(0,t.jsx)(sB.f,{className:"text-muted-foreground ml-auto size-3"})]})}e.i(328991),e.i(154469),e.i(998683),e.i(440706),e.i(246349),e.i(678784);let rO="stigmer:sidebar-open";function rM(){try{let e=localStorage.getItem(rO);if(null===e)return!0;return"false"!==e}catch{return!0}}function rL(){return!0}function rE(e){function t(t){t.key===rO&&e()}return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function rI(e){try{localStorage.setItem(rO,String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:rO}))}function rA(){let e=(0,s.useSyncExternalStore)(rE,rM,rL),t=(0,s.useCallback)(()=>rI(!rM()),[]);return{isOpen:e,toggle:t,open:(0,s.useCallback)(()=>rI(!0),[]),close:(0,s.useCallback)(()=>rI(!1),[])}}function rF(){let e=rA(),n=(0,r.usePathname)(),i=(0,r.useRouter)(),{lastSessionZonePath:a}=(0,d.useSessionNavigation)(),o=(0,rh.f)(),l=(0,s.useCallback)(({href:e,className:s,children:r,"aria-current":n})=>(0,t.jsx)(sI.default,{href:e,"aria-current":n,className:s,children:r}),[]),c=(0,s.useCallback)(()=>{i.push("/dashboard")},[i]);return(0,t.jsx)(rd,{groups:o,activePath:n,backHref:a??"/",renderLink:l,footer:(0,t.jsx)(rC,{}),isOpen:e.isOpen,onCollapse:e.close,onOrgChanged:c})}var rT=e.i(94875),rD=e.i(799190);let rR=new Date(0);function rP(e){return e.id.startsWith("ses_")}function rB(e){let t=e.updatedAt?(0,tD.S)(e.updatedAt):rR;return{id:e.id,subject:e.subject||"Untitled session",updatedAt:t.getTime()>0?t:rR}}let rq=(0,n.f)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),rz=(0,n.f)("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);var r$=e.i(686311),rW=e.i(981997),rU=e.i(223945),rH=e.i(966992);function rK(e,t){let s=new Date(e);return s.setDate(s.getDate()+t),s}function rV({className:e,children:s,...r}){return(0,t.jsx)("div",{className:(0,a.f)("stg:relative stg:overflow-auto","stg:[scrollbar-width:thin] stg:[scrollbar-color:var(--color-border)_transparent]","stg:[&::-webkit-scrollbar]:w-2.5","stg:[&::-webkit-scrollbar-track]:bg-transparent","stg:[&::-webkit-scrollbar-thumb]:rounded-full","stg:[&::-webkit-scrollbar-thumb]:bg-border",e),...r,children:s})}function rQ({activeNav:e=null,renderLink:r,recentActivity:n,activeSessionId:i=null,renderEntryAccessory:a,conversationsBadgeCount:o,footer:l,isOpen:c=!0,onCollapse:u,onOrgChanged:d,now:g}){let{entries:h,isLoading:f=!1,error:x=null}=n,m=(0,s.useMemo)(()=>(function(e,t){let s,r=((s=new Date(t??new Date)).setHours(0,0,0,0),s),n=rK(r,-1),i=rK(r,-6),a=rK(r,-29),o=[{label:"Today",entries:[]},{label:"Yesterday",entries:[]},{label:"Previous 7 Days",entries:[]},{label:"Previous 30 Days",entries:[]},{label:"Older",entries:[]}];for(let t of e){let e=t.updatedAt;e>=r?o[0].entries.push(t):e>=n?o[1].entries.push(t):e>=i?o[2].entries.push(t):e>=a?o[3].entries.push(t):o[4].entries.push(t)}return o.filter(e=>e.entries.length>0)})(h,g),[h,g]);return(0,t.jsxs)(ro,{ariaLabel:"Main navigation",isOpen:c,onCollapse:u,onOrgChanged:d,footer:l,children:[(0,t.jsxs)("div",{className:"stg:flex stg:flex-none stg:flex-col stg:gap-0.5 stg:px-3 stg:py-1",children:[(0,t.jsx)(r_,{id:"new-session",href:"/",label:"New Session",icon:s9.f,active:"new-session"===e,renderLink:r}),(0,t.jsx)(r_,{id:"dashboard",href:"/dashboard",label:"Dashboard",icon:rq,active:"dashboard"===e,renderLink:r}),(0,t.jsx)(r_,{id:"conversations",href:"/conversations",label:"Conversations",icon:rW.f,active:"conversations"===e,renderLink:r,accessory:void 0!==o&&o>0?(0,t.jsx)(rG,{count:o}):null}),(0,t.jsx)(r_,{id:"library",href:"/library",label:"Library",icon:rz,active:"library"===e,renderLink:r}),(0,t.jsx)(r_,{id:"marketplace",href:"/marketplace",label:"Marketplace",icon:rU.f,active:"marketplace"===e,renderLink:r}),(0,t.jsx)(r_,{id:"models",href:"/models",label:"Models & providers",icon:rH.f,active:"models"===e,renderLink:r})]}),(0,t.jsx)(rl,{}),(0,t.jsx)(rV,{className:"stg:flex-1",children:(0,t.jsxs)("div",{className:"stg:p-3",children:[(0,t.jsx)("p",{className:`${ru()} stg:mb-2`,children:"Recents"}),f?(0,t.jsx)(rZ,{}):x?(0,t.jsx)(rX,{message:x.message}):0===m.length?(0,t.jsx)(r0,{}):(0,t.jsx)(rY,{groups:m,activeSessionId:i,renderLink:r,renderEntryAccessory:a,now:g})]})})]})}function r_({id:e,href:s,label:r,icon:n,active:i,renderLink:a,accessory:o=null}){return a({id:e,href:s,active:i,className:rc(i),"aria-current":i?"page":void 0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n,{className:"stg:size-4 stg:shrink-0"}),r,o]})})}function rG({count:e}){return(0,t.jsxs)("span",{className:"stg:ml-auto stg:flex stg:shrink-0 stg:items-center",children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:bg-sidebar-primary stg:text-sidebar-primary-foreground stg:rounded-full stg:px-1.5 stg:py-0.5 stg:text-2xs stg:leading-none stg:font-semibold stg:tabular-nums",children:e>99?"99+":e}),(0,t.jsx)("span",{className:"stg:sr-only",children:1===e?"1 conversation needs a human":`${e} conversations need a human`})]})}function rY({groups:e,activeSessionId:s,renderLink:r,renderEntryAccessory:n,now:i}){return(0,t.jsx)(p.g,{children:(0,t.jsx)("div",{className:"stg:space-y-4",children:e.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"stg:text-sidebar-muted-foreground stg:mb-1 stg:px-2 stg:text-2xs stg:font-medium stg:tracking-wide stg:uppercase",children:e.label}),(0,t.jsx)("ul",{className:`${v.J} stg:space-y-0.5`,role:"list",children:e.entries.map(e=>(0,t.jsx)(rJ,{entry:e,activeSessionId:s,renderLink:r,renderEntryAccessory:n,now:i},e.id))})]},e.label))})})}let rJ=(0,s.memo)(function({entry:e,activeSessionId:s,renderLink:r,renderEntryAccessory:n,now:i}){let a=e.id===s,o=r({id:e.id,href:`/sessions/${e.id}`,active:a,"aria-current":a?"page":void 0,entry:e,className:a?"stg:flex stg:items-start stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:transition-colors stg:bg-sidebar-accent stg:text-sidebar-accent-foreground":"stg:flex stg:items-start stg:gap-2 stg:rounded-md stg:px-2 stg:py-1 stg:text-xs stg:transition-colors stg:text-sidebar-muted-foreground stg:hover:bg-sidebar-accent stg:hover:text-sidebar-accent-foreground",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r$.f,{className:"stg:mt-0.5 stg:size-3 stg:shrink-0 stg:opacity-50","aria-hidden":"true"}),(0,t.jsx)("span",{className:"stg:line-clamp-2 stg:flex-1",children:e.subject}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-2xs stg:leading-tight stg:text-sidebar-muted-foreground stg:tabular-nums",children:(0,tU.f)(e.updatedAt,i)}),n?.(e)]})});return(0,t.jsx)("li",{children:(0,t.jsxs)(p.W,{children:[(0,t.jsx)(p.y,{render:o}),(0,t.jsx)(p.Y,{side:"right",sideOffset:12,children:e.subject})]})})});function rZ(){return(0,t.jsx)(Z.f,{className:"stg:space-y-2 stg:px-2",label:"Loading sessions",children:Array.from({length:5},(e,s)=>(0,t.jsx)("div",{className:"stg:bg-sidebar-muted stg:h-5 stg:animate-pulse stg:rounded",style:{width:`${70+20*Math.sin(1.5*s)}%`}},s))})}function rX({message:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"stg:text-destructive stg:mb-4 stg:px-2 stg:text-xs",role:"alert",children:e}),(0,t.jsx)(r0,{})]})}function r0(){return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:py-8 stg:text-center",children:[(0,t.jsx)(r$.f,{className:"stg:text-sidebar-muted-foreground stg:size-8"}),(0,t.jsx)("p",{className:"stg:text-sidebar-muted-foreground stg:text-xs",children:"No recent activity"})]})}function r1(e){return!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&0===e.button}function r2(){let e=rA(),n=(0,r.usePathname)(),i=(0,r.useRouter)(),a=function(){let e=(void 0)??30,t=(0,l.f)(),s=(0,sy.x)(),{data:r,isLoading:n,error:i,refetch:a}=(0,c.f)(()=>t.activity.listRecentActivity({pageSize:e,org:s}).then(e=>e.entries.filter(rP).map(rB)),[t,e,s],[],{cacheKey:`recent-activity:${s}`});return{entries:r,isLoading:n,error:i,refetch:a}}(),{refetch:o}=a,{count:u}=function(e){let t=(0,l.f)(),r=(void 0)??rD.U,n=e?async()=>(await t.channel.countConversations((0,tG.f)(rT.P,{org:e,filter:rT.r.filter_wants_human}))).count:null,{data:i,isLoading:a,error:o,refetch:u}=(0,c.f)(n,[e,t],0,{refetchInterval:r,refetchOnWindowFocus:!0});return(0,s.useMemo)(()=>({count:i,isLoading:a,error:o,refetch:u}),[i,a,o,u])}((0,sy.x)()||null),{activeSessionId:h,isSessionZone:f,navigateToSession:x,navigateToHome:m}=(0,d.useSessionNavigation)(),{isExecutionZone:p}=(0,g.f)(),b=!f&&!p&&n.startsWith("/dashboard"),v=!f&&!p&&n.startsWith("/conversations"),y=!f&&!p&&n.startsWith("/library"),j=!f&&!p&&n.startsWith("/marketplace"),k=!f&&!p&&n.startsWith("/models"),w=(0,s.useCallback)(()=>{i.push("/dashboard")},[i]);(0,s.useEffect)(()=>{if(o(),!h)return;let e=setTimeout(o,8e3),t=setTimeout(o,18e3);return()=>{clearTimeout(e),clearTimeout(t)}},[h,o]);let N=(0,s.useCallback)(({id:e,href:s,className:r,children:n,entry:i,"aria-current":a})=>i?(0,t.jsx)("a",{href:s,onClick:e=>{r1(e)&&(e.preventDefault(),x(i.id))},"aria-current":a,className:r,children:n}):"new-session"===e?(0,t.jsx)(sI.default,{href:"/",onClick:e=>{r1(e)&&(e.preventDefault(),m())},className:r,children:n}):(0,t.jsx)(sI.default,{href:s,"aria-current":a,className:r,children:n}),[x,m]);return(0,t.jsx)(rQ,{activeNav:b?"dashboard":v?"conversations":y?"library":j?"marketplace":k?"models":null,renderLink:N,recentActivity:a,activeSessionId:h,conversationsBadgeCount:u,footer:(0,t.jsx)(rC,{}),isOpen:e.isOpen,onCollapse:e.close,onOrgChanged:w})}function r5({runId:e}){let{navigateToSession:r}=(0,d.useSessionNavigation)(),{sessionId:n,isLoading:i,error:a,refetch:u}=function(e){let t=(0,l.f)(),s=e?async()=>{try{let s=await t.run.get(e),r=s.spec?.target;return r?.case==="sessionId"?r.value:null}catch(e){if((0,o.c)(e)||(0,o.a)(e))return null;throw e}}:null,{data:r,isLoading:n,error:i,refetch:a}=(0,c.f)(s,[e,t],null);return{sessionId:r,isLoading:n,error:i,refetch:a}}(e);return((0,s.useEffect)(()=>{n&&r(n)},[n,r]),i||n)?null:a?(0,t.jsx)(sD,{error:a,onRetry:u}):(0,t.jsx)(sP,{})}function r3({activeSessionId:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,a.f)("h-full",null!=e&&"hidden"),"aria-hidden":null!=e,children:(0,t.jsx)(sk,{})}),null!=e&&(0,t.jsx)(sE,{id:e},e)]})}e.s(["AppShell",0,function({children:e}){let n,o=rA(),l=(0,r.usePathname)(),{activeSessionId:c,isSessionZone:h}=(0,d.useSessionNavigation)(),{activeRunId:f,isExecutionZone:x}=(0,g.f)(),m=(n=(0,s.useSyncExternalStore)(s2,s0,s1),(0,s.useEffect)(()=>{try{localStorage.getItem(s_)||(localStorage.setItem(s_,new Date().toISOString()),sX=!0)}catch{}},[]),{visible:n,dismiss:(0,s.useCallback)(()=>{try{localStorage.setItem(sG,JSON.stringify({campaign:sZ,ts:new Date().toISOString()}))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:sG}))},[])}),p=l.startsWith("/settings"),b=l.startsWith("/invite/")||l.startsWith("/login")||l.startsWith("/chat/")||l.startsWith("/desktop/")||l.startsWith("/connect/")||l.startsWith("/auth/oauth/callback");(0,s.useEffect)(()=>{o.isOpen&&window.innerWidth<1024&&o.close()},[l]);let v=o.isOpen,y=o.close;return((0,s.useEffect)(()=>{function e(e){"Escape"===e.key&&v&&window.innerWidth<1024&&y()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,y]),b)?(0,t.jsx)("div",{className:"bg-background text-foreground min-h-screen",children:(0,t.jsx)("main",{children:e})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sN.T,{}),(0,t.jsxs)("div",{className:"bg-background text-foreground flex h-screen",children:[o.isOpen&&(0,t.jsx)("div",{className:"bg-backdrop fixed inset-0 z-40 backdrop-blur-sm lg:hidden",onClick:o.close,"aria-hidden":"true"}),(0,t.jsx)(u.f,{variant:"ghost",size:"icon-sm",onClick:o.open,"aria-label":"Open sidebar",className:(0,a.f)("fixed top-2 left-2 z-30",o.isOpen&&"hidden"),children:(0,t.jsx)(i,{className:"size-4"})}),(0,t.jsx)("div",{className:(0,a.f)("shrink-0 overflow-hidden","border-sidebar-border border-r","transition-[width] duration-200 ease-in-out motion-reduce:transition-none",o.isOpen?"w-60":"w-0","max-lg:fixed max-lg:inset-y-0 max-lg:left-0 max-lg:z-50 max-lg:shadow-lg"),children:(0,t.jsx)("div",{className:"h-full w-60",children:(0,t.jsx)("div",{className:"h-full animate-in fade-in duration-150",children:p?(0,t.jsx)(rF,{}):(0,t.jsx)(r2,{})},p?"management":"session")})}),(0,t.jsxs)("main",{className:"min-w-0 flex-1 flex flex-col overflow-hidden",children:[m.visible&&(0,t.jsx)(s5,{onDismiss:m.dismiss}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:p?e:x&&f?(0,t.jsx)(r5,{runId:f},f):h?(0,t.jsx)(r3,{activeSessionId:c}):e})]})]})]})}],936636)},693079,e=>{"use strict";let t,s,r,n,i,a;var o=e.i(974265),l=e.i(651023),c=e.i(537097),u=e.i(363178);function d(e){return(0,o.jsx)(u.J,{...e})}var g={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},h=new class{#e=g;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},f="u"<typeof window||"Deno"in globalThis;function x(){}function m(e,t){return"function"==typeof e?e(t):e}function p(e,t){let{type:s="all",exact:r,fetchStatus:n,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==v(a,t.options))return!1}else if(!j(t.queryKey,a))return!1}if("all"!==s){let e=t.isActive();if("active"===s&&!e||"inactive"===s&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!n||n===t.state.fetchStatus)&&(!i||!!i(t))}function b(e,t){let{exact:s,status:r,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(s){if(y(t.options.mutationKey)!==y(i))return!1}else if(!j(t.options.mutationKey,i))return!1}return(!r||t.state.status===r)&&(!n||!!n(t))}function v(e,t){return(t?.queryKeyHashFn||y)(e)}function y(e){return JSON.stringify(e,(e,t)=>N(t)?Object.keys(t).sort().reduce((e,s)=>(e[s]=t[s],e),{}):t)}function j(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(s=>j(e[s],t[s]))}var k=Object.prototype.hasOwnProperty;function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function N(e){if(!C(e))return!1;let t=e.constructor;if(void 0===t)return!0;let s=t.prototype;return!!C(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function S(e,t,s=0){let r=[...e,t];return s&&r.length>s?r.slice(1):r}function O(e,t,s=0){let r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var M=Symbol();function L(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==M?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}var E=(t=[],s=0,r=e=>{e()},n=e=>{e()},i=function(e){setTimeout(e,0)},{batch:e=>{let a;s++;try{a=e()}finally{let e;--s||(e=t,t=[],e.length&&i(()=>{n(()=>{e.forEach(e=>{r(e)})})}))}return a},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a=e=>{s?t.push(e):i(()=>{r(e)})},setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}),I=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},A=new class extends I{#s;#r;#n;constructor(){super(),this.#n=e=>{if(!f&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#n=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#s!==e&&(this.#s=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#s?this.#s:globalThis.document?.visibilityState!=="hidden"}},F=new class extends I{#i=!0;#r;#n;constructor(){super(),this.#n=e=>{if(!f&&window.addEventListener){let t=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#r||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#n=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#i!==e&&(this.#i=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#i}};function T(e){return Math.min(1e3*2**e,3e4)}function D(e){return(e??"online")!=="online"||F.isOnline()}var R=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function P(e){let t,s=!1,r=0,n=function(){let e,t,s=new Promise((s,r)=>{e=s,t=r});function r(e){Object.assign(s,e),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},s.reject=e=>{r({status:"rejected",reason:e}),t(e)},s}(),i=()=>A.isFocused()&&("always"===e.networkMode||F.isOnline())&&e.canRun(),a=()=>D(e.networkMode)&&e.canRun(),o=e=>{"pending"===n.status&&(t?.(),n.resolve(e))},l=e=>{"pending"===n.status&&(t?.(),n.reject(e))},c=()=>new Promise(s=>{t=e=>{("pending"!==n.status||i())&&s(e)},e.onPause?.()}).then(()=>{t=void 0,"pending"===n.status&&e.onContinue?.()}),u=()=>{let t;if("pending"!==n.status)return;let a=0===r?e.initialPromise:void 0;try{t=a??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(o).catch(t=>{if("pending"!==n.status)return;let a=e.retry??3*!f,o=e.retryDelay??T,d="function"==typeof o?o(r,t):o,g=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,t);s||!g?l(t):(r++,e.onFail?.(r,t),new Promise(e=>{h.setTimeout(e,d)}).then(()=>i()?void 0:c()).then(()=>{s?l(t):u()}))})};return{promise:n,status:()=>n.status,cancel:t=>{if("pending"===n.status){let s=new R(t);l(s),e.onCancel?.(s)}},continue:()=>(t?.(),n),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:a,start:()=>(a()?u():c().then(u),n)}}var B=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){var e;this.clearGcTimeout(),"number"==typeof(e=this.gcTime)&&e>=0&&1/0!==e&&(this.#a=h.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(f?1/0:3e5))}clearGcTimeout(){this.#a&&(h.clearTimeout(this.#a),this.#a=void 0)}},q=class extends B{#o;#l;#c;#u;#d;#g;#h;constructor(e){super(),this.#h=!1,this.#g=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#u=e.client,this.#c=this.#u.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#o=$(this.options),this.state=e.state??this.#o,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#g,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=$(this.options);void 0!==e.data&&(this.setState(z(e.data,e.dataUpdatedAt)),this.#o=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(e,t){var s,r;let n=(s=this.state.data,"function"==typeof(r=this.options).structuralSharing?r.structuralSharing(s,e):!1!==r.structuralSharing?function e(t,s,r=0){if(t===s)return t;if(r>500)return s;let n=w(t)&&w(s);if(!n&&!(N(t)&&N(s)))return s;let i=(n?t:Object.keys(t)).length,a=n?s:Object.keys(s),o=a.length,l=n?Array(o):{},c=0;for(let u=0;u<o;u++){let o=n?u:a[u],d=t[o],g=s[o];if(d===g){l[o]=d,(n?u<i:k.call(t,o))&&c++;continue}if(null===d||null===g||"object"!=typeof d||"object"!=typeof g){l[o]=g;continue}let h=e(d,g,r+1);l[o]=h,h===d&&c++}return i===o&&c===i?t:l}(s,e):e);return this.#f({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(x).catch(x):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#o)}isActive(){return this.observers.some(e=>{var t;return!1!==(t=e.options.enabled,"function"==typeof t?t(this):t)})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===M||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===m(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!Math.max(this.state.dataUpdatedAt+(e||0)-Date.now(),0))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#h?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,t){let s;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,r.signal)})},i=()=>{let e,s=L(this.options,t),r=(n(e={client:this.#u,queryKey:this.queryKey,meta:this.meta}),e);return(this.#h=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},a=(n(s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:i}),s);this.options.behavior?.onFetch(a,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#f({type:"fetch",meta:a.fetchOptions?.meta}),this.#d=P({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof R&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#c.config.onSuccess?.(e,this),this.#c.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof R){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#c.config.onError?.(e,this),this.#c.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){let t=t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":var s;return{...t,...(s=t.data,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:D(this.options.networkMode)?"fetching":"paused",...void 0===s&&{error:null,status:"pending"}}),fetchMeta:e.meta??null};case"success":let r={...t,...z(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":let n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),E.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:e})})}};function z(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function $(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,s=void 0!==t,r=s?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var W=class extends I{constructor(e={}){super(),this.config=e,this.#x=new Map}#x;build(e,t,s){let r=t.queryKey,n=t.queryHash??v(r,t),i=this.get(n);return i||(i=new q({client:e,queryKey:r,queryHash:n,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#x.has(e.queryHash)||(this.#x.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#x.get(e.queryHash);t&&(e.destroy(),t===e&&this.#x.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){E.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#x.get(e)}getAll(){return[...this.#x.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>p(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>p(e,t)):t}notify(e){E.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){E.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){E.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},U=class extends B{#u;#m;#p;#d;constructor(e){super(),this.#u=e.client,this.mutationId=e.mutationId,this.#p=e.mutationCache,this.#m=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#m.includes(e)||(this.#m.push(e),this.clearGcTimeout(),this.#p.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#m=this.#m.filter(t=>t!==e),this.scheduleGc(),this.#p.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#m.length||("pending"===this.state.status?this.scheduleGc():this.#p.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#f({type:"continue"})},s={client:this.#u,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=P({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#p.canRun(this)});let r="pending"===this.state.status,n=!this.#d.canStart();try{if(r)t();else{this.#f({type:"pending",variables:e,isPaused:n}),this.#p.config.onMutate&&await this.#p.config.onMutate(e,this,s);let t=await this.options.onMutate?.(e,s);t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:n})}let i=await this.#d.start();return await this.#p.config.onSuccess?.(i,e,this.state.context,this,s),await this.options.onSuccess?.(i,e,this.state.context,s),await this.#p.config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,e,this.state.context,s),this.#f({type:"success",data:i}),i}catch(t){try{await this.#p.config.onError?.(t,e,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,s)}catch(e){Promise.reject(e)}try{await this.#p.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,s)}catch(e){Promise.reject(e)}throw this.#f({type:"error",error:t}),t}finally{this.#p.runNext(this)}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),E.batch(()=>{this.#m.forEach(t=>{t.onMutationUpdate(e)}),this.#p.notify({mutation:this,type:"updated",action:e})})}},H=class extends I{constructor(e={}){super(),this.config=e,this.#b=new Set,this.#v=new Map,this.#y=0}#b;#v;#y;build(e,t,s){let r=new U({client:e,mutationCache:this,mutationId:++this.#y,options:e.defaultMutationOptions(t),state:s});return this.add(r),r}add(e){this.#b.add(e);let t=K(e);if("string"==typeof t){let s=this.#v.get(t);s?s.push(e):this.#v.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#b.delete(e)){let t=K(e);if("string"==typeof t){let s=this.#v.get(t);if(s)if(s.length>1){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}else s[0]===e&&this.#v.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=K(e);if("string"!=typeof t)return!0;{let s=this.#v.get(t),r=s?.find(e=>"pending"===e.state.status);return!r||r===e}}runNext(e){let t=K(e);if("string"!=typeof t)return Promise.resolve();{let s=this.#v.get(t)?.find(t=>t!==e&&t.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){E.batch(()=>{this.#b.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#b.clear(),this.#v.clear()})}getAll(){return Array.from(this.#b)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>b(t,e))}findAll(e={}){return this.getAll().filter(t=>b(e,t))}notify(e){E.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return E.batch(()=>Promise.all(e.map(e=>e.continue().catch(x))))}};function K(e){return e.options.scope?.id}function V(e){return{onFetch:(t,s)=>{let r=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[],o={pages:[],pageParams:[]},l=0,c=async()=>{let s=!1,c=L(t.options,t.fetchOptions),u=async(e,r,n)=>{if(s)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);let i=(()=>{var e,i;let a,o,l={client:t.client,queryKey:t.queryKey,pageParam:r,direction:n?"backward":"forward",meta:t.options.meta};return e=()=>t.signal,i=()=>s=!0,o=!1,Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(a??=e(),o||(o=!0,a.aborted?i():a.addEventListener("abort",i,{once:!0})),a)}),l})(),a=await c(i),{maxPages:o}=t.options,l=n?O:S;return{pages:l(e.pages,a,o),pageParams:l(e.pageParams,r,o)}};if(n&&i.length){let e="backward"===n,t={pages:i,pageParams:a},s=(e?function(e,{pages:t,pageParams:s}){return t.length>0?e.getPreviousPageParam?.(t[0],t,s[0],s):void 0}:Q)(r,t);o=await u(t,s,e)}else{let t=e??i.length;do{let e=0===l?a[0]??r.initialPageParam:Q(r,o);if(l>0&&null==e)break;o=await u(o,e),l++}while(l<t)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s):t.fetchFn=c}}}function Q(e,{pages:t,pageParams:s}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}var _=class{#j;#p;#g;#k;#w;#N;#C;#S;constructor(e={}){this.#j=e.queryCache||new W,this.#p=e.mutationCache||new H,this.#g=e.defaultOptions||{},this.#k=new Map,this.#w=new Map,this.#N=0}mount(){this.#N++,1===this.#N&&(this.#C=A.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#j.onFocus())}),this.#S=F.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#j.onOnline())}))}unmount(){this.#N--,0===this.#N&&(this.#C?.(),this.#C=void 0,this.#S?.(),this.#S=void 0)}isFetching(e){return this.#j.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#p.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#j.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),s=this.#j.build(this,t),r=s.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(m(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#j.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,s){let r=this.defaultQueryOptions({queryKey:e}),n=this.#j.get(r.queryHash),i=n?.state.data,a="function"==typeof t?t(i):t;if(void 0!==a)return this.#j.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(e,t,s){return E.batch(()=>this.#j.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,s)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#j.get(t.queryHash)?.state}removeQueries(e){let t=this.#j;E.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let s=this.#j;return E.batch(()=>(s.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let s={revert:!0,...t};return Promise.all(E.batch(()=>this.#j.findAll(e).map(e=>e.cancel(s)))).then(x).catch(x)}invalidateQueries(e,t={}){return E.batch(()=>(this.#j.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let s={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(E.batch(()=>this.#j.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,s);return s.throwOnError||(t=t.catch(x)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(x)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let s=this.#j.build(this,t);return s.isStaleByTime(m(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(x).catch(x)}fetchInfiniteQuery(e){return e.behavior=V(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(x).catch(x)}ensureInfiniteQueryData(e){return e.behavior=V(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return F.isOnline()?this.#p.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#j}getMutationCache(){return this.#p}getDefaultOptions(){return this.#g}setDefaultOptions(e){this.#g=e}setQueryDefaults(e,t){this.#k.set(y(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#k.values()],s={};return t.forEach(t=>{j(e,t.queryKey)&&Object.assign(s,t.defaultOptions)}),s}setMutationDefaults(e,t){this.#w.set(y(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#w.values()],s={};return t.forEach(t=>{j(e,t.mutationKey)&&Object.assign(s,t.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#g.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=v(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===M&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#g.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#j.clear(),this.#p.clear()}},G=l.createContext(void 0),Y=({client:e,children:t})=>(l.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,o.jsx)(G.Provider,{value:e,children:t})),J=e.i(531278),Z=e.i(610595),X=e.i(381715),ee=e.i(297629);e.i(67407);var et=e.i(282155),es=e.i(671010),er=e.i(272012),en=e.i(163308),ei=e.i(800692),ea=e.i(472402),eo=e.i(388487);function el({children:e}){let{accessToken:t,logout:s}=(0,ei.f)(),{resolvedTheme:r}=(0,u.i)(),n=(0,l.useCallback)(()=>t,[t]),i=(0,l.useCallback)(()=>s(),[s]),a=(0,l.useMemo)(()=>new er.f({baseUrl:(0,ea.T)(),getAccessToken:n,onUnauthenticated:i}),[n,i]),{mode:c}=function(e){let[t,s]=(0,l.useState)(()=>({mode:function(){try{let e=new URL((0,ea.T)()).hostname;if("localhost"===e||"127.0.0.1"===e||"::1"===e)return"local"}catch{return"local"}return"cloud"}(),resolved:!1})),r=(0,l.useMemo)(()=>e,[e]);return(0,l.useEffect)(()=>{if(!r)return;let e=!1;return r.platform.getServerInfo().then(t=>{e||s({mode:t.deploymentMode,resolved:!0})},()=>{e||s(e=>({mode:e.mode,resolved:!0}))}),()=>{e=!0}},[r]),t}(a);return(0,o.jsx)(en.f,{client:a,deploymentMode:c,colorMode:"dark"===r?"dark":"light",loadMermaid:eo.f,children:e})}var ec=e.i(846696),eu=e.i(444868);function ed(e){let t=(0,eu.w)();return(0,o.jsx)(ec.K,{theme:t,position:"top-right",richColors:!0,className:"toaster stg:group",toastOptions:{classNames:{toast:"stg:group toast stg:group-[.toaster]:bg-background stg:group-[.toaster]:text-foreground stg:group-[.toaster]:border-border stg:group-[.toaster]:shadow-lg",description:"stg:group-[.toast]:text-muted-foreground",actionButton:"stg:group-[.toast]:bg-primary stg:group-[.toast]:text-primary-foreground",cancelButton:"stg:group-[.toast]:bg-muted stg:group-[.toast]:text-muted-foreground"}},...e})}var eg=e.i(63209),eh=e.i(16715),ef=e.i(607486),ex=e.i(292270),em=e.i(379185);let ep=["/invite/"];function eb({children:e}){let t=(0,c.usePathname)(),{state:s,retry:r,refresh:n}=function(e){let{isBypassed:t}=e,{orgs:s,isLoading:r,error:n,retry:i,refresh:a}=(0,ee.S)();return{state:t?{status:"bypassed"}:r?{status:"loading"}:n?{status:"error",message:n}:0===s.length?{status:"no-orgs"}:{status:"ready"},retry:i,refresh:a}}({isBypassed:ep.some(e=>t.startsWith(e))});switch(s.status){case"bypassed":case"ready":return(0,o.jsx)(o.Fragment,{children:e});case"loading":return(0,o.jsx)(ey,{});case"error":return(0,o.jsx)(ej,{message:s.message,onRetry:r});case"no-orgs":return(0,o.jsx)(ek,{onRefresh:n})}}function ev(){let{user:e,logout:t}=(0,ei.f)();if(!e)return null;let s=(e.name??e.email).charAt(0).toUpperCase();return(0,o.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-3 p-4",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"bg-muted text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,o.jsx)("span",{className:"text-xs font-medium",children:s})}),(0,o.jsx)("span",{className:"text-muted-foreground text-sm",children:e.email})]}),(0,o.jsxs)("button",{onClick:t,className:"text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1.5 text-sm transition-colors",children:[(0,o.jsx)(ex.f,{className:"size-3.5"}),"Sign out"]})]})}function ey(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(J.f,{className:"text-muted-foreground size-8 animate-spin"})})}function ej({message:e,onRetry:t}){return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center gap-4 p-8",children:[(0,o.jsx)(ev,{}),(0,o.jsx)(eg.f,{className:"text-destructive size-8"}),(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Failed to load organizations"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:e}),(0,o.jsxs)("button",{onClick:t,className:"bg-primary text-primary-foreground hover:bg-primary-hover inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium",children:[(0,o.jsx)(eh.f,{className:"size-3"}),"Try again"]})]})}function ek({onRefresh:e}){let t=(0,l.useCallback)(t=>{e(t.metadata?.id)},[e]);return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center p-8",children:[(0,o.jsx)(ev,{}),(0,o.jsxs)("div",{className:"w-full max-w-sm space-y-6",children:[(0,o.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,o.jsx)("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:(0,o.jsx)(ef.f,{className:"text-muted-foreground size-6"})}),(0,o.jsx)("h1",{className:"text-foreground text-lg font-semibold",children:"Welcome to Stigmer"}),(0,o.jsx)("p",{className:"text-muted-foreground text-sm",children:"Create an organization to get started. Organizations are the top-level context that owns your agents, vaults, and resources. To join an existing one instead, ask one of its admins to invite you."}),(0,o.jsx)("p",{className:"text-muted-foreground text-sm",children:"Next, you connect a model provider, such as Anthropic or OpenAI, so your agents can answer."})]}),(0,o.jsx)(em.f,{onCreated:t})]})]})}var ew=e.i(910304);async function eN(e,t){try{return{account:await e.identityAccount.whoAmI(),created:!1}}catch(e){if(!(0,ew.c)(e))throw e}return t?.onProvisioning?.(),{account:await e.identityAccount.provisionMyAccount(),created:!0}}var eC=e.i(255817),eS=e.i(781836);let eO=Object.freeze({status:"ready",account:null});var eM=e.i(707125);function eL({children:e}){let{state:t,retry:s}=function(e){let{isEnabled:t}=e,s=(0,eC.f)(),[r,n]=(0,l.useState)(t?{status:"checking"}:eO),i=(0,l.useRef)(0),a=(0,l.useCallback)(async()=>{let e=++i.current;n({status:"checking"});try{let{account:t}=await eN(s,{onProvisioning:()=>{e===i.current&&n({status:"provisioning"})}});if(e!==i.current)return;n({status:"ready",account:t})}catch(t){if(e!==i.current)return;n({status:"error",message:(0,eS.f)(t).message})}},[s]);return(0,l.useEffect)(()=>{t?a():n(eO)},[t,a]),{state:r,retry:(0,l.useCallback)(()=>{t&&a()},[t,a])}}({isEnabled:"oidc"===(0,eM.f)().authMode});switch(t.status){case"ready":return(0,o.jsx)(o.Fragment,{children:e});case"checking":return(0,o.jsx)(eI,{});case"provisioning":return(0,o.jsx)(eA,{});case"error":return(0,o.jsx)(eF,{message:t.message,onRetry:s})}}function eE(){let{user:e,logout:t}=(0,ei.f)();if(!e)return null;let s=(e.name??e.email).charAt(0).toUpperCase();return(0,o.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-3 p-4",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("div",{className:"bg-muted text-muted-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,o.jsx)("span",{className:"text-xs font-medium",children:s})}),(0,o.jsx)("span",{className:"text-muted-foreground text-sm",children:e.email})]}),(0,o.jsxs)("button",{onClick:t,className:"text-muted-foreground hover:text-foreground inline-flex cursor-pointer items-center gap-1.5 text-sm transition-colors",children:[(0,o.jsx)(ex.f,{className:"size-3.5"}),"Sign out"]})]})}function eI(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(J.f,{className:"text-muted-foreground size-8 animate-spin"})})}function eA(){let{user:e}=(0,ei.f)(),t=e?.name??e?.email;return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center p-8",children:[(0,o.jsx)(eE,{}),(0,o.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[e&&(0,o.jsx)("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:(0,o.jsx)("span",{className:"text-muted-foreground text-lg font-medium",children:(t??"?").charAt(0).toUpperCase()})}),(0,o.jsxs)("div",{className:"space-y-1.5",children:[(0,o.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:t?`Welcome, ${t}!`:"Welcome!"}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:"Setting up your account…"})]}),(0,o.jsx)(J.f,{className:"text-muted-foreground size-5 animate-spin"})]})]})}function eF({message:e,onRetry:t}){return(0,o.jsxs)("div",{className:"relative flex min-h-screen flex-col items-center justify-center gap-4 p-8",children:[(0,o.jsx)(eE,{}),(0,o.jsx)(eg.f,{className:"text-destructive size-8"}),(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Failed to set up your account"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:e}),(0,o.jsxs)("button",{onClick:t,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary-hover",children:[(0,o.jsx)(eh.f,{className:"size-3"}),"Try again"]})]})}let eT=["/login","/invite/","/desktop/","/connect/","/auth/oauth/callback"],eD=["/chat/"],eR=new _({defaultOptions:{queries:{staleTime:3e4,retry:(e,t)=>!!(0,Z.f)(t)&&e<1,refetchOnWindowFocus:!0},mutations:{retry:!1}}});function eP({children:e}){let t=(0,c.usePathname)(),s=eT.some(e=>t.startsWith(e)),r=eD.some(e=>t.startsWith(e));return s?(0,o.jsx)(o.Fragment,{children:e}):r?(0,o.jsx)(et.f,{children:e}):(0,o.jsx)(et.f,{children:(0,o.jsx)(l.Suspense,{fallback:(0,o.jsx)(eq,{}),children:(0,o.jsx)(es.f,{children:(0,o.jsx)(Y,{client:eR,children:(0,o.jsx)(el,{children:(0,o.jsx)(eL,{children:(0,o.jsx)(X.t,{children:(0,o.jsx)(ee.N,{children:(0,o.jsxs)(eb,{children:[e,(0,o.jsx)(ed,{})]})})})})})})})})})}function eB({children:e}){let[t,s]=(0,l.useState)(!1),[r,n]=(0,l.useState)(null);return((0,l.useEffect)(()=>{(0,eM.h)().then(()=>s(!0)).catch(e=>{n(e instanceof Error?e.message:"Failed to load configuration")})},[]),r)?(0,o.jsxs)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3 p-8",children:[(0,o.jsx)("p",{className:"text-destructive text-sm font-medium",children:"Configuration Error"}),(0,o.jsx)("p",{className:"text-muted-foreground max-w-md text-center text-sm",children:r})]}):t?(0,o.jsx)(o.Fragment,{children:e}):(0,o.jsx)(eq,{})}function eq(){return(0,o.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center gap-3",children:(0,o.jsx)(J.f,{className:"text-muted-foreground size-8 animate-spin"})})}e.s(["Providers",0,function({children:e}){return(0,o.jsx)(eB,{children:(0,o.jsx)(d,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,o.jsx)(eP,{children:e})})})}],693079)},379185,292270,e=>{"use strict";var t=e.i(974265),s=e.i(651023),r=e.i(891287),n=e.i(893976),i=e.i(610595),a=e.i(421415),o=e.i(255817),l=e.i(781836),c=e.i(367539),u=e.i(891914),d=e.i(379410);e.s(["f",0,function({onCreated:e,onCancel:g,className:h}){let f=(0,s.useId)(),{create:x,isCreating:m,error:p,clearError:b}=function(){let e=(0,o.f)(),[t,r]=(0,s.useState)(!1),[n,i]=(0,s.useState)(null),a=(0,s.useCallback)(()=>i(null),[]);return{create:(0,s.useCallback)(async t=>{r(!0),i(null);try{return await e.organization.create(t)}catch(e){throw i((0,l.f)(e)),e}finally{r(!1)}},[e]),isCreating:t,error:n,clearError:a}}(),[v,y]=(0,s.useState)(""),[j,k]=(0,s.useState)(""),[w,N]=(0,s.useState)(""),C=(0,s.useRef)(!1),S=v.trim(),O=j.length>0||S.length>0?(0,u.N)(a.h,(0,r.f)(a.h,{...j.length>0&&{slug:j},...S.length>0&&{name:S}})):[],M=j.length>0?(0,u.u)(O,"slug"):null,L=S.length>0?(0,u.u)(O,"name"):null,E=""!==S&&j.length>0&&null===M&&null===L&&!m,I=(0,s.useCallback)(e=>{y(e),C.current||k((0,c.f)(e.trim()))},[]),A=(0,s.useCallback)(e=>{C.current=!0,k(e)},[]),F=(0,s.useCallback)(async t=>{if(t.preventDefault(),E){b();try{let t=await x({name:S,slug:j,description:w.trim()||void 0});e?.(t)}catch{}}},[E,S,j,w,x,b,e]);return(0,t.jsxs)("form",{onSubmit:F,className:(0,n.f)("stg:space-y-3",h),children:[(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsx)("label",{htmlFor:`${f}-name`,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Name"}),(0,t.jsx)("input",{id:`${f}-name`,type:"text",value:v,onChange:e=>I(e.target.value),placeholder:"e.g. Acme Corp",disabled:m,autoFocus:!0,required:!0,maxLength:63,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",L?"stg:border-destructive":"stg:border-input")}),L?(0,t.jsx)("p",{className:"stg:text-2xs stg:text-destructive",role:"alert",children:L}):(0,t.jsx)("p",{className:"stg:text-2xs stg:text-muted-foreground",children:"A human-readable display name for the organization."})]}),(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsx)("label",{htmlFor:`${f}-slug`,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Slug"}),(0,t.jsx)("input",{id:`${f}-slug`,type:"text",value:j,onChange:e=>A(e.target.value),placeholder:"e.g. acme-corp",disabled:m,required:!0,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground stg:font-mono","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",M?"stg:border-destructive":"stg:border-input")}),M?(0,t.jsx)("p",{className:"stg:text-2xs stg:text-destructive",role:"alert",children:M}):(0,t.jsx)("p",{className:"stg:text-2xs stg:text-muted-foreground",children:"URL-friendly identifier used in resource references. 2–63 characters: lowercase letters, numbers, and hyphens."})]}),(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsxs)("label",{htmlFor:`${f}-desc`,className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:["Description"," ",(0,t.jsx)("span",{className:"stg:text-muted-foreground-subtle",children:"(optional)"})]}),(0,t.jsx)("input",{id:`${f}-desc`,type:"text",value:w,onChange:e=>N(e.target.value),placeholder:"What is this organization for?",disabled:m,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50")})]})]}),p&&(0,t.jsx)("p",{className:"stg:text-destructive stg:text-2xs",role:"alert",children:(0,i.g)(p)}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsxs)("button",{type:"submit",disabled:!E,className:(0,n.f)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:[m&&(0,t.jsx)(d.f,{size:12}),"Create organization"]}),g&&(0,t.jsx)("button",{type:"button",onClick:g,disabled:m,className:(0,n.f)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs","stg:text-muted-foreground stg:hover:text-foreground stg:hover:bg-accent-hover","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Cancel"})]})]})}],379185);let g=(0,e.i(475254).f)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["f",0,g],292270)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,443214,e=>{"use strict";var t=e.i(762592);e.i(539927),e.S([t,"createInfoServices,n"],443214)}]);
@@ -0,0 +1,28 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,155732,e=>{"use strict";var t=e.i(974265),s=e.i(651023),r=e.i(537097),n=e.i(893976),a=e.i(869803);function i({steps:e,currentStepIndex:s,onStepClick:r,className:o}){return(0,t.jsx)("nav",{"aria-label":"Wizard progress",className:(0,n.f)("stg:flex stg:flex-col stg:gap-1",o),children:(0,t.jsx)("ol",{className:(0,n.f)(a.J,"stg:flex stg:flex-col stg:gap-1"),role:"list",children:e.map((a,i)=>{var o,g;let d=(o=i)<(g=s)?"completed":o===g?"active":"pending",c="completed"===d&&null!=r,u=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(l,{index:i,state:d}),(0,t.jsx)("span",{className:(0,n.f)("stg:text-sm stg:font-medium stg:transition-colors","active"===d&&"stg:text-foreground","completed"===d&&"stg:text-foreground","pending"===d&&"stg:text-muted-foreground"),children:a.label})]});return(0,t.jsxs)("li",{children:[c?(0,t.jsx)("button",{type:"button",onClick:()=>r(i),className:(0,n.f)("stg:w-full stg:rounded-md stg:px-2 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),"aria-label":`Go back to step ${i+1}: ${a.label}`,"aria-current":void 0,children:u}):(0,t.jsx)("div",{className:"stg:px-2 stg:py-2","aria-current":"active"===d?"step":void 0,children:u}),i<e.length-1&&(0,t.jsx)("div",{className:"stg:ml-[18px] stg:h-4 stg:w-px stg:bg-border","aria-hidden":"true"})]},a.id)})})})}function l({index:e,state:s}){return(0,t.jsx)("div",{className:(0,n.f)("stg:flex stg:size-7 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-full stg:text-xs stg:font-medium stg:transition-colors","completed"===s&&"stg:bg-primary stg:text-primary-foreground","active"===s&&"stg:border-2 stg:border-primary stg:text-primary","pending"===s&&"stg:border stg:border-border stg:text-muted-foreground"),"aria-hidden":"true",children:"completed"===s?(0,t.jsx)(o,{className:"stg:size-3.5"}):(0,t.jsx)("span",{children:e+1})})}function o({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m3 8.5 3.5 3.5 6.5-8"})})}var g=e.i(379410);function d({showBack:e,nextLabel:s,nextDisabled:r,isSubmitting:a,onBack:i,onNext:l,onCancel:o,className:x}){return(0,t.jsxs)("div",{className:(0,n.f)("stg:flex stg:items-center stg:justify-between stg:border-t stg:border-border stg:px-6 stg:py-4",x),children:[(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:gap-2",children:o&&(0,t.jsx)("button",{type:"button",onClick:o,disabled:a,className:(0,n.f)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm","stg:text-muted-foreground stg:transition-colors","stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Cancel"})}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[e&&(0,t.jsxs)("button",{type:"button",onClick:i,disabled:a,className:(0,n.f)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium stg:text-foreground stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:[(0,t.jsx)(c,{className:"stg:size-3.5"}),"Back"]}),(0,t.jsxs)("button",{type:"button",onClick:l,disabled:r||a,"data-cursor-target":"wizard-next",className:(0,n.f)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:bg-primary stg:px-4 stg:py-1.5 stg:text-sm stg:font-medium stg:text-primary-foreground stg:transition-colors","stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:[a&&(0,t.jsx)(g.f,{size:14}),s,!a&&(0,t.jsx)(u,{className:"stg:size-3.5"})]})]})]})}function c({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 3 5 8l5 5"})})}function u({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function x({steps:e,currentStepIndex:s,children:r,submitLabel:a,isSubmitting:l,canGoNext:o=!0,canGoBack:g=!1,onNext:c,onBack:u,onGoToStep:m,onCancel:h,className:f}){let b=s===e.length-1;return(0,t.jsxs)("div",{className:(0,n.f)("stg:flex stg:min-h-0 stg:flex-col stg:overflow-hidden stg:rounded-lg stg:border stg:border-border stg:bg-background",f),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:border-b stg:border-border stg:px-4 stg:py-3 stg:sm:hidden",children:[(0,t.jsx)(p,{current:s+1,total:e.length}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e[s]?.label})]}),(0,t.jsxs)("div",{className:"stg:flex stg:min-h-0 stg:flex-1",children:[(0,t.jsx)("aside",{className:"stg:hidden stg:w-52 stg:shrink-0 stg:border-r stg:border-border stg:bg-muted-faint stg:px-3 stg:py-6 stg:sm:block",children:(0,t.jsx)(i,{steps:e,currentStepIndex:s,onStepClick:m})}),(0,t.jsx)("main",{className:"stg:flex-1 stg:overflow-y-auto stg:px-6 stg:py-6 stg:sm:px-8",children:r})]}),(0,t.jsx)(d,{showBack:g,nextLabel:b?a:"Next",nextDisabled:!o,isSubmitting:l,onBack:u,onNext:c,onCancel:h})]})}function p({current:e,total:s}){return(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-2 stg:py-0.5 stg:text-2xs stg:font-semibold stg:text-primary-foreground",children:[e,"/",s]})}var m=e.i(255817),h=e.i(781836),f=e.i(164358),b=e.i(311015);function v({className:e}){return(0,t.jsx)(b.f,{variant:"permission",title:"Only admins can create agents here",description:"Ask an admin to turn on 'Members can create agents'.",className:e})}var j=e.i(367539);let y=/^[a-z0-9]+(-[a-z0-9]+)*$/;function k({data:e,updateData:r,validationError:a}){let i=(0,s.useId)(),l=(0,s.useCallback)(t=>{e.slugTouched?r({name:t}):r({name:t,slug:(0,j.f)(t)})},[e.slugTouched,r]),o=(0,s.useCallback)(e=>{r({slug:e,slugTouched:!0})},[r]),g=e.slug.length>0&&!y.test(e.slug)?"Slug must be lowercase letters, numbers, and hyphens only":null;return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"stg:text-lg stg:font-semibold stg:text-foreground",children:"Identity & Instructions"}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-sm stg:text-muted-foreground",children:"Define what this agent is and what it does."})]}),a&&(0,t.jsx)("p",{className:"stg:text-sm stg:text-destructive",role:"alert",children:a}),(0,t.jsxs)("div",{className:"stg:grid stg:gap-4 stg:sm:grid-cols-2",children:[(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsxs)("label",{htmlFor:`${i}-name`,className:"stg:text-sm stg:font-medium stg:text-foreground",children:["Name ",(0,t.jsx)("span",{className:"stg:text-destructive",children:"*"})]}),(0,t.jsx)("input",{id:`${i}-name`,type:"text",value:e.name,onChange:e=>l(e.target.value),placeholder:"e.g. PR Review Bot",autoFocus:!0,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-3 stg:py-2 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")})]}),(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:`${i}-slug`,className:"stg:text-sm stg:font-medium stg:text-foreground",children:"Slug"}),(0,t.jsx)("input",{id:`${i}-slug`,type:"text",value:e.slug,onChange:e=>o(e.target.value),placeholder:"auto-generated",className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:px-3 stg:py-2 stg:font-mono stg:text-sm stg:text-foreground",g?"stg:border-destructive stg:bg-input-bg":"stg:border-input stg:bg-input-bg","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")}),g&&(0,t.jsx)("p",{className:"stg:text-xs stg:text-destructive",children:g}),!g&&e.slug&&(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Referenced as ",(0,t.jsx)("code",{className:"stg:font-mono",children:e.slug})]})]})]}),(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:`${i}-description`,className:"stg:text-sm stg:font-medium stg:text-foreground",children:"Description"}),(0,t.jsx)("input",{id:`${i}-description`,type:"text",value:e.description,onChange:e=>r({description:e.target.value}),placeholder:"A brief description of what this agent does",maxLength:200,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-3 stg:py-2 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")})]}),(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:`${i}-icon`,className:"stg:text-sm stg:font-medium stg:text-foreground",children:"Icon URL"}),(0,t.jsx)("input",{id:`${i}-icon`,type:"url",value:e.iconUrl,onChange:e=>r({iconUrl:e.target.value}),placeholder:"https://example.com/icon.png",className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-3 stg:py-2 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")})]}),(0,t.jsxs)("div",{className:"stg:space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:`${i}-instructions`,className:"stg:text-sm stg:font-medium stg:text-foreground",children:"Instructions"}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"The system prompt that defines this agent's behavior."}),(0,t.jsx)("textarea",{id:`${i}-instructions`,value:e.instructions,onChange:e=>r({instructions:e.target.value}),placeholder:"You are a helpful assistant that...",rows:12,className:(0,n.f)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-3 stg:py-2 stg:font-mono stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")})]})]})}var N=e.i(513642),w=e.i(962838),C=e.i(841358),S=e.i(773624);function A({org:e,data:r,updateData:n}){let[a,i]=(0,s.useState)(()=>{let e=new Set;return r.plugins.length>0&&e.add("plugins"),r.mcpServers.length>0&&e.add("mcp-servers"),r.skillRefs.length>0&&e.add("skills"),r.env.length>0&&e.add("env"),e}),l=(0,s.useCallback)(e=>{i(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),o=(0,s.useCallback)(e=>{n({plugins:e})},[n]),g=(0,w.f)(e||null).allowed,d=(0,s.useMemo)(()=>r.mcpServers.map(e=>({name:e.name??"",url:e.url??"",headers:e.headers??{}})),[r.mcpServers]),c=(0,s.useCallback)(e=>(n({mcpServers:e.map(e=>({name:e.name,url:e.url,headers:{...e.headers}}))}),!0),[n]),u=(0,s.useCallback)(e=>{n({skillRefs:e})},[n]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"stg:text-lg stg:font-semibold stg:text-foreground",children:"Capabilities"}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-sm stg:text-muted-foreground",children:"Configure what tools, skills, and secrets this agent can use. All sections are optional."})]}),(0,t.jsx)(L,{id:"plugins",title:"Plugins",subtitle:"Tools, skills and hooks the agent uses, each plugin whole",count:r.plugins.length,expanded:a.has("plugins"),onToggle:l,children:(0,t.jsx)(N.f,{org:e,value:r.plugins,onChange:o})}),g&&(0,t.jsx)(L,{id:"mcp-servers",title:"MCP servers",subtitle:"Servers the agent dials itself, by name and address",count:r.mcpServers.length,expanded:a.has("mcp-servers"),onToggle:l,children:(0,t.jsx)("div",{className:"stg:-mx-4 stg:-my-4",children:(0,t.jsx)(S.f,{servers:d,editing:!0,onChange:c,emptyText:"No MCP servers. Every conversation with this agent dials the servers added here, beside its plugins' servers."})})}),(0,t.jsx)(L,{id:"skills",title:"Skills",subtitle:"Knowledge and capabilities to attach",count:r.skillRefs.length,expanded:a.has("skills"),onToggle:l,children:(0,t.jsx)(C.f,{org:e,value:r.skillRefs,onChange:u})}),(0,t.jsx)(L,{id:"env",title:"Environment Variables",subtitle:"Secrets and config the agent declares",count:r.env.length,expanded:a.has("env"),onToggle:l,children:(0,t.jsx)(I,{entries:r.env,onChange:e=>n({env:e})})})]})}function L({id:e,title:r,subtitle:a,count:i,expanded:l,onToggle:o,children:g}){let d=(0,s.useId)();return(0,t.jsxs)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(e),"aria-expanded":l,"aria-controls":d,className:(0,n.f)("stg:flex stg:w-full stg:items-center stg:justify-between stg:px-4 stg:py-3 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:r}),i>0&&(0,t.jsx)("span",{className:"stg:ml-2 stg:inline-flex stg:items-center stg:justify-center stg:rounded-full stg:bg-primary stg:px-1.5 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-primary-foreground",children:i}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:a})]}),(0,t.jsx)(T,{className:(0,n.f)("stg:size-4 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",l&&"stg:rotate-180")})]}),l&&(0,t.jsx)("div",{id:d,className:"stg:border-t stg:border-border stg:px-4 stg:py-4",children:g})]})}function I({entries:e,onChange:r}){let a=(0,s.useCallback)(()=>{r([...e,{key:"",description:"",isSecret:!0,optional:!1}])},[e,r]),i=(0,s.useCallback)((t,s)=>{r(e.map((e,r)=>r===t?{...e,...s}:e))},[e,r]),l=(0,s.useCallback)(t=>{r(e.filter((e,s)=>s!==t))},[e,r]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3",children:[e.map((e,s)=>(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2 stg:rounded-md stg:border stg:border-border stg:p-3",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-2",children:[(0,t.jsxs)("div",{className:"stg:flex-1 stg:space-y-1.5",children:[(0,t.jsx)("input",{type:"text",value:e.key,onChange:e=>i(s,{key:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")}),placeholder:"VARIABLE_NAME","aria-label":`Environment variable name ${s+1}`,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-2.5 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring")}),(0,t.jsx)("input",{type:"text",value:e.description,onChange:e=>i(s,{description:e.target.value}),placeholder:"Description (optional)","aria-label":`Description for ${e.key||`variable ${s+1}`}`,className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring")})]}),(0,t.jsx)("button",{type:"button",onClick:()=>l(s),"aria-label":`Remove ${e.key||"variable"}`,className:(0,n.f)("stg:mt-1 stg:rounded stg:p-1 stg:text-muted-foreground stg:transition-colors","stg:hover:bg-accent-hover stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(E,{className:"stg:size-3.5"})})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-4",children:[(0,t.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.isSecret,onChange:e=>i(s,{isSecret:e.target.checked}),className:"stg:size-3.5 stg:rounded stg:border-input"}),"Secret"]}),(0,t.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.optional,onChange:e=>i(s,{optional:e.target.checked}),className:"stg:size-3.5 stg:rounded stg:border-input"}),"Optional"]})]})]},s)),(0,t.jsxs)("button",{type:"button",onClick:a,className:(0,n.f)("stg:inline-flex stg:w-fit stg:items-center stg:gap-1.5 stg:rounded-md stg:border stg:border-dashed stg:border-input stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:text-muted-foreground stg:transition-colors","stg:hover:border-border stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:[(0,t.jsx)(R,{className:"stg:size-3"}),"Add variable"]})]})}function T({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 6 4 4 4-4"})})}function R({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}function E({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8"})})}var M=e.i(992999),$=e.i(610595),z=e.i(590745),B=e.i(42592);function D({org:e,data:r,isCreating:n,error:a}){var i;let l=(0,B.b)(),o=(0,s.useMemo)(()=>P(e,r),[e,r]),g=(0,s.useMemo)(()=>(0,z.K)((0,M.h)(o)),[o]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"stg:text-lg stg:font-semibold stg:text-foreground",children:"Review & Create"}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-sm stg:text-muted-foreground",children:"Review the agent configuration below, then create it."})]}),(0,t.jsx)("div",{className:"stg:rounded-lg stg:border stg:border-border stg:p-4",children:(0,t.jsxs)("dl",{className:"stg:grid stg:gap-x-6 stg:gap-y-3 stg:text-sm stg:sm:grid-cols-2",children:[(0,t.jsx)(O,{label:"Name",value:r.name}),(0,t.jsx)(O,{label:"Slug",value:r.slug,mono:!0}),(0,t.jsx)(O,{label:"Organization",value:l(e),mono:!0}),r.description&&(0,t.jsx)(O,{label:"Description",value:r.description,className:"stg:sm:col-span-2"}),r.instructions&&(0,t.jsx)(O,{label:"Instructions",value:(i=r.instructions).length<=120?i:i.slice(0,120)+"…",className:"stg:sm:col-span-2"}),(0,t.jsx)(O,{label:"Plugins",value:r.plugins.length>0?`${r.plugins.length} added`:"None"}),r.mcpServers.length>0&&(0,t.jsx)(O,{label:"MCP servers",value:`${r.mcpServers.length} added`}),(0,t.jsx)(O,{label:"Skills",value:r.skillRefs.length>0?`${r.skillRefs.length} attached`:"None"}),r.env.length>0&&(0,t.jsx)(O,{label:"Env Variables",value:`${r.env.length} declared`})]})}),(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"YAML Preview"}),(0,t.jsx)("div",{className:"stg:max-h-80 stg:overflow-auto stg:rounded-lg stg:border stg:border-border stg:bg-muted-faint",children:(0,t.jsx)("pre",{className:"stg:p-4 stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground",children:g})})]}),a&&(0,t.jsxs)("div",{className:"stg:rounded-md stg:border stg:border-destructive stg:bg-muted-faint stg:px-4 stg:py-3",role:"alert",children:[(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-destructive",children:"Failed to create agent"}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-xs stg:text-muted-foreground",children:(0,$.g)(a)})]}),n&&(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground","aria-live":"polite",children:"Creating agent…"})]})}function O({label:e,value:s,mono:r,className:a}){return(0,t.jsxs)("div",{className:a,children:[(0,t.jsx)("dt",{className:"stg:text-xs stg:text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:(0,n.f)("stg:mt-0.5 stg:text-sm stg:text-foreground",r&&"stg:font-mono"),children:s})]})}function P(e,t){let s={name:t.name.trim(),org:e,...t.slug&&{slug:t.slug},...t.description&&{description:t.description.trim()},...t.iconUrl&&{iconUrl:t.iconUrl.trim()},...t.instructions&&{instructions:t.instructions}};if(t.plugins.length>0&&(s.plugins=t.plugins),t.mcpServers.length>0&&(s.mcpServers=t.mcpServers),t.skillRefs.length>0&&(s.skillRefs=t.skillRefs),t.env.length>0){let e={};for(let s of t.env)s.key&&(e[s.key]={...s.isSecret&&{isSecret:!0},...s.description&&{description:s.description},...s.optional&&{optional:!0}});Object.keys(e).length>0&&(s.env=e)}return s}let U=[{id:"identity",label:"Identity & Instructions",validate:e=>e.name.trim()?null:"Name is required"},{id:"capabilities",label:"Capabilities"},{id:"review",label:"Review & Create"}];function W(e){let{allowed:s,isLoading:r}=(0,f.f)(e.org||null);return r?null:s?(0,t.jsx)(G,{...e}):(0,t.jsx)(v,{className:e.className})}function G({org:e,initialData:r,onComplete:n,onCancel:a,className:i}){let l=function(e){let{steps:t,initialData:r}=e,n=(0,s.useMemo)(()=>function(e,s){switch(s.type){case"GO_NEXT":{let s=t[e.currentStepIndex],r=s?.validate?.(e.data)??null;if(r)return{...e,validationError:r};let n=Math.min(e.currentStepIndex+1,t.length-1);return{...e,currentStepIndex:n,validationError:null}}case"GO_BACK":{let t=Math.max(e.currentStepIndex-1,0);return{...e,currentStepIndex:t,validationError:null}}case"GO_TO_STEP":if(s.index<0||s.index>=t.length||s.index>=e.currentStepIndex)return e;return{...e,currentStepIndex:s.index,validationError:null};case"UPDATE_DATA":return{...e,data:{...e.data,...s.partial},validationError:null};case"SET_VALIDATION_ERROR":return{...e,validationError:s.error};default:return e}},[t]),[a,i]=(0,s.useReducer)(n,{currentStepIndex:0,data:r,validationError:null}),l=t[a.currentStepIndex],o=0===a.currentStepIndex,g=a.currentStepIndex===t.length-1,d=(0,s.useMemo)(()=>null===(l.validate?.(a.data)??null),[l,a.data]),c=!o,u=(0,s.useCallback)(()=>{i({type:"GO_NEXT"})},[]),x=(0,s.useCallback)(()=>{i({type:"GO_BACK"})},[]),p=(0,s.useCallback)(e=>{i({type:"GO_TO_STEP",index:e})},[]),m=(0,s.useCallback)(e=>{i({type:"UPDATE_DATA",partial:e})},[]);return(0,s.useMemo)(()=>({currentStepIndex:a.currentStepIndex,currentStep:l,data:a.data,updateData:m,canGoNext:d,canGoBack:c,goNext:u,goBack:x,goToStep:p,validationError:a.validationError,isFirstStep:o,isLastStep:g}),[a.currentStepIndex,a.data,a.validationError,l,d,c,o,g,m,u,x,p])}({steps:U,initialData:(0,s.useMemo)(()=>({name:"",slug:"",slugTouched:!1,description:"",iconUrl:"",instructions:"",plugins:[],mcpServers:[],skillRefs:[],env:[],...r}),[r])}),{create:o,isCreating:g,error:d,clearError:c}=function(){let e=(0,m.f)(),[t,r]=(0,s.useState)(!1),[n,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{create:(0,s.useCallback)(async t=>{r(!0),a(null);try{return await e.agent.apply(t)}catch(e){throw a((0,h.f)(e)),e}finally{r(!1)}},[e]),isCreating:t,error:n,clearError:i}}(),u=(0,s.useCallback)(()=>{l.isLastStep?p():(c(),l.goNext())},[l.isLastStep,l.goNext,c]),p=(0,s.useCallback)(async()=>{c();let t=P(e,l.data);try{let s=await o(t);n({org:s.metadata?.org??e,slug:s.metadata?.slug??t.slug??t.name,name:s.metadata?.name??t.name})}catch{}},[e,l.data,o,c,n]),f=(0,s.useMemo)(()=>{switch(l.currentStep.id){case"identity":return(0,t.jsx)(k,{data:l.data,updateData:l.updateData,validationError:l.validationError});case"capabilities":return(0,t.jsx)(A,{org:e,data:l.data,updateData:l.updateData});case"review":return(0,t.jsx)(D,{org:e,data:l.data,isCreating:g,error:d});default:return null}},[l.currentStep.id,l.data,l.updateData,l.validationError,e,g,d]);return(0,t.jsx)(x,{steps:U,currentStepIndex:l.currentStepIndex,submitLabel:"Create agent",isSubmitting:g,canGoNext:l.canGoNext,canGoBack:l.canGoBack,onNext:u,onBack:l.goBack,onGoToStep:l.goToStep,onCancel:a,className:i,children:f})}let _={"data-analysis":"Data Analysis",devops:"DevOps",content:"Content",integration:"Integration",general:"General"};function F({template:e,onSelect:r,className:a}){let i=(0,s.useCallback)(()=>{r(e)},[r,e]),l=(0,s.useCallback)(t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e))},[r,e]),o=e.name.charAt(0).toUpperCase(),g=_[e.category]??e.category;return(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:i,onKeyDown:l,"aria-label":`Use ${e.name} template`,className:(0,n.f)("stg:group stg:flex stg:cursor-pointer stg:flex-col stg:gap-3 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-4","stg:transition-colors stg:hover:border-primary stg:hover:bg-accent","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",a),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3",children:[(0,t.jsx)("span",{className:"stg:inline-flex stg:size-9 stg:shrink-0 stg:items-center stg:justify-center stg:rounded-md stg:bg-avatar stg:text-sm stg:font-semibold stg:text-muted-foreground","aria-hidden":"true",children:o}),(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.name}),(0,t.jsx)("span",{className:"stg:mt-1 stg:inline-block stg:rounded-full stg:bg-muted stg:px-2 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-muted-foreground",children:g})]})]}),(0,t.jsx)("p",{className:"stg:line-clamp-2 stg:text-xs stg:leading-relaxed stg:text-muted-foreground",children:e.description})]})}function K({templates:e,onSelect:r,emptyContent:a,className:i}){let{filtered:l,query:o,setQuery:g,activeCategory:d,setActiveCategory:c,availableCategories:u}=function(e){let{templates:t}=e,[r,n]=(0,s.useState)(""),[a,i]=(0,s.useState)(null),l=(0,s.useCallback)(e=>{n(e)},[]),o=(0,s.useMemo)(()=>{let e=new Set;for(let s of t)e.add(s.category);return[...e].sort()},[t]),g=(0,s.useMemo)(()=>{let e=t;a&&(e=e.filter(e=>e.category===a));let s=r.trim().toLowerCase();return s&&(e=e.filter(e=>[e.name,e.description,...e.tags??[]].join(" ").toLowerCase().includes(s))),e},[t,a,r]);return(0,s.useMemo)(()=>({filtered:g,query:r,setQuery:l,activeCategory:a,setActiveCategory:i,availableCategories:o}),[g,r,l,a,i,o])}({templates:e}),x=(0,s.useRef)(null),p=(0,s.useCallback)(e=>{let t=x.current?.querySelectorAll('[role="tab"]');if(!t?.length)return;let s=Array.from(t).findIndex(e=>e===document.activeElement);if(-1===s)return;let r=null;"ArrowRight"===e.key?r=(s+1)%t.length:"ArrowLeft"===e.key?r=(s-1+t.length)%t.length:"Home"===e.key?r=0:"End"===e.key&&(r=t.length-1),null!==r&&(e.preventDefault(),t[r].focus(),t[r].click())},[]);return(0,t.jsxs)("div",{className:(0,n.f)("stg:flex stg:flex-col stg:gap-4",i),children:[(0,t.jsxs)("div",{className:"stg:relative",children:[(0,t.jsx)(H,{}),(0,t.jsx)("input",{type:"search",value:o,onChange:e=>g(e.target.value),placeholder:"Search templates…","aria-label":"Search templates",className:(0,n.f)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-input-bg stg:py-2 stg:pl-9 stg:pr-3 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring")})]}),u.length>1&&(0,t.jsxs)("div",{ref:x,role:"tablist","aria-label":"Template categories",onKeyDown:p,className:"stg:flex stg:flex-wrap stg:gap-1",children:[(0,t.jsx)(V,{label:"All",isActive:null===d,onClick:()=>c(null)}),u.map(e=>(0,t.jsx)(V,{label:_[e]??e,isActive:d===e,onClick:()=>c(e)},e))]}),l.length>0?(0,t.jsx)("div",{role:"list","aria-label":"Templates",className:"stg:grid stg:grid-cols-1 stg:gap-3 stg:sm:grid-cols-2 stg:lg:grid-cols-3",children:l.map(e=>(0,t.jsx)("div",{role:"listitem",children:(0,t.jsx)(F,{template:e,onSelect:r})},e.id))}):a??(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-muted-foreground",children:"No templates match your search."})]})}function V({label:e,isActive:s,onClick:r}){return(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":s,tabIndex:s?0:-1,onClick:r,className:(0,n.f)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring",s?"stg:bg-primary stg:text-primary-foreground":"stg:bg-muted stg:text-muted-foreground stg:hover:bg-accent stg:hover:text-accent-foreground"),children:e})}function H(){return(0,t.jsxs)("svg",{className:"stg:pointer-events-none stg:absolute stg:left-3 stg:top-1/2 stg:size-4 stg:-translate-y-1/2 stg:text-muted-foreground",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:11,cy:11,r:8}),(0,t.jsx)("path",{d:"m21 21-4.3-4.3"})]})}function Y({resourceLabel:e,templates:r,onSelect:a,className:i}){let[l,o]=(0,s.useState)("options"),g=(0,s.useCallback)(e=>{a({kind:"template",data:e.data})},[a]),d=(0,s.useCallback)(()=>{o("options")},[]);return"gallery"===l?(0,t.jsxs)("div",{className:(0,n.f)("stg:flex stg:flex-col stg:gap-4",i),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:d,"aria-label":"Back to creation options",className:(0,n.f)("stg:inline-flex stg:items-center stg:justify-center stg:rounded-md stg:p-1.5","stg:text-muted-foreground stg:transition-colors","stg:hover:bg-accent stg:hover:text-accent-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(Z,{})}),(0,t.jsx)("h2",{className:"stg:text-base stg:font-semibold stg:text-foreground",children:"Choose a template"})]}),(0,t.jsx)(K,{templates:r,onSelect:g})]}):(0,t.jsxs)("div",{className:(0,n.f)("stg:flex stg:flex-col stg:gap-6",i),children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"stg:text-lg stg:font-semibold stg:text-foreground",children:["Create a new ",e]}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-sm stg:text-muted-foreground",children:"Choose how you'd like to get started."})]}),(0,t.jsxs)("div",{className:"stg:grid stg:grid-cols-1 stg:gap-3 stg:sm:grid-cols-3",children:[(0,t.jsx)(q,{title:"Start from scratch",description:`Create a blank ${e} and configure it step by step.`,icon:(0,t.jsx)(J,{}),onClick:()=>a({kind:"scratch"}),cursorTarget:"creation-path-scratch"}),r.length>0&&(0,t.jsx)(q,{title:"Browse templates",description:`Start with a pre-built ${e} configuration.`,icon:(0,t.jsx)(X,{}),onClick:()=>o("gallery"),badge:`${r.length} available`,cursorTarget:"creation-path-template"}),(0,t.jsx)(q,{title:"Import from file",description:"Upload a YAML or JSON configuration file.",icon:(0,t.jsx)(Q,{}),onClick:()=>a({kind:"import"}),cursorTarget:"creation-path-import"})]})]})}function q({title:e,description:s,icon:r,onClick:a,badge:i,cursorTarget:l}){return(0,t.jsxs)("button",{type:"button",onClick:a,"data-cursor-target":l,className:(0,n.f)("stg:group stg:flex stg:flex-col stg:items-center stg:gap-3 stg:rounded-lg stg:border stg:border-border stg:bg-card stg:p-6 stg:text-center","stg:transition-colors stg:hover:border-primary stg:hover:bg-accent","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:[(0,t.jsx)("span",{className:"stg:text-muted-foreground stg:transition-colors stg:group-hover:text-foreground",children:r}),(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:s})]}),i&&(0,t.jsx)("span",{className:"stg:rounded-full stg:bg-muted stg:px-2 stg:py-0.5 stg:text-2xs stg:font-medium stg:text-muted-foreground",children:i})]})}function J(){return(0,t.jsxs)("svg",{className:"stg:size-8",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),(0,t.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}function X(){return(0,t.jsxs)("svg",{className:"stg:size-8",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"}),(0,t.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"})]})}function Q(){return(0,t.jsxs)("svg",{className:"stg:size-8",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,t.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,t.jsx)("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]})}function Z(){return(0,t.jsxs)("svg",{className:"stg:size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,t.jsx)("path",{d:"M19 12H5"})]})}var ee=e.i(658653);let et=[{id:"variance-report",name:"Variance Report",description:"A customer uploads a ledger; the agent works through it and hands back a variance report as a file.",category:"data-analysis",tags:["accounting","ledger","budget","variance","report","file"],data:{name:"Variance Reporter",description:"Turns a customer's ledger into a variance report.",instructions:`You review a customer's ledger and report how each account did against its budget.
2
+
3
+ ## How you work
4
+
5
+ 1. Read the ledger the customer uploaded. If it holds no budget figures, ask for them before going on.
6
+ 2. Group the lines by account and compare each account's actual total with its budget.
7
+ 3. Call out every account over or under its budget by more than 5%, with the difference and the lines behind it.
8
+ 4. Write the report as a file, a spreadsheet or a Markdown table as the customer asks, and hand it back.
9
+
10
+ ## Rules
11
+
12
+ - Use only the figures in the ledger. When a line is unclear, say so in the report rather than guessing.
13
+ - Never change the customer's books. When an account needs a correcting entry, propose it in the report.`}},{id:"cloud-change",name:"Cloud Change",description:"A customer asks for a change to their cloud setup; the agent proposes it and applies it only after a yes. Once it is created, mark the tool that applies changes as needing a yes.",category:"devops",tags:["cloud","infrastructure","devops","change","approval"],data:{name:"Cloud Change Agent",description:"Proposes changes to a customer's cloud setup and applies them only after a yes.",instructions:`You change a customer's cloud setup when they ask, and you apply nothing until they say yes.
14
+
15
+ ## How you work
16
+
17
+ 1. Read what the customer asks for, and look at their current setup before deciding anything.
18
+ 2. Propose the change: what will change, why it does what they asked, and what else it affects, such as cost, downtime or other services.
19
+ 3. Wait for the customer's yes. If they ask for something different, propose again.
20
+ 4. Apply exactly the change they said yes to, then report what changed and how to undo it.
21
+
22
+ ## Rules
23
+
24
+ - Never apply a change the customer has not said yes to, and never widen it while applying it.
25
+
26
+ ## Setting this agent up
27
+
28
+ Make the tool that applies changes ask first, so the platform also stops for the customer's yes: a hook that asks before it, or a tool its MCP server marks destructive. Until then, the rules above are the only stop.`}}];var es=e.i(297629),er=e.i(310057);e.s(["AgentNewPage",0,function(){let e=(0,es.x)(),{allowed:n,isLoading:a}=(0,f.f)(e||null),i=(0,B.b)(),l=(0,r.useRouter)(),{setLabel:o}=(0,er.Q)(),[g,d]=(0,s.useState)({phase:"picking"}),[c,u]=(0,s.useState)(!1);(0,s.useEffect)(()=>{o("New agent")},[o]);let x=(0,s.useCallback)(e=>{switch(e.kind){case"scratch":d({phase:"wizard"});break;case"template":d({phase:"wizard",initialData:e.data});break;case"import":u(!0)}},[]),p=(0,s.useCallback)(e=>{l.push(`/library/agents/${i(e.org)}/${e.slug}`)},[l,i]),m=(0,s.useCallback)(()=>{"wizard"===g.phase?d({phase:"picking"}):l.push("/library/agents")},[g.phase,l]);return!e||a?null:n?(0,t.jsxs)(t.Fragment,{children:["picking"===g.phase?(0,t.jsx)(Y,{resourceLabel:"agent",templates:et,onSelect:x}):(0,t.jsx)(W,{org:e,initialData:g.initialData,onComplete:p,onCancel:m,className:"min-h-[480px]"}),(0,t.jsx)(ee.f,{open:c,onOpenChange:u,org:e,onApplied:()=>l.push("/library/agents")})]}):(0,t.jsx)(v,{})}],155732)}]);