agmon 0.2.0 → 0.2.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 (278) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/fallback-build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +8 -8
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +15 -14
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +15 -14
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -3
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/api/media/route.js.nft.json +1 -1
  18. package/.next/server/app/api/reports/tokens/route.js.nft.json +1 -1
  19. package/.next/server/app/api/sessions/[id]/transcript/route.js.nft.json +1 -1
  20. package/.next/server/app/api/traces/stream/route.js.nft.json +1 -1
  21. package/.next/server/app/api/version/route.js.nft.json +1 -1
  22. package/.next/server/app/api/workspace/file-content/route.js.nft.json +1 -1
  23. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  24. package/.next/server/app/chat/page.js.nft.json +1 -1
  25. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/chat.html +1 -1
  27. package/.next/server/app/chat.rsc +20 -19
  28. package/.next/server/app/chat.segments/_full.segment.rsc +20 -19
  29. package/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
  30. package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +21 -20
  31. package/.next/server/app/index.html +1 -1
  32. package/.next/server/app/index.rsc +20 -18
  33. package/.next/server/app/index.segments/__PAGE__.segment.rsc +8 -8
  34. package/.next/server/app/index.segments/_full.segment.rsc +20 -18
  35. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  36. package/.next/server/app/page.js.nft.json +1 -1
  37. package/.next/server/app/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/reports/page.js.nft.json +1 -1
  39. package/.next/server/app/reports/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/reports.html +1 -1
  41. package/.next/server/app/reports.rsc +4 -4
  42. package/.next/server/app/reports.segments/_full.segment.rsc +4 -4
  43. package/.next/server/app/reports.segments/_tree.segment.rsc +2 -2
  44. package/.next/server/app/reports.segments/reports/__PAGE__.segment.rsc +4 -4
  45. package/.next/server/app/store/page.js.nft.json +1 -1
  46. package/.next/server/app/store/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/store.html +1 -1
  48. package/.next/server/app/store.rsc +5 -5
  49. package/.next/server/app/store.segments/_full.segment.rsc +5 -5
  50. package/.next/server/app/store.segments/_tree.segment.rsc +2 -2
  51. package/.next/server/app/store.segments/store/__PAGE__.segment.rsc +5 -5
  52. package/.next/server/chunks/_0ao-_t4jkb46h._.js +2 -2
  53. package/.next/server/chunks/_0ao-_t4jkb46h._.js.map +1 -1
  54. package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js.map +1 -1
  55. package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js +3 -0
  56. package/.next/server/chunks/ssr/[root-of-the-server]__0i2rbwbkxbdog._.js.map +1 -0
  57. package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js +3 -0
  58. package/.next/server/chunks/ssr/[root-of-the-server]__0qzscpxebh28_._.js.map +1 -0
  59. package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js +427 -0
  60. package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js.map +1 -0
  61. package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js +1 -1
  62. package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js.map +1 -1
  63. package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js +427 -0
  64. package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js.map +1 -0
  65. package/.next/server/chunks/ssr/_0--937zhi743v._.js +3 -0
  66. package/.next/server/chunks/ssr/_0--937zhi743v._.js.map +1 -0
  67. package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js +3 -0
  68. package/.next/server/chunks/ssr/_0e3frtjrk-wi9._.js.map +1 -0
  69. package/.next/server/chunks/ssr/_0h29jdf4relbq._.js +3 -0
  70. package/.next/server/chunks/ssr/_0h29jdf4relbq._.js.map +1 -0
  71. package/.next/server/chunks/ssr/_1487-zi23c5eb._.js +1 -1
  72. package/.next/server/chunks/ssr/_1487-zi23c5eb._.js.map +1 -1
  73. package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js +3 -0
  74. package/.next/server/chunks/ssr/_1vgwoe-shb9z7._.js.map +1 -0
  75. package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js +3 -0
  76. package/.next/server/chunks/ssr/_1zm4m-s8k7oe3._.js.map +1 -0
  77. package/.next/server/chunks/ssr/_202tntue-jj6s._.js +3 -0
  78. package/.next/server/chunks/ssr/_202tntue-jj6s._.js.map +1 -0
  79. package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js → node_modules_00ebs67b4u61w._.js} +1 -1
  80. package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js → node_modules_01p9ctt-n2dxp._.js} +1 -1
  81. package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js → node_modules_05i69rc9pwcdx._.js} +1 -1
  82. package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js → node_modules_06mgkab1v5iox._.js} +2 -2
  83. package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js → node_modules_07bjxeq9dfgn1._.js} +2 -2
  84. package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js → node_modules_08q6a-f2itxyo._.js} +1 -1
  85. package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js → node_modules_09v49jhajmvl4._.js} +2 -2
  86. package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js → node_modules_0b8zi3pbl-y9n._.js} +2 -2
  87. package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js → node_modules_0d2ios01ot1in._.js} +1 -1
  88. package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js → node_modules_0dw0vozejrnml._.js} +2 -2
  89. package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js → node_modules_0e3njj436xau-._.js} +1 -1
  90. package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js → node_modules_0e6qoh__e4a69._.js} +1 -1
  91. package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js → node_modules_0hb0q0epwvp--._.js} +1 -1
  92. package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js → node_modules_0jla9ugf1y6rb._.js} +1 -1
  93. package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js → node_modules_0l-y0kqtu_r3o._.js} +1 -1
  94. package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js → node_modules_0l814qpw677vm._.js} +1 -1
  95. package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js → node_modules_0lqovp8j8ld76._.js} +1 -1
  96. package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js → node_modules_0o63z1gd17rhb._.js} +1 -1
  97. package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js → node_modules_0sjdrli5douui._.js} +1 -1
  98. package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js → node_modules_0xh8tnq1niblb._.js} +1 -1
  99. package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js → node_modules_0yayrqhzfk8wy._.js} +1 -1
  100. package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js → node_modules_0z1e37smavebg._.js} +2 -2
  101. package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js → node_modules_0zb0i39mnjdf3._.js} +1 -1
  102. package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js → node_modules_10g1mmrf63d8a._.js} +2 -2
  103. package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js → node_modules_152txg4c7ose3._.js} +2 -2
  104. package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js → node_modules_185fuy4cv7loa._.js} +2 -2
  105. package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js → node_modules_1aqaelh-8fme6._.js} +1 -1
  106. package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js → node_modules_1d4sreyq0ubqg._.js} +2 -2
  107. package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js → node_modules_1e_nc2eyg4djz._.js} +1 -1
  108. package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js → node_modules_1hd7j-tdb8drq._.js} +1 -1
  109. package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js → node_modules_1i3x2csuq_-jt._.js} +1 -1
  110. package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js → node_modules_1l2g7btuh3e4s._.js} +2 -2
  111. package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js → node_modules_1l46or7mgko0z._.js} +1 -1
  112. package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js → node_modules_1ltys5mwtcv-n._.js} +1 -1
  113. package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js → node_modules_1nz3ckv6tu_66._.js} +1 -1
  114. package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js → node_modules_1pquu5wprusnc._.js} +2 -2
  115. package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js → node_modules_1qnypguag6s_l._.js} +1 -1
  116. package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js → node_modules_1r6w-jlme6d10._.js} +1 -1
  117. package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js → node_modules_1st9dwe66yx93._.js} +1 -1
  118. package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js → node_modules_1tskcaktx6ods._.js} +1 -1
  119. package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js → node_modules_1wew4nn7i1uup._.js} +1 -1
  120. package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js → node_modules_1zbmc81s-4zsm._.js} +1 -1
  121. package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js → node_modules_1zii7uk468cay._.js} +2 -2
  122. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js → node_modules_katex_dist_katex_mjs_0kqo9zl9cgwbo._.js} +1 -1
  123. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js} +1 -1
  124. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js → node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js} +2 -2
  125. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0-5bcc79665lq._.js.map +1 -0
  126. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_0pezg1352q13j._.js → node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js} +2 -2
  127. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0axoa1eg51x1-._.js.map +1 -0
  128. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js → node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js} +2 -2
  129. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_18ei1-na3kusb._.js.map +1 -0
  130. package/.next/server/chunks/ssr/{node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js → node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js} +2 -2
  131. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1tx493x2_auzs._.js.map +1 -0
  132. package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js +3 -0
  133. package/.next/server/chunks/ssr/node_modules_mermaid_dist_mermaid_core_mjs_06it7ktosm1dr._.js.map +1 -0
  134. package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js +1 -1
  135. package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js.map +1 -1
  136. package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js +1 -1
  137. package/.next/server/chunks/ssr/src_components_reports_TokenReportView_jsx_1g3p_enbbsadt._.js.map +1 -1
  138. package/.next/server/middleware-build-manifest.js +3 -3
  139. package/.next/server/pages/404.html +1 -1
  140. package/.next/server/pages/500.html +1 -1
  141. package/.next/server/preview-props.json +3 -3
  142. package/.next/server/server-reference-manifest.js +1 -1
  143. package/.next/server/server-reference-manifest.json +1 -1
  144. package/.next/static/chunks/0r9apkv3exqv-.js +1 -0
  145. package/.next/static/chunks/17jorrh_pfel_.js +1 -0
  146. package/.next/static/chunks/1n_lb7wmn81jj.js +1 -0
  147. package/.next/static/chunks/2-w116ewoshm1.js +1 -0
  148. package/.next/static/chunks/23uup1e8841av.js +1 -0
  149. package/.next/static/chunks/25l0z48vlvdu4.css +1 -0
  150. package/.next/static/chunks/2rx7xvi55ohln.js +1 -0
  151. package/.next/static/chunks/3og0e9qcff393.js +425 -0
  152. package/.next/static/chunks/3rtpnpqd981z9.js +1 -0
  153. package/.next/trace +1 -1
  154. package/.next/trace-build +1 -1
  155. package/bin/cli.js +12 -0
  156. package/package.json +1 -1
  157. package/src/app/chat/page.js +14 -14
  158. package/src/app/globals.css +128 -0
  159. package/src/app/layout.js +6 -1
  160. package/src/app/page.js +1 -1
  161. package/src/components/chat/ChatMessageItem.js +12 -12
  162. package/src/components/chat/CodeBlock.js +5 -5
  163. package/src/components/chat/DiffViewer.js +27 -27
  164. package/src/components/chat/MarkdownRenderer.js +19 -19
  165. package/src/components/chat/SessionChatView.js +41 -41
  166. package/src/components/chat/SessionSearch.js +8 -8
  167. package/src/components/chat/ThinkingAccordion.js +3 -3
  168. package/src/components/chat/ToolCallCard.js +6 -6
  169. package/src/components/chat/ToolOutputView.js +19 -19
  170. package/src/components/factory/office-canvas.js +134 -3
  171. package/src/components/factory/scene/characters.js +267 -32
  172. package/src/components/layout/CommandPalette.jsx +12 -0
  173. package/src/components/layout/EditorTabs.jsx +17 -0
  174. package/src/components/layout/LayoutToggles.jsx +31 -2
  175. package/src/components/layout/LeftSidebar.jsx +27 -3
  176. package/src/components/layout/RightSidebar.jsx +8 -8
  177. package/src/components/layout/TitleBar.jsx +5 -1
  178. package/src/components/layout/VSCodeWorkbench.jsx +78 -14
  179. package/src/components/store/Item3DRenderer.jsx +602 -48
  180. package/src/components/store/LiveFittingRoom.jsx +55 -791
  181. package/src/components/store/LiveReactAgent.jsx +1637 -0
  182. package/src/components/store/SupporterStoreModal.jsx +3 -2
  183. package/src/components/store/SupporterStoreView.jsx +94 -34
  184. package/src/components/theme/ThemeSettingsModal.jsx +40 -40
  185. package/src/components/ui/Button.jsx +4 -4
  186. package/src/components/ui/Input.jsx +1 -1
  187. package/src/components/ui/Modal.jsx +6 -6
  188. package/src/components/ui/Select.jsx +3 -3
  189. package/src/lib/catalog/auras.js +226 -1199
  190. package/src/lib/catalog/index.js +60 -1
  191. package/src/lib/catalog/pets.js +291 -2398
  192. package/src/lib/catalog/props.js +488 -4199
  193. package/src/lib/catalog/skins.js +773 -3249
  194. package/src/lib/catalog/trophies.js +226 -1199
  195. package/src/lib/mockTraces.js +15 -15
  196. package/src/lib/supporterStore.js +1 -1
  197. package/src/lib/traceContract.js +1 -1
  198. package/src/lib/watchers/claudeWatcher.js +24 -19
  199. package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js +0 -3
  200. package/.next/server/chunks/ssr/[root-of-the-server]__19s2v5rryc14o._.js.map +0 -1
  201. package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js +0 -427
  202. package/.next/server/chunks/ssr/[root-of-the-server]__1_jerxrctq6ev._.js.map +0 -1
  203. package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js +0 -427
  204. package/.next/server/chunks/ssr/[root-of-the-server]__1pvso-uyf--97._.js.map +0 -1
  205. package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js +0 -3
  206. package/.next/server/chunks/ssr/[root-of-the-server]__1y78dc7oiz7ks._.js.map +0 -1
  207. package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js +0 -3
  208. package/.next/server/chunks/ssr/_0ozao7omdwbvd._.js.map +0 -1
  209. package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js +0 -3
  210. package/.next/server/chunks/ssr/_0rcmpdyxc1qwj._.js.map +0 -1
  211. package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js +0 -3
  212. package/.next/server/chunks/ssr/_0wv0xnhun3mk7._.js.map +0 -1
  213. package/.next/server/chunks/ssr/_17rmaft1zusua._.js +0 -3
  214. package/.next/server/chunks/ssr/_17rmaft1zusua._.js.map +0 -1
  215. package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js +0 -3
  216. package/.next/server/chunks/ssr/_1e-d4pcj59a7a._.js.map +0 -1
  217. package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js +0 -3
  218. package/.next/server/chunks/ssr/_1qr5gnh64z8pg._.js.map +0 -1
  219. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_0pezg1352q13j._.js.map +0 -1
  220. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_131i-tjzse3ye._.js.map +0 -1
  221. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1d8fezw1qsiob._.js.map +0 -1
  222. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_1to-9cv1ysvs6._.js.map +0 -1
  223. package/.next/static/chunks/0_3s_e4gd9xl0.js +0 -1
  224. package/.next/static/chunks/0i4kx4yl-dwfg.js +0 -425
  225. package/.next/static/chunks/0z0jbobmmvqoc.js +0 -1
  226. package/.next/static/chunks/1_a_gmob5qzho.js +0 -1
  227. package/.next/static/chunks/1ifqr4qo4697b.js +0 -1
  228. package/.next/static/chunks/2ccq9i8ev4dsx.js +0 -1
  229. package/.next/static/chunks/2mif7onk_9jy-.css +0 -1
  230. package/.next/static/chunks/40wyf-mv0tiu3.js +0 -1
  231. /package/.next/server/chunks/ssr/{node_modules_1c8i3jrmo4393._.js.map → node_modules_00ebs67b4u61w._.js.map} +0 -0
  232. /package/.next/server/chunks/ssr/{node_modules_02vtgweceovke._.js.map → node_modules_01p9ctt-n2dxp._.js.map} +0 -0
  233. /package/.next/server/chunks/ssr/{node_modules_1kr1c-ncf8q9t._.js.map → node_modules_05i69rc9pwcdx._.js.map} +0 -0
  234. /package/.next/server/chunks/ssr/{node_modules_02jwra-d9iqim._.js.map → node_modules_06mgkab1v5iox._.js.map} +0 -0
  235. /package/.next/server/chunks/ssr/{node_modules_1dff7b_kvngr-._.js.map → node_modules_07bjxeq9dfgn1._.js.map} +0 -0
  236. /package/.next/server/chunks/ssr/{node_modules_0m3ihe65818y_._.js.map → node_modules_08q6a-f2itxyo._.js.map} +0 -0
  237. /package/.next/server/chunks/ssr/{node_modules_0-6sb1gkbjo93._.js.map → node_modules_09v49jhajmvl4._.js.map} +0 -0
  238. /package/.next/server/chunks/ssr/{node_modules_0oukyh0iq21ow._.js.map → node_modules_0b8zi3pbl-y9n._.js.map} +0 -0
  239. /package/.next/server/chunks/ssr/{node_modules_061uaylfjwqk7._.js.map → node_modules_0d2ios01ot1in._.js.map} +0 -0
  240. /package/.next/server/chunks/ssr/{node_modules_02nv3yff2pqh8._.js.map → node_modules_0dw0vozejrnml._.js.map} +0 -0
  241. /package/.next/server/chunks/ssr/{node_modules_0-nvg0c4pgfb8._.js.map → node_modules_0e3njj436xau-._.js.map} +0 -0
  242. /package/.next/server/chunks/ssr/{node_modules_0fs8mckuwk2tj._.js.map → node_modules_0e6qoh__e4a69._.js.map} +0 -0
  243. /package/.next/server/chunks/ssr/{node_modules_0t4h1rucl35hl._.js.map → node_modules_0hb0q0epwvp--._.js.map} +0 -0
  244. /package/.next/server/chunks/ssr/{node_modules_0f773uqgzj7y7._.js.map → node_modules_0jla9ugf1y6rb._.js.map} +0 -0
  245. /package/.next/server/chunks/ssr/{node_modules_0dq0dsblt-q0g._.js.map → node_modules_0l-y0kqtu_r3o._.js.map} +0 -0
  246. /package/.next/server/chunks/ssr/{node_modules_0zc49fdcopqu9._.js.map → node_modules_0l814qpw677vm._.js.map} +0 -0
  247. /package/.next/server/chunks/ssr/{node_modules_1wlwrgnt65zus._.js.map → node_modules_0lqovp8j8ld76._.js.map} +0 -0
  248. /package/.next/server/chunks/ssr/{node_modules_0z3elum1675ve._.js.map → node_modules_0o63z1gd17rhb._.js.map} +0 -0
  249. /package/.next/server/chunks/ssr/{node_modules_1xyxigbqzb8vs._.js.map → node_modules_0sjdrli5douui._.js.map} +0 -0
  250. /package/.next/server/chunks/ssr/{node_modules_1-iyhsn_1p9nx._.js.map → node_modules_0xh8tnq1niblb._.js.map} +0 -0
  251. /package/.next/server/chunks/ssr/{node_modules_0nde84kzuwv2n._.js.map → node_modules_0yayrqhzfk8wy._.js.map} +0 -0
  252. /package/.next/server/chunks/ssr/{node_modules_0__m9_odts7_e._.js.map → node_modules_0z1e37smavebg._.js.map} +0 -0
  253. /package/.next/server/chunks/ssr/{node_modules_0f4xh33v3iltc._.js.map → node_modules_0zb0i39mnjdf3._.js.map} +0 -0
  254. /package/.next/server/chunks/ssr/{node_modules_0b8ndnuql44z1._.js.map → node_modules_10g1mmrf63d8a._.js.map} +0 -0
  255. /package/.next/server/chunks/ssr/{node_modules_1-sz_-qddwilq._.js.map → node_modules_152txg4c7ose3._.js.map} +0 -0
  256. /package/.next/server/chunks/ssr/{node_modules_12qn4bepdou5v._.js.map → node_modules_185fuy4cv7loa._.js.map} +0 -0
  257. /package/.next/server/chunks/ssr/{node_modules_0fd1swhk15cx3._.js.map → node_modules_1aqaelh-8fme6._.js.map} +0 -0
  258. /package/.next/server/chunks/ssr/{node_modules_13nsmuhey_ti_._.js.map → node_modules_1d4sreyq0ubqg._.js.map} +0 -0
  259. /package/.next/server/chunks/ssr/{node_modules_0hqa9oxz17hip._.js.map → node_modules_1e_nc2eyg4djz._.js.map} +0 -0
  260. /package/.next/server/chunks/ssr/{node_modules_1rlnehdn16ay-._.js.map → node_modules_1hd7j-tdb8drq._.js.map} +0 -0
  261. /package/.next/server/chunks/ssr/{node_modules_07maxxr-t28ql._.js.map → node_modules_1i3x2csuq_-jt._.js.map} +0 -0
  262. /package/.next/server/chunks/ssr/{node_modules_1iovyom0-y7o_._.js.map → node_modules_1l2g7btuh3e4s._.js.map} +0 -0
  263. /package/.next/server/chunks/ssr/{node_modules_1ll-58c1c-qab._.js.map → node_modules_1l46or7mgko0z._.js.map} +0 -0
  264. /package/.next/server/chunks/ssr/{node_modules_0z7rdbaf13024._.js.map → node_modules_1ltys5mwtcv-n._.js.map} +0 -0
  265. /package/.next/server/chunks/ssr/{node_modules_0vn0kjn_84lmn._.js.map → node_modules_1nz3ckv6tu_66._.js.map} +0 -0
  266. /package/.next/server/chunks/ssr/{node_modules_1zs2nou5uogby._.js.map → node_modules_1pquu5wprusnc._.js.map} +0 -0
  267. /package/.next/server/chunks/ssr/{node_modules_05w7qhtrzvnk6._.js.map → node_modules_1qnypguag6s_l._.js.map} +0 -0
  268. /package/.next/server/chunks/ssr/{node_modules_1v4lexrfhnlhs._.js.map → node_modules_1r6w-jlme6d10._.js.map} +0 -0
  269. /package/.next/server/chunks/ssr/{node_modules_1f4geuvkvlxj1._.js.map → node_modules_1st9dwe66yx93._.js.map} +0 -0
  270. /package/.next/server/chunks/ssr/{node_modules_0kovk4b6czb22._.js.map → node_modules_1tskcaktx6ods._.js.map} +0 -0
  271. /package/.next/server/chunks/ssr/{node_modules_12qw2ucebdvol._.js.map → node_modules_1wew4nn7i1uup._.js.map} +0 -0
  272. /package/.next/server/chunks/ssr/{node_modules_1216007ogd5om._.js.map → node_modules_1zbmc81s-4zsm._.js.map} +0 -0
  273. /package/.next/server/chunks/ssr/{node_modules_1kv6lsckqs-m0._.js.map → node_modules_1zii7uk468cay._.js.map} +0 -0
  274. /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0bmuudv_6eypr._.js.map → node_modules_katex_dist_katex_mjs_0kqo9zl9cgwbo._.js.map} +0 -0
  275. /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0qyy6pq9uzpk0._.js.map → node_modules_katex_dist_katex_mjs_1604s1ky8db8u._.js.map} +0 -0
  276. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → 1y6Da0YgnPr2_6ncpWrbV}/_buildManifest.js +0 -0
  277. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → 1y6Da0YgnPr2_6ncpWrbV}/_clientMiddlewareManifest.js +0 -0
  278. /package/.next/static/{sQnXeiP8rV6y2v0az_xw3 → 1y6Da0YgnPr2_6ncpWrbV}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,74647,e=>{"use strict";let t,r,s,l;var i,o,n=e.i(18050),a=e.i(71645),c=e.i(68590),d=e.i(37750),h=e.i(95925);function u(e){let t=(0,a.useId)();return`${e??t}`}let f="u">typeof window?a.useLayoutEffect:a.useEffect;function x(e){let t=(0,a.useRef)(e);return f(()=>{t.current=e},[e]),(0,a.useCallback)((...e)=>t.current?.(...e),[t])}function p(...e){return x(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function m(e,t="Assertion error"){if(!e)throw Error(t)}(0,a.createContext)(null);class g{#e={};addListener(e,t){let r=this.#e[e];return void 0===r?this.#e[e]=[t]:r.includes(t)||r.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let r=this.#e[e];if(void 0!==r)if(1===r.length)r[0].call(null,t);else{let e=!1,s=null,l=Array.from(r);for(let r=0;r<l.length;r++){let i=l[r];try{i.call(null,t)}catch(t){null===s&&(e=!0,s=t)}}if(e)throw s}}removeAllListeners(){this.#e={}}removeListener(e,t){let r=this.#e[e];if(void 0!==r){let e=r.indexOf(t);e>=0&&r.splice(e,1)}}}let b={cursorFlags:0,state:"inactive"},v=new g;function y(e){return v.addListener("change",e)}function w(e){let t=b;b=e,"active"===t.state&&"active"!==e.state&&t.didPointerMove&&t.hitRegions.forEach(({separator:e})=>{e&&e.element.ownerDocument.activeElement===e.element&&e.element.blur()}),v.emit("change",{prev:t,next:e})}let j=e=>e,k=()=>{};function N(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let S=new WeakMap;function C(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:r}=S.get(e)??{};void 0===r&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(r):e.adoptedStyleSheets=[...e.adoptedStyleSheets,r]));let s=b;switch(s.state){case"active":case"hover":{let e=function({cursorFlags:e,axes:t,state:r}){let s=0,l=0;switch(r){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":s++;break;case"vertical":l++}})}if(0!==s||0!==l){if("active"===r&&e&&N()){let t=(4&e)!=0,r=(8&e)!=0;if((1&e)!=0)return t?"se-resize":r?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":r?"nw-resize":"w-resize";if(t)return"s-resize";if(r)return"n-resize"}return N()?s>0&&l>0?"move":s>0?"ew-resize":"ns-resize":s>0&&l>0?"grab":s>0?"col-resize":"row-resize"}}({cursorFlags:s.cursorFlags,axes:s.hitRegions.map(e=>e.axis),state:s.state}),l=`*, *:hover {cursor: ${e} !important; }`;if(t===l)return;t=l,e?0===r.cssRules.length?r.insertRule(l):r.replaceSync(l):1===r.cssRules.length&&r.deleteRule(0);break}case"inactive":t=void 0,1===r.cssRules.length&&r.deleteRule(0)}S.set(e,{prevStyle:t,styleSheet:r})}function T({axis:e}){let{layoutStrategy:t,orientation:r,items:s}=e;return t?t.calculateAvailableSize():s.reduce((e,t)=>e+="horizontal"===r?t.element.offsetWidth:t.element.offsetHeight,0)}function _(e,t){let r=e.compareDocumentPosition(t);return r&Node.DOCUMENT_POSITION_DISCONNECTED?0:r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0}function M(e,t){return Array.from(t).sort((t,r)=>{var s,l,i,o;let n,a,c="horizontal"===e?(s=t,l=r,0!=(n=s.element.offsetLeft-l.element.offsetLeft)?n:s.element.offsetWidth-l.element.offsetWidth):(i=t,o=r,0!=(a=i.element.offsetTop-o.element.offsetTop)?a:i.element.offsetHeight-o.element.offsetHeight);return 0!==c?c:_(t.element,r.element)})}function z(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function R(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function I({expandHitTargets:e=!0,axis:r,includeDisabled:s=!1}){if(r.layoutStrategy)return r.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:r,includeDisabled:s});let{element:l,orientation:i,items:o,separators:n}=r,a=M(i,Array.from(l.children).filter(z).filter(e=>!e.hasAttribute("data-resize-preview")).map(e=>({element:e}))).map(({element:e})=>e),c=[],d=!1,h=!1,u=-1,f,x=-1,p=0,g,b=[];{let e=-1;for(let t of a)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(p++,-1===u&&(u=e),x=e))}if(s||p>1){let l=-1;for(let p of a)if(p.hasAttribute("data-panel")){l++;let n=o.find(e=>e.element===p);if(n){if(g){let o,a=g.element.getBoundingClientRect(),v=p.getBoundingClientRect();if(h){let e="horizontal"===i?new DOMRect(a.right,a.top,0,a.height):new DOMRect(a.left,a.bottom,a.width,0),t="horizontal"===i?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(b.length){case 0:o=[e,t];break;case 1:{let r=b[0],s=function({orientation:e,rects:t,targetRect:r}){let s={x:r.x+r.width/2,y:r.y+r.height/2},l,i=Number.MAX_VALUE;for(let r of t){let{x:t,y:o}=R(s,r),n="horizontal"===e?t:o;n<i&&(i=n,l=r)}return m(l,"No rect found"),l}({orientation:i,rects:[a,v],targetRect:r.element.getBoundingClientRect()});o=[r,s===a?t:e];break}default:o=b}}else o=b.length?b:["horizontal"===i?new DOMRect(a.right,v.top,v.left-a.right,v.height):new DOMRect(v.left,a.bottom,v.width,v.top-a.bottom)];for(let i of o){let o=function({expandHitTargets:e,axis:r,rect:s}){let l=e?(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?r.resizeTargetMinimumSize.coarse:r.resizeTargetMinimumSize.fine:0;if(s.width<l){let e=l-s.width;s=new DOMRect(s.x-e/2,s.y,s.width+e,s.height)}if(s.height<l){let e=l-s.height;s=new DOMRect(s.x,s.y-e/2,s.width,s.height+e)}return s}({expandHitTargets:e,axis:r,rect:"width"in i?i:i.element.getBoundingClientRect()}),a=l<=u||l>x;!s&&(d||a)||(f??=T({axis:r}),c.push({axis:r,axisSize:f,items:[g,n],separator:"width"in i?void 0:i,rect:o})),d=!1}}h=!1,g=n,b=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(d=!0);let e=n.find(e=>e.element===p);e?b.push(e):(g=void 0,b=[])}else h=!0}return c}function L({axisSize:e,itemElement:t,styleProp:r}){let s,[l,i]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(r);switch(i){case"%":s=l/100*e;break;case"px":s=l;break;case"rem":s=l*parseFloat(getComputedStyle(t.ownerDocument.documentElement).fontSize);break;case"em":s=l*parseFloat(getComputedStyle(t).fontSize);break;case"vh":s=l/100*window.innerHeight;break;case"vw":s=l/100*window.innerWidth}return s}function E(e){return parseFloat(e.toFixed(3))}function A(e){let{items:t}=e,r=T({axis:e});return 0===r?t.map(e=>({groupResizeBehavior:e.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.constraintProps.collapsible,defaultSize:void 0,disabled:e.constraintProps.disabled,minSize:0,maxSize:100,itemId:e.id})):t.map(e=>{let t,s,{element:l,constraintProps:i}=e,o=0;void 0!==i.collapsedSize&&(o=E(L({axisSize:r,itemElement:l,styleProp:i.collapsedSize})/r*100)),void 0!==i.collapsedThreshold&&(t=E(L({axisSize:r,itemElement:l,styleProp:i.collapsedThreshold})/r*100)),void 0!==i.defaultSize&&(s=E(L({axisSize:r,itemElement:l,styleProp:i.defaultSize})/r*100));let n=0;void 0!==i.minSize&&(n=E(L({axisSize:r,itemElement:l,styleProp:i.minSize})/r*100));let a=100;return void 0!==i.maxSize&&(a=E(L({axisSize:r,itemElement:l,styleProp:i.maxSize})/r*100)),{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:o,collapsedThreshold:t,collapsible:!0===i.collapsible,defaultSize:s,disabled:i.disabled,minSize:n,maxSize:a,itemId:e.id}})}let P=new Map,F=new g;function $(e,t){for(let[t]of P)if(t.id===e)return t}function O(e,t){for(let[t,r]of P)if(t.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function D(e,t){return F.addListener("axisChange",r=>{r.axis.id===e&&t(r)})}function W(e,t,r){let s=P.get(e);(P=new Map(P)).set(e,t),F.emit("axisChange",{axis:e,isUserInteraction:r?.isUserInteraction===!0,prev:s,next:t})}function V(e,t,r=0){return Math.abs(E(e)-E(t))<=r}function B(e,t){return V(e,t)?0:e>t?1:-1}function H({overrideDisabledItems:e,itemConstraints:t,prevSize:r,size:s}){let{collapsedSize:l=0,collapsedThreshold:i,collapsible:o,disabled:n,maxSize:a=100,minSize:c=0}=t;if(n&&!e)return r;if(0>B(s,c))if(o){let e=i??(c-l)/2,t=0>=B(r,l),o=B(s,t?l+e:c-e);s=0>=B(s,l)||o<0||void 0!==i&&t&&0===o?l:c}else s=c;return E(s=Math.min(a,s))}function U({delta:e,initialLayout:t,itemConstraints:r,pivotIndices:s,prevLayout:l,trigger:i}){if(V(e,0))return t;let o="imperative-api"===i,n=r.map(({itemId:e})=>t[e]),a=r.map(({itemId:e})=>l[e]),c=[...n],[d,h]=s;m(null!=d,"Invalid first pivot index"),m(null!=h,"Invalid second pivot index");let u=0;if("keyboard"===i){{let t=e<0?h:d,s=r[t];m(s,`Panel constraints not found for index ${t}`);let{collapsedSize:l=0,collapsible:i,minSize:o=0}=s;if(i){let r=n[t];if(m(null!=r,`Previous layout not found for panel index ${t}`),V(r,l)){let t=o-r;B(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:h,s=r[t];m(s,`No panel constraints found for index ${t}`);let{collapsedSize:l=0,collapsible:i,minSize:o=0}=s;if(i){let r=n[t];if(m(null!=r,`Previous layout not found for panel index ${t}`),V(r,o)){let t=r-l;B(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?h:d,s=r[t];m(s,`Panel constraints not found for index ${t}`);let l=n[t],{collapsedSize:i,collapsedThreshold:o,collapsible:a,minSize:c}=s;if(a&&0>B(l,c)){let t=c-i;if(0>B(l+Math.abs(e),c)){let r=B(Math.abs(e),o??t/2),s=void 0===o&&e<0;e=r>0||0===r&&s?e<0?-t:t:0}}}{let t=e<0?1:-1,s=e<0?h:d,l=0;for(;;){let e=n[s];if(m(null!=e,`Previous layout not found for panel index ${s}`),l+=H({overrideDisabledItems:o,itemConstraints:r[s],prevSize:e,size:100})-e,(s+=t)<0||s>=r.length)break}let i=Math.min(Math.abs(e),Math.abs(l));e=e<0?0-i:i}{let t=e<0?d:h;for(;t>=0&&t<r.length;){let s=Math.abs(e)-Math.abs(u),l=n[t];m(null!=l,`Previous layout not found for panel index ${t}`);let i=l-s,a=H({overrideDisabledItems:o,itemConstraints:r[t],prevSize:l,size:i});if(!V(l,a)&&(u+=l-a,c[t]=a,u.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}(a,c))return l;{let t=e<0?h:d,s=n[t];m(null!=s,`Previous layout not found for panel index ${t}`);let l=s+u,i=H({overrideDisabledItems:o,itemConstraints:r[t],prevSize:s,size:l});if(c[t]=i,!V(i,l)){let t=l-i,s=e<0?h:d;for(;s>=0&&s<r.length;){let l=c[s];m(null!=l,`Previous layout not found for panel index ${s}`);let i=l+t,n=H({overrideDisabledItems:o,itemConstraints:r[s],prevSize:l,size:i});if(V(l,n)||(t-=n-l,c[s]=n),V(t,0))break;e>0?s--:s++}}}return V(Object.values(c).reduce((e,t)=>t+e,0),100,.1)?c.reduce((e,t,s)=>(e[r[s].itemId]=t,e),{}):l}function q(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(void 0===t[r]||0!==B(e[r],t[r]))return!1;return!0}function G({commit:e,document:t,event:r,hitRegions:s,initialLayoutMap:l,mountedAxes:i,pointerDownAtPoint:o,prevCursorFlags:n}){let a=0,c=b,d="active"===c.state?c.previews:[],h=new Map("active"===c.state?c.previewLayoutMap:void 0);s.forEach(t=>{let{axis:s,axisSize:n}=t,{orientation:c,items:u}=s;if(e&&"separator"!==s.resizePreviewMode)return;let{disableCursor:f}=s.mutableState,x=0;x=o?"horizontal"===c?(r.clientX-o.x)/n*100:(r.clientY-o.y)/n*100:"horizontal"===c?r.clientX<0?-100:100:r.clientY<0?-100:100;let p=l.get(s),m=i.get(s);if(!p||!m)return;let{defaultLayoutDeferred:g,derivedItemConstraints:b,axisSize:v,layout:y,separatorToItems:w}=m;if(b&&y&&w){let r="separator"===s.resizePreviewMode?h.get(s)??y:y,l=U({delta:x,initialLayout:p,itemConstraints:b,pivotIndices:t.items.map(e=>u.indexOf(e)),prevLayout:r,trigger:"mouse-or-touch"});if("separator"===s.resizePreviewMode&&!e&&!q(l,r)){h.set(s,l);let e=0,t=u.map(t=>n/100*(e+=l[t.id]-p[t.id]));d=d.map(e=>{if(e.axis!==s)return e;let r=t[e.itemIndex];return r===e.offset?e:{...e,offset:r}})}if(q(l,r)&&0!==x&&!f)switch(c){case"horizontal":a|=x<0?1:2;break;case"vertical":a|=x<0?4:8}("separator"!==s.resizePreviewMode||e)&&!q(l,y)&&W(t.axis,{defaultLayoutDeferred:g,derivedItemConstraints:b,axisSize:v,layout:l,requestedAxisSize:v,requestedLayout:l,separatorToItems:w})}});let u=0;0===r.movementX?u|=3&n:u|=3&a,0===r.movementY?u|=12&n:u|=12&a;let f="active"===c.state&&(r.clientX!==c.pointerDownAtPoint.x||r.clientY!==c.pointerDownAtPoint.y);(function(e,t=[],r,s=!1){let l=b,i={...b};i.cursorFlags=e,"active"===i.state&&(i.didPointerMove||=s,i.previews=t,r&&(i.previewLayoutMap=r)),b=i,v.emit("change",{prev:l,next:i})})(u,d,h,f),C(t)}function Y(e,t){let r=b,s=P,l=!1;return"active"===r.state&&(G({commit:!0,document:e,event:t,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedAxes:s,pointerDownAtPoint:r.pointerDownAtPoint,prevCursorFlags:r.cursorFlags}),w({cursorFlags:0,state:"inactive"}),r.hitRegions.length>0&&(C(e),l=!0,r.hitRegions.forEach(e=>{if(!s.has(e.axis))return;let t=O(e.axis.id,!0);W(e.axis,t,{isUserInteraction:!0})}))),l}function X(e){e.defaultPrevented||Y(e.currentTarget,e)}let K=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Z(e){let t=e.length;for(;t--;){let r=e[t];if(m(r,"Missing node"),function(e){let t,r=getComputedStyle(e);return!!("fixed"===r.position||"auto"!==r.zIndex&&("static"!==r.position||"flex"===(t=getComputedStyle(ee(e)??e).display)||"inline-flex"===t)||1>+r.opacity||"transform"in r&&"none"!==r.transform||"webkitTransform"in r&&"none"!==r.webkitTransform||"mixBlendMode"in r&&"normal"!==r.mixBlendMode||"filter"in r&&"none"!==r.filter||"webkitFilter"in r&&"none"!==r.webkitFilter||"isolation"in r&&"isolate"===r.isolation||K.test(r.willChange)||"touch"===r.webkitOverflowScrolling)}(r))return r}return null}function J(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Q(e){let t=[];for(;e;)t.push(e),e=ee(e);return t}function ee(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function et(e,t){let r=[];return t.forEach((t,s)=>{if(s.disabled)return;let l=I({axis:s}),i=function(e,t,r){let s,l={x:1/0,y:1/0};for(let i of t){let t=R(r,i.rect);switch(e){case"horizontal":(t.x<l.x||t.x===l.x&&t.y<=l.y)&&(s=i,l=t);break;case"vertical":(t.y<l.y||t.y===l.y&&t.x<=l.x)&&(s=i,l=t)}}return s?{distance:l,hitRegion:s}:void 0}(s.orientation,l,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&function({axisElement:e,hitRegion:t,pointerEventTarget:r}){if(z(r)){let t=r.closest("dialog");if(t&&!t.contains(e)&&function(e){try{return e.matches(":modal")}catch{return!1}}(t))return!1}if(!z(r)||r.contains(e)||e.contains(r))return!0;if(function(e,t){let r;if(e===t)throw Error("Cannot compare node with itself");let s={a:Q(e),b:Q(t)};for(;s.a.at(-1)===s.b.at(-1);)r=s.a.pop(),s.b.pop();m(r,"Stacking order can only be calculated for elements with a common ancestor");let l={a:J(Z(s.a)),b:J(Z(s.b))};if(l.a===l.b){let e=r.childNodes,t={a:s.a.at(-1),b:s.b.at(-1)},l=e.length;for(;l--;){let r=e[l];if(r===t.a)return 1;if(r===t.b)return -1}}return Math.sign(l.a-l.b)}(r,e)>0){let l=r;for(;l;){var s;if(l.contains(e))break;if(s=l.getBoundingClientRect(),s.x<t.x+t.width&&s.x+s.width>t.x&&s.y<t.y+t.height&&s.y+s.height>t.y)return!1;l=l.parentElement}}return!0}({axisElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&r.push(i.hitRegion)}),r}function er({layout:e,itemConstraints:t}){let r=t.map(({itemId:t})=>e[t]),s=[...r],l=s.reduce((e,t)=>e+t,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(e=>`${e}%`).join(", ")}`);if(!V(l,100)&&s.length>0)for(let e=0;e<t.length;e++){let t=s[e];m(null!=t,`No layout data found for index ${e}`);let r=100/l*t;s[e]=r}let i=0;for(let e=0;e<t.length;e++){let l=r[e];m(null!=l,`No layout data found for index ${e}`);let o=s[e];m(null!=o,`No layout data found for index ${e}`);let n=H({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:l,size:o});o!=n&&(i+=o-n,s[e]=n)}if(!V(i,0))for(let e=0;e<t.length;e++){let r=s[e];m(null!=r,`No layout data found for index ${e}`);let l=r+i,o=H({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:r,size:l});if(r!==o&&(i-=o-r,s[e]=o,V(i,0)))break}return s.reduce((e,r,s)=>(e[t[s].itemId]=r,e),{})}function es({axisId:e,itemId:t}){let r=()=>{for(let[t,{defaultLayoutDeferred:r,derivedItemConstraints:s,layout:l,axisSize:i,separatorToItems:o}]of P)if(t.id===e)return{defaultLayoutDeferred:r,derivedItemConstraints:s,axis:t,axisSize:i,layout:l,separatorToItems:o};throw Error(`Group ${e} not found`)},s=()=>{let e=r().derivedItemConstraints.find(e=>e.itemId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{let e=r().axis.items.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},i=()=>{let e=r().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{if(e===i())return;let{defaultLayoutDeferred:s,derivedItemConstraints:l,axis:o,axisSize:n,layout:a,separatorToItems:c}=r(),d=er({layout:(({nextSize:e,items:r,prevLayout:s,derivedItemConstraints:l})=>{let o=i(),n=r.findIndex(e=>e.id===t),a=0===n,c=n===r.length-1;if(c&&e<o&&(a||r.slice(0,n).every((e,t)=>{let r=l[t];return r?.collapsible&&V(r.collapsedSize,s[r.itemId])}))){let e=r.slice(0,n).reduce((e,t)=>e+s[t.id],0);return{...s,[t]:E(100-e)}}return U({delta:c?o-e:e-o,initialLayout:s,itemConstraints:l,pivotIndices:c?[n-1,n]:[n,n+1],prevLayout:s,trigger:"imperative-api"})})({nextSize:e,items:o.items,prevLayout:a,derivedItemConstraints:l}),itemConstraints:l});q(a,d)||W(o,{defaultLayoutDeferred:s,derivedItemConstraints:l,axisSize:n,layout:d,requestedAxisSize:n,requestedLayout:d,separatorToItems:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=s(),{mutableValues:r}=l(),n=i();e&&n!==t&&(r.expandToSize=n,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:r}=s(),{mutableValues:n}=l(),a=i();if(e&&a===t){let e=n.expandToSize??r;0===e&&(e=1),o(e)}},getSize:()=>{let{axis:e}=r(),s=i(),{element:o}=l();return{asPercentage:s,inPixels:e.layoutStrategy?e.layoutStrategy.getItemSizeInPixels(t):"horizontal"===e.orientation?o.offsetWidth:o.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=s(),r=i();return e&&V(t,r)},resize:e=>{let{axis:t}=r(),{element:s}=l(),i=T({axis:t});o(E(L({axisSize:i,itemElement:s,styleProp:e})/i*100))}}}function el(e){e.defaultPrevented||et(e,P).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let r=t.items.find(e=>void 0!==e.constraintProps.defaultSize);if(r){let s=r.constraintProps.defaultSize,l=es({axisId:t.axis.id,itemId:r.id});l&&void 0!==s&&(l.resize(s),e.preventDefault())}}})}function ei(e){for(let[t]of P)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function eo({axisId:e}){let t=()=>{for(let[t,r]of P)if(t.id===e)return{axis:t,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:r}=t();return e?{}:r},setLayout(e){let{defaultLayoutDeferred:r,derivedItemConstraints:s,axis:l,axisSize:i,layout:o,separatorToItems:n}=t(),a=er({layout:e,itemConstraints:s});return r?o:(q(o,a)||W(l,{defaultLayoutDeferred:r,derivedItemConstraints:s,axisSize:i,layout:a,requestedAxisSize:i,requestedLayout:a,separatorToItems:n}),a)}}}function en(e,t){let r=ei(e),s=O(r.id,!0),l=r.separators.find(t=>t.element===e);m(l,"Matching separator not found");let i=s.separatorToItems.get(l);m(i,"Matching panels not found");let o=i.map(e=>r.items.indexOf(e)),n=eo({axisId:r.id}).getLayout(),a=er({layout:U({delta:t,initialLayout:n,itemConstraints:s.derivedItemConstraints,pivotIndices:o,prevLayout:n,trigger:"keyboard"}),itemConstraints:s.derivedItemConstraints});q(n,a)||W(r,{defaultLayoutDeferred:s.defaultLayoutDeferred,derivedItemConstraints:s.derivedItemConstraints,axisSize:s.axisSize,layout:a,requestedAxisSize:s.axisSize,requestedLayout:a,separatorToItems:s.separatorToItems},{isUserInteraction:!0})}function ea(e){if(e.defaultPrevented)return;let t=e.currentTarget,r=ei(t);if(!(r.disabled||r.separators.find(e=>e.element===t)?.disabled))switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===r.orientation&&en(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===r.orientation&&en(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===r.orientation&&en(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===r.orientation&&en(t,-5);break;case"End":e.preventDefault(),en(t,100);break;case"Enter":{e.preventDefault();let{derivedItemConstraints:s,layout:l,separatorToItems:i}=O(r.id,!0),o=r.separators.find(e=>e.element===t);m(o,"Matching separator not found");let n=i.get(o);m(n,"Matching panels not found");let a=n[0],c=s.find(e=>e.itemId===a.id);if(m(c,"Panel metadata not found"),c.collapsible){let e=l[a.id];en(t,(c.collapsedSize===e?r.mutableState.expandedItemSizes[a.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let t=r.separators.map(e=>e.element),s=Array.from(t).findIndex(t=>t===e.currentTarget);m(null!==s,"Index not found");let l=e.shiftKey?s>0?s-1:t.length-1:s+1<t.length?s+1:0;t[l].focus({preventScroll:!0});break}case"Home":e.preventDefault(),en(t,-100)}}function ec(e){let t=b;if("active"!==t.state)return!1;let r=P;return t.previewLayoutMap.forEach((e,t)=>{let s=r.get(t);"separator"===t.resizePreviewMode&&s&&!q(e,s.layout)&&W(t,{...s,layout:e,requestedAxisSize:s.axisSize,requestedLayout:e})}),w({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{if(!r.has(e.axis))return;let t=O(e.axis.id,!0);W(e.axis,t,{isUserInteraction:!0})}),C(e),!0}function ed(e){let t=b;if("active"!==t.state)return;let r=t.hitRegions.flatMap(({separator:e})=>e?[e.element]:[]);!r.some(t=>t===e.target)||r.some(t=>t.hasPointerCapture?.(e.pointerId))||ec(e.currentTarget)}function eh(e){ec(e.currentTarget)}function eu(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=P,r=et(e,t);if(0===r.length)return;let s=new Map,l=!1;r.forEach(e=>{e.separator&&(l||(l=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let r=t.get(e.axis);r&&s.set(e.axis,r.layout)});let i=Array.from(s.keys()).flatMap(e=>"separator"===e.resizePreviewMode?function(e,t){let{element:r,orientation:s,items:l}=e,i=r.getBoundingClientRect(),o="horizontal"===s;return I({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:s,rect:n,separator:a},c)=>{let d=l.indexOf(s[0]),h=o?n.left+n.width/2:n.top+n.height/2;return{active:t.some(t=>t.axis===e&&t.items[0]===s[0]&&(a||t.separator?t.separator===a:V(h,o?t.rect.left+t.rect.width/2:t.rect.top+t.rect.height/2))),axis:e,key:a?`separator-${a.id}`:`panel-${s[0].id}-${c}`,offset:0,itemIndex:d,rect:new DOMRect((o&&!a?h:n.left)-i.left-r.clientLeft+r.scrollLeft,(!o&&!a?h:n.top)-i.top-r.clientTop+r.scrollTop,o&&!a?0:n.width,!o&&!a?0:n.height),separator:a}})}(e,r):[]);w({cursorFlags:0,didPointerMove:!1,hitRegions:r,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(s),previews:i,state:"active"}),e.preventDefault()}function ef(e){let t=P,r=b;"active"===r.state&&G({commit:!1,document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedAxes:t,prevCursorFlags:r.cursorFlags})}function ex(e){if(e.defaultPrevented)return;let t=b,r=P;if("active"===t.state){if(0===e.buttons)return void ec(e.currentTarget);for(let r of t.hitRegions)if(r.separator){let{element:t}=r.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}G({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedAxes:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let s=et(e,r);0===s.length?"inactive"!==t.state&&w({cursorFlags:0,state:"inactive"}):w({cursorFlags:0,hitRegions:s,state:"hover"}),C(e.currentTarget)}}function ep(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===b.state&&w({cursorFlags:0,state:"inactive"})}function em(e){e.defaultPrevented||("mouse"!==e.pointerType||!(e.button>0))&&Y(e.currentTarget,e)&&e.preventDefault()}function eg(e){e.target===e.currentTarget&&ec(e.currentTarget.document)}function eb({axis:e,itemConstraints:t}){let r=e.items.map(({id:e})=>e).join(","),s=e.mutableState.defaultLayout;return e.mutableState.layouts[r]??(s&&function(e,t){let r=e.map(e=>e.id),s=Object.keys(t);if(r.length!==s.length)return!1;for(let e of r)if(!s.includes(e))return!1;return!0}(e.items,s)?s:function(e){let t=0,r=0,s={};for(let l of e)if(void 0!==l.defaultSize){t++;let e=E(l.defaultSize);r+=e,s[l.itemId]=e}else s[l.itemId]=void 0;let l=e.length-t;if(0!==l){let t=E((100-r)/l);for(let r of e)void 0===r.defaultSize&&(s[r.itemId]=t)}return s}(t))}function ev({itemIds:e,layout:t}){return er({layout:t,itemConstraints:e.map(e=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:e,maxSize:100,minSize:0}))})}function ey(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}let ew=new Map;function ej(e){let t=(0,a.useRef)({...e});return f(()=>{for(let r in e)t.current[r]=e[r]},[e]),t.current}let ek=(0,a.createContext)(null);function eN({attributes:e,axisId:t,axisOrientation:r,children:s,className:l,disableCursor:i,disabled:o,disableDoubleClick:c,elementRef:d,id:h,isSharedHitRegion:u,preview:x,registerSeparator:m,requiredStyle:g,style:v,styleDefaults:j,tabIndex:k=0,updateSeparatorProps:N}){let S,C,T=ej({disabled:o,disableDoubleClick:c,children:s,className:l,preview:x,style:v}),[_,M]=(0,a.useState)({}),[z,R]=(0,a.useState)("inactive"),[I,L]=(0,a.useState)(!1),E=(0,a.useRef)(null),A=(0,a.useRef)(null),P=p(E,d);return f(()=>{let e=E.current;if(null!==e){let r={disabled:T.disabled,disableDoubleClick:T.disableDoubleClick,element:e,id:h,get children(){return T.children},get className(){return T.className},get preview(){return T.preview},get style(){return T.style}};A.current=r;let s=m(r),l=y(e=>{R("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===r||(u?.(e)??!1))?e.next.state:"inactive")}),i=D(t,e=>{let{derivedItemConstraints:t,layout:s,separatorToItems:l}=e.next,i=l.get(r);if(i){let r=i[0],l=t.findIndex(e=>e.itemId===r.id),{layoutStrategy:o}=e.axis;M({...function({layout:e,itemConstraints:t,itemId:r,itemIndex:s}){let l,i,o=e[r],n=t.find(e=>e.itemId===r);if(n){let a=n.maxSize,c=n.collapsible?n.collapsedSize:n.minSize,d=[s,s+1];i=er({layout:U({delta:c-o,initialLayout:e,itemConstraints:t,pivotIndices:d,prevLayout:e}),itemConstraints:t})[r],l=er({layout:U({delta:a-o,initialLayout:e,itemConstraints:t,pivotIndices:d,prevLayout:e}),itemConstraints:t})[r]}return{valueControls:r,valueMax:l,valueMin:i,valueNow:o}}({layout:s,itemConstraints:t,itemId:r.id,itemIndex:l}),...o?.getItemAriaControls&&{valueControls:o.getItemAriaControls(r.id)}})}});return()=>{A.current=null,l(),i(),s()}}},[t,h,u,m,T]),f(()=>{let e=A.current;e&&"active"===b.state&&b.previews.some(t=>t.separator===e)&&w({...b,previews:b.previews.map(t=>t.separator===e?{...t}:t)})},[x]),(0,a.useEffect)(()=>{N(h,{disabled:o,disableDoubleClick:c})},[o,c,h,N]),o&&!i&&(S="not-allowed"),C=o?"disabled":"active"===z?"active":I?"focus":z,(0,n.jsx)("div",{...e,"aria-controls":_.valueControls,"aria-disabled":o||void 0,"aria-orientation":"horizontal"===r?"vertical":"horizontal","aria-valuemax":_.valueMax,"aria-valuemin":_.valueMin,"aria-valuenow":_.valueNow,children:s,className:l,"data-separator":C,"data-testid":h,id:h,onBlur:()=>L(!1),onFocus:()=>L(!0),ref:P,role:"separator",style:{...j,cursor:S,...v,...g,touchAction:"none"},tabIndex:o?void 0:k})}function eS({separator:e}){let{element:t}=e,r=(0,a.useRef)(null);return f(()=>{let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],l=[e,...e.querySelectorAll("*")],i=t.ownerDocument.defaultView;return s.forEach((e,t)=>{let r=l[t];if(r instanceof i.HTMLElement||r instanceof i.SVGElement){let t=i.getComputedStyle(e);for(let e=0;e<t.length;e++){let s=t.item(e);r.style.setProperty(s,t.getPropertyValue(s))}}r.removeAttribute("data-testid"),r.removeAttribute("id")}),Object.assign(e.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),r.current.appendChild(e),()=>e.remove()},[t]),(0,n.jsx)("div",{ref:r,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function eC(){let e=(0,a.useContext)(ek);return m(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function eT(e){let{registerOverlay:t}=eC(),r=(0,a.useRef)(e);ey(r.current,e)||(r.current=e);let s=r.current;return f(()=>t(s),[t,s]),null}function e_({active:e,orientation:t,style:r,...s}){let l;switch(t){case"horizontal":l={height:"100%",minWidth:"1px"};break;case"vertical":l={minHeight:"1px",width:"100%"}}return(0,n.jsx)("div",{...s,"data-separator-overlay":e?"active":"inactive",style:{...l,...r,flexShrink:0,pointerEvents:"none"}})}function eM({overlay:e,preview:t}){let{axis:r,offset:s,rect:l,separator:i}=t,o="horizontal"===r.orientation,c=i?.preview,d=e;return(0,a.isValidElement)(c)&&c.type===eT&&(d=c.props,c=void 0),null==c&&(d?c=(0,n.jsx)(e_,{...d,active:t.active,orientation:r.orientation}):i&&(c=(0,n.jsx)(eS,{separator:i}))),(0,n.jsx)("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:l.height,left:l.left,pointerEvents:"none",position:"absolute",top:l.top,transform:o?`translateX(${s}px)`:`translateY(${s}px)`,width:l.width},children:c})}function ez({children:e,className:t,defaultLayout:r,disableCursor:s,disabled:l,elementRef:i,groupRef:o,id:c,onLayoutChange:d,onLayoutChanged:h,orientation:g="horizontal",resizePreviewMode:v="panel",resizeTargetMinimumSize:k={coarse:20,fine:10},style:N,...S}){let z,R=(0,a.useRef)({onLayoutChange:{},onLayoutChanged:{}}),L=x(e=>{q(R.current.onLayoutChange,e)||(R.current.onLayoutChange=e,d?.(e))}),F=x((e,t,r)=>{q(R.current.onLayoutChanged,e)||(R.current.onLayoutChanged=e,h?.(e,{isUserInteraction:t,requestedLayout:r}))}),B=u(c),[H,U]=(0,a.useState)(),G=function({groupId:e,resizePreviewMode:t}){let[r,s]=(0,a.useState)([]),l=(0,a.useRef)(r);return f(()=>{let r=r=>{let i=$(e),o="separator"===t&&"active"===r.state?r.previews.filter(e=>e.axis===i&&(e.active||!V(e.offset,0))):[],n=l.current;n.length===o.length&&o.every((e,t)=>e===n[t])||(l.current=o,s(o))};if("separator"!==t)return void r(b);let i=y(({next:e})=>r(e));return r(b),i},[e,t]),r}({groupId:B,resizePreviewMode:v}),Y=(0,a.useRef)(null),[K,Z]=function(){let[e,t]=(0,a.useState)({});return[e,(0,a.useCallback)(()=>t({}),[])]}(),J=(0,a.useRef)([]),Q=(0,a.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),ee=p(Y,i);z=(0,a.useRef)({getLayout:()=>({}),setLayout:j}),(0,a.useImperativeHandle)(o,()=>z.current,[]),f(()=>{Object.assign(z.current,eo({axisId:B}))});let et=x((e,t)=>{let s=O(e);return s?{flexGrow:s.layout[t]??1}:r?.[t]?{flexGrow:r?.[t]}:void 0}),es=ej({defaultLayout:r,disableCursor:s,resizeTargetMinimumSize:k}),ei=(0,a.useMemo)(()=>({get disableCursor(){return!!es.disableCursor},getPanelStyles:et,id:B,orientation:g,registerPanel:e=>{let t=Q.current;return t.panels=M(g,[...t.panels,e]),Z(),()=>{t.panels=t.panels.filter(t=>t!==e),Z()}},registerOverlay:e=>(U(e),()=>{U(void 0)}),registerSeparator:e=>{let t=Q.current;return t.separators=M(g,[...t.separators,e]),Z(),()=>{t.separators=t.separators.filter(t=>t!==e),Z()}},updatePanelProps:(e,{disabled:t})=>{let r=Q.current.panels.find(t=>t.id===e);r&&(r.constraintProps.disabled=t);let s=$(B),l=O(B);s&&l&&W(s,{...l,derivedItemConstraints:A(s)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:r})=>{let s=Q.current.separators.find(t=>t.id===e);s&&(s.disabled=t,s.disableDoubleClick=r)}}),[et,B,Z,g,es]),en=(0,a.useRef)(null);return f(()=>{var e;let t,r,s,i,o,n,a,c,d,h,u,f,x,p=Y.current;if(null===p)return;let y=Q.current;if(y.panels=M(g,y.panels),y.separators=M(g,y.separators),J.current=Array.from([...y.panels.map(({element:e})=>e),...y.separators.map(({element:e})=>e)]).sort(_),void 0!==es.defaultLayout&&Object.keys(es.defaultLayout).length===y.panels.length)for(let e of(x={},y.panels)){let t=es.defaultLayout[e.id];void 0!==t&&(x[e.id]=t)}let j={disabled:!!l,element:p,id:B,mutableState:{defaultLayout:x,disableCursor:!!es.disableCursor,expandedItemSizes:Q.current.lastExpandedPanelSizes,layouts:Q.current.layouts},orientation:g,items:y.panels,resizePreviewMode:v,get resizeTargetMinimumSize(){return es.resizeTargetMinimumSize},separators:y.separators};en.current=j;let k=(t=!0,m((e=j).element.ownerDocument.defaultView,"Cannot register an unmounted Group"),r=e.element.ownerDocument.defaultView.ResizeObserver,s=new Set,i=new Set,(o=new r(r=>{for(let s of r){let{borderBoxSize:r,target:l}=s;if(l===e.element){if(t){let t=T({axis:e});if(0===t)return;let r=O(e.id);if(!r)return;let s=A(e),l=r.requestedAxisSize,i=r.requestedLayout;r.defaultLayoutDeferred&&(l=t,i=ev({itemIds:e.items.map(({id:e})=>e),layout:eb({axis:e,itemConstraints:s})}));let o=er({layout:function({axis:e,nextAxisSize:t,prevAxisSize:r,prevLayout:s}){if(r<=0||t<=0||r===t)return s;let l=0,i=0,o=!1,n=new Map,a=[];for(let c of e.items){let e=s[c.id]??0;if("preserve-pixel-size"===c.constraintProps.groupResizeBehavior){o=!0;let s=E(e/100*r/t*100);n.set(c.id,s),l+=s}else a.push(c.id),i+=e}if(!o||0===a.length)return s;let c=100-l,d={...s};if(n.forEach((e,t)=>{d[t]=e}),i>0)for(let e of a){let t=s[e]??0;d[e]=E(t/i*c)}else{let e=E(c/a.length);for(let t of a)d[t]=e}return d}({axis:e,nextAxisSize:t,prevAxisSize:l,prevLayout:i}),itemConstraints:s});if(!r.defaultLayoutDeferred&&q(r.layout,o)&&function(e,t){return e.length===t.length&&e.every((e,r)=>ey(e,t[r]))}(r.derivedItemConstraints,s)&&r.axisSize===t)continue;W(e,{defaultLayoutDeferred:!1,derivedItemConstraints:s,axisSize:t,layout:o,requestedAxisSize:l,requestedLayout:i,separatorToItems:r.separatorToItems})}}else!function(e,t,r){if(!r[0])return;let s=e.items.find(e=>e.element===t);if(!s||!s.onResize)return;let l=T({axis:e}),i="horizontal"===e.orientation?s.element.offsetWidth:s.element.offsetHeight,o=s.mutableValues.prevSize,n={asPercentage:E(i/l*100),inPixels:i};s.mutableValues.prevSize=n,s.onResize(n,s.id,o)}(e,l,r)}})).observe(e.element),e.items.forEach(e=>{m(!s.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),s.add(e.id),e.onResize&&o.observe(e.element)}),n=T({axis:e}),a=A(e),d=er({layout:c=eb({axis:e,itemConstraints:a}),itemConstraints:a}),u=(h=e.element.ownerDocument).defaultView,ew.set(h,(ew.get(h)??0)+1),f=new Map,I({axis:e,includeDisabled:!0}).forEach(e=>{e.separator&&f.set(e.separator,e.items)}),W(e,{defaultLayoutDeferred:0===n,derivedItemConstraints:a,axisSize:n,layout:d,requestedAxisSize:n,requestedLayout:ev({itemIds:e.items.map(({id:e})=>e),layout:c}),separatorToItems:f}),e.separators.forEach(e=>{m(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener("keydown",ea)}),1===ew.get(h)&&(h.addEventListener("contextmenu",X,!0),h.addEventListener("dblclick",el,!0),h.addEventListener("lostpointercapture",ed,!0),h.addEventListener("pointercancel",eh,!0),h.addEventListener("pointerdown",eu,!0),h.addEventListener("pointerleave",ef),h.addEventListener("pointermove",ex),h.addEventListener("pointerout",ep),h.addEventListener("pointerup",em,!0),u?.addEventListener("blur",eg)),function(){t=!1,ew.set(h,Math.max(0,(ew.get(h)??0)-1)),(P=new Map(P)).delete(e),function(e){if("inactive"===b.state)return!1;let t=b.hitRegions.filter(t=>t.axis!==e),r="active"===b.state&&b.previews.some(t=>t.axis===e);if(t.length===b.hitRegions.length&&!r)return!1;if(0===t.length)w({cursorFlags:0,state:"inactive"});else if("active"===b.state){let r=new Map(b.initialLayoutMap),s=new Map(b.previewLayoutMap);r.delete(e),s.delete(e),w({...b,cursorFlags:0,hitRegions:t,initialLayoutMap:r,previewLayoutMap:s,previews:b.previews.filter(t=>t.axis!==e)})}else w({...b,hitRegions:t});return!0}(e)&&C(h),e.separators.forEach(e=>{e.element.removeEventListener("keydown",ea)}),ew.get(h)||(h.removeEventListener("contextmenu",X,!0),h.removeEventListener("dblclick",el,!0),h.removeEventListener("lostpointercapture",ed,!0),h.removeEventListener("pointercancel",eh,!0),h.removeEventListener("pointerdown",eu,!0),h.removeEventListener("pointerleave",ef),h.removeEventListener("pointermove",ex),h.removeEventListener("pointerout",ep),h.removeEventListener("pointerup",em,!0),u?.removeEventListener("blur",eg)),o.disconnect()}),{defaultLayoutDeferred:N,derivedItemConstraints:S,layout:z,requestedLayout:R}=O(j.id,!0);!N&&S.length>0&&(L(z),F(z,!1,R));let $=D(B,e=>{let{defaultLayoutDeferred:t,derivedItemConstraints:r,layout:s,requestedLayout:l}=e.next;if(t||0===r.length)return;!function({derivedItemConstraints:e,axis:t,layout:r,prevLayout:s,requestedLayout:l}){let i=t.items.map(({id:e})=>e).join(",");t.mutableState.layouts[i]=l,s&&e.forEach(e=>{if(e.collapsible){let l=V(e.collapsedSize,r[e.itemId]),i=V(e.collapsedSize,s[e.itemId]);l&&!i&&(t.mutableState.expandedItemSizes[e.itemId]=s[e.itemId])}})}({derivedItemConstraints:r,axis:j,layout:s,prevLayout:e.prev?.layout,requestedLayout:l});let i=b,o="active"!==i.state||!i.hitRegions.some(e=>e.axis===j);L(s),o&&F(s,e.isUserInteraction,l)});return()=>{en.current=null,k(),$()}},[l,B,F,L,g,K,v,es]),f(()=>{(function(e){for(let t=1;t<e.length;t++)if(_(e[t-1],e[t])>0)return!1;return!0})(J.current)||Z()}),(0,a.useEffect)(()=>{let e=en.current;e&&(e.mutableState.defaultLayout=r,e.mutableState.disableCursor=!!s)}),(0,n.jsx)(ek.Provider,{value:ei,children:(0,n.jsxs)("div",{...S,className:t,"data-group":!0,"data-testid":B,id:B,ref:ee,style:{height:"100%",width:"100%",overflow:"hidden",position:"separator"===v?"relative":void 0,...N,display:"flex",flexDirection:"horizontal"===g?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===g?"pan-y":"pan-x"},children:[e,G.map(e=>(0,n.jsx)(eM,{overlay:H,preview:e},e.key))]})})}function eR({children:e,className:t,collapsedSize:r="0%",collapsedThreshold:s,collapsible:l=!1,defaultSize:i,disabled:o,elementRef:c,groupResizeBehavior:d="preserve-relative-size",id:h,maxSize:m="100%",minSize:g="0%",onResize:b,panelRef:v,style:y,...w}){let j,N=!!h,S=u(h),C=ej({disabled:o}),T=(0,a.useRef)(null),_=p(T,c),{getPanelStyles:M,id:z,orientation:R,registerPanel:I,updatePanelProps:L}=eC(),E=null!==b,A=x((e,t,r)=>{b?.(e,h,r)});f(()=>{let e=T.current;if(null!==e)return I({element:e,id:S,idIsStable:N,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?A:void 0,constraintProps:{groupResizeBehavior:d,collapsedSize:r,collapsedThreshold:s,collapsible:l,defaultSize:i,disabled:C.disabled,maxSize:m,minSize:g}})},[d,r,s,l,i,E,S,N,m,g,A,I,C]),(0,a.useEffect)(()=>{L(S,{disabled:o})},[o,S,L]),function(e,t){let{id:r}=eC(),s=(0,a.useRef)({collapse:k,expand:k,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:k});(0,a.useImperativeHandle)(t,()=>s.current,[]),f(()=>{Object.assign(s.current,es({axisId:r,itemId:e}))})}(S,v);let P=()=>{let e=M(z,S);if(e)return JSON.stringify(e)},F=(0,a.useSyncExternalStore)(e=>D(z,e),P,P);return j=F?JSON.parse(F):void 0!==i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,n.jsx)("div",{...w,"data-disabled":o||void 0,"data-panel":!0,"data-testid":S,id:S,ref:_,style:{...eI,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...j},children:(0,n.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:"horizontal"===R?"pan-y":"pan-x"},children:e})})}eT.displayName="SeparatorOverlay",ez.displayName="Group",eR.displayName="Panel";let eI={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0},eL={flexBasis:"auto"},eE={flexGrow:0,flexShrink:0};function eA({children:e,className:t,disabled:r,disableDoubleClick:s,elementRef:l,id:i,preview:o,style:a,...c}){let d=u(i),{disableCursor:h,id:f,orientation:x,registerSeparator:p,updateSeparatorProps:m}=eC();return(0,n.jsx)(eN,{attributes:c,axisId:f,axisOrientation:x,className:t,disableCursor:h,disabled:r,disableDoubleClick:s,elementRef:l,id:d,preview:o,registerSeparator:p,requiredStyle:eE,style:a,styleDefaults:eL,updateSeparatorProps:m,children:e})}eA.displayName="Separator";var eP=e.i(5342),eF=e.i(71567),e$=e.i(66595),eO=e.i(25398),eD=e.i(23827),eW=e.i(56420);let eV={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};eV.node;let eB=(0,eW.f)(eV),eH={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};eH.node;let eU=(0,eW.f)(eH),eq={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};eq.node;let eG=(0,eW.f)(eq),eY={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};eY.node;let eX=(0,eW.f)(eY);var eK=e.i(49803),eZ=e.i(31772),eJ=e.i(50786),eQ=e.i(28623);let e0={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};e0.node;let e1=(0,eW.f)(e0),e2={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};e2.node;let e5=(0,eW.f)(e2),e3={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};e3.node;let e4=(0,eW.f)(e3);var e8=e.i(26787),e6=e.i(90582);function e7({isLeftSidebarVisible:e,isBottomPanelVisible:t,isRightSidebarVisible:r,onToggleLeftSidebar:s,onToggleBottomPanel:l,onToggleRightSidebar:i,isZenFullscreen:o=!1,onToggleZenFullscreen:a=null}){let c=e=>`inline-flex items-center justify-center p-1 rounded transition-colors ${e?"bg-[#007acc]/20 border border-[#007acc]/50 text-[#4fc1ff]":"border border-transparent text-[#858585] hover:text-[#cccccc] hover:bg-[#2a2d2e]"}`;return(0,n.jsxs)("div",{"data-testid":"layout-toggles-group",className:"inline-flex items-center gap-0.5 bg-[#252526] p-0.5 rounded border border-[#333333]",children:[(0,n.jsx)("button",{type:"button","data-testid":"toggle-left-sidebar",title:"Toggle Primary Sidebar (Cmd+B / Ctrl+B)",onClick:s,className:c(e),children:(0,n.jsx)(e1,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{type:"button","data-testid":"toggle-bottom-panel",title:"Toggle Bottom Panel (Cmd+J / Ctrl+J)",onClick:l,className:c(t),children:(0,n.jsx)(e5,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{type:"button","data-testid":"toggle-right-sidebar",title:"Toggle Secondary Sidebar (Live Chat & Inspector - Cmd+Alt+B)",onClick:i,className:c(r),children:(0,n.jsx)(e4,{className:"w-3.5 h-3.5"})}),a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-[1px] h-3 bg-[#333333] my-auto mx-0.5"}),(0,n.jsx)("button",{type:"button","data-testid":"toggle-zen-fullscreen",title:o?"Thoát chế độ toàn màn hình Chill Mode (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",onClick:a,className:`inline-flex items-center justify-center p-1 rounded transition-colors ${o?"bg-amber-500/20 border border-amber-500/50 text-amber-300 shadow-sm":"border border-transparent text-[#858585] hover:text-[#4fc1ff] hover:bg-[#2a2d2e]"}`,children:o?(0,n.jsx)(e6.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,n.jsx)(e8.f,{className:"w-3.5 h-3.5"})})]})]})}let e9=[{id:"showcase",label:"All Items Showcase (24)"},{id:"cases",label:"Edge Cases & Items (17)"},{id:"showcase_skins",label:"Skins & Outfits (15)"},{id:"showcase_props",label:"Tech Props & Gadgets (14)"},{id:"showcase_pets",label:"Pets & Companions (12)"},{id:"showcase_auras",label:"Particle Auras & VFX (12)"},{id:"showcase_trophies",label:"Trophies & Badges (12)"},{id:"storm",label:"Storm (30 Agents)"},{id:"busy",label:"Busy (8 Agents)"},{id:"idle",label:"Idle (2 Agents)"},{id:"errors",label:"Error States"}];function te({stats:e={},mode:t="live",mockPreset:r="cases",onModeChange:s,onPresetChange:l,isRefreshing:i=!1,onRefresh:o,soundEnabled:a=!1,onToggleSound:c,notifEnabled:d=!1,onToggleNotif:h,onOpenCommandPalette:u,onOpenReports:f,onOpenStore:x,onOpenThemeSettings:p,isSupporter:m=!1,layout:g,onToggleLeftSidebar:b,onToggleBottomPanel:v,onToggleRightSidebar:y,isZenFullscreen:w=!1,onToggleZenFullscreen:j=null}){return(0,n.jsxs)("header",{className:"h-[34px] min-h-[34px] bg-[#1e1e1e] border-b border-[#2b2b2b] flex items-center justify-between px-3 text-[#cccccc] text-xs select-none shrink-0 z-40",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-[200px]",children:[(0,n.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded bg-gradient-to-br from-emerald-500 to-cyan-600 shadow-sm shadow-emerald-500/20",children:(0,n.jsx)(eF.f,{className:"w-3.5 h-3.5 text-white"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"font-bold text-[#e1e1e1] tracking-wide text-[11px]",children:"AGMON"}),(0,n.jsx)("span",{className:"rounded bg-[#2d2d2d] px-1.5 py-0.2 text-[9px] font-medium text-slate-400 border border-[#3e3e42]",children:"v0.2.0"})]}),(0,n.jsxs)("div",{className:"hidden lg:flex items-center gap-1 bg-[#252526] px-1.5 py-0.5 rounded text-[10px] text-emerald-400 border border-[#333333]",children:[(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),(0,n.jsx)("span",{children:"Multi-Provider"})]})]}),(0,n.jsxs)("div",{onClick:u,title:"Search sessions or run commands (Cmd+Shift+P / Ctrl+Shift+P)",className:"flex items-center justify-between w-[320px] max-w-[35vw] h-6 bg-[#252526] border border-[#3e3e42] hover:border-[#007acc] rounded px-2 cursor-pointer transition-colors text-slate-400 group",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,n.jsx)(e$.f,{className:"w-3 h-3 text-slate-500 group-hover:text-slate-300 shrink-0"}),(0,n.jsx)("span",{className:"text-[11px] truncate",children:"Search agents, logs, commands..."})]}),(0,n.jsx)("kbd",{className:"hidden sm:inline-block text-[9px] font-mono bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 text-slate-400",children:"Cmd+Shift+P"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-[240px] justify-end",children:[(0,n.jsxs)("div",{onClick:f,title:"Click to view detailed Token & Cost Analytics",className:"hidden xl:flex items-center gap-1.5 bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] px-2 py-0.5 rounded text-[11px] cursor-pointer transition-colors",children:[(0,n.jsx)("span",{className:"text-slate-400",children:"Desks:"}),(0,n.jsx)("span",{className:"font-bold text-slate-200",children:e?.agents??0}),(0,n.jsx)("span",{className:"text-slate-600",children:"|"}),(0,n.jsx)("span",{className:"text-slate-400",children:"Active:"}),(0,n.jsx)("span",{className:"font-bold text-cyan-400",children:e?.busy??0}),(0,n.jsx)("span",{className:"text-slate-600",children:"|"}),(0,n.jsx)("span",{className:"text-slate-400",children:"Tokens:"}),(0,n.jsx)("span",{className:"font-bold text-emerald-400",children:e?.tokensLabel??"0k"})]}),(0,n.jsxs)("button",{onClick:f,title:"Open Token & Cost Analytics",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors",children:[(0,n.jsx)(eK.f,{className:"w-3 h-3 text-amber-400"}),(0,n.jsx)("span",{className:"hidden md:inline font-medium",children:"Reports"})]}),(0,n.jsxs)("button",{onClick:x,title:"Supporter Store: Skins, Pets, Ambience & Coffee",className:`flex items-center gap-1.5 px-2.5 py-0.5 rounded border text-[11px] transition-all cursor-pointer ${m?"bg-amber-500/20 border-amber-500/50 text-amber-300 hover:bg-amber-500/30 shadow-sm shadow-amber-500/10":"bg-amber-500/10 hover:bg-amber-500/20 border-amber-500/40 hover:border-amber-400 text-amber-300 hover:text-white"}`,children:[(0,n.jsx)(eZ.f,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,n.jsx)("span",{className:"font-semibold text-amber-300",children:m?"VIP Supporter":"Store"})]}),(0,n.jsxs)("button",{onClick:p,title:"Color Themes & Font Customization (Preferences)",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors cursor-pointer",children:[(0,n.jsx)(eJ.f,{className:"w-3 h-3 text-cyan-400"}),(0,n.jsx)("span",{className:"hidden lg:inline font-medium",children:"Themes"})]}),(0,n.jsxs)("div",{className:"flex items-center rounded bg-[#252526] border border-[#333333] p-0.5 text-[11px]",children:[(0,n.jsxs)("button",{onClick:()=>s?.("live"),title:"Connect live log watchers ~/.gemini and ~/.claude",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"live"===t?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-slate-400 hover:text-slate-200"}`,children:[(0,n.jsx)(eX,{className:`w-2.5 h-2.5 ${"live"===t?"text-emerald-400 animate-pulse":"text-slate-500"}`}),"Live"]}),(0,n.jsx)("button",{onClick:()=>s?.("mock"),title:"Simulated multi-agent mock telemetry",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"mock"===t?"bg-[#333333] text-slate-200":"text-slate-400 hover:text-slate-200"}`,children:"Mock"}),"mock"===t&&(0,n.jsx)("select",{value:r,onChange:e=>l?.(e.target.value),className:"bg-transparent px-1 py-0.5 text-[10px] text-slate-300 outline-none cursor-pointer border-l border-[#333333] ml-1",children:e9.map(e=>(0,n.jsx)("option",{value:e.id,className:"bg-[#1e1e1e] text-slate-200",children:e.label},e.id))})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{s?.("mock"),l?.("showcase")},title:"Quickly showcase all 24 item archetypes in action",className:`flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold border transition-all ${"mock"===t&&"showcase"===r?"bg-cyan-500/20 text-cyan-300 border-cyan-500/50 shadow-sm shadow-cyan-500/20":"bg-[#252526] text-slate-300 border-[#333333] hover:text-cyan-300 hover:border-cyan-500/40"}`,children:[(0,n.jsx)(eQ.f,{className:"w-3 h-3 text-cyan-400"}),(0,n.jsx)("span",{children:"Items Showcase"})]}),(0,n.jsx)("button",{onClick:o,title:"Force refresh connections & data",className:"flex h-6 w-6 items-center justify-center rounded border border-[#333333] bg-[#252526] text-slate-400 hover:text-slate-200 hover:border-[#444444] transition-colors",children:(0,n.jsx)(eO.f,{className:`w-3 h-3 ${i?"animate-spin text-emerald-400":""}`})}),(0,n.jsx)("button",{onClick:c,title:a?"Sound effects: ON":"Sound effects: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${a?"border-emerald-500/50 bg-emerald-500/20 text-emerald-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:a?(0,n.jsx)(eD.f,{className:"w-3 h-3"}):(0,n.jsx)(eB,{className:"w-3 h-3"})}),(0,n.jsx)("button",{onClick:h,title:d?"Desktop notifications: ON":"Desktop notifications: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${d?"border-amber-500/50 bg-amber-500/20 text-amber-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:d?(0,n.jsx)(eU,{className:"w-3 h-3"}):(0,n.jsx)(eG,{className:"w-3 h-3"})}),(0,n.jsx)(e7,{isLeftSidebarVisible:g?.isLeftSidebarVisible,isBottomPanelVisible:g?.isBottomPanelVisible,isRightSidebarVisible:g?.isRightSidebarVisible,onToggleLeftSidebar:b,onToggleBottomPanel:v,onToggleRightSidebar:y,isZenFullscreen:w,onToggleZenFullscreen:j})]})]})}let tt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};tt.node;let tr=(0,eW.f)(tt);var ts=e.i(79432),tl=e.i(4139);let ti={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};ti.node;let to=(0,eW.f)(ti);var tn=e.i(20283);let ta={name:"files",size:24,node:[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]};ta.node;let tc=(0,eW.f)(ta);function td({activeView:e="explorer",onViewChange:t,onOpenStore:r,agentCount:s=0,isLeftSidebarVisible:l=!0,activeLeftSidebarTab:i="agents",isRightSidebarVisible:o=!1,activeRightSidebarTab:a="chat",isBottomPanelVisible:d=!1,onToggleBottomPanel:h,onOpenSettings:u}){let f=[{id:"explorer",title:"Explorer: Agents & Sessions (Ctrl+Shift+E)",icon:tr,badge:s>0?s:void 0},{id:"files",title:"Workspace Files: File Tree & Code Editor",icon:tc},{id:"chat",title:"Live Chat / Transcript (Sidebar)",icon:c.f},{id:"office",title:"Virtual 2D Office View (Canvas)",icon:eF.f},{id:"network",title:"Multi-Agent Collaboration DAG Graph",icon:tn.f},{id:"reports",title:"Token & AI Cost Analytics",icon:eK.f},{id:"telemetry",title:"Live Telemetry & Traces",icon:ts.f},{id:"store",title:"Supporter Store: Skins, Pets & Ambience",icon:eZ.f}];return(0,n.jsxs)("aside",{"data-testid":"activity-bar",className:"w-12 h-full bg-[#181818] flex flex-col justify-between items-center border-r border-[#2b2b2b] py-2 shrink-0 z-30 select-none",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1 w-full items-center",children:[f.map(s=>{let c="chat"===s.id?o&&"chat"===a:"files"===s.id?l&&"files"===i:"explorer"===s.id?l&&"agents"===i:e===s.id,d=s.icon;return(0,n.jsxs)("button",{onClick:()=>{"store"===s.id?r?.():t?.(s.id)},title:s.title,className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${c?"text-white border-l-2 border-[#007acc] bg-[#252526]/50":"store"===s.id?"text-amber-400 hover:text-amber-300 hover:bg-[#252526]/40 border-l-2 border-transparent":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:[(0,n.jsx)(d,{className:`w-5 h-5 ${"store"===s.id?"text-amber-400":""}`}),void 0!==s.badge&&(0,n.jsx)("span",{className:"absolute top-1.5 right-1.5 bg-[#007acc] text-white text-[9px] font-bold px-1 rounded-full leading-none min-w-3 text-center",children:s.badge})]},s.id)}),(0,n.jsx)("button",{onClick:h,title:d?"Hide Terminal & Logs (Cmd+J)":"Show Terminal & Logs (Cmd+J)",className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${d?"text-cyan-400 border-l-2 border-cyan-500/50":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:(0,n.jsx)(tl.f,{className:"w-5 h-5"})})]}),(0,n.jsx)("div",{className:"flex flex-col gap-1 w-full items-center",children:(0,n.jsx)("button",{onClick:u,title:"System Settings & Watchers",className:"w-full py-2.5 flex justify-center items-center text-[#858585] hover:text-[#cccccc] transition-colors border-l-2 border-transparent",children:(0,n.jsx)(to,{className:"w-5 h-5"})})})]})}var th=e.i(16327),tu=e.i(67927);let tf={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};tf.node;let tx=(0,eW.f)(tf),tp={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};tp.node;let tm=(0,eW.f)(tp);var tg=e.i(97142),tb=e.i(63448);let tv={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};tv.node;let ty=(0,eW.f)(tv);var tw=e.i(46513);let tj={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};tj.node;let tk=(0,eW.f)(tj);function tN({filename:e="",isFolder:t=!1,isOpen:r=!1,size:s=14,className:l=""}){if(t)return r?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${l}`,children:[(0,n.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V6H3a1.5 1.5 0 0 0-1.42 1.027L.5 11V3a1.5 1.5 0 0 1 1-1.5z",fill:"#c99e55"}),(0,n.jsx)("path",{d:"M2 13.5l1.8-6.2c.16-.54.66-.9 1.22-.9h9.46c.72 0 1.22.68 1.03 1.36l-1.5 5.2a1.5 1.5 0 0 1-1.44 1.04H3.5A1.5 1.5 0 0 1 2 13.5z",fill:"#e8a838"})]}):(0,n.jsx)("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${l}`,children:(0,n.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V3z",fill:"#dcb67a"})});let i=(e||"").toLowerCase();return i.endsWith(".js")||i.endsWith(".jsx")||i.endsWith(".mjs")||i.endsWith(".cjs")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f7df1e"}),(0,n.jsx)("text",{x:"3",y:"12",fill:"#000000",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:i.endsWith(".jsx")?"JSX":"JS"})]}):i.endsWith(".ts")||i.endsWith(".tsx")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3178c6"}),(0,n.jsx)("text",{x:"2.5",y:"12",fill:"#ffffff",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:i.endsWith(".tsx")?"TSX":"TS"})]}):i.endsWith(".json")||i.endsWith(".jsonl")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f1c40f",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"3.5",y:"12",fill:"#f1c40f",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"10",children:"{}"})]}):i.endsWith(".md")||i.endsWith(".markdown")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#519aba",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"2",y:"11.5",fill:"#519aba",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"MD"})]}):i.endsWith(".html")||i.endsWith(".htm")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e44d26",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"1",y:"11.5",fill:"#e44d26",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#42a5f5",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"2",y:"11.5",fill:"#42a5f5",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"#"})]}):i.endsWith(".java")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f89820",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"1.5",y:"11.5",fill:"#f89820",fontFamily:"var(--font-family-ui, sans-serif)",fontWeight:"bold",fontSize:"8.5",children:"JAVA"})]}):i.endsWith(".py")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3776ab",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"2.5",y:"11.5",fill:"#3776ab",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"9",children:"PY"})]}):i.endsWith(".sql")||i.endsWith(".ddl")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#00bcd4",fillOpacity:"0.2"}),(0,n.jsx)("path",{d:"M8 2C4.69 2 2 3.12 2 4.5v7C2 12.88 4.69 14 8 14s6-1.12 6-2.5v-7C14 3.12 11.31 2 8 2zm0 1.5c2.76 0 4.5.83 4.5 1s-1.74 1-4.5 1-4.5-.83-4.5-1 1.74-1 4.5-1zm-4.5 3.32c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1V6.82zm0 3.5c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1v-1.73z",fill:"#00bcd4"})]}):i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".ico")||i.endsWith(".bmp")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#26a69a",fillOpacity:"0.2",stroke:"#26a69a",strokeWidth:"0.8"}),(0,n.jsx)("circle",{cx:"5",cy:"5.5",r:"1.5",fill:"#26a69a"}),(0,n.jsx)("path",{d:"M2.5 13.5l4-5 3.5 4 2-2.5 2 3.5h-11.5z",fill:"#26a69a"})]}):i.endsWith(".svg")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#ff7043",fillOpacity:"0.2",stroke:"#ff7043",strokeWidth:"0.8"}),(0,n.jsx)("text",{x:"1",y:"11.5",fill:"#ff7043",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"SVG"})]}):"dockerfile"===i||i.startsWith("dockerfile.")||i.endsWith(".dockerfile")||i.includes("docker-compose")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#2496ed",fillOpacity:"0.2"}),(0,n.jsx)("path",{d:"M13.8 6.8c-.3-.2-.8-.2-1.1 0-.1-.6-.5-1.1-1.1-1.3l-.4-.1-.2.4c-.2.5-.2 1 0 1.5-.4.2-.8.5-1.2.9H2.5c-.3 0-.5.2-.5.5v3.5c0 1.7 1.3 3 3 3h5.2c2.5 0 4.6-1.8 4.8-4.3.4-.6.6-1.3.6-2 0-.8-.4-1.4-1-1.8-.2-.1-.5-.2-.8-.3zM4 6.5h1.5v1.5H4V6.5zm2 0h1.5v1.5H6V6.5zm2 0h1.5v1.5H8V6.5zm2 0h1.5v1.5H10V6.5z",fill:"#2496ed"})]}):i.startsWith(".git")||i.includes("git")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f05032",fillOpacity:"0.15"}),(0,n.jsx)("circle",{cx:"5",cy:"5",r:"1.5",fill:"#f05032"}),(0,n.jsx)("circle",{cx:"11",cy:"5",r:"1.5",fill:"#f05032"}),(0,n.jsx)("circle",{cx:"8",cy:"11.5",r:"1.5",fill:"#f05032"}),(0,n.jsx)("path",{d:"M5 6.5v2a3 3 0 0 0 3 3M11 6.5v2a3 3 0 0 1-3 3",stroke:"#f05032",strokeWidth:"1.2",fill:"none"})]}):i.endsWith(".yaml")||i.endsWith(".yml")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#cb171e",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"1",y:"11.5",fill:"#e06c75",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"YML"})]}):i.endsWith(".toml")||i.endsWith(".ini")||i.endsWith(".conf")||i.endsWith(".cfg")||i.endsWith(".properties")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#61afef",fillOpacity:"0.2"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"3",stroke:"#61afef",strokeWidth:"1.2",fill:"none"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"1",fill:"#61afef"}),(0,n.jsx)("path",{d:"M8 2.5v2M8 11.5v2M2.5 8h2M11.5 8h2",stroke:"#61afef",strokeWidth:"1.2"})]}):i.endsWith(".sh")||i.endsWith(".bash")||i.endsWith(".zsh")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#89d185",fillOpacity:"0.2"}),(0,n.jsx)("path",{d:"M4 5l3 3-3 3",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,n.jsx)("line",{x1:"8.5",y1:"11",x2:"12",y2:"11",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round"})]}):i.includes("lock")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e5c07b",fillOpacity:"0.2"}),(0,n.jsx)("rect",{x:"4.5",y:"7",width:"7",height:"6",rx:"1",fill:"#e5c07b"}),(0,n.jsx)("path",{d:"M6 7V5a2 2 0 1 1 4 0v2",stroke:"#e5c07b",strokeWidth:"1.2",fill:"none"})]}):i.endsWith(".xml")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e74c3c",fillOpacity:"0.2"}),(0,n.jsx)("text",{x:"1",y:"11.5",fill:"#e74c3c",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):i.startsWith(".env")||i.includes("config")?(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",className:`shrink-0 ${l}`,children:[(0,n.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#9b59b6",fillOpacity:"0.2"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"3.5",stroke:"#bb86fc",strokeWidth:"1.2",fill:"none"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"1.5",fill:"#03dac6"})]}):(0,n.jsxs)("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${l}`,children:[(0,n.jsx)("path",{d:"M3 2a1 1 0 0 1 1-1h5.5l3.5 3.5V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2z",stroke:"#858585",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,n.jsx)("path",{d:"M9 1v4h4",stroke:"#858585",strokeWidth:"1.2"}),(0,n.jsx)("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"}),(0,n.jsx)("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"})]})}function tS({entry:e,depth:t=0,expandedPaths:r,toggleFolder:s,onOpenFile:l,searchQuery:i}){let o=!!r[e.path],[c,d]=(0,a.useState)(null),[h,u]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e.isDirectory&&o&&null===c&&!h&&(u(!0),fetch(`/api/workspace/files?path=${encodeURIComponent(e.path)}`).then(e=>e.json()).then(e=>{d(e.entries||[])}).catch(()=>d([])).finally(()=>u(!1)))},[e.isDirectory,e.path,o,c,h]);let f=(0,a.useMemo)(()=>!i||e.name.toLowerCase().includes(i.toLowerCase()),[e.name,i]);return e.isDirectory?(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("div",{onClick:()=>s(e.path),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none",style:{paddingLeft:`${14*t+8}px`},title:e.path,children:[o?(0,n.jsx)(th.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}):(0,n.jsx)(tu.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),(0,n.jsx)(tN,{isFolder:!0,isOpen:o,size:14}),(0,n.jsx)("span",{className:"font-medium text-[11px] truncate",children:e.name}),h&&(0,n.jsx)(eO.f,{className:"w-2.5 h-2.5 animate-spin text-cyan-400 ml-auto"})]}),o&&c&&(0,n.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,n.jsx)("div",{className:"text-[10px] text-slate-500 italic py-0.5",style:{paddingLeft:`${(t+1)*14+18}px`},children:"(Empty folder)"}):c.map(e=>(0,n.jsx)(tS,{entry:e,depth:t+1,expandedPaths:r,toggleFolder:s,onOpenFile:l,searchQuery:i},e.path))})]}):f?(0,n.jsxs)("div",{onClick:()=>l?.(e),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none group",style:{paddingLeft:`${14*t+20}px`},title:`${e.name} (${e.size?`${Math.round(e.size/1024)} KB`:""})`,children:[(0,n.jsx)(tN,{filename:e.name,size:14}),(0,n.jsx)("span",{className:"text-[11px] text-slate-300 group-hover:text-cyan-300 truncate",children:e.name}),e.size>0&&(0,n.jsx)("span",{className:"text-[9px] text-slate-600 font-mono ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:e.size>1048576?`${(e.size/1048576).toFixed(1)}M`:`${Math.round(e.size/1024)}k`})]}):null}function tC({onOpenFile:e,initialPath:t=""}){let[r,s]=(0,a.useState)(t),[l,i]=(0,a.useState)(null),[o,c]=(0,a.useState)([]),[d,h]=(0,a.useState)(!1),[u,f]=(0,a.useState)(""),[x,p]=(0,a.useState)({}),m=(0,a.useCallback)(async e=>{h(!0);try{let t=e?`/api/workspace/files?path=${encodeURIComponent(e)}`:"/api/workspace/files",r=await fetch(t),l=await r.json();r.ok&&(c(l.entries||[]),s(l.currentPath||""),i(l.parentPath||null))}catch{}finally{h(!1)}},[]);(0,a.useEffect)(()=>{m(t)},[t,m]);let g=(0,a.useCallback)(e=>{p(t=>({...t,[e]:!t[e]}))},[]),b=(0,a.useMemo)(()=>r?r.split("/").pop()||r:"Workspace",[r]);return(0,n.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden text-xs",children:[(0,n.jsxs)("div",{className:"h-[30px] min-h-[30px] px-2.5 bg-[#252526] border-b border-[#2b2b2b] flex items-center justify-between shrink-0 select-none",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[(0,n.jsx)(tm,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,n.jsx)("span",{className:"font-bold text-[11px] uppercase tracking-wider text-slate-300 truncate",title:r,children:b})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[l&&(0,n.jsx)("button",{onClick:()=>{l&&m(l)},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Navigate up one directory",children:(0,n.jsx)(tk,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{onClick:()=>m(r),className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Refresh file explorer",children:(0,n.jsx)(eO.f,{className:`w-3.5 h-3.5 ${d?"animate-spin text-emerald-400":""}`})})]})]}),(0,n.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]/60",children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,n.jsx)(e$.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,n.jsx)("input",{type:"text",value:u,onChange:e=>f(e.target.value),placeholder:"Search files...",className:"bg-transparent text-[11px] text-slate-200 outline-none w-full placeholder:text-slate-500"})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto p-1 py-1.5 space-y-0.5",children:d&&0===o.length?(0,n.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading files..."}):0===o.length?(0,n.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs italic",children:"No files found"}):o.map(t=>(0,n.jsx)(tS,{entry:t,depth:0,expandedPaths:x,toggleFolder:g,onOpenFile:e,searchQuery:u},t.path))})]})}var tT=e.i(81390);function t_({workstations:e=[],selectedId:t=null,onSelectAgent:r,onOpenAgentTab:s,stats:l={},onRefresh:i,onStartReplay:o,onViewConversation:d,onOpenFile:u,onOpenStore:f,activeSidebarTab:x,onActiveSidebarTabChange:p}){let[m,g]=(0,a.useState)("agents"),b=void 0!==x?x:m,v=p||g,[y,w]=(0,a.useState)(""),[j,k]=(0,a.useState)(""),[N,S]=(0,a.useState)({agents:!0,folders:!0,metrics:!1}),C=e=>{S(t=>({...t,[e]:!t[e]}))},T=(0,a.useMemo)(()=>{if(!j.trim())return e;let t=j.toLowerCase();return e.filter(e=>e.account?.toLowerCase().includes(t)||e.sessionTitle?.toLowerCase().includes(t)||e.lastText?.toLowerCase().includes(t)||e.connectionId?.toLowerCase().includes(t)||e.provider?.toLowerCase().includes(t)||e.model?.toLowerCase().includes(t)||e.activeTool?.toLowerCase().includes(t))},[e,j]),_=(0,a.useMemo)(()=>{let e={extensions:[],desktop:[],geminiApp:[],geminiCli:[],claude:[],other:[]};return T.forEach(t=>{let r=(t.provider||"").toLowerCase(),s=(t.clientType||"").toLowerCase(),l=(t.cli||"").toLowerCase(),i=(t.connectionId||"").toLowerCase(),o=(t.model||"").toLowerCase(),n="extension"===s||"ide"===s||i.includes("extension"),a="desktop"===s||i.includes("desktop"),c="claude"===l||r.includes("claude")||r.includes("anthropic")||o.includes("claude");n?e.extensions.push(t):a?e.desktop.push(t):"app"===s||r.includes("app")||i.includes("app")?e.geminiApp.push(t):c?e.claude.push(t):r.includes("gemini")||"antigravity"===l||"cli"===s?e.geminiCli.push(t):e.other.push(t)}),e},[T]),M=(e,l)=>{let i=t===e.connectionId,a=e.state||"idle",u=e.account||"agent-factory",f=e.sessionTitle||u,x="app"===e.clientType||(e.provider||"").includes("(app)"),p="extension"===e.clientType||(e.provider||"").includes("extension")||(e.connectionId||"").toLowerCase().includes("extension"),m="desktop"===e.clientType||(e.connectionId||"").toLowerCase().includes("desktop"),g=e.lastText?`${"assistant"===e.lastTextRole?"AI: ":"user"===e.lastTextRole?"You: ":""}${e.lastText}`:`${u} \xb7 ${e.model||"AI Agent"}${e.activeTool?` \xb7 ${e.activeTool}`:""}`;return(0,n.jsxs)("div",{onClick:()=>{r?.(e.connectionId),s?.(e)},className:`group flex items-center justify-between px-3 py-2 cursor-pointer text-xs transition-colors border-l-2 ${i?"bg-[#37373d] text-white border-[#007acc]":"hover:bg-[#2a2d2e] text-[#cccccc] border-transparent"}`,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1 mr-2",children:[(0,n.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${"error"===a?"bg-rose-500":"streaming"===a||"busy"===a||"working"===a?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-slate-500"}`}),(0,n.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,n.jsx)("span",{className:"font-medium truncate text-[11px] text-slate-200",title:f,children:f}),p?(0,n.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"EXT"}):m?(0,n.jsx)("span",{className:"shrink-0 bg-orange-950/80 text-orange-300 border border-orange-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"DESK"}):x?(0,n.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"APP"}):(0,n.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"CLI"})]}),(0,n.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:g,children:g})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),o(e.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-cyan-400 hover:text-white transition-all cursor-pointer",title:"Replay Session (Default)",children:(0,n.jsx)(h.f,{className:"w-3 h-3"})}),d&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),d(e.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-slate-400 hover:text-cyan-300 transition-all cursor-pointer",title:"View conversation transcript",children:(0,n.jsx)(c.f,{className:"w-3 h-3"})}),(0,n.jsx)("span",{className:"text-[10px] text-slate-500 font-mono group-hover:text-slate-300",children:e.totalLabel||"0k"})]})]},e.connectionId||`agent-${l}`)};return(0,n.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,n.jsxs)("div",{className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{onClick:()=>v("agents"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"agents"===b?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"View active AI Agents & Sessions",children:[(0,n.jsx)(eF.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,n.jsxs)("span",{children:["Agents (",e.length,")"]})]}),(0,n.jsxs)("button",{onClick:()=>v("files"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"files"===b?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"Browse Workspace & Project Files",children:[(0,n.jsx)(tr,{className:"w-3.5 h-3.5 text-amber-400"}),(0,n.jsx)("span",{children:"Files"})]})]}),(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)("button",{onClick:i,title:"Refresh",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",children:(0,n.jsx)(eO.f,{className:"w-3 h-3"})})})]}),"files"===b?(0,n.jsx)(tC,{onOpenFile:u,initialPath:y}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]",children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,n.jsx)(e$.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,n.jsx)("input",{type:"text",value:j,onChange:e=>k(e.target.value),placeholder:"Filter agents by name, model...",className:"w-full bg-transparent text-[11px] text-slate-200 outline-none placeholder:text-slate-500"})]})}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2b2b2b]",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:()=>C("agents"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[N.agents?(0,n.jsx)(th.f,{className:"w-3 h-3 text-slate-400"}):(0,n.jsx)(tu.f,{className:"w-3 h-3 text-slate-400"}),(0,n.jsxs)("span",{className:"uppercase text-[10px] tracking-wide",children:["Workstations & Sessions (",T.length,")"]})]}),l?.busy>0&&(0,n.jsxs)("span",{className:"bg-emerald-500/20 text-emerald-400 text-[9px] font-bold px-1.5 py-0.2 rounded-full border border-emerald-500/30",children:[l.busy," active"]})]}),N.agents&&(0,n.jsx)("div",{className:"py-1",children:0===T.length?(0,n.jsx)("div",{className:"px-4 py-3 text-center text-xs text-slate-500 italic",children:"No active agents found"}):(0,n.jsxs)(n.Fragment,{children:[_.extensions?.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-400/90 flex items-center gap-1",children:[(0,n.jsx)(ty,{className:"w-2.5 h-2.5"}),(0,n.jsxs)("span",{children:["Extensions & IDEs (",_.extensions.length,")"]})]}),_.extensions.map(M)]}),_.desktop?.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-orange-400/90 flex items-center gap-1",children:[(0,n.jsx)(tw.f,{className:"w-2.5 h-2.5"}),(0,n.jsxs)("span",{children:["Claude Desktop (",_.desktop.length,")"]})]}),_.desktop.map(M)]}),_.geminiApp.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-purple-400/80 flex items-center gap-1",children:[(0,n.jsx)(eQ.f,{className:"w-2.5 h-2.5"}),(0,n.jsxs)("span",{children:["Antigravity Desktop App (",_.geminiApp.length,")"]})]}),_.geminiApp.map(M)]}),_.geminiCli.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-emerald-400/80 flex items-center gap-1",children:[(0,n.jsx)(tg.f,{className:"w-2.5 h-2.5"}),(0,n.jsxs)("span",{children:["Gemini CLI / Antigravity (",_.geminiCli.length,")"]})]}),_.geminiCli.map(M)]}),_.claude.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-amber-400/80 flex items-center gap-1",children:[(0,n.jsx)(ts.f,{className:"w-2.5 h-2.5"}),(0,n.jsxs)("span",{children:["Claude Code (",_.claude.length,")"]})]}),_.claude.map(M)]}),_.other.length>0&&(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-slate-400 flex items-center gap-1",children:(0,n.jsxs)("span",{children:["Other Agents (",_.other.length,")"]})}),_.other.map(M)]})]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{type:"button",onClick:()=>C("folders"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[N.folders?(0,n.jsx)(th.f,{className:"w-3 h-3 text-slate-400"}):(0,n.jsx)(tu.f,{className:"w-3 h-3 text-slate-400"}),(0,n.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Watched Brain Directories"})]})}),N.folders&&(0,n.jsxs)("div",{className:"px-3 py-2 space-y-1.5 text-[11px]",children:[(0,n.jsxs)("div",{onClick:()=>{w("~/.gemini/antigravity/brain"),v("files")},className:"flex items-center gap-2 text-slate-400 hover:text-purple-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity Brain files",children:[(0,n.jsx)(tm,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),(0,n.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity/brain"})]}),(0,n.jsxs)("div",{onClick:()=>{w("~/.gemini/antigravity-cli/brain"),v("files")},className:"flex items-center gap-2 text-slate-400 hover:text-emerald-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity CLI Brain files",children:[(0,n.jsx)(tx,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,n.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity-cli/brain"})]}),(0,n.jsxs)("div",{onClick:()=>{w("~/.claude/projects"),v("files")},className:"flex items-center gap-2 text-slate-400 hover:text-amber-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Claude Projects files",children:[(0,n.jsx)(tx,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,n.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.claude/projects"})]})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{type:"button",onClick:()=>C("metrics"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[N.metrics?(0,n.jsx)(th.f,{className:"w-3 h-3 text-slate-400"}):(0,n.jsx)(tu.f,{className:"w-3 h-3 text-slate-400"}),(0,n.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Factory Overview"})]})}),N.metrics&&(0,n.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,n.jsx)("span",{children:"Total Workstations:"}),(0,n.jsx)("span",{className:"font-bold text-slate-200",children:l?.agents||0})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,n.jsx)("span",{children:"Active Agents:"}),(0,n.jsx)("span",{className:"font-bold text-emerald-400",children:l?.busy||0})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,n.jsx)("span",{children:"Total Tokens:"}),(0,n.jsx)("span",{className:"font-bold text-cyan-400",children:l?.tokensLabel||"0k"})]})]})]}),(0,n.jsx)("div",{className:"p-2 border-t border-[#252526] bg-[#1a1a1b]",children:(0,n.jsxs)("button",{type:"button",onClick:f,className:"w-full flex items-center justify-between p-2 rounded-lg bg-gradient-to-r from-amber-500/15 to-amber-600/10 hover:from-amber-500/25 hover:to-amber-600/20 border border-amber-500/30 text-amber-300 transition-all cursor-pointer text-xs",title:`Open Supporter Store: ${tT.E} Tech Items & 3D Effects`,children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(tb.f,{className:"w-4 h-4 text-amber-400"}),(0,n.jsxs)("div",{className:"text-left",children:[(0,n.jsx)("div",{className:"font-bold text-white text-[11px] leading-tight",children:"Supporter Store"}),(0,n.jsxs)("div",{className:"text-[10px] text-amber-400/80",children:[tT.E," Tech Items & 3D Effects"]})]})]}),(0,n.jsx)("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-amber-500/20 border border-amber-500/40",children:"Open"})]})})]})]})]})}var tM=e.i(63676),tz=e.i(24071);function tR({tabs:e=[],activeTabId:t="canvas",onSelectTab:r,onCloseTab:s,isZenFullscreen:l=!1,onToggleZenFullscreen:i=null}){let o=(0,a.useRef)(null);return(0,n.jsxs)("div",{"data-testid":"editor-tabs-bar",className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#1e1e1e] flex items-center justify-between select-none overflow-hidden",children:[(0,n.jsx)("div",{ref:o,onWheel:e=>{o.current&&(o.current.scrollLeft+=e.deltaY)},className:"flex items-center h-full overflow-x-auto no-scrollbar scroll-smooth flex-1",style:{scrollbarWidth:"none"},children:e.map(e=>{let l=e.id===t;return(0,n.jsxs)("div",{onClick:()=>r?.(e.id),className:`group flex items-center gap-2 h-full px-3 text-xs cursor-pointer border-r border-[#1e1e1e] transition-colors relative shrink-0 ${l?"bg-[#1e1e1e] text-white border-t-2 border-t-[#007acc]":"bg-[#2d2d2d] text-[#969696] hover:bg-[#252526] hover:text-[#cccccc] border-t-2 border-t-transparent"}`,children:["canvas"===e.type?(0,n.jsx)(eF.f,{className:"w-3.5 h-3.5 text-emerald-400"}):"network"===e.type?(0,n.jsx)(tn.f,{className:"w-3.5 h-3.5 text-indigo-400"}):"telemetry"===e.type?(0,n.jsx)(ts.f,{className:"w-3.5 h-3.5 text-cyan-400"}):"reports"===e.type?(0,n.jsx)(eK.f,{className:"w-3.5 h-3.5 text-amber-400"}):"store"===e.type?(0,n.jsx)(tb.f,{className:"w-3.5 h-3.5 text-amber-400"}):"file"===e.type?(0,n.jsx)(tN,{filename:e.filePath||e.title,size:14}):(0,n.jsx)(tg.f,{className:"w-3.5 h-3.5 text-purple-400"}),(0,n.jsx)("span",{className:"font-medium text-[11px] truncate max-w-[140px]",children:e.title}),!1!==e.closable&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),s?.(e.id)},title:"Close tab",className:"p-0.5 rounded text-slate-500 hover:text-white hover:bg-[#333333] transition-colors opacity-70 group-hover:opacity-100",children:(0,n.jsx)(tM.X,{className:"w-3 h-3"})})]},e.id)})}),(0,n.jsxs)("div",{className:"flex items-center px-2 gap-1 bg-[#252526] border-l border-[#1e1e1e] shrink-0 h-full",children:[i&&"canvas"===t&&(0,n.jsx)("button",{type:"button","data-testid":"editor-zen-fullscreen-btn",onClick:i,title:l?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",className:"p-1 mr-0.5 rounded text-slate-400 hover:text-cyan-300 hover:bg-[#333333] transition-colors cursor-pointer",children:(0,n.jsx)(e8.f,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{onClick:()=>{o.current&&o.current.scrollBy({left:-100,behavior:"smooth"})},title:"Scroll left",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,n.jsx)(tz.f,{className:"w-3 h-3"})}),(0,n.jsx)("button",{onClick:()=>{o.current&&o.current.scrollBy({left:100,behavior:"smooth"})},title:"Scroll right",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,n.jsx)(tu.f,{className:"w-3 h-3"})})]})]})}var tI=e.i(53138);let tL={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};tL.node;let tE=(0,eW.f)(tL);var tA=e.i(19830),tP=e.i(28523);function tF({traces:e=[],activeTab:t="logs",onTabChange:r,onClose:s,isMaximized:l=!1,onToggleMaximize:i}){let[o,c]=(0,a.useState)(t),[d,h]=(0,a.useState)(""),[u,f]=(0,a.useState)(!0),[x,p]=(0,a.useState)(null),[m,g]=(0,a.useState)(!1),b=(0,a.useRef)(null);(0,a.useEffect)(()=>{g(!0)},[]),(0,a.useEffect)(()=>{c(t)},[t]);let v=(0,a.useMemo)(()=>{let t=[],r=e=>{if(!m)return"--:--:--";if(e){if("string"==typeof e&&e.includes(":"))return e;let t=new Date(e);if(!isNaN(t.getTime()))return t.toLocaleTimeString()}return new Date().toLocaleTimeString()};e.forEach(e=>{let s=e.account||"Agent",l=e.model||"gemini-3.8-flash",i=e.clientType||(e.provider?.includes("app")?"app":"cli"),o=e.provider||"gemini",n=e.connectionId||e.traceId||"agent";Array.isArray(e.logs)&&e.logs.length>0?e.logs.forEach((e,a)=>{let c=(e.type||"").toUpperCase(),d=c.includes("ERR")?"ERROR":c.includes("TOOL")?"TOOL":"STREAM";t.push({id:`${n}-${e.timestamp||a}-${a}`,time:r(e.timestamp),level:d,provider:o,clientType:i,account:s,model:l,message:e.detail||e.summary||"Event recorded",meta:e.summary!==e.detail?e.summary:""})}):(e.activeTool&&t.push({id:`${n}-tool-${e.activeTool}`,time:r(e.timestamp),level:"TOOL",provider:o,clientType:i,account:s,model:l,message:`Executing tool: ${e.activeTool}`,meta:e.activeToolParams||""}),("streaming"===e.state||"busy"===e.state)&&t.push({id:`${n}-stream`,time:r(e.timestamp),level:"STREAM",provider:o,clientType:i,account:s,model:l,message:`Active session processing tokens (${Number.isFinite(e.totalTokens)?`${Math.round(e.totalTokens/1e3)}k`:"unavailable"})`}),"error"===e.state&&t.push({id:`${n}-err`,time:r(e.timestamp),level:"ERROR",provider:o,clientType:i,account:s,model:l,message:`Session encountered error state (${e.error||"failed"})`}))}),0===t.length&&t.push({id:"sys-init",time:m?new Date().toLocaleTimeString():"--:--:--",level:"SYSTEM",provider:"system",clientType:"cli",account:"AGMon Core",message:"Watcher initialized. Monitoring ~/.gemini and ~/.claude directories in real time."});let s=t.length>250?t.slice(-250):t;return x?s.filter(e=>e.time>x):s},[e,x,m]),y=(0,a.useMemo)(()=>{let e=v;if("tools"===o?e=e.filter(e=>"TOOL"===e.level):"problems"===o&&(e=e.filter(e=>"ERROR"===e.level)),d.trim()){let t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||e.account.toLowerCase().includes(t)||e.level.toLowerCase().includes(t)||e.model?.toLowerCase().includes(t))}return e},[v,o,d]);(0,a.useEffect)(()=>{u&&b.current&&(b.current.scrollTop=b.current.scrollHeight)},[y,u]);let w=[{id:"logs",label:"Agent Output",icon:tl.f,count:v.length},{id:"tools",label:"Tool Executions",icon:ts.f,count:v.filter(e=>"TOOL"===e.level).length},{id:"problems",label:"Problems",icon:tI.f,count:v.filter(e=>"ERROR"===e.level).length}];return(0,n.jsxs)("div",{"data-testid":"bottom-panel-container",className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,n.jsxs)("div",{className:"h-[32px] min-h-[32px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,n.jsx)("div",{className:"flex items-center h-full gap-1",children:w.map(e=>{let t=o===e.id,s=e.icon;return(0,n.jsxs)("button",{type:"button",onClick:()=>{c(e.id),r?.(e.id)},className:`flex items-center gap-1.5 h-full px-2.5 text-xs transition-colors border-b-2 font-medium ${t?"text-white border-[#007acc] bg-[#1e1e1e]":"text-[#858585] hover:text-[#cccccc] border-transparent"}`,children:[(0,n.jsx)(s,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{className:"text-[11px] uppercase tracking-wider",children:e.label}),e.count>0&&(0,n.jsx)("span",{className:"bg-[#333333] text-slate-300 text-[9px] font-mono px-1 rounded-full",children:e.count})]},e.id)})}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1.5 py-0.5 h-5",children:[(0,n.jsx)(e$.f,{className:"w-2.5 h-2.5 text-slate-500"}),(0,n.jsx)("input",{type:"text",value:d,onChange:e=>h(e.target.value),placeholder:"Filter logs...",className:"bg-transparent text-[10px] text-slate-200 outline-none w-20 sm:w-32 placeholder:text-slate-500"})]}),(0,n.jsx)("button",{onClick:()=>f(e=>!e),title:u?"Pause auto-scroll":"Resume auto-scroll",className:`p-1 rounded text-xs transition-colors ${u?"text-cyan-400 bg-cyan-950/40":"text-slate-500 hover:text-slate-300"}`,children:u?(0,n.jsx)(tP.f,{className:"w-3 h-3"}):(0,n.jsx)(tA.f,{className:"w-3 h-3"})}),(0,n.jsx)("button",{onClick:()=>p(new Date().toLocaleTimeString()),title:"Clear log console",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,n.jsx)(tE,{className:"w-3 h-3"})}),i&&(0,n.jsx)("button",{onClick:i,title:l?"Restore panel size":"Maximize panel",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:l?(0,n.jsx)(e6.f,{className:"w-3 h-3"}):(0,n.jsx)(e8.f,{className:"w-3 h-3"})}),(0,n.jsx)("button",{onClick:s,title:"Close panel (Cmd+J / Ctrl+J)",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,n.jsx)(tM.X,{className:"w-3 h-3"})})]})]}),(0,n.jsx)("div",{ref:b,className:"flex-1 p-2 font-mono text-[11px] leading-relaxed overflow-y-auto bg-[#181818] select-text divide-y divide-[#222222]",children:0===y.length?(0,n.jsx)("div",{className:"text-slate-500 italic py-4 text-center",children:"No logs match the current filters"}):y.map(e=>{let t="TOOL"===e.level,r="ERROR"===e.level,s="app"===e.clientType;return(0,n.jsxs)("div",{className:"py-1 flex items-start gap-2 hover:bg-[#202020] px-1 rounded",children:[(0,n.jsx)("span",{suppressHydrationWarning:!0,className:"text-slate-500 shrink-0 text-[10px]",children:e.time}),(0,n.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${r?"bg-rose-950/80 text-rose-300 border border-rose-500/40":t?"bg-cyan-950/80 text-cyan-300 border border-cyan-500/40":"bg-slate-800 text-slate-300 border border-slate-700"}`,children:e.level}),(0,n.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${s?"bg-purple-950/80 text-purple-300 border border-purple-500/40":"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40"}`,children:s?"APP":"CLI"}),(0,n.jsxs)("span",{className:"text-slate-300 font-semibold shrink-0",children:["[",e.account,"]"]}),(0,n.jsx)("span",{className:"text-slate-400 break-all",children:e.message}),e.meta&&(0,n.jsx)("span",{className:"text-slate-500 text-[10px] truncate max-w-xs",children:e.meta})]},e.id)})})]})}var t$=e.i(12092),tO=e.i(86206),tD=e.i(8734),tW=e.i(89664),tV=e.i(17099),tB=e.i(60244);function tH({selectedAgent:e=null,workstations:t=[],activeTab:r="chat",onTabChange:s,onSelectAgent:l,onClose:i,onStartReplay:o}){let u,f,x,p,m,g,b,v,y,w,[j,k]=(0,a.useState)(!1),[N,S]=(0,a.useState)(r||"chat"),C=s?r:N,T=e=>{s?s(e):S(e)},_=e?.clientType==="app"||(e?.provider||"").toLowerCase().includes("(app)"),M=e?.state==="streaming"||e?.state==="busy"||e?.state==="working"||e?.mode==="streaming";return(0,n.jsxs)("div",{"data-testid":"secondary-sidebar-container",className:"flex flex-col h-full w-full bg-[var(--bg-editor)] text-[var(--text-main)] select-none overflow-hidden",children:[(0,n.jsxs)("div",{className:"h-[36px] min-h-[36px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-2 flex items-center justify-between shrink-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>T("chat"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"chat"===C?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent Live Chat & Conversation Transcript",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(c.f,{className:"w-3.5 h-3.5"}),M&&(0,n.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-cyan-400 animate-ping"})]}),(0,n.jsx)("span",{children:"Live Chat"}),M&&(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 inline-block ml-0.5"})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>T("inspector"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"inspector"===C?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent specs, telemetry, and token usage",children:[(0,n.jsx)(t$.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:"Inspector"})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:["chat"===C&&e&&(0,n.jsx)("button",{onClick:()=>(0,eP.f)(e.connectionId||e.traceId),title:"Open in Detached Window (VS Code style)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent-primary)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,n.jsx)(d.f,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{onClick:i,title:"Close Secondary Sidebar (Cmd+Alt+B)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,n.jsx)(tM.X,{className:"w-3.5 h-3.5"})})]})]}),(0,n.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:"chat"===C?e?(0,n.jsx)(tV.f,{sessionTrace:e,isSidebar:!0,onClose:i,onStartReplay:o}):(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col justify-center items-center text-center space-y-4",children:[(0,n.jsx)("div",{className:"w-12 h-12 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center text-slate-500",children:(0,n.jsx)(c.f,{className:"w-6 h-6"})}),(0,n.jsxs)("div",{className:"space-y-1.5 max-w-[280px]",children:[(0,n.jsx)("h4",{className:"font-bold text-slate-300 text-xs",children:"No Agent Selected"}),(0,n.jsx)("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Click any workstation on the virtual office or select an active agent below to inspect live conversation:"})]}),t.length>0&&(0,n.jsxs)("div",{className:"w-full max-w-[280px] space-y-1.5 pt-2 text-left",children:[(0,n.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500 block px-1",children:["Active Agents (",t.length,")"]}),(0,n.jsx)("div",{className:"space-y-1 max-h-[28rem] overflow-y-auto pr-1",children:t.map((e,t)=>{let r="streaming"===e.state||"busy"===e.state||"working"===e.state||"streaming"===e.mode,s=e.account||"agent-factory",i=e.sessionTitle||s,o="app"===e.clientType||(e.provider||"").includes("(app)"),a="extension"===e.clientType||(e.provider||"").includes("extension")||(e.connectionId||"").toLowerCase().includes("extension"),c=e.lastText?`${"assistant"===e.lastTextRole?"AI: ":"user"===e.lastTextRole?"You: ":""}${e.lastText}`:`${s} \xb7 ${e.model||"AI Agent"}${e.activeTool?` \xb7 ${e.activeTool}`:""}`;return(0,n.jsxs)("button",{onClick:()=>l?.(e.connectionId||e.traceId),className:"w-full flex items-center gap-2 p-2 rounded bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] text-left transition-colors cursor-pointer text-slate-300",children:[(0,n.jsx)(eF.f,{className:"w-3.5 h-3.5 text-cyan-400 shrink-0 self-start mt-0.5"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,n.jsx)("span",{className:"truncate font-medium text-xs text-slate-200",title:i,children:i}),a?(0,n.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"EXT"}):o?(0,n.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"APP"}):(0,n.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"CLI"})]}),(0,n.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:c,children:c})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[r&&(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),(0,n.jsx)(tu.f,{className:"w-3.5 h-3.5 text-slate-500"})]})]},e.connectionId||e.traceId||`active-agent-${t}`)})})]})]}):(0,n.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-3 text-xs select-text",children:e?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded bg-[#1e1e1e] flex items-center justify-center border border-[#3e3e42]",children:(0,n.jsx)(tg.f,{className:"w-3.5 h-3.5 text-cyan-400"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-bold text-slate-200 text-xs",children:e.account||`Desk #${(e.deskIndex??0)+1}`}),(0,n.jsxs)("p",{className:"text-[10px] text-slate-400 font-mono",children:["ID: ",e.connectionId?.slice(0,8),"..."]})]})]}),_?(0,n.jsxs)("span",{className:"bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,n.jsx)(tO.f,{className:"w-2.5 h-2.5"}),(0,n.jsx)("span",{children:"APP"})]}):(0,n.jsxs)("span",{className:"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,n.jsx)(tl.f,{className:"w-2.5 h-2.5"}),(0,n.jsx)("span",{children:"CLI"})]})]}),(0,n.jsxs)("div",{className:"pt-2 border-t border-[#2b2b2b] grid grid-cols-2 gap-2 text-[11px]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"PROVIDER"}),(0,n.jsx)("span",{className:"font-semibold text-slate-300 uppercase",children:e.provider||"Unavailable"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"MODEL"}),(0,n.jsx)("span",{className:"font-semibold text-emerald-400 truncate block",children:e.model||"Unavailable"})]})]})]}),(0,n.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,n.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"CURRENT ACTIVITY"}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,n.jsx)("span",{className:"text-slate-400",children:"Status:"}),(0,n.jsx)("span",{className:`font-semibold capitalize px-1.5 py-0.2 rounded text-[10px] ${"streaming"===e.state?"bg-cyan-500/20 text-cyan-300 border border-cyan-500/30":"busy"===e.state?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"error"===e.state?"bg-rose-500/20 text-rose-300 border border-rose-500/30":"bg-slate-800 text-slate-400"}`,children:e.state||"Idle"})]}),e.activeTool&&(0,n.jsxs)("div",{className:"pt-1",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[11px] block",children:"Active Tool:"}),(0,n.jsx)("div",{className:"mt-1 bg-[#181818] p-1.5 rounded border border-[#2b2b2b] font-mono text-[10px] text-cyan-300 truncate",children:e.activeTool})]})]}),(u=(0,tB.F)(),f=e?.skin||u?.equippedSkin,x=e?.aura||u?.equippedAura,p=e?.pet||u?.equippedPet,m=e?.props&&e.props.length>0?e.props:u?.equippedProps||[],g=e?.trophy||u?.equippedTrophy,b=f&&"classic"!==f&&"none"!==f?(0,tT.x)(f):null,v=x&&"none"!==x?(0,tT.x)(x):null,y=p&&"none"!==p?(0,tT.x)(p):null,w=g&&"none"!==g?(0,tT.x)(g):null,(0,n.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-[10px] font-bold text-cyan-400 uppercase tracking-wider flex items-center gap-1.5",children:[(0,n.jsx)(eQ.f,{className:"w-3 h-3 text-cyan-400"}),(0,n.jsx)("span",{children:"EQUIPPED COSMETICS"})]}),(b||v||y||w||m.length>0)&&(0,n.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/80 text-cyan-300 border border-cyan-500/40 font-mono font-bold",children:"ACTIVE GEAR"})]}),(0,n.jsxs)("div",{className:"space-y-1.5 text-[11px]",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Chassis Skin:"}),(0,n.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:b?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"w-2 h-2 rounded-full inline-block border border-white/20",style:{backgroundColor:b.color}}),(0,n.jsx)("span",{className:"text-emerald-400 font-semibold truncate max-w-[120px]",children:b.name}),(0,n.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-slate-800 text-slate-400 border border-slate-700",children:b.archetype})]}):(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Classic Chassis"})})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Particle Aura:"}),(0,n.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-purple-400 font-semibold truncate max-w-[120px]",children:v.name}),(0,n.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-purple-950/60 text-purple-300 border border-purple-800/40",children:v.archetype})]}):(0,n.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,n.jsxs)("div",{className:"py-1 border-b border-[#2d2d30]",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Tech Desk Props:"}),(0,n.jsxs)("span",{className:"text-[9px] text-slate-500 font-mono",children:["(",m.length,")"]})]}),m.length>0?(0,n.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:m.map((e,t)=>{let r=(0,tT.x)(e);return(0,n.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/60 text-cyan-300 border border-cyan-800/40 font-mono flex items-center gap-1",children:[(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:r?.color||"#38bdf8"}}),(0,n.jsx)("span",{children:r?.name||e})]},t)})}):(0,n.jsx)("span",{className:"text-slate-500 text-[10px]",children:"Standard Workstation"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Companion Pet:"}),(0,n.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:y?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-amber-400 font-semibold truncate max-w-[120px]",children:y.name}),(0,n.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-amber-950/60 text-amber-300 border border-amber-800/40",children:y.archetype})]}):(0,n.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Desk Trophy:"}),(0,n.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:w?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-yellow-400 font-semibold truncate max-w-[120px]",children:w.name}),(0,n.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-yellow-950/60 text-yellow-300 border border-yellow-800/40",children:w.archetype})]}):(0,n.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]})]})]})),(0,n.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,n.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"TOKEN USAGE"}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-[11px]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Total Tokens"}),(0,n.jsx)("span",{className:"font-bold text-emerald-400 font-mono",children:Number.isFinite(e.totalTokens)?e.totalTokens.toLocaleString():"—"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Requests / Steps"}),(0,n.jsx)("span",{className:"font-bold text-slate-300 font-mono",children:Number.isFinite(e.requestCount)?e.requestCount:"—"})]})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5 pt-1",children:[o&&(0,n.jsxs)("button",{onClick:()=>o(e.connectionId||e.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#007acc] hover:bg-[#0062a3] text-white font-medium text-xs transition-colors shadow-sm cursor-pointer",children:[(0,n.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:"Replay Session"})]}),(0,n.jsxs)("button",{onClick:()=>T("chat"),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-200 hover:text-white font-medium text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,n.jsx)(c.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,n.jsx)("span",{children:"View Live Chat (Pin to Sidebar)"})]}),(0,n.jsxs)("button",{onClick:()=>(0,eP.f)(e.connectionId||e.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 hover:text-white text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,n.jsx)(d.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,n.jsx)("span",{children:"Open in Detached Window"})]}),(0,n.jsxs)("button",{onClick:()=>{e?.connectionId&&(navigator.clipboard?.writeText(e.connectionId),k(!0),setTimeout(()=>k(!1),2e3))},className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[j?(0,n.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:j?"Connection ID Copied!":"Copy Connection ID"})]})]})]}):(0,n.jsxs)("div",{className:"py-12 text-center text-slate-500 space-y-3",children:[(0,n.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center mx-auto text-slate-600",children:(0,n.jsx)(t$.f,{className:"w-5 h-5"})}),(0,n.jsxs)("div",{className:"space-y-1 px-4",children:[(0,n.jsx)("h4",{className:"font-bold text-slate-400 text-xs",children:"No Agent Selected"}),(0,n.jsx)("p",{className:"text-[11px] leading-relaxed",children:"Click any workstation on the virtual office or select from the Explorer list to inspect telemetry and details."})]})]})})})]})}let tU={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};tU.node;let tq=(0,eW.f)(tU);function tG({mode:e="live",connected:t=!0,live:r=!0,stats:s={},selectedAgent:l=null,soundEnabled:i=!1,isBottomOpen:o=!0,onToggleBottom:a}){return(0,n.jsxs)("footer",{"data-testid":"status-bar",className:"h-[22px] min-h-[22px] bg-[#181818] border-t border-[#2b2b2b] px-3 flex items-center justify-between text-[11px] text-[#cccccc] select-none shrink-0 z-30 font-sans",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 hover:text-white cursor-pointer transition-colors",children:[(0,n.jsx)("span",{className:`w-2 h-2 rounded-full ${t&&r?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-amber-400"}`}),(0,n.jsx)("span",{className:"font-medium text-[10px]",children:"live"===e?"WATCHER: LIVE":"MODE: DEMO MOCK"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 hover:text-white transition-colors",children:[(0,n.jsx)(tq,{className:"w-3 h-3 text-[#007acc]"}),(0,n.jsxs)("span",{children:[s?.agents||0," Desks"]})]}),s?.busy>0&&(0,n.jsxs)("div",{className:"flex items-center gap-1 text-emerald-400",children:[(0,n.jsx)(ts.f,{className:"w-3 h-3 animate-spin"}),(0,n.jsxs)("span",{children:[s.busy," Working"]})]})]}),(0,n.jsx)("div",{className:"hidden md:flex items-center gap-2 text-slate-400 text-[10px]",children:l?(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(tg.f,{className:"w-3 h-3 text-cyan-400"}),(0,n.jsx)("span",{className:"text-slate-200 font-semibold truncate max-w-[200px]",children:l.account||l.connectionId}),(0,n.jsxs)("span",{children:["(",l.model||"gemini-3.8-flash",")"]})]}):(0,n.jsx)("span",{children:"Ready · Real-time monitoring Antigravity CLI, App & Claude"})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 text-[10px]",children:[i?(0,n.jsx)(eD.f,{className:"w-3 h-3 text-emerald-400"}):(0,n.jsx)(eB,{className:"w-3 h-3 text-slate-500"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:i?"Audio On":"Muted"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 font-mono text-[10px]",children:[(0,n.jsx)("span",{children:"Tokens:"}),(0,n.jsx)("span",{className:"text-emerald-400 font-bold",children:s?.tokensLabel||"0k"})]}),(0,n.jsxs)("button",{type:"button",onClick:a,title:o?"Hide Terminal (Cmd+J)":"Show Terminal (Cmd+J)",className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${o?"bg-[#007acc]/20 text-[#4fc1ff]":"text-slate-400 hover:text-white hover:bg-[#252526]"}`,children:[(0,n.jsx)(tl.f,{className:"w-3 h-3"}),(0,n.jsx)("span",{className:"text-[10px] hidden sm:inline",children:"Terminal"})]})]})]})}var tY=e.i(13285);let tX={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};tX.node;let tK=(0,eW.f)(tX);function tZ({isOpen:e=!1,onClose:t,onOpenStore:r,onOpenThemeSettings:s,onOpenFontSettings:l,onToggleLeftSidebar:i,onToggleBottomPanel:o,onToggleRightSidebar:u,onToggleZenFullscreen:f,onOpenChatSidebar:x,onOpenFilesExplorer:p,onToggleSound:m,onToggleNotif:g,onRefresh:b,onSetMode:v,onSelectPreset:y,onOpenReports:w,onStartReplay:j}){let[k,N]=(0,a.useState)(""),S=(0,a.useRef)(null);if((0,a.useEffect)(()=>{e&&(setTimeout(()=>S.current?.focus(),50),N(""))},[e]),(0,a.useEffect)(()=>{let r=r=>{"Escape"===r.key&&e&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]),!e)return null;let C=[{id:"toggle-left",title:"View: Toggle Primary Side Bar",shortcut:"Cmd+B",icon:e1,action:()=>{i(),t()}},{id:"open-files-explorer",title:"File: Open Workspace Files Explorer (Code & Artifacts)",icon:tc,action:()=>{p?.(),t()}},{id:"toggle-bottom",title:"View: Toggle Bottom Panel (Terminal & Logs)",shortcut:"Cmd+J",icon:e5,action:()=>{o(),t()}},{id:"toggle-zen-fullscreen",title:"View: Toggle Virtual Office Chill Mode (Full Screen)",shortcut:"Shift+F",icon:e8.f,action:()=>{f?.(),t()}},{id:"toggle-right",title:"View: Toggle Secondary Side Bar (Live Chat & Inspector)",shortcut:"Cmd+Alt+B",icon:e4,action:()=>{u(),t()}},{id:"open-chat-sidebar",title:"Chat: Pin Live Chat to Sidebar",icon:c.f,action:()=>{x?.(),t()}},{id:"open-chat-new-window",title:"Chat: Move into New Window (Detached)",icon:d.f,action:()=>{(0,eP.f)(),t()}},{id:"preferences-theme",title:"Preferences: Color Theme (VS Code Themes)",icon:eJ.f,action:()=>{s?.(),t()}},{id:"preferences-fonts",title:"Preferences: Configure Fonts (UI & Monospace)",icon:tK,action:()=>{l?.(),t()}},{id:"open-reports",title:"Reports: Open Token Usage & Analytics Report",icon:eK.f,action:()=>{w?.(),t()}},{id:"open-store",title:"Store: Open Supporter Store & Character Customization (Buy Me a Coffee)",icon:eZ.f,action:()=>{r?.(),t()}},{id:"start-replay",title:"Time-Machine: Replay Session History",icon:h.f,action:()=>{j?.(),t()}},{id:"refresh-watchers",title:"Watcher: Force Refresh All Watchers & Brain Transcripts",shortcut:"Cmd+R",icon:eO.f,action:()=>{b(),t()}},{id:"live-mode",title:"Mode: Switch to Live Watchers (Realtime ~/.gemini & ~/.claude)",icon:eX,action:()=>{v("live"),t()}},{id:"mock-storm",title:"Preset: Run Storm Demo (30 Agents Stress Test)",icon:tY.f,action:()=>{v("mock"),y("storm"),t()}},{id:"mock-busy",title:"Preset: Run Busy Demo (8 Working Agents)",icon:tY.f,action:()=>{v("mock"),y("busy"),t()}},{id:"toggle-sound",title:"Audio: Toggle 8-bit Sound FX",icon:eD.f,action:()=>{m(),t()}},{id:"toggle-notif",title:"System: Toggle Desktop Notifications",icon:eU,action:()=>{g(),t()}}].filter(e=>e.title.toLowerCase().includes(k.toLowerCase()));return(0,n.jsx)("div",{onClick:t,className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-start justify-center pt-16 px-4",children:(0,n.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"w-full max-w-xl bg-[#252526] border border-[#3e3e42] rounded-lg shadow-2xl overflow-hidden flex flex-col max-h-[420px]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-[#1e1e1e] border-b border-[#333333]",children:[(0,n.jsx)(e$.f,{className:"w-4 h-4 text-slate-400 shrink-0"}),(0,n.jsx)("input",{ref:S,type:"text",value:k,onChange:e=>N(e.target.value),placeholder:"Type a command or search actions...",className:"w-full bg-transparent text-xs text-slate-100 outline-none placeholder:text-slate-500"}),(0,n.jsx)("kbd",{className:"text-[10px] bg-[#2a2d2e] border border-[#3e3e42] rounded px-1.5 py-0.5 text-slate-400",children:"Esc"})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2d2d2d] py-1",children:0===C.length?(0,n.jsx)("div",{className:"p-4 text-center text-xs text-slate-500 italic",children:"No matching commands found"}):C.map(e=>{let t=e.icon;return(0,n.jsxs)("div",{onClick:e.action,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-[#007acc] hover:text-white text-[#cccccc] text-xs transition-colors group",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,n.jsx)(t,{className:"w-4 h-4 text-slate-400 group-hover:text-white shrink-0"}),(0,n.jsx)("span",{className:"font-medium truncate text-[11px]",children:e.title})]}),e.shortcut&&(0,n.jsx)("kbd",{className:"font-mono text-[9px] bg-[#1e1e1e] group-hover:bg-[#0062a3] border border-[#3e3e42] group-hover:border-transparent px-1.5 py-0.5 rounded text-slate-400 group-hover:text-white shrink-0",children:e.shortcut})]},e.id)})})]})})}var tJ=e.i(93414),tQ=e.i(38268);let t0={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};t0.node;let t1=(0,eW.f)(t0);var t2=e.i(47760);let t5={extension:{type:t2.x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await e.A(86043)}},t3={extension:{type:t2.x.Environment,name:"webworker",priority:0},test:()=>"u">typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await e.A(62925)}};e.i(10463),e.i(99650),e.i(58035);var t4=e.i(95932);t2.H.add(t5,t3);var t8=e.i(27402),t6=e.i(2351);async function t7(e={}){return void 0!==l?l:l=await (async()=>{let t=t8.f.get().getNavigator().gpu;if(!t)return!1;try{let r=await t.requestAdapter(e);return await r.requestDevice(),!0}catch(e){return!1}})()}let t9=["webgl","webgpu","canvas"];async function re(t){let r,l=[];t.preference?Array.isArray(t.preference)?l=t.preference.slice():(l.push(t.preference),t9.forEach(e=>{e!==t.preference&&l.push(e)})):l=t9.slice();let i={};for(let o=0;o<l.length;o++){let n=l[o];if("webgpu"===n&&await t7()){let{WebGPURenderer:s}=await e.A(53088);r=s,i={...t,...t.webgpu};break}if("webgl"===n&&function(e){return void 0!==s?s:s=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??t6.f.defaultOptions.failIfMajorPerformanceCaveat};try{if(!t8.f.get().getWebGLRenderingContext())return!1;let e=t8.f.get().createCanvas().getContext("webgl",t),r=!!e?.getContextAttributes()?.stencil;if(e){let t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,r}catch(e){return!1}})()}(t.failIfMajorPerformanceCaveat??t6.f.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:s}=await e.A(99331);r=s,i={...t,...t.webgl};break}if("canvas"===n){let{CanvasRenderer:s}=await e.A(35640);r=s,i={...t,...t.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!r)throw Error("No available renderer for the current environment");let o=new r;return await o.init(i),o}var rt=e.i(50147),rr=e.i(81834),rs=e.i(49864);class rl{static init(e){Object.defineProperty(this,"resizeTo",{configurable:!0,set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let e,t;if(this._resizeTo){if(this._cancelResize(),this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:s}=this._resizeTo;e=r,t=s}this.renderer.resize(e,t),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}rl.extension=t2.x.Application;var ri=e.i(59750),ro=e.i(6972);class rn{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,ri.f.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?ro.f.shared:new ro.f,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}}rn.extension=t2.x.Application,t2.H.add(rl),t2.H.add(rn);let ra=class e{constructor(...e){this.stage=new rt.t,void 0!==e[0]&&(0,rs.K)(rs.e,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new rt.t),this.renderer=await re(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,rs.K)(rs.e,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(t=!1,r=!1){let s=e._plugins.slice(0);s.reverse(),s.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(t),this.renderer=null}};ra._plugins=[],t2.H.handleByList(t2.x.Application,ra._plugins),t2.H.add(rr.L);var rc=e.i(81541),rd=e.i(94425),rh=e.i(95627),ru=e.i(4864),rf=e.i(56857),rx=e.i(97377);class rp extends rx.f{constructor(e,t){let{text:r,resolution:s,style:l,anchor:i,width:o,height:n,roundPixels:a,...c}=e;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=r??"",this.style=l,this.resolution=s??null,this.allowChildren=!1,this._anchor=new rf.f({_onUpdate:()=>{this.onViewUpdate()}}),i&&(this.anchor=i),this.roundPixels=a??!1,void 0!==o&&(this.width=o),void 0!==n&&(this.height=n)}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=null===e,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){"object"==typeof e?(t=e.height??e.width,e=e.width):t??(t=e),void 0!==e&&this._setWidth(e,this.bounds.width),void 0!==t&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,r=this.bounds.height,s=-t*this.anchor.x,l=0;return!!(e.x>=s)&&!!(e.x<=s+t)&&(l=-r*this.anchor.y,!!(e.y>=l)&&!!(e.y<=l+r))||!1}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){this._style?.off("update",this.onViewUpdate,this),super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof e?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var rm=e.i(57471),rg=e.i(63646),rb=e.i(81735),rv=e.i(61411);let ry=null,rw=null;function rj(e,t,r){for(let s=0,l=4*r*t;s<t;++s,l+=4)if(0!==e[l+3])return!1;return!0}function rk(e,t,r,s,l){let i=4*t;for(let t=s,o=s*i+4*r;t<=l;++t,o+=i)if(0!==e[o+3])return!1;return!0}class rN{constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){let t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){let t=Array(e.length);for(let r=0;r<e.length;r++){let s=e[r];t[r]=[s,this.get(s)]}return t}evict(e=!1){if(e||this.size>0){let e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t=this.items[e];if(void 0!==t)return this.ttl>0&&t.expiry<=Date.now()?void this.delete(e):(this.moveToEnd(t),t.value)}has(e){return e in this.items}moveToEnd(e){this.last!==e&&(null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),e.prev=this.last,e.next=null,null!==this.last&&(this.last.next=e),this.last=e,null===this.first&&(this.first=e))}keys(){let e=Array(this.size),t=this.first,r=0;for(;null!==t;)e[r++]=t.key,t=t.next;return e}setWithEvicted(e,t,r=this.resetTtl){let s=null;if(this.has(e))this.set(e,t,!0,r);else{this.max>0&&this.size===this.max&&(s={...this.first},this.evict(!0));let r=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};1==++this.size?this.first=r:this.last.next=r,this.last=r}return s}set(e,t,r=!1,s=this.resetTtl){let l=this.items[e];return r||void 0!==l?(l.value=t,!1===r&&s&&(l.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(l)):(this.max>0&&this.size===this.max&&this.evict(!0),l=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=l:this.last.next=l,this.last=l),this}values(e=this.keys()){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=this.get(e[r]);return t}}function rS(e){return!!e.tagStyles&&Object.keys(e.tagStyles).length>0}function rC(e){return e.includes("<")}let rT=new Set([10,13]),r_=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),rM=new Set([45,8208,8211,8212,173]),rz=/(\r\n|\r|\n)/,rR=/(?:\r\n|\r|\n)/;function rI(e){return"string"==typeof e&&rT.has(e.charCodeAt(0))}function rL(e,t){return"string"==typeof e&&r_.has(e.charCodeAt(0))}function rE(e){return"normal"===e||"pre-line"===e}function rA(e){return"normal"===e}function rP(e){if("string"!=typeof e)return"";let t=e.length-1;for(;t>=0&&rL(e[t]);)t--;return t<e.length-1?e.slice(0,t+1):e}function rF(e){let t=[],r=[];if("string"!=typeof e)return t;for(let s=0;s<e.length;s++){let l=e[s],i=e[s+1];if(rL(l,i)||rI(l)){r.length>0&&(t.push(r.join("")),r.length=0),"\r"===l&&"\n"===i?(t.push("\r\n"),s++):t.push(l);continue}r.push(l),"string"==typeof l&&rM.has(l.charCodeAt(0))&&i&&!rL(i)&&!rI(i)&&(t.push(r.join("")),r.length=0)}return r.length>0&&t.push(r.join("")),t}function r$(e,t,r,s){let l=r(e),i=[];for(let r=0;r<l.length;r++){let o=l[r],n=o,a=1;for(;l[r+a];){let i=l[r+a];if(s(n,i,e,r,t))break;o+=i,n=i,a++}r+=a-1,i.push(o)}return i}let rO=/\r\n|\r|\n/g,rD={willReadFrequently:!0};function rW(e,t,r,s,l){let i=r[e];return"number"!=typeof i&&(i=l(e,t,s)+t,r[e]=i),i}let rV={willReadFrequently:!0},rB=class e{static get experimentalLetterSpacingSupported(){let t=e._experimentalLetterSpacingSupported;if(void 0===t){let r=t8.f.get().getCanvasRenderingContext2D().prototype;t=e._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return t}constructor(e,t,r,s,l,i,o,n,a,c){this.text=e,this.style=t,this.width=r,this.height=s,this.lines=l,this.lineWidths=i,this.lineHeight=o,this.maxLineWidth=n,this.fontProperties=a,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",r,s=e._canvas,l=r.wordWrap){let i=`${t}-${r.styleKey}-wordWrap-${l}`;if(e._measurementCache.has(i))return e._measurementCache.get(i);if(rS(r)&&rC(t)){let s=function(e,t,r,s,l,i,o,n,a){let c=function(e,t){let r=[],s=t.tagStyles;if(!rS(t)||!rC(e))return r.push({text:e,style:t}),r;let l=[t],i=[],o="",n=0;for(;n<e.length;){let t=e[n];if("<"===t){let d=e.indexOf(">",n);if(-1===d){o+=t,n++;continue}let h=e.indexOf("<",n+1);if(-1!==h&&h<d){o+=t,n++;continue}let u=e.slice(n+1,d);if(u.startsWith("/")){let t=u.slice(1).trim();if(i.length>0&&i[i.length-1]===t){o.length>0&&(r.push({text:o,style:l[l.length-1]}),o=""),l.pop(),i.pop(),n=d+1;continue}o+=e.slice(n,d+1),n=d+1;continue}{let t=u.trim();if(s[t]){var a,c;o.length>0&&(r.push({text:o,style:l[l.length-1]}),o="");let e=(a=l[l.length-1],c=s[t],a.clone().assign(c));l.push(e),i.push(t),n=d+1;continue}o+=e.slice(n,d+1),n=d+1;continue}}o+=t,n++}return o.length>0&&r.push({text:o,style:l[l.length-1]}),r}(e,t);if(rA(t.whiteSpace))for(let e=0;e<c.length;e++){let t=c[e];c[e]={text:t.text.replace(rO," "),style:t.style}}let d=[],h=[];for(let e of c){let t=e.text.split(rz);for(let r=0;r<t.length;r++){let s=t[r];"\r\n"===s||"\r"===s||"\n"===s?(d.push(h),h=[]):s.length>0&&h.push({text:s,style:e.style})}}(h.length>0||0===d.length)&&d.push(h);let u=r?function(e,t,r,s,l,i){let{letterSpacing:o,whiteSpace:n,wordWrapWidth:a,breakWords:c}=t,d=rE(n),h=a+o,u={},f="",x=(e,t)=>{let l=`${e}|${t.styleKey}`,i=u[l];if(void 0===i){let o=t._fontString;o!==f&&(r.font=o,f=o),i=s(e,t.letterSpacing,r)+t.letterSpacing,u[l]=i}return i},p=[];for(let t of e){let e=function(e){let t=[],r=!1;for(let s of e){let e=rF(s.text),l=!0;for(let i of e){let e=rL(i)||rI(i),o=l&&r&&!e;t.push({token:i,style:s.style,continuesFromPrevious:o}),r=!e,l=!1}}return t}(t),r=p.length,s=t=>{let r=0,s=t;do{let{token:t,style:l}=e[s];r+=x(t,l),s++}while(s<e.length&&e[s].continuesFromPrevious)return r},o=t=>{let r=[],s=t;do r.push({token:e[s].token,style:e[s].style}),s++;while(s<e.length&&e[s].continuesFromPrevious)return r},n=[],a=0,u=!d,f=null,m=()=>{f&&f.text.length>0&&n.push(f),f=null},g=()=>{if(m(),n.length>0){let e=n[n.length-1];e.text=rP(e.text),0===e.text.length&&n.pop()}p.push(n),n=[],a=0,u=!1};for(let t=0;t<e.length;t++){let{token:r,style:b,continuesFromPrevious:v}=e[t],y=x(r,b);if(d){let e=rL(r),t=f?.text[f.text.length-1]??n[n.length-1]?.text.slice(-1)??"",s=!!t&&rL(t);if(e&&s)continue}let w=!v,j=w?s(t):y;if(j>h&&w)if(a>0&&g(),c){let e=o(t);for(let t=0;t<e.length;t++){let r=e[t].token,s=e[t].style;for(let e of r$(r,c,i,l)){let t=x(e,s);t+a>h&&g(),f&&f.style===s?f.text+=e:(m(),f={text:e,style:s}),a+=t}}t+=e.length-1}else{let e=o(t);m(),p.push(e.map(e=>({text:e.token,style:e.style}))),u=!1,t+=e.length-1}else if(j+a>h&&w){if(rL(r)){u=!1;continue}g(),f={text:r,style:b},a=y}else if(v&&!c)f&&f.style===b?f.text+=r:(m(),f={text:r,style:b}),a+=y;else{let e=rL(r);if(0===a&&e&&!u)continue;f&&f.style===b?f.text+=r:(m(),f={text:r,style:b}),a+=y}}if(m(),n.length>0){let e=n[n.length-1];e.text=rP(e.text),0===e.text.length&&n.pop()}(n.length>0||p.length===r)&&p.push(n)}return p}(d,t,s,i,n,a):d,f=[],x=[],p=[],m=[],g=[],b=0,v=o(t._fontString);0===v.fontSize&&(v.fontSize=t.fontSize,v.ascent=t.fontSize);let y="",w=!!t.dropShadow,j=t._stroke?.width||0;for(let e of u){let r=0,i=v.ascent,n=v.descent,a="";for(let t of e){let e=t.style._fontString,c=o(e);e!==y&&(s.font=e,y=e),r+=l(t.text,t.style.letterSpacing,s),i=Math.max(i,c.ascent),n=Math.max(n,c.descent),a+=t.text;let d=t.style._stroke?.width||0;d>j&&(j=d),!w&&t.style.dropShadow&&(w=!0)}0===e.length&&(i=v.ascent,n=v.descent),f.push(r),x.push(i),p.push(n),g.push(a);let c=t.lineHeight||i+n;m.push(c+t.leading),b=Math.max(b,r)}let k=j,N=b+k+(t.dropShadow?t.dropShadow.distance:0),S=0;for(let e=0;e<m.length;e++)S+=m[e];return{width:N,height:(S=Math.max(S,m[0]+k))+(t.dropShadow?t.dropShadow.distance:0),lines:g,lineWidths:f,lineHeight:(t.lineHeight||v.fontSize)+t.leading,maxLineWidth:b,fontProperties:v,runsByLine:u,lineAscents:x,lineDescents:p,lineHeights:m,hasDropShadow:w}}(t,r,l,e._context,e._measureText,e._measureTextAdvance,e.measureFont,e.canBreakChars,e.wordWrapSplit),o=new e(t,r,s.width,s.height,s.lines,s.lineWidths,s.lineHeight,s.maxLineWidth,s.fontProperties,{runsByLine:s.runsByLine,lineAscents:s.lineAscents,lineDescents:s.lineDescents,lineHeights:s.lineHeights,hasDropShadow:s.hasDropShadow});return e._measurementCache.set(i,o),o}let o=r._fontString,n=e.measureFont(o);0===n.fontSize&&(n.fontSize=r.fontSize,n.ascent=r.fontSize,n.descent=0);let a=e._context;a.font=o;let c=(l?e._wordWrap(t,r,s):t).split(rR),d=Array(c.length),h=0;for(let t=0;t<c.length;t++){let s=e._measureText(c[t],r.letterSpacing,a);d[t]=s,h=Math.max(h,s)}let u=r._stroke?.width??0,f=r.lineHeight||n.fontSize,x=e._adjustWidthForStyle(h,r),p=Math.max(f,n.fontSize+u)+(c.length-1)*(f+r.leading),m=e._adjustHeightForStyle(p,r),g=new e(t,r,x,m,c,d,f+r.leading,h,n);return e._measurementCache.set(i,g),g}static _adjustWidthForStyle(e,t){let r=e+(t._stroke?.width||0);return t.dropShadow&&(r+=t.dropShadow.distance),r}static _adjustHeightForStyle(e,t){let r=e;return t.dropShadow&&(r+=t.dropShadow.distance),r}static _measureText(t,r,s){let{metricWidth:l,metrics:i,letterSpacingVal:o}=e._measureTextCore(t,r,s),n=-(i.actualBoundingBoxLeft??0),a=(i.actualBoundingBoxRight??0)-n;return i.width>0&&(a+=o),Math.max(l,a)}static _measureTextAdvance(t,r,s){return e._measureTextCore(t,r,s).metricWidth}static _measureTextCore(t,r,s){let l=!1;e.experimentalLetterSpacingSupported&&(e.experimentalLetterSpacing?(s.letterSpacing=`${r}px`,s.textLetterSpacing=`${r}px`,l=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let i=s.measureText(t),o=i.width,n=0;return o>0&&(o+=n=l?-r:(e.graphemeSegmenter(t).length-1)*r),{metricWidth:o,metrics:i,letterSpacingVal:n}}static _wordWrap(t,r,s=e._canvas){return function(e,t,r,s,l,i,o){let n=r.getContext("2d",rD);n.font=t._fontString;let a=0,c="",d=[],h=Object.create(null),{letterSpacing:u,whiteSpace:f}=t,x=rE(f),p=rA(f),m=!x,g=t.wordWrapWidth+u,b=rF(e);for(let e=0;e<b.length;e++){let r=b[e];if(rI(r)){if(!p){d.push(rP(c)),m=!x,c="",a=0;continue}r=" "}if(x){let e=rL(r),t=rL(c[c.length-1]);if(e&&t)continue}let f=rW(r,u,h,n,s);if(f>g)if(""!==c&&(d.push(rP(c)),c="",a=0),l(r,t.breakWords))for(let e of r$(r,t.breakWords,o,i)){let t=rW(e,u,h,n,s);t+a>g&&(d.push(rP(c)),m=!1,c="",a=0),c+=e,a+=t}else c.length>0&&(d.push(rP(c)),c="",a=0),d.push(rP(r)),m=!1,c="",a=0;else f+a>g&&(m=!1,d.push(rP(c)),c="",a=0),(c.length>0||!rL(r)||m)&&(c+=r,a+=f)}let v=rP(c);return v.length>0&&d.push(v),d.join("\n")}(t,r,s,e._measureTextAdvance,e.canBreakWords,e.canBreakChars,e.wordWrapSplit)}static isBreakingSpace(e,t){return rL(e,t)}static canBreakWords(e,t){return t}static canBreakChars(e,t,r,s,l){return!0}static wordWrapSplit(t){return e.graphemeSegmenter(t)}static measureFont(t){if(e._fonts[t])return e._fonts[t];let r=e._context;r.font=t;let s=r.measureText(e.METRICS_STRING+e.BASELINE_SYMBOL),l=s.actualBoundingBoxAscent??0,i=s.actualBoundingBoxDescent??0,o={ascent:l,descent:i,fontSize:l+i};return e._fonts[t]=o,o}static clearMetrics(t=""){t?delete e._fonts[t]:e._fonts={}}static get _canvas(){if(!e.__canvas){let t;try{let r=new OffscreenCanvas(0,0),s=r.getContext("2d",rV);if(s?.measureText)return e.__canvas=r,r;t=t8.f.get().createCanvas()}catch(e){t=t8.f.get().createCanvas()}t.width=t.height=10,e.__canvas=t}return e.__canvas}static get _context(){return e.__context||(e.__context=e._canvas.getContext("2d",rV)),e.__context}};rB.METRICS_STRING="|ÉqÅ",rB.BASELINE_SYMBOL="M",rB.BASELINE_MULTIPLIER=1.4,rB.HEIGHT_MULTIPLIER=2,rB.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let e=new Intl.Segmenter;return t=>{let r=e.segment(t),s=[],l=0;for(let e of r)s[l++]=e.segment;return s}}return e=>[...e]})(),rB.experimentalLetterSpacing=!1,rB._fonts={},rB._measurementCache=function(e=1e3,t=0,r=!1){if(isNaN(e)||e<0)throw TypeError("Invalid max value");if(isNaN(t)||t<0)throw TypeError("Invalid ttl value");if("boolean"!=typeof r)throw TypeError("Invalid resetTtl value");return new rN(e,t,r)}(1e3);let rH=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function rU(e){let t="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize,r=e.fontFamily;Array.isArray(e.fontFamily)||(r=e.fontFamily.split(","));for(let e=r.length-1;e>=0;e--){let t=r[e].trim();/([\"\'])[^\'\"]+\1/.test(t)||rH.includes(t)||(t=`"${t}"`),r[e]=t}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${r.join(",")}`}var rq=e.i(28959),rG=e.i(61805),rY=e.i(31320),rX=e.i(85830),rK=e.i(37836);function rZ(e,t,r,s=0,l=0,i=0){if(e.texture===rY.f.WHITE&&!e.fill)return rm.f.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof rK.f){let r=e.fill,s=t.createPattern(r.texture.source.resource,"repeat");return rG.f.applyPatternTransform(s,r.transform,!1),s}else if(e.fill instanceof rc.f){let o,n=e.fill,a="linear"===n.type,c="local"===n.textureSpace,d=1,h=1;c&&r&&(d=r.width+s,h=r.height+s);let u=!1;if(a){let{start:e,end:r}=n;o=t.createLinearGradient(e.x*d+l,e.y*h+i,r.x*d+l,r.y*h+i),u=Math.abs(r.x-e.x)<Math.abs((r.y-e.y)*.1)}else{let{center:e,innerRadius:r,outerCenter:s,outerRadius:a}=n;o=t.createRadialGradient(e.x*d+l,e.y*h+i,r*d,s.x*d+l,s.y*h+i,a*d)}if(u&&c&&r){let e=r.lineHeight/h;for(let t=0;t<r.lines.length;t++){let l=(t*r.lineHeight+s/2)/h;n.colorStops.forEach(t=>{let r=l+t.offset*e;r=Math.max(0,Math.min(1,r)),o.addColorStop(Math.floor(1e5*r)/1e5,rm.f.shared.setValue(t.color).toHex())})}}else n.colorStops.forEach(e=>{o.addColorStop(e.offset,rm.f.shared.setValue(e.color).toHex())});return o}}else{let r=t.createPattern(e.texture.source.resource,"repeat"),s=e.matrix.copyTo(rq.f.shared);return s.scale(e.texture.source.pixelWidth,e.texture.source.pixelHeight),r.setTransform(s),r}return(0,rX.f)("FillStyle not recognised",e),"red"}let rJ=new rg.f;function rQ(e){let t=0;for(let r=0;r<e.length;r++)32===e.charCodeAt(r)&&t++;return t}let r0=new class{getCanvasAndContext(e){let{text:t,style:r,resolution:s=1}=e,l=r._getFinalPadding(),i=rB.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,i.width)+2*l)*s),n=Math.ceil(Math.ceil(Math.max(1,i.height)+2*l)*s),a=rb.f.getOptimalCanvasAndContext(o,n);this._renderTextToCanvas(r,l,s,a,i);let c=r.trim?function(...e){let t=e[0];t.canvas||(t={canvas:e[0],resolution:e[1]});let{canvas:r}=t,s=Math.min(t.resolution??1,1),l=t.width??r.width,i=t.height??r.height,o=t.output;if(ry||((rw=(ry=t8.f.get().createCanvas(256,128)).getContext("2d",{willReadFrequently:!0})).globalCompositeOperation="copy",rw.globalAlpha=1),(ry.width<l||ry.height<i)&&(ry.width=(0,rv.a)(l),ry.height=(0,rv.a)(i)),!rw)throw TypeError("Failed to get canvas 2D context");rw.drawImage(r,0,0,l,i,0,0,l*s,i*s);let n=rw.getImageData(0,0,l,i).data,a=0,c=0,d=l-1,h=i-1;for(;c<i&&rj(n,l,c);)++c;if(c===i)return rg.f.EMPTY;for(;rj(n,l,h);)--h;for(;rk(n,l,a,c,h);)++a;for(;rk(n,l,d,c,h);)--d;return++d,++h,rw.globalCompositeOperation="source-over",rw.strokeRect(a,c,d-a,h-c),rw.globalCompositeOperation="copy",o??(o=new rg.f),o.set(a/s,c/s,(d-a)/s,(h-c)/s),o}({canvas:a.canvas,width:o,height:n,resolution:1,output:rJ}):rJ.set(0,0,o,n);return{canvasAndContext:a,frame:c}}returnCanvasAndContext(e){rb.f.returnCanvasAndContext(e)}_renderTextToCanvas(e,t,r,s,l){let i,o;if(l.runsByLine&&l.runsByLine.length>0)return void this._renderTaggedTextToCanvas(l,e,t,r,s);let{canvas:n,context:a}=s,c=rU(e),d=l.lines,h=l.lineHeight,u=l.lineWidths,f=l.maxLineWidth,x=l.fontProperties,p=n.height;if(a.resetTransform(),a.scale(r,r),a.textBaseline=e.textBaseline,e._stroke?.width){let t=e._stroke;a.lineWidth=t.width,a.miterLimit=t.miterLimit,a.lineJoin=t.join,a.lineCap=t.cap}a.font=c;let m=e.dropShadow?2:1,g=(e._stroke?.width??0)/2,b=(h-x.fontSize)/2;h-x.fontSize<0&&(b=0);for(let n=0;n<m;++n){let c=e.dropShadow&&0===n,m=c?Math.ceil(Math.max(1,p)+2*t):0,v=m*r;if(c)this._setupDropShadow(a,e,r,v);else{let r=e._gradientBounds,s=e._gradientOffset;if(r){let i={width:r.width,height:r.height,lineHeight:r.height,lines:l.lines};this._setFillAndStrokeStyles(a,e,i,t,g,s?.x??0,s?.y??0)}else s?this._setFillAndStrokeStyles(a,e,l,t,g,s.x,s.y):this._setFillAndStrokeStyles(a,e,l,t,g);a.shadowColor="rgba(0,0,0,0)"}for(let r=0;r<d.length;r++){i=g,o=g+r*h+x.ascent+b,i+=this._getAlignmentOffset(u[r],f,e.align);let l=0;if("justify"===e.align&&e.wordWrap&&r<d.length-1){let e=rQ(d[r]);e>0&&(l=(f-u[r])/e)}e._stroke?.width&&this._drawLetterSpacing(d[r],e,s,i+t,o+t-m,!0,l),void 0!==e._fill&&this._drawLetterSpacing(d[r],e,s,i+t,o+t-m,!1,l)}}}_renderTaggedTextToCanvas(e,t,r,s,l){let{canvas:i,context:o}=l,{runsByLine:n,lineWidths:a,maxLineWidth:c,lineAscents:d,lineHeights:h,hasDropShadow:u}=e,f=i.height;o.resetTransform(),o.scale(s,s),o.textBaseline=t.textBaseline;let x=u?2:1,p=t._stroke?.width??0;for(let e of n)for(let t of e){let e=t.style._stroke?.width??0;e>p&&(p=e)}let m=p/2,g=[];for(let e=0;e<n.length;e++){let t=n[e],r=[];for(let e of t){let t=rU(e.style);o.font=t,r.push({width:rB._measureText(e.text,e.style.letterSpacing,o),font:t})}g.push(r)}for(let e=0;e<x;++e){let i=u&&0===e,x=i?Math.ceil(Math.max(1,f)+2*r):0,p=x*s;i||(o.shadowColor="rgba(0,0,0,0)");let b=m;for(let e=0;e<n.length;e++){let u=n[e],f=a[e],v=d[e],y=h[e],w=g[e],j=m;j+=this._getAlignmentOffset(f,c,t.align);let k=0;if("justify"===t.align&&t.wordWrap&&e<n.length-1){let e=0;for(let t of u)e+=rQ(t.text);e>0&&(k=(c-f)/e)}let N=b+v,S=j+r;for(let e=0;e<u.length;e++){let t=u[e],{width:n,font:a}=w[e];if(o.font=a,o.textBaseline=t.style.textBaseline,t.style._stroke?.width){let e=t.style._stroke;if(o.lineWidth=e.width,o.miterLimit=e.miterLimit,o.lineJoin=e.join,o.lineCap=e.cap,i)if(t.style.dropShadow)this._setupDropShadow(o,t.style,s,p);else{S+=n+rQ(t.text)*k;continue}else{let s=rB.measureFont(a),l=t.style.lineHeight||s.fontSize;o.strokeStyle=rZ(e,o,{width:n,height:l,lineHeight:l,lines:[t.text]},2*r,S-r,b)}this._drawLetterSpacing(t.text,t.style,l,S,N+r-x,!0,k)}S+=n+rQ(t.text)*k}S=j+r;for(let e=0;e<u.length;e++){let t=u[e],{width:n,font:a}=w[e];if(o.font=a,o.textBaseline=t.style.textBaseline,void 0!==t.style._fill){if(i)if(t.style.dropShadow)this._setupDropShadow(o,t.style,s,p);else{S+=n+rQ(t.text)*k;continue}else{let e=rB.measureFont(a),s=t.style.lineHeight||e.fontSize,l={width:n,height:s,lineHeight:s,lines:[t.text]};o.fillStyle=rZ(t.style._fill,o,l,2*r,S-r,b)}this._drawLetterSpacing(t.text,t.style,l,S,N+r-x,!1,k)}S+=n+rQ(t.text)*k}b+=y}}}_setFillAndStrokeStyles(e,t,r,s,l,i=0,o=0){e.fillStyle=t._fill?rZ(t._fill,e,r,2*s,i,o):null,t._stroke?.width&&(e.strokeStyle=rZ(t._stroke,e,r,l+2*s,i,o))}_setupDropShadow(e,t,r,s){e.fillStyle="black",e.strokeStyle="black";let l=t.dropShadow,i=l.color,o=l.alpha;e.shadowColor=rm.f.shared.setValue(i).setAlpha(o).toRgbaString();let n=l.blur*r,a=l.distance*r;e.shadowBlur=n,e.shadowOffsetX=Math.cos(l.angle)*a,e.shadowOffsetY=Math.sin(l.angle)*a+s}_getAlignmentOffset(e,t,r){return"right"===r?t-e:"center"===r?(t-e)/2:0}_drawLetterSpacing(e,t,r,s,l,i=!1,o=0){let{context:n}=r,a=t.letterSpacing,c=!1;if(rB.experimentalLetterSpacingSupported&&(rB.experimentalLetterSpacing?(n.letterSpacing=`${a}px`,n.textLetterSpacing=`${a}px`,c=!0):(n.letterSpacing="0px",n.textLetterSpacing="0px")),(0===a||c)&&0===o)return void(i?n.strokeText(e,s,l):n.fillText(e,s,l));if(0!==o&&(0===a||c)){let t=e.split(" "),r=s,a=n.measureText(" ").width;for(let e=0;e<t.length;e++)i?n.strokeText(t[e],r,l):n.fillText(t[e],r,l),r+=n.measureText(t[e]).width+a+o;return}let d=s,h=rB.graphemeSegmenter(e),u=n.measureText(e).width,f=0;for(let e=0;e<h.length;++e){let t=h[e];i?n.strokeText(t,d,l):n.fillText(t,d,l);let r="";for(let t=e+1;t<h.length;++t)r+=h[t];d+=u-(f=n.measureText(r).width)+a," "===t&&(d+=o),u=f}}};var r1=t4,r2=e.i(24314),r5=e.i(20446),r3=e.i(86230);let r4=class e extends r1.f{constructor(t={}){super(),this.uid=(0,r2.f)("textStyle"),this._tick=0,this._cachedFontString=null,function(e){if("boolean"==typeof e.dropShadow&&e.dropShadow){let t=r4.defaultDropShadow;e.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(void 0!==e.strokeThickness){(0,rs.K)(rs.e,"strokeThickness is now a part of stroke");let t=e.stroke,r={};if(rm.f.isColorLike(t))r.color=t;else if(t instanceof rc.f||t instanceof rK.f)r.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))r=t;else throw Error("Invalid stroke value.");e.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,rs.K)(rs.e,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,rX.f)("The number of fill colors must match the number of fill gradient stops.");let t=new rc.f({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=e.fillGradientStops.slice(),s=e.fill.map(e=>rm.f.shared.setValue(e).toNumber());r.forEach((e,r)=>{t.addColorStop(e,s[r])}),e.fill={fill:t}}}(t);let r=t instanceof e,s=t;r&&(t=s._toObject());let l={...e.defaultTextStyle,...t};for(let e in l)this[e]=l[e];this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.update())}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(null!==t&&"object"==typeof t?this._dropShadow=this._createProxy({...e.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...e.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.update())}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&("string"==typeof e?this._fontSize=parseInt(e,10):this._fontSize=e,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.update())}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.update())}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.update())}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=Object.freeze(e),this.update())}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.update())}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...r5.f.defaultFillStyle,...e},()=>{this._fill=(0,r3._)({...this._originalFill},r5.f.defaultFillStyle)})),this._fill=(0,r3._)(0===e?"black":e,r5.f.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...r5.f.defaultStrokeStyle,...e},()=>{this._stroke=(0,r3.U)({...this._originalStroke},r5.f.defaultStrokeStyle)})),this._stroke=(0,r3.U)(e,r5.f.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(e){this._tagStyles!==e&&(this._tagStyles=e??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let t=e.defaultTextStyle;for(let e in t)this[e]=t[e]}assign(e){for(let t in e)this[t]=e[t];return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=rU(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new e(this._toObject())}_getFinalPadding(){let e=0;if(this._filters)for(let t=0;t<this._filters.length;t++)e+=this._filters[t].padding;return Math.max(this._padding,e)}destroy(e=!1){if(this.removeAllListeners(),"boolean"==typeof e?e:e?.texture){let t="boolean"==typeof e?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(t),this._originalFill?.texture&&this._originalFill.texture.destroy(t),this._stroke?.texture&&this._stroke.texture.destroy(t),this._originalStroke?.texture&&this._originalStroke.texture.destroy(t)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(e,r,s)=>e[r]===s||(e[r]=s,t?.(r,s),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(rm.f.isColorLike(e)||e instanceof rc.f||e instanceof rK.f)}};r4.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},r4.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let r8=!1;var r6=e.i(33219),r7=e.i(81481),r9=e.i(40766);class se extends r9.f{}class st{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),e.runners.contextChange.add(this),this._managedTexts=new r6.f({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let e in this._managedTexts.items){let t=this._managedTexts.items[e];t?._autoResolution&&t.onViewUpdate()}}contextChange(){for(let e in this._managedTexts.items)this._managedTexts.items[e]?.unload()}validateRenderable(e){let t=this._getGpuText(e),r=e.styleKey;return t.currentKey!==r||e._didTextUpdate}addRenderable(e,t){let r=this._getGpuText(e);if(e._didTextUpdate||r.currentKey!==e.styleKey){let t=e._autoResolution?this._renderer.resolution:e.resolution;(r.currentKey!==e.styleKey||e._resolution!==t)&&this._updateGpuText(e),e._didTextUpdate=!1,function(e,t){let{texture:r,bounds:s}=e,l=t._style._getFinalPadding();(0,r7.f)(s,t._anchor,r);let i=t._anchor._x*l*2,o=t._anchor._y*l*2;s.minX-=l-i,s.minY-=l-o,s.maxX-=l-i,s.maxY-=l-o}(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._getGpuText(e);t._batcher.updateElement(t)}_updateGpuText(e){let t=this._getGpuText(e);t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,t.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e.styleKey}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){let t=new se;return t.currentKey="--",t.renderable=e,t.transform=e.groupTransform,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){let t=e._gpuData[this._renderer.uid];if(!t)return;let{canvasText:r}=this._renderer;r.getReferenceCount(t.currentKey)>0?r.decreaseReferenceCount(t.currentKey):t.texture&&r.returnTexture(t.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}st.extension={type:[t2.x.WebGLPipes,t2.x.WebGPUPipes,t2.x.CanvasPipes],name:"text"};var sr=e.i(41163),ss=e.i(70298);class sl{constructor(e,t){this._activeTextures={},this._renderer=e,this._retainCanvasContext=t}getTexture(e,t,r,s){"string"==typeof e&&((0,rs.K)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:r,resolution:t}),e.style instanceof r4||(e.style=new r4(e.style)),"string"!=typeof e.text&&(e.text=e.text.toString());let{text:l,style:i,textureStyle:o,autoGenerateMipmaps:n}=e,a=e.resolution??this._renderer.resolution,{frame:c,canvasAndContext:d}=r0.getCanvasAndContext({text:l,style:i,resolution:a}),h=(0,ss.f)(d.canvas,c.width,c.height,a,n,o?.scaleMode);if(i.trim&&(c.pad(i.padding),h.frame.copyFrom(c),h.frame.scale(1/a),h.updateUvs()),i.filters){let e=this._applyFilters(h,i.filters);return this.returnTexture(h),r0.returnCanvasAndContext(d),e}return this._renderer.texture.initSource(h._source),this._retainCanvasContext||r0.returnCanvasAndContext(d),h}returnTexture(e){let t=e.source,r=t.resource;if(this._retainCanvasContext&&r?.getContext){let e=r.getContext("2d");e&&r0.returnCanvasAndContext({canvas:r,context:e})}t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",sr.f.returnTexture(e)}renderTextToCanvas(){(0,rs.K)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let r=this.getTexture({text:e.text,style:e.style,resolution:e._resolution,textureStyle:e.textureStyle,autoGenerateMipmaps:e.autoGenerateMipmaps});return this._activeTextures[t]={texture:r,usageCount:1},r}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,0===t.usageCount&&(this.returnTexture(t.texture),this._activeTextures[e]=null))}getReferenceCount(e){return this._activeTextures[e]?.usageCount??0}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}_applyFilters(e,t){let r=this._renderer.renderTarget.renderTarget,s=this._renderer.filter.generateFilteredTexture({texture:e,filters:t});return this._renderer.renderTarget.bind({target:r,clear:!1}),s}destroy(){for(let e in this._renderer=null,this._activeTextures)this._activeTextures[e]&&this.returnTexture(this._activeTextures[e].texture);this._activeTextures=null}}class si extends sl{constructor(e){super(e,!0)}}si.extension={type:[t2.x.CanvasSystem],name:"canvasText"};class so extends sl{constructor(e){super(e,!1)}}so.extension={type:[t2.x.WebGLSystem,t2.x.WebGPUSystem],name:"canvasText"},t2.H.add(si),t2.H.add(so),t2.H.add(st);class sn extends rp{constructor(...e){let t,r=(("string"==typeof(t=e[0]??{})||e[1])&&((0,rs.K)(rs.e,'use new Text({ text: "hi!", style }) instead'),t={text:t,style:e[1]}),t);super(r,r4),this.renderPipeId="text",r.textureStyle&&(this.textureStyle=r.textureStyle instanceof ru.f?r.textureStyle:new ru.f(r.textureStyle),function(e){if(r8)return;let t=new ru.f({scaleMode:e.scaleMode});e._resourceId!==t._resourceId&&(r8=!0,(0,rX.f)("Text textureStyle: only scaleMode is applied to a text texture, the other fields are ignored"))}(this.textureStyle)),this.autoGenerateMipmaps=r.autoGenerateMipmaps??rh.f.defaultOptions.autoGenerateMipmaps}updateBounds(){let e=this._bounds,t=this._anchor,r=0,s=0;if(this._style.trim){let{frame:e,canvasAndContext:t}=r0.getCanvasAndContext({text:this.text,style:this._style,resolution:1});r0.returnCanvasAndContext(t),r=e.width,s=e.height}else{let e=rB.measureText(this._text,this._style);r=e.width,s=e.height}e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*s,e.maxY=e.minY+s}}let sa={pending:0xf59e0b,streaming:2282478,done:3462041,error:0xef4444};function sc(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):"0"}function sd(e=[]){let t=new Map;for(let r of e){if(!r?.connectionId)continue;let e=t.get(r.connectionId);if(!e){let s=String(r.connectionId||"").toLowerCase(),l=r.clientType||("app"===r.source||s.includes("app")?"app":"extension"===r.source||s.includes("extension")||"ide"===r.source||s.includes("ide")?"extension":"cli");e={connectionId:r.connectionId,account:r.account||r.connectionId,model:r.model,provider:r.provider,cli:r.cli||"agent",clientType:l,source:r.source||l,clientIcon:r.clientIcon,traces:[],tokens:{input:0,output:0,cached:0},totalTokens:null,activeCount:0,errorCount:0,tools:[],errorReason:null,fallbackFrom:null,queued:0,elapsedMs:0,cost:null,pendingCount:0,isLooping:!1,logs:[],skin:r.skin||null,aura:r.aura||null,pet:r.pet||null,props:r.props||[],trophy:r.trophy||null,theme:r.theme||null,sessionTitle:r.sessionTitle||r.account||"agent-factory",lastText:null,lastTextRole:null},t.set(r.connectionId,e)}for(let t of(e.traces.push(r),r.skin&&!e.skin&&(e.skin=r.skin),r.aura&&!e.aura&&(e.aura=r.aura),r.pet&&!e.pet&&(e.pet=r.pet),!r.props?.length||e.props&&e.props.length||(e.props=r.props),r.trophy&&!e.trophy&&(e.trophy=r.trophy),r.theme&&!e.theme&&(e.theme=r.theme),r.isLooping&&(e.isLooping=!0),Array.isArray(r.logs)&&r.logs.length>0&&(e.logs=r.logs),r.currentCommand&&!e.currentCommand&&(e.currentCommand=r.currentCommand),r.sessionTitle&&(e.sessionTitle=r.sessionTitle),r.lastText&&(e.lastText=r.lastText,e.lastTextRole=r.lastTextRole),r.toolCalls||[])){let r=t.tool||t.type;r&&!e.tools.includes(r)&&e.tools.push(r)}e.tokens.input+=r.tokens?.input??0,e.tokens.output+=r.tokens?.output??0,e.tokens.cached+=r.tokens?.cached??0,Number.isFinite(r.totalTokens)&&(e.totalTokens=(e.totalTokens??0)+r.totalTokens),e.queued+=Math.max(1,r.concurrent||1),e.elapsedMs=Math.max(e.elapsedMs,r.elapsedMs??0),Number.isFinite(r.cost)&&(e.cost=(e.cost??0)+r.cost),r.fallback?.from&&!e.fallbackFrom&&(e.fallbackFrom=r.fallback.from),"error"===r.state?(e.errorCount+=1,e.errorReason=e.errorReason||r.error||"error"):("streaming"===r.state||"pending"===r.state)&&(e.activeCount+=1,"pending"===r.state&&(e.pendingCount+=1))}let r=t.size,s=r>35?8:r>18?7:6,l=r>35?175:200,i=r>35?145:170,o=Math.max(1500,60+s*l+120),n=o+360,a=[...t.values()].map((e,t)=>{let r=Math.floor(t/s),o=!!e.isLooping,n=e.errorCount>0?"error":e.activeCount>0?"streaming":"done",a=o?"looping":"error"===n?"error":"streaming"===n?e.pendingCount===e.activeCount?"pending":"streaming":e.elapsedMs>=32e3?"sleeping":"happy",c=e.totalTokens,d=c&&e.tokens.cached>0?Math.round(e.tokens.cached/c*100):null,h=e.account||"agent-factory",u=e.sessionTitle||h;return{...e,deskIndex:t,traceId:e.traces?.[0]?.traceId||e.connectionId,sessionTitle:u,occupied:!0,state:n,mode:a,isLooping:o,logs:e.logs,cachedPct:d,cost:Number.isFinite(e.cost)?Math.round(100*e.cost)/100:null,color:o?0xf43f5e:sa[n],totalTokens:c,totalLabel:null===c?"—":sc(c),count:e.traces.length,x:60+t%s*l,y:820-r*i,depth:1,busy:e.activeCount}}),c=[...new Set(a.map(e=>e.provider).filter(Boolean))],d=c.map((e,t)=>{let r=a.filter(t=>t.provider===e),s=r.reduce((e,t)=>e+t.busy,0),l=r.reduce((e,t)=>e+(t.totalTokens??0),0),i=r.some(e=>"error"===e.state);return{provider:e,x:n,y:480-(c.length-1)*104/2+104*t,busy:s,load:Math.min(1,s/4),overloaded:s>=4,totalTokens:l,totalLabel:sc(l),color:i?sa.error:s>0?sa.streaming:sa.done}}),h=new Set(c),u=new Map;for(let e of a){if(!e.fallbackFrom||!h.has(e.fallbackFrom)||e.fallbackFrom===e.provider)continue;let t=`${e.fallbackFrom}>${e.provider}`,r=u.get(t)||{from:e.fallbackFrom,to:e.provider,count:0};r.count+=1,u.set(t,r)}return{workstations:a,pods:d,fallbacks:[...u.values()],rack:{x:o,y:480,active:a.reduce((e,t)=>e+t.busy,0)},stats:{agents:a.length,busy:a.filter(e=>e.busy>0).length,tokens:a.reduce((e,t)=>e+(t.totalTokens??0),0),tokensLabel:sc(a.reduce((e,t)=>e+(t.totalTokens??0),0))}}}var sh=e.i(69096);function su(e,t=61695){if(!e)return t;if("number"==typeof e)return e;let r=parseInt(String(e).replace("#","").trim(),16);return Number.isNaN(r)?t:r}function sf(e,t){let r=String(e||"");return r.length>t?`${r.slice(0,t-1)}…`:r}let sx=()=>(0,sh.l)("mono"),sp=()=>(0,sh.l)("ui");function sm(...e){return new rc.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:e.map((t,r)=>({offset:r/(e.length-1),color:t})),textureSpace:"local"})}let sg=(e,t,r=1)=>({width:e,color:t,alpha:r,cap:"round",join:"round"});function sb({color:e,depth:t=1,scale:r=1,seed:s=0,trimColor:l,mode:i="streaming",clientType:o="cli",skin:n="classic",aura:a="none"}){let c=new rt.t,d="app"===o?9133302:1096065,h="string"==typeof n?(0,tT.x)(n):null,u=!!(h||n&&"classic"!==n&&"none"!==n),f=h?.archetype||("cat"===n?"cyber_cat":"ninja"===n?"stealth_ninja":"hacker"===n?"matrix_hacker":n||"cyber_classic"),x=h?.variant||"tactical_visor",p=h?.color?su(h.color,l??d):l??d;h?.secondaryColor&&su(h.secondaryColor,1120295);let m=h?.accentColor?su(h.accentColor,0xffffff):0xffffff,g=u?1975344:0xf3f5f9,b=u?1119778:0xc9d0dc,v=new rd.f;"mecha_pilot"===f?(v.poly([-22,-30,22,-30,18,-6,-18,-6]).fill({color:1579035}).stroke({width:1.5,color:p}),v.poly([-27,-29,-20,-33,-17,-25,-25,-20]).fill({color:2565930}).stroke({width:1,color:p}),v.poly([27,-29,20,-33,17,-25,25,-20]).fill({color:2565930}).stroke({width:1,color:p}),v.poly([-12,-26,-7,-26,-3,-20,-8,-20]).fill({color:0xeab308}),v.poly([2,-26,7,-26,11,-20,6,-20]).fill({color:0xeab308}),v.rect(-13,-30,2,24).fill({color:p}),v.rect(11,-30,2,24).fill({color:p}),v.circle(0,-14,5.5).fill({color:592139}).stroke({width:1.4,color:p}),v.circle(0,-14,3).fill({color:p}),v.rect(-4,-15,8,2).fill({color:0xffffff})):"stealth_ninja"===f?(v.poly([-16,-30,16,-30,13,-6,-13,-6]).fill({color:593174}).stroke({width:1.4,color:p}),v.poly([-16,-30,5,-14,2,-14,-16,-28]).fill({color:p}),v.poly([-16,-28,-11,-30,14,-9,9,-7]).fill({color:p,alpha:.9}),v.roundRect(-14,-12,28,6,2).fill({color:1973067}).stroke({width:1.2,color:p}),v.poly([3,-7,6,1,4,6,1,1,3,-7]).fill({color:p})):"matrix_hacker"===f?(v.roundRect(-21,-30,42,25,7).fill({color:1184279}).stroke({width:1.5,color:p}),v.roundRect(-18,-32,36,10,4).fill({color:2039592}).stroke({width:1.2,color:p}),v.rect(-7,-23,2,16).fill({color:0xffffff}),v.rect(-7.5,-7,3,4).fill({color:p}),v.rect(5,-23,2,16).fill({color:0xffffff}),v.rect(4.5,-7,3,4).fill({color:p}),v.poly([-15,-14,15,-14,13,-6,-13,-6]).fill({color:592141}).stroke({width:1,color:2565930})):"celestial_astro"===f?(v.poly([-18,-30,18,-30,16,-6,-16,-6]).fill({color:0xf1f5f9}).stroke({width:1.4,color:p}),v.roundRect(-14,-33,28,5,2).fill({color:3359061}).stroke({width:1.2,color:p}),v.roundRect(-24,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),v.roundRect(16,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),v.circle(-7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),v.circle(-7,-17,1.5).fill({color:2278750}),v.circle(7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),v.circle(7,-17,1.5).fill({color:3718648})):(v.poly([-18,-30,18,-30,15,-6,-15,-6]).fill(sm(0xffffff,g,b)).stroke({width:1.2,color:p}),v.poly([-17,-30,-7,-14,-13,-14]).fill({color:856343}),v.poly([17,-30,7,-14,13,-14]).fill({color:856343}),v.poly([-5,-30,0,-18,5,-30]).stroke({width:1.2,color:m,alpha:.85}),v.roundRect(-4.5,-19,9,12,1.5).fill({color:593174}).stroke({width:1,color:p}),v.rect(-3,-17.5,6,4.5).fill({color:p}),v.rect(-3,-11,6,1.5).fill({color:0xffffff}),v.rect(-15,-10,30,4).fill({color:132631}),v.roundRect(-3.5,-11,7,6,1).fill({color:1976635}).stroke({width:1,color:p}));let y=new rd.f;y.roundRect(-10,-36,20,8,4).fill({color:p});let w=new rd.f;w.roundRect(-6,-34,12,3,1.5).fill({color:e});let j=new rd.f,k=new rd.f;for(let[e,t,r]of[[j,-26,-1],[k,18,1]])e.roundRect(t,-28,8,24,4).fill({color:g}),e.roundRect(t,-28,8,8,4).fill({color:0xffffff,alpha:.6}),e.circle(t+4+1.5*r,-2,4.5).stroke({width:2.4,color:g}),e.pivot.set(t+4,-26),e.position.set(t+4,-26);let N=new rd.f;N.circle(-27,-56,8).fill({color:p}),N.circle(27,-56,8).fill({color:p}),N.circle(-27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),N.circle(27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),N.circle(-29,-58,3).fill({color:0xffffff,alpha:.7}),N.circle(25,-58,3).fill({color:0xffffff,alpha:.7}),N.ellipse(0,-56,26,24).fill(sm(u?2963272:0xffffff,g,b)),u&&N.ellipse(0,-56,27,25).stroke({width:2.2,color:p,alpha:.95}),N.ellipse(4,-50,24,21).stroke({width:3,color:7043728,alpha:.25}),N.ellipse(-8,-68,12,5.5).fill({color:0xffffff,alpha:.8}),N.circle(-14,-64,2).fill({color:0xffffff,alpha:.9}),N.ellipse(0,-53,22,17).fill({color:b}),N.ellipse(0,-53,20,15.5).fill({color:988188}),N.ellipse(-5,-58,11,5).fill({color:0xffffff,alpha:.06}),"tactical_visor"===x?(N.roundRect(-24,-66,48,7,2.5).fill({color:988970}),N.roundRect(-24,-66,48,7,2.5).stroke({width:1.6,color:p}),N.poly([-26,-66,-34,-76,-26,-72]).fill({color:p}),N.poly([26,-66,34,-76,26,-72]).fill({color:p}),N.circle(0,-62.5,2.5).fill({color:m})):"laser_scout"===x?(N.circle(8,-57,7).stroke({width:1.6,color:p}),N.circle(8,-57,2.5).fill({color:0xff0000})):"riot_shield"===x?(N.roundRect(-25,-68,50,9,3).fill({color:1975344}),N.roundRect(-25,-68,50,9,3).stroke({width:1.8,color:p}),N.circle(-16,-64,2.5).fill({color:m}),N.circle(16,-64,2.5).fill({color:m})):"cyber_horns"===x?(N.poly([-20,-70,-30,-88,-14,-76]).fill({color:p}),N.poly([20,-70,30,-88,14,-76]).fill({color:p})):"crown_radiator"===x?(N.poly([-16,-72,-14,-86,-8,-74]).fill({color:p}),N.poly([-4,-74,0,-92,4,-74]).fill({color:p}),N.poly([8,-74,14,-86,16,-72]).fill({color:p}),N.circle(0,-70,3).fill({color:m})):"gas_respirator"===x?(N.circle(-14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),N.circle(14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),N.circle(-14,-44,3).fill({color:p}),N.circle(14,-44,3).fill({color:p})):"prism_goggles"===x?(N.poly([-16,-62,-8,-66,-2,-62,-2,-52,-8,-48,-16,-52]).fill({color:805486}).stroke({width:1.6,color:p}),N.poly([2,-62,8,-66,16,-62,16,-52,8,-48,2,-52]).fill({color:805486}).stroke({width:1.6,color:p}),N.circle(-9,-57,2.5).fill({color:m}),N.circle(9,-57,2.5).fill({color:m})):"samurai_crest"===x?(N.poly([-22,-72,0,-88,22,-72,0,-80]).fill({color:p}),N.circle(0,-78,3).fill({color:m})):"overdrive_vents"===x?(N.poly([-18,-72,-28,-90,-14,-76]).fill({color:p}),N.poly([18,-72,28,-90,14,-76]).fill({color:p})):"holo_shroud"===x?(N.ellipse(0,-66,28,12).stroke({width:1.8,color:p,alpha:.8}),N.circle(0,-78,4).fill({color:m})):"v_fin"===x?(N.poly([-24,-88,-18,-92,0,-76,18,-92,24,-88,0,-72]).fill({color:p}),N.poly([-4,-72,0,-78,4,-72,0,-68]).fill({color:0xef4444})):"blast_shield"===x?(N.roundRect(-24,-68,48,14,3).fill({color:988970}).stroke({width:2,color:p}),N.circle(-18,-80,3.5).fill({color:0xfde047}),N.circle(18,-80,3.5).fill({color:0xfde047})):"eva_horn"===x?(N.poly([-3,-74,0,-98,3,-74]).fill({color:p}),N.roundRect(-28,-48,5,18,2).fill({color:p}),N.roundRect(23,-48,5,18,2).fill({color:p})):"cage_grille"===x?(N.roundRect(-16,-52,32,14,2).fill({color:1579035}).stroke({width:1.6,color:p}),N.roundRect(-22,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p}),N.roundRect(18,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p})):"missile_pod"===x?(N.roundRect(-30,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),N.roundRect(22,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),N.circle(-26,-38,1.5).fill({color:0xef4444}),N.circle(26,-38,1.5).fill({color:0xef4444})):"quad_array"===x?(N.poly([-22,-72,-26,-90,-20,-72]).fill({color:p}),N.poly([-12,-76,-14,-94,-10,-76]).fill({color:p}),N.poly([10,-76,14,-94,12,-76]).fill({color:p}),N.poly([20,-72,26,-90,22,-72]).fill({color:p}),N.circle(-26,-90,2).fill({color:m}),N.circle(26,-90,2).fill({color:m})):"halo_shield"===x?(N.poly([-32,-42,-26,-46,-20,-42,-20,-34,-26,-30,-32,-34]).fill({color:413243}).stroke({width:1.5,color:p}),N.poly([20,-42,26,-46,32,-42,32,-34,26,-30,20,-34]).fill({color:413243}).stroke({width:1.5,color:p})):"ram_horns"===x?(N.poly([-18,-72,-34,-86,-18,-92,-14,-72]).fill({color:p}),N.poly([18,-72,34,-86,18,-92,14,-72]).fill({color:p})):"radar_dish"===x?(N.ellipse(-24,-84,7,12).fill({color:1579035}).stroke({width:1.5,color:p}),N.circle(-24,-84,2).fill({color:m})):"hyper_wings"===x?(N.poly([-26,-46,-44,-64,-34,-40]).fill({color:p}),N.poly([26,-46,44,-64,34,-40]).fill({color:p})):"flowing_headband"===x?(N.roundRect(-24,-66,48,8,2).fill({color:1973067}).stroke({width:1.5,color:p}),N.circle(0,-62,3).fill({color:3718648}),N.poly([24,-62,38,-56,46,-46,36,-48,24,-56]).fill({color:p})):"tactical_cowl"===x?(N.roundRect(-24,-68,48,24,6).fill({color:988970,alpha:.8}).stroke({width:1.4,color:p}),N.circle(6,-57,4.5).stroke({width:1.8,color:2278750}),N.circle(6,-57,1.5).fill({color:2278750})):"oni_mask"===x?(N.poly([-16,-72,-24,-88,-12,-76]).fill({color:0xef4444}),N.poly([16,-72,24,-88,12,-76]).fill({color:0xef4444}),N.poly([-16,-46,-10,-40,0,-42,10,-40,16,-46,12,-36,-12,-36]).fill({color:0xffffff})):"kitsune_ears"===x?(N.poly([-22,-72,-14,-88,-6,-76]).fill({color:1975344}),N.poly([-20,-73,-14,-85,-8,-76]).fill({color:p}),N.poly([6,-76,14,-88,22,-72]).fill({color:1975344}),N.poly([8,-76,14,-85,20,-73]).fill({color:p})):"conical_kasa"===x?(N.poly([-36,-72,0,-92,36,-72]).fill({color:1579035}).stroke({width:1.6,color:p}),N.roundRect(-36,-72,72,2.5,1).fill({color:m})):"twin_katanas"===x?(N.poly([-24,-32,28,-88,25,-88,-27,-32]).fill({color:p}),N.poly([24,-32,-28,-88,-25,-88,27,-32]).fill({color:p})):"tengu_beak"===x?N.poly([-12,-48,0,-34,12,-48,0,-44]).fill({color:988970}).stroke({width:1.5,color:p}):"veil_shroud"===x?N.roundRect(-22,-62,44,26,6).fill({color:988970,alpha:.85}).stroke({width:1.2,color:p}):"scythe_crest"===x?N.poly([-14,-66,0,-88,14,-66,0,-82]).fill({color:p}):"void_mask"===x?(N.roundRect(-18,-62,36,20,4).fill({color:0}).stroke({width:1.8,color:p}),N.circle(0,-52,3).fill({color:p})):"hoodie_cowl"===x?N.roundRect(-28,-74,56,46,14).fill({color:335627,alpha:.9}).stroke({width:1.8,color:p}):"vr_goggles"===x?(N.roundRect(-22,-64,44,15,3).fill({color:537412}).stroke({width:1.8,color:p}),N.circle(-16,-78,2.5).fill({color:m}),N.poly([-16,-64,-16,-78,-14,-78,-14,-64]).fill({color:p})):"daemon_horns"===x?(N.poly([-16,-70,-22,-86,-10,-74]).fill({color:p}),N.poly([16,-70,22,-86,10,-74]).fill({color:p})):"glitch_halo"===x?(N.rect(-28,-76,56,42).stroke({width:1.5,color:p,alpha:.8}),N.rect(-18,-82,12,6).fill({color:p,alpha:.7})):"floating_hud"===x?N.roundRect(24,-78,30,16,2).fill({color:592139}).stroke({width:1,color:p}):"respirator_eq"===x?(N.roundRect(-18,-46,36,10,3).fill({color:988970}).stroke({width:1.2,color:p}),N.rect(-12,-43,4,5).fill({color:2278750}),N.rect(-4,-45,4,7).fill({color:0xeab308}),N.rect(4,-45,4,7).fill({color:0xef4444}),N.rect(12,-43,4,5).fill({color:2278750})):"heatsink_fins"===x?(N.rect(-18,-84,4,14).fill({color:0xea580c}),N.rect(-10,-88,4,18).fill({color:0xea580c}),N.rect(-2,-90,4,20).fill({color:0xea580c}),N.rect(6,-88,4,18).fill({color:0xea580c}),N.rect(14,-84,4,14).fill({color:0xea580c})):"cable_dreads"===x?(N.poly([-22,-62,-32,-48,-28,-12,-26,-12,-30,-48,-20,-62]).fill({color:p}),N.poly([22,-62,32,-48,28,-12,26,-12,30,-48,20,-62]).fill({color:p})):"cyber_skull"===x?(N.circle(-7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),N.circle(7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),N.poly([-8,-40,8,-40,8,-38,-8,-38]).fill({color:p})):"wireframe_cube"===x?(N.rect(-24,-76,48,42).stroke({width:1.6,color:p}),N.rect(-16,-68,32,26).stroke({width:1.2,color:m,alpha:.8})):"bubble_dome"===x?(N.circle(0,-56,28).stroke({width:2.5,color:p,alpha:.9}),N.circle(0,-84,3.5).fill({color:0xfef08a})):"lunar_pack"===x?(N.rect(-20,-86,2,18).fill({color:p}),N.circle(-19,-86,2).fill({color:0xffffff}),N.ellipse(0,-54,24,18).stroke({width:2,color:0xe2e8f0})):"sunburst_halo"===x?(N.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}),N.circle(0,-76,3).fill({color:0xfef08a}),N.circle(-22,-70,2).fill({color:0xfef08a}),N.circle(22,-70,2).fill({color:0xfef08a})):"saturn_ring"===x?(N.ellipse(0,-56,36,10).stroke({width:2.2,color:p}),N.circle(28,-62,3).fill({color:m})):"star_crown"===x?(N.poly([-16,-74,-12,-86,-8,-76]).fill({color:p}),N.poly([-6,-76,0,-92,6,-76]).fill({color:p}),N.poly([8,-76,12,-86,16,-74]).fill({color:p}),N.circle(0,-74,2.5).fill({color:0xffffff})):"eclipse_corona"===x?(N.ellipse(0,-56,32,18).stroke({width:3,color:p,alpha:.6}),N.circle(0,-56,22).fill({color:0}).stroke({width:1.5,color:p})):"pulsar_spires"===x?(N.poly([-1.5,-78,1.5,-78,1.5,-98,-1.5,-98]).fill({color:p}),N.circle(0,-98,3).fill({color:0xffffff}),N.poly([-1.5,-34,1.5,-34,1.5,-18,-1.5,-18]).fill({color:p}),N.circle(0,-18,3).fill({color:0xffffff})):"aurora_ribbons"===x?N.ellipse(0,-78,24,6).stroke({width:2.5,color:p,alpha:.75}):"angel_wings"===x?(N.poly([-26,-46,-48,-78,-32,-38]).fill({color:p,alpha:.85}),N.poly([26,-46,48,-78,32,-38]).fill({color:p,alpha:.85}),N.ellipse(0,-80,16,5).stroke({width:1.6,color:m})):"singularity_core"===x?(N.ellipse(0,-56,30,26).stroke({width:2,color:0xffffff,alpha:.9}),N.circle(-22,-70,2.5).fill({color:m}),N.circle(22,-42,2.5).fill({color:m})):"stealth_ninja"===f||"ninja"===f?(N.roundRect(-24,-66,48,8,3).fill({color:1973067}).stroke({width:1.5,color:p}),N.circle(0,-62,3).fill({color:3718648})):"mecha_pilot"===f?(N.poly([-22,-72,-18,-90,-12,-70]).fill({color:p}),N.poly([12,-70,18,-90,22,-72]).fill({color:p})):"celestial_astro"===f?N.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}):"matrix_hacker"===f||"hacker"===f?N.roundRect(-27,-78,54,48,16).fill({color:1120295}).stroke({width:1.6,color:p}):"cyber_cat"===f||"cat"===n?(N.poly([-22,-72,-14,-86,-6,-76]).fill({color:g}),N.poly([-20,-73,-14,-83,-8,-76]).fill({color:0xf472b6,alpha:.8}),N.poly([6,-76,14,-86,22,-72]).fill({color:g}),N.poly([8,-76,14,-83,20,-73]).fill({color:0xf472b6,alpha:.8})):N.poly([-8,-68,0,-78,8,-68]).fill({color:p});let S=null,C="string"==typeof a?(0,tT.x)(a):null,T=C?.archetype||"plasma_ring";a&&"none"!==a&&(S=new rd.f,c.addChildAt(S,0));let _=new rd.f,M=new rd.f;c.addChild(v,y,w,j,k,N,_,M),c.scale.set(r*t);let z=i,R=u?p:e,I=(e,t,r,s,l,i)=>{if("happy"===i)_.moveTo(e-4.6,t+2).arc(e,t+2,4.6,Math.PI,0).stroke(sg(2.6,R,l));else if("sleep"===i)_.moveTo(e-4.6,t).arc(e,t,4.6,0,Math.PI).stroke(sg(2.2,R,.7));else if("x"===i)_.moveTo(e-4,t-4).lineTo(e+4,t+4).stroke(sg(2.6,R,l)),_.moveTo(e+4,t-4).lineTo(e-4,t+4).stroke(sg(2.6,R,l));else if("looping"===i)_.circle(e,t,4.2).stroke(sg(1.8,R,l)),_.circle(e,t,2).stroke(sg(1.4,R,l)),_.circle(e,t,.6).fill({color:R,alpha:l});else{_.ellipse(e,t,r,s).fill({color:R,alpha:.9*l});for(let l=t-s+1;l<t+s;l+=2.4)_.rect(e-r-1,l,2*r+2,1).fill({color:988188,alpha:.55})}};return{root:c,statusDot:w,setMode(e){z=e},animate(e,t=0){let r=c.baseX??c.x,l=z,i=.012*e+r,o=Math.sin(.004*e+.05*r)*(.8+1.4*t),a=0,d=0;"happy"===l&&(o=-(3.2*Math.abs(Math.sin(.005*e+r)))),"sleeping"===l&&(o=1.1*Math.sin(.0016*e+r)+2.2,d=.12+.02*Math.sin(.0016*e+r)),"error"===l&&(a=1.8*Math.sin(.09*e)),"looping"===l&&(a=2.2*Math.sin(.08*e),o=1.6*Math.sin(.015*e),d=.16*Math.sin(.02*e)),c.x=r+a,c.y=(c.baseY||0)+o,c.rotation=d,j.rotation=0,k.rotation=0,"streaming"===l?(j.rotation=.14*Math.sin(i)*(.3+t),k.rotation=-(.14*Math.sin(i+1.3))*(.3+t)):"pending"===l?(j.rotation=2.5+.35*Math.sin(.012*e),k.rotation=-(.06*Math.sin(i+1.3))):"happy"===l?(j.rotation=2.2+.2*Math.sin(.01*e),k.rotation=-2.2-.2*Math.sin(.01*e+1)):"error"===l?(j.rotation=2.7+.1*Math.sin(.08*e),k.rotation=-2.7-.1*Math.sin(.08*e)):"looping"===l?(j.rotation=2.4+.4*Math.sin(.02*e),k.rotation=-2.4-.4*Math.sin(.02*e+1)):"sleeping"===l&&(j.rotation=.05,k.rotation=-.05);let h=Math.sin(.0013*e+2.1*s)>.985,u=.85+.15*Math.sin(.01*e+s);_.clear();let f="happy"===l?"happy":"sleeping"===l?"sleep":"error"===l?"x":"looping"===l?"looping":"scan";if(I(-8,-57,4.8,h?.8:4.4,u,f),I(8,-57,4.8,h?.8:4.4,u,f),"happy"===l?_.moveTo(-6,-48).arc(0,-48,6,0,Math.PI).stroke(sg(2.2,R,.9)):"sleeping"===l?_.circle(0,-45,1.8).stroke(sg(1.6,R,.6)):"error"===l?_.moveTo(-7,-45).lineTo(-3.5,-48).lineTo(0,-45).lineTo(3.5,-48).lineTo(7,-45).stroke(sg(2,R,u)):"looping"===l?_.circle(0,-46,3.2).stroke(sg(2,R,u)):_.ellipse(0,-46,5+3*t,2.4+1.2*t).fill({color:R,alpha:.75*u}),"cat"===n&&(_.moveTo(-12,-47).lineTo(-22,-49).stroke(sg(1.2,0xffffff,.7)),_.moveTo(-12,-44).lineTo(-21,-43).stroke(sg(1.2,0xffffff,.7)),_.moveTo(12,-47).lineTo(22,-49).stroke(sg(1.2,0xffffff,.7)),_.moveTo(12,-44).lineTo(21,-43).stroke(sg(1.2,0xffffff,.7)),_.poly([-2,-48,0,-46,2,-48]).fill({color:0xf472b6})),M.clear(),"sleeping"===l)for(let t=0;t<3;t+=1){let r=(4e-4*e+t/3+.13*s)%1,l=20+16*r,i=-78-30*r,o=3+4*r;M.moveTo(l,i).lineTo(l+o,i).lineTo(l,i+o).lineTo(l+o,i+o).stroke(sg(1.6,0xa5b4cc,1-r))}else if("error"===l||"looping"===l)for(let t=0;t<5;t+=1){let r=(8e-4*e+t/5+.12*s)%1,l=7*Math.sin(8*r+1.3*t)+(t-2)*3.5,i=-76-38*r,o=2.5+7*r;M.circle(l,i,o).fill({color:4937059,alpha:.65*(1-r)})}if(S){S.clear();let t=C?.color?su(C.color,61695):61695,r=1+.12*Math.sin(.006*e),i="happy"===l?.95:"error"===l?.35+.35*Math.sin(.08*e):"sleeping"===l?.25:.65;if("matrix_rain"===T)for(let r=-3;r<=3;r++){let l=9*r,o=-70+(.002*e+.33*r+.2*s)%1*50;S.moveTo(l,o-8).lineTo(l,o).stroke({width:1.5,color:t,alpha:.8*i}),S.circle(l,o,1.2).fill({color:0xffffff,alpha:i})}else if("quantum_mist"===T){for(let s=0;s<4;s++){let l=.003*e+s*Math.PI/2,o=30*r+4*Math.sin(l),n=14*r+3*Math.cos(l);S.ellipse(0,-42,o,n).stroke({width:1.2,color:t,alpha:.5*i})}S.circle(28*Math.sin(.007*e),-42+11*Math.cos(.007*e),2.2).fill({color:0xffffff,alpha:i})}else if("glitch_halo"===T){let s=2*Math.sin(.09*e);S.roundRect(-30*r+s,-54*r,60*r,24*r,6).stroke({width:2,color:t,alpha:i}),S.circle(2*s,-42,3).stroke({width:1,color:0xffffff,alpha:.7*i})}else S.ellipse(0,-42,34*r,13*r).stroke({width:2,color:t,alpha:i}),S.ellipse(0,-42,26*r,9*r).stroke({width:1.2,color:0xffffff,alpha:.8*i}),"happy"===l&&S.circle(32*Math.sin(.01*e),-42+12*Math.cos(.01*e),2.5).fill({color:0xffffff})}w.alpha=.6+.4*Math.sin(.007*e+s)*(.3+t)},setState(e){w.tint=e}}}function sv(e,{color:t=2282478,size:r=10}={}){return new sn({text:e,style:{fontFamily:sp(),fontSize:r,fill:t,fontWeight:"700"}})}let sy={cap:"round",join:"round"},sw={bash:{label:"Bash",color:3462041,draw(e,t){e.moveTo(-8,-6).lineTo(-2,0).lineTo(-8,6).stroke({width:2.4,color:t,...sy}),e.moveTo(1,7).lineTo(8,7).stroke({width:2.4,color:t,...sy})}},read:{label:"Read",color:6333946,draw(e,t){e.moveTo(-6,-9).lineTo(3,-9).lineTo(7,-5).lineTo(7,9).lineTo(-6,9).closePath().stroke({width:2,color:t,...sy}),e.moveTo(-3,-1).lineTo(4,-1).stroke({width:1.8,color:t,...sy}),e.moveTo(-3,3).lineTo(4,3).stroke({width:1.8,color:t,...sy}),e.moveTo(-3,6.5).lineTo(1,6.5).stroke({width:1.8,color:t,...sy})}},edit:{label:"Edit",color:0xfbbf24,draw(e,t){e.moveTo(-7,8).lineTo(-6,3).lineTo(4,-7).lineTo(8,-3).lineTo(-2,7).closePath().stroke({width:2,color:t,...sy}),e.moveTo(1,-4).lineTo(5,0).stroke({width:1.8,color:t,...sy}),e.moveTo(-8,9.5).lineTo(-1,9.5).stroke({width:1.8,color:t,...sy})}},search:{label:"Search",color:0xf472b6,draw(e,t){e.circle(-2,-2,6).stroke({width:2.2,color:t,...sy}),e.moveTo(2.5,2.5).lineTo(8,8).stroke({width:2.6,color:t,...sy})}},web:{label:"Web",color:2282478,draw(e,t){e.circle(0,0,8.5).stroke({width:2,color:t,...sy}),e.ellipse(0,0,3.6,8.5).stroke({width:1.6,color:t,...sy}),e.moveTo(-8.5,0).lineTo(8.5,0).stroke({width:1.6,color:t,...sy})}},mcp:{label:"MCP",color:0xa78bfa,draw(e,t){e.moveTo(-4,-9).lineTo(-4,-3).stroke({width:2.4,color:t,...sy}),e.moveTo(4,-9).lineTo(4,-3).stroke({width:2.4,color:t,...sy}),e.roundRect(-8,-3,16,9,3).stroke({width:2,color:t,...sy}),e.moveTo(0,6).lineTo(0,10).stroke({width:2.4,color:t,...sy})}},agent:{label:"Subagent",color:0xfb923c,draw(e,t){e.moveTo(0,-4).lineTo(-6,6).stroke({width:1.8,color:t,...sy}),e.moveTo(0,-4).lineTo(6,6).stroke({width:1.8,color:t,...sy}),e.circle(0,-5,3.6).fill({color:t}),e.circle(-6.5,7,3).fill({color:t}),e.circle(6.5,7,3).fill({color:t})}},todo:{label:"Todo",color:9741240,draw(e,t){e.moveTo(-8,-5).lineTo(-6,-3).lineTo(-3,-7).stroke({width:1.8,color:t,...sy}),e.moveTo(1,-5).lineTo(8,-5).stroke({width:1.8,color:t,...sy}),e.moveTo(-8,5).lineTo(-6,7).lineTo(-3,3).stroke({width:1.8,color:t,...sy}),e.moveTo(1,5).lineTo(8,5).stroke({width:1.8,color:t,...sy})}},gitnexus:{label:"GitNexus",color:0xc084fc,draw(e,t){e.moveTo(0,0).lineTo(-6,-6).stroke({width:1.5,color:t,...sy}),e.moveTo(0,0).lineTo(6,-5).stroke({width:1.5,color:t,...sy}),e.moveTo(0,0).lineTo(0,7).stroke({width:1.5,color:t,...sy}),e.circle(0,0,3.2).fill({color:t}),e.circle(-6,-6,2.2).fill({color:t}),e.circle(6,-5,2.2).fill({color:t}),e.circle(0,7,2.2).fill({color:t})}},browser:{label:"Browser",color:440020,draw(e,t){e.roundRect(-8,-7,16,14,2.5).stroke({width:1.8,color:t,...sy}),e.moveTo(-8,-2).lineTo(8,-2).stroke({width:1.4,color:t,...sy}),e.circle(-5,-4.5,1).fill({color:t}),e.circle(-2,-4.5,1).fill({color:t})}},git:{label:"Git",color:0xf97316,draw(e,t){e.moveTo(-4,-7).lineTo(-4,7).stroke({width:2,color:t,...sy}),e.moveTo(-4,2).arc(0,2,4,Math.PI,0).lineTo(4,-3).stroke({width:1.8,color:t,...sy}),e.circle(-4,-6,2.4).fill({color:t}),e.circle(-4,6,2.4).fill({color:t}),e.circle(4,-3,2.4).fill({color:t})}},docker:{label:"Docker",color:3718648,draw(e,t){e.roundRect(-7,1,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...sy}),e.roundRect(1,1,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...sy}),e.roundRect(-3,-6,6,5,1).fill({color:t,alpha:.8}).stroke({width:1.2,color:t,...sy})}}},sj={pending:{label:"Queued",color:0xf59e0b,draw(e,t){for(let r of[-7,0,7])e.circle(r,1,2.6).fill({color:t})}},done:{label:"Done",color:3462041,draw(e,t){e.moveTo(-7,0).lineTo(-2,6).lineTo(8,-7).stroke({width:3,color:t,...sy})}},rate_limited:{label:"Rate limit",color:0xef4444,draw(e,t){e.moveTo(-6,-9).lineTo(6,-9).lineTo(-6,9).lineTo(6,9).closePath().stroke({width:2,color:t,...sy}),e.moveTo(-3,6.5).lineTo(3,6.5).stroke({width:2.2,color:t,...sy})}},upstream_timeout:{label:"Timeout",color:0xef4444,draw(e,t){e.circle(0,0,8.5).stroke({width:2,color:t,...sy}),e.moveTo(0,-5).lineTo(0,0).lineTo(4.5,3).stroke({width:2,color:t,...sy})}},quota_exhausted:{label:"Quota",color:0xef4444,draw(e,t){e.roundRect(-8,-5,14,10,2).stroke({width:2,color:t,...sy}),e.rect(6,-2,3,4).fill({color:t}),e.rect(-6,-3,2.6,6).fill({color:t})}},auth_refresh_failed:{label:"Auth",color:0xef4444,draw(e,t){e.circle(-4,0,4.2).stroke({width:2,color:t,...sy}),e.moveTo(0,0).lineTo(8,0).stroke({width:2,color:t,...sy}),e.moveTo(5,0).lineTo(5,4).stroke({width:2,color:t,...sy}),e.moveTo(-9,-8).lineTo(9,8).stroke({width:2.2,color:0xfbbf24,...sy})}},fallback:{label:"Fallback",color:0xfbbf24,draw(e,t){e.moveTo(-8,-4).lineTo(7,-4).stroke({width:2.2,color:t,...sy}),e.moveTo(3,-8).lineTo(8,-4).lineTo(3,0).stroke({width:2.2,color:t,...sy}),e.moveTo(8,5).lineTo(-7,5).stroke({width:2.2,color:t,...sy}),e.moveTo(-3,1).lineTo(-8,5).lineTo(-3,9).stroke({width:2.2,color:t,...sy})}},looping:{label:"Looping",color:0xf43f5e,draw(e,t){e.arc(0,0,6.5,-(.2*Math.PI),1.3*Math.PI).stroke({width:2.2,color:t,...sy}),e.moveTo(4,-6.5).lineTo(7,-3.5).lineTo(1,-3.5).closePath().fill({color:t})}}},sk=Object.keys(sw),sN=["pending","done","rate_limited","upstream_timeout","quota_exhausted","auth_refresh_failed","fallback","looping"];function sS(e,{size:t=1,showLabel:r=!0,label:s}={}){let l=sw[e]||sj[e]||sw.bash,i=new rt.t,o=new rd.f;o.circle(0,0,21).fill({color:l.color,alpha:.18});let n=new rd.f;n.circle(0,0,15).fill({color:988188}),n.circle(0,0,15).stroke({width:2,color:l.color,alpha:.95});let a=new rd.f;if(l.draw(a,l.color),a.scale.set(.95),i.addChild(o,n,a),r){let e=new sn({text:s??l.label,style:{fontFamily:(0,sh.l)("ui"),fontSize:9,fill:l.color,fontWeight:"800"}});e.anchor.set(.5,0),e.y=18,i.addChild(e)}return i.scale.set(t),{root:i,halo:o,tool:e}}let sC={x:-60,y:40,w:2150,h:980},sT=e=>Math.max(0,Math.min(1,e)),s_={streaming:.8,pending:.3,happy:.2,sleeping:0,error:1};async function sM(e,t,r={}){let s,l,i,o,n=r.selectedId??null,a=r.onSelect,c=!1,d={x:0,y:0},h={x:0,y:0},u=!1,f=new ra;await f.init({canvas:e,preference:"webgl",resizeTo:e.parentElement,background:724758,antialias:!0,resolution:Math.min(globalThis.devicePixelRatio||1,2),autoDensity:!0});let x=f.renderer?.context?.extensions?.loseContext;if(x&&"function"==typeof x.loseContext){let e=x.loseContext.bind(x);x.loseContext=()=>{try{let t=f.renderer?.gl;if(t&&"function"==typeof t.isContextLost&&t.isContextLost())return;e()}catch(e){}}}let p=new rt.t,m=new rt.t,g=new rt.t,b=new rt.t,v=new rt.t,y=new rt.t,w=new rt.t,j=(s=new rt.t,l=new rd.f,i=new rd.f,s.addChild(i,l),o=[],{container:s,setRoutes(e){for(let t of(o.length=0,e)){let e=Math.max(1,Math.min(6,Math.round(6*t.weight)));for(let r=0;r<e;r+=1)o.push({from:t.from,to:t.to,t:(r/e+.1*Math.random())%1,speed:35e-5+6e-4*Math.random()+4e-4*t.weight,color:t.color,size:1.6+2.2*t.weight,shape:t.shape||"circle",arc:t.arc??26})}for(;o.length>700;)o.pop()},animate(e){for(let t of(l.clear(),i.clear(),o)){t.t+=t.speed*e,t.t>1&&(t.t-=1,t.speed=35e-5+6e-4*Math.random());let r=function(e,t,r,s){let l=Math.sin(r*Math.PI)*s;return{x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r-l}}(t.from,t.to,t.t,t.arc),s=Math.min(1,6*t.t)*Math.min(1,(1-t.t)*6),o=t.size;if("diamond"===t.shape)l.poly([r.x,r.y-1.5*o,r.x+1.2*o,r.y,r.x,r.y+1.5*o,r.x-1.2*o,r.y]).fill({color:t.color,alpha:s});else if("square"===t.shape){let e=.7*o;l.rect(r.x-e,r.y-e,2*e,2*e).fill({color:t.color,alpha:.9*s})}else l.circle(r.x,r.y,o).fill({color:t.color,alpha:s});i.circle(r.x,r.y,3*o).fill({color:t.color,alpha:.14*s})}}});p.addChild(m,g,j.container,b,v,y,w),f.stage.addChild(p);let k=t,N=new rd.f;function S(e=2150,t=980){sC.w=e,sC.h=t,N.clear();let r=(0,tB.F)(),s=k?.[0]?.theme||r?.equippedOfficeTheme||"theme_default",l=(tT.y.officeThemes||[]).find(e=>e.id===s)||tT.y.officeThemes?.[0],i=l?.palette||{floorGradient:[725016,1449772],gridColor:1712944,gridAlpha:.7,borderColor:2503236,panelRackColor:0xfde047,panelPodColor:2282478},[o,n]=i.floorGradient||[725016,1449772],a=i.gridColor??1712944,c=i.gridAlpha??.7,d=i.borderColor??2503236,h=i.panelRackColor??0xfde047,u=i.panelPodColor??2282478;N.roundRect(sC.x,sC.y,sC.w,sC.h,28).fill(new rc.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:[{offset:0,color:o},{offset:1,color:n}],textureSpace:"local"}));for(let e=sC.x+100;e<sC.x+sC.w;e+=100)N.moveTo(e,sC.y+14).lineTo(e,sC.y+sC.h-14).stroke({width:1,color:a,alpha:c});for(let e=sC.y+100;e<sC.y+sC.h;e+=100)N.moveTo(sC.x+14,e).lineTo(sC.x+sC.w-14,e).stroke({width:1,color:a,alpha:c});N.roundRect(sC.x,sC.y,sC.w,sC.h,28).stroke({width:2,color:d,alpha:.9}),N.roundRect(1370,sC.y+120,260,sC.h-240,22).fill({color:h,alpha:.045}),N.roundRect(1750,sC.y+40,220,sC.h-150,22).fill({color:u,alpha:.045})}S(2150,980),N.eventMode="static",N.on("pointertap",()=>{u||D(null)}),m.addChild(N);let C=new rt.t,T=sb({color:0xfde047,trimColor:0xf59e0b,seed:3,scale:.95,mode:"sleeping"});T.root.baseX=0,T.root.baseY=-156,T.root.x=0,T.root.y=-156,C.addChild(T.root);let _=new rd.f;_.roundRect(-70,-170,140,230,10).fill({color:1712685}),_.roundRect(-62,-162,124,60,6).fill({color:2240576}),_.roundRect(-58,40,116,96,6).fill({color:2240576}),C.addChild(_);let M=new rd.f;M.roundRect(-80,-180,160,250,14).fill({color:0xfde047,alpha:.12}),C.addChildAt(M,0);let z=new rd.f;C.addChild(z);let R=new sn({text:"CORE HUB",style:{fontFamily:(0,sh.l)("ui"),fontSize:14,fill:3718648,fontWeight:"800",letterSpacing:2}});R.anchor.set(.5,0),R.y=-92,C.addChild(R);let I=sv("0",{color:0xfde047,size:13});I.anchor.set(.5,0),I.y=4,C.addChild(I),b.addChild(C);let L=[],E=[],A=[],P=[],F=!1,$="";function O(){for(let e of E)e.desk.setSelected(e.ws.connectionId===n)}function D(e){n=e,O(),a?.(e)}function W(e,t=!1){k=e;let r=function(e){if(!Array.isArray(e)||0===e.length)return"0:empty";let t=e.length+":";for(let r=0;r<e.length;r++){let s=e[r];s&&(t+=`${s.connectionId||s.id||r}_${s.state||""}_${s.mode||""}_${+!!s.isLooping}_${s.skin||""}_${s.aura||""}_${s.pet||""}_${s.trophy||""}_${Array.isArray(s.props)?s.props.join(","):s.props||""}_${s.cost||0}_${s.elapsedMs||0}_${s.tokens?.input||0}_${s.tokens?.output||0}_${s.tools?.length||0}_${s.error||""}|`)}return t}(e);if(!t&&r===$&&L.length>0)return;$=r;let s=[],l=[],i=[],o=[],a=(e,t)=>(e.addChild(t),s.push(t),t),c=sd(e),d=new Map(c.pods.map(e=>[e.provider,e])),h=[],f=[...c.workstations].sort((e,t)=>e.y-t.y||e.x-t.x),x=(0,tB.F)();for(let[e,t]of f.entries()){let r=!!t.isLooping,s="app"===t.clientType||String(t.provider||"").toLowerCase().includes("app"),i=t.clientType||(s?"app":"cli"),o=function({color:e,label:t="",meta:r="",provider:s="",clientType:l="cli",elapsedMs:i=0,cost:o=0,cachedPct:n=0,queued:a=1,depth:c=1,isLooping:d=!1,pet:h="none",props:u=[],trophy:f="none"}){let x=new rt.t,p="app"===l||String(s||"").toLowerCase().includes("app"),m=new rd.f;m.ellipse(83,102,93,11).fill({color:0,alpha:.18}),m.ellipse(81,100,.56*150,8).fill({color:0,alpha:.28}),m.roundRect(0,34,150,62,7).fill(sm(2831427,1580326)),m.poly([150,40,159,32,159,88,150,94]).fill({color:1053723}),m.poly([-5,28,8,20,148,20,159,28]).fill({color:6122365}),m.roundRect(-5,26,164,14,6).fill(sm(6648714,3818836)),m.roundRect(-5,26,164,2.5,2).fill({color:0xffffff,alpha:.3}),m.roundRect(0,40,150,2,1).fill({color:0,alpha:.35}),x.addChild(m);let g=Math.min(1,i/4e4),b=i<12e3?3462041:i<26e3?0xfbbf24:0xef4444,v=new rd.f;v.roundRect(10,87,130,4,2).fill({color:988188}),v.roundRect(10,87,Math.max(4,130*g),4,2).fill({color:b}),x.addChild(v);let y=new rd.f;y.roundRect(13,-30,76,62,12).fill({color:e,alpha:.12}),x.addChild(y);let w=new rd.f;w.roundRect(25,-16,58,38,5).fill({color:0,alpha:.35}),w.roundRect(23,-18,58,38,5).fill(sm(2765116,724499)),w.roundRect(27,-14,50,30,3).fill({color:e,alpha:.6});for(let e=0;e<4;e+=1)w.roundRect(31,-9+6*e,18+11*e%22,2.4,1).fill({color:0xffffff,alpha:.5});w.poly([27,-14,53,-14,41,16,27,16]).fill({color:0xffffff,alpha:.07}),w.roundRect(46,20,8,6,2).fill({color:2962753}),x.addChild(w);let j=new rd.f;j.roundRect(29,-13,26,11,2.5).fill({color:p?3868516:413243,alpha:.9}),j.roundRect(29,-13,26,11,2.5).stroke({width:.8,color:p?0xa855f7:366185,alpha:.95}),x.addChild(j);let k=new sn({text:p?"APP":"CLI",style:{fontFamily:sx(),fontSize:7,fill:p?0xd8b4fe:7268279,fontWeight:"900"}});k.anchor.set(.5,.5),k.x=42,k.y=-7.5,x.addChild(k);let N=new rd.f;N.roundRect(89,29,34,8,3).fill({color:724499}),N.roundRect(89,27,34,8,3).fill(sm(3884372,2304565)),x.addChild(N);let S=new rd.f,C=Math.min(5,Math.max(1,a));for(let e=0;e<C;e+=1)S.roundRect(-2+e%2,22-3.4*e,22,5,1.5).fill({color:e%2?0xe6edf6:0xcfd8e6}).stroke({width:.6,color:988188,alpha:.5});if(x.addChild(S),a>1){let e=new sn({text:`\xd7${a}`,style:{fontFamily:sp(),fontSize:10,fill:0xfbbf24,fontWeight:"800"}});e.anchor.set(.5,1),e.x=9,e.y=22-3.4*C-1,x.addChild(e)}let T=new sn({text:sf(t,18),style:{fontFamily:sp(),fontSize:11.5,fill:p?0xf5d0fe:0xe6edf6,fontWeight:"700"}});T.anchor.set(.5,0),T.x=75,T.y=42;let _=s?s.toUpperCase():"",M=_?`${_} \xb7 ${sf(r,18)}`:sf(r,28),z=new sn({text:sf(M,28),style:{fontFamily:sx(),fontSize:8.5,fill:p?0xd8b4fe:9675189}});z.anchor.set(.5,0),z.x=75,z.y=57;let R=Number.isFinite(i)?i:null,I=Number.isFinite(o)?`$${o.toFixed(2)}`:"—",L=Number.isFinite(n)?`${n}% cached`:"— cached",E=null===R?"—":R>=1e3?`${(R/1e3).toFixed(1)}s`:`${R}ms`,A=new sn({text:`${E} \xb7 ${I} \xb7 ${L}`,style:{fontFamily:sx(),fontSize:8.5,fill:b}});A.anchor.set(.5,0),A.x=75,A.y=71,x.addChild(T,z,A);let P=Array.isArray(u)?u:[u],F=P.map(e=>"string"==typeof e?(0,tT.x)(e):e).filter(Boolean),$=P.includes("coffee_machine")||F.some(e=>"espresso_station"===e.archetype||e.id?.includes("prop_3")||e.id?.includes("espresso")),O=P.includes("bonsai")||F.some(e=>"terrarium_bonsai"===e.archetype||e.id?.includes("prop_4")||e.id?.includes("bonsai")),D=F.some(e=>"supercomputer"===e.archetype||e.id?.includes("prop_0")||e.id?.includes("server")),W=F.some(e=>"hologram_emitter"===e.archetype||e.id?.includes("prop_2")||e.id?.includes("holo")),V=F.some(e=>"dual_monitor"===e.archetype||e.id?.includes("prop_1")||e.id?.includes("monitor")),B=F.some(e=>"arcade_cabinet"===e.archetype||e.id?.includes("arcade")),H=F.some(e=>"lab_oscilloscope"===e.archetype||e.id?.includes("oscilloscope")),U=null;if($){let e=new rt.t;e.x=118,e.y=12;let t=new rd.f;t.roundRect(0,0,16,20,3).fill(sm(4674921,1976635)),t.roundRect(2,2,12,5,1.5).fill({color:988970}),t.roundRect(3,3,3,3,1).fill({color:3718648}),t.roundRect(2,9,12,9,1).fill({color:988970}),t.roundRect(4,11,7,7,2).fill({color:0xf8fafc}),t.roundRect(5,12,5,2,1).fill({color:7877903}),e.addChild(t),U=new rd.f,e.addChild(U),x.addChild(e)}if(O){let e=new rt.t;e.x=4,e.y=14;let t=new rd.f;t.roundRect(0,10,14,7,2).fill({color:8138002}),t.ellipse(7,6,7,5).fill({color:1409085}),t.circle(4,4,3.8).fill({color:2278750}),t.circle(10,4,3.8).fill({color:1483594}),e.addChild(t),x.addChild(e)}let q=null;if(D){let e=new rt.t;e.x=128,e.y=8;let t=new rd.f;t.roundRect(0,0,14,28,2).fill(sm(1976635,988970)),t.roundRect(0,0,14,28,2).stroke({width:1,color:3359061}),e.addChild(t),q=new rd.f,e.addChild(q),x.addChild(e)}let G=null;if(W){let e=new rt.t;e.x=6,e.y=10;let t=new rd.f;t.ellipse(8,22,9,3.5).fill({color:1976635}),t.ellipse(8,22,9,3.5).stroke({width:1,color:440020}),t.poly([8,22,1,6,15,6]).fill({color:440020,alpha:.2}),e.addChild(t),(G=new rd.f).x=8,G.y=4,G.roundRect(-4,-4,8,8,1).stroke({width:1.2,color:3718648,alpha:.9}),G.roundRect(-4,-4,8,8,1).fill({color:440020,alpha:.4}),e.addChild(G),x.addChild(e)}if(V){let e=new rt.t;e.x=4,e.y=10;let t=new rd.f;t.roundRect(0,0,14,24,2).fill(sm(1976635,988970)),t.roundRect(0,0,14,24,2).stroke({width:1,color:3718648,alpha:.7}),t.roundRect(2,2,10,20,1).fill({color:132631});for(let e=0;e<4;e++)t.roundRect(3,4+4.5*e,5+e%2*3,1.2,.5).fill({color:e%2?2278750:61695,alpha:.8});e.addChild(t),x.addChild(e)}if(B){let e=new rt.t;e.x=126,e.y=6;let t=new rd.f;t.roundRect(0,0,16,30,2).fill(sm(4988309,1973067)),t.roundRect(0,0,16,30,2).stroke({width:1,color:0xa855f7}),t.roundRect(2,2,12,6,1).fill({color:0xf43f5e}),t.roundRect(2,10,12,11,1).fill({color:395284}),t.circle(5,24,1.5).fill({color:0xf59e0b}),e.addChild(t),x.addChild(e)}let Y=null;if(H){let e=new rt.t;e.x=6,e.y=12;let t=new rd.f;t.roundRect(0,0,18,18,2).fill({color:1976635}),t.roundRect(0,0,18,18,2).stroke({width:1,color:1096065}),t.circle(9,9,6.5).fill({color:142370}),e.addChild(t),Y=new rd.f,e.addChild(Y),x.addChild(e)}if(f&&"none"!==f){let e="string"==typeof f?(0,tT.x)(f):null,t=e?.color?su(e.color,0xf59e0b):0xf59e0b,r=e?.archetype||"quantum_crystal",s=new rt.t;s.x=136,s.y=16;let l=new rd.f;l.roundRect(-6,8,12,4,1).fill({color:988970}),l.roundRect(-6,8,12,4,1).stroke({width:.8,color:t,alpha:.6}),"golden_key"===r?(l.circle(0,-2,4).stroke({width:1.5,color:t}),l.moveTo(0,2).lineTo(0,8).stroke({width:1.5,color:t}),l.moveTo(0,5).lineTo(2.5,5).stroke({width:1.2,color:t})):"silicon_wafer"===r?(l.circle(0,0,5.5).fill({color:1976635}),l.circle(0,0,5.5).stroke({width:1.2,color:t}),l.moveTo(-4,0).lineTo(4,0).stroke({width:.8,color:3718648,alpha:.8}),l.moveTo(0,-4).lineTo(0,4).stroke({width:.8,color:0xec4899,alpha:.8})):"diamond_bug"===r?(l.ellipse(0,0,4.5,5.5).fill({color:t}),l.circle(0,-3.5,2.5).fill({color:0xffffff}),l.moveTo(-4,-1).lineTo(-6,-3).stroke({width:1,color:t}),l.moveTo(4,-1).lineTo(6,-3).stroke({width:1,color:t})):(l.poly([0,-6,5,2,-5,2]).fill({color:t}),l.poly([0,-6,5,2,0,6,-5,2]).stroke({width:1,color:0xffffff,alpha:.8}),l.circle(0,0,1.5).fill({color:0xffffff})),s.addChild(l),x.addChild(s)}let X=null,K="string"==typeof h?(0,tT.x)(h):null,Z=K?.archetype||("cat"===h?"cyber_cat":"shiba"===h?"dozing_shiba":h),J=K?.color?su(K.color,0xf472b6):"dozing_shiba"===Z?0xd97706:0xf472b6;if(h&&"none"!==h){(X=new rt.t).x=24,X.y=80;let e=new rd.f;"cyber_cat"===Z||"cat"===h?(e.ellipse(0,0,11,7).fill({color:J}),e.circle(-7,-2,5.5).fill({color:J}),e.poly([-11,-7,-8,-11,-5,-7]).fill({color:0xf43f5e}),e.poly([-7,-7,-4,-11,-1,-7]).fill({color:0xf43f5e}),e.moveTo(-9,-1).arc(-7,-1,2,0,Math.PI).stroke(sg(1,8917815)),e.ellipse(7,2,5,2.5).fill({color:J})):"dozing_shiba"===Z||"shiba"===h?(e.ellipse(0,0,13,8).fill({color:J}),e.ellipse(2,2,9,4).fill({color:0xfef3c7}),e.circle(-8,-2,6).fill({color:J}),e.poly([-12,-7,-9,-12,-6,-7]).fill({color:0xb45309}),e.poly([-7,-7,-4,-12,-1,-7]).fill({color:0xb45309}),e.moveTo(-10,-1).arc(-8,-1,2,0,Math.PI).stroke(sg(1,7877903)),e.circle(9,-2,4).fill({color:J})):"hover_drone"===Z?(e.ellipse(0,6,12,3.5).stroke({width:1.5,color:J,alpha:.8}),e.circle(0,0,7).fill({color:1976635}),e.circle(0,0,7).stroke({width:1.2,color:J}),e.circle(0,0,3).fill({color:3718648}),e.circle(-1,-1,1).fill({color:0xffffff})):(e.ellipse(0,0,8,10).fill({color:1976635}),e.ellipse(0,0,8,10).stroke({width:1.2,color:J}),e.circle(-3,-4,2.5).fill({color:J}),e.circle(3,-4,2.5).fill({color:J}),e.poly([-1,0,1,0,0,2]).fill({color:0xf59e0b})),X.addChild(e),x.addChild(X)}let Q=new rd.f;Q.roundRect(-12,-76,174,180,14).stroke({width:2.5,color:0xfde047,alpha:.9}),Q.roundRect(-12,-76,174,180,14).fill({color:0xfde047,alpha:.05}),Q.visible=!1,x.addChildAt(Q,0);let ee=new rd.f;return ee.roundRect(-10,18,170,88,10).stroke({width:3,color:0xf43f5e,alpha:.95}),ee.roundRect(-10,18,170,88,10).fill({color:0xf43f5e,alpha:.08}),ee.visible=!!d,x.addChildAt(ee,0),x.eventMode="static",x.cursor="pointer",x.hitArea=new rg.f(-12,-76,174,180),x.scale.set(c),{root:x,screen:w,glow:y,setSelected(e){Q.visible=!!e},setHazard(e){ee.visible=!!e},animate(e,t=0,r="streaming"){if(w.alpha=.7+.12*Math.sin(.008*e+x.x)*(.4+t),y.alpha=.3+.5*t+.08*Math.sin(.004*e+x.x),ee.visible&&(ee.alpha=.45+.45*Math.sin(.008*e)),U&&t>0){U.clear();for(let t=0;t<3;t++){let r=(.001*e+t/3)%1,s=7+3*Math.sin(5*r+t),l=8-12*r;U.circle(s,l,1+1.8*r).fill({color:0xffffff,alpha:.45*(1-r)})}}else U&&U.clear();if(q){q.clear();for(let t=0;t<4;t++){let r=Math.sin(.008*e+1.6*t)>0,s=[2278750,61695,0xf59e0b,0xec4899][t];q.circle(4,4+6*t,1.3).fill({color:r?s:1976635})}}if(G&&(G.rotation=.002*e),Y){Y.clear(),Y.moveTo(3,9);for(let t=3;t<=15;t+=1.5){let r=9+3*Math.sin(.01*e+.8*t);Y.lineTo(t,r)}Y.stroke({width:1.2,color:3462041,alpha:.9})}X&&("hover_drone"===Z?(X.y=72+4*Math.sin(.005*e),X.scale.y=1):"happy"===r?(X.y=80-7*Math.abs(Math.sin(.008*e)),X.scale.y=1+.15*Math.abs(Math.sin(.008*e))):"sleeping"===r?(X.y=80,X.scale.y=1+.04*Math.sin(.0016*e)):"error"===r?(X.x=24+1.5*Math.sin(.08*e),X.y=80):"looping"===r?X.rotation=.15*Math.sin(.04*e):(X.y=80,X.scale.y=1+.06*Math.sin(.003*e)))}}}({color:t.color,label:t.account,meta:`${t.model||""} \xb7 ${t.totalLabel}`,provider:t.provider,clientType:i,elapsedMs:t.elapsedMs,cost:t.cost,cachedPct:t.cachedPct,queued:t.queued,depth:t.depth,isLooping:r,pet:t.pet||x.equippedPet||"none",props:t.props&&t.props.length>0?t.props:x.equippedProps||[],trophy:t.trophy||x.equippedTrophy||"none"});o.root.x=t.x,o.root.y=t.y,o.root.on("pointertap",e=>{u||(e.stopPropagation(),D(t.connectionId===n?null:t.connectionId))});let c=sb({color:t.color,depth:t.depth,seed:e,mode:t.mode,clientType:i,skin:t.skin||x.equippedSkin||"classic",aura:t.aura||x.equippedAura||"none"});c.root.x=t.x+108,c.root.baseX=t.x+108,c.root.baseY=t.y+34,c.root.y=c.root.baseY,a(b,c.root),a(b,o.root);let f=[];if(t.busy>0||t.tools.length>0)for(let e of t.tools){let r=sS(e,{size:1.05});r.root.x=t.x+28,r.root.y=t.y-50,r.root.visible=!1,a(y,r.root),f.push(r)}let p=null,m=t.isLooping?"looping":"pending"===t.mode?"pending":"happy"===t.mode?"done":"error"===t.mode?sj[t.errorReason]?t.errorReason:"rate_limited":null;if(m&&((p=sS(m,{size:1.05})).root.x=t.x+150+14,p.root.y=t.y-34,a(y,p.root)),t.fallbackFrom){let e=sS("fallback",{size:.85,label:`from ${t.fallbackFrom}`});e.root.x=t.x+150+14,e.root.y=t.y+40,a(y,e.root)}let g=null;if("happy"===t.mode&&t.cost>0){g=new rt.t;let e=new rd.f;e.circle(0,0,6).fill({color:0xfacc15}),e.circle(0,0,6).stroke({width:1.2,color:0xa16207});let r=new sn({text:`+$${t.cost.toFixed(2)}`,style:{fontFamily:(0,sh.l)("ui"),fontSize:11,fill:0xfacc15,fontWeight:"800"}});r.x=10,r.anchor.set(0,.5),g.addChild(e,r),g.x=t.x+16,g.visible=!1,a(y,g)}l.push({desk:o,character:c,ws:t,toolBadges:f,statusBadge:p,coin:g});let v=d.get(t.provider);if(t.busy>0){let e=e=>Math.max(.15,sT(e)),r=e(t.tokens.input/16e3),s=e(t.tokens.output/3200),l=t.tokens.cached>0?e(t.tokens.cached/6500):0,i={x:t.x+75,y:t.y-10},o={x:1500,y:390};h.push({from:i,to:o,color:t.color,weight:r}),v&&(h.push({from:{x:1500,y:440},to:{x:v.x-46,y:v.y},color:v.color,weight:r}),h.push({from:{x:v.x-46,y:v.y+14},to:{x:1520,y:470},color:8843180,weight:s,shape:"diamond",arc:-22})),h.push({from:{x:1480,y:490},to:{x:t.x+100,y:t.y+6},color:8843180,weight:s,shape:"diamond",arc:-22}),l&&h.push({from:{x:t.x+90,y:t.y-20},to:{x:1470,y:360},color:0xcbd5e1,weight:l,shape:"square",arc:44})}}for(let e of c.pods){let t=sb({color:e.color,trimColor:e.color,scale:.55,seed:e.provider.length,mode:e.overloaded?"pending":e.busy>0?"streaming":"sleeping"});t.root.x=e.x+2,t.root.baseX=e.x+2,t.root.baseY=e.y+10,t.root.y=e.y+10,a(b,t.root);let r=new rd.f;r.ellipse(0,34,52,10).fill({color:0,alpha:.35}),r.roundRect(-46,-30,92,62,12).fill({color:1844529}),r.roundRect(-46,-30,92,6,5).fill({color:0xffffff,alpha:.06});let s=e.overloaded?sa.error:e.load>.5?0xfbbf24:3462041;for(let t=0;t<3;t+=1){let l=sT(3*e.load-t);r.roundRect(-38,-18+14*t,76,9,3).fill({color:988188}),l>0&&r.roundRect(-38,-18+14*t,76*l,9,3).fill({color:s,alpha:.9})}r.x=e.x,r.y=e.y,a(b,r);let l=new rd.f;l.x=e.x+34,l.y=e.y-35,a(b,l);let o=new sn({text:e.provider.toUpperCase(),style:{fontFamily:(0,sh.l)("ui"),fontSize:12,fill:0xdce6f2,fontWeight:"800",letterSpacing:1}});o.anchor.set(.5,0),o.x=e.x,o.y=e.y+38,a(b,o);let n=sv(`${e.busy} in flight${e.overloaded?" · FULL":""}`,{color:e.overloaded?sa.error:e.color,size:10});n.anchor.set(.5,0),n.x=e.x,n.y=e.y+53,a(b,n),i.push({pod:e,operator:t,siren:l})}c.fallbacks.forEach((e,t)=>{let r=d.get(e.from),s=d.get(e.to);if(!r||!s)return;let l=1778-t%4*14,i=new rd.f;i.moveTo(r.x-46,r.y).lineTo(l,r.y).stroke({width:2,color:0xfbbf24,alpha:.5}),i.moveTo(s.x-46,s.y).lineTo(l,s.y).stroke({width:2,color:0xfbbf24,alpha:.5}),function(e,t,r,s){let l=Math.sign(s-r)||1;for(let i=r;l>0?i<s-8:i>s+8;i+=14*l)e.moveTo(t,i).lineTo(t,i+8*l).stroke({width:2,color:0xfbbf24,alpha:.8})}(i,l,r.y,s.y);let n=Math.sign(s.y-r.y)||1;i.poly([l-6,s.y-10*n,l+6,s.y-10*n,l,s.y]).fill({color:0xfbbf24}),a(g,i);let c=new sn({text:`FALLBACK \xd7${e.count}`,style:{fontFamily:(0,sh.l)("ui"),fontSize:9,fill:0xfbbf24,fontWeight:"800",letterSpacing:1}});c.anchor.set(1,.5),c.x=l-9,c.y=(r.y+s.y)/2,a(g,c);let h=sb({color:0xfbbf24,trimColor:0xf59e0b,scale:.5,seed:t+5,mode:"streaming"}),u=new rd.f;u.roundRect(-30,-22,14,12,2).fill({color:0xd6a15c}),u.moveTo(-30,-16).lineTo(-16,-16).stroke({width:1.2,color:8145437});let f=new rd.f;h.root.addChild(u,f),a(v,h.root),o.push({drone:h,flame:f,laneX:l,y1:r.y,y2:s.y,offset:900*t})}),C.x=1500,C.y=480,I.text=String(c.rack.active),F=c.rack.active>0,T.setMode(F?"streaming":"sleeping"),j.setRoutes(h);let p=L;for(let e of(L=s,E=l,A=i,P=o,O(),p))try{e.destroy({children:!0})}catch(e){}}function V(){if(f.screen.width<=0||f.screen.height<=0)return;let e=Math.max(.25,Math.min(f.screen.width/2190,f.screen.height/1020,1));p.scale.set(e),S(Math.max(2150,f.screen.width/e-30),Math.max(980,f.screen.height/e-30)),p.x=(f.screen.width-sC.w*p.scale.x)/2-sC.x*p.scale.x,p.y=(f.screen.height-sC.h*p.scale.y)/2-sC.y*p.scale.y,r.onZoomChange?.(Math.round(100*e))}f.renderer.on("resize",V);let B=e=>{0===e.button&&(c=!0,u=!1,d={x:e.clientX,y:e.clientY},h={x:p.x,y:p.y})},H=e=>{if(!c)return;let t=e.clientX-d.x,r=e.clientY-d.y;Math.hypot(t,r)>4&&(u=!0),p.x=h.x+t,p.y=h.y+r},U=()=>{c=!1},q=t=>{t.preventDefault();let s=e.getBoundingClientRect(),l=t.clientX-s.left,i=t.clientY-s.top,o=t.deltaY<0?1.08:.92,n=p.scale.x,a=Math.max(.25,Math.min(1.15,n*o));if(.001>Math.abs(a-n))return;let c=(l-p.x)/n,d=(i-p.y)/n;p.scale.set(a),p.x=l-c*a,p.y=i-d*a,r.onZoomChange?.(Math.round(100*a))},G=()=>{V()},Y=null,X=e=>{e.preventDefault(),console.warn("[OfficeScene] WebGL context lost - browser reclaimed GPU memory")},K=()=>{console.info("[OfficeScene] WebGL context restored by browser"),Y&&clearTimeout(Y),Y=setTimeout(()=>{try{W(k,!0)}catch(e){console.warn("[OfficeScene] Soft rebuild after context restore:",e)}},200)};e.addEventListener("pointerdown",B),window.addEventListener("pointermove",H),window.addEventListener("pointerup",U),e.addEventListener("wheel",q,{passive:!1}),e.addEventListener("dblclick",G),e.addEventListener("webglcontextlost",X,!1),e.addEventListener("webglcontextrestored",K,!1);let Z=()=>{S(sC.w,sC.h),W(k,!0)};window.addEventListener(tB.o,Z),window.addEventListener(sh.D,Z);let J=0;f.ticker.add(e=>{let t=e.deltaMS;for(let e of(J+=t,j.animate(t),E)){let{ws:t}=e,r="streaming"===t.mode?Math.min(1,t.busy/2):s_[t.mode]??0;e.desk.animate(J,r,t.mode),e.character.animate(J,r);let s=e.toolBadges.length;if(s>0){let r=Math.floor((J+3*t.x)/2200)%s,l=(J+3*t.x)%2200/2200;e.toolBadges.forEach((e,s)=>{let i=s===r;if(e.root.visible=i,!i)return;let o=Math.min(Math.min(1,6*l),Math.min(1,(1-l)*6));e.root.scale.set(1.05*(.35+.65*o)),e.root.alpha=o,e.root.y=t.y-50+2.5*Math.sin(.005*J+s),e.halo.scale.set(1+.12*Math.sin(.01*J))})}if(e.statusBadge){let r="error"===t.mode;e.statusBadge.root.y=t.y-34+Math.sin(J*(r?.02:.004)+t.x)*(r?3:2),e.statusBadge.halo.scale.set(1+Math.sin(J*(r?.016:.008))*(r?.3:.12))}if(e.coin){let r=(J+5*t.x)%3400/3400;e.coin.visible=r<.8,e.coin.y=t.y-24-30*r,e.coin.alpha=Math.sin(Math.min(1,r/.8)*Math.PI)}}for(let{pod:e,operator:t,siren:r}of A)if(t.animate(J,e.overloaded?1:Math.min(1,e.load)),r.clear(),e.overloaded){let e=Math.sin(.014*J)>0;r.circle(0,0,5).fill({color:0xef4444,alpha:e?1:.35}),r.circle(0,0,13).fill({color:0xef4444,alpha:e?.28:.05})}else r.circle(0,0,3).fill({color:e.busy>0?3462041:4674921,alpha:.9});for(let e of P){let t=(J+e.offset)%4500/4500,r=t*t*(3-2*t);e.drone.root.baseX=e.laneX,e.drone.root.baseY=e.y1+(e.y2-e.y1)*r+6,e.drone.animate(J,1),e.flame.clear(),e.flame.ellipse(0,16,7+1.5*Math.sin(.04*J),10+3*Math.sin(.05*J)).fill({color:0xfbbf24,alpha:.55}),e.flame.ellipse(0,14,4,6).fill({color:0xfff1b8,alpha:.85}),e.drone.root.alpha=Math.min(1,8*t)*Math.min(1,(1-t)*8)}T.animate(J,+!!F),z.clear();for(let e=0;e<5;e+=1)for(let t=0;t<6;t+=1)Math.sin(.006*J+1.7*e+.9*t)>(F?-.2:.6)&&z.circle(-40+16*t,56+14*e,2.4).fill({color:e%3==0?3462041:2282478,alpha:.9});M.alpha=F?.5+.3*Math.sin(.005*J):.15});let Q=(e,t)=>{let r=new sn({text:e,style:{fontFamily:(0,sh.l)("ui"),fontSize:11,fill:8227488,fontWeight:"800",letterSpacing:2}});r.x=t,r.y=sC.y+sC.h-52,w.addChild(r)};Q("TOOL CALLS",35),sk.forEach((e,t)=>{let r=sS(e,{size:.72});r.root.x=160+65*t,r.root.y=sC.y+sC.h-40,w.addChild(r.root)}),Q("STATUS",965),sN.forEach((e,t)=>{let r=sS(e,{size:.72});r.root.x=1050+68*t,r.root.y=sC.y+sC.h-40,w.addChild(r.root)});let ee=new sn({text:"● input ◆ output ■ cached",style:{fontFamily:(0,sh.l)("ui"),fontSize:11,fill:8227488,fontWeight:"700"}});return ee.x=1560,ee.y=sC.y+sC.h-50,w.addChild(ee),W(t),V(),{app:f,rebuild:W,fit:V,zoomIn(){let e=Math.min(1.15,1.15*p.scale.x),t=f.screen.width/2,s=f.screen.height/2,l=(t-p.x)/p.scale.x,i=(s-p.y)/p.scale.y;p.scale.set(e),p.x=t-l*e,p.y=s-i*e,r.onZoomChange?.(Math.round(100*e))},zoomOut(){let e=Math.max(.25,.85*p.scale.x),t=f.screen.width/2,s=f.screen.height/2,l=(t-p.x)/p.scale.x,i=(s-p.y)/p.scale.y;p.scale.set(e),p.x=t-l*e,p.y=s-i*e,r.onZoomChange?.(Math.round(100*e))},reset100(){p.scale.set(1),p.x=(f.screen.width-2150)/2-sC.x,p.y=(f.screen.height-980)/2-sC.y,r.onZoomChange?.(100)},setSelected(e){n=e,O()},setOnSelect(e){a=e},destroy:()=>{Y&&clearTimeout(Y);try{e.removeEventListener("pointerdown",B),window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",U),e.removeEventListener("wheel",q),e.removeEventListener("dblclick",G),e.removeEventListener("webglcontextlost",X),e.removeEventListener("webglcontextrestored",K),window.removeEventListener(tB.o,Z),window.removeEventListener(sh.D,Z),f.renderer?.off?.("resize",V)}catch{}try{f.ticker?.stop?.()}catch{}try{let e=f.renderer?.gl;(!e||"function"==typeof e.isContextLost&&e.isContextLost())&&f.renderer?.context?.extensions&&(f.renderer.context.extensions.loseContext=null),f.destroy(!1,{children:!0})}catch(e){console.warn("[OfficeScene] Cleanly handled app.destroy:",e)}}}}function sz({traces:e=[],onStats:t,onSelect:r,selectedId:s=null,isZenFullscreen:l=!1,onToggleZenFullscreen:i=null,soundEnabled:o=!1,onToggleSound:c=null}){let d=(0,a.useRef)(null),h=(0,a.useRef)(null),[u,f]=(0,a.useState)(100),[x,p]=(0,a.useState)(!1),m=(0,a.useRef)({onSelect:r,selectedId:s,traces:e});(0,a.useEffect)(()=>{m.current={onSelect:r,selectedId:s,traces:e}});let[g,b]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let e=!1,t=null,r=d.current;if(!r)return;let s=document.createElement("canvas");return s.style.position="absolute",s.style.inset="0",s.style.width="100%",s.style.height="100%",s.style.display="block",s.style.opacity="0",s.style.transition="opacity 0.2s ease-in-out",r.appendChild(s),(async()=>{try{let r=await sM(s,m.current.traces,{selectedId:m.current.selectedId,onSelect:e=>m.current.onSelect?.(e),onZoomChange:e=>f(e)});if(e){try{r?.destroy?.()}catch{}try{s.remove()}catch{}return}h.current=t=r,s.style.opacity="1",m.current.traces&&m.current.traces.length>0&&t.rebuild?.(m.current.traces)}catch(t){e||(console.error("[OfficeCanvas] mount failed:",t),b(t?.message||"Failed to start the scene"))}})(),()=>{e=!0;try{t?.destroy?.()}catch(e){console.warn("[OfficeCanvas] Cleanup warning:",e)}h.current=null;try{s.remove()}catch{}}},[]),(0,a.useEffect)(()=>{h.current&&h.current.rebuild?.(e)},[e]),(0,a.useEffect)(()=>{let e=()=>{h.current&&h.current.rebuild?.(m.current.traces,!0)};return window.addEventListener(tB.o,e),()=>window.removeEventListener(tB.o,e)},[]),(0,a.useEffect)(()=>{h.current&&h.current.setSelected?.(s)},[s]),(0,a.useEffect)(()=>{if(!t)return;let e=setInterval(()=>{t?.({mounted:!!h.current})},2e3);return()=>clearInterval(e)},[t]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{window.dispatchEvent(new Event("resize")),h.current?.fit?.()},60);return()=>clearTimeout(e)},[l]),(0,a.useEffect)(()=>{if(l){p(!0);let e=setTimeout(()=>p(!1),3500);return()=>clearTimeout(e)}p(!1)},[l]),(0,a.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),i?.(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,i]),(0,n.jsxs)("div",{className:`relative h-full w-full overflow-hidden bg-[#080d14] ${l?"!fixed !inset-0 !z-[99] !w-screen !h-screen !rounded-none !border-none":"rounded-xl border border-slate-800 shadow-2xl"}`,children:[(0,n.jsx)("div",{ref:d,className:"absolute inset-0"}),g&&(0,n.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-rose-400",children:g}),x&&(0,n.jsx)("div",{className:"absolute top-5 left-1/2 -translate-x-1/2 z-30 pointer-events-none transition-all duration-300 animate-in fade-in slide-in-from-top-2",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-slate-950/90 border border-cyan-500/40 text-cyan-200 text-xs shadow-2xl backdrop-blur-md",children:[(0,n.jsx)(eQ.f,{className:"w-4 h-4 text-cyan-400 shrink-0"}),(0,n.jsxs)("span",{children:["Chế độ Chill toàn màn hình · Nhấn ",(0,n.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-800 text-amber-300 font-mono text-[10px]",children:"ESC"})," hoặc click nút góc trên để thoát"]})]})}),l&&(0,n.jsxs)("div",{className:"absolute top-4 right-4 z-30 flex items-center gap-2 animate-in fade-in duration-200",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-slate-950/70 border border-slate-800/80 backdrop-blur-md shadow-xl text-xs text-slate-300 select-none",children:[(0,n.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,n.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),(0,n.jsx)("span",{className:"font-medium text-[11px]",children:"Virtual Office · Chill Mode"}),(0,n.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:["(",e.length," Bots)"]})]}),(0,n.jsxs)("button",{type:"button","data-testid":"exit-zen-fullscreen-btn",onClick:()=>i?.(!1),title:"Thoát chế độ toàn màn hình Chill Mode (ESC)",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-slate-900/80 hover:bg-slate-800 border border-slate-700/60 hover:border-amber-500/50 text-slate-300 hover:text-white backdrop-blur-md shadow-xl transition-all cursor-pointer text-xs font-medium group",children:[(0,n.jsx)(e6.f,{className:"w-3.5 h-3.5 text-amber-400 group-hover:scale-110 transition-transform"}),(0,n.jsx)("span",{className:"text-[11px]",children:"Thoát ESC"})]})]}),(0,n.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-1 rounded-lg border border-slate-800/80 bg-slate-950/80 p-1 backdrop-blur-md shadow-xl text-slate-400",children:[(0,n.jsx)("button",{onClick:()=>h.current?.zoomOut?.(),title:"Zoom out",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,n.jsx)(tQ.f,{className:"w-3.5 h-3.5"})}),(0,n.jsxs)("button",{onClick:()=>h.current?.reset100?.(),title:"Reset to 100% (1:1 natural scale)",className:"px-2 py-1 rounded-md text-[11px] font-mono hover:bg-slate-800 hover:text-slate-200 transition-colors font-semibold text-slate-300 cursor-pointer",children:[u,"%"]}),(0,n.jsx)("button",{onClick:()=>h.current?.zoomIn?.(),title:"Zoom in",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,n.jsx)(tJ.f,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,n.jsx)("button",{onClick:()=>h.current?.fit?.(),title:"Fit to view",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,n.jsx)(e8.f,{className:"w-3.5 h-3.5"})}),i&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,n.jsx)("button",{type:"button","data-testid":"canvas-camera-zen-fullscreen-btn",onClick:()=>i(!l),title:l?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (ESC để thoát)",className:`p-1.5 rounded-md transition-colors cursor-pointer ${l?"bg-amber-500/20 text-amber-300 hover:bg-amber-500/30":"hover:bg-slate-800 hover:text-cyan-300 text-slate-400"}`,children:l?(0,n.jsx)(e6.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,n.jsx)(t1,{className:"w-3.5 h-3.5"})})]}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,n.jsx)("button",{type:"button",onClick:c,title:o?"Âm thanh: BẬT":"Âm thanh: TẮT",className:`p-1.5 rounded-md transition-colors cursor-pointer ${o?"text-emerald-400 hover:bg-slate-800":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,children:o?(0,n.jsx)(eD.f,{className:"w-3.5 h-3.5"}):(0,n.jsx)(eB,{className:"w-3.5 h-3.5"})})]})]})]})}var sR=e.i(21991);function sI({traces:e=[],selectedTraceId:t=null,onSelectTrace:r,activeTurns:s=[],className:l=""}){let i=(0,a.useRef)(null),[o,c]=(0,a.useState)(1),[d,h]=(0,a.useState)({x:100,y:50}),u=(0,a.useRef)(o);u.current=o;let f=(0,a.useRef)(d);f.current=d;let[x,p]=(0,a.useState)(!1),[m,g]=(0,a.useState)({x:0,y:0}),[b,v]=(0,a.useState)(t||e[0]?.traceId||e[0]?.connectionId),y=(0,a.useMemo)(()=>{let t=new Set,r=[];for(let s of e){let e=s.traceId||s.connectionId;!e||t.has(e)||(t.add(e),r.push({id:e,label:`${s.account||s.connectionId} (${s.model||"Gemini"})`}))}return r},[e]);(0,a.useEffect)(()=>{t?v(t):!b&&e.length>0&&v(e[0].traceId||e[0].connectionId)},[t,e,b]);let{nodes:w,edges:j,bounds:k}=(0,a.useMemo)(()=>(function(e=[],t=null,r=[]){if(!Array.isArray(e)||0===e.length)return{nodes:[],edges:[],bounds:{minX:0,maxX:800,minY:0,maxY:600}};let s=e.find(e=>e.traceId===t||e.traces?.[0]?.traceId===t||e.connectionId===t)||e[0],l=[];Array.isArray(r)&&r.forEach((e,t)=>{Array.isArray(e.toolCalls)&&e.toolCalls.forEach(e=>{let r=(e.name||"").toLowerCase();if(r.includes("invoke_subagent")||r.includes("define_subagent")){let r=e.args?.Subagents||e.args?.subagents||e.args;(Array.isArray(r)?r:[r]).forEach((r,i)=>{r&&(r.Role||r.role||r.TypeName||r.name)&&l.push({id:`sub-${t}-${i}-${r.TypeName||r.name||"worker"}`,parentId:s.traceId||s.connectionId,role:r.Role||r.role||"Subagent Worker",typeName:r.TypeName||r.name||"specialist",model:r.Model||r.model||null,prompt:r.Prompt||r.prompt||r.system_prompt||"",workspace:r.Workspace||r.workspace||"inherit",status:"running"===e.status?"streaming":"idle",tokens:null,durationMs:null,isSubagent:!0})})}})});let i=e.filter(e=>!e.parentTraceId);e.filter(e=>e.parentTraceId);let o=[],n=[],a=new Set,c=new Set,d=e=>{!e||!e.id||a.has(e.id)||(a.add(e.id),o.push(e))};(l.length>0?[s]:i.length>0?i:e).forEach(e=>{d({id:e.traceId||e.connectionId,level:0,label:e.account||e.connectionId||"Orchestrator Agent",role:"Lead Orchestrator",model:e.model||null,status:e.state||e.mode||"idle",isLooping:!!e.isLooping,tokens:e.tokens||null,toolsCount:e.tools?.length??e.logs?.length??null,clientType:e.clientType||"cli",color:e.color?`#${e.color.toString(16).padStart(6,"0")}`:"#38bdf8",isRoot:!0,traceRef:e})}),l.length>0&&l.forEach(e=>{var t;d({id:e.id,level:1,parentId:e.parentId,label:e.role,role:e.role,typeName:e.typeName,model:e.model,status:e.status,prompt:e.prompt,tokens:e.tokens,toolsCount:null,clientType:"subagent",color:"#818cf8",isRoot:!1}),!(t={id:`edge-${e.parentId}-${e.id}`,fromId:e.parentId,toId:e.id,active:"streaming"===e.status,label:e.typeName}).id||c.has(t.id)||(c.add(t.id),n.push(t))});let h={};o.forEach(e=>{h[e.level]||(h[e.level]=[]),h[e.level].push(e)});let u=[],f={},x=1;Object.values(h).forEach(e=>{e.length>x&&(x=e.length)});let p=Math.max((320*x-60)/2+100,500);Object.keys(h).forEach(e=>{let t=parseInt(e,10),r=h[t],s=p-(320*r.length-60)/2;r.forEach((e,r)=>{let l=Math.round(s+320*r),i=Math.round(80+280*t),o={...e,x:l,y:i,width:260,height:140};u.push(o),f[e.id]=o})});let m=[];n.forEach(e=>{let t=f[e.fromId],r=f[e.toId];if(t&&r){let s=t.x+t.width/2,l=t.y+t.height,i=r.x+r.width/2,o=r.y,n=Math.max((o-l)/2,40),a=l+n,c=o-n,d=`M ${s} ${l} C ${s} ${a}, ${i} ${c}, ${i} ${o}`;m.push({...e,fromPos:{x:s,y:l},toPos:{x:i,y:o},pathData:d})}});let g=1/0,b=-1/0,v=1/0,y=-1/0;return u.forEach(e=>{e.x<g&&(g=e.x),e.x+e.width>b&&(b=e.x+e.width),e.y<v&&(v=e.y),e.y+e.height>y&&(y=e.y+e.height)}),isFinite(g)||(g=0,b=1e3,v=0,y=700),{nodes:u,edges:m,bounds:{minX:Math.max(0,g-100),maxX:b+100,minY:Math.max(0,v-80),maxY:y+100}}})(e,b,s),[e,b,s]),N=(0,a.useRef)(k);N.current=k;let S=(0,a.useRef)(w.length);S.current=w.length;let C=(0,a.useCallback)(()=>{if(!i.current||0===S.current)return;let{clientWidth:e,clientHeight:t}=i.current,r=N.current,s=r.maxX-r.minX,l=r.maxY-r.minY;if(s<=0||l<=0)return;let o=Math.min(Math.max(Math.min((e-120)/s,(t-120)/l),.3),1.2),n=(r.minX+r.maxX)/2,a=(r.minY+r.maxY)/2,d=e/2-n*o,u=t/2-a*o;c(o),h({x:Math.round(d),y:Math.round(u)})},[]),T=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(b&&b!==T.current&&w.length>0){T.current=b;let e=setTimeout(()=>{C()},100);return()=>clearTimeout(e)}},[b,w.length,C]),(0,a.useEffect)(()=>{let e=()=>p(!1);return window.addEventListener("mouseup",e),()=>window.removeEventListener("mouseup",e)},[]),(0,a.useEffect)(()=>{let e=i.current;if(!e)return;let t=t=>{t.preventDefault();let r=u.current,s=f.current,l=t.deltaY<0?1.08*r:r/1.08;l=Math.min(Math.max(l,.2),3);let i=e.getBoundingClientRect(),o=t.clientX-i.left,n=t.clientY-i.top,a=o-(o-s.x)*(l/r),d=n-(n-s.y)*(l/r);c(l),h({x:Math.round(a),y:Math.round(d)})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let _=w.filter(e=>"streaming"===e.status).length;return(0,n.jsxs)("div",{className:`relative w-full h-full bg-slate-950 overflow-hidden select-none flex flex-col ${l}`,onMouseMove:e=>{x&&h({x:Math.round(e.clientX-m.x),y:Math.round(e.clientY-m.y)})},onMouseUp:()=>{p(!1)},children:[(0,n.jsxs)("div",{className:"absolute top-4 left-4 right-4 z-20 flex items-center justify-between pointer-events-none",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl px-3 py-1.5 shadow-xl backdrop-blur-md text-xs",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"p-1 rounded-lg bg-indigo-500/10 text-indigo-400 border border-indigo-500/20",children:(0,n.jsx)(tn.f,{className:"w-4 h-4"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-slate-200 block text-xs",children:"Multi-Agent DAG"}),(0,n.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:[w.length," agents • ",j.length," links ",_>0&&`• ${_} running`]})]})]}),(0,n.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-1"}),(0,n.jsx)("select",{value:b||"",onChange:e=>v(e.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 font-mono focus:outline-none focus:border-indigo-500/50 cursor-pointer",children:y.map(e=>(0,n.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl p-1 shadow-xl backdrop-blur-md",children:[(0,n.jsx)("button",{onClick:()=>{let e=u.current,t=f.current,r=Math.min(1.2*e,3);if(i.current){let{clientWidth:s,clientHeight:l}=i.current,o=s/2,n=l/2;h({x:Math.round(o-(o-t.x)*(r/e)),y:Math.round(n-(n-t.y)*(r/e))})}c(r)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom In (+)",children:(0,n.jsx)(tJ.f,{className:"w-4 h-4"})}),(0,n.jsxs)("span",{className:"text-[11px] font-mono text-slate-400 px-2 min-w-12 text-center",children:[Math.round(100*o),"%"]}),(0,n.jsx)("button",{onClick:()=>{let e=u.current,t=f.current,r=Math.max(e/1.2,.2);if(i.current){let{clientWidth:s,clientHeight:l}=i.current,o=s/2,n=l/2;h({x:Math.round(o-(o-t.x)*(r/e)),y:Math.round(n-(n-t.y)*(r/e))})}c(r)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom Out (-)",children:(0,n.jsx)(tQ.f,{className:"w-4 h-4"})}),(0,n.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-0.5"}),(0,n.jsxs)("button",{onClick:C,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-colors",title:"Fit to Screen",children:[(0,n.jsx)(e8.f,{className:"w-3.5 h-3.5 text-indigo-400"}),(0,n.jsx)("span",{children:"Fit"})]})]})]}),(0,n.jsxs)("div",{ref:i,onMouseDown:e=>{e.target.closest("button")||e.target.closest(".agent-node-card")||e.target.closest("select")||(p(!0),g({x:e.clientX-f.current.x,y:e.clientY-f.current.y}))},onDoubleClick:e=>{e.target.closest("button")||e.target.closest(".agent-node-card")||e.target.closest("select")||C()},className:"flex-1 w-full h-full relative cursor-grab active:cursor-grabbing overflow-hidden",children:[(0,n.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-20",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("defs",{children:(0,n.jsx)("pattern",{id:"dag-grid",width:"28",height:"28",patternUnits:"userSpaceOnUse",children:(0,n.jsx)("circle",{cx:"2",cy:"2",r:"1.2",fill:"#64748b"})})}),(0,n.jsx)("rect",{width:"100%",height:"100%",fill:"url(#dag-grid)"})]}),(0,n.jsxs)("div",{style:{transform:`translate(${d.x}px, ${d.y}px) scale(${o})`,transformOrigin:"0 0",transition:x?"none":"transform 0.1s ease-out"},className:"absolute top-0 left-0",children:[(0,n.jsxs)("svg",{className:"overflow-visible pointer-events-none absolute top-0 left-0",style:{width:1,height:1},children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:"edge-pulse-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"#38bdf8"}),(0,n.jsx)("stop",{offset:"50%",stopColor:"#818cf8"}),(0,n.jsx)("stop",{offset:"100%",stopColor:"#c084fc"})]}),(0,n.jsx)("marker",{id:"dag-arrow",viewBox:"0 0 10 10",refX:"6",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,n.jsx)("path",{d:"M 0 1 L 8 5 L 0 9 z",fill:"#6366f1"})})]}),j.map(e=>{let t=e.active;return(0,n.jsxs)("g",{children:[(0,n.jsx)("path",{d:e.pathData,fill:"none",stroke:"#1e293b",strokeWidth:"4",strokeLinecap:"round"}),(0,n.jsx)("path",{d:e.pathData,fill:"none",stroke:t?"url(#edge-pulse-gradient)":"#475569",strokeWidth:t?"2.5":"1.8",strokeDasharray:t?"8 6":"none",strokeLinecap:"round",className:t?"animate-pulse":""}),(0,n.jsx)("circle",{cx:e.toPos.x,cy:e.toPos.y,r:t?"4.5":"3",fill:t?"#38bdf8":"#64748b",className:t?"animate-ping":""}),e.label&&(0,n.jsxs)("g",{transform:`translate(${(e.fromPos.x+e.toPos.x)/2}, ${(e.fromPos.y+e.toPos.y)/2})`,children:[(0,n.jsx)("rect",{x:"-38",y:"-10",width:"76",height:"20",rx:"6",fill:"#090d16",stroke:"#334155",strokeWidth:"1"}),(0,n.jsx)("text",{x:"0",y:"4",textAnchor:"middle",fill:"#94a3b8",fontSize:"9",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"600",children:e.label})]})]},e.id)})]}),(0,n.jsx)("div",{className:"relative",children:w.map(e=>{let t="streaming"===e.status,s="done"===e.status,l=e.isLooping?{text:"Loop Alert",color:"text-rose-400 bg-rose-500/10 border-rose-500/30",dot:"bg-rose-500 animate-ping"}:t?{text:"Running",color:"text-cyan-300 bg-cyan-500/10 border-cyan-500/30",dot:"bg-cyan-400 animate-ping"}:s?{text:"Completed",color:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",dot:"bg-emerald-400"}:{text:"Idle",color:"text-slate-400 bg-slate-800/60 border-slate-700/60",dot:"bg-slate-500"};return(0,n.jsxs)("div",{style:{position:"absolute",left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},onClick:()=>{e.traceRef&&r?.(e.traceRef)},className:`agent-node-card rounded-2xl border transition-all duration-200 cursor-pointer shadow-xl backdrop-blur-md p-3.5 flex flex-col justify-between select-text group hover:scale-[1.02] ${e.isRoot?"bg-slate-900/95 border-cyan-500/40 hover:border-cyan-400 hover:shadow-cyan-500/10":"bg-slate-900/85 border-slate-800 hover:border-indigo-500/50 hover:shadow-indigo-500/10"}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsx)("div",{className:"w-8 h-8 rounded-xl border flex items-center justify-center shrink-0 shadow-inner",style:{borderColor:e.color,backgroundColor:`${e.color}20`},children:(0,n.jsx)(eF.f,{className:"w-4 h-4",style:{color:e.color}})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"font-semibold text-slate-100 text-xs truncate",children:e.label}),(0,n.jsx)("div",{className:"text-[10px] text-slate-400 truncate flex items-center gap-1",children:(0,n.jsx)("span",{children:e.role})})]})]}),(0,n.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-mono border font-semibold ${l.color}`,children:[(0,n.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),(0,n.jsx)("span",{children:l.text})]})]}),(0,n.jsx)("div",{className:"my-1.5",children:e.prompt?(0,n.jsx)("p",{className:"text-[11px] text-slate-300 font-mono line-clamp-2 leading-relaxed bg-black/40 p-1.5 rounded-lg border border-slate-800/80",children:e.prompt}):(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-slate-400",children:[(0,n.jsx)(tl.f,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,n.jsx)("span",{className:"truncate font-mono",children:e.model})]})}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-1.5 border-t border-slate-800/80 text-[10px] text-slate-400 font-mono",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(tg.f,{className:"w-3 h-3 text-indigo-400"}),(0,n.jsx)("span",{className:"truncate max-w-24",children:e.model})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[e.toolsCount>0&&(0,n.jsxs)("span",{children:[e.toolsCount," tools"]}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),e.traceRef&&r?.(e.traceRef)},className:"opacity-0 group-hover:opacity-100 p-1 rounded bg-slate-800 hover:bg-slate-700 text-slate-200 transition-opacity",title:"View chat session for this agent",children:(0,n.jsx)(sR.f,{className:"w-3 h-3"})})]})]})]},e.id)})})]})]})]})}var sL=e.i(22392);function sE(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,s=Array(t);r<t;r++)s[r]=e[r];return s}function sA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function sP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sA(Object(r),!0).forEach(function(t){var s;s=r[t],t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sA(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function sF(e){return function t(){for(var r=this,s=arguments.length,l=Array(s),i=0;i<s;i++)l[i]=arguments[i];return l.length>=e.length?e.apply(this,l):function(){for(var e=arguments.length,s=Array(e),i=0;i<e;i++)s[i]=arguments[i];return t.apply(r,[].concat(l,s))}}}function s$(e){return({}).toString.call(e).includes("Object")}function sO(e){return"function"==typeof e}var sD=sF(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),sW=function(e,t){return s$(t)||sD("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&sD("changeField"),t},sV=function(e){sO(e)||sD("selectorType")},sB=function(e){sO(e)||s$(e)||sD("handlerType"),s$(e)&&Object.values(e).some(function(e){return!sO(e)})&&sD("handlersType")},sH=function(e){e||sD("initialIsRequired"),s$(e)||sD("initialType"),Object.keys(e).length||sD("initialContent")};function sU(e,t){return sO(t)?t(e.current):t}function sq(e,t){return e.current=sP(sP({},e.current),t),t}function sG(e,t,r){return sO(t)?t(e.current):Object.keys(r).forEach(function(r){var s;return null==(s=t[r])?void 0:s.call(t,e.current[r])}),r}var sY={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},sX=(i=function(e,t){throw Error(e[t]||e.default)},function e(){for(var t=this,r=arguments.length,s=Array(r),l=0;l<r;l++)s[l]=arguments[l];return s.length>=i.length?i.apply(this,s):function(){for(var r=arguments.length,l=Array(r),i=0;i<r;i++)l[i]=arguments[i];return e.apply(t,[].concat(s,l))}})(sY),sK=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}},sZ={type:"cancelation",msg:"operation is manually canceled"};function sJ(e){var t=!1,r=new Promise(function(r,s){e.then(function(e){return t?s(sZ):r(e)}),e.catch(s)});return r.cancel=function(){return t=!0},r}var sQ=function(e){if(Array.isArray(e))return e}(o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};sH(e),sB(t);var r={current:e},s=sF(sG)(r,t),l=sF(sq)(r),i=sF(sW)(e),o=sF(sU)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return sV(e),e(r.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(s,l,i,o)(e)}]}({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,s,l,i,o=[],n=!0,a=!1;try{l=(t=t.call(e)).next,!1;for(;!(n=(r=l.call(t)).done)&&(o.push(r.value),2!==o.length);n=!0);}catch(e){a=!0,s=e}finally{try{if(!n&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(a)throw s}}return o}}(o)||function(e){if(e){if("string"==typeof e)return sE(e,2);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?sE(e,2):void 0}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s0=sQ[0],s1=sQ[1];function s2(e){return document.body.appendChild(e)}function s5(e){var t,r,s=s0(function(e){return{config:e.config,reject:e.reject}}),l=(t="".concat(s.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return l.onload=function(){return e()},l.onerror=s.reject,l}function s3(){var e=s0(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){var r=t.m||t;s4(r),e.resolve(r)},function(t){e.reject(t)})}function s4(e){s0().monaco||s1({monaco:e})}var s8=new Promise(function(e,t){return s1({resolve:e,reject:t})}),s6=function(){var e=s0(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(s1({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),sJ(s8);if(window.monaco&&window.monaco.editor)return s4(window.monaco),e.resolve(window.monaco),sJ(s8);sK(s2,s5)(s3)}return sJ(s8)},s7={display:"flex",position:"relative",textAlign:"initial"},s9={width:"100%"},le={display:"none"},lt={display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"},lr=function({children:e}){return a.default.createElement("div",{style:lt},e)},ls=(0,a.memo)(function({width:e,height:t,isEditorReady:r,loading:s,_ref:l,className:i,wrapperProps:o}){return a.default.createElement("section",{style:{...s7,width:e,height:t},...o},!r&&a.default.createElement(lr,null,s),a.default.createElement("div",{ref:l,style:{...s9,...!r&&le},className:i}))}),ll=function(e){(0,a.useEffect)(e,[])},li=function(e,t,r=!0){let s=(0,a.useRef)(!0);(0,a.useEffect)(s.current||!r?()=>{s.current=!1}:e,t)};function lo(){}function ln(e,t,r,s){var l,i,o,n,a,c;return l=e,i=s,l.editor.getModel(la(l,i))||(o=e,n=t,a=r,c=s,o.editor.createModel(n,a,c?la(o,c):void 0))}function la(e,t){return e.Uri.parse(t)}(0,a.memo)(function({original:e,modified:t,language:r,originalLanguage:s,modifiedLanguage:l,originalModelPath:i,modifiedModelPath:o,keepCurrentOriginalModel:n=!1,keepCurrentModifiedModel:c=!1,theme:d="light",loading:h="Loading...",options:u={},height:f="100%",width:x="100%",className:p,wrapperProps:m={},beforeMount:g=lo,onMount:b=lo}){let[v,y]=(0,a.useState)(!1),[w,j]=(0,a.useState)(!0),k=(0,a.useRef)(null),N=(0,a.useRef)(null),S=(0,a.useRef)(null),C=(0,a.useRef)(b),T=(0,a.useRef)(g),_=(0,a.useRef)(!1);ll(()=>{let e=s6();return e.then(e=>(N.current=e)&&j(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return k.current?(t=k.current?.getModel(),void(n||t?.original?.dispose(),c||t?.modified?.dispose(),k.current?.dispose())):e.cancel()}}),li(()=>{if(k.current&&N.current){let t=k.current.getOriginalEditor(),l=ln(N.current,e||"",s||r||"text",i||"");l!==t.getModel()&&t.setModel(l)}},[i],v),li(()=>{if(k.current&&N.current){let e=k.current.getModifiedEditor(),s=ln(N.current,t||"",l||r||"text",o||"");s!==e.getModel()&&e.setModel(s)}},[o],v),li(()=>{let e=k.current.getModifiedEditor();e.getOption(N.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],v),li(()=>{k.current?.getModel()?.original.setValue(e||"")},[e],v),li(()=>{let{original:e,modified:t}=k.current.getModel();N.current.editor.setModelLanguage(e,s||r||"text"),N.current.editor.setModelLanguage(t,l||r||"text")},[r,s,l],v),li(()=>{N.current?.editor.setTheme(d)},[d],v),li(()=>{k.current?.updateOptions(u)},[u],v);let M=(0,a.useCallback)(()=>{if(!N.current)return;T.current(N.current);let n=ln(N.current,e||"",s||r||"text",i||""),a=ln(N.current,t||"",l||r||"text",o||"");k.current?.setModel({original:n,modified:a})},[r,t,l,e,s,i,o]),z=(0,a.useCallback)(()=>{!_.current&&S.current&&(k.current=N.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...u}),M(),N.current?.editor.setTheme(d),y(!0),_.current=!0)},[u,d,M]);return(0,a.useEffect)(()=>{v&&C.current(k.current,N.current)},[v]),(0,a.useEffect)(()=>{w||v||z()},[w,v,z]),a.default.createElement(ls,{width:x,height:f,isEditorReady:v,loading:h,_ref:S,className:p,wrapperProps:m})});var lc=function(e){let t=(0,a.useRef)();return(0,a.useEffect)(()=>{t.current=e},[e]),t.current},ld=new Map,lh=(0,a.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:s,language:l,path:i,theme:o="light",line:n,loading:c="Loading...",options:d={},overrideServices:h={},saveViewState:u=!0,keepCurrentModel:f=!1,width:x="100%",height:p="100%",className:m,wrapperProps:g={},beforeMount:b=lo,onMount:v=lo,onChange:y,onValidate:w=lo}){let[j,k]=(0,a.useState)(!1),[N,S]=(0,a.useState)(!0),C=(0,a.useRef)(null),T=(0,a.useRef)(null),_=(0,a.useRef)(null),M=(0,a.useRef)(v),z=(0,a.useRef)(b),R=(0,a.useRef)(),I=(0,a.useRef)(s),L=lc(i),E=(0,a.useRef)(!1),A=(0,a.useRef)(!1);ll(()=>{let e=s6();return e.then(e=>(C.current=e)&&S(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>T.current?void(R.current?.dispose(),f?u&&ld.set(i,T.current.saveViewState()):T.current.getModel()?.dispose(),T.current.dispose()):e.cancel()}),li(()=>{let o=ln(C.current,e||s||"",t||l||"",i||r||"");o!==T.current?.getModel()&&(u&&ld.set(L,T.current?.saveViewState()),T.current?.setModel(o),u&&T.current?.restoreViewState(ld.get(i)))},[i],j),li(()=>{T.current?.updateOptions(d)},[d],j),li(()=>{T.current&&void 0!==s&&(T.current.getOption(C.current.editor.EditorOption.readOnly)?T.current.setValue(s):s!==T.current.getValue()&&(A.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),T.current.pushUndoStop(),A.current=!1))},[s],j),li(()=>{let e=T.current?.getModel();e&&l&&C.current?.editor.setModelLanguage(e,l)},[l],j),li(()=>{void 0!==n&&T.current?.revealLine(n)},[n],j),li(()=>{C.current?.editor.setTheme(o)},[o],j);let P=(0,a.useCallback)(()=>{if(!(!_.current||!C.current)&&!E.current){z.current(C.current);let a=i||r,c=ln(C.current,s||e||"",t||l||"",a||"");T.current=C.current?.editor.create(_.current,{model:c,automaticLayout:!0,...d},h),u&&T.current.restoreViewState(ld.get(a)),C.current.editor.setTheme(o),void 0!==n&&T.current.revealLine(n),k(!0),E.current=!0}},[e,t,r,s,l,i,d,h,u,o,n]);return(0,a.useEffect)(()=>{j&&M.current(T.current,C.current)},[j]),(0,a.useEffect)(()=>{N||j||P()},[N,j,P]),I.current=s,(0,a.useEffect)(()=>{j&&y&&(R.current?.dispose(),R.current=T.current?.onDidChangeModelContent(e=>{A.current||y(T.current.getValue(),e)}))},[j,y]),(0,a.useEffect)(()=>{if(j){let e=C.current.editor.onDidChangeMarkers(e=>{let t=T.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=C.current.editor.getModelMarkers({resource:t});w?.(e)}});return()=>{e?.dispose()}}return()=>{}},[j,w]),a.default.createElement(ls,{width:x,height:p,isEditorReady:j,loading:c,_ref:_,className:m,wrapperProps:g})});let lu={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};lu.node;let lf=(0,eW.f)(lu),lx={name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]};lx.node;let lp=(0,eW.f)(lx);var lm=e.i(72382);let lg={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};lg.node;let lb=(0,eW.f)(lg);var lv=e.i(99847),ly=e.i(15170),lw=e.i(59928),lj=e.i(89360);function lk({filePath:e,fileMeta:t,isSvg:r=!1,onToggleSvgSource:s,onClose:l}){let[i,o]=(0,a.useState)(1),[c,d]=(0,a.useState)({x:0,y:0}),[h,u]=(0,a.useState)(!1),[f,x]=(0,a.useState)({x:0,y:0}),[p,m]=(0,a.useState)(!0),[g,b]=(0,a.useState)({width:0,height:0}),[v,y]=(0,a.useState)(!1),[w,j]=(0,a.useState)(!1),[k,N]=(0,a.useState)(!1),S=(0,a.useRef)(null),C=(0,a.useRef)(null),T=(0,a.useMemo)(()=>t?.mediaUrl?t.mediaUrl:e?`/api/media?path=${encodeURIComponent(e)}`:"",[t,e]),_=(0,a.useMemo)(()=>t?.name?t.name:e?e.split("/").pop()||e:"image",[t,e]),M=(0,a.useMemo)(()=>{if(t?.ext)return t.ext.replace(".","").toUpperCase();let e=_.split(".");return e.length>1?e.pop().toUpperCase():"IMG"},[t,_]),z=(0,a.useMemo)(()=>{if(!t?.size)return null;let e=t.size;return e>=1048576?`${(e/1048576).toFixed(2)} MB`:`${Math.round(e/1024)} KB`},[t]),R=()=>{u(!1)};return(0,n.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden select-none",children:[(0,n.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 text-xs z-10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,n.jsx)(tN,{filename:_,size:15}),(0,n.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:_,children:_}),(0,n.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:e,children:e})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,n.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-teal-300 font-bold uppercase",children:M}),g.width>0&&(0,n.jsxs)("span",{children:[g.width," × ",g.height," px"]}),z&&(0,n.jsx)("span",{children:z})]}),(0,n.jsxs)("button",{onClick:()=>{e&&(navigator.clipboard.writeText(e),N(!0),setTimeout(()=>N(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${k?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy absolute file path",children:[k?(0,n.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{className:"hidden lg:inline",children:k?"Copied!":"Copy Path"})]}),(0,n.jsx)("button",{onClick:()=>m(e=>!e),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${p?"text-teal-400":""}`,title:`Toggle Transparent Checkerboard (${p?"ON":"OFF"})`,children:(0,n.jsx)(lw.f,{className:"w-3.5 h-3.5"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 py-0.5",children:[(0,n.jsx)("button",{onClick:()=>{o(e=>Math.max(Number((e-.25).toFixed(2)),.25))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom Out",children:(0,n.jsx)(tQ.f,{className:"w-3.5 h-3.5"})}),(0,n.jsxs)("button",{onClick:()=>{o(1),d({x:0,y:0})},className:"text-[10px] font-mono font-bold text-teal-300 px-1 hover:text-white cursor-pointer",title:"Reset Zoom to 100%",children:[Math.round(100*i),"%"]}),(0,n.jsx)("button",{onClick:()=>{o(e=>Math.min(Number((e+.25).toFixed(2)),5))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom In",children:(0,n.jsx)(tJ.f,{className:"w-3.5 h-3.5"})})]}),(0,n.jsx)("button",{onClick:()=>{if(!S.current||!g.width||!g.height)return;let e=S.current.clientWidth-40,t=S.current.clientHeight-40;o(Number(Math.min(e/g.width,t/g.height,1).toFixed(2))),d({x:0,y:0})},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Fit to Screen",children:(0,n.jsx)(e8.f,{className:"w-3.5 h-3.5"})}),r&&s&&(0,n.jsxs)("button",{onClick:s,className:"flex items-center gap-1 px-2 py-1 rounded bg-[#2d2d2d] hover:bg-[#383838] border border-[#3e3e42] text-xs text-amber-300 hover:text-white transition-colors cursor-pointer",title:"View & Edit SVG Source Code",children:[(0,n.jsx)(lj.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"SVG Code"})]}),(0,n.jsx)("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Open raw image in browser",children:(0,n.jsx)(sR.f,{className:"w-3.5 h-3.5"})}),l&&(0,n.jsx)("button",{onClick:l,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close image tab",children:(0,n.jsx)(tM.X,{className:"w-3.5 h-3.5"})})]})]}),(0,n.jsxs)("div",{ref:S,onWheel:e=>{e.preventDefault(),e.deltaY<0?o(e=>Math.min(Number((e+.1).toFixed(2)),5)):o(e=>Math.max(Number((e-.1).toFixed(2)),.25))},onMouseDown:e=>{0===e.button&&(u(!0),x({x:e.clientX-c.x,y:e.clientY-c.y}))},onMouseMove:e=>{h&&d({x:e.clientX-f.x,y:e.clientY-f.y})},onMouseUp:R,onMouseLeave:R,className:`flex-1 relative overflow-hidden flex items-center justify-center ${h?"cursor-grabbing":"cursor-grab"} ${p?"bg-[#141414] [background-image:linear-gradient(45deg,#1f1f1f_25%,transparent_25%),linear-gradient(-45deg,#1f1f1f_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#1f1f1f_75%),linear-gradient(-45deg,transparent_75%,#1f1f1f_75%)] [background-size:20px_20px] [background-position:0_0,0_10px,10px_-10px,-10px_0px]":"bg-[#121212]"}`,children:[!v&&!w&&(0,n.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-400",children:[(0,n.jsx)(eO.f,{className:"w-6 h-6 animate-spin text-teal-400"}),(0,n.jsx)("span",{className:"text-xs font-mono",children:"Loading image..."})]}),w?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,n.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,n.jsx)(lv.f,{className:"w-5 h-5"})}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot display image"}),(0,n.jsxs)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:["Unable to load image from ",T]})]}):(0,n.jsx)("div",{style:{transform:`translate(${c.x}px, ${c.y}px) scale(${i})`,transformOrigin:"center center",transition:h?"none":"transform 0.15s ease-out"},className:"inline-block transition-transform select-none",children:(0,n.jsx)("img",{ref:C,src:T,alt:_,onLoad:e=>{let{naturalWidth:t,naturalHeight:r}=e.target;b({width:t,height:r}),y(!0),j(!1)},onError:()=>{y(!1),j(!0)},draggable:!1,className:`max-w-none shadow-2xl rounded-sm ${v?"opacity-100":"opacity-0"}`})}),(0,n.jsxs)("div",{className:"absolute bottom-3 left-3 bg-[#1e1e1e]/90 backdrop-blur-xs border border-[#3e3e42] rounded px-2.5 py-1 text-[10px] text-slate-400 flex items-center gap-2 pointer-events-none",children:[(0,n.jsx)(ly.f,{className:"w-3 h-3 text-teal-400"}),(0,n.jsx)("span",{children:"Drag to pan · Scroll to zoom"})]})]})]})}var lN=e.i(75276);function lS({content:e="",filePath:t="",className:r=""}){return(0,n.jsx)("div",{className:`h-full w-full overflow-y-auto bg-[#1e1e1e] p-6 lg:p-8 select-text ${r}`,children:(0,n.jsx)("div",{className:"max-w-4xl mx-auto bg-[#1e1e1e] pb-16",children:(0,n.jsx)(lN.f,{content:e})})})}function lC({filePath:e,initialContent:t=null,readOnly:r=!1,onClose:s,onSave:l}){let[i,o]=(0,a.useState)(t||""),[c,d]=(0,a.useState)(t||""),[h,u]=(0,a.useState)(null),[f,x]=(0,a.useState)(!t),[p,m]=(0,a.useState)(null),[g,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[w,j]=(0,a.useState)(!1),[k,N]=(0,a.useState)("on"),[S,C]=(0,a.useState)(!0),[T,_]=(0,a.useState)("vs-dark"),[M,z]=(0,a.useState)('ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'),[R,I]=(0,a.useState)(13),[L,E]=(0,a.useState)("preview"),[A,P]=(0,a.useState)("image"),F=(0,a.useMemo)(()=>e?e.split("/").pop()||e:"untitled",[e]);(0,a.useEffect)(()=>{let e=()=>{let e=(0,sh._)();"light-plus"===e.theme?_("vs"):_("vs-dark"),z((0,sh.l)("mono")),e.fontSize&&I(parseInt(e.fontSize,10)||13)};return e(),window.addEventListener(sh.D,e),()=>window.removeEventListener(sh.D,e)},[]);let $=(0,a.useCallback)(async()=>{if(e){x(!0),m(null);try{let t=await fetch(`/api/workspace/file-content?path=${encodeURIComponent(e)}`),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to load file content");o(r.content||""),d(r.content||""),u(r)}catch(e){m(e.message)}finally{x(!1)}}},[e]);(0,a.useEffect)(()=>{$()},[$]);let O=(0,a.useMemo)(()=>i!==c,[i,c]),D=async()=>{if(e&&!r&&!v){y(!0);try{let t=await fetch("/api/workspace/file-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:i})}),r=await t.json();if(!t.ok)throw Error(r.error||"Save failed");d(i),j(!0),setTimeout(()=>j(!1),2e3),l?.(e,i)}catch(e){alert(`Save error: ${e.message}`)}finally{y(!1)}}};(0,a.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),D())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,e,r]);let W=(0,a.useMemo)(()=>i?i.split("\n").length:0,[i]),V=h?.language||"plaintext",B=!!(h?.isImage&&!h?.isSvg),H=!!h?.isSvg,U="markdown"===V||F.endsWith(".md")||F.endsWith(".markdown")||F.endsWith(".mdx");return!B||f||p?!H||"image"!==A||f||p?(0,n.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-slate-200 overflow-hidden select-text",children:[(0,n.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 select-none text-xs",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,n.jsx)(tN,{filename:F,size:15}),(0,n.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:F,children:F}),O&&(0,n.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0",title:"Modified"}),(0,n.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:e,children:e})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[U&&(0,n.jsxs)("div",{className:"flex items-center bg-[#1e1e1e] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[(0,n.jsx)("button",{onClick:()=>E("edit"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"edit"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Monaco Source Editor",children:"Code"}),(0,n.jsx)("button",{onClick:()=>E("preview"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"preview"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Formatted Markdown Preview",children:"Preview"}),(0,n.jsx)("button",{onClick:()=>E("split"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"split"===L?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Side-by-side Edit & Live Preview",children:"Split"})]}),H&&"code"===A&&(0,n.jsxs)("button",{onClick:()=>P("image"),className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#1e1e1e] hover:bg-[#333333] border border-[#3e3e42] text-[10px] text-teal-300 hover:text-white transition-colors cursor-pointer",title:"Switch to Rendered SVG Image View",children:[(0,n.jsx)(ly.f,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"Image View"})]}),(0,n.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,n.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-cyan-300 font-bold uppercase",children:V}),(0,n.jsxs)("span",{children:[W," lines"]}),(0,n.jsx)("span",{children:"UTF-8"})]}),(0,n.jsxs)("button",{onClick:()=>{i&&(navigator.clipboard.writeText(i),b(!0),setTimeout(()=>b(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${g?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy file content to clipboard",children:[g?(0,n.jsx)(tW.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{className:"hidden lg:inline",children:g?"Copied!":"Copy"})]}),!r&&(0,n.jsxs)("button",{onClick:D,disabled:!O||v,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-colors cursor-pointer border font-semibold ${w?"bg-emerald-600 text-white border-emerald-500":O?"bg-[#007acc] hover:bg-[#0062a3] text-white border-[#007acc] shadow-sm animate-pulse":"bg-[#2d2d2d] border-[#3e3e42] text-slate-500 cursor-not-allowed opacity-50"}`,title:"Save changes (Cmd+S / Ctrl+S)",children:[(0,n.jsx)(lf,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:v?"Saving...":w?"Saved!":"Save"})]}),(!U||"preview"!==L)&&(0,n.jsx)("button",{onClick:()=>N(e=>"on"===e?"off":"on"),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${"on"===k?"text-cyan-400":""}`,title:`Toggle Word Wrap (${"on"===k?"ON":"OFF"})`,children:(0,n.jsx)(lp,{className:"w-3.5 h-3.5"})}),(!U||"preview"!==L)&&(0,n.jsx)("button",{onClick:()=>C(e=>!e),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${S?"text-cyan-400":""}`,title:`Toggle Minimap (${S?"Show":"Hide"})`,children:S?(0,n.jsx)(lm.f,{className:"w-3.5 h-3.5"}):(0,n.jsx)(lb,{className:"w-3.5 h-3.5"})}),(0,n.jsx)("button",{onClick:$,className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Reload from disk",children:(0,n.jsx)(eO.f,{className:`w-3.5 h-3.5 ${f?"animate-spin text-emerald-400":""}`})}),s&&(0,n.jsx)("button",{onClick:s,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close editor tab",children:(0,n.jsx)(tM.X,{className:"w-3.5 h-3.5"})})]})]}),(0,n.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#1e1e1e]",children:f?(0,n.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-slate-400",children:[(0,n.jsx)(eO.f,{className:"w-6 h-6 animate-spin text-[#007acc]"}),(0,n.jsxs)("span",{className:"text-xs font-mono",children:["Loading ",F,"..."]})]}):p?(0,n.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,n.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,n.jsx)(lv.f,{className:"w-5 h-5"})}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot load file"}),(0,n.jsx)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:p}),(0,n.jsx)("button",{onClick:$,className:"px-3 py-1.5 rounded bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-xs text-slate-200 cursor-pointer",children:"Retry"})]}):U&&"preview"===L?(0,n.jsx)(lS,{content:i,filePath:e}):U&&"split"===L?(0,n.jsxs)("div",{className:"flex h-full w-full divide-x divide-[#2b2b2b]",children:[(0,n.jsx)("div",{className:"w-1/2 h-full overflow-hidden",children:(0,n.jsx)(lh,{height:"100%",path:e,language:V,value:i,onChange:e=>o(e||""),theme:T,options:{readOnly:r,fontSize:R,fontFamily:M,minimap:{enabled:S},scrollBeyondLastLine:!1,wordWrap:k,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})}),(0,n.jsx)("div",{className:"w-1/2 h-full overflow-hidden bg-[#1e1e1e]",children:(0,n.jsx)(lS,{content:i,filePath:e})})]}):(0,n.jsx)(lh,{height:"100%",path:e,language:V,value:i,onChange:e=>o(e||""),theme:T,options:{readOnly:r,fontSize:R,fontFamily:M,minimap:{enabled:S},scrollBeyondLastLine:!1,wordWrap:k,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})})]}):(0,n.jsx)(lk,{filePath:e,fileMeta:h,isSvg:!0,onToggleSvgSource:()=>P("code"),onClose:s}):(0,n.jsx)(lk,{filePath:e,fileMeta:h,onClose:s})}var lT=e.i(74363);e.i(2043);var l_=e.i(95554),lM=e.i(15267);let lz={name:"shield-check",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:"m9 12 2 2 4-4",key:"dzmm74"}]]};lz.node;let lR=(0,eW.f)(lz);function lI({isOpen:e,onClose:t}){let[r,s]=(0,a.useState)((0,tB.F)());return(0,a.useEffect)(()=>{let e=e=>{s(e.detail||(0,tB.F)())};return window.addEventListener(tB.o,e),()=>window.removeEventListener(tB.o,e)},[]),(0,n.jsx)(l_.f,{isOpen:e,onClose:t,title:`Supporter Store & Vault (${tT.E} Tech Items & 3D Effects)`,description:"Support the developer to maintain the project and unlock custom AGMon virtual office decorations",size:"full",footer:(0,n.jsxs)("div",{className:"flex items-center justify-between w-full text-xs text-slate-400",children:[(0,n.jsx)("div",{className:"flex items-center gap-2",children:r.isSupporter?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 text-amber-400 font-semibold",children:[(0,n.jsx)(lR,{className:"w-4 h-4 text-amber-400"}),(0,n.jsxs)("span",{children:["Status: VIP Supporter Activated (All ",tT.E," items unlocked)"]})]}):(0,n.jsx)("span",{children:"100% of AGMon core engineering features remain completely free"})}),(0,n.jsx)(lM.f,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]}),children:(0,n.jsx)("div",{className:"h-[80vh] -mx-4 -mt-2 -mb-4 overflow-hidden rounded-md border border-[#333333]",children:(0,n.jsx)(lT.f,{hideHeader:!0,onClose:t})})})}function lL({isOpen:e=!1,onClose:t,initialTab:r="themes"}){let[s,l]=(0,a.useState)(r||"themes"),[i,o]=(0,a.useState)(sh.s);if((0,a.useEffect)(()=>{e&&(o((0,sh._)()),l(r||"themes"))},[e,r]),(0,a.useEffect)(()=>{let e=e=>{e.detail&&o(e.detail)};return window.addEventListener(sh.D,e),()=>window.removeEventListener(sh.D,e)},[]),!e)return null;let c=(e,t)=>{let r={...i,[e]:t};o(r),(0,sh.Y)(r)};return(0,n.jsx)("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-in fade-in",children:(0,n.jsxs)("div",{className:"w-full max-w-2xl bg-[var(--bg-editor)] border border-[var(--border-card)] rounded-xl shadow-2xl overflow-hidden flex flex-col text-[var(--text-main)] font-sans max-h-[85vh]",children:[(0,n.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(eJ.f,{className:"w-4 h-4 text-[var(--accent-primary)]"}),(0,n.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-[var(--text-bright)]",children:"Preferences: Theme & Typography (VS Code Settings)"})]}),(0,n.jsx)("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",title:"Close (Escape)",children:(0,n.jsx)(tM.X,{className:"w-4 h-4"})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-[var(--border-subtle)] bg-[var(--bg-card-inner)] shrink-0 select-none",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>l("themes"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"themes"===s?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,n.jsx)(eJ.f,{className:"w-3.5 h-3.5 text-[var(--accent-primary)]"}),(0,n.jsxs)("span",{children:["Color Themes (",sh.z.length,")"]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>l("fonts"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"fonts"===s?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,n.jsx)(tK,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,n.jsx)("span",{children:"Typography & Fonts"})]})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:"themes"===s?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"Choose color theme for workbench, dialogs, sidebar, and toolbars:"}),(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:sh.z.map(e=>{let t=i.theme===e.id;return(0,n.jsxs)("div",{onClick:()=>{var t;let r;return t=e.id,void(o(r={...i,theme:t}),(0,sh.Y)(r))},className:`group relative p-3 rounded-lg border transition-all cursor-pointer flex flex-col justify-between space-y-2.5 ${t?"bg-[var(--bg-card)] border-[var(--accent-primary)] shadow-md shadow-[var(--accent-primary)]/10 ring-1 ring-[var(--accent-primary)]/40":"bg-[var(--bg-card-inner)] border-[var(--border-card)] hover:border-[var(--accent-primary)]/50 hover:bg-[var(--bg-card)]"}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-bold text-xs text-[var(--text-bright)]",children:e.name}),(0,n.jsx)("span",{className:"text-[9px] px-1.5 py-0.2 rounded border border-[var(--border-card)] text-[var(--text-muted)] uppercase font-mono bg-[var(--bg-card)]",children:e.category})]}),t&&(0,n.jsx)("div",{className:"w-4 h-4 rounded-full bg-[var(--accent-primary)] text-[var(--text-on-accent,#ffffff)] flex items-center justify-center shrink-0",children:(0,n.jsx)(tW.f,{className:"w-2.5 h-2.5"})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 h-3 rounded overflow-hidden p-0.5 bg-black/10 dark:bg-black/40 border border-[var(--border-card)]",children:[(0,n.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.workbench},title:`Workbench: ${e.colors.workbench}`}),(0,n.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.editor},title:`Editor: ${e.colors.editor}`}),(0,n.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:e.colors.sidebar},title:`Sidebar: ${e.colors.sidebar}`}),(0,n.jsx)("span",{className:"h-full w-4 rounded-xs",style:{backgroundColor:e.colors.accent},title:`Accent: ${e.colors.accent}`})]}),(0,n.jsx)("p",{className:"text-[11px] text-[var(--text-muted)] leading-relaxed",children:e.description})]},e.id)})})]}):(0,n.jsxs)("div",{className:"space-y-4 text-xs",children:[(0,n.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"1. UI Font Family"}),(0,n.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-ui"})]}),(0,n.jsx)("select",{value:i.uiFont,onChange:e=>c("uiFont",e.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:sh.M.map(e=>(0,n.jsx)("option",{value:e.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:e.name},e.id))}),(0,n.jsx)("div",{className:"p-2 rounded bg-[var(--bg-card)] border border-[var(--border-card)] text-[var(--text-main)] text-xs",style:{fontFamily:"var(--font-family-ui)"},children:"UI Preview: Agent Factory - Realtime multi-agent activity and telemetry monitor."})]}),(0,n.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"2. Monospace Font (Code & Console)"}),(0,n.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-mono"})]}),(0,n.jsx)("select",{value:i.codeFont,onChange:e=>c("codeFont",e.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:sh.Q.map(e=>(0,n.jsx)("option",{value:e.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:e.name},e.id))}),(0,n.jsx)("div",{className:"p-2 rounded bg-[var(--bg-chat-code)] border border-[var(--border-card)] text-[var(--text-chat-code)] font-mono text-[11px] leading-relaxed",style:{fontFamily:"var(--font-family-mono)"},children:'const agent = { id: "gemini-3.8-flash", tokens: 142857, state: "streaming" };'})]}),(0,n.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"3. Base Font Size"}),(0,n.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-size-ui"})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:sh.J.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>c("fontSize",e.id),className:`p-2 rounded border text-xs font-semibold transition-colors cursor-pointer text-center ${i.fontSize===e.id?"bg-[var(--accent-primary)]/15 border-[var(--accent-primary)] text-[var(--accent-primary)] font-bold shadow-xs":"bg-[var(--bg-card)] border-[var(--border-card)] text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,children:e.label},e.id))})]})]})}),(0,n.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-t border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,n.jsxs)("button",{onClick:()=>{o(sh.s),(0,sh.Y)(sh.s)},className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] text-[var(--text-muted)] hover:text-[var(--text-bright)] border border-[var(--border-card)] text-xs transition-colors cursor-pointer",title:"Restore default settings",children:[(0,n.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:"Reset to Defaults"})]}),(0,n.jsx)("button",{onClick:t,className:"px-4 py-1.5 rounded bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] text-xs font-semibold transition-colors cursor-pointer",children:"Done"})]})]})})}var lE=e.i(61240);let lA={"gemini-3.8-flash":{input:.075,output:.3,cached:.01875},"gemini-2.5-flash":{input:.075,output:.3,cached:.01875},"gemini-1.5-flash":{input:.075,output:.3,cached:.01875},"gemini-3.8-pro":{input:1.25,output:5,cached:.3125},"gemini-3.1-pro":{input:1.25,output:5,cached:.3125},"gemini-2.5-pro":{input:1.25,output:5,cached:.3125},"gemini-1.5-pro":{input:1.25,output:5,cached:.3125},"claude-opus-5-5":{input:4,output:20,cached:.2},"claude-sonnet-5-5":{input:2,output:10,cached:.1},"claude-haiku-5-5":{input:.1,output:.5,cached:.01},"claude-fable-5":{input:10,output:50,cached:1},"claude-mythos-5":{input:10,output:50,cached:1},"claude-opus-4-8":{input:5,output:25,cached:.5},"claude-opus-4-7":{input:5,output:25,cached:.5},"claude-opus-4-6":{input:5,output:25,cached:.5},"claude-opus-4-5":{input:5,output:25,cached:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3},"claude-sonnet-4-5":{input:3,output:15,cached:.3},"claude-haiku-4-5":{input:1,output:5,cached:.1},"claude-3-7-sonnet":{input:3,output:15,cached:.3},"claude-3-5-sonnet":{input:3,output:15,cached:.3},"claude-3-5-haiku":{input:.8,output:4,cached:.08},"claude-3-opus":{input:15,output:75,cached:1.5},"claude-3-haiku":{input:.25,output:1.25,cached:.025},"gpt-4o-mini":{input:.15,output:.6,cached:.075},"gpt-4o":{input:2.5,output:10,cached:1.25},minimax:{input:.3,output:1.2,cached:.3}},lP=Object.keys(lA).sort((e,t)=>t.length-e.length);function lF(e,t){if(!e)return null;let r=function(e){let t=(e||"").toLowerCase();if(!t)return null;for(let e of lP)if(t.includes(e))return lA[e];return null}(t);return r?(e.input||0)*(r.input/1e6)+(e.output||0)*(r.output/1e6)+(e.cached||0)*(r.cached/1e6):null}let l$={name:"skip-back",size:24,node:[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]]};l$.node;let lO=(0,eW.f)(l$),lD={name:"skip-forward",size:24,node:[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]};lD.node;let lW=(0,eW.f)(lD);var lV=e.i(64569),lB=e.i(23730),lH=e.i(82902);function lU(e){if(isNaN(e)||e<0)return"00:00";let t=Math.floor(e/60),r=Math.floor(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function lq({replay:e,onClose:t,className:r=""}){let{sessionInfo:s,keyframes:l=[],totalSteps:i=0,currentStepIndex:o=0,currentKeyframe:c,currentTime:d=0,totalElapsedSeconds:u=0,isPlaying:f=!1,playbackSpeed:x=2,play:p,pause:m,togglePlay:g,seekToStep:b,stepForward:v,stepBackward:y,setPlaybackSpeed:w,reset:j}=e,[k,N]=(0,a.useState)(null),S=(0,a.useMemo)(()=>i<=1?[]:l.map((e,t)=>{let r=t/(i-1)*100,s="bg-slate-500";return"prompt"===e.milestoneType?s="bg-amber-400":"file_write"===e.type?s="bg-purple-400":"tool"===e.milestoneType?s="bg-cyan-400":"error"===e.milestoneType?s="bg-rose-500":"finish"===e.milestoneType&&(s="bg-emerald-400"),{idx:t,pct:r,color:s,type:e.type,title:e.title,summary:e.summary}}),[l,i]);return l&&0!==l.length?(0,n.jsxs)("div",{className:`bg-[#181818]/95 backdrop-blur-md border-t border-[#3e3e42] p-2 select-none shadow-2xl flex flex-col gap-2 text-slate-200 ${r}`,style:{colorScheme:"dark"},children:[(0,n.jsxs)("div",{className:"relative flex flex-col gap-1 px-2 pt-1",children:[(0,n.jsxs)("div",{className:"relative w-full h-5 flex items-center",children:[(0,n.jsx)("div",{className:"absolute inset-x-0 h-1 bg-[#252526] rounded-full pointer-events-none overflow-hidden",children:(0,n.jsx)("div",{className:"h-full bg-[#007acc] transition-all duration-75",style:{width:`${i>1?o/(i-1)*100:0}%`}})}),(0,n.jsx)("div",{className:"absolute inset-x-0 h-full pointer-events-none flex items-center",children:S.map(e=>(0,n.jsx)("div",{className:`absolute w-2 h-2 rounded-full -translate-x-1/2 ${e.color} transition-transform ${k===e.idx||o===e.idx?"scale-150 ring-2 ring-white z-20":"opacity-80"}`,style:{left:`${e.pct}%`}},e.idx))}),(0,n.jsx)("input",{type:"range",min:0,max:Math.max(0,i-1),value:o,onChange:e=>b(parseInt(e.target.value,10)),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",title:"Drag to scrub timeline"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,n.jsxs)("span",{className:"text-[#007acc] font-bold",children:["Step ",o+1,"/",i]}),(0,n.jsx)("span",{className:"text-slate-600",children:"•"}),(0,n.jsx)("span",{className:"text-white truncate font-sans",children:c?.title||"Event"}),c?.activeTool&&(0,n.jsx)(lH.f,{variant:"type",badgeSize:"xs",className:"shrink-0 font-mono",children:c.activeTool})]}),(0,n.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,n.jsxs)("span",{children:[lU(d)," / ",lU(u)]})})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 px-2 border-t border-[#252526] pt-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lM.f,{variant:"secondary",size:"icon-sm",onClick:j,title:"Rewind to start (Home)",children:(0,n.jsx)(h.f,{className:"w-3.5 h-3.5"})}),(0,n.jsx)(lM.f,{variant:"secondary",size:"icon-sm",onClick:y,disabled:o<=0,title:"Step backward (←)",children:(0,n.jsx)(lO,{className:"w-3.5 h-3.5"})}),(0,n.jsx)(lM.f,{variant:"primary",size:"sm",onClick:g,className:"px-3",title:f?"Pause (Space)":"Play (Space)",leftIcon:f?(0,n.jsx)(tP.f,{className:"w-3.5 h-3.5"}):(0,n.jsx)(tA.f,{className:"w-3.5 h-3.5 fill-current"}),children:f?"Pause":"Play"}),(0,n.jsx)(lM.f,{variant:"secondary",size:"icon-sm",onClick:v,disabled:o>=i-1,title:"Step forward (→)",children:(0,n.jsx)(lW,{className:"w-3.5 h-3.5"})}),(0,n.jsxs)("div",{className:"flex items-center gap-1 pl-2 border-l border-[#333]",children:[(0,n.jsx)("span",{className:"text-[10px] text-slate-400 font-medium",children:"Speed:"}),(0,n.jsx)("div",{className:"flex items-center bg-[#252526] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[{label:"1x",value:1},{label:"2x",value:2},{label:"5x",value:5},{label:"10x",value:10}].map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>w(e.value),className:`px-1.5 py-0.5 rounded transition-colors cursor-pointer ${x===e.value?"bg-[#007acc] text-white font-bold":"text-slate-400 hover:text-white"}`,children:e.label},e.value))})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3 text-xs font-mono",children:[(0,n.jsxs)("div",{className:"hidden sm:flex items-center gap-1.5 text-slate-400",children:[(0,n.jsx)("span",{className:"text-[10px] uppercase text-slate-500",children:"Session:"}),(0,n.jsxs)("span",{className:"text-white truncate max-w-[140px]",title:s?.id,children:[s?.id?.slice(0,14),"..."]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-emerald-400",children:[(0,n.jsx)(lV.f,{className:"w-3 h-3 text-cyan-400"}),(0,n.jsxs)("span",{children:[(c?.cumulativeTokens||0).toLocaleString()," tks"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-amber-300",children:[(0,n.jsx)(lB.f,{className:"w-3 h-3 text-amber-400"}),(0,n.jsxs)("span",{children:["$",(c?.cumulativeCost||0).toFixed(4)]})]}),t&&(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:t,className:"text-slate-400 hover:text-white ml-1",title:"Exit Replay mode",leftIcon:(0,n.jsx)(tM.X,{className:"w-3 h-3"}),children:"Exit Replay"})]})]})]}):null}var lG=e.i(62633),lY=e.i(1279),lX=e.i(47925),lK=e.i(51757),lZ=e.i(74544);let lJ={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};lJ.node;let lQ=(0,eW.f)(lJ);function l0({isOpen:e,onClose:t,replay:r,onOpenConversation:s}){let{currentKeyframe:l,currentStepIndex:i=0,totalSteps:o=0,currentTime:d=0,totalElapsedSeconds:h=0,stepBackward:u,stepForward:f,sessionInfo:x={}}=r||{},[p,m]=(0,a.useState)(!1);if(!e||!l)return null;let g=e=>{e&&(navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3))},b={user_input:{label:"User Prompt",variant:"warning",icon:lY.f,color:"text-amber-400",bg:"bg-amber-950/40 border-amber-500/30"},thought:{label:"AI Chain of Thought",variant:"info",icon:lG.f,color:"text-cyan-400",bg:"bg-cyan-950/40 border-cyan-500/30"},tool_call:{label:"Tool Call",variant:"primary",icon:lX.f,color:"text-[#007acc]",bg:"bg-blue-950/40 border-blue-500/30"},file_write:{label:"File Write / Edit",variant:"tool",icon:lj.f,color:"text-purple-400",bg:"bg-purple-950/40 border-purple-500/30"},assistant_reply:{label:"Assistant Reply",variant:"success",icon:tl.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"},finish:{label:"Session Finished",variant:"success",icon:lK.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"}}[l.type]||{label:l.type||"Event",variant:"default",icon:lQ,color:"text-slate-400",bg:"bg-slate-900 border-slate-800"},v=b.icon,y="error"===l.milestoneType,w=l.details||{},j=w.args&&Object.keys(w.args).length>0,k=!!w.output;return(0,n.jsx)(l_.f,{isOpen:e,onClose:t,title:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(v,{className:`w-4 h-4 ${y?"text-rose-400":b.color}`}),(0,n.jsxs)("span",{className:"text-white font-semibold",children:["Event Details • Step ",i+1,"/",o]}),(0,n.jsx)(lH.f,{variant:y?"danger":b.variant,badgeSize:"xs",className:"uppercase tracking-wider font-mono text-[10px]",children:y?"Error":b.label})]}),description:(0,n.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400 mt-1",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,n.jsx)(lZ.f,{className:"w-3 h-3 text-slate-500"}),l.elapsedSeconds,"s (",new Date(l.timestamp).toLocaleTimeString(),")"]}),(0,n.jsx)("span",{children:"•"}),(0,n.jsxs)("span",{className:"flex items-center gap-1 text-cyan-400 font-mono",children:[(0,n.jsx)(lV.f,{className:"w-3 h-3"}),(l.cumulativeTokens||0).toLocaleString()," tokens"]}),(0,n.jsx)("span",{children:"•"}),(0,n.jsxs)("span",{className:"flex items-center gap-1 text-amber-300 font-mono",children:[(0,n.jsx)(lB.f,{className:"w-3 h-3"}),"$",(l.cumulativeCost||0).toFixed(4)]})]}),size:"lg",footer:(0,n.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(lM.f,{variant:"secondary",size:"sm",onClick:u,disabled:i<=0,leftIcon:(0,n.jsx)(tz.f,{className:"w-3.5 h-3.5"}),children:"Previous"}),(0,n.jsx)(lM.f,{variant:"secondary",size:"sm",onClick:f,disabled:i>=o-1,rightIcon:(0,n.jsx)(tu.f,{className:"w-3.5 h-3.5"}),children:"Next"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,n.jsx)(lM.f,{variant:"secondary",size:"sm",onClick:()=>{t(),s(x?.id||r?.sessionId)},leftIcon:(0,n.jsx)(c.f,{className:"w-3.5 h-3.5 text-cyan-400"}),children:"View Conversation"}),(0,n.jsx)(lM.f,{variant:"secondary",size:"sm",onClick:t,children:"Close"})]})]}),children:(0,n.jsxs)("div",{className:"space-y-4 max-h-[65vh] overflow-y-auto pr-1",children:[(0,n.jsxs)("div",{className:`p-3 rounded-lg border ${b.bg} space-y-1`,children:[(0,n.jsxs)("div",{className:"text-xs font-semibold text-white flex items-center justify-between",children:[(0,n.jsx)("span",{children:l.title}),l.activeTool&&(0,n.jsx)(lH.f,{variant:"type",badgeSize:"xs",className:"font-mono",children:l.activeTool})]}),l.summary&&(0,n.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed",children:l.summary})]}),"user_input"===l.type&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lY.f,{className:"w-3.5 h-3.5 text-amber-400"}),"User Prompt Message"]}),(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:()=>g(l.content),leftIcon:p?(0,n.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:l.content||"No text content."})]}),"thought"===l.type&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lG.f,{className:"w-3.5 h-3.5 text-cyan-400"}),"AI Reasoning (Chain of Thought)"]}),(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:()=>g(l.content),leftIcon:p?(0,n.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#12161f] border border-cyan-900/40 rounded-lg text-xs font-mono text-cyan-200/90 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:l.content})]}),"file_write"===l.type&&w.args?.ReplacementContent&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lj.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Code Changes (Diff Preview)"]}),w.targetFile&&(0,n.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:w.targetFile})]}),w.args.TargetContent&&(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("span",{className:"text-[10px] font-bold text-rose-400 uppercase tracking-wider block",children:"- Original Content (Replaced)"}),(0,n.jsx)("pre",{className:"p-2.5 bg-rose-950/20 border border-rose-500/30 rounded-lg text-xs font-mono text-rose-300 whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto",children:w.args.TargetContent})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider block",children:"+ New Content (Added)"}),(0,n.jsx)("pre",{className:"p-2.5 bg-emerald-950/20 border border-emerald-500/30 rounded-lg text-xs font-mono text-emerald-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.args.ReplacementContent})]})]}),"file_write"===l.type&&!w.args?.ReplacementContent&&w.args?.CodeContent&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lj.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Created File Content"]}),w.targetFile&&(0,n.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:w.targetFile})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#101010] border border-purple-500/30 rounded-lg text-xs font-mono text-purple-200 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.args.CodeContent})]}),("tool_call"===l.type||"file_write"===l.type)&&j&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(lQ,{className:"w-3.5 h-3.5 text-blue-400"}),"Arguments (",l.activeTool,")"]}),w.targetFile&&(0,n.jsx)("span",{className:"text-[11px] font-mono text-purple-300 truncate max-w-[280px]",children:w.targetFile})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-mono text-slate-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(w.args,null,2)})]}),("tool_call"===l.type||"file_write"===l.type)&&k&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(tl.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Execution Output"]}),(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:()=>g(w.output),leftIcon:p?(0,n.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#101010] border border-[#2b2b2b] rounded-lg text-xs font-mono text-emerald-400/90 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:w.output})]}),"assistant_reply"===l.type&&(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(tl.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Assistant Response"]}),(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:()=>g(l.content),leftIcon:p?(0,n.jsx)(tW.f,{className:"w-3 h-3 text-emerald-400"}):(0,n.jsx)(tD.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,n.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:l.content})]}),"finish"===l.type&&(0,n.jsxs)("div",{className:"p-4 bg-emerald-950/20 border border-emerald-500/30 rounded-lg space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-emerald-400 font-bold text-sm",children:[(0,n.jsx)(lK.f,{className:"w-5 h-5"}),"Session Summary"]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[(0,n.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL DURATION"}),(0,n.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[h,"s"]})]}),(0,n.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL STEPS"}),(0,n.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[o," events"]})]}),(0,n.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL TOKENS"}),(0,n.jsx)("span",{className:"font-mono text-cyan-400 text-sm font-semibold",children:(l.cumulativeTokens||0).toLocaleString()})]}),(0,n.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,n.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ESTIMATED COST"}),(0,n.jsxs)("span",{className:"font-mono text-amber-300 text-sm font-semibold",children:["$",(l.cumulativeCost||0).toFixed(4)]})]})]})]})]})})}var l1=e.i(56539);function l2({replay:e,onExit:t,onOpenConversation:r,className:s="",children:l}){let[i,o]=(0,a.useState)(!1),[d,h]=(0,a.useState)(!0),{sessionInfo:u={},currentKeyframe:f,currentStepIndex:x=0,totalSteps:p=0,isPlaying:m=!1,togglePlay:g,stepForward:b,stepBackward:v,seekToStep:y}=e||{};return(0,a.useEffect)(()=>{let e=e=>{let t=document.activeElement?.tagName?.toLowerCase();"input"!==t&&"textarea"!==t&&("Space"===e.code?(e.preventDefault(),g?.()):"ArrowLeft"===e.code?(e.preventDefault(),v?.()):"ArrowRight"===e.code?(e.preventDefault(),b?.()):"Home"===e.code?(e.preventDefault(),y?.(0)):"End"===e.code?(e.preventDefault(),y?.(Math.max(0,p-1))):"i"!==e.key&&"I"!==e.key||e.metaKey||e.ctrlKey||o(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,v,b,y,p]),(0,n.jsxs)("div",{className:`relative flex flex-col h-full w-full overflow-hidden ${s}`,children:[(0,n.jsxs)("div",{className:"h-9 min-h-[36px] bg-[#1a1f2c]/90 border-b border-[#2d3748] px-3 flex items-center justify-between z-30 select-none backdrop-blur-md",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsxs)("span",{className:"flex h-2 w-2 relative",children:[(0,n.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cyan-500"})]}),(0,n.jsx)(lH.f,{variant:"type",badgeSize:"xs",className:"font-mono uppercase font-bold tracking-wider",children:"Time-Machine Replay"}),(0,n.jsx)("span",{className:"text-slate-500 text-xs hidden sm:inline",children:"•"}),(0,n.jsx)("span",{className:"text-xs text-slate-300 font-mono truncate max-w-[200px]",title:u?.id,children:u?.id?`${u.id.slice(0,16)}...`:"Session"}),u?.model&&(0,n.jsxs)("span",{className:"text-[11px] text-slate-400 font-mono hidden md:inline",children:["(",u.model,")"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[r&&(0,n.jsx)(lM.f,{variant:"secondary",size:"xs",onClick:()=>r(u?.id||e?.sessionId),leftIcon:(0,n.jsx)(c.f,{className:"w-3 h-3 text-cyan-400"}),title:"View full conversation transcript for this session",children:"View Conversation"}),(0,n.jsx)(lM.f,{variant:"secondary",size:"xs",onClick:()=>o(!0),leftIcon:(0,n.jsx)(t$.f,{className:"w-3 h-3 text-cyan-400"}),title:"Inspect event details and parameters (Key: I)",children:"Step Details"}),(0,n.jsx)(lM.f,{variant:"ghost",size:"xs",onClick:t,leftIcon:(0,n.jsx)(tM.X,{className:"w-3.5 h-3.5"}),className:"text-slate-400 hover:text-white hover:bg-rose-950/40 hover:border-rose-500/40",title:"Exit Replay and return to live stream",children:"Exit Replay"})]})]}),(0,n.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[l,f&&(0,n.jsx)("div",{className:"absolute top-3 right-3 z-20 max-w-sm pointer-events-auto",children:(0,n.jsxs)("div",{className:"bg-[#18181b]/90 border border-[#3f3f46] rounded-xl shadow-2xl backdrop-blur-md overflow-hidden transition-all",children:[(0,n.jsxs)("div",{onClick:()=>h(!d),className:"px-3 py-2 bg-[#27272a]/70 flex items-center justify-between cursor-pointer hover:bg-[#27272a] transition-colors",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(e=>{switch(e){case"user_input":return(0,n.jsx)(lY.f,{className:"w-3.5 h-3.5 text-amber-400"});case"thought":return(0,n.jsx)(lG.f,{className:"w-3.5 h-3.5 text-cyan-400"});case"file_write":return(0,n.jsx)(lj.f,{className:"w-3.5 h-3.5 text-purple-400"});case"tool_call":return(0,n.jsx)(lX.f,{className:"w-3.5 h-3.5 text-[#007acc]"});case"finish":return(0,n.jsx)(lK.f,{className:"w-3.5 h-3.5 text-emerald-400"});default:return(0,n.jsx)(tl.f,{className:"w-3.5 h-3.5 text-slate-400"})}})(f.type),(0,n.jsx)("span",{className:"text-xs font-semibold text-white truncate",children:f.title||"Agent Activity"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-slate-400",children:[(0,n.jsxs)("span",{className:"text-[10px] font-mono",children:[x+1,"/",p]}),d?(0,n.jsx)(l1.f,{className:"w-3 h-3"}):(0,n.jsx)(th.f,{className:"w-3 h-3"})]})]}),d&&(0,n.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,n.jsx)("p",{className:"text-slate-300 leading-relaxed font-sans line-clamp-3",children:f.summary||f.content?.slice(0,150)||"Executing task..."}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-1 border-t border-[#27272a] text-[11px]",children:[f.activeTool?(0,n.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-cyan-400 truncate",children:[(0,n.jsx)(lX.f,{className:"w-3 h-3 text-[#007acc] shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:f.activeTool})]}):(0,n.jsxs)("span",{className:"text-[10px] text-slate-500 font-mono",children:["Step ",x+1]}),r&&(0,n.jsxs)("button",{type:"button",onClick:()=>r(u?.id||e?.sessionId),className:"flex items-center gap-1 text-[11px] text-cyan-400 hover:text-cyan-300 hover:underline cursor-pointer ml-auto shrink-0",title:"View conversation transcript",children:[(0,n.jsx)(c.f,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"Conversation"})]})]})]})]})})]}),(0,n.jsx)(lq,{replay:e,onClose:t,className:"z-30 shrink-0"}),(0,n.jsx)(l0,{isOpen:i,onClose:()=>o(!1),replay:e,onOpenConversation:r})]})}let l5="agmon_workbench_layout",l3={isLeftSidebarVisible:!0,isBottomPanelVisible:!0,isRightSidebarVisible:!1,activeActivityView:"explorer",activeRightSidebarTab:"chat",activeBottomTab:"logs",activeEditorTab:"canvas",openedTabs:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]};function l4({traces:e=[],office:t={workstations:[],stats:{}},mode:r="live",mockPreset:s="cases",onModeChange:l,onPresetChange:i,connected:o=!0,live:u=!0,isRefreshing:f=!1,onRefresh:x,soundEnabled:p=!1,onToggleSound:m,notifEnabled:g=!1,onToggleNotif:b}){let[v,y]=(0,a.useState)(l3),[w,j]=(0,a.useState)(!1),[k,N]=(0,a.useState)(null),[S,C]=(0,a.useState)("canvas"),[T,_]=(0,a.useState)("agents"),[M,z]=(0,a.useState)(!1),[R,I]=(0,a.useState)(!1),[L,E]=(0,a.useState)(!1),[A,P]=(0,a.useState)("themes"),[F,$]=(0,a.useState)(!1),[O,D]=(0,a.useState)(!1),W=(0,a.useCallback)(e=>{D(t=>{let r="boolean"==typeof e?e:!t;return r?(C("canvas"),"u">typeof document&&document.documentElement?.requestFullscreen&&!document.fullscreenElement&&document.documentElement.requestFullscreen().catch(()=>{})):"u">typeof document&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),r})},[]);(0,a.useEffect)(()=>{let e=()=>{"u">typeof document&&!document.fullscreenElement&&O&&D(!1)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[O]),(0,a.useEffect)(()=>{let e=(0,tB.F)();$(!!e.isSupporter),(0,lE.n)(e);let t=e=>{$(!!(e.detail||(0,tB.F)()).isSupporter)};window.addEventListener(tB.o,t);{let e=new URLSearchParams(window.location.search);("1"===e.get("store")||"true"===e.get("store")||"store"===e.get("modal")||"1"===e.get("coffee"))&&I(!0)}return()=>window.removeEventListener(tB.o,t)},[]);let[V,B]=(0,a.useState)(null),H=function(e=null){let[t,r]=(0,a.useState)(e),[s,l]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),[n,c]=(0,a.useState)({sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0}),[d,h]=(0,a.useState)(0),[u,f]=(0,a.useState)(!1),[x,p]=(0,a.useState)(2),m=(0,a.useRef)(null),g=(0,a.useRef)(null),b=(0,a.useCallback)(async e=>{if(e){l(!0),o(null),f(!1),h(0);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/transcript`);if(!t.ok)throw Error(`Failed to load session transcript: HTTP ${t.status}`);let s=await t.json(),l=function(e){if(!e||!Array.isArray(e.turns))return{sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0};let t=e.session||{},r=e.turns||[],s=t.model||null,l=t.cli||"antigravity",i=[],o=0,n=0,a=0,c=0,d=Date.now();t.startedAt?d=new Date(t.startedAt).getTime():r.length>0&&r[0].timestamp&&(d=new Date(r[0].timestamp).getTime()),r.forEach((e,t)=>{let r=e.timestamp?new Date(e.timestamp).getTime():d+5e3*t,l=Math.max(0,Math.round((r-d)/1e3));e.tokens&&(n+=e.tokens.input||0,a+=e.tokens.output||0,c+=e.tokens.cached||0);let h=n+a+c,u=lF({input:n,output:a,cached:c},s);if("user"===e.role)return void i.push({stepIndex:o++,turnIndex:t,timestamp:e.timestamp||new Date(r).toISOString(),elapsedSeconds:l,type:"user_input",milestoneType:"prompt",agentState:"thinking",title:"User Prompt",summary:e.content?e.content.slice(0,80)+(e.content.length>80?"...":""):"User message",content:e.content||"",cumulativeTokens:h,cumulativeCost:u,activeTool:null});e.thinking&&i.push({stepIndex:o++,turnIndex:t,timestamp:e.timestamp||new Date(r).toISOString(),elapsedSeconds:l,type:"thought",milestoneType:"thought",agentState:"thinking",title:"AI Chain of Thought",summary:e.thinking.slice(0,90)+(e.thinking.length>90?"...":""),content:e.thinking,cumulativeTokens:h,cumulativeCost:u,activeTool:null});let f=e.toolCalls||[];if(f.forEach((s,n)=>{let a=l+(n+1)*2,c="replace_file_content"===s.name||"write_to_file"===s.name||s.name?.includes("edit")||s.name?.includes("write"),d="run_command"===s.name||"bash"===s.name||"terminal"===s.name,f=s.name?.includes("search")||s.name?.includes("grep")||s.name?.includes("view"),x="tool";c?x="file_write":d?x="command":f&&(x="search"),i.push({stepIndex:o++,turnIndex:t,toolIndex:n,timestamp:e.timestamp||new Date(r+2e3*n).toISOString(),elapsedSeconds:a,type:c?"file_write":"tool_call",milestoneType:"error"===s.status?"error":"tool",agentState:c?"typing":"running_tool",title:`Tool Call: ${s.name||"tool"}`,summary:s.summary||s.action||s.name,details:{id:s.id,name:s.name,type:x,summary:s.summary,args:s.args||{},output:s.output||"",status:s.status||"completed",targetFile:s.args?.TargetFile||s.args?.AbsolutePath||null},cumulativeTokens:h,cumulativeCost:u,activeTool:s.name})}),e.content){let s=l+(f.length>0?(f.length+1)*2:1);i.push({stepIndex:o++,turnIndex:t,timestamp:e.timestamp||new Date(r+1e3*s).toISOString(),elapsedSeconds:s,type:"assistant_reply",milestoneType:"reply",agentState:"typing",title:"Assistant Reply",summary:e.content.slice(0,90)+(e.content.length>90?"...":""),content:e.content,cumulativeTokens:h,cumulativeCost:u,activeTool:null})}});let h=i[i.length-1],u=h?h.elapsedSeconds+2:5;i.push({stepIndex:o++,timestamp:new Date().toISOString(),elapsedSeconds:u,type:"finish",milestoneType:"finish",agentState:"done",title:"Session Completed",summary:`Completed ${r.length} turns • ${i.length} events`,content:"All tasks completed as instructed.",cumulativeTokens:n+a+c,cumulativeCost:lF({input:n,output:a,cached:c},s),activeTool:null});let f=n+a+c,x=lF({input:n,output:a,cached:c},s);return{sessionInfo:{id:t.id||"session",cli:l,model:s,cwd:t.cwd||"",startedAt:t.startedAt,turnsCount:r.length,totalSteps:i.length},keyframes:i,totalElapsedSeconds:u,totalTokens:f,totalCost:x}}(s);c(l),r(e),h(0)}catch(e){console.error("[useSessionReplay] Load error:",e),o(e.message||"Failed to load session data")}finally{l(!1)}}},[]);(0,a.useEffect)(()=>{e&&b(e)},[e,b]);let{keyframes:v,totalElapsedSeconds:y,sessionInfo:w,totalTokens:j,totalCost:k}=n,N=v.length,S=(0,a.useMemo)(()=>{if(0===v.length)return null;let e=Math.min(Math.max(0,d),v.length-1);return v[e]},[v,d]),C=S?S.elapsedSeconds:0,T=y>0?C/y:0,_=(0,a.useCallback)(e=>{h(t=>Math.min(Math.max(0,e),N-1))},[N]),M=(0,a.useCallback)(e=>{if(0===v.length)return;let t=Math.min(Math.max(0,e),1)*y,r=0,s=1/0;v.forEach((e,l)=>{let i=Math.abs(e.elapsedSeconds-t);i<s&&(s=i,r=l)}),_(r)},[v,y,_]),z=(0,a.useCallback)(()=>{_(d+1)},[d,_]),R=(0,a.useCallback)(()=>{_(d-1)},[d,_]),I=(0,a.useCallback)(()=>{d>=N-1&&h(0),f(!0),g.current=performance.now()},[d,N]),L=(0,a.useCallback)(()=>{f(!1),m.current&&cancelAnimationFrame(m.current)},[]),E=(0,a.useCallback)(()=>{u?L():I()},[u,I,L]),A=(0,a.useCallback)(()=>{L(),h(0)},[L]);return(0,a.useEffect)(()=>{if(!u||0===v.length)return;let e=0,t=1200/x,r=s=>{g.current||(g.current=s);let l=s-g.current;g.current=s,(e+=l)>=t&&(e=0,h(e=>e>=N-1?(f(!1),e):e+1)),m.current=requestAnimationFrame(r)};return g.current=performance.now(),m.current=requestAnimationFrame(r),()=>{m.current&&cancelAnimationFrame(m.current)}},[u,v.length,N,x]),{sessionId:t,loading:s,error:i,sessionInfo:w,keyframes:v,totalSteps:N,currentStepIndex:d,currentKeyframe:S,currentTime:C,totalElapsedSeconds:y,progress:T,isPlaying:u,playbackSpeed:x,totalTokens:j,totalCost:k,loadSession:b,play:I,pause:L,togglePlay:E,seekToStep:_,seekToProgress:M,stepForward:z,stepBackward:R,setPlaybackSpeed:p,reset:A}}(V),U=(0,a.useCallback)(t=>{let r=t||k||e[0]?.connectionId||e[0]?.traceId||"default-session";B(r),N(r),C("canvas")},[k,e]),q=(0,a.useCallback)(()=>{B(null)},[]),[G,Y]=(0,a.useState)(()=>[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]);(0,a.useEffect)(()=>{(0,sh.p)();let e=function(){try{let e=localStorage.getItem(l5);if(e){let t=JSON.parse(e);return{...l3,...t}}}catch(e){console.warn("[layoutStore] Failed to load workbench layout:",e)}return{...l3}}();y(e),e.activeEditorTab&&C(e.activeEditorTab),e.openedTabs&&Array.isArray(e.openedTabs)&&e.openedTabs.length>0&&Y(e.openedTabs),j(!0)},[]),(0,a.useEffect)(()=>{w&&function(e){try{localStorage.setItem(l5,JSON.stringify(e))}catch(e){console.warn("[layoutStore] Failed to save workbench layout:",e)}}(v)},[v,w]),(0,a.useEffect)(()=>{if("canvas"===S){let e=(0,tB.F)();window.dispatchEvent(new CustomEvent(tB.o,{detail:e}))}},[S]);let X=(0,a.useMemo)(()=>V&&H.currentKeyframe?function(e,t={}){if(!e)return null;let r=t.id||"replay-session",s=t.cli||"antigravity",l=t.model||"gemini-3.8-flash",i="app"===t.clientType,o="antigravity"===s?"Google":"Anthropic",n="mcp",a=(e.activeTool||e.details?.name||"").toLowerCase();a.includes("bash")||a.includes("command")||a.includes("terminal")||"run_command"===a?n="bash":a.includes("read")||a.includes("view")||"view_file"===a?n="read":a.includes("edit")||a.includes("write")||"replace_file_content"===a||"write_to_file"===a?n="edit":a.includes("search")||a.includes("grep")||a.includes("find")?n="search":a.includes("web")||a.includes("browse")||a.includes("url")?n="web":(a.includes("memory")||a.includes("remember")||a.includes("recall"))&&(n="memory");let c="streaming",d="streaming";"user_input"===e.type||"thought"===e.type?(c="pending",d="pending"):"finish"===e.type?(c="done",d="happy"):"error"===e.milestoneType&&(c="error",d="error");let h=e.activeTool?[{id:e.details?.id||"tool-0",tool:n,type:n,name:e.activeTool,status:e.details?.status||"completed"}]:[];return{connectionId:r,traceId:r,account:`${s.toUpperCase()}: ${r.slice(0,10)}`,model:l,provider:o,cli:s,clientType:i?"app":"cli",state:c,mode:d,isLooping:!1,tools:e.activeTool?[n]:[],toolCalls:h,activeTool:e.activeTool||null,tokens:{input:null,output:null,cached:null},totalTokens:e.cumulativeTokens??null,cost:e.cumulativeCost??null,elapsedMs:1e3*(e.elapsedSeconds||0),currentCommand:e.title||"",summary:e.summary||"",isReplay:!0,logs:[{id:`replay-log-${e.stepIndex}`,time:new Date(e.timestamp||Date.now()).toLocaleTimeString(),level:"error"===e.milestoneType?"error":"info",message:`[Replay #${e.stepIndex+1}] ${e.title}: ${e.summary}`}]}}(H.currentKeyframe,H.sessionInfo):null,[V,H.currentKeyframe,H.sessionInfo]),K=(0,a.useMemo)(()=>X?[X]:e,[X,e]),Z=(0,a.useMemo)(()=>X?sd(K):t,[X,K,t]),J=(0,a.useMemo)(()=>k?Z.workstations.find(e=>e.connectionId===k||e.traceId===k||e.traces?.[0]?.traceId===k)||K.find(e=>e.connectionId===k||e.traceId===k||e.traces?.[0]?.traceId===k)||{connectionId:k,traceId:k,account:k.length>20?`${k.slice(0,16)}...`:k,model:H?.sessionInfo?.model||"AI Agent",provider:H?.sessionInfo?.provider||"antigravity"}:null,[Z.workstations,K,k,H?.sessionInfo]),Q=(0,a.useCallback)(e=>{e&&(N(e),y(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})))},[]),ee=(0,a.useCallback)(e=>{N(e),e&&y(e=>({...e,isRightSidebarVisible:!0}))},[]),et=(0,a.useCallback)(e=>{if(!e)return;let t=`agent-${e.connectionId}`;Y(r=>r.find(e=>e.id===t)?r:[...r,{id:t,title:e.account||`Desk #${e.deskIndex+1}`,type:"agent",agentData:e,closable:!0}]),C(t)},[]),er=(0,a.useCallback)(e=>{Y(t=>{let r=t.filter(t=>t.id!==e);return r.length>0?r:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]}),C(t=>t===e?"canvas":t)},[]),es=(0,a.useCallback)(()=>{Y(e=>e.find(e=>"reports"===e.id)?e:[...e,{id:"reports",title:"Token Analytics",type:"reports",closable:!0}]),C("reports")},[]),el=(0,a.useCallback)(()=>{Y(e=>e.find(e=>"network"===e.id)?e:[...e,{id:"network",title:"Multi-Agent Graph",type:"network",closable:!0}]),C("network")},[]),ei=(0,a.useCallback)(()=>{Y(e=>e.find(e=>"store"===e.id)?e:[...e,{id:"store",title:"Supporter Store",type:"store",closable:!0}]),C("store")},[]),eo=(0,a.useCallback)(e=>{if(!e||!e.path)return;let t=`file-${e.path}`,r=e.name||e.path.split("/").pop();Y(s=>s.find(e=>e.id===t)?s:[...s,{id:t,title:r,type:"file",filePath:e.path,closable:!0}]),C(t)},[]),en=(0,a.useCallback)(()=>{y(e=>({...e,isLeftSidebarVisible:!0})),_("files")},[]);(0,a.useEffect)(()=>{let e=e=>{let t=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(t&&e.shiftKey&&("p"===e.key||"P"===e.key)){e.preventDefault(),z(e=>!e);return}if(t&&!e.shiftKey&&!e.altKey&&("b"===e.key||"B"===e.key)){e.preventDefault(),y(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible}));return}if(t&&("j"===e.key||"J"===e.key||"`"===e.key)){e.preventDefault(),y(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible}));return}if(t&&e.altKey&&("b"===e.key||"B"===e.key)){e.preventDefault(),y(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible}));return}if("Escape"===e.key&&O){e.preventDefault(),W(!1);return}if(e.shiftKey&&("f"===e.key||"F"===e.key)&&!t&&!e.altKey){let t=document.activeElement?.tagName?.toLowerCase();if("input"!==t&&"textarea"!==t){e.preventDefault(),W();return}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[O,W]);let ea=(0,a.useCallback)(()=>{window.dispatchEvent(new Event("resize"))},[]),ec=(0,a.useMemo)(()=>G.find(e=>e.id===S)||G[0],[G,S]),ed=(0,a.useMemo)(()=>{if("telemetry"!==S)return"";let e=K.length>30?K.slice(-30):K;try{return JSON.stringify(e,null,2)}catch{return"[]"}},[S,K]);return(0,n.jsxs)("div",{className:"flex h-screen w-screen flex-col overflow-hidden bg-[#181818] text-[#cccccc] font-sans antialiased",children:[(0,n.jsx)(te,{stats:t.stats,mode:r,mockPreset:s,onModeChange:l,onPresetChange:i,isRefreshing:f,onRefresh:x,soundEnabled:p,onToggleSound:m,notifEnabled:g,onToggleNotif:b,onOpenCommandPalette:()=>z(!0),onOpenReports:es,onOpenStore:ei,onOpenThemeSettings:()=>{P("themes"),E(!0)},isSupporter:F,layout:v,onToggleLeftSidebar:()=>y(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible})),onToggleBottomPanel:()=>y(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onToggleRightSidebar:()=>y(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible})),isZenFullscreen:O,onToggleZenFullscreen:W}),(0,n.jsxs)("div",{className:"flex flex-1 overflow-hidden relative",children:[(0,n.jsx)(td,{activeView:v.activeActivityView,isLeftSidebarVisible:v.isLeftSidebarVisible,activeLeftSidebarTab:T,isRightSidebarVisible:v.isRightSidebarVisible,activeRightSidebarTab:v.activeRightSidebarTab||"chat",onOpenStore:ei,onViewChange:e=>{"chat"===e?y(e=>{let t=e.isRightSidebarVisible&&"chat"===e.activeRightSidebarTab;return{...e,isRightSidebarVisible:!t,activeRightSidebarTab:"chat"}}):"files"===e?(y(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible||"files"!==T,activeActivityView:"files"})),_("files")):"explorer"===e?(y(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible||"agents"!==T,activeActivityView:"explorer"})),_("agents")):"office"===e?C("canvas"):"network"===e?el():"reports"===e?es():"telemetry"===e?(Y(e=>e.find(e=>"telemetry"===e.id)?e:[...e,{id:"telemetry",title:"Live Telemetry",type:"telemetry",closable:!0}]),C("telemetry")):"store"===e?ei():y(t=>({...t,activeActivityView:e,isLeftSidebarVisible:t.activeActivityView!==e||!t.isLeftSidebarVisible}))},agentCount:t.stats?.busy||0,isBottomPanelVisible:v.isBottomPanelVisible,onToggleBottomPanel:()=>y(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onOpenSettings:()=>{P("themes"),E(!0)}}),(0,n.jsxs)(ez,{orientation:"horizontal",className:"flex-1 h-full overflow-hidden",onLayoutChange:ea,children:[v.isLeftSidebarVisible&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eR,{id:"left-sidebar-panel",defaultSize:"260px",minSize:"180px",maxSize:"450px",className:"overflow-hidden h-full",children:(0,n.jsx)(t_,{workstations:Z.workstations,selectedId:k,onSelectAgent:ee,onOpenAgentTab:et,stats:Z.stats,onRefresh:x,onStartReplay:U,onViewConversation:Q,onOpenFile:eo,onOpenStore:ei,activeSidebarTab:T,onActiveSidebarTabChange:_})}),(0,n.jsx)(eA,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"})]}),(0,n.jsx)(eR,{id:"center-main-panel",minSize:"350px",className:"overflow-hidden flex flex-col h-full bg-[#1e1e1e]",children:(0,n.jsxs)(ez,{orientation:"vertical",className:"h-full w-full overflow-hidden",onLayoutChange:ea,children:[(0,n.jsxs)(eR,{id:"editor-area-panel",minSize:"160px",className:"overflow-hidden flex flex-col h-full",children:[(0,n.jsx)(tR,{tabs:G,activeTabId:S,onSelectTab:C,onCloseTab:er,isZenFullscreen:O,onToggleZenFullscreen:W}),(0,n.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#070b12]",children:V?(0,n.jsx)(l2,{replay:H,onExit:q,onOpenConversation:Q,children:(0,n.jsx)("div",{className:"absolute inset-0",children:"network"===S?(0,n.jsx)(sI,{traces:K,selectedTraceId:k,onSelectTrace:e=>{N(e.traceId||e.connectionId),y(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}}):(0,n.jsx)(sz,{traces:K,selectedId:k,onSelect:e=>ee(e),isZenFullscreen:O,onToggleZenFullscreen:W,soundEnabled:p,onToggleSound:m})})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:`absolute inset-0 transition-opacity ${"canvas"===S?"opacity-100 z-10":"opacity-0 pointer-events-none z-0"} ${O?"!fixed !inset-0 !z-40 !w-screen !h-screen !rounded-none !border-none":""}`,children:(0,n.jsx)(sz,{traces:K,selectedId:k,onSelect:e=>ee(e),isZenFullscreen:O,onToggleZenFullscreen:W,soundEnabled:p,onToggleSound:m})}),"telemetry"===S&&(0,n.jsxs)("div",{className:"absolute inset-0 p-4 overflow-auto font-mono text-xs bg-[var(--bg-editor)] text-[var(--text-main)]",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between pb-2 border-b border-[var(--border-subtle)]",children:[(0,n.jsx)("h3",{className:"font-bold text-sm text-[var(--accent-primary)]",children:"Realtime Telemetry Snapshots"}),(0,n.jsxs)("span",{className:"text-[var(--text-muted)]",children:[K.length," active sessions",K.length>30?" (latest 30)":""]})]}),(0,n.jsx)("pre",{className:"bg-[var(--bg-chat-code)] p-4 rounded border border-[var(--border-card)] text-[11px] text-[var(--text-chat-code)] leading-relaxed overflow-x-auto",children:ed})]}),ec?.type==="agent"&&(0,n.jsx)("div",{className:"absolute inset-0 p-4 overflow-auto bg-[var(--bg-editor)] text-[var(--text-main)]",children:(0,n.jsx)("div",{className:"max-w-3xl mx-auto space-y-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between p-4 bg-[var(--bg-card)] rounded-lg border border-[var(--border-card)]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-base font-bold text-[var(--text-bright)]",children:ec.title}),(0,n.jsxs)("p",{className:"text-xs text-[var(--text-muted)]",children:["Connection ID: ",ec.agentData?.connectionId]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("button",{onClick:()=>U(ec.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5 shadow-sm",title:"Replay Session (Default)",children:[(0,n.jsx)(h.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:"Replay Session"})]}),(0,n.jsxs)("button",{onClick:()=>Q(ec.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--text-main)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Pin live chat transcript to Right Sidebar",children:[(0,n.jsx)(c.f,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,n.jsx)("span",{children:"Pin to Sidebar"})]}),(0,n.jsxs)("button",{onClick:()=>{(0,eP.f)(ec.agentData?.connectionId)},className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--accent-primary)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Open in Detached Window (VS Code style)",children:[(0,n.jsx)(d.f,{className:"w-3.5 h-3.5"}),(0,n.jsx)("span",{children:"New Window"})]})]})]})})}),"reports"===S&&(0,n.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,n.jsx)(sL.f,{onClose:()=>er("reports"),onStartReplay:U,onViewConversation:Q})}),"network"===S&&(0,n.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-slate-950 z-20",children:(0,n.jsx)(sI,{traces:K,selectedTraceId:k,onSelectTrace:e=>{N(e.traceId||e.connectionId),y(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}})}),ec?.type==="file"&&(0,n.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#1e1e1e] z-20",children:(0,n.jsx)(lC,{filePath:ec.filePath,onClose:()=>er(S)})}),("store"===S||ec?.type==="store")&&(0,n.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,n.jsx)(lT.f,{hideHeader:!1,onClose:()=>er("store")})})]})})]}),v.isBottomPanelVisible&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eA,{className:"h-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-row-resize z-20 shrink-0"}),(0,n.jsx)(eR,{id:"bottom-panel",defaultSize:"220px",minSize:"90px",maxSize:"600px",className:"overflow-hidden bg-[#181818]",children:(0,n.jsx)(tF,{traces:K,activeTab:v.activeBottomTab,onTabChange:e=>y(t=>({...t,activeBottomTab:e})),onClose:()=>y(e=>({...e,isBottomPanelVisible:!1}))})})]})]})}),v.isRightSidebarVisible&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eA,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"}),(0,n.jsx)(eR,{id:"right-sidebar-panel",defaultSize:"360px",minSize:"260px",maxSize:"750px",className:"overflow-hidden h-full bg-[#252526]",children:(0,n.jsx)(tH,{selectedAgent:J,workstations:Z.workstations,activeTab:v.activeRightSidebarTab||"chat",onTabChange:e=>y(t=>({...t,activeRightSidebarTab:e})),onSelectAgent:ee,onClose:()=>y(e=>({...e,isRightSidebarVisible:!1})),onStartReplay:U})})]})]})]}),(0,n.jsx)(tG,{mode:r,connected:o,live:u,stats:Z.stats,selectedAgent:J,soundEnabled:p,isBottomOpen:v.isBottomPanelVisible,onToggleBottom:()=>y(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible}))}),(0,n.jsx)(tZ,{isOpen:M,onClose:()=>z(!1),onToggleLeftSidebar:()=>y(e=>({...e,isLeftSidebarVisible:!e.isLeftSidebarVisible})),onToggleBottomPanel:()=>y(e=>({...e,isBottomPanelVisible:!e.isBottomPanelVisible})),onToggleRightSidebar:()=>y(e=>({...e,isRightSidebarVisible:!e.isRightSidebarVisible})),onToggleZenFullscreen:W,onOpenChatSidebar:()=>y(e=>({...e,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})),onOpenFilesExplorer:en,onOpenThemeSettings:()=>{P("themes"),E(!0)},onOpenFontSettings:()=>{P("fonts"),E(!0)},onToggleSound:m,onToggleNotif:b,onRefresh:x,onSetMode:l,onSelectPreset:i,onOpenReports:es,onOpenStore:ei,onStartReplay:U}),(0,n.jsx)(lI,{isOpen:R,onClose:()=>I(!1)}),(0,n.jsx)(lL,{isOpen:L,onClose:()=>E(!1),initialTab:A})]})}var l8=e.i(18913);function l6(){let[e,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(null);return((0,a.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(e=>{e.addEventListener("updatefound",()=>{let r=e.installing;r&&r.addEventListener("statechange",()=>{"installed"===r.state&&navigator.serviceWorker.controller&&t(!0)})})});let e=null,r=async()=>{try{let r=await fetch("/api/version");if(r.ok){let l=await r.json();e?l.version&&l.version!==e&&(s(l.version),t(!0)):e=l.version}}catch{}};r();let l=setInterval(r,6e4);return()=>clearInterval(l)},[]),e)?(0,n.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 rounded-full border border-emerald-500/40 bg-slate-900/95 px-4 py-2 shadow-2xl backdrop-blur-md animate-in slide-in-from-bottom-4 duration-300",children:[(0,n.jsx)("span",{className:"flex h-2 w-2 rounded-full bg-emerald-400 animate-ping"}),(0,n.jsxs)("span",{className:"text-xs text-slate-200 flex items-center gap-1.5",children:[(0,n.jsx)(eQ.f,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,n.jsxs)("span",{children:["New version available ",r?`(${r})`:""]})]}),(0,n.jsx)("button",{onClick:()=>{window.location.reload()},className:"rounded-full bg-emerald-500 hover:bg-emerald-400 px-3 py-1 text-xs font-semibold text-slate-950 transition-colors shadow-sm",children:"Update now"}),(0,n.jsx)("button",{onClick:()=>t(!1),className:"text-slate-400 hover:text-slate-200 p-1 ml-1 rounded hover:bg-slate-800 transition-colors","aria-label":"Dismiss",children:(0,n.jsx)(tM.X,{className:"w-3.5 h-3.5"})})]}):null}var l7=e.i(55332),l9=e.i(58858);e.s(["default",0,function(){let[e,t]=(0,a.useState)("live"),[r,s]=(0,a.useState)("cases"),[l,i]=(0,a.useState)(!1),[o,c]=(0,a.useState)(!1);(0,a.useEffect)(()=>{i(!(0,l7.p)()),c((0,l9.p)());{let e=new URLSearchParams(window.location.search);"mock"===(e.get("source")||e.get("mode"))&&t("mock");let r=e.get("preset");r&&s(r)}},[]);let{traces:d,connected:h,live:u,isRefreshing:f,refresh:x}=(0,l8.f)({mode:e,preset:r}),p=(0,a.useMemo)(()=>sd(d),[d]);return(0,n.jsxs)("main",{className:"h-screen w-screen overflow-hidden bg-[var(--bg-workbench)]",children:[(0,n.jsx)(l6,{}),(0,n.jsx)(l4,{traces:d,office:p,mode:e,mockPreset:r,onModeChange:e=>t(e),onPresetChange:e=>s(e),connected:h,live:u,isRefreshing:f,onRefresh:x,soundEnabled:l,onToggleSound:()=>{i((0,l7.Z)())},notifEnabled:o,onToggleNotif:()=>{c((0,l9.i)())}})]})}],74647)}]);