@aeolus-fleet/console 0.19.0 → 0.20.1

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 (265) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +6 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/routes-manifest.json +40 -0
  7. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/squadrons/[procedure]/route.js +1 -1
  16. package/.next/server/app/api/squadrons/[procedure]/route.js.nft.json +1 -1
  17. package/.next/server/app/api/trierarch-plugin/[procedure]/route/app-paths-manifest.json +3 -0
  18. package/.next/server/app/api/trierarch-plugin/[procedure]/route/build-manifest.json +12 -0
  19. package/.next/server/app/api/trierarch-plugin/[procedure]/route/server-reference-manifest.json +4 -0
  20. package/.next/server/app/api/trierarch-plugin/[procedure]/route.js +6 -0
  21. package/.next/server/app/api/trierarch-plugin/[procedure]/route.js.nft.json +1 -0
  22. package/.next/server/app/api/trierarch-plugin/[procedure]/route_client-reference-manifest.js +3 -0
  23. package/.next/server/app/health/route.js +1 -1
  24. package/.next/server/app/health/route.js.nft.json +1 -1
  25. package/.next/server/app/inbox/page.js.nft.json +1 -1
  26. package/.next/server/app/inbox/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app/labels/page/app-paths-manifest.json +3 -0
  28. package/.next/server/app/labels/page/build-manifest.json +20 -0
  29. package/.next/server/app/labels/page/next-font-manifest.json +11 -0
  30. package/.next/server/app/labels/page/react-loadable-manifest.json +1 -0
  31. package/.next/server/app/labels/page/server-reference-manifest.json +4 -0
  32. package/.next/server/app/labels/page.js +14 -0
  33. package/.next/server/app/labels/page.js.nft.json +1 -0
  34. package/.next/server/app/labels/page_client-reference-manifest.js +3 -0
  35. package/.next/server/app/needs-attention/page.js.nft.json +1 -1
  36. package/.next/server/app/needs-attention/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/needs-crew/page/app-paths-manifest.json +3 -0
  38. package/.next/server/app/needs-crew/page/build-manifest.json +20 -0
  39. package/.next/server/app/needs-crew/page/next-font-manifest.json +11 -0
  40. package/.next/server/app/needs-crew/page/react-loadable-manifest.json +1 -0
  41. package/.next/server/app/needs-crew/page/server-reference-manifest.json +4 -0
  42. package/.next/server/app/needs-crew/page.js +14 -0
  43. package/.next/server/app/needs-crew/page.js.nft.json +1 -0
  44. package/.next/server/app/needs-crew/page_client-reference-manifest.js +3 -0
  45. package/.next/server/app/page.js.nft.json +1 -1
  46. package/.next/server/app/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/settings/page.js.nft.json +1 -1
  48. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  49. package/.next/server/app/ships/[shipId]/page.js.nft.json +1 -1
  50. package/.next/server/app/ships/[shipId]/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/sign-in/failed/page.js.nft.json +1 -1
  52. package/.next/server/app/sign-in/failed/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/sign-in/page.js.nft.json +1 -1
  54. package/.next/server/app/sign-in/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/squadrons/[squadronId]/page.js.nft.json +1 -1
  56. package/.next/server/app/squadrons/[squadronId]/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/squadrons/blueprints/[name]/page.js.nft.json +1 -1
  58. package/.next/server/app/squadrons/blueprints/[name]/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/squadrons/connection/route.js +3 -3
  60. package/.next/server/app/squadrons/connection/route.js.nft.json +1 -1
  61. package/.next/server/app/squadrons/page.js.nft.json +1 -1
  62. package/.next/server/app/squadrons/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app/squadrons/templates/[name]/page.js.nft.json +1 -1
  64. package/.next/server/app/squadrons/templates/[name]/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/trierarch-plugin/connection/route/app-paths-manifest.json +3 -0
  66. package/.next/server/app/trierarch-plugin/connection/route/build-manifest.json +12 -0
  67. package/.next/server/app/trierarch-plugin/connection/route/server-reference-manifest.json +4 -0
  68. package/.next/server/app/trierarch-plugin/connection/route.js +8 -0
  69. package/.next/server/app/trierarch-plugin/connection/route.js.nft.json +1 -0
  70. package/.next/server/app/trierarch-plugin/connection/route_client-reference-manifest.js +3 -0
  71. package/.next/server/app/trierarchs/[shipId]/page/app-paths-manifest.json +3 -0
  72. package/.next/server/app/trierarchs/[shipId]/page/build-manifest.json +20 -0
  73. package/.next/server/app/trierarchs/[shipId]/page/next-font-manifest.json +11 -0
  74. package/.next/server/app/trierarchs/[shipId]/page/react-loadable-manifest.json +1 -0
  75. package/.next/server/app/trierarchs/[shipId]/page/server-reference-manifest.json +4 -0
  76. package/.next/server/app/trierarchs/[shipId]/page.js +14 -0
  77. package/.next/server/app/trierarchs/[shipId]/page.js.nft.json +1 -0
  78. package/.next/server/app/trierarchs/[shipId]/page_client-reference-manifest.js +3 -0
  79. package/.next/server/app/trierarchs/page/app-paths-manifest.json +3 -0
  80. package/.next/server/app/trierarchs/page/build-manifest.json +20 -0
  81. package/.next/server/app/trierarchs/page/next-font-manifest.json +11 -0
  82. package/.next/server/app/trierarchs/page/react-loadable-manifest.json +1 -0
  83. package/.next/server/app/trierarchs/page/server-reference-manifest.json +4 -0
  84. package/.next/server/app/trierarchs/page.js +14 -0
  85. package/.next/server/app/trierarchs/page.js.nft.json +1 -0
  86. package/.next/server/app/trierarchs/page_client-reference-manifest.js +3 -0
  87. package/.next/server/app/version/route.js +3 -2
  88. package/.next/server/app/version/route.js.nft.json +1 -1
  89. package/.next/server/app-paths-manifest.json +6 -0
  90. package/.next/server/chunks/04lx_next-internal_server_app_api_trierarch-plugin_[procedure]_route_actions_0pov8t_.js +3 -0
  91. package/.next/server/chunks/1eui__next-internal_server_app_trierarch-plugin_connection_route_actions_1jgdi18.js +3 -0
  92. package/.next/server/chunks/{[root-of-the-server]__0w2mqex._.js → [root-of-the-server]__14rtv1n._.js} +2 -2
  93. package/.next/server/chunks/[root-of-the-server]__1c6takz._.js +3 -0
  94. package/.next/server/chunks/[root-of-the-server]__1f7engf._.js +3 -0
  95. package/.next/server/chunks/[root-of-the-server]__1f_8ohl._.js +3 -0
  96. package/.next/server/chunks/[root-of-the-server]__1h3r48l._.js +3 -0
  97. package/.next/server/chunks/[root-of-the-server]__1kc3njk._.js +3 -0
  98. package/.next/server/chunks/_0h366h9._.js +3 -0
  99. package/.next/server/chunks/packages_console_lib_connect-plugin_ts_197hf-1._.js +3 -0
  100. package/.next/server/chunks/ssr/0ysl_console__next-internal_server_app_trierarchs_[shipId]_page_actions_0e_rw4u.js +3 -0
  101. package/.next/server/chunks/ssr/[root-of-the-server]__0qbhnxj._.js +3 -0
  102. package/.next/server/chunks/ssr/[root-of-the-server]__18derwo._.js +3 -0
  103. package/.next/server/chunks/ssr/[root-of-the-server]__18g_7b-._.js +3 -0
  104. package/.next/server/chunks/ssr/[root-of-the-server]__1m1u7bl._.js +3 -0
  105. package/.next/server/chunks/ssr/[root-of-the-server]__1uan58j._.js +3 -3
  106. package/.next/server/chunks/ssr/_06c6zlg._.js +3 -0
  107. package/.next/server/chunks/ssr/{_0plfddz._.js → _0dogq79._.js} +2 -2
  108. package/.next/server/chunks/ssr/_0exrpxl._.js +3 -0
  109. package/.next/server/chunks/ssr/_0gt230s._.js +3 -0
  110. package/.next/server/chunks/ssr/_0rvujxo._.js +3 -0
  111. package/.next/server/chunks/ssr/{_00yiulp._.js → _0s2b6hb._.js} +2 -2
  112. package/.next/server/chunks/ssr/{_050suap._.js → _0sko-kt._.js} +2 -2
  113. package/.next/server/chunks/ssr/_0snpwr0._.js +3 -0
  114. package/.next/server/chunks/ssr/{_0igx2qf._.js → _0sv2xqb._.js} +2 -2
  115. package/.next/server/chunks/ssr/_0udw2gs._.js +3 -0
  116. package/.next/server/chunks/ssr/_0wr_wnm._.js +3 -0
  117. package/.next/server/chunks/ssr/{_0-rsrfr._.js → _0wtj0e-._.js} +2 -2
  118. package/.next/server/chunks/ssr/_0xc3etp._.js +3 -0
  119. package/.next/server/chunks/ssr/_0xi2v5k._.js +3 -0
  120. package/.next/server/chunks/ssr/_0xvm1ng._.js +3 -0
  121. package/.next/server/chunks/ssr/_0ziovn_._.js +3 -0
  122. package/.next/server/chunks/ssr/_11cgy8n._.js +3 -0
  123. package/.next/server/chunks/ssr/_1442xyx._.js +3 -0
  124. package/.next/server/chunks/ssr/_14rijy-._.js +3 -0
  125. package/.next/server/chunks/ssr/_16jiag3._.js +3 -0
  126. package/.next/server/chunks/ssr/_17u4fan._.js +3 -0
  127. package/.next/server/chunks/ssr/_181kpys._.js +3 -0
  128. package/.next/server/chunks/ssr/_19e0e-9._.js +3 -3
  129. package/.next/server/chunks/ssr/_1_h504-._.js +3 -0
  130. package/.next/server/chunks/ssr/_1al_cqt._.js +3 -0
  131. package/.next/server/chunks/ssr/_1bmk6y_._.js +3 -0
  132. package/.next/server/chunks/ssr/_1cn9_0f._.js +3 -0
  133. package/.next/server/chunks/ssr/_1d6cgif._.js +3 -0
  134. package/.next/server/chunks/ssr/_1ejhqt9._.js +3 -0
  135. package/.next/server/chunks/ssr/_1ezhc7m._.js +3 -0
  136. package/.next/server/chunks/ssr/_1g2wuzd._.js +1 -1
  137. package/.next/server/chunks/ssr/_1hcta3c._.js +3 -0
  138. package/.next/server/chunks/ssr/_1kv8ma5._.js +3 -0
  139. package/.next/server/chunks/ssr/{_1s07u90._.js → _1lu1eda._.js} +2 -2
  140. package/.next/server/chunks/ssr/_1ntb2un._.js +3 -0
  141. package/.next/server/chunks/ssr/_1ommvbv._.js +3 -0
  142. package/.next/server/chunks/ssr/_1on9mjs._.js +3 -0
  143. package/.next/server/chunks/ssr/_1oofkty._.js +3 -0
  144. package/.next/server/chunks/ssr/_1r6ce_7._.js +3 -0
  145. package/.next/server/chunks/ssr/{_1s8-j5t._.js → _1ub6rp3._.js} +2 -2
  146. package/.next/server/chunks/ssr/_208q2q8._.js +3 -0
  147. package/.next/server/chunks/ssr/node_modules_next_dist_0kq7z60._.js +1 -1
  148. package/.next/server/chunks/ssr/packages_console_03isfmy._.js +3 -0
  149. package/.next/server/chunks/ssr/packages_console_0edevze._.js +3 -0
  150. package/.next/server/chunks/ssr/packages_console_0oso305._.js +3 -0
  151. package/.next/server/chunks/ssr/packages_console_0y7h5dm._.js +3 -0
  152. package/.next/server/chunks/ssr/packages_console_10fqil_._.js +1 -1
  153. package/.next/server/chunks/ssr/packages_console_1stwpsk._.js +3 -0
  154. package/.next/server/chunks/ssr/packages_console__next-internal_server_app_labels_page_actions_0-7_20w.js +3 -0
  155. package/.next/server/chunks/ssr/packages_console__next-internal_server_app_needs-crew_page_actions_0rw7fgn.js +3 -0
  156. package/.next/server/chunks/ssr/packages_console__next-internal_server_app_trierarchs_page_actions_1zds6hw.js +3 -0
  157. package/.next/server/chunks/ssr/packages_console_app_inbox_page_tsx_1bpmlpx._.js +1 -1
  158. package/.next/server/chunks/ssr/packages_console_app_labels_page_tsx_0xxovjk._.js +3 -0
  159. package/.next/server/chunks/ssr/packages_console_app_needs-attention_page_tsx_1agfico._.js +1 -1
  160. package/.next/server/chunks/ssr/packages_console_app_page_tsx_16ln4px._.js +1 -1
  161. package/.next/server/chunks/ssr/packages_console_app_providers_tsx_06ai92n._.js +1 -1
  162. package/.next/server/chunks/ssr/packages_console_app_settings_page_tsx_1zqt7sk._.js +1 -1
  163. package/.next/server/chunks/ssr/packages_console_app_ships_[shipId]_page_tsx_0fudjay._.js +1 -1
  164. package/.next/server/chunks/ssr/packages_console_app_squadrons_[squadronId]_page_tsx_1umxs1g._.js +1 -1
  165. package/.next/server/chunks/ssr/packages_console_app_squadrons_page_tsx_1w6ym6z._.js +1 -1
  166. package/.next/server/chunks/ssr/packages_console_app_trierarchs_[shipId]_page_tsx_1rqyoj3._.js +3 -0
  167. package/.next/server/chunks/ssr/packages_console_components_1-5gwzg._.js +3 -0
  168. package/.next/server/chunks/ssr/packages_console_components_atoms_select_tsx_1v_3j3i._.js +1 -1
  169. package/.next/server/chunks/ssr/packages_console_components_organisms_form-squadron_tsx_1-qlsje._.js +3 -0
  170. package/.next/server/middleware-build-manifest.js +3 -3
  171. package/.next/server/next-font-manifest.js +1 -1
  172. package/.next/server/next-font-manifest.json +16 -0
  173. package/.next/server/pages/500.html +1 -1
  174. package/.next/server/server-reference-manifest.js +1 -1
  175. package/.next/server/server-reference-manifest.json +1 -1
  176. package/.next/static/chunks/038sk3qwghvto.js +1 -0
  177. package/.next/static/chunks/0f5-vxw1bk8ym.js +1 -0
  178. package/.next/static/chunks/0y1nvhxr03jkb.js +1 -0
  179. package/.next/static/chunks/{2ff-56ohrio7h.js → 0z1nza3zgavbi.js} +1 -1
  180. package/.next/static/chunks/177iv_tzmr_0a.js +1 -0
  181. package/.next/static/chunks/1auwxv_urmljv.js +1 -0
  182. package/.next/static/chunks/1bvfk_-_enrxp.js +1 -0
  183. package/.next/static/chunks/1ct431l_sosvm.js +1 -0
  184. package/.next/static/chunks/1h0f7mfr5wxsj.js +1 -0
  185. package/.next/static/chunks/1zuzmwfsw_7q0.js +1 -0
  186. package/.next/static/chunks/21y50ct8e_pis.js +1 -0
  187. package/.next/static/chunks/25amuen1qm2o7.js +1 -0
  188. package/.next/static/chunks/26dg2z_6kosr0.js +1 -0
  189. package/.next/static/chunks/28j4p-34f5axr.js +1 -0
  190. package/.next/static/chunks/28vyyv4krlzx3.js +1 -0
  191. package/.next/static/chunks/2b-ho-tbr3sac.js +1 -0
  192. package/.next/static/chunks/2r01e5tqyyrsv.js +1 -0
  193. package/.next/static/chunks/2r2aklt62ojhs.js +1 -0
  194. package/.next/static/chunks/2spn0c35v7c1b.js +1 -0
  195. package/.next/static/chunks/2wnrtdpkhbd_j.js +1 -0
  196. package/.next/static/chunks/{0hl9b82m3b_kf.js → 2zu1o4z0tmf0-.js} +1 -1
  197. package/.next/static/chunks/3061rp6nl670n.js +1 -0
  198. package/.next/static/chunks/32oc7qg77tpjj.js +1 -0
  199. package/.next/static/chunks/36_a72wj7_f-y.js +1 -0
  200. package/.next/static/chunks/3ba10-qig9f07.js +1 -0
  201. package/.next/static/chunks/3drxrwegn5v1p.css +3 -0
  202. package/.next/static/chunks/3jhje-hiar2ex.js +1 -0
  203. package/.next/static/chunks/3jsj5ozfio3me.js +1 -0
  204. package/.next/static/chunks/3pkfx52bufv4g.js +1 -0
  205. package/.next/static/chunks/3pu5ywtisj_fp.js +1 -0
  206. package/.next/static/chunks/{2z2hhi291ems4.js → 3splvoavlf-cc.js} +12 -12
  207. package/.next/static/chunks/{2quoh5csh67oz.js → 3t2amxc2hojri.js} +1 -1
  208. package/.next/static/chunks/3vl7dc6v-u8w0.js +1 -0
  209. package/.next/static/chunks/3x_52f9if0z-8.js +1 -0
  210. package/.next/static/chunks/3z61krti-vbu2.js +1 -0
  211. package/.next/static/chunks/{1cbzjk-qf984o.js → 414186x82sxkk.js} +1 -1
  212. package/.next/static/chunks/42y_hgylfwlq5.js +1 -0
  213. package/README.md +1 -0
  214. package/package.json +3 -3
  215. package/.next/server/chunks/[root-of-the-server]__0eg7gro._.js +0 -3
  216. package/.next/server/chunks/[root-of-the-server]__11ajlfh._.js +0 -3
  217. package/.next/server/chunks/[root-of-the-server]__1w1vtvn._.js +0 -3
  218. package/.next/server/chunks/_1mul6_v._.js +0 -3
  219. package/.next/server/chunks/ssr/_01eh2h5._.js +0 -3
  220. package/.next/server/chunks/ssr/_05wjy-d._.js +0 -3
  221. package/.next/server/chunks/ssr/_09pq8b7._.js +0 -3
  222. package/.next/server/chunks/ssr/_0_6abve._.js +0 -3
  223. package/.next/server/chunks/ssr/_0aqa8e3._.js +0 -3
  224. package/.next/server/chunks/ssr/_0c1ebla._.js +0 -3
  225. package/.next/server/chunks/ssr/_0g98qoq._.js +0 -3
  226. package/.next/server/chunks/ssr/_0k0kffc._.js +0 -3
  227. package/.next/server/chunks/ssr/_0ksc8ky._.js +0 -3
  228. package/.next/server/chunks/ssr/_0nxk8e5._.js +0 -3
  229. package/.next/server/chunks/ssr/_0sh180u._.js +0 -3
  230. package/.next/server/chunks/ssr/_0t1jjxf._.js +0 -3
  231. package/.next/server/chunks/ssr/_0vz-_zq._.js +0 -3
  232. package/.next/server/chunks/ssr/_0y_ez3b._.js +0 -3
  233. package/.next/server/chunks/ssr/_0zz00ec._.js +0 -3
  234. package/.next/server/chunks/ssr/_101_mtq._.js +0 -3
  235. package/.next/server/chunks/ssr/_10vocmg._.js +0 -3
  236. package/.next/server/chunks/ssr/_16klr-g._.js +0 -3
  237. package/.next/server/chunks/ssr/_1_hm4gt._.js +0 -3
  238. package/.next/server/chunks/ssr/_1c2ijn5._.js +0 -3
  239. package/.next/server/chunks/ssr/_1jgnfkf._.js +0 -3
  240. package/.next/server/chunks/ssr/_1m_b36m._.js +0 -3
  241. package/.next/server/chunks/ssr/_1pif908._.js +0 -3
  242. package/.next/server/chunks/ssr/_20fp5al._.js +0 -3
  243. package/.next/server/chunks/ssr/packages_console_components_1_4zc74._.js +0 -3
  244. package/.next/static/chunks/04p19br-6pr3q.js +0 -1
  245. package/.next/static/chunks/05xsztb02v-3h.js +0 -1
  246. package/.next/static/chunks/0atm4wesk-4u8.js +0 -1
  247. package/.next/static/chunks/0es5vdu6lt-lm.css +0 -3
  248. package/.next/static/chunks/0jkliy--t1bbh.js +0 -1
  249. package/.next/static/chunks/0nchi43nyih52.js +0 -1
  250. package/.next/static/chunks/0oh4dxohbk7m8.js +0 -1
  251. package/.next/static/chunks/0w8wux_7extu3.js +0 -1
  252. package/.next/static/chunks/0xdkx7wg739q7.js +0 -1
  253. package/.next/static/chunks/1q-shkfypoia-.js +0 -1
  254. package/.next/static/chunks/1t5mkoni0wrc0.js +0 -1
  255. package/.next/static/chunks/21py3ha_f_e3-.js +0 -1
  256. package/.next/static/chunks/22wd2oyjf0iq_.js +0 -1
  257. package/.next/static/chunks/2mvb-x6v93lfc.js +0 -1
  258. package/.next/static/chunks/2t6jzvnrf9ejw.js +0 -1
  259. package/.next/static/chunks/32-17dotvltga.js +0 -1
  260. package/.next/static/chunks/3m4-wgj579r4x.js +0 -1
  261. package/.next/static/chunks/3tsjbqptivphr.js +0 -1
  262. package/.next/static/chunks/42-u_9nvmdste.js +0 -1
  263. /package/.next/static/{4BHf_wBvFUce1tC4Uw_GD → tBoOmC5nKBL5eqDmRV5Vd}/_buildManifest.js +0 -0
  264. /package/.next/static/{4BHf_wBvFUce1tC4Uw_GD → tBoOmC5nKBL5eqDmRV5Vd}/_clientMiddlewareManifest.js +0 -0
  265. /package/.next/static/{4BHf_wBvFUce1tC4Uw_GD → tBoOmC5nKBL5eqDmRV5Vd}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[830,a=>{"use strict";var b=a.i(87924);a.i(23600);var c=a.i(2811),d=a.i(50944),e=a.i(72131),f=a.i(94777),g=a.i(15439),h=a.i(2549),i=a.i(83786),j=a.i(68698),k=a.i(64831);let l={name:"mail-question-mark",size:24,node:[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]],aliases:["mail-question"]};l.node;let m=(0,k.default)(l),n={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};n.node;let o=(0,k.default)(n);var p=a.i(9854),q=a.i(72872),r=a.i(31429),s=a.i(84980),t=a.i(12068),u=a.i(82314),v=a.i(4838),w=a.i(33809),x=a.i(24173),y=a.i(90468);function z({parts:a,className:c}){let d;return(0,b.jsx)("span",{className:c,children:(d=new Map,a.map(a=>{let b="text"===a.kind?`text:${a.text}`:`ship:${a.party.id}`,c=d.get(b)??0;return d.set(b,c+1),{key:`${b}#${String(c)}`,part:a}})).map(({key:a,part:c})=>"text"===c.kind?(0,b.jsx)("span",{children:c.text},a):(0,b.jsx)(y.ShipName,{name:c.party.name,shipId:c.party.id,isSuffixShown:c.party.name!==r.OPERATOR_NAME,className:"align-baseline"},a))})}var A=a.i(23063),B=a.i(29703);function C(a){return a.ship?[(0,r.ship)(a.ship)]:[(0,r.text)("a ship")]}var D=a.i(76166);function E({entries:a,recipient:c}){return(0,b.jsx)("ol",{"data-testid":"delivery-history","aria-label":"Delivery history",className:"flex flex-col",children:a.map((d,e)=>{let f=new Date(d.occurredAt);return(0,b.jsxs)("li",{"data-testid":"delivery-history-entry","data-type":d.type,className:"relative flex gap-3 pb-4 last:pb-0",children:[(0,b.jsxs)("span",{"aria-hidden":!0,className:"relative flex w-3 shrink-0 justify-center",children:[(0,b.jsx)("span",{className:"mt-1.5 size-2.5 rounded-full border-2 border-muted-foreground bg-card"}),e<a.length-1?(0,b.jsx)("span",{className:"absolute top-5 bottom-[-0.25rem] w-px bg-border"}):null]}),(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(A.StatusBadge,{status:function(a){switch(a.type){case"MessageAccepted":case"DeliveryReturned":return"pending";case"DeliveryClaimed":return"delivered";case"DeliveryAcknowledged":return"acknowledged";case"DeliveryUndeliverable":return"undeliverable";case"DeliveryAbandoned":return"abandoned";case"DeliveryDismissed":return"dismissed"}}(d)}),(0,b.jsx)("time",{dateTime:d.occurredAt,title:(0,q.fullDateTime)(f),className:"font-mono text-id text-muted-foreground tabular-nums",children:(0,q.secondsTime)(f)}),0===e?(0,b.jsx)(D.Badge,{variant:"outline",children:"Current"}):null]}),(0,b.jsx)(z,{parts:function(a,b){switch(a.type){case"MessageAccepted":return"ship"===b.kind?[(0,r.text)("Stored in the inbox of "),(0,r.ship)(b.ship),(0,r.text)(".")]:[(0,r.text)(`Queued for any ship of type ${b.type}.`)];case"DeliveryClaimed":{let b=null!==a.attempts&&a.attempts>1?`Attempt ${String(a.attempts)}: claimed`:"Claimed";return[(0,r.text)(`${b} by `),...C(a),...function(a){if(null===a)return[];let b=null!==a.description&&""!==a.description?a.description:(0,B.locationKindWord)(a.kind);return[(0,r.text)(`, session on ${b}`)]}(a.location),(0,r.text)(".")]}case"DeliveryReturned":return"ship"===b.kind?[(0,r.text)("Back in the inbox: the session of "),...C(a),(0,r.text)(" ended before acknowledging it.")]:[(0,r.text)("Returned to the queue: the session of "),...C(a),(0,r.text)(" ended before acknowledging it.")];case"DeliveryAcknowledged":return[(0,r.text)("Acknowledged by "),...C(a),(0,r.text)(".")];case"DeliveryUndeliverable":return[(0,r.text)(null===a.attempts?"Never acknowledged: no ship takes it automatically any more.":`Received ${String(a.attempts)} times, never acknowledged.`)];case"DeliveryAbandoned":return[(0,r.text)("Abandoned: "),...C(a),(0,r.text)(" was retired before taking it.")];case"DeliveryDismissed":return[(0,r.text)("Dismissed by the operator: no ship takes it any more.")]}}(d,c),className:"text-meta text-muted-foreground max-sm:text-body-touch"})]})]},d.seq)})})}let F="text-section font-semibold text-foreground";function G({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-3 py-2 last:border-b-0",children:[(0,b.jsx)("dt",{className:"w-24 shrink-0 text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 items-center gap-1.5 text-body text-foreground",children:c})]})}function H({message:a}){let c=a.recipient;return(0,b.jsxs)("dl",{"aria-label":"Envelope",className:"overflow-hidden rounded-lg border border-border bg-card",children:[(0,b.jsxs)(G,{label:"Message id",children:[(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.id}),(0,b.jsx)(u.CopyButton,{value:a.id,label:"Copy message id"})]}),(0,b.jsx)(G,{label:"From",children:(0,b.jsx)(y.ShipName,{name:a.sender.name,shipId:a.sender.id,isSuffixShown:a.sender.name!==r.OPERATOR_NAME})}),(0,b.jsx)(G,{label:"To",children:"ship"===c.kind?(0,b.jsx)(y.ShipName,{name:c.ship.name,shipId:c.ship.id,isSuffixShown:c.ship.name!==r.OPERATOR_NAME}):(0,b.jsxs)("span",{children:["Any ship of type ",(0,b.jsx)("span",{className:"font-mono text-id",children:c.type})]})}),(0,b.jsx)(G,{label:"Sent",children:(0,b.jsx)("time",{dateTime:a.sentAt,className:"tabular-nums",children:(0,q.fullDateTime)(new Date(a.sentAt))})}),null===a.model?null:(0,b.jsx)(G,{label:"Model",children:(0,b.jsx)("span",{className:"truncate font-mono text-id","data-testid":"message-model",children:a.model})}),a.inReplyTo?(0,b.jsx)(G,{label:"In reply to",children:(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.inReplyTo})}):null]})}function I({message:a}){let c=(0,p.payloadLabel)(a.payload,a.contentType),d=(0,p.formattedPayload)(a.payload,a.contentType),e=(0,b.jsx)(s.CodeBlock,{label:c,code:a.payload,isWrapped:!0,copyLabel:"Copy payload",codeTestId:"message-payload"});return void 0===d?(0,b.jsxs)("section",{"aria-label":"Payload",className:"flex flex-col gap-2",children:[(0,b.jsx)("h3",{className:F,children:"Payload"}),e]}):(0,b.jsx)("section",{"aria-label":"Payload",className:"flex flex-col gap-2",children:(0,b.jsxs)(f.Tabs,{defaultValue:"formatted",className:"gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsx)("h3",{className:F,children:"Payload"}),(0,b.jsxs)(f.TabsList,{className:"max-sm:w-auto",children:[(0,b.jsx)(f.TabsTrigger,{value:"formatted",children:"Formatted"}),(0,b.jsx)(f.TabsTrigger,{value:"raw",children:"Raw"})]})]}),(0,b.jsx)(f.TabsContent,{value:"formatted",children:(0,b.jsx)(s.CodeBlock,{label:c,code:d,copyValue:a.payload,copyLabel:"Copy payload",codeTestId:"message-payload"})}),(0,b.jsx)(f.TabsContent,{value:"raw",children:e})]})})}function J({message:a}){return(0,b.jsxs)("section",{"aria-label":"Delivery",className:"flex flex-col gap-2 max-sm:order-first",children:[(0,b.jsx)("h3",{className:F,children:"Delivery"}),(0,b.jsx)("div",{className:"rounded-lg border border-border bg-card p-3",children:(0,b.jsx)(E,{entries:a.delivery.history,recipient:a.recipient})})]})}function K(){return(0,b.jsxs)("div",{"aria-busy":!0,className:"flex flex-col gap-4",children:[(0,b.jsx)("span",{className:"sr-only",children:"Loading the message"}),(0,b.jsx)(w.Skeleton,{className:"h-32 w-full rounded-lg"}),(0,b.jsx)(w.Skeleton,{className:"h-28 w-full rounded-lg"}),(0,b.jsx)(w.Skeleton,{className:"h-40 w-full rounded-lg"})]})}function L({message:a,messageId:c,state:d,isOpen:e,onOpenChange:f,onReply:g}){let h="ready"===d&&void 0!==a;return(0,b.jsx)(v.Sheet,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.SheetContent,{side:"right","data-testid":"message-sheet",children:[(0,b.jsx)(v.SheetHeader,{children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(v.SheetTitle,{className:"flex min-w-0 items-baseline gap-1.5",children:[(0,b.jsx)("span",{children:"Message from"}),(0,b.jsx)(y.ShipName,{name:a.sender.name,shipId:a.sender.id,isSuffixShown:a.sender.name!==r.OPERATOR_NAME,className:"text-heading"})]}),(0,b.jsxs)(v.SheetDescription,{children:[(0,b.jsx)(z,{parts:"ship"===a.recipient.kind?[(0,r.text)("To "),(0,r.ship)(a.recipient.ship)]:[(0,r.text)(`To any ship of type ${a.recipient.type}`)]}),". ",(0,A.statusLabel)(a.delivery.state),"."]}),g&&a.sender.name!==r.OPERATOR_NAME?(0,b.jsx)("div",{children:(0,b.jsxs)(t.Button,{size:"xs",icon:(0,b.jsx)(o,{}),"data-testid":"message-reply",onClick:()=>{g(a)},children:["Reply to ",a.sender.name]})}):null]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.SheetTitle,{children:"Message"}),(0,b.jsx)(v.SheetDescription,{children:"not-found"===d?"Couldn’t open this message":"Loading"})]})}),(0,b.jsxs)(v.SheetBody,{className:"flex flex-col gap-5",children:["loading"===d?(0,b.jsx)(K,{}):null,"not-found"===d?(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(m,{}),title:"Message not found",description:(0,b.jsxs)(b.Fragment,{children:["No message with this id exists in this fleet, or the link is incomplete.",c?(0,b.jsx)("span",{className:"mt-2 block font-mono text-id",children:c}):null]})}):null,h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(H,{message:a}),(0,b.jsx)(I,{message:a}),(0,b.jsx)(J,{message:a})]}):null]})]})})}let M={name:"arrow-down-left",size:24,node:[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]};M.node;let N=(0,k.default)(M),O={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};O.node;let P=(0,k.default)(O),Q={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};Q.node;let R=(0,k.default)(Q);var S=a.i(48819),T=a.i(80487);function U(a,b){return RegExp(`"${b}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`).exec(a)?.[1]}let V={"application/vnd.aeolus.squadron.check-in+json":()=>"Checked in at its flagship","application/vnd.aeolus.squadron.role+json":a=>{let b=U(a,"role");return void 0===b?"Given its role":`Given the role: ${b}`},"application/vnd.aeolus.squadron.on-station+json":a=>{let b=U(a,"role");return void 0===b?"Took up its role":`Took up the role: ${b}`},"application/vnd.aeolus.squadron.stand-down+json":()=>"Asked to stand down","application/vnd.aeolus.squadron.stood-down+json":()=>"Stood down"};function W(a,b){return a.sentAt.localeCompare(b.sentAt)||a.id.localeCompare(b.id)}var X=a.i(40392),Y=a.i(50808);function Z({message:a,shipId:c,now:d,onOpenMessage:e}){var f,g,h;let i,j,k=a.sender.id===c,l=new Date(a.sentAt),m=void 0!==(j=V[g=(f=a).contentType,g.split(";")[0]?.trim().toLowerCase()??""])?{text:j(f.preview),isCode:!1}:(0,p.isJson)(f.contentType)?{text:0===(i=function(a){let b,c=[],d=0,e=0;for(;e<a.length;){let f=a[e]??"";if('"'===f){let{value:f,end:g}=function(a,b){let c=b+1;for(;c<a.length&&'"'!==a[c];)c+="\\"===a[c]?2:1;return{value:a.slice(b+1,c),end:c+1}}(a,e);1===d&&void 0===b&&a.slice(g).trimStart().startsWith(":")?b=f:1===d&&void 0!==b&&g<=a.length&&'"'===a[g-1]&&(c.push([b,f]),b=void 0),e=g;continue}if("{"===f||"["===f)1===d&&void 0!==b&&(c.push([b,"…"]),b=void 0),d+=1;else if("}"===f||"]"===f)d-=1;else if(1===d&&void 0!==b&&/[-\dtfn]/.test(f)){let d=/^(-?\d[\d.eE+-]*|true|false|null)/.exec(a.slice(e))?.[1];if(void 0!==d){c.push([b,d]),b=void 0,e+=d.length;continue}}e+=1}return c}(h=f.preview)).length?h:i.map(([a,b])=>`${a} ${b}`).join(" · "),isCode:!0}:{text:f.preview,isCode:!1};return(0,b.jsx)("li",{className:"border-b border-border last:border-b-0",children:(0,b.jsxs)("button",{type:"button","data-testid":"message-row","data-message-id":a.id,"aria-label":`${k?"Sent":"Received"} message: ${m.text}`,className:"flex w-full items-start gap-3 px-3.5 py-3 text-left transition-colors duration-(--duration-fast) hover:bg-accent",onClick:()=>{e(a.id)},children:[(0,b.jsx)("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md border border-tone-ended-border bg-tone-ended-bg text-tone-ended-fg [&_svg]:size-(--size-icon-sm)",children:(0,b.jsx)(k?P:N,{})}),(0,b.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,b.jsxs)("span",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)(z,{parts:k?"ship"===a.recipient.kind?[(0,r.text)("To "),(0,r.ship)(a.recipient.ship)]:[(0,r.text)(`To any ship of type ${a.recipient.type}`)]:[(0,r.text)("From "),(0,r.ship)(a.sender)],className:"text-body text-foreground max-sm:text-body-touch"}),(0,b.jsx)(A.StatusBadge,{status:a.delivery.state})]}),(0,b.jsx)("span",{"data-testid":"message-line",className:(0,T.classNames)("truncate text-muted-foreground",m.isCode?"font-mono text-id":"text-meta"),children:m.text}),(0,b.jsx)("time",{dateTime:a.sentAt,title:(0,q.fullDateTime)(l),className:"text-meta text-muted-foreground tabular-nums",children:(0,q.relativeTime)(l,d)})]})]})})}function $({shipId:a,messages:c,state:d,onRetry:e,now:f,onOpenMessage:g}){return"loading"===d?(0,b.jsx)(Y.LoadingSkeleton,{variant:"list",rows:3,label:"Loading the messages"}):"error"===d?(0,b.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-3",children:[(0,b.jsx)(X.InlineError,{title:"Couldn’t load the messages",description:"The rest of the page is current. Try again in a moment."}),e?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(S.RotateCw,{"aria-hidden":!0}),onClick:e,className:"self-start",children:"Try again"}):null]}):0===c.length?(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(R,{}),title:"No messages yet",description:"Messages this ship sends or receives appear here as they happen."}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:(function(a){let b=new Map(a.map(a=>[a.id,a])),c=new Map;for(let d of a){let a=function(a,b){let c=new Set([a.id]),d=a,e=null===d.inReplyTo?void 0:b.get(d.inReplyTo);for(;e&&!c.has(e.id);)c.add(e.id),e=null===(d=e).inReplyTo?void 0:b.get(d.inReplyTo);return d}(d,b);c.set(a.id,[...c.get(a.id)??[],d])}return[...c.entries()].map(([a,b])=>{let c=b.toSorted(W);return{id:a,messages:c,lastSentAt:c.at(-1)?.sentAt??""}}).toSorted((a,b)=>b.lastSentAt.localeCompare(a.lastSentAt)||b.id.localeCompare(a.id))})(c).map(c=>(0,b.jsx)("section",{"data-testid":"message-thread","aria-label":`Thread of ${String(c.messages.length)} ${1===c.messages.length?"message":"messages"}`,className:"overflow-hidden rounded-lg border border-border bg-card",children:(0,b.jsx)("ol",{children:c.messages.map(c=>(0,b.jsx)(Z,{message:c,shipId:a,now:f,onOpenMessage:g},c.id))})},c.id))})}var _=a.i(38246),aa=a.i(12540),ab=a.i(8219),ac=a.i(75971);function ad({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 bg-card px-3.5 py-3",children:[(0,b.jsx)("dt",{className:"text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-body text-foreground",children:c})]})}function ae({shipId:a,now:c}){let d=(0,aa.useSquadrons)(),e=(0,aa.useCatalogue)(),f=d.data?.find(b=>b.flagship.shipId===a||b.members.some(b=>b.shipId===a));if(!f)return null;let g=(0,b.jsx)(_.default,{href:`/squadrons/${f.id}`,className:"font-mono hover:underline","data-testid":"ship-squadron-link",children:f.id});if(f.flagship.shipId===a)return(0,b.jsxs)("div",{role:"note","data-testid":"ship-flagship-note",className:"flex flex-wrap items-center gap-3 rounded-lg border border-border bg-muted px-3.5 py-3 text-meta text-foreground",children:[(0,b.jsxs)("span",{className:"grow",children:["Flagship of squadron ",g,": the address for work sent to the team. The squadron manager crews it, so it can’t be released, renamed or retired; it retires when the squadron disbands."]}),(0,b.jsx)(t.Button,{size:"xs",nativeButton:!1,render:(0,b.jsx)(_.default,{href:`/squadrons/${f.id}`}),"data-testid":"ship-open-squadron",children:"Open squadron"})]});let h=f.members.find(b=>b.shipId===a);if(!h)return null;let i=e.data?.blueprints.find(a=>a.repository===f.blueprint.repository&&a.name===f.blueprint.name&&a.version===f.blueprint.version),j=i?.roles.find(a=>a.name===h.role)?.template,k=null===h.crew.lastSeenAt?void 0:(0,q.duration)(new Date(h.crew.lastSeenAt),c);return(0,b.jsxs)("div",{className:"flex flex-col gap-3",children:["silent"===h.health&&"disbanded"!==f.state&&(0,b.jsxs)("div",{role:"alert","data-testid":"ship-silent-alert",className:"rounded-lg border border-tone-attention-border bg-tone-attention-bg px-3.5 py-3 text-meta text-foreground",children:[(0,b.jsx)("strong",{className:"font-semibold text-tone-attention-fg",children:void 0===k?"Silent.":`Silent: not seen for ${k}.`})," It checks in"," ",(0,ab.checkInText)(h.checkInMinutes),", so its session has probably stopped. Get a new crew line and start a new session; the old crew line then stops working."]}),(0,b.jsxs)("dl",{"data-testid":"ship-squadron-facts",className:"grid grid-cols-4 gap-px overflow-hidden rounded-lg border border-border bg-border max-sm:grid-cols-2",children:[(0,b.jsxs)(ad,{label:"Squadron",children:[g,(0,b.jsx)(A.StatusBadge,{status:f.state})]}),(0,b.jsxs)(ad,{label:"Role and template",children:[(0,b.jsx)("span",{className:"rounded-sm bg-secondary px-1.5 font-mono text-id",children:h.role}),j&&(0,b.jsxs)(_.default,{href:(0,ab.templatePath)(j),className:"font-mono text-meta hover:underline",children:[j.name,"@",j.version]})]}),(0,b.jsx)(ad,{label:"Health",children:(0,b.jsx)(ac.HealthIndicator,{health:h.health,detail:"silent"===h.health||"late"===h.health?k:void 0})}),(0,b.jsx)(ad,{label:"Hand-offs",children:i?(0,b.jsx)("span",{className:"text-meta",children:(0,ab.handoffsText)((0,ab.handoffsOf)(i,h.role))}):(0,b.jsx)(_.default,{href:(0,ab.blueprintPath)(f.blueprint),className:"text-meta text-muted-foreground hover:underline",children:"See its blueprint"})})]})]})}var af=a.i(73202),ag=a.i(97011),ah=a.i(79762),ai=a.i(93817),aj=a.i(52357),ak=a.i(26766),al=a.i(87005),am=a.i(40108),an=a.i(67042);function ao({harness:a,model:c,testId:d}){return null===a&&null===c?null:(0,b.jsxs)("span",{"data-testid":d,className:"flex min-w-0 flex-wrap items-center gap-x-1 text-meta text-muted-foreground",children:[null===a?null:(0,b.jsx)("span",{children:(0,an.harnessWord)(a)}),null!==a&&null!==c?(0,b.jsx)("span",{"aria-hidden":!0,children:"·"}):null,null===c?null:(0,b.jsx)("span",{className:"truncate font-mono text-id",children:c})]})}var ap=a.i(26955);function aq({ping:a,now:c,testId:d}){return null===a?null:(0,b.jsx)("span",{title:`Pinged ${(0,q.fullDateTime)(new Date(a.sentAt))}`,"data-testid":d,"data-state":a.state,className:"text-meta text-muted-foreground tabular-nums",children:(0,ap.pingLine)(a,c)})}var ar=a.i(41146),as=a.i(45185);function at({details:a,version:c,testId:d}){return(0,b.jsxs)("details",{"data-testid":d,className:"group rounded-lg border border-border bg-card",children:[(0,b.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-3.5 py-2.5 text-meta text-muted-foreground [&::-webkit-details-marker]:hidden",children:[(0,b.jsx)(ar.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 transition-transform group-open:rotate-90"}),(0,b.jsx)("span",{className:"font-medium text-foreground",children:"Report details"}),(0,b.jsxs)("span",{className:"tabular-nums",children:["· version ",c]})]}),(0,b.jsx)("div",{className:"px-3.5 pb-3.5",children:(0,b.jsx)(s.CodeBlock,{label:(0,as.reportDetailsLabel)(a),code:(0,as.reportDetailsJson)(a),copyLabel:"Copy report details",codeTestId:`${d}-code`})})]})}var au=a.i(92717);function av({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 bg-card px-3.5 py-3",children:[(0,b.jsx)("dt",{className:"text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 items-center gap-1.5 text-body text-foreground",children:c})]})}function aw({ship:a,now:c}){let d,e="operator"===a.kind,f=null===a.crewedSince?null:new Date(a.crewedSince),g=new Date(a.commissionedAt);return(0,b.jsxs)("dl",{className:"grid grid-cols-4 gap-px overflow-hidden rounded-lg border border-border bg-border max-sm:grid-cols-2",children:[(0,b.jsx)(av,{label:"Location",children:(0,b.jsxs)("span",{className:"inline-flex min-w-0 flex-col gap-0.5",children:[(0,b.jsx)(am.LocationTag,{kind:a.location?.kind??null,description:a.location?.description,size:"md"}),(0,b.jsx)(ao,{harness:a.harness,model:a.model?.id??null,testId:"ship-model"}),null===a.lastSeenAt?null:(0,b.jsx)("time",{dateTime:a.lastSeenAt,title:(0,q.fullDateTime)(new Date(a.lastSeenAt)),"data-testid":"ship-last-seen",className:"text-meta text-muted-foreground tabular-nums",children:(0,q.lastSeen)(new Date(a.lastSeenAt),c)}),(0,b.jsx)(aq,{ping:a.ping,now:c,testId:"ship-ping-status"}),"agent"!==a.kind?null:(0,b.jsx)(au.ReportLine,{report:a.report,now:c,variant:"full",testId:"ship-report"})]})}),(0,b.jsx)(av,{label:"Crewed since",children:f?(0,b.jsx)("time",{dateTime:a.crewedSince??void 0,title:(0,q.fullDateTime)(f),className:"tabular-nums",children:(d=c.getTime()-f.getTime()<864e5?(0,q.clockTime)(f):(0,q.shortDateTime)(f),`${d} \xb7 ${(0,q.duration)(f,c)}`)}):(0,b.jsx)("span",{className:"text-muted-foreground",children:"Not crewed"})}),(0,b.jsx)(av,{label:"Commissioned",children:(0,b.jsx)("time",{dateTime:a.commissionedAt,title:(0,q.fullDateTime)(g),children:e?`Fleet created ${(0,q.dayDate)(g)}`:(0,q.dayDate)(g)})}),(0,b.jsxs)(av,{label:"Ship id",children:[(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.id}),(0,b.jsx)(u.CopyButton,{value:a.id,label:"Copy ship id"})]})]})}function ax({icon:a,children:c}){return(0,b.jsxs)("p",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted px-3.5 py-2.5 text-meta text-muted-foreground [&_svg]:size-(--size-icon-sm) [&_svg]:shrink-0",children:[a,(0,b.jsx)("span",{children:c})]})}function ay({ship:a,shipId:c,state:d,actions:e,now:f,backHref:g="/"}){if("loading"===d||"ready"===d&&void 0===a)return(0,b.jsxs)("div",{"aria-busy":!0,"data-testid":"ship-header",className:"flex flex-col gap-4",children:[(0,b.jsx)("span",{className:"sr-only",children:"Loading the ship"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(w.Skeleton,{className:"h-8 w-40"}),(0,b.jsx)(w.Skeleton,{className:"h-6 w-20"}),(0,b.jsx)(w.Skeleton,{className:"h-6 w-16"})]}),(0,b.jsx)(w.Skeleton,{className:"h-16 w-full rounded-lg"})]});if("not-found"===d||void 0===a)return(0,b.jsx)("div",{"data-testid":"ship-header",children:(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(ai.CircleAlert,{}),title:"Ship not found",description:(0,b.jsxs)(b.Fragment,{children:["No ship with the id ",c?(0,b.jsx)("span",{className:"font-mono text-id",children:c}):"given"," exists in this fleet. The link may be incomplete. Retired ships keep their page."]}),action:(0,b.jsx)(t.Button,{size:"sm",nativeButton:!1,render:({children:a,...c})=>(0,b.jsx)(_.default,{href:g,...c,children:a}),children:"Back to fleet overview"})})});let h="operator"===a.kind,i="retired"===a.status;return(0,b.jsxs)("div",{"data-testid":"ship-header",className:"flex flex-col gap-4 max-sm:gap-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2.5 max-sm:flex-col max-sm:items-start max-sm:gap-1.5",children:[(0,b.jsx)("h1",{className:"min-w-0",children:(0,b.jsx)(y.ShipName,{name:a.name,shipId:a.id,size:"title",isSuffixShown:i})}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(A.StatusBadge,{status:a.status}),h?(0,b.jsxs)(D.Badge,{variant:"kind",children:[(0,b.jsx)(al.UserRound,{"aria-hidden":!0}),"operator"]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.Badge,{variant:"type",children:a.type}),a.scopes.filter(a=>ag.FLEET_SCOPES.some(b=>b===a)).map(a=>(0,b.jsx)(D.Badge,{variant:"kind","data-testid":"ship-fleet-scope",children:a},a))]}),"awaitingCrew"===a.status&&null===a.startingPrompt?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-meta text-muted-foreground [&_svg]:size-(--size-icon-sm)",children:[(0,b.jsx)(ak.KeyRound,{"aria-hidden":!0}),"No starting prompt issued"]}):null]})]}),e&&!i?(0,b.jsx)("div",{className:(0,T.classNames)("flex flex-wrap items-center gap-2","max-sm:w-full max-sm:[&>*]:flex-1"),children:e}):null]}),h?(0,b.jsx)(ax,{icon:(0,b.jsx)(aj.Info,{"aria-hidden":!0}),children:"argo is your ship. This console session crews it. It can’t be released, renamed or retired."}):null,i&&null!==a.retiredAt?(0,b.jsxs)(ax,{icon:(0,b.jsx)(ah.Archive,{"aria-hidden":!0}),children:["Retired on ",(0,q.fullDateTime)(new Date(a.retiredAt)),". Read-only."]}):null,(0,b.jsx)(aw,{ship:a,now:f}),"agent"===a.kind&&a.report?.details?(0,b.jsx)(at,{details:a.report.details,version:a.report.detailsVersion,testId:"ship-report-details"}):null]})}var az=a.i(59027),aA=a.i(25039);let aB={name:"lock-keyhole",size:24,node:[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]};aB.node;let aC=(0,k.default)(aB),aD={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};aD.node;let aE=(0,k.default)(aD);var aF=a.i(57230);let aG={name:"mail-check",size:24,node:[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]};aG.node;let aH=(0,k.default)(aG),aI={name:"mail-minus",size:24,node:[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]};aI.node;let aJ=(0,k.default)(aI),aK={name:"mail-x",size:24,node:[["path",{d:"M22 12.532V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8.792",key:"8lpqwp"}],["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["path",{d:"m16.5 16.5 5 5",key:"zc9lw7"}],["path",{d:"m21.5 16.5-5 5",key:"1empo3"}]]};aK.node;let aL=(0,k.default)(aK),aM={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};aM.node;let aN=(0,k.default)(aM),aO={name:"package-x",size:24,node:[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16.5 14.5 5 5",key:"ozpm51"}],["path",{d:"m16.5 19.5 5-5",key:"syf6b9"}],["path",{d:"M21 10.5V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.13-.074",key:"isw6gs"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]]};aO.node;let aP=(0,k.default)(aO),aQ={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};aQ.node;let aR=(0,k.default)(aQ),aS={name:"shield-alert",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]};aS.node;let aT=(0,k.default)(aS);var aU=a.i(23422),aV=a.i(98959),aW=a.i(90407);function aX(a,b){let c=a.details[b];return"string"==typeof c?c:void 0}function aY(a){return a?[(0,r.text)(" by "),(0,r.ship)(a)]:[]}let aZ={deregistered:"Its session deregistered.",takenOver:"Taken over by a new console session.",signedOut:"The operator signed out.",passwordReset:"Its session ended with the operator password reset.",retired:"Its session ended: the ship was retired."};function a$(a){return null!==a.message&&(0,aV.isPingContentType)(a.message.contentType)}function a_(a){return a.message?[(0,r.text)(a$(a)?"a ping from ":"a message from "),(0,r.ship)(a.message.sender)]:[(0,r.text)("a message")]}function a0(a){let[b,...c]=a_(a);return b?.kind==="text"?[(0,r.text)((0,r.capitalised)(b.text)),...c]:a_(a)}function a1(a,b){let{shipId:c,verb:d}=b,e=a.actor;return[...null===e||e.id===c?[(0,r.text)((0,r.capitalised)(d))]:[(0,r.ship)(e),(0,r.text)(` ${d}`)],(0,r.text)(" "),...a_(a)]}let a2={received:N,sent:P,claimed:aE,released:aF.LogOut,prompt:ak.KeyRound,commissioned:aA.Flag,acknowledged:aH,returned:aU.Undo2,undeliverable:aL,secret:aC,fleet:az.Anchor,password:aT,retired:ah.Archive,abandoned:aP,dismissed:aJ,renamed:aR,reported:aN},a3={waiting:"border-tone-waiting-border bg-tone-waiting-bg text-tone-waiting-fg",active:"border-tone-active-border bg-tone-active-bg text-tone-active-fg",ok:"border-tone-ok-border bg-tone-ok-bg text-tone-ok-fg",attention:"border-tone-attention-border bg-tone-attention-bg text-tone-attention-fg",ended:"border-tone-ended-border bg-tone-ended-bg text-tone-ended-fg"},a4="flex w-full gap-3 px-3.5 py-3 text-left";function a5({entry:a,shipId:c,now:d,onOpenMessage:e}){let{parts:f,tone:g,icon:h}=function(a,b){switch(a.type){case"FleetInitialised":return{parts:[(0,r.text)("Fleet initialised")],tone:"ended",icon:"fleet"};case"ShipCommissioned":{let b=aX(a,"type");return{parts:[(0,r.text)("Commissioned"),...aY(a.actor),...void 0===b?[]:[(0,r.text)(` as ${b}`)]],tone:"ended",icon:"commissioned"}}case"StartingPromptIssued":return{parts:[(0,r.text)("Starting prompt issued")],tone:"ended",icon:"prompt"};case"ShipClaimed":return{parts:[(0,r.text)(`Claimed by a session on ${function(a){let b=aX(a,"locationDescription");if(void 0!==b&&""!==b)return b;let c=aX(a,"location");return"DEVICE"===c||"CLOUD"===c||"SERVER"===c||"OTHER"===c?(0,B.locationKindWord)(c):"an unknown location"}(a)}`)],tone:"ok",icon:"claimed"};case"LeaseRevoked":let c,d;return{parts:[..."released"===(c=aX(a,"reason")??"")?[(0,r.text)("Released"),...aY(a.actor),(0,r.text)(".")]:[(0,r.text)(aZ[c]??"Its session ended.")],..."number"==typeof(d=a.details.returnedDeliveries)&&d>0?[(0,r.text)(` ${(0,r.counted)(d,{one:"in-flight delivery",many:"in-flight deliveries"})} went back to pending.`)]:[]],tone:"waiting",icon:"released"};case"CredentialRevoked":return{parts:[(0,r.text)("Secret invalidated")],tone:"ended",icon:"secret"};case"OperatorPasswordReset":return{parts:[(0,r.text)("Operator password reset")],tone:"waiting",icon:"password"};case"FleetLimitsChanged":return{parts:[(0,r.text)("Fleet limits changed")],tone:"ended",icon:"fleet"};case"SignInTicketIssued":return{parts:[(0,r.text)("Sign-in ticket issued")],tone:"ended",icon:"password"};case"ViewerSessionStarted":return{parts:[(0,r.text)("Someone started viewing the fleet")],tone:"ended",icon:"password"};case"CrewRequested":return{parts:[(0,r.text)("Crew requested"),...aY(a.actor)],tone:"waiting",icon:"claimed"};case"CrewRequestRemoved":return{parts:[(0,r.text)("Crew request removed"),...aY(a.actor)],tone:"ended",icon:"released"};case"CrewRequestExplained":{let b=aX(a,"reason");return{parts:[(0,r.text)(void 0===b?"Crew request can not be placed yet":`Crew request can not be placed: ${b}`),...aY(a.actor)],tone:"waiting",icon:"reported"}}case"CrewAssigned":return{parts:[(0,r.text)("Crew request assigned"),...aY(a.actor)],tone:"waiting",icon:"claimed"};case"CrewStatusChanged":{let b=aX(a,"status");return{parts:[(0,r.text)(void 0===b?"Crew status changed":`Crew ${b}`),...aY(a.actor)],tone:"crashed"===b?"attention":"active",icon:"reported"}}case"MessageAccepted":let e;return{parts:(e=a.message)?a$(a)&&"ship"===e.recipient.kind?e.sender.id===b?[(0,r.text)("Pinged "),(0,r.ship)(e.recipient.ship)]:[(0,r.text)("Pinged by "),(0,r.ship)(e.sender)]:e.sender.id===b?"ship"===e.recipient.kind?[(0,r.text)("Sent a message to "),(0,r.ship)(e.recipient.ship)]:[(0,r.text)(`Sent a message to any ship of type ${e.recipient.type}`)]:[(0,r.text)("Received a message from "),(0,r.ship)(e.sender)]:[(0,r.text)("A message was sent")],tone:"ended",icon:a.message?.sender.id===b?"sent":"received"};case"DeliveryClaimed":return{parts:a1(a,{shipId:b,verb:"took"}),tone:"active",icon:"received"};case"DeliveryAcknowledged":return{parts:"pong"===aX(a,"answer")?[...a1(a,{shipId:b,verb:"answered"}),(0,r.text)(" with pong")]:a1(a,{shipId:b,verb:"acknowledged"}),tone:"ok",icon:"acknowledged"};case"DeliveryReturned":return{parts:[...a0(a),(0,r.text)(" went back to pending")],tone:"waiting",icon:"returned"};case"DeliveryUndeliverable":return{parts:[...a0(a),(0,r.text)(" became undeliverable")],tone:"attention",icon:"undeliverable"};case"ShipRetired":{let b=a.details.abandonedDeliveries;return{parts:[(0,r.text)("Retired"),...aY(a.actor),(0,r.text)("."),..."number"==typeof b&&b>0?[(0,r.text)(` ${(0,r.counted)(b,{one:"delivery",many:"deliveries"})} abandoned.`)]:[]],tone:"ended",icon:"retired"}}case"DeliveryAbandoned":return{parts:[...a0(a),(0,r.text)(" was abandoned")],tone:"ended",icon:"abandoned"};case"ShipReported":{let b=aX(a,"state")??"in",c=aX(a,"note");return{parts:[(0,r.text)(void 0===c?`Reported ${b}`:`Reported ${b}: ${c}`)],tone:aW.REPORT_STATES.some(a=>a===b)?as.REPORT_TONES[b]:"ended",icon:"reported"}}case"ShipRenamed":{let b=aX(a,"from"),c=aX(a,"to");return{parts:[(0,r.text)(void 0===b||void 0===c?"Renamed":`Renamed from ${b} to ${c}`),...aY(a.actor)],tone:"ended",icon:"renamed"}}case"DeliveryDismissed":return{parts:[...a0(a),(0,r.text)(" was dismissed"),...aY(a.actor)],tone:"ended",icon:"dismissed"}}}(a,c),i=a2[h],j=new Date(a.occurredAt),k=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{"aria-hidden":!0,className:(0,T.classNames)("flex size-7 shrink-0 items-center justify-center rounded-md border [&_svg]:size-(--size-icon-sm)",a3[g]),children:(0,b.jsx)(i,{})}),(0,b.jsxs)("span",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsx)(z,{parts:f,className:"text-body text-foreground max-sm:text-body-touch"}),(0,b.jsx)("time",{dateTime:a.occurredAt,title:(0,q.fullDateTime)(j),className:"text-meta text-muted-foreground tabular-nums",children:(0,q.relativeTime)(j,d)})]})]}),{message:l}=a;return(0,b.jsx)("li",{"data-testid":"ship-timeline-entry","data-type":a.type,className:"border-b border-border last:border-b-0",children:l?(0,b.jsx)("button",{type:"button",className:(0,T.classNames)(a4,"transition-colors duration-(--duration-fast) hover:bg-accent"),onClick:()=>{e(l.id)},children:k}):(0,b.jsx)("div",{className:a4,children:k})})}function a6({shipId:a,entries:c,state:d,onRetry:e,now:f,onOpenMessage:g}){return"loading"===d?(0,b.jsx)(Y.LoadingSkeleton,{variant:"list",rows:4,label:"Loading the timeline"}):"error"===d?(0,b.jsxs)("div",{"data-testid":"ship-timeline",className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-3",children:[(0,b.jsx)(X.InlineError,{title:"Couldn’t load the timeline",description:"The rest of the page is current. Try again in a moment."}),e?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(S.RotateCw,{"aria-hidden":!0}),onClick:e,className:"self-start",children:"Try again"}):null]}):(0,b.jsxs)("div",{"data-testid":"ship-timeline",className:"overflow-hidden rounded-lg border border-border bg-card",children:[(0,b.jsx)("ol",{"aria-label":"Timeline",children:c.map(c=>(0,b.jsx)(a5,{entry:c,shipId:a,now:f,onOpenMessage:g},c.id))}),c.length<=1?(0,b.jsx)("p",{className:"border-t border-border px-3.5 py-3 text-center text-meta text-muted-foreground first:border-t-0",children:"Nothing else yet. Claims, releases and messages appear here as they happen."}):null]})}var a7=a.i(26110),a8=a.i(65563),a9=a.i(91154),ba=a.i(26949),bb=a.i(67336),bc=a.i(10023),bd=a.i(68450),be=a.i(94764),bf=a.i(10572),bg=a.i(99929),bh=a.i(54763);let bi="timeline",bj="messages";function bk(a){return Array.isArray(a)?a[0]:a}function bl({shipId:a,searchParams:k}){let l=(0,d.useRouter)(),m=(0,bd.useNow)(),n=bk(k.tab)===bj?bj:bi,o=(0,c.idSchema)("message").safeParse(bk(k.message)),p=o.success?o.data:void 0,q=(0,bg.useShip)(a),r=(0,bg.useShipTimeline)(a),s=(0,bg.useShipMessages)(a),t=(0,bg.useMessage)(p),u=(0,bb.useLiveFleet)(),v=(0,be.useAccountMenu)(m),w=(0,bh.useHasSquadrons)(),x=(0,aa.useSquadrons)(),y=(0,ba.useOpenInboxCount)(),z=(0,a8.useAccess)(),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(),G=(0,bc.useAttentionCount)();(0,bf.useSignInWhenSessionEnds)([q.error,r.error,s.error,t.error,u.error]);let H=b=>{let c,d;l.replace((c=new URLSearchParams,b.tab!==bi&&c.set("tab",b.tab),void 0!==b.messageId&&c.set("message",b.messageId),""===(d=c.toString())?`/ships/${a}`:`/ships/${a}?${d}`),{scroll:!1})},I=a=>{H({tab:n,messageId:a})},J="NOT_FOUND"===(0,a9.trpcErrorCode)(q.error),K=(0,ab.shipsInSquadrons)(x.data??[]).get(a);return(0,b.jsx)(a7.DetailLayout,{title:q.data?.name??"Ship",parents:K?[{href:"/squadrons",label:"Squadrons"},{href:`/squadrons/${K.squadronId}`,label:K.squadronId}]:[{href:"/",label:"Fleet overview"}],live:u.live,nav:{active:"overview",inboxCount:y,attentionCount:G,hasSquadrons:w,hasSettings:w&&z.canManage},onCompose:z.canSend?()=>{B(!0)}:void 0,onSearch:()=>{D(!0)},account:v,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j.ConsoleNotices,{}),(0,b.jsx)(i.ConsoleGuide,{})]}),header:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ay,{ship:q.data,shipId:a,state:J?"not-found":q.data?"ready":"loading",now:m,actions:q.data?(0,b.jsx)(af.ShipActions,{ship:q.data}):void 0}),J?null:(0,b.jsx)(ae,{shipId:a,now:m})]}),sheet:(0,b.jsx)(L,{message:t.data,messageId:p,state:"NOT_FOUND"===(0,a9.trpcErrorCode)(t.error)?"not-found":t.data?"ready":"loading",isOpen:void 0!==p,onOpenChange:a=>{a||H({tab:n})},onReply:z.canSend?a=>{F({messageId:a.id,sender:a.sender})}:void 0}),children:(0,b.jsxs)(b.Fragment,{children:[J?null:(0,b.jsxs)(f.Tabs,{value:n,onValueChange:a=>{H({tab:a===bj?bj:bi,messageId:p})},children:[(0,b.jsxs)(f.TabsList,{variant:"line","aria-label":`${q.data?.name??"Ship"} history`,children:[(0,b.jsx)(f.TabsTrigger,{variant:"line",value:bi,children:"Timeline"}),(0,b.jsx)(f.TabsTrigger,{variant:"line",value:bj,children:"Messages"})]}),(0,b.jsx)(f.TabsContent,{value:bi,className:"pt-4",children:(0,b.jsx)(a6,{shipId:a,entries:r.data??[],state:r.isError?"error":r.data?"ready":"loading",onRetry:()=>{r.refetch()},now:m,onOpenMessage:I})}),(0,b.jsx)(f.TabsContent,{value:bj,className:"pt-4",children:(0,b.jsx)($,{shipId:a,messages:s.data??[],state:s.isError?"error":s.data?"ready":"loading",onRetry:()=>{s.refetch()},now:m,onOpenMessage:I})})]}),(0,b.jsx)(g.ComposeMessage,{isOpen:A,onOpenChange:B}),(0,b.jsx)(g.ComposeMessage,{isOpen:void 0!==E,onOpenChange:a=>{a||F(void 0)},replyTo:E}),(0,b.jsx)(h.ConsoleCommands,{isOpen:C,onOpenChange:D,onCompose:()=>{B(!0)}})]})})}a.s(["default",0,function({params:a,searchParams:d}){let f=(0,c.idSchema)("ship").safeParse((0,e.use)(a).shipId),g=(0,e.use)(d),h=f.success?f.data:(0,c.idSchema)("ship").parse(`shp_${"0".repeat(26)}`);return(0,b.jsx)(bl,{shipId:h,searchParams:g})}],830)}];
1
+ module.exports=[830,a=>{"use strict";var b=a.i(87924);a.i(23600);var c=a.i(2811),d=a.i(50944),e=a.i(72131),f=a.i(94777),g=a.i(15439),h=a.i(2549),i=a.i(83786),j=a.i(68698),k=a.i(64831);let l={name:"mail-question-mark",size:24,node:[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]],aliases:["mail-question"]};l.node;let m=(0,k.default)(l),n={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};n.node;let o=(0,k.default)(n);var p=a.i(9854),q=a.i(72872),r=a.i(31429),s=a.i(84980),t=a.i(12068),u=a.i(82314),v=a.i(4838),w=a.i(33809),x=a.i(24173),y=a.i(90468);function z({parts:a,className:c}){let d;return(0,b.jsx)("span",{className:c,children:(d=new Map,a.map(a=>{let b="text"===a.kind?`text:${a.text}`:`ship:${a.party.id}`,c=d.get(b)??0;return d.set(b,c+1),{key:`${b}#${String(c)}`,part:a}})).map(({key:a,part:c})=>"text"===c.kind?(0,b.jsx)("span",{children:c.text},a):(0,b.jsx)(y.ShipName,{name:c.party.name,shipId:c.party.id,isSuffixShown:c.party.name!==r.OPERATOR_NAME,className:"align-baseline"},a))})}var A=a.i(23063),B=a.i(29703);function C(a){return a.ship?[(0,r.ship)(a.ship)]:[(0,r.text)("a ship")]}var D=a.i(76166);function E({entries:a,recipient:c}){return(0,b.jsx)("ol",{"data-testid":"delivery-history","aria-label":"Delivery history",className:"flex flex-col",children:a.map((d,e)=>{let f=new Date(d.occurredAt);return(0,b.jsxs)("li",{"data-testid":"delivery-history-entry","data-type":d.type,className:"relative flex gap-3 pb-4 last:pb-0",children:[(0,b.jsxs)("span",{"aria-hidden":!0,className:"relative flex w-3 shrink-0 justify-center",children:[(0,b.jsx)("span",{className:"mt-1.5 size-2.5 rounded-full border-2 border-muted-foreground bg-card"}),e<a.length-1?(0,b.jsx)("span",{className:"absolute top-5 bottom-[-0.25rem] w-px bg-border"}):null]}),(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(A.StatusBadge,{status:function(a){switch(a.type){case"MessageAccepted":case"DeliveryReturned":return"pending";case"DeliveryClaimed":return"delivered";case"DeliveryAcknowledged":return"acknowledged";case"DeliveryUndeliverable":return"undeliverable";case"DeliveryAbandoned":return"abandoned";case"DeliveryDismissed":return"dismissed"}}(d)}),(0,b.jsx)("time",{dateTime:d.occurredAt,title:(0,q.fullDateTime)(f),className:"font-mono text-id text-muted-foreground tabular-nums",children:(0,q.secondsTime)(f)}),0===e?(0,b.jsx)(D.Badge,{variant:"outline",children:"Current"}):null]}),(0,b.jsx)(z,{parts:function(a,b){switch(a.type){case"MessageAccepted":return"ship"===b.kind?[(0,r.text)("Stored in the inbox of "),(0,r.ship)(b.ship),(0,r.text)(".")]:[(0,r.text)(`Queued for any ship of type ${b.type}.`)];case"DeliveryClaimed":{let b=null!==a.attempts&&a.attempts>1?`Attempt ${String(a.attempts)}: claimed`:"Claimed";return[(0,r.text)(`${b} by `),...C(a),...function(a){if(null===a)return[];let b=null!==a.description&&""!==a.description?a.description:(0,B.locationKindWord)(a.kind);return[(0,r.text)(`, session on ${b}`)]}(a.location),(0,r.text)(".")]}case"DeliveryReturned":return"ship"===b.kind?[(0,r.text)("Back in the inbox: the session of "),...C(a),(0,r.text)(" ended before acknowledging it.")]:[(0,r.text)("Returned to the queue: the session of "),...C(a),(0,r.text)(" ended before acknowledging it.")];case"DeliveryAcknowledged":return[(0,r.text)("Acknowledged by "),...C(a),(0,r.text)(".")];case"DeliveryUndeliverable":return[(0,r.text)(null===a.attempts?"Never acknowledged: no ship takes it automatically any more.":`Received ${String(a.attempts)} times, never acknowledged.`)];case"DeliveryAbandoned":return[(0,r.text)("Abandoned: "),...C(a),(0,r.text)(" was retired before taking it.")];case"DeliveryDismissed":return[(0,r.text)("Dismissed by the operator: no ship takes it any more.")]}}(d,c),className:"text-meta text-muted-foreground max-sm:text-body-touch"})]})]},d.seq)})})}let F="text-section font-semibold text-foreground";function G({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-3 py-2 last:border-b-0",children:[(0,b.jsx)("dt",{className:"w-24 shrink-0 text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 items-center gap-1.5 text-body text-foreground",children:c})]})}function H({message:a}){let c=a.recipient;return(0,b.jsxs)("dl",{"aria-label":"Envelope",className:"overflow-hidden rounded-lg border border-border bg-card",children:[(0,b.jsxs)(G,{label:"Message id",children:[(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.id}),(0,b.jsx)(u.CopyButton,{value:a.id,label:"Copy message id"})]}),(0,b.jsx)(G,{label:"From",children:(0,b.jsx)(y.ShipName,{name:a.sender.name,shipId:a.sender.id,isSuffixShown:a.sender.name!==r.OPERATOR_NAME})}),(0,b.jsx)(G,{label:"To",children:"ship"===c.kind?(0,b.jsx)(y.ShipName,{name:c.ship.name,shipId:c.ship.id,isSuffixShown:c.ship.name!==r.OPERATOR_NAME}):(0,b.jsxs)("span",{children:["Any ship of type ",(0,b.jsx)("span",{className:"font-mono text-id",children:c.type})]})}),(0,b.jsx)(G,{label:"Sent",children:(0,b.jsx)("time",{dateTime:a.sentAt,className:"tabular-nums",children:(0,q.fullDateTime)(new Date(a.sentAt))})}),null===a.model?null:(0,b.jsx)(G,{label:"Model",children:(0,b.jsx)("span",{className:"truncate font-mono text-id","data-testid":"message-model",children:a.model})}),a.inReplyTo?(0,b.jsx)(G,{label:"In reply to",children:(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.inReplyTo})}):null]})}function I({message:a}){let c=(0,p.payloadLabel)(a.payload,a.contentType),d=(0,p.formattedPayload)(a.payload,a.contentType),e=(0,b.jsx)(s.CodeBlock,{label:c,code:a.payload,isWrapped:!0,copyLabel:"Copy payload",codeTestId:"message-payload"});return void 0===d?(0,b.jsxs)("section",{"aria-label":"Payload",className:"flex flex-col gap-2",children:[(0,b.jsx)("h3",{className:F,children:"Payload"}),e]}):(0,b.jsx)("section",{"aria-label":"Payload",className:"flex flex-col gap-2",children:(0,b.jsxs)(f.Tabs,{defaultValue:"formatted",className:"gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsx)("h3",{className:F,children:"Payload"}),(0,b.jsxs)(f.TabsList,{className:"max-sm:w-auto",children:[(0,b.jsx)(f.TabsTrigger,{value:"formatted",children:"Formatted"}),(0,b.jsx)(f.TabsTrigger,{value:"raw",children:"Raw"})]})]}),(0,b.jsx)(f.TabsContent,{value:"formatted",children:(0,b.jsx)(s.CodeBlock,{label:c,code:d,copyValue:a.payload,copyLabel:"Copy payload",codeTestId:"message-payload"})}),(0,b.jsx)(f.TabsContent,{value:"raw",children:e})]})})}function J({message:a}){return(0,b.jsxs)("section",{"aria-label":"Delivery",className:"flex flex-col gap-2 max-sm:order-first",children:[(0,b.jsx)("h3",{className:F,children:"Delivery"}),(0,b.jsx)("div",{className:"rounded-lg border border-border bg-card p-3",children:(0,b.jsx)(E,{entries:a.delivery.history,recipient:a.recipient})})]})}function K(){return(0,b.jsxs)("div",{"aria-busy":!0,className:"flex flex-col gap-4",children:[(0,b.jsx)("span",{className:"sr-only",children:"Loading the message"}),(0,b.jsx)(w.Skeleton,{className:"h-32 w-full rounded-lg"}),(0,b.jsx)(w.Skeleton,{className:"h-28 w-full rounded-lg"}),(0,b.jsx)(w.Skeleton,{className:"h-40 w-full rounded-lg"})]})}function L({message:a,messageId:c,state:d,isOpen:e,onOpenChange:f,onReply:g}){let h="ready"===d&&void 0!==a;return(0,b.jsx)(v.Sheet,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.SheetContent,{side:"right","data-testid":"message-sheet",children:[(0,b.jsx)(v.SheetHeader,{children:h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(v.SheetTitle,{className:"flex min-w-0 items-baseline gap-1.5",children:[(0,b.jsx)("span",{children:"Message from"}),(0,b.jsx)(y.ShipName,{name:a.sender.name,shipId:a.sender.id,isSuffixShown:a.sender.name!==r.OPERATOR_NAME,className:"text-heading"})]}),(0,b.jsxs)(v.SheetDescription,{children:[(0,b.jsx)(z,{parts:"ship"===a.recipient.kind?[(0,r.text)("To "),(0,r.ship)(a.recipient.ship)]:[(0,r.text)(`To any ship of type ${a.recipient.type}`)]}),". ",(0,A.statusLabel)(a.delivery.state),"."]}),g&&a.sender.name!==r.OPERATOR_NAME?(0,b.jsx)("div",{children:(0,b.jsxs)(t.Button,{size:"xs",icon:(0,b.jsx)(o,{}),"data-testid":"message-reply",onClick:()=>{g(a)},children:["Reply to ",a.sender.name]})}):null]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.SheetTitle,{children:"Message"}),(0,b.jsx)(v.SheetDescription,{children:"not-found"===d?"Couldn’t open this message":"Loading"})]})}),(0,b.jsxs)(v.SheetBody,{className:"flex flex-col gap-5",children:["loading"===d?(0,b.jsx)(K,{}):null,"not-found"===d?(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(m,{}),title:"Message not found",description:(0,b.jsxs)(b.Fragment,{children:["No message with this id exists in this fleet, or the link is incomplete.",c?(0,b.jsx)("span",{className:"mt-2 block font-mono text-id",children:c}):null]})}):null,h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(H,{message:a}),(0,b.jsx)(I,{message:a}),(0,b.jsx)(J,{message:a})]}):null]})]})})}let M={name:"arrow-down-left",size:24,node:[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]};M.node;let N=(0,k.default)(M),O={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};O.node;let P=(0,k.default)(O),Q={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};Q.node;let R=(0,k.default)(Q);var S=a.i(48819),T=a.i(80487);function U(a,b){return RegExp(`"${b}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)"`).exec(a)?.[1]}let V={"application/vnd.aeolus.squadron.check-in+json":()=>"Checked in at its flagship","application/vnd.aeolus.squadron.role+json":a=>{let b=U(a,"role");return void 0===b?"Given its role":`Given the role: ${b}`},"application/vnd.aeolus.squadron.on-station+json":a=>{let b=U(a,"role");return void 0===b?"Took up its role":`Took up the role: ${b}`},"application/vnd.aeolus.squadron.stand-down+json":()=>"Asked to stand down","application/vnd.aeolus.squadron.stood-down+json":()=>"Stood down"};function W(a,b){return a.sentAt.localeCompare(b.sentAt)||a.id.localeCompare(b.id)}var X=a.i(40392),Y=a.i(50808);function Z({message:a,shipId:c,now:d,onOpenMessage:e}){var f,g,h;let i,j,k=a.sender.id===c,l=new Date(a.sentAt),m=void 0!==(j=V[g=(f=a).contentType,g.split(";")[0]?.trim().toLowerCase()??""])?{text:j(f.preview),isCode:!1}:(0,p.isJson)(f.contentType)?{text:0===(i=function(a){let b,c=[],d=0,e=0;for(;e<a.length;){let f=a[e]??"";if('"'===f){let{value:f,end:g}=function(a,b){let c=b+1;for(;c<a.length&&'"'!==a[c];)c+="\\"===a[c]?2:1;return{value:a.slice(b+1,c),end:c+1}}(a,e);1===d&&void 0===b&&a.slice(g).trimStart().startsWith(":")?b=f:1===d&&void 0!==b&&g<=a.length&&'"'===a[g-1]&&(c.push([b,f]),b=void 0),e=g;continue}if("{"===f||"["===f)1===d&&void 0!==b&&(c.push([b,"…"]),b=void 0),d+=1;else if("}"===f||"]"===f)d-=1;else if(1===d&&void 0!==b&&/[-\dtfn]/.test(f)){let d=/^(-?\d[\d.eE+-]*|true|false|null)/.exec(a.slice(e))?.[1];if(void 0!==d){c.push([b,d]),b=void 0,e+=d.length;continue}}e+=1}return c}(h=f.preview)).length?h:i.map(([a,b])=>`${a} ${b}`).join(" · "),isCode:!0}:{text:f.preview,isCode:!1};return(0,b.jsx)("li",{className:"border-b border-border last:border-b-0",children:(0,b.jsxs)("button",{type:"button","data-testid":"message-row","data-message-id":a.id,"aria-label":`${k?"Sent":"Received"} message: ${m.text}`,className:"flex w-full items-start gap-3 px-3.5 py-3 text-left transition-colors duration-(--duration-fast) hover:bg-accent",onClick:()=>{e(a.id)},children:[(0,b.jsx)("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md border border-tone-ended-border bg-tone-ended-bg text-tone-ended-fg [&_svg]:size-(--size-icon-sm)",children:(0,b.jsx)(k?P:N,{})}),(0,b.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,b.jsxs)("span",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)(z,{parts:k?"ship"===a.recipient.kind?[(0,r.text)("To "),(0,r.ship)(a.recipient.ship)]:[(0,r.text)(`To any ship of type ${a.recipient.type}`)]:[(0,r.text)("From "),(0,r.ship)(a.sender)],className:"text-body text-foreground max-sm:text-body-touch"}),(0,b.jsx)(A.StatusBadge,{status:a.delivery.state})]}),(0,b.jsx)("span",{"data-testid":"message-line",className:(0,T.classNames)("truncate text-muted-foreground",m.isCode?"font-mono text-id":"text-meta"),children:m.text}),(0,b.jsx)("time",{dateTime:a.sentAt,title:(0,q.fullDateTime)(l),className:"text-meta text-muted-foreground tabular-nums",children:(0,q.relativeTime)(l,d)})]})]})})}function $({shipId:a,messages:c,state:d,onRetry:e,now:f,onOpenMessage:g}){return"loading"===d?(0,b.jsx)(Y.LoadingSkeleton,{variant:"list",rows:3,label:"Loading the messages"}):"error"===d?(0,b.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-3",children:[(0,b.jsx)(X.InlineError,{title:"Couldn’t load the messages",description:"The rest of the page is current. Try again in a moment."}),e?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(S.RotateCw,{"aria-hidden":!0}),onClick:e,className:"self-start",children:"Try again"}):null]}):0===c.length?(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(R,{}),title:"No messages yet",description:"Messages this ship sends or receives appear here as they happen."}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:(function(a){let b=new Map(a.map(a=>[a.id,a])),c=new Map;for(let d of a){let a=function(a,b){let c=new Set([a.id]),d=a,e=null===d.inReplyTo?void 0:b.get(d.inReplyTo);for(;e&&!c.has(e.id);)c.add(e.id),e=null===(d=e).inReplyTo?void 0:b.get(d.inReplyTo);return d}(d,b);c.set(a.id,[...c.get(a.id)??[],d])}return[...c.entries()].map(([a,b])=>{let c=b.toSorted(W);return{id:a,messages:c,lastSentAt:c.at(-1)?.sentAt??""}}).toSorted((a,b)=>b.lastSentAt.localeCompare(a.lastSentAt)||b.id.localeCompare(a.id))})(c).map(c=>(0,b.jsx)("section",{"data-testid":"message-thread","aria-label":`Thread of ${String(c.messages.length)} ${1===c.messages.length?"message":"messages"}`,className:"overflow-hidden rounded-lg border border-border bg-card",children:(0,b.jsx)("ol",{children:c.messages.map(c=>(0,b.jsx)(Z,{message:c,shipId:a,now:f,onOpenMessage:g},c.id))})},c.id))})}var _=a.i(65563),aa=a.i(6071),ab=a.i(96082),ac=a.i(90146),ad=a.i(65230),ae=a.i(82611),af=a.i(38058),ag=a.i(93454),ah=a.i(88191),ai=a.i(58864),aj=a.i(11708),ak=a.i(73370),al=a.i(8311),am=a.i(26766),an=a.i(62140),ao=a.i(58983),ap=a.i(58724),aq=a.i(13931),ar=a.i(33838),as=a.i(23636),at=a.i(38246),au=a.i(67042),av=a.i(36501);let aw={request:"Couldn’t request crew",remove:"Couldn’t remove the request",restart:"Couldn’t restart the crew"};function ax({at:a,now:c,children:d}){return(0,b.jsx)("time",{dateTime:a,title:(0,q.fullDateTime)(new Date(a)),className:"tabular-nums",children:d??(0,q.sinceTime)(new Date(a),c)})}function ay({trierarch:a,hasTrierarchs:c}){return(0,b.jsxs)(at.default,{href:c?`/trierarchs/${a.id}`:`/ships/${a.id}`,"data-testid":"crew-request-trierarch",className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground underline decoration-input underline-offset-3 [&_svg]:size-(--size-icon-sm) [&_svg]:shrink-0 [&_svg]:text-muted-foreground",children:[(0,b.jsx)(as.ShipWheel,{"aria-hidden":!0}),(0,b.jsx)("span",{className:"truncate",children:a.name})]})}function az({requestedBy:a,requestedAt:c,now:d}){let e=null===a?null:a.name===r.OPERATOR_NAME?"you":a.name;return(0,b.jsxs)("span",{"data-testid":"crew-request-requested-by",children:[null===e?"Requested ":`Requested by ${e} `,(0,b.jsx)(ax,{at:c,now:d,children:(0,q.relativeTime)(new Date(c),d)}),"."]})}let aA={note:"border-border bg-muted text-muted-foreground",waiting:"border-tone-waiting-border bg-tone-waiting-bg text-tone-waiting-fg",attention:"border-tone-attention-border bg-tone-attention-bg text-tone-attention-fg"};function aB({tone:a,icon:c,children:d}){return(0,b.jsxs)("div",{role:"attention"===a?"alert":"waiting"===a?"status":"note","data-testid":"crew-request-note",className:`flex items-start gap-2 rounded-lg border px-3 py-2.5 text-meta [&_svg]:mt-0.5 [&_svg]:size-(--size-icon-sm) [&_svg]:shrink-0 ${aA[a]}`,children:[c,(0,b.jsx)("span",{children:d})]})}function aC({stage:a,now:c}){let d="running"===a.status?a.startedAt:null,e=(0,aa.restartWords)(a);return null===d&&void 0===e?null:(0,b.jsxs)("span",{className:"text-meta text-muted-foreground","data-testid":"crew-request-session",children:[null===d?null:(0,b.jsxs)(b.Fragment,{children:["since ",(0,b.jsx)(ax,{at:d,now:c})]}),null!==d&&void 0!==e?" · ":null,e]})}function aD({rows:a,machineLabels:c=[]}){return(0,b.jsxs)("dl",{"data-testid":"crew-request-settings",className:"grid grid-cols-[repeat(auto-fill,minmax(8.5rem,1fr))] gap-x-5 gap-y-3 border-t border-border pt-3",children:[a.map(a=>(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,b.jsx)("dt",{className:"text-caption font-medium text-muted-foreground",children:a.label}),(0,b.jsxs)("dd",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-body font-medium",children:[null===a.value?(0,b.jsx)("span",{className:"font-normal text-muted-foreground",children:"None"}):(0,b.jsx)("span",{className:a.isMono?"truncate font-mono text-id":"truncate",children:"Harness"===a.label?(0,au.harnessWord)(a.value):a.value}),void 0===a.meta?null:(0,b.jsx)("span",{className:"text-meta font-normal text-muted-foreground",children:a.meta})]})]},a.label)),0===c.length?null:(0,b.jsxs)("div",{className:"col-span-full flex min-w-0 flex-col gap-0.5","data-testid":"crew-request-machine-labels",children:[(0,b.jsx)("dt",{className:"text-caption font-medium text-muted-foreground",children:"Machine labels"}),(0,b.jsx)("dd",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:c.map((a,c)=>(0,b.jsxs)(e.Fragment,{children:[0===c?null:(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:"and"}),(0,b.jsx)(av.LabelChip,{chip:a})]},a.valueId))})]})]})}function aE(){return(0,b.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,b.jsx)(an.ListChecks,{"aria-hidden":!0,className:"size-(--size-icon) text-muted-foreground"}),(0,b.jsx)("h2",{className:"text-section font-semibold",children:"Crew request"})]})}function aF(a){let{stage:c,requestedBy:d,now:e,canManage:f,isAwaitingCrew:g,busy:h,error:i}=a,j=void 0===i?null:(0,b.jsx)(X.InlineError,{title:aw[i.action],description:`${i.message} Nothing changed.`});if("none"===c.kind)return(0,b.jsxs)("section",{"aria-label":"Crew request","data-testid":"crew-request",className:"flex flex-col gap-2.5 rounded-lg border border-border bg-card px-4 py-3.5 shadow-sm",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3.5",children:[(0,b.jsx)(aE,{}),(0,b.jsx)("p",{className:"min-w-0 flex-1 text-meta text-muted-foreground",children:a.hasTrierarchs?"No crew request. A crew request keeps this ship crewed: a trierarch starts a session for it and restarts it when it stops.":"No crew request. A crew request puts this ship on your Needs crew list until you crew it by hand."}),f?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(an.ListChecks,{}),isLoading:"request"===h,onClick:a.onRequest,"data-testid":"crew-request-request",children:"Request crew"}):null]}),j]});let k=(0,aa.crewRequestAction)(c),l=void 0!==h;return(0,b.jsxs)("section",{"aria-label":"Crew request","data-testid":"crew-request",className:"flex flex-col gap-2.5 rounded-lg border border-border bg-card px-4 py-3.5 shadow-sm",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,b.jsx)(aE,{}),(0,b.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-2","data-testid":"crew-request-state",children:["assigned"===c.kind?(0,b.jsx)(A.StatusBadge,{status:c.status}):(0,b.jsx)(A.StatusBadge,{status:c.kind}),"needsCrew"===c.kind?(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:a.hasTrierarchs?"not assigned yet":c.reason??(0,b.jsxs)(b.Fragment,{children:["since ",(0,b.jsx)(ax,{at:c.requestedAt,now:e})]})}):null,"crewedByHand"===c.kind&&null!==c.since?(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:["since ",(0,b.jsx)(ax,{at:c.since,now:e})]}):null,"assigned"===c.kind?(0,b.jsx)(aC,{stage:c,now:e}):null,"assigned"===c.kind&&"releasing"===c.status&&void 0!==a.statusChangedAt?(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:["asked ",(0,b.jsx)(ax,{at:a.statusChangedAt,now:e})]}):null]}),"assigned"===c.kind?(0,b.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 text-meta",children:["on ",(0,b.jsx)(ay,{trierarch:c.trierarch,hasTrierarchs:a.hasTrierarchs??!1})]}):null,(0,b.jsx)("span",{className:"flex-1"}),"assigned"===c.kind&&"releasing"===c.status?(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:["Waiting for ",c.trierarch.name]}):null,f?(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["remove"===k?(0,b.jsx)(t.Button,{size:"sm",variant:"ghost",isLoading:"remove"===h,disabled:l,onClick:a.onRemove,"data-testid":"crew-request-remove",children:"Remove request"}):null,(0,aa.isRestartable)(c)?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(ar.RotateCcw,{}),isLoading:"restart"===h,disabled:l,onClick:a.onRestart,"data-testid":"crew-request-restart",children:"Restart"}):null,void 0!==a.onEdit&&void 0!==k?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(ap.Pen,{}),disabled:l,onClick:a.onEdit,"data-testid":"crew-request-edit",children:"Edit…"}):null,"release"===k?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(aq.Power,{}),disabled:l,onClick:a.onRelease,"data-testid":"crew-request-release",children:"Release…"}):null,"needsCrew"===c.kind&&g&&!a.hasTrierarchs?(0,b.jsx)(t.Button,{size:"sm",variant:"primary",icon:(0,b.jsx)(am.KeyRound,{}),disabled:l,onClick:a.onGetStartingPrompt,"data-testid":"crew-request-prompt",children:"Get starting prompt"}):null]}):null]}),"assigned"===c.kind?function(a,c){let{trierarch:d}=a,e=void 0===c.statusChangedAt?null:(0,b.jsx)(ax,{at:c.statusChangedAt,now:c.now});switch(a.status){case"crewing":return(0,b.jsxs)(aB,{tone:"note",icon:(0,b.jsx)(ao.LoaderCircle,{"aria-hidden":!0}),children:[d.name," is starting the session."]});case"running":return null;case"restarting":return(0,b.jsxs)(aB,{tone:"waiting",icon:(0,b.jsx)(ar.RotateCcw,{"aria-hidden":!0}),children:[(0,b.jsx)("strong",{className:"font-medium",children:null===e?"The session stopped.":(0,b.jsxs)(b.Fragment,{children:["The session stopped at ",e,"."]})})," ",d.name," is starting it again. Once its restarts are used up it stops trying and the request shows Crashed."]});case"crashed":return(0,b.jsxs)(aB,{tone:"attention",icon:(0,b.jsx)(ak.CircleX,{"aria-hidden":!0}),children:[(0,b.jsx)("strong",{className:"font-medium",children:null===e?"Crashed.":(0,b.jsxs)(b.Fragment,{children:["Crashed at ",e,"."]})})," The session kept stopping and ",d.name," ","stopped trying. The lease still holds, so new deliveries wait in the inbox. Restart crews it again with the same settings."]});case"releasing":return(0,b.jsxs)(aB,{tone:"note",icon:(0,b.jsx)(aq.Power,{"aria-hidden":!0}),children:["Releasing: ",d.name," is stopping the session and cleaning up. The request goes away once it confirms."]})}}(c,{statusChangedAt:a.statusChangedAt,now:e}):null,"needsCrew"===c.kind&&a.hasTrierarchs?null===c.reason?(0,b.jsx)(aB,{tone:"note",icon:(0,b.jsx)(ao.LoaderCircle,{"aria-hidden":!0}),children:"Waiting for the trierarch plugin to assign a trierarch."}):c.reason===aj.NO_MACHINE_MATCHES_REASON&&void 0!==a.machineLabels&&a.machineLabels.length>0?(0,b.jsxs)(aB,{tone:"waiting",icon:(0,b.jsx)(al.Clock,{"aria-hidden":!0}),children:[(0,b.jsx)("strong",{className:"font-medium",children:"No machine matches these labels."})," The plugin places this ship only on a machine with ",(0,ae.machineLabelsText)(a.machineLabels),", and none"," ",(0,ae.noMatchWords)(a.machineLabels.length).carries,". It assigns a trierarch as soon as one does; until then this ship is on Needs crew."]}):(0,b.jsxs)(aB,{tone:"waiting",icon:(0,b.jsx)(al.Clock,{"aria-hidden":!0}),children:[(0,b.jsxs)("strong",{className:"font-medium",children:[(0,r.capitalised)(c.reason),"."]})," The plugin assigns a trierarch as soon as one fits. Until then this ship is on Needs crew."]}):null,j,void 0===a.settingsRows?null:(0,b.jsx)(aD,{rows:a.settingsRows,machineLabels:a.machineLabels}),(0,b.jsxs)("p",{className:"text-meta text-muted-foreground",children:["needsCrew"!==c.kind||a.hasTrierarchs?null:"On your Needs crew list. Crew it by hand: get a starting prompt and start a session with it. Crewing it fulfils the request; the request stays until you remove it. ","crewedByHand"===c.kind?`${c.crewedBy.name===r.OPERATOR_NAME?"You":c.crewedBy.name} crewed it by hand. The request stands: if the lease ends, the ship is back on Needs crew until you crew it again or release it. `:null,(0,b.jsx)(az,{requestedBy:d,requestedAt:c.requestedAt,now:e}),"assigned"===c.kind&&"releasing"!==c.status?" The trierarch keeps it crewed until you release it.":null]})]})}var aG=a.i(54763),aH=a.i(12540),aI=a.i(18441),aJ=a.i(2374),aK=a.i(71251);let aL={request:{title:a=>`Request a crew for ${a}`,description:"The trierarch plugin picks a trierarch, which starts the session and keeps it crewed.",action:"Request crew",busy:"Requesting"},edit:{title:a=>`Edit the crew request for ${a}`,description:"Saving writes a new version of the settings: its trierarch stops the session and starts it again with them, in the same workspace.",action:"Save and restart",busy:"Saving"}},aM={waiting:"border-tone-waiting-border bg-tone-waiting-bg text-tone-waiting-fg",attention:"border-tone-attention-border bg-tone-attention-bg text-tone-attention-fg",note:"border-border bg-muted text-muted-foreground"};function aN({tone:a,icon:c,children:d}){return(0,b.jsxs)("div",{role:"attention"===a?"alert":"status","data-testid":"request-crew-banner",className:`flex items-start gap-2 rounded-lg border px-3.5 py-2.5 text-meta [&_svg]:mt-0.5 [&_svg]:size-(--size-icon-sm) [&_svg]:shrink-0 ${aM[a]}`,children:[c,(0,b.jsx)("span",{children:d})]})}function aO(a){let{shipName:c,mode:d,offers:f,heldSettings:g,squadrons:h,machineLabels:i,check:j,refusedAt:k,error:l,isPending:m,onSettingsChange:n,onSubmit:o}=a,p=aL[d],[r,s]=(0,e.useState)(()=>"edit"===d?(0,ab.valuesOf)(g,f):(0,ab.defaultValues)(f)),u=(0,ab.settingsOf)(r),v=j?.kind==="refused"?j:void 0,w=(0,ab.promptBytes)(r.firstPrompt)>aj.FIRST_PROMPT_MAX_BYTES,x=r.machineLabels.length>0&&i?.matchOf(r.machineLabels).matching.length===0,y=void 0!==u&&void 0===v&&!w&&!m;return(0,b.jsxs)("form",{noValidate:!0,className:"contents",onSubmit:a=>{a.preventDefault(),y&&o(u)},children:[(0,b.jsxs)(aI.DialogHeader,{children:[(0,b.jsx)(aI.DialogTitle,{children:p.title(c)}),(0,b.jsx)(aI.DialogDescription,{children:p.description})]}),0===f.length?(0,b.jsx)(aN,{tone:"waiting",icon:(0,b.jsx)(as.ShipWheel,{"aria-hidden":!0}),children:"No machine answers with what it offers yet. Join a machine under Trierarchs, or wait for its trierarch to report."}):void 0!==v&&void 0!==k?(0,b.jsxs)(aN,{tone:"attention",icon:(0,b.jsx)(ak.CircleX,{"aria-hidden":!0}),children:["The trierarch plugin refused: ",v.field,". Nothing was requested. Change the field below and try again."]}):j?.kind!=="noRoom"||x?null:(0,b.jsx)(aN,{tone:"waiting",icon:(0,b.jsx)(al.Clock,{"aria-hidden":!0}),children:"No trierarch has a free slot right now. You can still request: the request waits on Needs crew and the plugin assigns a trierarch when a slot frees up."}),0===f.length?null:(0,b.jsx)(aK.CrewSettingsFields,{offers:f,values:r,onChange:a=>{s(a),n((0,ab.settingsOf)(a))},squadrons:h,refusal:v,isDisabled:m,...void 0===i?{}:{machineLabels:{...i,shipName:c}}}),void 0===l?null:(0,b.jsx)(X.InlineError,{title:"edit"===d?"Couldn’t save the settings":"Couldn’t request crew",description:`${l} Nothing changed.`}),(0,b.jsxs)(aI.DialogFooter,{className:"items-center",children:[(0,b.jsx)("span",{className:"mr-auto text-meta text-muted-foreground","data-testid":"request-crew-note",children:void 0!==v&&void 0!==k?`Refused at ${(0,q.secondsTime)(k)}. Nothing was requested.`:x?"The request will wait for a machine with these labels.":j?.kind==="noRoom"?"The request will wait for room.":null}),(0,b.jsx)(aI.DialogClose,{render:(0,b.jsx)(t.Button,{type:"button",disabled:m}),children:"Cancel"}),(0,b.jsx)(t.Button,{type:"submit",variant:"primary",icon:(0,b.jsx)(as.ShipWheel,{}),isLoading:m,disabled:!y,"data-testid":"request-crew-submit",children:m?p.busy:p.action})]})]})}function aP(a){let{shipName:c,mode:d,state:e,isOpen:f,onOpenChange:g,isPending:h,onRetry:i}=a,j=aL[d];return(0,b.jsx)(aI.Dialog,{open:f,onOpenChange:a=>{h||g(a)},children:(0,b.jsx)(aI.DialogContent,{size:"md","data-testid":"request-crew-dialog",className:aJ.dialogSurface.phoneFullScreen,children:"ready"===e?(0,b.jsx)(aO,{...a}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(aI.DialogHeader,{children:[(0,b.jsx)(aI.DialogTitle,{children:j.title(c)}),(0,b.jsx)(aI.DialogDescription,{children:j.description})]}),"loading"===e?(0,b.jsx)(aN,{tone:"note",icon:(0,b.jsx)(ao.LoaderCircle,{"aria-hidden":!0,className:"motion-safe:animate-spin"}),children:"Loading the trierarch plugin’s options."}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aN,{tone:"attention",icon:(0,b.jsx)(ak.CircleX,{"aria-hidden":!0}),children:"The trierarch plugin is not answering. Its options can’t load, so a request with settings can’t be made now. Nothing changed."}),(0,b.jsx)("div",{children:(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(S.RotateCw,{}),onClick:i,"data-testid":"request-crew-retry",children:"Try again"})}),"request"===d?(0,b.jsxs)("p",{className:"text-meta text-muted-foreground",children:["You can still crew ",c," by hand: close this and use Get starting prompt."]}):null]}),(0,b.jsxs)(aI.DialogFooter,{className:"items-center",children:[(0,b.jsx)("span",{className:"mr-auto text-meta text-muted-foreground",children:"loading"===e?"Waiting for the trierarch plugin.":`${j.action} is off until the plugin answers.`}),(0,b.jsx)(aI.DialogClose,{render:(0,b.jsx)(t.Button,{type:"button"}),children:"Cancel"}),(0,b.jsx)(t.Button,{type:"button",variant:"primary",icon:(0,b.jsx)(as.ShipWheel,{}),disabled:!0,children:j.action})]})]})})})}var aQ=a.i(44344);function aR({ship:a,timeline:c,now:d}){let f=(0,_.useAccess)(),g=(0,ag.useHasTrierarchPlugin)(),h=(0,ac.useRequestCrew)(),i=(0,ac.useLabelContext)(),j=(0,ac.useRemoveCrewRequest)(),k=(0,ac.useReleaseShip)(),l=(0,ac.useGetStartingPrompt)(),[m,n]=(0,e.useState)(),[o,p]=(0,e.useState)(),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(),y=function(a){let c=(0,ag.useMachines)(),d=(0,aG.useSquadronsConnection)(),f=(0,aH.useSquadrons)(),g=(0,ac.useRequestCrew)(),h=(0,ac.useLabelContext)(),[i,j]=(0,e.useState)(),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(),o=(0,ab.offersOf)(c.data??[]),p=void 0===h||void 0===c.data?void 0:(0,ae.machineLabelsInputOf)(h,c.data),q=(0,ab.settingsOf)("edit"===i?(0,ab.valuesOf)(a?.heldSettings,o):(0,ab.defaultValues)(o)),r=void 0!==i&&void 0!==a,s=(0,ag.useCrewSettingsCheck)(r&&void 0!==c.data?null===k?q:k:void 0),t=async b=>{if(void 0!==a&&void 0!==i){g.reset();try{let a=await s.checkNow();if("refused"===a.kind)return void n(new Date)}catch{}g.mutate({shipId:a.shipId,settings:b},{onSuccess:()=>{j(void 0),(0,ah.showToast)("edit"===i?{title:`Settings saved for ${a.shipName}`,description:"Its trierarch restarts the session with them.",tone:"success"}:{title:`Crew requested for ${a.shipName}`,description:"The trierarch plugin assigns a trierarch that fits.",tone:"success"})}})}};return{open:a=>{g.reset(),l(null),n(void 0),j(a)},dialog:void 0===a?null:(0,b.jsx)(aP,{shipName:a.shipName,mode:i??"request",state:c.isError?"unreachable":void 0===c.data?"loading":"ready",offers:o,heldSettings:a.heldSettings,squadrons:"connected"===d?(f.data??[]).filter(a=>"disbanded"!==a.state).map(a=>a.id):void 0,...void 0===p?{}:{machineLabels:p},check:s.data,refusedAt:m,error:g.error?.message,isPending:g.isPending,isOpen:r,onOpenChange:a=>{a||j(void 0)},onSettingsChange:a=>{l(a),n(void 0)},onSubmit:a=>void t(a),onRetry:()=>{c.refetch()}})}}("agent"===a.kind&&"retired"!==a.status?{shipId:a.id,shipName:a.name,heldSettings:a.crewRequest?.settings}:void 0);if("agent"!==a.kind||"retired"===a.status)return null;let z=(0,aa.crewRequestStage)(a),A=a.crewRequest,B=async(a,b)=>{n(a),p(void 0);try{return await b(),!0}catch(b){return p({action:a,message:b instanceof Error?b.message:String(b)}),!1}finally{n(void 0)}},C=()=>{l.reset(),x((0,af.isUnclaimedPromptOut)(a)&&a.startingPrompt?{issuedAt:a.startingPrompt.issuedAt}:void 0),v(!0),l.mutate({shipId:a.id})},D=async()=>{await B("request",()=>h.mutateAsync({shipId:a.id,settings:{}}))&&(0,ah.showToast)({title:`${a.name} needs crew`,description:"It is on your Needs crew list until you crew it.",tone:"success",..."awaitingCrew"===a.status&&f.canManage?{action:{label:"Get starting prompt",onClick:C}}:{}})},E=async()=>{null===A||"assigned"!==z.kind||await B("restart",()=>h.mutateAsync({shipId:a.id,settings:A.settings}))&&(0,ah.showToast)({title:`Restarting ${a.name}`,description:`${z.trierarch.name} starts its session again with the same settings.`,tone:"success"})},F=async b=>{t(void 0);let c=(0,aa.releaseSteps)(b),d=0;try{for(let b of c)await ("removeCrewRequest"===b?j.mutateAsync({shipId:a.id}):k.mutateAsync({shipId:a.id})),d+=1;r(!1)}catch(b){let a=b instanceof Error?b.message:String(b);t(0===d?`${a} Nothing changed.`:`${a} Its crew request is removed; the session still holds the ship. Try again to end its lease.`)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aF,{stage:z,requestedBy:(0,aa.requestedBy)(c),statusChangedAt:(0,aa.statusChangedAt)(c),now:d,canManage:f.canManage,isAwaitingCrew:"awaitingCrew"===a.status,hasTrierarchs:g,busy:m,error:o,settingsRows:null===A?void 0:(0,ab.settingsRows)(A.settings),...null===A||void 0===i?{}:{machineLabels:(0,ad.pickedChips)((0,ae.machineLabelIdsOf)(A.settings),i)},onRequest:()=>{g?y.open("request"):D()},...g?{onEdit:()=>{y.open("edit")}}:{},onRemove:()=>void B("remove",()=>j.mutateAsync({shipId:a.id})),onRelease:()=>{t(void 0),r(!0)},onRestart:()=>void E(),onGetStartingPrompt:C}),y.dialog,"crewedByHand"===z.kind||"assigned"===z.kind?(0,b.jsx)(ai.CrewReleaseDialog,{shipName:a.name,stage:z,sessionLocation:null===a.location?null:a.location.description??a.location.kind.toLowerCase(),inFlightCount:a.inFlightDeliveries,isOpen:q,onOpenChange:r,isPending:j.isPending||k.isPending,error:s,onConfirm:()=>void F(z)}):null,(0,b.jsx)(aQ.StartingPromptDialog,{shipName:a.name,state:l.data?"shown":l.isError?"error":"issuing",prompt:l.data?.prompt,crewLines:l.data?.crewLines,replacesUnclaimed:w,error:l.error?.message,isOpen:u,onOpenChange:a=>{a||(l.reset(),v(!1))},onConfirm:()=>{l.mutate({shipId:a.id})}})]})}var aS=a.i(8219),aT=a.i(75971);function aU({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 bg-card px-3.5 py-3",children:[(0,b.jsx)("dt",{className:"text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-body text-foreground",children:c})]})}function aV({shipId:a,now:c}){let d=(0,aH.useSquadrons)(),e=(0,aH.useCatalogue)(),f=d.data?.find(b=>b.flagship.shipId===a||b.members.some(b=>b.shipId===a));if(!f)return null;let g=(0,b.jsx)(at.default,{href:`/squadrons/${f.id}`,className:"font-mono hover:underline","data-testid":"ship-squadron-link",children:f.id});if(f.flagship.shipId===a)return(0,b.jsxs)("div",{role:"note","data-testid":"ship-flagship-note",className:"flex flex-wrap items-center gap-3 rounded-lg border border-border bg-muted px-3.5 py-3 text-meta text-foreground",children:[(0,b.jsxs)("span",{className:"grow",children:["Flagship of squadron ",g,": the address for work sent to the team. The squadron manager crews it, so it can’t be released, renamed or retired; it retires when the squadron disbands."]}),(0,b.jsx)(t.Button,{size:"xs",nativeButton:!1,render:(0,b.jsx)(at.default,{href:`/squadrons/${f.id}`}),"data-testid":"ship-open-squadron",children:"Open squadron"})]});let h=f.members.find(b=>b.shipId===a);if(!h)return null;let i=e.data?.blueprints.find(a=>a.repository===f.blueprint.repository&&a.name===f.blueprint.name&&a.version===f.blueprint.version),j=i?.roles.find(a=>a.name===h.role)?.template,k=null===h.crew.lastSeenAt?void 0:(0,q.duration)(new Date(h.crew.lastSeenAt),c);return(0,b.jsxs)("div",{className:"flex flex-col gap-3",children:["silent"===h.health&&"disbanded"!==f.state&&(0,b.jsxs)("div",{role:"alert","data-testid":"ship-silent-alert",className:"rounded-lg border border-tone-attention-border bg-tone-attention-bg px-3.5 py-3 text-meta text-foreground",children:[(0,b.jsx)("strong",{className:"font-semibold text-tone-attention-fg",children:void 0===k?"Silent.":`Silent: not seen for ${k}.`})," It checks in"," ",(0,aS.checkInText)(h.checkInMinutes),", so its session has probably stopped. Get a new crew line and start a new session; the old crew line then stops working."]}),(0,b.jsxs)("dl",{"data-testid":"ship-squadron-facts",className:"grid grid-cols-4 gap-px overflow-hidden rounded-lg border border-border bg-border max-sm:grid-cols-2",children:[(0,b.jsxs)(aU,{label:"Squadron",children:[g,(0,b.jsx)(A.StatusBadge,{status:f.state})]}),(0,b.jsxs)(aU,{label:"Role and template",children:[(0,b.jsx)("span",{className:"rounded-sm bg-secondary px-1.5 font-mono text-id",children:h.role}),j&&(0,b.jsxs)(at.default,{href:(0,aS.templatePath)(j),className:"font-mono text-meta hover:underline",children:[j.name,"@",j.version]})]}),(0,b.jsx)(aU,{label:"Health",children:(0,b.jsx)(aT.HealthIndicator,{health:h.health,detail:"silent"===h.health||"late"===h.health?k:void 0})}),(0,b.jsx)(aU,{label:"Hand-offs",children:i?(0,b.jsx)("span",{className:"text-meta",children:(0,aS.handoffsText)((0,aS.handoffsOf)(i,h.role))}):(0,b.jsx)(at.default,{href:(0,aS.blueprintPath)(f.blueprint),className:"text-meta text-muted-foreground hover:underline",children:"See its blueprint"})})]})]})}var aW=a.i(73202),aX=a.i(97011),aY=a.i(79762),aZ=a.i(93817),a$=a.i(52357),a_=a.i(71094),a0=a.i(87005),a1=a.i(40108);function a2({harness:a,model:c,testId:d}){return null===a&&null===c?null:(0,b.jsxs)("span",{"data-testid":d,className:"flex min-w-0 flex-wrap items-center gap-x-1 text-meta text-muted-foreground",children:[null===a?null:(0,b.jsx)("span",{children:(0,au.harnessWord)(a)}),null!==a&&null!==c?(0,b.jsx)("span",{"aria-hidden":!0,children:"·"}):null,null===c?null:(0,b.jsx)("span",{className:"truncate font-mono text-id",children:c})]})}var a3=a.i(26955);function a4({ping:a,now:c,testId:d}){return null===a?null:(0,b.jsx)("span",{title:`Pinged ${(0,q.fullDateTime)(new Date(a.sentAt))}`,"data-testid":d,"data-state":a.state,className:"text-meta text-muted-foreground tabular-nums",children:(0,a3.pingLine)(a,c)})}var a5=a.i(41146),a6=a.i(45185);function a7({details:a,version:c,testId:d}){return(0,b.jsxs)("details",{"data-testid":d,className:"group rounded-lg border border-border bg-card",children:[(0,b.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-3.5 py-2.5 text-meta text-muted-foreground [&::-webkit-details-marker]:hidden",children:[(0,b.jsx)(a5.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 transition-transform group-open:rotate-90"}),(0,b.jsx)("span",{className:"font-medium text-foreground",children:"Report details"}),(0,b.jsxs)("span",{className:"tabular-nums",children:["· version ",c]})]}),(0,b.jsx)("div",{className:"px-3.5 pb-3.5",children:(0,b.jsx)(s.CodeBlock,{label:(0,a6.reportDetailsLabel)(a),code:(0,a6.reportDetailsJson)(a),copyLabel:"Copy report details",codeTestId:`${d}-code`})})]})}var a8=a.i(92717);function a9({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 bg-card px-3.5 py-3",children:[(0,b.jsx)("dt",{className:"text-meta text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:"flex min-w-0 items-center gap-1.5 text-body text-foreground",children:c})]})}function ba({ship:a,now:c,labels:d}){let e,f="operator"===a.kind,g=null===a.crewedSince?null:new Date(a.crewedSince),h=new Date(a.commissionedAt);return(0,b.jsxs)("dl",{className:"grid grid-cols-4 gap-px overflow-hidden rounded-lg border border-border bg-border max-sm:grid-cols-2",children:[(0,b.jsx)(a9,{label:"Location",children:(0,b.jsxs)("span",{className:"inline-flex min-w-0 flex-col gap-0.5",children:[(0,b.jsx)(a1.LocationTag,{kind:a.location?.kind??null,description:a.location?.description,size:"md"}),(0,b.jsx)(a2,{harness:a.harness,model:a.model?.id??null,testId:"ship-model"}),null===a.lastSeenAt?null:(0,b.jsx)("time",{dateTime:a.lastSeenAt,title:(0,q.fullDateTime)(new Date(a.lastSeenAt)),"data-testid":"ship-last-seen",className:"text-meta text-muted-foreground tabular-nums",children:(0,q.lastSeen)(new Date(a.lastSeenAt),c)}),(0,b.jsx)(a4,{ping:a.ping,now:c,testId:"ship-ping-status"}),"agent"!==a.kind?null:(0,b.jsx)(a8.ReportLine,{report:a.report,now:c,variant:"full",testId:"ship-report"})]})}),(0,b.jsx)(a9,{label:"Crewed since",children:g?(0,b.jsx)("time",{dateTime:a.crewedSince??void 0,title:(0,q.fullDateTime)(g),className:"tabular-nums",children:(e=c.getTime()-g.getTime()<864e5?(0,q.clockTime)(g):(0,q.shortDateTime)(g),`${e} \xb7 ${(0,q.duration)(g,c)}`)}):(0,b.jsx)("span",{className:"text-muted-foreground",children:"Not crewed"})}),(0,b.jsx)(a9,{label:"Commissioned",children:(0,b.jsx)("time",{dateTime:a.commissionedAt,title:(0,q.fullDateTime)(h),children:f?`Fleet created ${(0,q.dayDate)(h)}`:(0,q.dayDate)(h)})}),(0,b.jsxs)(a9,{label:"Ship id",children:[(0,b.jsx)("span",{className:"truncate font-mono text-id",children:a.id}),(0,b.jsx)(u.CopyButton,{value:a.id,label:"Copy ship id"})]}),void 0===d?null:(0,b.jsxs)("div",{className:"col-span-4 flex min-w-0 items-center gap-4 bg-card px-3.5 py-2.5 max-sm:col-span-2 max-sm:flex-col max-sm:items-start max-sm:gap-1.5","data-testid":"ship-labels",children:[(0,b.jsx)("dt",{className:"shrink-0 text-meta text-muted-foreground",children:"Labels"}),(0,b.jsx)("dd",{className:"min-w-0 flex-1",children:d})]})]})}function bb({icon:a,children:c}){return(0,b.jsxs)("p",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted px-3.5 py-2.5 text-meta text-muted-foreground [&_svg]:size-(--size-icon-sm) [&_svg]:shrink-0",children:[a,(0,b.jsx)("span",{children:c})]})}function bc({ship:a,shipId:c,state:d,actions:e,crewRequest:f,now:g,backHref:h="/",labels:i,isPluginShip:j=!1}){if("loading"===d||"ready"===d&&void 0===a)return(0,b.jsxs)("div",{"aria-busy":!0,"data-testid":"ship-header",className:"flex flex-col gap-4",children:[(0,b.jsx)("span",{className:"sr-only",children:"Loading the ship"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(w.Skeleton,{className:"h-8 w-40"}),(0,b.jsx)(w.Skeleton,{className:"h-6 w-20"}),(0,b.jsx)(w.Skeleton,{className:"h-6 w-16"})]}),(0,b.jsx)(w.Skeleton,{className:"h-16 w-full rounded-lg"})]});if("not-found"===d||void 0===a)return(0,b.jsx)("div",{"data-testid":"ship-header",children:(0,b.jsx)(x.EmptyState,{variant:"section",icon:(0,b.jsx)(aZ.CircleAlert,{}),title:"Ship not found",description:(0,b.jsxs)(b.Fragment,{children:["No ship with the id ",c?(0,b.jsx)("span",{className:"font-mono text-id",children:c}):"given"," exists in this fleet. The link may be incomplete. Retired ships keep their page."]}),action:(0,b.jsx)(t.Button,{size:"sm",nativeButton:!1,render:({children:a,...c})=>(0,b.jsx)(at.default,{href:h,...c,children:a}),children:"Back to fleet overview"})})});let k="operator"===a.kind,l="retired"===a.status;return(0,b.jsxs)("div",{"data-testid":"ship-header",className:"flex flex-col gap-4 max-sm:gap-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2.5 max-sm:flex-col max-sm:items-start max-sm:gap-1.5",children:[(0,b.jsx)("h1",{className:"min-w-0",children:(0,b.jsx)(y.ShipName,{name:a.name,shipId:a.id,size:"title",isSuffixShown:l})}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(A.StatusBadge,{status:a.status}),k?(0,b.jsxs)(D.Badge,{variant:"kind",children:[(0,b.jsx)(a0.UserRound,{"aria-hidden":!0}),"operator"]}):(0,b.jsxs)(b.Fragment,{children:[j?(0,b.jsxs)(D.Badge,{variant:"kind","data-testid":"ship-plugin",children:[(0,b.jsx)(a_.Plug,{"aria-hidden":!0}),"plugin"]}):null,(0,b.jsx)(D.Badge,{variant:"type",children:a.type}),a.scopes.filter(a=>aX.FLEET_SCOPES.some(b=>b===a)).map(a=>(0,b.jsx)(D.Badge,{variant:"kind","data-testid":"ship-fleet-scope",children:a},a))]}),"awaitingCrew"===a.status&&null===a.startingPrompt?(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-meta text-muted-foreground [&_svg]:size-(--size-icon-sm)",children:[(0,b.jsx)(am.KeyRound,{"aria-hidden":!0}),"No starting prompt issued"]}):null]})]}),e&&!l?(0,b.jsx)("div",{className:(0,T.classNames)("flex flex-wrap items-center gap-2","max-sm:w-full max-sm:[&>*]:flex-1"),children:e}):null]}),k?(0,b.jsx)(bb,{icon:(0,b.jsx)(a$.Info,{"aria-hidden":!0}),children:"argo is your ship. This console session crews it. It can’t be released, renamed or retired."}):null,l&&null!==a.retiredAt?(0,b.jsxs)(bb,{icon:(0,b.jsx)(aY.Archive,{"aria-hidden":!0}),children:["Retired on ",(0,q.fullDateTime)(new Date(a.retiredAt)),". Read-only."]}):null,f,(0,b.jsx)(ba,{ship:a,now:g,labels:i}),"agent"===a.kind&&a.report?.details?(0,b.jsx)(a7,{details:a.report.details,version:a.report.detailsVersion,testId:"ship-report-details"}):null]})}var bd=a.i(63511),be=a.i(52562),bf=a.i(89027),bg=a.i(13608),bh=a.i(3512),bi=a.i(74215),bj=a.i(60275),bk=a.i(681);function bl({chip:a,labelKey:c,isBusy:d,onUnassign:f,onChange:g}){let[h,i]=(0,e.useState)(!1);return(0,b.jsxs)(bj.Popover,{open:h,onOpenChange:i,children:[(0,b.jsx)(bj.PopoverTrigger,{render:(0,b.jsx)("button",{type:"button","aria-label":`Change or remove ${a.key}=${a.value}`,"data-testid":"ship-label-yours",disabled:d,className:"inline-flex items-center rounded-sm focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60"}),children:(0,b.jsx)(av.LabelChip,{chip:a,trailing:(0,b.jsx)(bf.ChevronDown,{"aria-hidden":!0}),className:"hover:bg-accent"})}),(0,b.jsxs)(bj.PopoverContent,{align:"start",sideOffset:6,className:"w-72 p-1.5","data-testid":"ship-label-menu",children:[(0,b.jsxs)("span",{className:"flex items-center justify-between px-2 pt-1 pb-1.5 text-meta",children:[(0,b.jsxs)("span",{className:"font-mono",children:[a.key,"=",(0,b.jsx)("span",{className:"text-muted-foreground",children:a.value})]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"Change the value"})]}),(0,b.jsx)("ul",{className:"flex flex-col",children:(c?.values??[]).map(d=>{let e=d.valueId===a.valueId,f=c?.carriedValueIds.includes(d.valueId)??!1;return(0,b.jsx)("li",{children:(0,b.jsxs)("button",{type:"button",disabled:f,"data-testid":"ship-label-value",className:"flex h-(--size-control-sm) w-full items-center gap-2 rounded-sm px-2 text-left text-body hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none [&_svg]:size-(--size-icon-sm)",onClick:()=>{i(!1),g({from:a.valueId,to:d.valueId})},children:[(0,b.jsx)("span",{className:"w-4",children:f?(0,b.jsx)(be.Check,{"aria-hidden":!0}):null}),(0,b.jsx)("span",{className:(0,T.classNames)("min-w-0 grow truncate font-mono",f&&!e?"text-muted-foreground":void 0),children:d.value}),(0,b.jsx)("span",{className:"text-meta text-muted-foreground tabular-nums",children:f&&!e?"Carried":`${String(d.shipCount)} ${1===d.shipCount?"ship":"ships"}`})]})},d.valueId)})}),(0,b.jsx)("div",{className:"mt-1 border-t border-border pt-1",children:(0,b.jsxs)("button",{type:"button","data-testid":"ship-label-remove",className:"flex h-(--size-control-sm) w-full items-center gap-2 rounded-sm px-2 text-body text-destructive-text hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-(--size-icon-sm)",onClick:()=>{i(!1),f(a.valueId)},children:[(0,b.jsx)(bi.X,{"aria-hidden":!0}),"Remove label"]})})]})]})}function bm({keys:a,isBusy:c,onAssign:d}){let[f,g]=(0,e.useState)(!1);return(0,b.jsxs)(bj.Popover,{open:f,onOpenChange:g,children:[(0,b.jsx)(bj.PopoverTrigger,{render:(0,b.jsx)(t.Button,{variant:"ghost",size:"xs",icon:(0,b.jsx)(bh.Plus,{}),disabled:c,"data-testid":"ship-labels-add"}),children:"Add label"}),(0,b.jsxs)(bj.PopoverContent,{align:"start",sideOffset:6,className:"w-80 p-2","data-testid":"ship-labels-add-popover",children:[(0,b.jsxs)("span",{className:"flex items-center justify-between px-2 pt-1 pb-2 text-body font-medium",children:["Add a label",(0,b.jsx)("span",{className:"text-meta font-normal text-muted-foreground",children:"Yours"})]}),0===a.length?(0,b.jsx)("p",{className:"px-2 py-2 text-meta text-muted-foreground",children:"You have no labels yet. Define one on the Labels page, then put it on ships here."}):(0,b.jsx)(bk.LabelPicker,{groups:[{title:"Yours",keys:[...a]}],pickedValueIds:a.flatMap(a=>a.carriedValueIds),pickedWord:"Carried",onPick:a=>{g(!1),d(a)}}),(0,b.jsx)("p",{className:"mt-2 flex items-center justify-between border-t border-border px-2 pt-2 text-meta",children:(0,b.jsx)(at.default,{href:"/labels",className:"font-medium hover:underline",children:0===a.length?"Define a label":"Manage labels"})})]})]})}function bn({chips:a,keys:c,limit:d,isBusy:f,error:g,onAssign:h,onUnassign:i,onChange:j}){let[k,l]=(0,e.useState)(!1),m=!k&&a.length>3,n=m?a.slice(0,2):a,o=[...new Set(n.filter(a=>"none"!==a.mark).map(a=>a.ownerName))];return(0,b.jsxs)("span",{className:"flex min-w-0 flex-col gap-2","data-testid":"ship-labels-edit",children:[(0,b.jsxs)("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[0===a.length?(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:"No labels"}):null,n.filter(a=>"none"===a.mark).map(a=>(0,b.jsx)(bl,{chip:a,labelKey:c.find(b=>b.labelId===a.labelId),isBusy:f,onUnassign:i,onChange:j},a.valueId)),m?(0,b.jsxs)("button",{type:"button","aria-label":`Show all ${String(a.length)} labels`,"data-testid":"ship-labels-more",className:"inline-flex h-5.5 items-center rounded-sm bg-secondary px-1.5 text-caption font-medium tabular-nums hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring",onClick:()=>{l(!0)},children:["+",a.length-2]}):null,d.isAtLimit?null:(0,b.jsx)(bm,{keys:c,isBusy:f,onAssign:h}),o.map(a=>(0,b.jsxs)("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:["by ",a]}),n.filter(b=>"none"!==b.mark&&b.ownerName===a).map(a=>(0,b.jsx)(av.LabelChip,{chip:a,testId:"ship-label"},a.valueId))]},a)),k&&a.length>3?(0,b.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm px-1 text-meta hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-(--size-icon-sm)",onClick:()=>{l(!1)},children:[(0,b.jsx)(bg.ChevronUp,{"aria-hidden":!0}),"Show fewer"]}):null,d.isAtLimit?(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:"At the limit: a ship carries at most 20 labels (decision 0031)."}):null,void 0===d.count?null:(0,b.jsx)("span",{className:"ml-auto text-meta text-muted-foreground tabular-nums","data-testid":"ship-labels-count",children:d.count})]}),void 0===g?null:(0,b.jsx)(X.InlineError,{title:g.title,description:`Refused: ${g.message}. Nothing changed.`})]})}function bo(a,b){for(let c of a){let a=c.values.find(a=>a.valueId===b);if(void 0!==a)return`${c.key}=${a.value}`}return"the label"}function bp({ship:a}){let d=(0,ac.useLabelContext)(),f=(0,_.useAccess)(),g=(0,ac.useAssignLabel)(),h=(0,ac.useUnassignLabel)(),[i,j]=(0,e.useState)(void 0);if(void 0===d)return(0,b.jsx)(w.Skeleton,{className:"h-5.5 w-40"});let k=(0,ad.chipsOf)(a,d);if(!(f.canAssignLabels&&"operator"!==a.kind&&"retired"!==a.status))return(0,b.jsx)(bd.ShipLabels,{chips:k});let l=(0,ad.assignKeysOf)(a,d),m=a=>b=>{j({title:a,message:b.message})};return(0,b.jsx)(bn,{chips:k,keys:l,limit:(0,ad.labelLimitOf)(a),isBusy:g.isPending||h.isPending,error:i,onAssign:b=>{j(void 0),g.mutate({shipId:a.id,valueId:(0,c.idSchema)("labelValue").parse(b)},{onError:m(`Couldn’t add ${bo(l,b)}`)})},onUnassign:b=>{j(void 0),h.mutate({shipId:a.id,valueId:(0,c.idSchema)("labelValue").parse(b)},{onError:m(`Couldn’t remove ${bo(l,b)}`)})},onChange:({from:b,to:d})=>{j(void 0);let e=(0,c.idSchema)("labelValue").parse(b);h.mutate({shipId:a.id,valueId:e},{onSuccess:()=>{g.mutate({shipId:a.id,valueId:(0,c.idSchema)("labelValue").parse(d)},{onError:c=>{g.mutate({shipId:a.id,valueId:e}),m(`Couldn’t change ${bo(l,b)} to ${bo(l,d)}`)(c)}})},onError:m(`Couldn’t change ${bo(l,b)}`)})}})}var bq=a.i(59027),br=a.i(25039);let bs={name:"lock-keyhole",size:24,node:[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]};bs.node;let bt=(0,k.default)(bs),bu={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};bu.node;let bv=(0,k.default)(bu);var bw=a.i(57230);let bx={name:"mail-check",size:24,node:[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]};bx.node;let by=(0,k.default)(bx),bz={name:"mail-minus",size:24,node:[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]};bz.node;let bA=(0,k.default)(bz),bB={name:"mail-x",size:24,node:[["path",{d:"M22 12.532V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8.792",key:"8lpqwp"}],["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["path",{d:"m16.5 16.5 5 5",key:"zc9lw7"}],["path",{d:"m21.5 16.5-5 5",key:"1empo3"}]]};bB.node;let bC=(0,k.default)(bB),bD={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};bD.node;let bE=(0,k.default)(bD),bF={name:"package-x",size:24,node:[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16.5 14.5 5 5",key:"ozpm51"}],["path",{d:"m16.5 19.5 5-5",key:"syf6b9"}],["path",{d:"M21 10.5V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.13-.074",key:"isw6gs"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]]};bF.node;let bG=(0,k.default)(bF),bH={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};bH.node;let bI=(0,k.default)(bH),bJ={name:"shield-alert",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]};bJ.node;let bK=(0,k.default)(bJ);var bL=a.i(23422),bM=a.i(98959),bN=a.i(90407);function bO(a,b){let c=a.details[b];return"string"==typeof c?c:void 0}function bP(a){return bO(a,"key")??""}function bQ(a){return(bO(a,"values")??"").split(",").join(", ")}function bR(a){return a?[(0,r.text)(" by "),(0,r.ship)(a)]:[]}let bS={deregistered:"Its session deregistered.",takenOver:"Taken over by a new console session.",signedOut:"The operator signed out.",passwordReset:"Its session ended with the operator password reset.",retired:"Its session ended: the ship was retired."};function bT(a){return null!==a.message&&(0,bM.isPingContentType)(a.message.contentType)}function bU(a){return a.message?[(0,r.text)(bT(a)?"a ping from ":"a message from "),(0,r.ship)(a.message.sender)]:[(0,r.text)("a message")]}function bV(a){let[b,...c]=bU(a);return b?.kind==="text"?[(0,r.text)((0,r.capitalised)(b.text)),...c]:bU(a)}function bW(a,b){let{shipId:c,verb:d}=b,e=a.actor;return[...null===e||e.id===c?[(0,r.text)((0,r.capitalised)(d))]:[(0,r.ship)(e),(0,r.text)(` ${d}`)],(0,r.text)(" "),...bU(a)]}let bX={received:N,sent:P,claimed:bv,released:bw.LogOut,prompt:am.KeyRound,commissioned:br.Flag,acknowledged:by,returned:bL.Undo2,undeliverable:bC,secret:bt,fleet:bq.Anchor,password:bK,retired:aY.Archive,abandoned:bG,dismissed:bA,renamed:bI,reported:bE},bY={waiting:"border-tone-waiting-border bg-tone-waiting-bg text-tone-waiting-fg",active:"border-tone-active-border bg-tone-active-bg text-tone-active-fg",ok:"border-tone-ok-border bg-tone-ok-bg text-tone-ok-fg",attention:"border-tone-attention-border bg-tone-attention-bg text-tone-attention-fg",ended:"border-tone-ended-border bg-tone-ended-bg text-tone-ended-fg"},bZ="flex w-full gap-3 px-3.5 py-3 text-left";function b$({entry:a,shipId:c,now:d,onOpenMessage:e}){let{parts:f,tone:g,icon:h}=function(a,b){switch(a.type){case"FleetInitialised":return{parts:[(0,r.text)("Fleet initialised")],tone:"ended",icon:"fleet"};case"ShipCommissioned":{let b=bO(a,"type");return{parts:[(0,r.text)("Commissioned"),...bR(a.actor),...void 0===b?[]:[(0,r.text)(` as ${b}`)]],tone:"ended",icon:"commissioned"}}case"StartingPromptIssued":return{parts:[(0,r.text)("Starting prompt issued")],tone:"ended",icon:"prompt"};case"ShipClaimed":return{parts:[(0,r.text)(`Claimed by a session on ${function(a){let b=bO(a,"locationDescription");if(void 0!==b&&""!==b)return b;let c=bO(a,"location");return"DEVICE"===c||"CLOUD"===c||"SERVER"===c||"OTHER"===c?(0,B.locationKindWord)(c):"an unknown location"}(a)}`)],tone:"ok",icon:"claimed"};case"LeaseRevoked":let c,d;return{parts:[..."released"===(c=bO(a,"reason")??"")?[(0,r.text)("Released"),...bR(a.actor),(0,r.text)(".")]:[(0,r.text)(bS[c]??"Its session ended.")],..."number"==typeof(d=a.details.returnedDeliveries)&&d>0?[(0,r.text)(` ${(0,r.counted)(d,{one:"in-flight delivery",many:"in-flight deliveries"})} went back to pending.`)]:[]],tone:"waiting",icon:"released"};case"CredentialRevoked":return{parts:[(0,r.text)("Secret invalidated")],tone:"ended",icon:"secret"};case"OperatorPasswordReset":return{parts:[(0,r.text)("Operator password reset")],tone:"waiting",icon:"password"};case"FleetLimitsChanged":return{parts:[(0,r.text)("Fleet limits changed")],tone:"ended",icon:"fleet"};case"SignInTicketIssued":return{parts:[(0,r.text)("Sign-in ticket issued")],tone:"ended",icon:"password"};case"ViewerSessionStarted":return{parts:[(0,r.text)("Someone started viewing the fleet")],tone:"ended",icon:"password"};case"CrewRequested":return{parts:[(0,r.text)("Crew requested"),...bR(a.actor)],tone:"waiting",icon:"claimed"};case"CrewRequestRemoved":return{parts:[(0,r.text)("Crew request removed"),...bR(a.actor)],tone:"ended",icon:"released"};case"CrewRequestExplained":{let b=bO(a,"reason");return{parts:[(0,r.text)(void 0===b?"Crew request can not be placed yet":`Crew request can not be placed: ${b}`),...bR(a.actor)],tone:"waiting",icon:"reported"}}case"WorktreeClearRequested":return{parts:[(0,r.text)(`Clearing of the kept ${bO(a,"repository")??""} worktree requested`),...bR(a.actor)],tone:"waiting",icon:"reported"};case"WorktreeCleared":return{parts:[(0,r.text)("not-kept"===bO(a,"outcome")?`Kept ${bO(a,"repository")??""} worktree cleared (none was kept)`:`Kept ${bO(a,"repository")??""} worktree cleared`),...bR(a.actor)],tone:"ended",icon:"retired"};case"WorktreeClearRemoved":return{parts:[(0,r.text)(`Clearing of the kept ${bO(a,"repository")??""} worktree dropped`),...bR(a.actor)],tone:"ended",icon:"released"};case"CrewAssigned":return{parts:[(0,r.text)("Crew request assigned"),...bR(a.actor)],tone:"waiting",icon:"claimed"};case"CrewStatusChanged":{let b=bO(a,"status");return{parts:[(0,r.text)(void 0===b?"Crew status changed":`Crew ${b}`),...bR(a.actor)],tone:"crashed"===b?"attention":"active",icon:"reported"}}case"LabelDefined":return{parts:[(0,r.text)(`Label ${bP(a)} defined: ${bQ(a)}`)],tone:"ended",icon:"reported"};case"LabelValuesChanged":return{parts:[(0,r.text)(`Label ${bP(a)} values changed: ${bQ(a)}`)],tone:"ended",icon:"reported"};case"LabelRetired":return{parts:[(0,r.text)(`Label ${bP(a)} retired`)],tone:"ended",icon:"retired"};case"LabelDeleted":return{parts:[(0,r.text)(`Label ${bP(a)} deleted`)],tone:"ended",icon:"retired"};case"LabelAssigned":return{parts:[(0,r.text)(`Labelled ${bP(a)}=${bO(a,"value")??""}`),...bR(a.actor)],tone:"ended",icon:"reported"};case"LabelUnassigned":return{parts:[(0,r.text)(`Label ${bP(a)}=${bO(a,"value")??""} removed`),...bR(a.actor)],tone:"ended",icon:"reported"};case"MessageAccepted":let e;return{parts:(e=a.message)?bT(a)&&"ship"===e.recipient.kind?e.sender.id===b?[(0,r.text)("Pinged "),(0,r.ship)(e.recipient.ship)]:[(0,r.text)("Pinged by "),(0,r.ship)(e.sender)]:e.sender.id===b?"ship"===e.recipient.kind?[(0,r.text)("Sent a message to "),(0,r.ship)(e.recipient.ship)]:[(0,r.text)(`Sent a message to any ship of type ${e.recipient.type}`)]:[(0,r.text)("Received a message from "),(0,r.ship)(e.sender)]:[(0,r.text)("A message was sent")],tone:"ended",icon:a.message?.sender.id===b?"sent":"received"};case"DeliveryClaimed":return{parts:bW(a,{shipId:b,verb:"took"}),tone:"active",icon:"received"};case"DeliveryAcknowledged":return{parts:"pong"===bO(a,"answer")?[...bW(a,{shipId:b,verb:"answered"}),(0,r.text)(" with pong")]:bW(a,{shipId:b,verb:"acknowledged"}),tone:"ok",icon:"acknowledged"};case"DeliveryReturned":return{parts:[...bV(a),(0,r.text)(" went back to pending")],tone:"waiting",icon:"returned"};case"DeliveryUndeliverable":return{parts:[...bV(a),(0,r.text)(" became undeliverable")],tone:"attention",icon:"undeliverable"};case"ShipRetired":{let b=a.details.abandonedDeliveries;return{parts:[(0,r.text)("Retired"),...bR(a.actor),(0,r.text)("."),..."number"==typeof b&&b>0?[(0,r.text)(` ${(0,r.counted)(b,{one:"delivery",many:"deliveries"})} abandoned.`)]:[]],tone:"ended",icon:"retired"}}case"DeliveryAbandoned":return{parts:[...bV(a),(0,r.text)(" was abandoned")],tone:"ended",icon:"abandoned"};case"ShipReported":{let b=bO(a,"state")??"in",c=bO(a,"note");return{parts:[(0,r.text)(void 0===c?`Reported ${b}`:`Reported ${b}: ${c}`)],tone:bN.REPORT_STATES.some(a=>a===b)?a6.REPORT_TONES[b]:"ended",icon:"reported"}}case"ShipRenamed":{let b=bO(a,"from"),c=bO(a,"to");return{parts:[(0,r.text)(void 0===b||void 0===c?"Renamed":`Renamed from ${b} to ${c}`),...bR(a.actor)],tone:"ended",icon:"renamed"}}case"DeliveryDismissed":return{parts:[...bV(a),(0,r.text)(" was dismissed"),...bR(a.actor)],tone:"ended",icon:"dismissed"}}}(a,c),i=bX[h],j=new Date(a.occurredAt),k=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{"aria-hidden":!0,className:(0,T.classNames)("flex size-7 shrink-0 items-center justify-center rounded-md border [&_svg]:size-(--size-icon-sm)",bY[g]),children:(0,b.jsx)(i,{})}),(0,b.jsxs)("span",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsx)(z,{parts:f,className:"text-body text-foreground max-sm:text-body-touch"}),(0,b.jsx)("time",{dateTime:a.occurredAt,title:(0,q.fullDateTime)(j),className:"text-meta text-muted-foreground tabular-nums",children:(0,q.relativeTime)(j,d)})]})]}),{message:l}=a;return(0,b.jsx)("li",{"data-testid":"ship-timeline-entry","data-type":a.type,className:"border-b border-border last:border-b-0",children:l?(0,b.jsx)("button",{type:"button",className:(0,T.classNames)(bZ,"transition-colors duration-(--duration-fast) hover:bg-accent"),onClick:()=>{e(l.id)},children:k}):(0,b.jsx)("div",{className:bZ,children:k})})}function b_({shipId:a,entries:c,state:d,onRetry:e,now:f,onOpenMessage:g}){return"loading"===d?(0,b.jsx)(Y.LoadingSkeleton,{variant:"list",rows:4,label:"Loading the timeline"}):"error"===d?(0,b.jsxs)("div",{"data-testid":"ship-timeline",className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-3",children:[(0,b.jsx)(X.InlineError,{title:"Couldn’t load the timeline",description:"The rest of the page is current. Try again in a moment."}),e?(0,b.jsx)(t.Button,{size:"sm",icon:(0,b.jsx)(S.RotateCw,{"aria-hidden":!0}),onClick:e,className:"self-start",children:"Try again"}):null]}):(0,b.jsxs)("div",{"data-testid":"ship-timeline",className:"overflow-hidden rounded-lg border border-border bg-card",children:[(0,b.jsx)("ol",{"aria-label":"Timeline",children:c.map(c=>(0,b.jsx)(b$,{entry:c,shipId:a,now:f,onOpenMessage:g},c.id))}),c.length<=1?(0,b.jsx)("p",{className:"border-t border-border px-3.5 py-3 text-center text-meta text-muted-foreground first:border-t-0",children:"Nothing else yet. Claims, releases and messages appear here as they happen."}):null]})}var b0=a.i(26110),b1=a.i(91154),b2=a.i(26949),b3=a.i(67336),b4=a.i(10023),b5=a.i(68450),b6=a.i(45065),b7=a.i(94764),b8=a.i(10572),b9=a.i(99929),ca=a.i(34159);let cb="timeline",cc="messages";function cd(a){return Array.isArray(a)?a[0]:a}function ce({shipId:a,searchParams:k}){let l=(0,d.useRouter)(),m=(0,b5.useNow)(),n=(0,b6.usePluginShipIds)(),o=cd(k.tab)===cc?cc:cb,p=(0,c.idSchema)("message").safeParse(cd(k.message)),q=p.success?p.data:void 0,r=(0,b9.useShip)(a),s=(0,b9.useShipTimeline)(a),t=(0,b9.useShipMessages)(a),u=(0,b9.useMessage)(q),v=(0,b3.useLiveFleet)(),w=(0,b7.useAccountMenu)(m),x=(0,aH.useSquadrons)(),y=(0,b2.useOpenInboxCount)(),z=(0,_.useAccess)(),A=(0,ca.usePluginNav)(),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(),H=(0,b4.useAttentionCount)();(0,b8.useSignInWhenSessionEnds)([r.error,s.error,t.error,u.error,v.error]);let I=b=>{let c,d;l.replace((c=new URLSearchParams,b.tab!==cb&&c.set("tab",b.tab),void 0!==b.messageId&&c.set("message",b.messageId),""===(d=c.toString())?`/ships/${a}`:`/ships/${a}?${d}`),{scroll:!1})},J=a=>{I({tab:o,messageId:a})},K="NOT_FOUND"===(0,b1.trpcErrorCode)(r.error),M=(0,aS.shipsInSquadrons)(x.data??[]).get(a);return(0,b.jsx)(b0.DetailLayout,{title:r.data?.name??"Ship",parents:M?[{href:"/squadrons",label:"Squadrons"},{href:`/squadrons/${M.squadronId}`,label:M.squadronId}]:[{href:"/",label:"Fleet overview"}],live:v.live,nav:{active:"overview",inboxCount:y,attentionCount:H,...A},onCompose:z.canSend?()=>{C(!0)}:void 0,onSearch:()=>{E(!0)},account:w,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j.ConsoleNotices,{}),(0,b.jsx)(i.ConsoleGuide,{})]}),header:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(bc,{ship:r.data,shipId:a,state:K?"not-found":r.data?"ready":"loading",now:m,actions:r.data?(0,b.jsx)(aW.ShipActions,{ship:r.data}):void 0,crewRequest:r.data?(0,b.jsx)(aR,{ship:r.data,timeline:s.data??[],now:m}):void 0,labels:r.data?(0,b.jsx)(bp,{ship:r.data}):void 0,isPluginShip:n.has(a)}),K?null:(0,b.jsx)(aV,{shipId:a,now:m})]}),sheet:(0,b.jsx)(L,{message:u.data,messageId:q,state:"NOT_FOUND"===(0,b1.trpcErrorCode)(u.error)?"not-found":u.data?"ready":"loading",isOpen:void 0!==q,onOpenChange:a=>{a||I({tab:o})},onReply:z.canSend?a=>{G({messageId:a.id,sender:a.sender})}:void 0}),children:(0,b.jsxs)(b.Fragment,{children:[K?null:(0,b.jsxs)(f.Tabs,{value:o,onValueChange:a=>{I({tab:a===cc?cc:cb,messageId:q})},children:[(0,b.jsxs)(f.TabsList,{variant:"line","aria-label":`${r.data?.name??"Ship"} history`,children:[(0,b.jsx)(f.TabsTrigger,{variant:"line",value:cb,children:"Timeline"}),(0,b.jsx)(f.TabsTrigger,{variant:"line",value:cc,children:"Messages"})]}),(0,b.jsx)(f.TabsContent,{value:cb,className:"pt-4",children:(0,b.jsx)(b_,{shipId:a,entries:s.data??[],state:s.isError?"error":s.data?"ready":"loading",onRetry:()=>{s.refetch()},now:m,onOpenMessage:J})}),(0,b.jsx)(f.TabsContent,{value:cc,className:"pt-4",children:(0,b.jsx)($,{shipId:a,messages:t.data??[],state:t.isError?"error":t.data?"ready":"loading",onRetry:()=>{t.refetch()},now:m,onOpenMessage:J})})]}),(0,b.jsx)(g.ComposeMessage,{isOpen:B,onOpenChange:C}),(0,b.jsx)(g.ComposeMessage,{isOpen:void 0!==F,onOpenChange:a=>{a||G(void 0)},replyTo:F}),(0,b.jsx)(h.ConsoleCommands,{isOpen:D,onOpenChange:E,onCompose:()=>{C(!0)}})]})})}a.s(["default",0,function({params:a,searchParams:d}){let f=(0,c.idSchema)("ship").safeParse((0,e.use)(a).shipId),g=(0,e.use)(d),h=f.success?f.data:(0,c.idSchema)("ship").parse(`shp_${"0".repeat(26)}`);return(0,b.jsx)(ce,{shipId:h,searchParams:g})}],830)}];
2
2
 
3
3
  //# sourceMappingURL=packages_console_app_ships_%5BshipId%5D_page_tsx_0fudjay._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[9107,a=>{"use strict";var b=a.i(87924);a.i(23600);var c=a.i(2811),d=a.i(50944),e=a.i(72131),f=a.i(15439),g=a.i(2549),h=a.i(83786),i=a.i(68698),j=a.i(90487),k=a.i(41146),l=a.i(78958),m=a.i(38246),n=a.i(72872),o=a.i(24173),p=a.i(40392),q=a.i(50808);function r({messages:a,state:c,error:d,onRetry:e,flagshipId:f,now:g}){return(0,b.jsxs)("section",{"aria-labelledby":"kept-messages","data-testid":"kept-messages",className:"flex flex-col gap-2",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsx)("h2",{id:"kept-messages",className:"text-body font-semibold",children:"Messages the flagship kept"}),(0,b.jsx)("p",{className:"text-meta text-muted-foreground",children:"Messages to the flagship it does not handle: kept here, never forwarded."})]}),"loading"===c?(0,b.jsx)(q.LoadingSkeleton,{variant:"list",rows:2,label:"Loading the kept messages"}):"error"===c?(0,b.jsx)(p.InlineError,{title:"Couldn’t load the kept messages",description:"The rest of the page is current. Try again in a moment.",detail:d,onRetry:e}):0===a.length?(0,b.jsx)(o.EmptyState,{variant:"section",icon:(0,b.jsx)(l.Inbox,{"aria-hidden":!0}),title:"No kept messages",description:"Every message to the flagship was the squadron's own."}):(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border",children:a.map(a=>(0,b.jsx)("li",{"data-testid":"kept-message",children:(0,b.jsxs)(m.default,{href:`/ships/${f}?tab=messages&message=${a.messageId}`,className:"flex items-center gap-3 px-3 py-2.5 hover:bg-accent",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"flex flex-wrap items-center gap-x-2 text-meta",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:a.senderName}),(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:a.contentType}),(0,b.jsx)("time",{dateTime:a.receivedAt,className:"text-muted-foreground",children:(0,n.relativeTime)(new Date(a.receivedAt),g)})]}),(0,b.jsx)("span",{className:"truncate text-body",children:a.payload.split("\n")[0]??""})]}),(0,b.jsx)(k.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon) shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"sr-only",children:"Open the message"})]})},a.deliveryId))})]})}var s=a.i(79762),t=a.i(70840),u=a.i(19459),v=a.i(26268),w=a.i(46444),x=a.i(59613),y=a.i(12068),z=a.i(2374),A=a.i(71673),B=a.i(65698);function C(a){return`${String(a)} ${1===a?"delivery":"deliveries"}`}function D(a){let{squadronId:c,memberCount:d,openDeliveries:f,inFlightDeliveries:g,isForced:h=!1,isPending:i,error:j,onConfirm:k}=a,[l,m]=(0,e.useState)(""),n=h&&f>0,o=!n||(0,w.isTypedMatch)(c,l),q=void 0===j?null:(0,b.jsx)(p.InlineError,{title:"Couldn’t stand down the squadron",description:`${j} Nothing changed; the squadron still sails.`});return h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(x.AlertDialogHeader,{children:[(0,b.jsxs)(x.AlertDialogTitle,{children:["Force stand down ",c,"?"]}),(0,b.jsx)(x.AlertDialogDescription,{children:"The squadron disbands right away. This can't be undone."})]}),f>0?(0,b.jsxs)("div",{role:"alert",className:"flex gap-2 rounded-lg border border-tone-attention-border bg-tone-attention-bg p-3 text-meta text-tone-attention-fg",children:[(0,b.jsx)(v.TriangleAlert,{"aria-hidden":!0,className:"mt-0.5 size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsxs)("p",{className:"font-medium",children:[C(f)," will be abandoned"]}),(0,b.jsxs)("p",{className:"text-foreground",children:["Members and the flagship retire now, without finishing. ",f-g," pending, ",g," in flight."]})]})]}):(0,b.jsx)(A.ConsequenceList,{consequences:[{icon:s.Archive,text:"Every member ship and the flagship retire now and the squadron is disbanded. No open work is lost."}]}),n?(0,b.jsx)(B.TypedConfirm,{expected:c,value:l,onValueChange:m}):null,q,(0,b.jsxs)(x.AlertDialogFooter,{children:[(0,b.jsx)(x.AlertDialogClose,{render:(0,b.jsx)(y.Button,{disabled:i}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"destructive",isLoading:i,disabled:!o,onClick:k,"data-testid":"force-stand-down-confirm",children:f>0?`Stand down now and abandon ${C(f)}`:"Force stand down"})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(x.AlertDialogHeader,{children:[(0,b.jsxs)(x.AlertDialogTitle,{children:["Stand down ",c,"?"]}),(0,b.jsxs)(x.AlertDialogDescription,{children:["Its ",d," ",1===d?"member winds":"members wind"," down on their own. This can't be undone."]})]}),(0,b.jsx)(A.ConsequenceList,{consequences:[{icon:t.Ban,text:"No new work reaches its members; hand-offs stop."},{icon:u.Hourglass,text:`Members finish their open work: ${C(f)}.`},{icon:s.Archive,text:"Then each member ship and the flagship retire and the squadron is disbanded. History stays read-only."}]}),q,(0,b.jsxs)(x.AlertDialogFooter,{children:[(0,b.jsx)(x.AlertDialogClose,{render:(0,b.jsx)(y.Button,{disabled:i}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"destructive",isLoading:i,onClick:k,"data-testid":"stand-down-confirm",children:i?"Standing down":"Stand down squadron"})]})]})}function E(a){let{isOpen:c,onOpenChange:d,isPending:e,isForced:f=!1}=a;return(0,b.jsx)(x.AlertDialog,{open:c,onOpenChange:a=>{e||d(a)},children:(0,b.jsx)(x.AlertDialogContent,{"data-testid":f?"force-stand-down-dialog":"stand-down-dialog",className:z.dialogSurface.phoneSheet,children:(0,b.jsx)(D,{...a})})})}var F=a.i(73594),G=a.i(8219),H=a.i(18441);function I({squadronId:a,blueprint:c,roles:d,isPending:f,error:g,onSubmit:h}){let[i,j]=(0,e.useState)(d[0]?.role),k=d.find(a=>a.role===i)??d[0];return k?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(H.DialogHeader,{children:[(0,b.jsxs)(H.DialogTitle,{children:["Add a member to ",a]}),(0,b.jsx)(H.DialogDescription,{children:"Roles come from its blueprint. Next you get the new member's crew lines."})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,b.jsx)("span",{className:"text-meta font-medium",children:"Role"}),(0,b.jsx)("div",{role:"radiogroup","aria-label":"Role",className:"flex flex-col gap-2",children:d.map(a=>(0,b.jsxs)("button",{type:"button",role:"radio","aria-checked":a.role===k.role,"data-testid":"add-member-role",onClick:()=>{j(a.role)},className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-left text-meta aria-checked:border-primary aria-checked:ring-1 aria-checked:ring-primary",children:[(0,b.jsx)("span",{className:"rounded-sm bg-muted px-1.5 font-mono",children:a.role}),(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:a.template}),(0,b.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[a.now," now"]})]},a.role))})]}),(0,b.jsxs)("p",{className:"flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-meta text-muted-foreground",children:[(0,b.jsx)(F.UserPlus,{"aria-hidden":!0,className:"mt-0.5 size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("span",{children:["A new ship of the role ",k.role,", template ",(0,b.jsx)("span",{className:"font-mono",children:k.template}),void 0===k.checkInMinutes?"":`, checks in ${(0,G.checkInText)(k.checkInMinutes)}`,". Blueprint ",c," has ",k.inBlueprint," ",k.role,"; the squadron then has ",k.now+1,"."]})]}),void 0!==g&&(0,b.jsx)(p.InlineError,{variant:"field",title:"Couldn’t add the member",description:`${g} No ship was commissioned.`}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(H.DialogClose,{render:(0,b.jsx)(y.Button,{type:"button",disabled:f}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"primary",isLoading:f,"data-testid":"add-member-submit",onClick:()=>{h(k.role)},children:f?"Adding":"Add member"})]})]}):null}function J(a){let{isOpen:c,onOpenChange:d,isPending:e}=a;return(0,b.jsx)(H.Dialog,{open:c,onOpenChange:a=>{e||d(a)},children:(0,b.jsx)(H.DialogContent,{size:"md","data-testid":"add-member-dialog",className:z.dialogSurface.phoneFullScreen,children:(0,b.jsx)(I,{...a})})})}var K=a.i(52702),L=a.i(85650),M=a.i(42955),N=a.i(26766),O=a.i(17256),P=a.i(64831);let Q={name:"square-arrow-out-up-right",size:24,node:[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],aliases:["arrow-up-right-from-square"]};Q.node;let R=(0,P.default)(Q);var S=a.i(28339),T=a.i(55280),U=a.i(4838),V=a.i(88191),W=a.i(42231);function X({squadronId:a,member:d,ship:g,template:h,canManage:i,canSend:j,isRemovable:k,onRemove:l}){let[n,o]=(0,e.useState)(!1),p="retired"===d.crew.status||g?.status==="retired",q=(0,W.useNewCrewLineFlow)(i&&!p?{squadronId:a,member:d,ship:g,template:h}:void 0),r=(0,c.idSchema)("ship").safeParse(d.shipId).data,s=async()=>{try{await navigator.clipboard.writeText(d.shipId),(0,V.showToast)({title:"Ship id copied",description:d.shipId,tone:"success"})}catch{(0,V.showToast)({title:"Couldn’t copy the ship id",description:d.shipId,tone:"error"})}},t=[{key:"open",label:"Open ship page",icon:R,testId:"member-open-ship",href:`/ships/${d.shipId}`},...j&&!p&&r?[{key:"message",label:"Message…",icon:O.SquarePen,testId:"member-message",onSelect:()=>{o(!0)}}]:[],...i&&!p?[{key:"crew-line",label:"Get new crew line…",icon:N.KeyRound,testId:"member-new-crew-line",onSelect:q.start}]:[],{key:"copy",label:"Copy ship id",icon:L.Copy,testId:"member-copy-id",onSelect:()=>void s()}],u=i&&k&&!p?{key:"remove",label:"Remove from squadron…",icon:S.UserMinus,testId:"member-remove",isDestructive:!0,onSelect:l}:void 0,v=a=>(0,b.jsx)(y.Button,{size:a,variant:"ghost",isIconOnly:!0,"aria-label":`Actions for ${d.name}`,icon:(0,b.jsx)(M.Ellipsis,{}),"data-testid":"member-actions"});return(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[i&&!p&&"silent"===d.health&&(0,b.jsx)(y.Button,{size:"xs",disabled:!q.isReady,"data-testid":"member-new-crew-line-primary",onClick:q.start,children:"Get new crew line"}),(0,b.jsx)("span",{className:"max-sm:hidden",children:(0,b.jsxs)(T.DropdownMenu,{children:[(0,b.jsx)(T.DropdownMenuTrigger,{render:v("xs")}),(0,b.jsxs)(T.DropdownMenuContent,{align:"end",children:[t.map(a=>void 0===a.href?(0,b.jsxs)(T.DropdownMenuItem,{onClick:a.onSelect,"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key):(0,b.jsxs)(T.DropdownMenuItem,{render:(0,b.jsx)(m.default,{href:a.href}),"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key)),u&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T.DropdownMenuSeparator,{}),(0,b.jsxs)(T.DropdownMenuItem,{variant:"destructive",onClick:u.onSelect,"data-testid":u.testId,children:[(0,b.jsx)(u.icon,{"aria-hidden":!0}),u.label]})]})]})]})}),(0,b.jsx)("span",{className:"sm:hidden",children:(0,b.jsxs)(U.Sheet,{children:[(0,b.jsx)(U.SheetTrigger,{render:v("touch")}),(0,b.jsxs)(U.SheetContent,{side:"bottom",children:[(0,b.jsx)(U.SheetHeader,{children:(0,b.jsx)(U.SheetTitle,{children:d.name})}),(0,b.jsx)("ul",{className:"flex flex-col pb-2",children:[...t,...u?[u]:[]].map(a=>(0,b.jsx)("li",{className:!0===a.isDestructive?"mt-1 border-t border-border pt-1":void 0,children:(0,b.jsxs)(U.SheetClose,{render:void 0===a.href?(0,b.jsx)("button",{type:"button",onClick:a.onSelect}):(0,b.jsx)(m.default,{href:a.href}),className:`flex h-(--size-control-touch) w-full items-center gap-3 px-4 text-left text-body-touch [&_svg]:size-(--size-icon) [&_svg]:shrink-0 ${!0===a.isDestructive?"text-destructive-text":"text-foreground"}`,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label.replace(/…$/,"")]})},a.key))}),(0,b.jsx)("div",{className:"px-4 pb-4",children:(0,b.jsx)(U.SheetClose,{render:(0,b.jsx)(y.Button,{size:"touch",className:"w-full"}),children:"Cancel"})})]})]})}),q.dialog,r&&(0,b.jsx)(f.ComposeMessage,{isOpen:n,onOpenChange:o,toShipId:r})]})}let Y={name:"octagon-x",size:24,node:[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-octagon"]};Y.node;let Z=(0,P.default)(Y);var $=a.i(46916);function _({squadronId:a,offered:c,onAddMember:d,onMessageFlagship:e,onStandDown:f,onForceStandDown:g}){let h=async()=>{try{await navigator.clipboard.writeText(a),(0,V.showToast)({title:"Squadron id copied",description:a,tone:"success"})}catch{(0,V.showToast)({title:"Couldn’t copy the squadron id",description:a,tone:"error"})}},i={key:"copy",label:"Copy squadron id",icon:L.Copy,testId:"squadron-copy-id",onSelect:()=>void h()},j=[...c.canStandDown?[{key:"stand-down",label:"Stand down…",icon:$.Waves,testId:"squadron-stand-down",isDestructive:!0,onSelect:f}]:[],...c.canForceStandDown?[{key:"force",label:"Force stand down…",icon:Z,testId:"squadron-force-stand-down",isDestructive:!0,onSelect:g}]:[]],k=a=>(0,b.jsx)(y.Button,{size:a,variant:"ghost",isIconOnly:!0,"aria-label":"Squadron actions",icon:(0,b.jsx)(M.Ellipsis,{}),"data-testid":"squadron-actions"});return(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[c.canAddMember&&(0,b.jsx)(y.Button,{size:"xs",icon:(0,b.jsx)(F.UserPlus,{}),"data-testid":"squadron-add-member",onClick:d,children:"Add member"}),c.canMessageFlagship&&(0,b.jsx)(y.Button,{size:"xs",icon:(0,b.jsx)(O.SquarePen,{}),"data-testid":"squadron-message-flagship",onClick:e,children:"Message"}),(0,b.jsx)("div",{className:"max-sm:hidden",children:(0,b.jsxs)(T.DropdownMenu,{children:[(0,b.jsx)(T.DropdownMenuTrigger,{render:k("xs")}),(0,b.jsxs)(T.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(T.DropdownMenuItem,{onClick:i.onSelect,"data-testid":i.testId,children:[(0,b.jsx)(L.Copy,{"aria-hidden":!0}),i.label]}),j.length>0&&(0,b.jsx)(T.DropdownMenuSeparator,{}),j.map(a=>(0,b.jsxs)(T.DropdownMenuItem,{variant:"destructive",onClick:a.onSelect,"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key))]})]})}),(0,b.jsx)("div",{className:"sm:hidden",children:(0,b.jsxs)(U.Sheet,{children:[(0,b.jsx)(U.SheetTrigger,{render:k("touch")}),(0,b.jsxs)(U.SheetContent,{side:"bottom","data-testid":"squadron-actions-sheet",children:[(0,b.jsx)(U.SheetHeader,{children:(0,b.jsx)(U.SheetTitle,{children:a})}),(0,b.jsx)("ul",{className:"flex flex-col pb-2",children:[i,...j].map((a,c)=>(0,b.jsx)("li",{className:1===c?"mt-1 border-t border-border pt-1":void 0,children:(0,b.jsxs)(U.SheetClose,{render:(0,b.jsx)("button",{type:"button",onClick:a.onSelect}),className:`flex h-(--size-control-touch) w-full items-center gap-3 px-4 text-left text-body-touch [&_svg]:size-(--size-icon) [&_svg]:shrink-0 ${!0===a.isDestructive?"text-destructive-text":"text-foreground"}`,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label.replace(/…$/,"")]})},a.key))}),(0,b.jsx)("div",{className:"px-4 pb-4",children:(0,b.jsx)(U.SheetClose,{render:(0,b.jsx)(y.Button,{size:"touch",className:"w-full"}),children:"Cancel"})})]})]})})]})}var aa=a.i(80459),ab=a.i(52357),ac=a.i(21327),ad=a.i(75971),ae=a.i(3842),af=a.i(40108),ag=a.i(92717),ah=a.i(23063);function ai({ship:a,now:c}){return a?(0,b.jsxs)("div",{className:"flex grow flex-wrap items-center justify-end gap-x-4 gap-y-1 text-meta",children:["crewed"===a.status?(0,b.jsx)(ag.ReportLine,{report:a.report,now:c,variant:"row",testId:"member-report"}):(0,b.jsx)(ah.StatusBadge,{status:a.status}),a.location?(0,b.jsx)(af.LocationTag,{kind:a.location.kind,description:a.location.description,isCompact:!0,size:"sm"}):(0,b.jsx)("span",{className:"text-muted-foreground",children:"No session"}),(0,b.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground","data-testid":"member-inbox",children:[(0,b.jsx)(l.Inbox,{"aria-hidden":!0,className:"size-(--size-icon-sm)"}),a.openDeliveries,(0,b.jsx)("span",{className:"sr-only",children:" open"})]})]}):null}function aj({role:a,blueprint:c,templates:d,count:e}){let f=c?.roles.find(b=>b.name===a)?.template,g=d.find(a=>a.repository===f?.repository&&a.name===f.name&&a.version===f.version);return(0,b.jsxs)("div",{className:"flex items-center gap-2 bg-muted px-3 py-1.5 text-meta",children:[(0,b.jsx)("span",{className:"rounded-sm bg-card px-1.5 font-mono",children:a}),f&&(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:`${f.name}@${String(f.version)}`}),g&&(0,b.jsxs)("span",{className:"text-muted-foreground",children:["checks in ",(0,G.checkInText)(g.checkInMinutes)]}),(0,b.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[e," ",1===e?"member":"members"]})]})}function ak({issued:a,template:c}){return(0,b.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-3 py-2.5",children:[(0,b.jsx)(ae.LaunchNote,{note:a.launchNote,model:a.model,template:c,testId:"member-launch-note"}),(0,b.jsxs)("p",{className:"flex items-center gap-1.5 text-meta text-muted-foreground",children:[(0,b.jsx)(ab.Info,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("span",{children:[(0,b.jsx)("span",{className:"font-medium",children:"Shown once."})," Paste a member’s crew line into Claude Code or Codex started where the launch note says, or into a chat client with the fleet’s connector."]})]})]})}function al({member:a,issued:c,ship:d,now:e,renderActions:f}){return(0,b.jsxs)("li",{"data-testid":"member-row",className:"flex flex-col gap-2 px-3 py-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(m.default,{href:`/ships/${a.shipId}`,className:"font-medium hover:underline","data-testid":"member-name",children:a.name}),(0,b.jsx)(ad.HealthIndicator,{health:a.health,detail:function(a,{ship:b,now:c}){let{lastSeenAt:d}=a.crew;if("late"!==a.health&&"silent"!==a.health||null===d)return;let e=(0,n.lastSeen)(new Date(d),c).replace(/^Last/,"last"),f=b?.location?.description;return f?`${e} on ${f}`:e}(a,{ship:d,now:e}),className:"shrink-0"}),a.model.isMismatch&&(0,b.jsxs)("span",{className:"text-meta text-tone-attention-fg",children:["Runs ",a.model.stated??"an unstated model",", not ",a.model.pinned]}),(0,b.jsx)(ai,{ship:d,now:e}),f?.(a)]}),c&&(0,b.jsx)(ac.CompactCrewLine,{crewLines:c.crewLines,subject:a.name,testIdPrefix:"member-crew-line"})]})}function am({squadron:a,blueprint:c,templates:d,crewLines:e,ships:f,now:g,renderActions:h}){if(0===a.members.length)return(0,b.jsx)(o.EmptyState,{variant:"section",title:"No members",description:"This squadron has no members."});let i=a=>null===a.onStationAt?e.get(a.shipId):void 0;return(0,b.jsx)("div",{"data-testid":"member-list",className:"flex flex-col overflow-hidden rounded-lg border border-border",children:(0,G.membersByRole)(a.members).map(a=>{let e=c?.roles.find(b=>b.name===a.role)?.template,j=a.members.map(i).find(a=>void 0!==a);return(0,b.jsxs)("section",{"aria-label":`Role ${a.role}`,children:[(0,b.jsx)(aj,{role:a.role,blueprint:c,templates:d,count:a.members.length}),j&&(0,b.jsx)(ak,{issued:j,template:e&&`${e.name}@${String(e.version)}`}),(0,b.jsx)("ul",{className:"divide-y divide-border",children:a.members.map(a=>(0,b.jsx)(al,{member:a,issued:i(a),ship:f.get(a.shipId),now:g,renderActions:h},a.shipId))})]},a.role)})})}var an=a.i(80487);let ao={forming:{done:"on station",next:"Sails when all are on station"},standdown:{done:"finished their work",next:"Disbands when all are done"}};function ap({done:a,total:c,variant:d,className:e}){let f=ao[d],g=1===c?"member":"members";return(0,b.jsxs)("div",{"data-slot":"station-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":a,"aria-label":`${String(a)} of ${String(c)} ${g} ${f.done}`,className:(0,an.classNames)("flex flex-col gap-1.5",e),children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2 text-meta",children:[(0,b.jsxs)("p",{role:"status","aria-live":"polite",className:"text-foreground","data-testid":"station-progress",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a," of ",c," ",g]})," ",f.done]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:f.next})]}),(0,b.jsx)("div",{"aria-hidden":!0,className:"flex gap-1",children:Array.from({length:c},(c,d)=>(0,b.jsx)("span",{className:(0,an.classNames)("h-1.5 grow rounded-full",d<a?"bg-tone-ok-fg":"bg-muted")},`segment-${String(d)}`))})]})}function aq({squadron:a,squadronId:c,state:d,actions:e,onForceStandDown:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"detail",rows:2,label:"Loading the squadron"});if("not-found"===d||!a)return(0,b.jsx)(o.EmptyState,{title:"No such squadron",description:`The squadron manager knows no squadron ${c}.`});let{onStation:g,total:h}=(0,G.stationCount)(a);return(0,b.jsxs)("header",{"data-testid":"squadron-header",className:"flex flex-col gap-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5",children:[(0,b.jsx)("h1",{className:"text-title font-semibold",children:a.id}),(0,b.jsx)(ah.StatusBadge,{status:a.state}),(0,b.jsxs)(m.default,{href:(0,G.blueprintPath)(a.blueprint),className:"text-meta text-muted-foreground hover:underline","data-testid":"squadron-blueprint",children:[(0,b.jsx)("span",{className:"font-mono",children:a.blueprint.name})," v",a.blueprint.version]}),e&&(0,b.jsx)("div",{className:"ml-auto flex gap-2",children:e})]}),(0,b.jsxs)("dl",{className:"flex flex-wrap gap-x-6 gap-y-1 text-meta text-muted-foreground",children:[(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Flagship"}),(0,b.jsx)("dd",{className:"font-mono text-foreground",children:a.flagship.name})]}),(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Members"}),(0,b.jsx)("dd",{className:"text-foreground",children:h})]}),(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Formed"}),(0,b.jsx)("dd",{className:"text-foreground",children:(0,n.shortDateTime)(new Date(a.formedAt))})]})]}),"standing-down"===a.state&&(0,b.jsxs)("div",{role:"status","data-testid":"squadron-state-notice",className:"flex flex-wrap items-center gap-3 rounded-lg border border-tone-waiting-border bg-tone-waiting-bg px-3 py-2.5 text-meta text-foreground",children:[(0,b.jsx)("span",{className:"grow",children:"No new work reaches its members. They finish their open work, then retire and the squadron disbands."}),f&&(0,b.jsx)(y.Button,{size:"xs","data-testid":"squadron-notice-force-stand-down",onClick:f,children:"Force stand down…"})]}),"disbanded"===a.state&&(0,b.jsxs)("div",{role:"status","data-testid":"squadron-state-notice",className:"rounded-lg border border-tone-ended-border bg-tone-ended-bg px-3 py-2.5 text-meta text-foreground",children:["Read-only. Its ",1===h?"1 member ship":`${String(h)} member ships`," and its flagship were retired; their history stays."]}),"forming"===a.state&&(0,b.jsx)(ap,{done:g,total:h,variant:"forming",className:"max-w-md"}),"standing-down"===a.state&&(0,b.jsx)(ap,{done:a.members.filter(a=>"retired"===a.crew.status).length,total:h,variant:"standdown",className:"max-w-md"})]})}var ar=a.i(26110);let as={working:"working",idle:"idle",blocked:"blocked"};function at({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsx)("span",{className:"text-caption font-medium text-muted-foreground",children:a}),(0,b.jsx)("span",{className:"text-meta text-foreground",children:c})]})}function au({health:a,work:c,openDeliveries:d,keptCount:e}){return(0,b.jsxs)("div",{"aria-label":"Squadron summary","data-testid":"squadron-summary",className:"grid grid-cols-4 gap-4 rounded-lg border border-border bg-card px-4 py-3 shadow-sm max-sm:grid-cols-2 max-sm:gap-3",children:[(0,b.jsx)(at,{label:"Health",children:0===a.length?"None":(0,b.jsx)(ad.HealthSummary,{counts:a})}),(0,b.jsx)(at,{label:"Work",children:0===c.length?"None reported":c.map(({state:a,count:b})=>`${String(b)} ${as[a]}`).join(", ")}),(0,b.jsx)(at,{label:"Open deliveries",children:void 0===d?"…":`${String(d)} in member inboxes`}),(0,b.jsx)(at,{label:"Kept by the flagship",children:void 0===e?"…":0===e?"None":String(e)})]})}var av=a.i(55138),aw=a.i(65563),ax=a.i(94764),ay=a.i(26949),az=a.i(67336),aA=a.i(10023),aB=a.i(68450),aC=a.i(10572),aD=a.i(99929),aE=a.i(54763),aF=a.i(12540);a.s(["default",0,function({params:a,searchParams:k}){let{squadronId:l}=(0,e.use)(a),m=(0,e.use)(k).action,n=(0,d.useRouter)(),o=(0,aB.useNow)(),p=(0,ax.useAccountMenu)(o),s=(0,aE.useHasSquadrons)(),t=(0,ay.useOpenInboxCount)(),u=(0,aA.useNeedsAttention)(),v=(0,aA.useAttentionCount)(),w=(0,az.useLiveFleet)(),x=(0,aF.useSquadrons)(),y=(0,aE.useSquadronsConnection)(),z=(0,aF.useCatalogue)(),A=(0,aF.useIssuedCrewLines)(l),B=(0,aF.useKeptMessages)(l),C=(0,aF.useStandDown)(),[D,F]=(0,e.useState)(!1),H=(0,aF.useForceStandDown)(),[I,L]=(0,e.useState)(!1),M=(0,aF.useAddMember)(),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(void 0),R=(0,aF.useRemoveMember)(),[S,T]=(0,e.useState)(void 0),U=(0,aw.useAccess)(),[V,W]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(!1),[$,ab]=(0,e.useState)(!1);(0,aC.useSignInWhenSessionEnds)([u.error,w.error]);let ac=x.data?.find(a=>a.id===l),ad=(0,aD.useShips)(ac?.members.map(a=>a.shipId)??[]),ae=[...ad.values()].reduce((a,b)=>a+b.openDeliveries,0),af=[...ad.values()].reduce((a,b)=>a+b.inFlightDeliveries,0),ag=z.data?.blueprints.find(a=>a.repository===ac?.blueprint.repository&&a.name===ac.blueprint.name&&a.version===ac.blueprint.version),ah=ac&&ag?(0,G.roleOptions)(ac,{blueprint:ag,templates:z.data?.templates??[]}):[],ai=S?ad.get(S.shipId):void 0,aj=S?ah.find(a=>a.role===S.role):void 0,ak=ac?(0,c.idSchema)("ship").safeParse(ac.flagship.shipId).data:void 0,al=ac?(0,G.squadronActionsOffered)(ac,{canManage:U.canManage,canSend:U.canSend,hasRoles:ah.length>0}):void 0,an="add-member"===m&&al?.canAddMember===!0,ao="stand-down"===m&&al?.canStandDown===!0,ap=()=>{void 0!==m&&n.replace(`/squadrons/${l}`,{scroll:!1})},as=ac?.state==="sailing"||ac?.state==="standing-down";return(0,b.jsxs)(ar.DetailLayout,{title:l,parents:[{href:"/squadrons",label:"Squadrons"}],header:(0,b.jsx)(aq,{squadron:ac,squadronId:l,state:x.data?ac?"ready":"not-found":"loading",actions:ac&&al?(0,b.jsx)(_,{squadronId:ac.id,offered:al,onAddMember:()=>{M.reset(),O(!0)},onMessageFlagship:()=>{Z(!0)},onStandDown:()=>{C.reset(),F(!0)},onForceStandDown:()=>{H.reset(),L(!0)}}):void 0,onForceStandDown:U.canManage?()=>{H.reset(),L(!0)}:void 0}),live:w.live,nav:{active:"squadrons",inboxCount:t,attentionCount:v,hasSquadrons:s,hasSettings:s&&U.canManage},onCompose:U.canSend?()=>{W(!0)}:void 0,onSearch:()=>{ab(!0)},account:p,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ConsoleNotices,{}),(0,b.jsx)(h.ConsoleGuide,{})]}),children:["not-connected"===y?(0,b.jsx)(av.SquadronsNotConnected,{}):ac?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(au,{health:(0,G.healthCounts)(ac.members),work:(0,G.workCounts)(ac.members.map(a=>ad.get(a.shipId)?.report??null)),openDeliveries:ad.size===ac.members.length?ae:void 0,keptCount:B.data?.length}),(0,b.jsx)(am,{squadron:ac,blueprint:ag,templates:z.data?.templates??[],crewLines:A,ships:ad,now:o,renderActions:a=>(0,b.jsx)(X,{squadronId:ac.id,member:a,ship:ad.get(a.shipId),template:ah.find(b=>b.role===a.role)?.template,canManage:U.canManage,canSend:U.canSend,isRemovable:as,onRemove:()=>{R.reset(),T(a)}})})]}):x.data?null:(0,b.jsx)(q.LoadingSkeleton,{variant:"list",label:"Loading the members"}),ag&&(0,b.jsx)(j.HandoffWiring,{blueprint:ag}),ac&&(0,b.jsx)(r,{messages:B.data??[],state:B.isError?"error":B.data?"ready":"loading",error:B.error?.message,onRetry:()=>{B.refetch()},flagshipId:ac.flagship.shipId,now:o}),ac&&(0,b.jsx)(E,{squadronId:ac.id,memberCount:ac.members.length,openDeliveries:ae,inFlightDeliveries:af,isOpen:D||ao,onOpenChange:a=>{F(a),a||ap()},isPending:C.isPending,error:C.error?.message,onConfirm:()=>{C.mutate(ac.id,{onSuccess:()=>{F(!1),ap()}})}}),ac&&(0,b.jsx)(E,{isForced:!0,squadronId:ac.id,memberCount:ac.members.length,openDeliveries:ae,inFlightDeliveries:af,isOpen:I,onOpenChange:L,isPending:H.isPending,error:H.error?.message,onConfirm:()=>{H.mutate(ac.id,{onSuccess:()=>{L(!1)}})}}),ac&&ah.length>0&&(0,b.jsx)(J,{squadronId:ac.id,blueprint:`${ac.blueprint.name} v${String(ac.blueprint.version)}`,roles:ah,isOpen:N||an,onOpenChange:a=>{O(a),a||ap()},isPending:M.isPending,error:M.error?.message,onSubmit:a=>{M.mutate({squadronId:ac.id,role:a},{onSuccess:a=>{O(!1),ap(),Q(a)}})}}),ac&&S&&(0,b.jsx)(aa.RemoveMemberDialog,{squadronId:ac.id,member:S,othersOfRole:(0,G.otherMembersOfRole)(ac,S.shipId),blueprint:aj?{label:`${ac.blueprint.name} v${String(ac.blueprint.version)}`,count:aj.inBlueprint}:void 0,openDeliveries:ai?.openDeliveries??0,inFlightDeliveries:ai?.inFlightDeliveries??0,isOpen:void 0!==ai,onOpenChange:a=>{a||T(void 0)},isPending:R.isPending,error:R.error?.message,onConfirm:()=>{R.mutate({squadronId:ac.id,shipId:S.shipId},{onSuccess:()=>{T(void 0)}})}}),P&&(0,b.jsx)(K.CrewLineDialog,{memberName:P.name,state:"shown",template:ah.find(a=>a.role===P.role)?.template,launchNote:P.launchNote,model:P.model,crewLines:P.crewLines,isOpen:!0,onOpenChange:a=>{a||Q(void 0)}}),(0,b.jsx)(f.ComposeMessage,{isOpen:V,onOpenChange:W}),ak&&(0,b.jsx)(f.ComposeMessage,{isOpen:Y,onOpenChange:Z,toShipId:ak}),(0,b.jsx)(g.ConsoleCommands,{isOpen:$,onOpenChange:ab,onCompose:()=>{W(!0)}})]})}],9107)}];
1
+ module.exports=[9107,a=>{"use strict";var b=a.i(87924);a.i(23600);var c=a.i(2811),d=a.i(50944),e=a.i(72131),f=a.i(15439),g=a.i(2549),h=a.i(83786),i=a.i(68698),j=a.i(90487),k=a.i(41146),l=a.i(78958),m=a.i(38246),n=a.i(72872),o=a.i(24173),p=a.i(40392),q=a.i(50808);function r({messages:a,state:c,error:d,onRetry:e,flagshipId:f,now:g}){return(0,b.jsxs)("section",{"aria-labelledby":"kept-messages","data-testid":"kept-messages",className:"flex flex-col gap-2",children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsx)("h2",{id:"kept-messages",className:"text-body font-semibold",children:"Messages the flagship kept"}),(0,b.jsx)("p",{className:"text-meta text-muted-foreground",children:"Messages to the flagship it does not handle: kept here, never forwarded."})]}),"loading"===c?(0,b.jsx)(q.LoadingSkeleton,{variant:"list",rows:2,label:"Loading the kept messages"}):"error"===c?(0,b.jsx)(p.InlineError,{title:"Couldn’t load the kept messages",description:"The rest of the page is current. Try again in a moment.",detail:d,onRetry:e}):0===a.length?(0,b.jsx)(o.EmptyState,{variant:"section",icon:(0,b.jsx)(l.Inbox,{"aria-hidden":!0}),title:"No kept messages",description:"Every message to the flagship was the squadron's own."}):(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border",children:a.map(a=>(0,b.jsx)("li",{"data-testid":"kept-message",children:(0,b.jsxs)(m.default,{href:`/ships/${f}?tab=messages&message=${a.messageId}`,className:"flex items-center gap-3 px-3 py-2.5 hover:bg-accent",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"flex flex-wrap items-center gap-x-2 text-meta",children:[(0,b.jsx)("span",{className:"font-medium text-foreground",children:a.senderName}),(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:a.contentType}),(0,b.jsx)("time",{dateTime:a.receivedAt,className:"text-muted-foreground",children:(0,n.relativeTime)(new Date(a.receivedAt),g)})]}),(0,b.jsx)("span",{className:"truncate text-body",children:a.payload.split("\n")[0]??""})]}),(0,b.jsx)(k.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon) shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"sr-only",children:"Open the message"})]})},a.deliveryId))})]})}var s=a.i(79762),t=a.i(70840),u=a.i(19459),v=a.i(26268),w=a.i(46444),x=a.i(59613),y=a.i(12068),z=a.i(2374),A=a.i(71673),B=a.i(65698);function C(a){return`${String(a)} ${1===a?"delivery":"deliveries"}`}function D(a){let{squadronId:c,memberCount:d,openDeliveries:f,inFlightDeliveries:g,isForced:h=!1,isPending:i,error:j,onConfirm:k}=a,[l,m]=(0,e.useState)(""),n=h&&f>0,o=!n||(0,w.isTypedMatch)(c,l),q=void 0===j?null:(0,b.jsx)(p.InlineError,{title:"Couldn’t stand down the squadron",description:`${j} Nothing changed; the squadron still sails.`});return h?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(x.AlertDialogHeader,{children:[(0,b.jsxs)(x.AlertDialogTitle,{children:["Force stand down ",c,"?"]}),(0,b.jsx)(x.AlertDialogDescription,{children:"The squadron disbands right away. This can't be undone."})]}),f>0?(0,b.jsxs)("div",{role:"alert",className:"flex gap-2 rounded-lg border border-tone-attention-border bg-tone-attention-bg p-3 text-meta text-tone-attention-fg",children:[(0,b.jsx)(v.TriangleAlert,{"aria-hidden":!0,className:"mt-0.5 size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsxs)("p",{className:"font-medium",children:[C(f)," will be abandoned"]}),(0,b.jsxs)("p",{className:"text-foreground",children:["Members and the flagship retire now, without finishing. ",f-g," pending, ",g," in flight."]})]})]}):(0,b.jsx)(A.ConsequenceList,{consequences:[{icon:s.Archive,text:"Every member ship and the flagship retire now and the squadron is disbanded. No open work is lost."}]}),n?(0,b.jsx)(B.TypedConfirm,{expected:c,value:l,onValueChange:m}):null,q,(0,b.jsxs)(x.AlertDialogFooter,{children:[(0,b.jsx)(x.AlertDialogClose,{render:(0,b.jsx)(y.Button,{disabled:i}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"destructive",isLoading:i,disabled:!o,onClick:k,"data-testid":"force-stand-down-confirm",children:f>0?`Stand down now and abandon ${C(f)}`:"Force stand down"})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(x.AlertDialogHeader,{children:[(0,b.jsxs)(x.AlertDialogTitle,{children:["Stand down ",c,"?"]}),(0,b.jsxs)(x.AlertDialogDescription,{children:["Its ",d," ",1===d?"member winds":"members wind"," down on their own. This can't be undone."]})]}),(0,b.jsx)(A.ConsequenceList,{consequences:[{icon:t.Ban,text:"No new work reaches its members; hand-offs stop."},{icon:u.Hourglass,text:`Members finish their open work: ${C(f)}.`},{icon:s.Archive,text:"Then each member ship and the flagship retire and the squadron is disbanded. History stays read-only."}]}),q,(0,b.jsxs)(x.AlertDialogFooter,{children:[(0,b.jsx)(x.AlertDialogClose,{render:(0,b.jsx)(y.Button,{disabled:i}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"destructive",isLoading:i,onClick:k,"data-testid":"stand-down-confirm",children:i?"Standing down":"Stand down squadron"})]})]})}function E(a){let{isOpen:c,onOpenChange:d,isPending:e,isForced:f=!1}=a;return(0,b.jsx)(x.AlertDialog,{open:c,onOpenChange:a=>{e||d(a)},children:(0,b.jsx)(x.AlertDialogContent,{"data-testid":f?"force-stand-down-dialog":"stand-down-dialog",className:z.dialogSurface.phoneSheet,children:(0,b.jsx)(D,{...a})})})}var F=a.i(73594),G=a.i(8219),H=a.i(18441);function I({squadronId:a,blueprint:c,roles:d,isPending:f,error:g,onSubmit:h}){let[i,j]=(0,e.useState)(d[0]?.role),k=d.find(a=>a.role===i)??d[0];return k?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(H.DialogHeader,{children:[(0,b.jsxs)(H.DialogTitle,{children:["Add a member to ",a]}),(0,b.jsx)(H.DialogDescription,{children:"Roles come from its blueprint. Next you get the new member's crew lines."})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,b.jsx)("span",{className:"text-meta font-medium",children:"Role"}),(0,b.jsx)("div",{role:"radiogroup","aria-label":"Role",className:"flex flex-col gap-2",children:d.map(a=>(0,b.jsxs)("button",{type:"button",role:"radio","aria-checked":a.role===k.role,"data-testid":"add-member-role",onClick:()=>{j(a.role)},className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-left text-meta aria-checked:border-primary aria-checked:ring-1 aria-checked:ring-primary",children:[(0,b.jsx)("span",{className:"rounded-sm bg-muted px-1.5 font-mono",children:a.role}),(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:a.template}),(0,b.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[a.now," now"]})]},a.role))})]}),(0,b.jsxs)("p",{className:"flex items-start gap-2 rounded-md bg-muted px-3 py-2 text-meta text-muted-foreground",children:[(0,b.jsx)(F.UserPlus,{"aria-hidden":!0,className:"mt-0.5 size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("span",{children:["A new ship of the role ",k.role,", template ",(0,b.jsx)("span",{className:"font-mono",children:k.template}),void 0===k.checkInMinutes?"":`, checks in ${(0,G.checkInText)(k.checkInMinutes)}`,". Blueprint ",c," has ",k.inBlueprint," ",k.role,"; the squadron then has ",k.now+1,"."]})]}),void 0!==g&&(0,b.jsx)(p.InlineError,{variant:"field",title:"Couldn’t add the member",description:`${g} No ship was commissioned.`}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(H.DialogClose,{render:(0,b.jsx)(y.Button,{type:"button",disabled:f}),children:"Cancel"}),(0,b.jsx)(y.Button,{variant:"primary",isLoading:f,"data-testid":"add-member-submit",onClick:()=>{h(k.role)},children:f?"Adding":"Add member"})]})]}):null}function J(a){let{isOpen:c,onOpenChange:d,isPending:e}=a;return(0,b.jsx)(H.Dialog,{open:c,onOpenChange:a=>{e||d(a)},children:(0,b.jsx)(H.DialogContent,{size:"md","data-testid":"add-member-dialog",className:z.dialogSurface.phoneFullScreen,children:(0,b.jsx)(I,{...a})})})}var K=a.i(52702),L=a.i(85650),M=a.i(42955),N=a.i(26766),O=a.i(17256),P=a.i(64831);let Q={name:"square-arrow-out-up-right",size:24,node:[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],aliases:["arrow-up-right-from-square"]};Q.node;let R=(0,P.default)(Q);var S=a.i(28339),T=a.i(55280),U=a.i(4838),V=a.i(88191),W=a.i(42231);function X({squadronId:a,member:d,ship:g,template:h,canManage:i,canSend:j,isRemovable:k,onRemove:l}){let[n,o]=(0,e.useState)(!1),p="retired"===d.crew.status||g?.status==="retired",q=(0,W.useNewCrewLineFlow)(i&&!p?{squadronId:a,member:d,ship:g,template:h}:void 0),r=(0,c.idSchema)("ship").safeParse(d.shipId).data,s=async()=>{try{await navigator.clipboard.writeText(d.shipId),(0,V.showToast)({title:"Ship id copied",description:d.shipId,tone:"success"})}catch{(0,V.showToast)({title:"Couldn’t copy the ship id",description:d.shipId,tone:"error"})}},t=[{key:"open",label:"Open ship page",icon:R,testId:"member-open-ship",href:`/ships/${d.shipId}`},...j&&!p&&r?[{key:"message",label:"Message…",icon:O.SquarePen,testId:"member-message",onSelect:()=>{o(!0)}}]:[],...i&&!p?[{key:"crew-line",label:"Get new crew line…",icon:N.KeyRound,testId:"member-new-crew-line",isDisabled:!q.isReady,onSelect:q.start}]:[],{key:"copy",label:"Copy ship id",icon:L.Copy,testId:"member-copy-id",onSelect:()=>void s()}],u=i&&k&&!p?{key:"remove",label:"Remove from squadron…",icon:S.UserMinus,testId:"member-remove",isDestructive:!0,onSelect:l}:void 0,v=a=>(0,b.jsx)(y.Button,{size:a,variant:"ghost",isIconOnly:!0,"aria-label":`Actions for ${d.name}`,icon:(0,b.jsx)(M.Ellipsis,{}),"data-testid":"member-actions"});return(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[i&&!p&&"silent"===d.health&&(0,b.jsx)(y.Button,{size:"xs",disabled:!q.isReady,"data-testid":"member-new-crew-line-primary",onClick:q.start,children:"Get new crew line"}),(0,b.jsx)("span",{className:"max-sm:hidden",children:(0,b.jsxs)(T.DropdownMenu,{children:[(0,b.jsx)(T.DropdownMenuTrigger,{render:v("xs")}),(0,b.jsxs)(T.DropdownMenuContent,{align:"end",children:[t.map(a=>void 0===a.href?(0,b.jsxs)(T.DropdownMenuItem,{disabled:a.isDisabled,onClick:a.onSelect,"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key):(0,b.jsxs)(T.DropdownMenuItem,{render:(0,b.jsx)(m.default,{href:a.href}),"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key)),u&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T.DropdownMenuSeparator,{}),(0,b.jsxs)(T.DropdownMenuItem,{variant:"destructive",onClick:u.onSelect,"data-testid":u.testId,children:[(0,b.jsx)(u.icon,{"aria-hidden":!0}),u.label]})]})]})]})}),(0,b.jsx)("span",{className:"sm:hidden",children:(0,b.jsxs)(U.Sheet,{children:[(0,b.jsx)(U.SheetTrigger,{render:v("touch")}),(0,b.jsxs)(U.SheetContent,{side:"bottom",children:[(0,b.jsx)(U.SheetHeader,{children:(0,b.jsx)(U.SheetTitle,{children:d.name})}),(0,b.jsx)("ul",{className:"flex flex-col pb-2",children:[...t,...u?[u]:[]].map(a=>(0,b.jsx)("li",{className:!0===a.isDestructive?"mt-1 border-t border-border pt-1":void 0,children:(0,b.jsxs)(U.SheetClose,{render:void 0===a.href?(0,b.jsx)("button",{type:"button",disabled:a.isDisabled,onClick:a.onSelect}):(0,b.jsx)(m.default,{href:a.href}),className:`flex h-(--size-control-touch) w-full items-center gap-3 px-4 text-left text-body-touch disabled:opacity-45 [&_svg]:size-(--size-icon) [&_svg]:shrink-0 ${!0===a.isDestructive?"text-destructive-text":"text-foreground"}`,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label.replace(/…$/,"")]})},a.key))}),(0,b.jsx)("div",{className:"px-4 pb-4",children:(0,b.jsx)(U.SheetClose,{render:(0,b.jsx)(y.Button,{size:"touch",className:"w-full"}),children:"Cancel"})})]})]})}),q.dialog,r&&(0,b.jsx)(f.ComposeMessage,{isOpen:n,onOpenChange:o,toShipId:r})]})}let Y={name:"octagon-x",size:24,node:[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-octagon"]};Y.node;let Z=(0,P.default)(Y);var $=a.i(46916);function _({squadronId:a,offered:c,onAddMember:d,onMessageFlagship:e,onStandDown:f,onForceStandDown:g}){let h=async()=>{try{await navigator.clipboard.writeText(a),(0,V.showToast)({title:"Squadron id copied",description:a,tone:"success"})}catch{(0,V.showToast)({title:"Couldn’t copy the squadron id",description:a,tone:"error"})}},i={key:"copy",label:"Copy squadron id",icon:L.Copy,testId:"squadron-copy-id",onSelect:()=>void h()},j=[...c.canStandDown?[{key:"stand-down",label:"Stand down…",icon:$.Waves,testId:"squadron-stand-down",isDestructive:!0,onSelect:f}]:[],...c.canForceStandDown?[{key:"force",label:"Force stand down…",icon:Z,testId:"squadron-force-stand-down",isDestructive:!0,onSelect:g}]:[]],k=a=>(0,b.jsx)(y.Button,{size:a,variant:"ghost",isIconOnly:!0,"aria-label":"Squadron actions",icon:(0,b.jsx)(M.Ellipsis,{}),"data-testid":"squadron-actions"});return(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[c.canAddMember&&(0,b.jsx)(y.Button,{size:"xs",icon:(0,b.jsx)(F.UserPlus,{}),"data-testid":"squadron-add-member",onClick:d,children:"Add member"}),c.canMessageFlagship&&(0,b.jsx)(y.Button,{size:"xs",icon:(0,b.jsx)(O.SquarePen,{}),"data-testid":"squadron-message-flagship",onClick:e,children:"Message"}),(0,b.jsx)("div",{className:"max-sm:hidden",children:(0,b.jsxs)(T.DropdownMenu,{children:[(0,b.jsx)(T.DropdownMenuTrigger,{render:k("xs")}),(0,b.jsxs)(T.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(T.DropdownMenuItem,{onClick:i.onSelect,"data-testid":i.testId,children:[(0,b.jsx)(L.Copy,{"aria-hidden":!0}),i.label]}),j.length>0&&(0,b.jsx)(T.DropdownMenuSeparator,{}),j.map(a=>(0,b.jsxs)(T.DropdownMenuItem,{variant:"destructive",onClick:a.onSelect,"data-testid":a.testId,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label]},a.key))]})]})}),(0,b.jsx)("div",{className:"sm:hidden",children:(0,b.jsxs)(U.Sheet,{children:[(0,b.jsx)(U.SheetTrigger,{render:k("touch")}),(0,b.jsxs)(U.SheetContent,{side:"bottom","data-testid":"squadron-actions-sheet",children:[(0,b.jsx)(U.SheetHeader,{children:(0,b.jsx)(U.SheetTitle,{children:a})}),(0,b.jsx)("ul",{className:"flex flex-col pb-2",children:[i,...j].map((a,c)=>(0,b.jsx)("li",{className:1===c?"mt-1 border-t border-border pt-1":void 0,children:(0,b.jsxs)(U.SheetClose,{render:(0,b.jsx)("button",{type:"button",onClick:a.onSelect}),className:`flex h-(--size-control-touch) w-full items-center gap-3 px-4 text-left text-body-touch [&_svg]:size-(--size-icon) [&_svg]:shrink-0 ${!0===a.isDestructive?"text-destructive-text":"text-foreground"}`,children:[(0,b.jsx)(a.icon,{"aria-hidden":!0}),a.label.replace(/…$/,"")]})},a.key))}),(0,b.jsx)("div",{className:"px-4 pb-4",children:(0,b.jsx)(U.SheetClose,{render:(0,b.jsx)(y.Button,{size:"touch",className:"w-full"}),children:"Cancel"})})]})]})})]})}var aa=a.i(80459),ab=a.i(52357),ac=a.i(21327),ad=a.i(75971),ae=a.i(3842),af=a.i(40108),ag=a.i(92717),ah=a.i(23063);function ai({ship:a,now:c}){return a?(0,b.jsxs)("div",{className:"flex grow flex-wrap items-center justify-end gap-x-4 gap-y-1 text-meta",children:["crewed"===a.status?(0,b.jsx)(ag.ReportLine,{report:a.report,now:c,variant:"row",testId:"member-report"}):(0,b.jsx)(ah.StatusBadge,{status:a.status}),a.location?(0,b.jsx)(af.LocationTag,{kind:a.location.kind,description:a.location.description,isCompact:!0,size:"sm"}):(0,b.jsx)("span",{className:"text-muted-foreground",children:"No session"}),(0,b.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground","data-testid":"member-inbox",children:[(0,b.jsx)(l.Inbox,{"aria-hidden":!0,className:"size-(--size-icon-sm)"}),a.openDeliveries,(0,b.jsx)("span",{className:"sr-only",children:" open"})]})]}):null}function aj({role:a,blueprint:c,templates:d,count:e}){let f=c?.roles.find(b=>b.name===a)?.template,g=d.find(a=>a.repository===f?.repository&&a.name===f.name&&a.version===f.version);return(0,b.jsxs)("div",{className:"flex items-center gap-2 bg-muted px-3 py-1.5 text-meta",children:[(0,b.jsx)("span",{className:"rounded-sm bg-card px-1.5 font-mono",children:a}),f&&(0,b.jsx)("span",{className:"font-mono text-muted-foreground",children:`${f.name}@${String(f.version)}`}),g&&(0,b.jsxs)("span",{className:"text-muted-foreground",children:["checks in ",(0,G.checkInText)(g.checkInMinutes)]}),(0,b.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[e," ",1===e?"member":"members"]})]})}function ak({issued:a,template:c}){return(0,b.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-3 py-2.5",children:[(0,b.jsx)(ae.LaunchNote,{note:a.launchNote,model:a.model,template:c,testId:"member-launch-note"}),(0,b.jsxs)("p",{className:"flex items-center gap-1.5 text-meta text-muted-foreground",children:[(0,b.jsx)(ab.Info,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0"}),(0,b.jsxs)("span",{children:[(0,b.jsx)("span",{className:"font-medium",children:"Shown once."})," Paste a member’s crew line into Claude Code or Codex started where the launch note says, or into a chat client with the fleet’s connector."]})]})]})}function al({member:a,issued:c,ship:d,now:e,renderActions:f}){return(0,b.jsxs)("li",{"data-testid":"member-row",className:"flex flex-col gap-2 px-3 py-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(m.default,{href:`/ships/${a.shipId}`,className:"font-medium hover:underline","data-testid":"member-name",children:a.name}),(0,b.jsx)(ad.HealthIndicator,{health:a.health,detail:function(a,{ship:b,now:c}){let{lastSeenAt:d}=a.crew;if("late"!==a.health&&"silent"!==a.health||null===d)return;let e=(0,n.lastSeen)(new Date(d),c).replace(/^Last/,"last"),f=b?.location?.description;return f?`${e} on ${f}`:e}(a,{ship:d,now:e}),className:"shrink-0"}),a.model.isMismatch&&(0,b.jsxs)("span",{className:"text-meta text-tone-attention-fg",children:["Runs ",a.model.stated??"an unstated model",", not ",a.model.pinned]}),(0,b.jsx)(ai,{ship:d,now:e}),f?.(a)]}),c&&(0,b.jsx)(ac.CompactCrewLine,{crewLines:c.crewLines,subject:a.name,testIdPrefix:"member-crew-line"})]})}function am({squadron:a,blueprint:c,templates:d,crewLines:e,ships:f,now:g,renderActions:h}){if(0===a.members.length)return(0,b.jsx)(o.EmptyState,{variant:"section",title:"No members",description:"This squadron has no members."});let i=a=>null===a.onStationAt?e.get(a.shipId):void 0;return(0,b.jsx)("div",{"data-testid":"member-list",className:"flex flex-col overflow-hidden rounded-lg border border-border",children:(0,G.membersByRole)(a.members).map(a=>{let e=c?.roles.find(b=>b.name===a.role)?.template,j=a.members.map(i).find(a=>void 0!==a);return(0,b.jsxs)("section",{"aria-label":`Role ${a.role}`,children:[(0,b.jsx)(aj,{role:a.role,blueprint:c,templates:d,count:a.members.length}),j&&(0,b.jsx)(ak,{issued:j,template:e&&`${e.name}@${String(e.version)}`}),(0,b.jsx)("ul",{className:"divide-y divide-border",children:a.members.map(a=>(0,b.jsx)(al,{member:a,issued:i(a),ship:f.get(a.shipId),now:g,renderActions:h},a.shipId))})]},a.role)})})}var an=a.i(80487);let ao={forming:{done:"on station",next:"Sails when all are on station"},standdown:{done:"finished their work",next:"Disbands when all are done"}};function ap({done:a,total:c,variant:d,className:e}){let f=ao[d],g=1===c?"member":"members";return(0,b.jsxs)("div",{"data-slot":"station-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":a,"aria-label":`${String(a)} of ${String(c)} ${g} ${f.done}`,className:(0,an.classNames)("flex flex-col gap-1.5",e),children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2 text-meta",children:[(0,b.jsxs)("p",{role:"status","aria-live":"polite",className:"text-foreground","data-testid":"station-progress",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a," of ",c," ",g]})," ",f.done]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:f.next})]}),(0,b.jsx)("div",{"aria-hidden":!0,className:"flex gap-1",children:Array.from({length:c},(c,d)=>(0,b.jsx)("span",{className:(0,an.classNames)("h-1.5 grow rounded-full",d<a?"bg-tone-ok-fg":"bg-muted")},`segment-${String(d)}`))})]})}function aq({squadron:a,squadronId:c,state:d,actions:e,onForceStandDown:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"detail",rows:2,label:"Loading the squadron"});if("not-found"===d||!a)return(0,b.jsx)(o.EmptyState,{title:"No such squadron",description:`The squadron manager knows no squadron ${c}.`});let{onStation:g,total:h}=(0,G.stationCount)(a);return(0,b.jsxs)("header",{"data-testid":"squadron-header",className:"flex flex-col gap-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5",children:[(0,b.jsx)("h1",{className:"text-title font-semibold",children:a.id}),(0,b.jsx)(ah.StatusBadge,{status:a.state}),(0,b.jsxs)(m.default,{href:(0,G.blueprintPath)(a.blueprint),className:"text-meta text-muted-foreground hover:underline","data-testid":"squadron-blueprint",children:[(0,b.jsx)("span",{className:"font-mono",children:a.blueprint.name})," v",a.blueprint.version]}),e&&(0,b.jsx)("div",{className:"ml-auto flex gap-2",children:e})]}),(0,b.jsxs)("dl",{className:"flex flex-wrap gap-x-6 gap-y-1 text-meta text-muted-foreground",children:[(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Flagship"}),(0,b.jsx)("dd",{className:"font-mono text-foreground",children:a.flagship.name})]}),(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Members"}),(0,b.jsx)("dd",{className:"text-foreground",children:h})]}),(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)("dt",{children:"Formed"}),(0,b.jsx)("dd",{className:"text-foreground",children:(0,n.shortDateTime)(new Date(a.formedAt))})]})]}),"standing-down"===a.state&&(0,b.jsxs)("div",{role:"status","data-testid":"squadron-state-notice",className:"flex flex-wrap items-center gap-3 rounded-lg border border-tone-waiting-border bg-tone-waiting-bg px-3 py-2.5 text-meta text-foreground",children:[(0,b.jsx)("span",{className:"grow",children:"No new work reaches its members. They finish their open work, then retire and the squadron disbands."}),f&&(0,b.jsx)(y.Button,{size:"xs","data-testid":"squadron-notice-force-stand-down",onClick:f,children:"Force stand down…"})]}),"disbanded"===a.state&&(0,b.jsxs)("div",{role:"status","data-testid":"squadron-state-notice",className:"rounded-lg border border-tone-ended-border bg-tone-ended-bg px-3 py-2.5 text-meta text-foreground",children:["Read-only. Its ",1===h?"1 member ship":`${String(h)} member ships`," and its flagship were retired; their history stays."]}),"forming"===a.state&&(0,b.jsx)(ap,{done:g,total:h,variant:"forming",className:"max-w-md"}),"standing-down"===a.state&&(0,b.jsx)(ap,{done:a.members.filter(a=>"retired"===a.crew.status).length,total:h,variant:"standdown",className:"max-w-md"})]})}var ar=a.i(26110);let as={working:"working",idle:"idle",blocked:"blocked"};function at({label:a,children:c}){return(0,b.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,b.jsx)("span",{className:"text-caption font-medium text-muted-foreground",children:a}),(0,b.jsx)("span",{className:"text-meta text-foreground",children:c})]})}function au({health:a,work:c,openDeliveries:d,keptCount:e}){return(0,b.jsxs)("div",{"aria-label":"Squadron summary","data-testid":"squadron-summary",className:"grid grid-cols-4 gap-4 rounded-lg border border-border bg-card px-4 py-3 shadow-sm max-sm:grid-cols-2 max-sm:gap-3",children:[(0,b.jsx)(at,{label:"Health",children:0===a.length?"None":(0,b.jsx)(ad.HealthSummary,{counts:a})}),(0,b.jsx)(at,{label:"Work",children:0===c.length?"None reported":c.map(({state:a,count:b})=>`${String(b)} ${as[a]}`).join(", ")}),(0,b.jsx)(at,{label:"Open deliveries",children:void 0===d?"…":`${String(d)} in member inboxes`}),(0,b.jsx)(at,{label:"Kept by the flagship",children:void 0===e?"…":0===e?"None":String(e)})]})}var av=a.i(55138),aw=a.i(65563),ax=a.i(94764),ay=a.i(26949),az=a.i(67336),aA=a.i(10023),aB=a.i(68450),aC=a.i(10572),aD=a.i(99929),aE=a.i(54763),aF=a.i(12540),aG=a.i(34159);a.s(["default",0,function({params:a,searchParams:k}){let{squadronId:l}=(0,e.use)(a),m=(0,e.use)(k).action,n=(0,d.useRouter)(),o=(0,aB.useNow)(),p=(0,ax.useAccountMenu)(o),s=(0,ay.useOpenInboxCount)(),t=(0,aA.useNeedsAttention)(),u=(0,aA.useAttentionCount)(),v=(0,az.useLiveFleet)(),w=(0,aF.useSquadrons)(),x=(0,aE.useSquadronsConnection)(),y=(0,aF.useCatalogue)(),z=(0,aF.useIssuedCrewLines)(l),A=(0,aF.useKeptMessages)(l),B=(0,aF.useStandDown)(),[C,D]=(0,e.useState)(!1),F=(0,aF.useForceStandDown)(),[H,I]=(0,e.useState)(!1),L=(0,aF.useAddMember)(),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(void 0),Q=(0,aF.useRemoveMember)(),[R,S]=(0,e.useState)(void 0),T=(0,aw.useAccess)(),U=(0,aG.usePluginNav)(),[V,W]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(!1),[$,ab]=(0,e.useState)(!1);(0,aC.useSignInWhenSessionEnds)([t.error,v.error]);let ac=w.data?.find(a=>a.id===l),ad=(0,aD.useShips)(ac?.members.map(a=>a.shipId)??[]),ae=[...ad.values()].reduce((a,b)=>a+b.openDeliveries,0),af=[...ad.values()].reduce((a,b)=>a+b.inFlightDeliveries,0),ag=y.data?.blueprints.find(a=>a.repository===ac?.blueprint.repository&&a.name===ac.blueprint.name&&a.version===ac.blueprint.version),ah=ac&&ag?(0,G.roleOptions)(ac,{blueprint:ag,templates:y.data?.templates??[]}):[],ai=R?ad.get(R.shipId):void 0,aj=R?ah.find(a=>a.role===R.role):void 0,ak=ac?(0,c.idSchema)("ship").safeParse(ac.flagship.shipId).data:void 0,al=ac?(0,G.squadronActionsOffered)(ac,{canManage:T.canManage,canSend:T.canSend,hasRoles:ah.length>0}):void 0,an="add-member"===m&&al?.canAddMember===!0,ao="stand-down"===m&&al?.canStandDown===!0,ap=()=>{void 0!==m&&n.replace(`/squadrons/${l}`,{scroll:!1})},as=ac?.state==="sailing"||ac?.state==="standing-down";return(0,b.jsxs)(ar.DetailLayout,{title:l,parents:[{href:"/squadrons",label:"Squadrons"}],header:(0,b.jsx)(aq,{squadron:ac,squadronId:l,state:w.data?ac?"ready":"not-found":"loading",actions:ac&&al?(0,b.jsx)(_,{squadronId:ac.id,offered:al,onAddMember:()=>{L.reset(),N(!0)},onMessageFlagship:()=>{Z(!0)},onStandDown:()=>{B.reset(),D(!0)},onForceStandDown:()=>{F.reset(),I(!0)}}):void 0,onForceStandDown:T.canManage?()=>{F.reset(),I(!0)}:void 0}),live:v.live,nav:{active:"squadrons",inboxCount:s,attentionCount:u,...U},onCompose:T.canSend?()=>{W(!0)}:void 0,onSearch:()=>{ab(!0)},account:p,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i.ConsoleNotices,{}),(0,b.jsx)(h.ConsoleGuide,{})]}),children:["not-connected"===x?(0,b.jsx)(av.SquadronsNotConnected,{}):ac?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(au,{health:(0,G.healthCounts)(ac.members),work:(0,G.workCounts)(ac.members.map(a=>ad.get(a.shipId)?.report??null)),openDeliveries:ad.size===ac.members.length?ae:void 0,keptCount:A.data?.length}),(0,b.jsx)(am,{squadron:ac,blueprint:ag,templates:y.data?.templates??[],crewLines:z,ships:ad,now:o,renderActions:a=>(0,b.jsx)(X,{squadronId:ac.id,member:a,ship:ad.get(a.shipId),template:ah.find(b=>b.role===a.role)?.template,canManage:T.canManage,canSend:T.canSend,isRemovable:as,onRemove:()=>{Q.reset(),S(a)}})})]}):w.data?null:(0,b.jsx)(q.LoadingSkeleton,{variant:"list",label:"Loading the members"}),ag&&(0,b.jsx)(j.HandoffWiring,{blueprint:ag}),ac&&(0,b.jsx)(r,{messages:A.data??[],state:A.isError?"error":A.data?"ready":"loading",error:A.error?.message,onRetry:()=>{A.refetch()},flagshipId:ac.flagship.shipId,now:o}),ac&&(0,b.jsx)(E,{squadronId:ac.id,memberCount:ac.members.length,openDeliveries:ae,inFlightDeliveries:af,isOpen:C||ao,onOpenChange:a=>{D(a),a||ap()},isPending:B.isPending,error:B.error?.message,onConfirm:()=>{B.mutate(ac.id,{onSuccess:()=>{D(!1),ap()}})}}),ac&&(0,b.jsx)(E,{isForced:!0,squadronId:ac.id,memberCount:ac.members.length,openDeliveries:ae,inFlightDeliveries:af,isOpen:H,onOpenChange:I,isPending:F.isPending,error:F.error?.message,onConfirm:()=>{F.mutate(ac.id,{onSuccess:()=>{I(!1)}})}}),ac&&ah.length>0&&(0,b.jsx)(J,{squadronId:ac.id,blueprint:`${ac.blueprint.name} v${String(ac.blueprint.version)}`,roles:ah,isOpen:M||an,onOpenChange:a=>{N(a),a||ap()},isPending:L.isPending,error:L.error?.message,onSubmit:a=>{L.mutate({squadronId:ac.id,role:a},{onSuccess:a=>{N(!1),ap(),P(a)}})}}),ac&&R&&(0,b.jsx)(aa.RemoveMemberDialog,{squadronId:ac.id,member:R,othersOfRole:(0,G.otherMembersOfRole)(ac,R.shipId),blueprint:aj?{label:`${ac.blueprint.name} v${String(ac.blueprint.version)}`,count:aj.inBlueprint}:void 0,openDeliveries:ai?.openDeliveries??0,inFlightDeliveries:ai?.inFlightDeliveries??0,isOpen:void 0!==ai,onOpenChange:a=>{a||S(void 0)},isPending:Q.isPending,error:Q.error?.message,onConfirm:()=>{Q.mutate({squadronId:ac.id,shipId:R.shipId},{onSuccess:()=>{S(void 0)}})}}),O&&(0,b.jsx)(K.CrewLineDialog,{memberName:O.name,state:"shown",template:ah.find(a=>a.role===O.role)?.template,launchNote:O.launchNote,model:O.model,crewLines:O.crewLines,isOpen:!0,onOpenChange:a=>{a||P(void 0)}}),(0,b.jsx)(f.ComposeMessage,{isOpen:V,onOpenChange:W}),ak&&(0,b.jsx)(f.ComposeMessage,{isOpen:Y,onOpenChange:Z,toShipId:ak}),(0,b.jsx)(g.ConsoleCommands,{isOpen:$,onOpenChange:ab,onCompose:()=>{W(!0)}})]})}],9107)}];
2
2
 
3
3
  //# sourceMappingURL=packages_console_app_squadrons_%5BsquadronId%5D_page_tsx_1umxs1g._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[25389,a=>{"use strict";var b=a.i(87924),c=a.i(3512),d=a.i(50944),e=a.i(72131),f=a.i(12068),g=a.i(94777),h=a.i(41146),i=a.i(64040),j=a.i(38246),k=a.i(72872),l=a.i(47480),m=a.i(8219),n=a.i(77339),o=a.i(24173),p=a.i(40392),q=a.i(50808),r=a.i(20847);function s({blueprints:a,squadrons:c,state:d,error:e,onRetry:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading blueprints"});if("error"===d)return(0,b.jsx)(p.InlineError,{variant:"page",title:"Couldn’t read blueprints from git",description:"The squadron manager couldn’t fetch the squadrons repository. Running squadrons are not affected.",detail:e,onRetry:f});if(0===a.length)return(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(i.DraftingCompass,{"aria-hidden":!0}),title:"No blueprints in git",description:"The squadron manager reads blueprints from .aeolus/squadrons/blueprints. Commit one there; it shows up here on its own."});let g=a.flatMap(a=>{let b=a.versions[0];return b?[{blueprint:a,latest:b,formed:(0,m.squadronsText)((0,m.squadronsFromBlueprint)(c,a))}]:[]});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(n.Table,{"data-testid":"blueprint-table",className:"max-sm:hidden",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Blueprint"}),(0,b.jsx)(n.TableHead,{children:"Source"}),(0,b.jsx)(n.TableHead,{children:"Latest"}),(0,b.jsx)(n.TableHead,{children:"Roles"}),(0,b.jsx)(n.TableHead,{children:"Squadrons"}),(0,b.jsx)(n.TableHead,{children:"Committed"})]})}),(0,b.jsx)(n.TableBody,{children:g.map(({blueprint:a,latest:c,formed:d})=>(0,b.jsxs)(n.TableRow,{"data-testid":"blueprint-row",children:[(0,b.jsx)(n.TableCell,{className:"font-medium",children:(0,b.jsx)(j.default,{href:(0,m.blueprintPath)(a),className:"hover:underline",children:a.name})}),(0,b.jsx)(n.TableCell,{"data-testid":"blueprint-row-source",children:(0,b.jsx)(r.RepositoryName,{name:c.repository,href:(0,l.versionFileUrl)(c)})}),(0,b.jsxs)(n.TableCell,{children:["v",c.version]}),(0,b.jsx)(n.TableCell,{children:(0,m.rolesText)(c)}),(0,b.jsx)(n.TableCell,{className:""===d?"text-muted-foreground":void 0,children:""===d?"None":d}),(0,b.jsxs)(n.TableCell,{className:"text-muted-foreground",children:[(0,k.dayMonth)(new Date(c.committedAt))," · ",(0,b.jsx)("span",{className:"font-mono",children:c.commit.slice(0,7)})]})]},a.key))})]}),(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border sm:hidden",children:g.map(({blueprint:a,latest:c})=>(0,b.jsx)("li",{children:(0,b.jsxs)(j.default,{href:(0,m.blueprintPath)(a),className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a.name," ",(0,b.jsxs)("span",{className:"text-meta font-normal text-muted-foreground",children:["v",c.version]})]}),(0,b.jsx)("span",{className:"truncate text-meta text-muted-foreground",children:(0,m.rolesText)(c)}),(0,b.jsx)("span",{className:"flex min-w-0 text-meta text-muted-foreground",children:(0,b.jsx)(r.RepositoryName,{name:c.repository})})]}),(0,b.jsx)(h.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 text-muted-foreground"})]})},a.key))})]})}var t=a.i(64831);let u={name:"layout-template",size:24,node:[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]};u.node;let v=(0,t.default)(u);function w({templates:a,blueprints:c,state:d,error:e,onRetry:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading templates"});if("error"===d)return(0,b.jsx)(p.InlineError,{variant:"page",title:"Couldn’t read templates from git",description:"The squadron manager couldn’t fetch the squadrons repository. Running squadrons are not affected.",detail:e,onRetry:f});if(0===a.length)return(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(v,{"aria-hidden":!0}),title:"No templates in git",description:"The squadron manager reads templates from .aeolus/squadrons/templates. Commit one there; it shows up here on its own."});let g=a.flatMap(a=>{let b=a.versions[0];return b?[{template:a,latest:b,users:function(a,b){let c=new Map;for(let a of b){let b=`${a.repository}#${a.name}`,d=c.get(b);(!d||d.version<a.version)&&c.set(b,a)}return(0,m.blueprintsUsing)([...c.values()],a).map(a=>a.name).sort().join(", ")}(a,c)}]:[]});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(n.Table,{"data-testid":"template-table",className:"max-sm:hidden",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Template"}),(0,b.jsx)(n.TableHead,{children:"Source"}),(0,b.jsx)(n.TableHead,{children:"Latest"}),(0,b.jsx)(n.TableHead,{children:"Check-in"}),(0,b.jsx)(n.TableHead,{children:"Used by blueprints"}),(0,b.jsx)(n.TableHead,{children:"Committed"})]})}),(0,b.jsx)(n.TableBody,{children:g.map(({template:a,latest:c,users:d})=>(0,b.jsxs)(n.TableRow,{"data-testid":"template-row",children:[(0,b.jsx)(n.TableCell,{className:"font-medium",children:(0,b.jsx)(j.default,{href:(0,m.templatePath)(a),className:"hover:underline",children:a.name})}),(0,b.jsx)(n.TableCell,{"data-testid":"template-row-source",children:(0,b.jsx)(r.RepositoryName,{name:c.repository,href:(0,l.versionFileUrl)(c)})}),(0,b.jsxs)(n.TableCell,{children:["v",c.version]}),(0,b.jsx)(n.TableCell,{children:(0,m.checkInText)(c.checkInMinutes)}),(0,b.jsx)(n.TableCell,{className:""===d?"text-muted-foreground":void 0,children:""===d?"None":d}),(0,b.jsx)(n.TableCell,{className:"text-muted-foreground",children:(0,k.dayMonth)(new Date(c.committedAt))})]},a.key))})]}),(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border sm:hidden",children:g.map(({template:a,latest:c})=>(0,b.jsx)("li",{children:(0,b.jsxs)(j.default,{href:(0,m.templatePath)(a),className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a.name," ",(0,b.jsxs)("span",{className:"text-meta font-normal text-muted-foreground",children:["v",c.version]})]}),(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:(0,m.checkInText)(c.checkInMinutes)}),(0,b.jsx)("span",{className:"flex min-w-0 text-meta text-muted-foreground",children:(0,b.jsx)(r.RepositoryName,{name:c.repository})})]}),(0,b.jsx)(h.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 text-muted-foreground"})]})},a.key))})]})}var x=a.i(15439),y=a.i(2549),z=a.i(83786),A=a.i(68698),B=a.i(83628),C=a.i(31668);let D={name:"wifi-off",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};D.node;let E=(0,t.default)(D);var F=a.i(12540);let G="state",H="blueprint",I="disbanded";var J=a.i(75297),K=a.i(45098),L=a.i(48136),M=a.i(45469),N=a.i(75971),O=a.i(23063);function P({squadrons:a,state:d,hasBlueprints:e,error:g,onRetry:h,onForm:i,view:j,onViewChange:k}){let l;if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading squadrons"});if("error"===d)return(0,b.jsx)(p.InlineError,{title:"Couldn’t load squadrons",description:"The console couldn’t reach the squadron manager. Your ships keep running; nothing is lost.",detail:g,onRetry:h});if(0===a.length)return e?(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(C.Shapes,{"aria-hidden":!0}),title:"No squadrons yet",description:"A squadron is a team of ships formed from a blueprint: a planner, implementers, a tester. You start each member's session by hand with its crew line.",action:i&&(0,b.jsx)(f.Button,{variant:"primary",icon:(0,b.jsx)(c.Plus,{"aria-hidden":!0}),onClick:i,"data-testid":"squadrons-form-first",children:"Form your first squadron"})}):(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(E,{"aria-hidden":!0}),title:"No blueprints found",description:"The squadron manager reads blueprints and templates from git. Add a blueprint there; it shows up here on its own."});let m=(l=j.query.trim().toLowerCase(),a.filter(a=>(j.isDisbandedShown||"disbanded"!==a.state)&&("all"===j.state||a.state===j.state)&&("all"===j.blueprint||a.blueprint.name===j.blueprint)&&(""===l||a.id.toLowerCase().includes(l)||a.blueprint.name.toLowerCase().includes(l))));return(0,b.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,b.jsx)(R,{squadrons:a,view:j,onViewChange:k,shownCount:m.length}),0===m.length?(0,b.jsx)(o.EmptyState,{variant:"no-results",title:"No squadrons match",action:(0,b.jsx)(f.Button,{onClick:()=>{k({query:"",state:"all",blueprint:"all",isDisbandedShown:j.isDisbandedShown})},children:"Clear filters"})}):(0,b.jsx)(S,{squadrons:m})]})}let Q={all:"All",forming:"Forming",sailing:"Sailing","standing-down":"Standing down"};function R({squadrons:a,view:c,onViewChange:d,shownCount:e}){let f={all:"All",...Object.fromEntries([...new Set(a.map(a=>a.blueprint.name))].toSorted((a,b)=>a.localeCompare(b)).map(a=>[a,a]))};return(0,b.jsxs)("div",{"data-slot":"squadrons-toolbar",className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("div",{className:"w-60 max-sm:min-w-0 max-sm:flex-1",children:(0,b.jsx)(J.Input,{type:"search","aria-label":"Search squadrons",placeholder:"Search squadrons","data-testid":"squadrons-search",value:c.query,onChange:a=>{d({...c,query:a.target.value})}})}),(0,b.jsxs)(L.Select,{items:Q,value:c.state,onValueChange:a=>{null!==a&&Object.hasOwn(Q,a)&&d({...c,state:a})},children:[(0,b.jsx)(L.SelectTrigger,{size:"sm","aria-label":"State","data-testid":"squadrons-filter-state",children:(0,b.jsxs)("span",{className:"flex gap-1.5",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"State"}),(0,b.jsx)(L.SelectValue,{className:"font-medium"})]})}),(0,b.jsx)(L.SelectContent,{children:Object.entries(Q).map(([a,c])=>(0,b.jsx)(L.SelectItem,{value:a,children:c},a))})]}),(0,b.jsxs)(L.Select,{items:f,value:c.blueprint,onValueChange:a=>{null!==a&&d({...c,blueprint:a})},children:[(0,b.jsx)(L.SelectTrigger,{size:"sm","aria-label":"Blueprint","data-testid":"squadrons-filter-blueprint",children:(0,b.jsxs)("span",{className:"flex gap-1.5",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Blueprint"}),(0,b.jsx)(L.SelectValue,{className:"font-medium"})]})}),(0,b.jsx)(L.SelectContent,{children:Object.entries(f).map(([a,c])=>(0,b.jsx)(L.SelectItem,{value:a,className:"all"===a?void 0:"font-mono",children:c},a))})]}),(0,b.jsxs)("div",{className:"inline-flex items-center gap-2 sm:ml-auto",children:[(0,b.jsx)(M.Switch,{id:"squadrons-show-disbanded","data-testid":"squadrons-show-disbanded",checked:c.isDisbandedShown,onCheckedChange:a=>{d({...c,isDisbandedShown:a})}}),(0,b.jsxs)(K.Label,{htmlFor:"squadrons-show-disbanded",className:"text-meta font-normal text-muted-foreground",children:["Show disbanded (",a.filter(a=>"disbanded"===a.state).length,")"]}),(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:[e," of ",a.length," squadrons"]})]})]})}function S({squadrons:a}){return(0,b.jsxs)(n.Table,{"data-testid":"squadrons-table",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Squadron"}),(0,b.jsx)(n.TableHead,{children:"Blueprint"}),(0,b.jsx)(n.TableHead,{children:"State"}),(0,b.jsx)(n.TableHead,{children:"Members"}),(0,b.jsx)(n.TableHead,{children:"Health"}),(0,b.jsx)(n.TableHead,{children:"Formed"})]})}),(0,b.jsx)(n.TableBody,{children:a.map(a=>(0,b.jsxs)(n.TableRow,{"data-testid":"squadrons-row",children:[(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(j.default,{href:`/squadrons/${a.id}`,className:"font-medium hover:underline",children:a.id})}),(0,b.jsx)(n.TableCell,{children:(0,b.jsxs)(j.default,{href:(0,m.blueprintPath)(a.blueprint),className:"hover:underline",children:[(0,b.jsx)("span",{className:"font-mono",children:a.blueprint.name})," ",(0,b.jsxs)("span",{className:"text-muted-foreground",children:["v",a.blueprint.version]})]})}),(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(O.StatusBadge,{status:a.state})}),(0,b.jsx)(n.TableCell,{children:function(a){if("forming"===a.state){let{onStation:b,total:c}=(0,m.stationCount)(a);return`${String(b)} of ${String(c)} on station`}return`${String(a.members.length)} ${1===a.members.length?"member":"members"}`}(a)}),(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(N.HealthSummary,{counts:(0,m.healthCounts)(a.members)})}),(0,b.jsx)(n.TableCell,{className:"text-muted-foreground",children:(0,k.shortDateTime)(new Date(a.formedAt))})]},a.id))})]})}var T=a.i(2466),U=a.i(55138),V=a.i(65563),W=a.i(94764),X=a.i(26949),Y=a.i(67336),Z=a.i(10023),$=a.i(68450),_=a.i(10572),aa=a.i(54763);let ab=["squadrons","blueprints","templates"];function ac(a){return ab.find(b=>b===a)??"squadrons"}a.s(["default",0,function({searchParams:a}){var h,i;let j,k=(0,d.useRouter)(),l=(0,e.use)(a),n={query:(h=new URLSearchParams(Object.entries(l).flatMap(([a,b])=>"string"==typeof b?[[a,b]]:[]))).get("q")??"",state:(i=h.get(G),void 0===(j=F.SQUADRON_STATES.find(a=>a===i))||"disbanded"===j?"all":j),blueprint:h.get(H)??"all",isDisbandedShown:"1"===h.get(I)},o="new"===l.form,p=ac(l.tab),q=a=>{let b,c=(b=new URLSearchParams,""!==a.query&&b.set("q",a.query),"all"!==a.state&&b.set(G,a.state),"all"!==a.blueprint&&b.set(H,a.blueprint),a.isDisbandedShown&&b.set(I,"1"),b).toString();k.replace(""===c?"/squadrons":`/squadrons?${c}`,{scroll:!1})},r=(0,$.useNow)(),t=(0,W.useAccountMenu)(r),u=(0,aa.useHasSquadrons)(),v=(0,X.useOpenInboxCount)(),C=(0,Z.useNeedsAttention)(),D=(0,Z.useAttentionCount)(),E=(0,Y.useLiveFleet)(),J=(0,F.useSquadrons)(),K=(0,aa.useSquadronsConnection)(),L=(0,F.useCatalogue)(),M=(0,F.useFormSquadron)(),[N,O]=(0,e.useState)(!1),Q=(0,V.useAccess)(),[R,S]=(0,e.useState)(!1),[ab,ad]=(0,e.useState)(!1);(0,_.useSignInWhenSessionEnds)([C.error,E.error]);let ae=(0,m.blueprintChoices)(L.data??{blueprints:[]}),af=()=>{M.reset(),O(!0)};return(0,b.jsxs)(T.ListLayout,{title:"Squadrons",description:"Teams of ships formed from blueprints in git.",live:E.live,nav:{active:"squadrons",inboxCount:v,attentionCount:D,hasSquadrons:u,hasSettings:u&&Q.canManage},primaryAction:Q.canManage&&ae.length>0?(0,b.jsx)(f.Button,{variant:"primary",icon:(0,b.jsx)(c.Plus,{"aria-hidden":!0}),onClick:af,"data-testid":"squadrons-form",children:"Form squadron"}):void 0,onCompose:Q.canSend?()=>{S(!0)}:void 0,onSearch:()=>{ad(!0)},account:t,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(A.ConsoleNotices,{}),(0,b.jsx)(z.ConsoleGuide,{})]}),children:["not-connected"===K?(0,b.jsx)(U.SquadronsNotConnected,{}):(0,b.jsxs)(g.Tabs,{value:p,onValueChange:a=>{let b=ac(a);k.replace("squadrons"===b?"/squadrons":`/squadrons?tab=${b}`,{scroll:!1})},children:[(0,b.jsxs)(g.TabsList,{variant:"line","aria-label":"Squadrons sections",children:[(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"squadrons","data-testid":"squadrons-tab-squadrons",children:"Squadrons"}),(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"blueprints","data-testid":"squadrons-tab-blueprints",children:"Blueprints"}),(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"templates","data-testid":"squadrons-tab-templates",children:"Templates"})]}),(0,b.jsx)(g.TabsContent,{value:"squadrons",className:"pt-4",children:(0,b.jsx)(P,{squadrons:J.data??[],state:J.isError?"error":J.data?"ready":"loading",hasBlueprints:ae.length>0,error:J.error?.message,onRetry:()=>{J.refetch()},onForm:Q.canManage?af:void 0,view:n,onViewChange:q})}),(0,b.jsx)(g.TabsContent,{value:"blueprints",className:"pt-4",children:(0,b.jsx)(s,{blueprints:ae,squadrons:J.data??[],state:L.isError?"error":L.data?"ready":"loading",error:L.error?.message,onRetry:()=>{L.refetch()}})}),(0,b.jsx)(g.TabsContent,{value:"templates",className:"pt-4",children:(0,b.jsx)(w,{templates:(0,m.templateChoices)(L.data??{templates:[]}),blueprints:L.data?.blueprints??[],state:L.isError?"error":L.data?"ready":"loading",error:L.error?.message,onRetry:()=>{L.refetch()}})})]}),ae.length>0&&(0,b.jsx)(B.FormSquadronDialog,{blueprints:ae,templates:L.data?.templates??[],isOpen:N||o,onOpenChange:a=>{O(a),!a&&o&&q(n)},isPending:M.isPending,error:M.error?.message,onSubmit:a=>{M.mutate(a,{onSuccess:a=>{O(!1),k.push(`/squadrons/${a.squadronId}`)}})}}),(0,b.jsx)(x.ComposeMessage,{isOpen:R,onOpenChange:S}),(0,b.jsx)(y.ConsoleCommands,{isOpen:ab,onOpenChange:ad,onCompose:()=>{S(!0)}})]})}],25389)}];
1
+ module.exports=[25389,a=>{"use strict";var b=a.i(87924),c=a.i(3512),d=a.i(50944),e=a.i(72131),f=a.i(12068),g=a.i(94777),h=a.i(41146),i=a.i(64040),j=a.i(38246),k=a.i(72872),l=a.i(47480),m=a.i(8219),n=a.i(77339),o=a.i(24173),p=a.i(40392),q=a.i(50808),r=a.i(20847);function s({blueprints:a,squadrons:c,state:d,error:e,onRetry:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading blueprints"});if("error"===d)return(0,b.jsx)(p.InlineError,{variant:"page",title:"Couldn’t read blueprints from git",description:"The squadron manager couldn’t fetch the squadrons repository. Running squadrons are not affected.",detail:e,onRetry:f});if(0===a.length)return(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(i.DraftingCompass,{"aria-hidden":!0}),title:"No blueprints in git",description:"The squadron manager reads blueprints from .aeolus/squadrons/blueprints. Commit one there; it shows up here on its own."});let g=a.flatMap(a=>{let b=a.versions[0];return b?[{blueprint:a,latest:b,formed:(0,m.squadronsText)((0,m.squadronsFromBlueprint)(c,a))}]:[]});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(n.Table,{"data-testid":"blueprint-table",className:"max-sm:hidden",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Blueprint"}),(0,b.jsx)(n.TableHead,{children:"Source"}),(0,b.jsx)(n.TableHead,{children:"Latest"}),(0,b.jsx)(n.TableHead,{children:"Roles"}),(0,b.jsx)(n.TableHead,{children:"Squadrons"}),(0,b.jsx)(n.TableHead,{children:"Committed"})]})}),(0,b.jsx)(n.TableBody,{children:g.map(({blueprint:a,latest:c,formed:d})=>(0,b.jsxs)(n.TableRow,{"data-testid":"blueprint-row",children:[(0,b.jsx)(n.TableCell,{className:"font-medium",children:(0,b.jsx)(j.default,{href:(0,m.blueprintPath)(a),className:"hover:underline",children:a.name})}),(0,b.jsx)(n.TableCell,{"data-testid":"blueprint-row-source",children:(0,b.jsx)(r.RepositoryName,{name:c.repository,href:(0,l.versionFileUrl)(c)})}),(0,b.jsxs)(n.TableCell,{children:["v",c.version]}),(0,b.jsx)(n.TableCell,{children:(0,m.rolesText)(c)}),(0,b.jsx)(n.TableCell,{className:""===d?"text-muted-foreground":void 0,children:""===d?"None":d}),(0,b.jsxs)(n.TableCell,{className:"text-muted-foreground",children:[(0,k.dayMonth)(new Date(c.committedAt))," · ",(0,b.jsx)("span",{className:"font-mono",children:c.commit.slice(0,7)})]})]},a.key))})]}),(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border sm:hidden",children:g.map(({blueprint:a,latest:c})=>(0,b.jsx)("li",{children:(0,b.jsxs)(j.default,{href:(0,m.blueprintPath)(a),className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a.name," ",(0,b.jsxs)("span",{className:"text-meta font-normal text-muted-foreground",children:["v",c.version]})]}),(0,b.jsx)("span",{className:"truncate text-meta text-muted-foreground",children:(0,m.rolesText)(c)}),(0,b.jsx)("span",{className:"flex min-w-0 text-meta text-muted-foreground",children:(0,b.jsx)(r.RepositoryName,{name:c.repository})})]}),(0,b.jsx)(h.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 text-muted-foreground"})]})},a.key))})]})}var t=a.i(64831);let u={name:"layout-template",size:24,node:[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]};u.node;let v=(0,t.default)(u);function w({templates:a,blueprints:c,state:d,error:e,onRetry:f}){if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading templates"});if("error"===d)return(0,b.jsx)(p.InlineError,{variant:"page",title:"Couldn’t read templates from git",description:"The squadron manager couldn’t fetch the squadrons repository. Running squadrons are not affected.",detail:e,onRetry:f});if(0===a.length)return(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(v,{"aria-hidden":!0}),title:"No templates in git",description:"The squadron manager reads templates from .aeolus/squadrons/templates. Commit one there; it shows up here on its own."});let g=a.flatMap(a=>{let b=a.versions[0];return b?[{template:a,latest:b,users:function(a,b){let c=new Map;for(let a of b){let b=`${a.repository}#${a.name}`,d=c.get(b);(!d||d.version<a.version)&&c.set(b,a)}return(0,m.blueprintsUsing)([...c.values()],a).map(a=>a.name).sort().join(", ")}(a,c)}]:[]});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(n.Table,{"data-testid":"template-table",className:"max-sm:hidden",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Template"}),(0,b.jsx)(n.TableHead,{children:"Source"}),(0,b.jsx)(n.TableHead,{children:"Latest"}),(0,b.jsx)(n.TableHead,{children:"Check-in"}),(0,b.jsx)(n.TableHead,{children:"Used by blueprints"}),(0,b.jsx)(n.TableHead,{children:"Committed"})]})}),(0,b.jsx)(n.TableBody,{children:g.map(({template:a,latest:c,users:d})=>(0,b.jsxs)(n.TableRow,{"data-testid":"template-row",children:[(0,b.jsx)(n.TableCell,{className:"font-medium",children:(0,b.jsx)(j.default,{href:(0,m.templatePath)(a),className:"hover:underline",children:a.name})}),(0,b.jsx)(n.TableCell,{"data-testid":"template-row-source",children:(0,b.jsx)(r.RepositoryName,{name:c.repository,href:(0,l.versionFileUrl)(c)})}),(0,b.jsxs)(n.TableCell,{children:["v",c.version]}),(0,b.jsx)(n.TableCell,{children:(0,m.checkInText)(c.checkInMinutes)}),(0,b.jsx)(n.TableCell,{className:""===d?"text-muted-foreground":void 0,children:""===d?"None":d}),(0,b.jsx)(n.TableCell,{className:"text-muted-foreground",children:(0,k.dayMonth)(new Date(c.committedAt))})]},a.key))})]}),(0,b.jsx)("ul",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border sm:hidden",children:g.map(({template:a,latest:c})=>(0,b.jsx)("li",{children:(0,b.jsxs)(j.default,{href:(0,m.templatePath)(a),className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsxs)("span",{className:"flex min-w-0 grow flex-col gap-0.5",children:[(0,b.jsxs)("span",{className:"font-medium",children:[a.name," ",(0,b.jsxs)("span",{className:"text-meta font-normal text-muted-foreground",children:["v",c.version]})]}),(0,b.jsx)("span",{className:"text-meta text-muted-foreground",children:(0,m.checkInText)(c.checkInMinutes)}),(0,b.jsx)("span",{className:"flex min-w-0 text-meta text-muted-foreground",children:(0,b.jsx)(r.RepositoryName,{name:c.repository})})]}),(0,b.jsx)(h.ChevronRight,{"aria-hidden":!0,className:"size-(--size-icon-sm) shrink-0 text-muted-foreground"})]})},a.key))})]})}var x=a.i(15439),y=a.i(2549),z=a.i(83786),A=a.i(68698),B=a.i(38279),C=a.i(31668);let D={name:"wifi-off",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};D.node;let E=(0,t.default)(D);var F=a.i(12540);let G="state",H="blueprint",I="disbanded";var J=a.i(75297),K=a.i(45098),L=a.i(48136),M=a.i(45469),N=a.i(75971),O=a.i(23063);function P({squadrons:a,state:d,hasBlueprints:e,error:g,onRetry:h,onForm:i,view:j,onViewChange:k}){let l;if("loading"===d)return(0,b.jsx)(q.LoadingSkeleton,{variant:"table",label:"Loading squadrons"});if("error"===d)return(0,b.jsx)(p.InlineError,{title:"Couldn’t load squadrons",description:"The console couldn’t reach the squadron manager. Your ships keep running; nothing is lost.",detail:g,onRetry:h});if(0===a.length)return e?(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(C.Shapes,{"aria-hidden":!0}),title:"No squadrons yet",description:"A squadron is a team of ships formed from a blueprint: a planner, implementers, a tester. You start each member's session by hand with its crew line.",action:i&&(0,b.jsx)(f.Button,{variant:"primary",icon:(0,b.jsx)(c.Plus,{"aria-hidden":!0}),onClick:i,"data-testid":"squadrons-form-first",children:"Form your first squadron"})}):(0,b.jsx)(o.EmptyState,{icon:(0,b.jsx)(E,{"aria-hidden":!0}),title:"No blueprints found",description:"The squadron manager reads blueprints and templates from git. Add a blueprint there; it shows up here on its own."});let m=(l=j.query.trim().toLowerCase(),a.filter(a=>(j.isDisbandedShown||"disbanded"!==a.state)&&("all"===j.state||a.state===j.state)&&("all"===j.blueprint||a.blueprint.name===j.blueprint)&&(""===l||a.id.toLowerCase().includes(l)||a.blueprint.name.toLowerCase().includes(l))));return(0,b.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,b.jsx)(R,{squadrons:a,view:j,onViewChange:k,shownCount:m.length}),0===m.length?(0,b.jsx)(o.EmptyState,{variant:"no-results",title:"No squadrons match",action:(0,b.jsx)(f.Button,{onClick:()=>{k({query:"",state:"all",blueprint:"all",isDisbandedShown:j.isDisbandedShown})},children:"Clear filters"})}):(0,b.jsx)(S,{squadrons:m})]})}let Q={all:"All",forming:"Forming",sailing:"Sailing","standing-down":"Standing down"};function R({squadrons:a,view:c,onViewChange:d,shownCount:e}){let f={all:"All",...Object.fromEntries([...new Set(a.map(a=>a.blueprint.name))].toSorted((a,b)=>a.localeCompare(b)).map(a=>[a,a]))};return(0,b.jsxs)("div",{"data-slot":"squadrons-toolbar",className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("div",{className:"w-60 max-sm:min-w-0 max-sm:flex-1",children:(0,b.jsx)(J.Input,{type:"search","aria-label":"Search squadrons",placeholder:"Search squadrons","data-testid":"squadrons-search",value:c.query,onChange:a=>{d({...c,query:a.target.value})}})}),(0,b.jsxs)(L.Select,{items:Q,value:c.state,onValueChange:a=>{null!==a&&Object.hasOwn(Q,a)&&d({...c,state:a})},children:[(0,b.jsx)(L.SelectTrigger,{size:"sm","aria-label":"State","data-testid":"squadrons-filter-state",children:(0,b.jsxs)("span",{className:"flex gap-1.5",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"State"}),(0,b.jsx)(L.SelectValue,{className:"font-medium"})]})}),(0,b.jsx)(L.SelectContent,{children:Object.entries(Q).map(([a,c])=>(0,b.jsx)(L.SelectItem,{value:a,children:c},a))})]}),(0,b.jsxs)(L.Select,{items:f,value:c.blueprint,onValueChange:a=>{null!==a&&d({...c,blueprint:a})},children:[(0,b.jsx)(L.SelectTrigger,{size:"sm","aria-label":"Blueprint","data-testid":"squadrons-filter-blueprint",children:(0,b.jsxs)("span",{className:"flex gap-1.5",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Blueprint"}),(0,b.jsx)(L.SelectValue,{className:"font-medium"})]})}),(0,b.jsx)(L.SelectContent,{children:Object.entries(f).map(([a,c])=>(0,b.jsx)(L.SelectItem,{value:a,className:"all"===a?void 0:"font-mono",children:c},a))})]}),(0,b.jsxs)("div",{className:"inline-flex items-center gap-2 sm:ml-auto",children:[(0,b.jsx)(M.Switch,{id:"squadrons-show-disbanded","data-testid":"squadrons-show-disbanded",checked:c.isDisbandedShown,onCheckedChange:a=>{d({...c,isDisbandedShown:a})}}),(0,b.jsxs)(K.Label,{htmlFor:"squadrons-show-disbanded",className:"text-meta font-normal text-muted-foreground",children:["Show disbanded (",a.filter(a=>"disbanded"===a.state).length,")"]}),(0,b.jsxs)("span",{className:"text-meta text-muted-foreground",children:[e," of ",a.length," squadrons"]})]})]})}function S({squadrons:a}){return(0,b.jsxs)(n.Table,{"data-testid":"squadrons-table",children:[(0,b.jsx)(n.TableHeader,{children:(0,b.jsxs)(n.TableRow,{children:[(0,b.jsx)(n.TableHead,{children:"Squadron"}),(0,b.jsx)(n.TableHead,{children:"Blueprint"}),(0,b.jsx)(n.TableHead,{children:"State"}),(0,b.jsx)(n.TableHead,{children:"Members"}),(0,b.jsx)(n.TableHead,{children:"Health"}),(0,b.jsx)(n.TableHead,{children:"Formed"})]})}),(0,b.jsx)(n.TableBody,{children:a.map(a=>(0,b.jsxs)(n.TableRow,{"data-testid":"squadrons-row",children:[(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(j.default,{href:`/squadrons/${a.id}`,className:"font-medium hover:underline",children:a.id})}),(0,b.jsx)(n.TableCell,{children:(0,b.jsxs)(j.default,{href:(0,m.blueprintPath)(a.blueprint),className:"hover:underline",children:[(0,b.jsx)("span",{className:"font-mono",children:a.blueprint.name})," ",(0,b.jsxs)("span",{className:"text-muted-foreground",children:["v",a.blueprint.version]})]})}),(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(O.StatusBadge,{status:a.state})}),(0,b.jsx)(n.TableCell,{children:function(a){if("forming"===a.state){let{onStation:b,total:c}=(0,m.stationCount)(a);return`${String(b)} of ${String(c)} on station`}return`${String(a.members.length)} ${1===a.members.length?"member":"members"}`}(a)}),(0,b.jsx)(n.TableCell,{children:(0,b.jsx)(N.HealthSummary,{counts:(0,m.healthCounts)(a.members)})}),(0,b.jsx)(n.TableCell,{className:"text-muted-foreground",children:(0,k.shortDateTime)(new Date(a.formedAt))})]},a.id))})]})}var T=a.i(2466),U=a.i(55138),V=a.i(65563),W=a.i(94764),X=a.i(26949),Y=a.i(67336),Z=a.i(10023),$=a.i(68450),_=a.i(10572),aa=a.i(54763),ab=a.i(34159);let ac=["squadrons","blueprints","templates"];function ad(a){return ac.find(b=>b===a)??"squadrons"}a.s(["default",0,function({searchParams:a}){var h,i;let j,k=(0,d.useRouter)(),l=(0,e.use)(a),n={query:(h=new URLSearchParams(Object.entries(l).flatMap(([a,b])=>"string"==typeof b?[[a,b]]:[]))).get("q")??"",state:(i=h.get(G),void 0===(j=F.SQUADRON_STATES.find(a=>a===i))||"disbanded"===j?"all":j),blueprint:h.get(H)??"all",isDisbandedShown:"1"===h.get(I)},o="new"===l.form,p=ad(l.tab),q=a=>{let b,c=(b=new URLSearchParams,""!==a.query&&b.set("q",a.query),"all"!==a.state&&b.set(G,a.state),"all"!==a.blueprint&&b.set(H,a.blueprint),a.isDisbandedShown&&b.set(I,"1"),b).toString();k.replace(""===c?"/squadrons":`/squadrons?${c}`,{scroll:!1})},r=(0,$.useNow)(),t=(0,W.useAccountMenu)(r),u=(0,X.useOpenInboxCount)(),v=(0,Z.useNeedsAttention)(),C=(0,Z.useAttentionCount)(),D=(0,Y.useLiveFleet)(),E=(0,F.useSquadrons)(),J=(0,aa.useSquadronsConnection)(),K=(0,F.useCatalogue)(),[L,M]=(0,e.useState)(!1),N=(0,V.useAccess)(),O=(0,ab.usePluginNav)(),[Q,R]=(0,e.useState)(!1),[S,ac]=(0,e.useState)(!1);(0,_.useSignInWhenSessionEnds)([v.error,D.error]);let ae=(0,m.blueprintChoices)(K.data??{blueprints:[]}),af=()=>{M(!0)};return(0,b.jsxs)(T.ListLayout,{title:"Squadrons",description:"Teams of ships formed from blueprints in git.",live:D.live,nav:{active:"squadrons",inboxCount:u,attentionCount:C,...O},primaryAction:N.canManage&&ae.length>0?(0,b.jsx)(f.Button,{variant:"primary",icon:(0,b.jsx)(c.Plus,{"aria-hidden":!0}),onClick:af,"data-testid":"squadrons-form",children:"Form squadron"}):void 0,onCompose:N.canSend?()=>{R(!0)}:void 0,onSearch:()=>{ac(!0)},account:t,banner:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(A.ConsoleNotices,{}),(0,b.jsx)(z.ConsoleGuide,{})]}),children:["not-connected"===J?(0,b.jsx)(U.SquadronsNotConnected,{}):(0,b.jsxs)(g.Tabs,{value:p,onValueChange:a=>{let b=ad(a);k.replace("squadrons"===b?"/squadrons":`/squadrons?tab=${b}`,{scroll:!1})},children:[(0,b.jsxs)(g.TabsList,{variant:"line","aria-label":"Squadrons sections",children:[(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"squadrons","data-testid":"squadrons-tab-squadrons",children:"Squadrons"}),(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"blueprints","data-testid":"squadrons-tab-blueprints",children:"Blueprints"}),(0,b.jsx)(g.TabsTrigger,{variant:"line",value:"templates","data-testid":"squadrons-tab-templates",children:"Templates"})]}),(0,b.jsx)(g.TabsContent,{value:"squadrons",className:"pt-4",children:(0,b.jsx)(P,{squadrons:E.data??[],state:E.isError?"error":E.data?"ready":"loading",hasBlueprints:ae.length>0,error:E.error?.message,onRetry:()=>{E.refetch()},onForm:N.canManage?af:void 0,view:n,onViewChange:q})}),(0,b.jsx)(g.TabsContent,{value:"blueprints",className:"pt-4",children:(0,b.jsx)(s,{blueprints:ae,squadrons:E.data??[],state:K.isError?"error":K.data?"ready":"loading",error:K.error?.message,onRetry:()=>{K.refetch()}})}),(0,b.jsx)(g.TabsContent,{value:"templates",className:"pt-4",children:(0,b.jsx)(w,{templates:(0,m.templateChoices)(K.data??{templates:[]}),blueprints:K.data?.blueprints??[],state:K.isError?"error":K.data?"ready":"loading",error:K.error?.message,onRetry:()=>{K.refetch()}})})]}),ae.length>0&&(0,b.jsx)(B.FormSquadron,{blueprints:ae,templates:K.data?.templates??[],isOpen:L||o,onOpenChange:a=>{M(a),!a&&o&&q(n)},onFormed:a=>{M(!1),k.push(`/squadrons/${a}`)}}),(0,b.jsx)(x.ComposeMessage,{isOpen:Q,onOpenChange:R}),(0,b.jsx)(y.ConsoleCommands,{isOpen:S,onOpenChange:ac,onCompose:()=>{R(!0)}})]})}],25389)}];
2
2
 
3
3
  //# sourceMappingURL=packages_console_app_squadrons_page_tsx_1w6ym6z._.js.map