titan-agent 7.0.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/README.md +54 -2
  2. package/dist/agent/agent.js +55 -10
  3. package/dist/agent/agent.js.map +1 -1
  4. package/dist/agent/contextManager.js +1 -1
  5. package/dist/agent/contextManager.js.map +1 -1
  6. package/dist/agent/honestyGuard.js +66 -0
  7. package/dist/agent/honestyGuard.js.map +1 -0
  8. package/dist/agent/selfCritique.js +101 -0
  9. package/dist/agent/selfCritique.js.map +1 -0
  10. package/dist/agent/toolSearch.js +9 -2
  11. package/dist/agent/toolSearch.js.map +1 -1
  12. package/dist/agent/trajectoryLogger.js +19 -2
  13. package/dist/agent/trajectoryLogger.js.map +1 -1
  14. package/dist/analytics/collector.js +1 -1
  15. package/dist/analytics/collector.js.map +1 -1
  16. package/dist/config/schema.js +32 -0
  17. package/dist/config/schema.js.map +1 -1
  18. package/dist/eval/harness.js +4 -1
  19. package/dist/eval/harness.js.map +1 -1
  20. package/dist/gateway/server.js +24 -8
  21. package/dist/gateway/server.js.map +1 -1
  22. package/dist/gateway/slashCommands.js +31 -0
  23. package/dist/gateway/slashCommands.js.map +1 -1
  24. package/dist/mcp/agentTools.js +135 -0
  25. package/dist/mcp/agentTools.js.map +1 -0
  26. package/dist/mcp/server.js +19 -2
  27. package/dist/mcp/server.js.map +1 -1
  28. package/dist/memory/graph.js +2 -0
  29. package/dist/memory/graph.js.map +1 -1
  30. package/dist/providers/errorTaxonomy.js +4 -0
  31. package/dist/providers/errorTaxonomy.js.map +1 -1
  32. package/dist/providers/moa.js +151 -0
  33. package/dist/providers/moa.js.map +1 -0
  34. package/dist/providers/modelCapabilities.js +65 -2
  35. package/dist/providers/modelCapabilities.js.map +1 -1
  36. package/dist/providers/ollama.js +1 -0
  37. package/dist/providers/ollama.js.map +1 -1
  38. package/dist/providers/openai_compat.js +14 -2
  39. package/dist/providers/openai_compat.js.map +1 -1
  40. package/dist/providers/router.js +3 -1
  41. package/dist/providers/router.js.map +1 -1
  42. package/dist/utils/benchMode.js +8 -0
  43. package/dist/utils/benchMode.js.map +1 -0
  44. package/dist/utils/constants.js +1 -1
  45. package/dist/utils/constants.js.map +1 -1
  46. package/package.json +26 -26
  47. package/ui/dist/assets/AboutYouMemory-57X5SqHQ.js +1 -0
  48. package/ui/dist/assets/AuditPanel-AyB8ciLZ.js +1 -0
  49. package/ui/dist/assets/AutonomyPanel-wmVPr-n3.js +1 -0
  50. package/ui/dist/assets/AutopilotPanel-CbLy4lJP.js +1 -0
  51. package/ui/dist/assets/AutoresearchPanel-DxRO1rBF.js +1 -0
  52. package/ui/dist/assets/BackupPanel-BUh9rQ-3.js +1 -0
  53. package/ui/dist/assets/BrowserPanel-OqKwGrIL.js +1 -0
  54. package/ui/dist/assets/CPActivity-DGfS7EY3.js +1 -0
  55. package/ui/dist/assets/CPAgentDetail-p0Kvzhhb.js +1 -0
  56. package/ui/dist/assets/CPAgents-B6wSSQZM.js +1 -0
  57. package/ui/dist/assets/CPApprovals-CYv9Do0i.js +1 -0
  58. package/ui/dist/assets/CPCosts-Dx6Q71rN.js +1 -0
  59. package/ui/dist/assets/CPDashboard-DA8-tE-l.js +1 -0
  60. package/ui/dist/assets/CPFiles-BJ49tzai.js +1 -0
  61. package/ui/dist/assets/CPGoals-h0dKL5V_.js +1 -0
  62. package/ui/dist/assets/CPInbox-CDvefgNH.js +1 -0
  63. package/ui/dist/assets/CPIssueDetail-CnmLzzDD.js +1 -0
  64. package/ui/dist/assets/CPIssues-DknAIMyl.js +1 -0
  65. package/ui/dist/assets/CPLayout-C2nqgkmY.js +2 -0
  66. package/ui/dist/assets/CPOrg-tDbHFphX.js +1 -0
  67. package/ui/dist/assets/CPRuns-UlrIURqG.js +1 -0
  68. package/ui/dist/assets/CPSocial-B-gHgvEw.js +1 -0
  69. package/ui/dist/assets/CPVoice-CJy938ZF.js +1 -0
  70. package/ui/dist/assets/ChannelsPanel-DLbxg1zO.js +1 -0
  71. package/ui/dist/assets/CheckpointsPanel-BB6TT0aE.js +1 -0
  72. package/ui/dist/assets/CommandPostHub-fIslwU_t.js +2 -0
  73. package/ui/dist/assets/ConfirmDialog-6hcNjmAh.js +9 -0
  74. package/ui/dist/assets/CronPanel-DLpw3Y25.js +1 -0
  75. package/ui/dist/assets/DataTable-KVqtDzvP.js +1 -0
  76. package/ui/dist/assets/DreamPanel-lcMXpbEb.js +5 -0
  77. package/ui/dist/assets/EmptyState-D-Dg8B8r.js +1 -0
  78. package/ui/dist/assets/EvalHarnessPanel-BKzRiiQw.js +2 -0
  79. package/ui/dist/assets/EvalPanel-Dtodacmj.js +1 -0
  80. package/ui/dist/assets/FileViewer-DjcVKkO2.js +60 -0
  81. package/ui/dist/assets/FilesPanel-BI90Pplh.js +1 -0
  82. package/ui/dist/assets/FleetPanel-tr0wjAwr.js +1 -0
  83. package/ui/dist/assets/HomelabPanel-m8vMm5rE.js +1 -0
  84. package/ui/dist/assets/InfraView-3WriJnyE.js +2 -0
  85. package/ui/dist/assets/IntegrationsPanel-BmL70fOw.js +1 -0
  86. package/ui/dist/assets/IntelligenceView-BGVxCKD3.js +2 -0
  87. package/ui/dist/assets/LearningPanel-CrYLQ6eV.js +1 -0
  88. package/ui/dist/assets/LiveStudio-CnW3eZYF.js +2 -0
  89. package/ui/dist/assets/LogsPanel-DbShr4Ic.js +1 -0
  90. package/ui/dist/assets/McpPanel-uMYEsPI4.js +1 -0
  91. package/ui/dist/assets/MemoryGraphPanel-C7-Z8f0v.js +1 -0
  92. package/ui/dist/assets/MemoryTaxonomyPanel-KrxN8U1G.js +1 -0
  93. package/ui/dist/assets/MemoryWikiPanel-DI3q6IHC.js +1 -0
  94. package/ui/dist/assets/MeshPanel-D4-g2tlu.js +1 -0
  95. package/ui/dist/assets/MissionCanvas-D8cjakJe.js +61 -0
  96. package/ui/dist/assets/MissionChat-BvqCUf1E.js +3 -0
  97. package/ui/dist/assets/MissionLibrary-CZoJQ9WD.js +1 -0
  98. package/ui/dist/assets/MissionStart-CXCq-_AD.js +1 -0
  99. package/ui/dist/assets/NvidiaPanel-BfI1K5Pg.js +1 -0
  100. package/ui/dist/assets/OrganismPanel-B7Gm9pP-.js +1 -0
  101. package/ui/dist/assets/OverviewPanel-B9tKWRK2.js +1 -0
  102. package/ui/dist/assets/PageHeader-CH85uoZG.js +1 -0
  103. package/ui/dist/assets/PersonaProfilesPanel-BPi8fl-U.js +3 -0
  104. package/ui/dist/assets/PersonasPanel-Dwr7sycT.js +1 -0
  105. package/ui/dist/assets/PhoneDeskPanel-D7qc6wUI.js +1 -0
  106. package/ui/dist/assets/RecipesPanel-DcqPWRSU.js +1 -0
  107. package/ui/dist/assets/SecurityPanel-Bv_B9Ahf.js +1 -0
  108. package/ui/dist/assets/SelfImprovePanel-Ca4rGwEG.js +1 -0
  109. package/ui/dist/assets/SelfProposalsPanel-DteMSASq.js +1 -0
  110. package/ui/dist/assets/SessionsPanel-BdbbKTbL.js +1 -0
  111. package/ui/dist/assets/SessionsTab-BJipiVJs.js +1 -0
  112. package/ui/dist/assets/SettingsPanel-mV7ykOCc.js +1 -0
  113. package/ui/dist/assets/SettingsView-Bu_wYTT5.js +2 -0
  114. package/ui/dist/assets/SkeletonLoader-9H7QWa9E.js +1 -0
  115. package/ui/dist/assets/SkillsPanel-CHwX2kDR.js +1 -0
  116. package/ui/dist/assets/SomaView-Bpsm4ZW7.js +5 -0
  117. package/ui/dist/assets/SomaView-Dghh9om4.css +1 -0
  118. package/ui/dist/assets/StatCard-wmSgMAM3.js +1 -0
  119. package/ui/dist/assets/TeamsPanel-XJiHxdDX.js +1 -0
  120. package/ui/dist/assets/TelemetryPanel-_pmGVxpO.js +1 -0
  121. package/ui/dist/assets/TitanCanvas-Cb7KG80W.css +1 -0
  122. package/ui/dist/assets/TitanCanvas-CmLy7p2N.js +883 -0
  123. package/ui/dist/assets/ToolsView-PHizHZBx.js +2 -0
  124. package/ui/dist/assets/TraceViewer-CYAzIcfB.js +1 -0
  125. package/ui/dist/assets/TracesPanel-CRSN_dzK.js +1 -0
  126. package/ui/dist/assets/TrainingPanel-B9rcuMsV.js +1 -0
  127. package/ui/dist/assets/VoiceOverlay-BL_ns1ZA.js +7 -0
  128. package/ui/dist/assets/VramPanel-BNPQ06_9.js +1 -0
  129. package/ui/dist/assets/WatchView-BgAkNnur.js +13 -0
  130. package/ui/dist/assets/WorkTab-RRpPpEOg.js +1 -0
  131. package/ui/dist/assets/WorkflowBuilderPanel-BPHIH8pf.js +1 -0
  132. package/ui/dist/assets/WorkflowsPanel-DqtmT0NB.js +1 -0
  133. package/ui/dist/assets/approvalHeadline-BRg3ReTi.js +1 -0
  134. package/ui/dist/assets/archive-DcK9HrbE.js +1 -0
  135. package/ui/dist/assets/arrow-left-4c2FnES1.js +1 -0
  136. package/ui/dist/assets/book-open-Ds_yciQm.js +1 -0
  137. package/ui/dist/assets/bot-CWDCc265.js +1 -0
  138. package/ui/dist/assets/chart-column-hhZMdCgB.js +1 -0
  139. package/ui/dist/assets/chevron-right-A_pvnRh_.js +1 -0
  140. package/ui/dist/assets/circle-check-big-C-JUM7wb.js +1 -0
  141. package/ui/dist/assets/circle-stop-yZuG9ZAE.js +1 -0
  142. package/ui/dist/assets/clipboard-list-C2HUEjZc.js +1 -0
  143. package/ui/dist/assets/clock-DSPgndSD.js +1 -0
  144. package/ui/dist/assets/clsx-CjueKrWZ.js +1 -0
  145. package/ui/dist/assets/createLucideIcon-qnlrxww7.js +1 -0
  146. package/ui/dist/assets/database-C1SgHa8T.js +1 -0
  147. package/ui/dist/assets/dollar-sign-D9siqK91.js +1 -0
  148. package/ui/dist/assets/download-CJZWQNfV.js +1 -0
  149. package/ui/dist/assets/external-link-CpQLWKKE.js +1 -0
  150. package/ui/dist/assets/file-text-BbGTi-Po.js +1 -0
  151. package/ui/dist/assets/flask-conical-B1YVft4E.js +1 -0
  152. package/ui/dist/assets/folder-EbR-w2Mq.js +1 -0
  153. package/ui/dist/assets/funnel-D2Dkn8Pf.js +1 -0
  154. package/ui/dist/assets/git-branch-CQ2yNSzU.js +1 -0
  155. package/ui/dist/assets/git-pull-request-BxL5wlGX.js +1 -0
  156. package/ui/dist/assets/index-Cz8190xO.css +2 -0
  157. package/ui/dist/assets/index-WI-E4I3h.js +243 -0
  158. package/ui/dist/assets/jsx-runtime-B15e6lOy.js +1 -0
  159. package/ui/dist/assets/layers-BPu5SRjI.js +1 -0
  160. package/ui/dist/assets/legacy-BIzifT-t.js +3 -0
  161. package/ui/dist/assets/lightbulb-BY7CpMte.js +1 -0
  162. package/ui/dist/assets/link-VDQkrGJw.js +1 -0
  163. package/ui/dist/assets/list-todo-DfnNUV_T.js +1 -0
  164. package/ui/dist/assets/message-square-BpzrINHz.js +1 -0
  165. package/ui/dist/assets/mic-De6oZFaV.js +1 -0
  166. package/ui/dist/assets/missions-y-qg_f9b.js +1 -0
  167. package/ui/dist/assets/network-CM7y1ats.js +1 -0
  168. package/ui/dist/assets/pause-C4TDJSfA.js +1 -0
  169. package/ui/dist/assets/pencil-Dd_vzHE-.js +1 -0
  170. package/ui/dist/assets/play-9WxZWVHA.js +1 -0
  171. package/ui/dist/assets/plug-Dm25Wbrc.js +1 -0
  172. package/ui/dist/assets/plus-CHryCIkk.js +1 -0
  173. package/ui/dist/assets/radio-D-XnoAVu.js +1 -0
  174. package/ui/dist/assets/refresh-cw-Disd5wRB.js +1 -0
  175. package/ui/dist/assets/rotate-ccw-Cw1T2W1T.js +1 -0
  176. package/ui/dist/assets/save-DP7oNar2.js +1 -0
  177. package/ui/dist/assets/search-aNVcX-nv.js +1 -0
  178. package/ui/dist/assets/send-D7iQD57b.js +1 -0
  179. package/ui/dist/assets/server-DFfeYjoM.js +1 -0
  180. package/ui/dist/assets/settings-5NWXzgyY.js +1 -0
  181. package/ui/dist/assets/shared-DLz_Jtg3.js +1 -0
  182. package/ui/dist/assets/shield-check-Cd50jCAn.js +1 -0
  183. package/ui/dist/assets/square-DlcoJ1ZM.js +1 -0
  184. package/ui/dist/assets/terminal-DgFz2Vsf.js +1 -0
  185. package/ui/dist/assets/test-tube-BimtS92_.js +1 -0
  186. package/ui/dist/assets/toggle-right-BMaR-sfT.js +1 -0
  187. package/ui/dist/assets/trash-2-CwUv7ww1.js +1 -0
  188. package/ui/dist/assets/trending-up-Ba9TwEow.js +1 -0
  189. package/ui/dist/assets/trophy-Gfv1QC45.js +1 -0
  190. package/ui/dist/assets/volume-2-BVlfVl2U.js +1 -0
  191. package/ui/dist/assets/wifi-off-CWLeusSV.js +1 -0
  192. package/ui/dist/assets/zoom-out-DeggJ7RM.js +1 -0
  193. package/ui/dist/index.html +4 -2
  194. package/ui/dist/sw.js +1 -1
  195. package/ui/dist/assets/AboutYouMemory-CZKEOd_O.js +0 -11
  196. package/ui/dist/assets/AuditPanel-Bu71N5Er.js +0 -1
  197. package/ui/dist/assets/AutonomyPanel-DB-39dX4.js +0 -11
  198. package/ui/dist/assets/AutopilotPanel-Cj8oKxWv.js +0 -1
  199. package/ui/dist/assets/AutoresearchPanel-3s8pjm6Z.js +0 -6
  200. package/ui/dist/assets/BackupPanel-EUQJMJE7.js +0 -1
  201. package/ui/dist/assets/BrowserPanel-Beo4F5Ar.js +0 -6
  202. package/ui/dist/assets/Button-MdXmb4_n.js +0 -1
  203. package/ui/dist/assets/CPActivity-B1Se9VVc.js +0 -1
  204. package/ui/dist/assets/CPAgentDetail-BYji6tT8.js +0 -1
  205. package/ui/dist/assets/CPAgents-BSUKucTe.js +0 -1
  206. package/ui/dist/assets/CPApprovals-B4v0em6e.js +0 -1
  207. package/ui/dist/assets/CPCosts-9ikh61Kv.js +0 -1
  208. package/ui/dist/assets/CPDashboard-sOok2T5v.js +0 -1
  209. package/ui/dist/assets/CPFiles-DB2nY5JE.js +0 -1
  210. package/ui/dist/assets/CPGoals-8Z1yOY8e.js +0 -1
  211. package/ui/dist/assets/CPInbox-Cq6-UY8F.js +0 -11
  212. package/ui/dist/assets/CPIssueDetail-NAGfmJg8.js +0 -1
  213. package/ui/dist/assets/CPIssues-BzX6Rckx.js +0 -1
  214. package/ui/dist/assets/CPLayout-BcRM6QSg.js +0 -2
  215. package/ui/dist/assets/CPOrg-B7DQ4UQP.js +0 -1
  216. package/ui/dist/assets/CPRuns-D-cpPw_M.js +0 -1
  217. package/ui/dist/assets/CPSocial-DshtmcK0.js +0 -11
  218. package/ui/dist/assets/CPVoice-DfXRnQVU.js +0 -1
  219. package/ui/dist/assets/ChannelsPanel-BnaTOeyf.js +0 -1
  220. package/ui/dist/assets/CheckpointsPanel-C62naE4U.js +0 -1
  221. package/ui/dist/assets/CommandPostHub-B_L1CAss.js +0 -24
  222. package/ui/dist/assets/ConfirmDialog-VErHWAbo.js +0 -1
  223. package/ui/dist/assets/CronPanel-BwMrrZ5d.js +0 -1
  224. package/ui/dist/assets/DataTable-BCqSUuN7.js +0 -1
  225. package/ui/dist/assets/DreamPanel-BNAcCLBB.js +0 -15
  226. package/ui/dist/assets/EmptyState-D9kQf1PX.js +0 -1
  227. package/ui/dist/assets/EvalHarnessPanel-BaMLdBNm.js +0 -2
  228. package/ui/dist/assets/EvalPanel-CW-SSjtg.js +0 -1
  229. package/ui/dist/assets/FileViewer-BL00nsd7.js +0 -61
  230. package/ui/dist/assets/FilesPanel-CeC6YUSd.js +0 -16
  231. package/ui/dist/assets/FleetPanel-EyWF7l3W.js +0 -1
  232. package/ui/dist/assets/HomelabPanel-BRfKRYe7.js +0 -6
  233. package/ui/dist/assets/InfraView-Jmqhg_Yc.js +0 -2
  234. package/ui/dist/assets/InlineEditableField-DgMrLDj1.js +0 -1
  235. package/ui/dist/assets/Input-CBTwa_Iw.js +0 -1
  236. package/ui/dist/assets/IntegrationsPanel-DQL-7Ec6.js +0 -1
  237. package/ui/dist/assets/IntelligenceView-DxD78qfP.js +0 -2
  238. package/ui/dist/assets/LearningPanel-C_JzSbJU.js +0 -1
  239. package/ui/dist/assets/LiveStudio-Db5yeaWo.js +0 -7
  240. package/ui/dist/assets/LogsPanel-CpinKwaZ.js +0 -1
  241. package/ui/dist/assets/McpPanel-D-MqN_f-.js +0 -1
  242. package/ui/dist/assets/MemoryGraphPanel-BnD5jRqf.js +0 -1
  243. package/ui/dist/assets/MemoryTaxonomyPanel-BBI202dd.js +0 -6
  244. package/ui/dist/assets/MemoryWikiPanel-Dn3XZHL0.js +0 -6
  245. package/ui/dist/assets/MeshPanel-C-mRJpr0.js +0 -11
  246. package/ui/dist/assets/MissionCanvas-CbZW83Ch.js +0 -72
  247. package/ui/dist/assets/MissionChat-Bs75jPAD.js +0 -7
  248. package/ui/dist/assets/MissionLibrary-BxQ6SxPe.js +0 -5
  249. package/ui/dist/assets/MissionStart-CBuBPasl.js +0 -1
  250. package/ui/dist/assets/Modal-ybPGvlQs.js +0 -9
  251. package/ui/dist/assets/NvidiaPanel-DdG13OX4.js +0 -1
  252. package/ui/dist/assets/OrganismPanel-xZWUJKyr.js +0 -1
  253. package/ui/dist/assets/OverviewPanel-B45ZYhJV.js +0 -1
  254. package/ui/dist/assets/PageHeader-DdrbS1aq.js +0 -1
  255. package/ui/dist/assets/PersonaProfilesPanel-CKER-EU5.js +0 -8
  256. package/ui/dist/assets/PersonasPanel-CMMQ3nh3.js +0 -1
  257. package/ui/dist/assets/PhoneDeskPanel-Bw_Y-cVE.js +0 -11
  258. package/ui/dist/assets/RecipesPanel-DzMcxpJJ.js +0 -1
  259. package/ui/dist/assets/SecurityPanel-BCq3Fzbr.js +0 -1
  260. package/ui/dist/assets/SelfImprovePanel-YE3hT8jK.js +0 -1
  261. package/ui/dist/assets/SelfProposalsPanel-DXuqBM6p.js +0 -1
  262. package/ui/dist/assets/SessionsPanel-DORz5goR.js +0 -1
  263. package/ui/dist/assets/SessionsTab-qYHDOuC8.js +0 -1
  264. package/ui/dist/assets/SettingsPanel-BbwPu1i7.js +0 -1
  265. package/ui/dist/assets/SettingsView-zgqkDDBJ.js +0 -2
  266. package/ui/dist/assets/SkeletonLoader-r6OGXaU9.js +0 -1
  267. package/ui/dist/assets/SkillsPanel-BjEOBMRo.js +0 -11
  268. package/ui/dist/assets/SomaView-BtCkeWfZ.css +0 -1
  269. package/ui/dist/assets/SomaView-DLzApZVW.js +0 -5
  270. package/ui/dist/assets/StatCard-DLq8aBps.js +0 -1
  271. package/ui/dist/assets/StatusBadge-BqlvIbdj.js +0 -1
  272. package/ui/dist/assets/Tabs-DdUThlp1.js +0 -1
  273. package/ui/dist/assets/TeamsPanel-uIIKoU7I.js +0 -1
  274. package/ui/dist/assets/TelemetryPanel-dVr3yQQr.js +0 -1
  275. package/ui/dist/assets/TitanCanvas-BfitWg9R.css +0 -1
  276. package/ui/dist/assets/TitanCanvas-xHAJqwG2.js +0 -945
  277. package/ui/dist/assets/ToolsView-CG1mZdiy.js +0 -2
  278. package/ui/dist/assets/Tooltip-C2tXJcrN.js +0 -6
  279. package/ui/dist/assets/TraceViewer-BIMD_Osr.js +0 -1
  280. package/ui/dist/assets/TracesPanel-nMUiyMj5.js +0 -1
  281. package/ui/dist/assets/TrainingPanel-CT5R4HWm.js +0 -1
  282. package/ui/dist/assets/VoiceOverlay-Br4QnCtw.js +0 -17
  283. package/ui/dist/assets/VramPanel-CdnJYytg.js +0 -1
  284. package/ui/dist/assets/WatchView-TNU6Ns1Q.js +0 -13
  285. package/ui/dist/assets/WorkTab-wTlX_UKP.js +0 -1
  286. package/ui/dist/assets/WorkflowBuilderPanel-CDpVt5ux.js +0 -6
  287. package/ui/dist/assets/WorkflowsPanel-zsFqsLdn.js +0 -11
  288. package/ui/dist/assets/approvalHeadline-DB9SgR-9.js +0 -1
  289. package/ui/dist/assets/archive-Bh689DNg.js +0 -6
  290. package/ui/dist/assets/arrow-left-WkVYLm80.js +0 -6
  291. package/ui/dist/assets/book-open-ohEXgUsS.js +0 -6
  292. package/ui/dist/assets/bot-DvEcyQcD.js +0 -6
  293. package/ui/dist/assets/chart-column-w3goFd5f.js +0 -6
  294. package/ui/dist/assets/check-CuRYh4Zh.js +0 -6
  295. package/ui/dist/assets/chevron-right-DbLSHmff.js +0 -6
  296. package/ui/dist/assets/circle-check-big-Bkba568b.js +0 -6
  297. package/ui/dist/assets/circle-stop-Bx2ohEg8.js +0 -6
  298. package/ui/dist/assets/clipboard-list-Dj9tORnu.js +0 -6
  299. package/ui/dist/assets/clock-JyQAYy6X.js +0 -6
  300. package/ui/dist/assets/clsx-B-dksMZM.js +0 -1
  301. package/ui/dist/assets/dollar-sign-XxwPAA2a.js +0 -6
  302. package/ui/dist/assets/download-D1izVEOL.js +0 -6
  303. package/ui/dist/assets/external-link-DZ_rZsIt.js +0 -6
  304. package/ui/dist/assets/file-text-Cfawu8Bs.js +0 -6
  305. package/ui/dist/assets/flask-conical-Ql8QxhgY.js +0 -6
  306. package/ui/dist/assets/folder-DAdIw-Pb.js +0 -6
  307. package/ui/dist/assets/funnel-FycfZcXo.js +0 -6
  308. package/ui/dist/assets/git-branch-C2qrhGGu.js +0 -6
  309. package/ui/dist/assets/index-Cml2x9pA.js +0 -507
  310. package/ui/dist/assets/index-yWybhcfI.css +0 -1
  311. package/ui/dist/assets/layers-yzjtGlHB.js +0 -6
  312. package/ui/dist/assets/legacy-D21WSMF1.js +0 -3
  313. package/ui/dist/assets/lightbulb-BZJNK69S.js +0 -6
  314. package/ui/dist/assets/link-CnFkBkaY.js +0 -6
  315. package/ui/dist/assets/list-todo-BlgfQHup.js +0 -6
  316. package/ui/dist/assets/message-square-CRsG9u6_.js +0 -6
  317. package/ui/dist/assets/mic-B32RHc7Y.js +0 -6
  318. package/ui/dist/assets/missions-1iw8Z2_0.js +0 -1
  319. package/ui/dist/assets/network-C9RXQGrV.js +0 -6
  320. package/ui/dist/assets/pause-BT1Bc2q3.js +0 -6
  321. package/ui/dist/assets/pencil-BK5IU6o0.js +0 -6
  322. package/ui/dist/assets/play-Cl1nC_gc.js +0 -6
  323. package/ui/dist/assets/plug-DvcpOalj.js +0 -6
  324. package/ui/dist/assets/plus-Dpo1qfrl.js +0 -6
  325. package/ui/dist/assets/radio-C5c9IyqX.js +0 -6
  326. package/ui/dist/assets/refresh-cw-C-iZkzuS.js +0 -6
  327. package/ui/dist/assets/rotate-ccw-qzrB3SNw.js +0 -6
  328. package/ui/dist/assets/save-DwR9wQVu.js +0 -6
  329. package/ui/dist/assets/search-D10l0m3-.js +0 -6
  330. package/ui/dist/assets/send-DtXGsaFW.js +0 -6
  331. package/ui/dist/assets/server-BzisF3LL.js +0 -6
  332. package/ui/dist/assets/settings-Dbwd1_-c.js +0 -6
  333. package/ui/dist/assets/shield-check-CXlDJyAW.js +0 -6
  334. package/ui/dist/assets/square-BBC-JKzY.js +0 -11
  335. package/ui/dist/assets/terminal-DaBIlWEM.js +0 -6
  336. package/ui/dist/assets/test-tube-CDATRD5t.js +0 -11
  337. package/ui/dist/assets/toggle-right-DTmrC5RD.js +0 -11
  338. package/ui/dist/assets/trash-2-CTeyjxD_.js +0 -6
  339. package/ui/dist/assets/trending-up-CXPRjRV4.js +0 -6
  340. package/ui/dist/assets/trophy-DbVdXRtU.js +0 -6
  341. package/ui/dist/assets/volume-2-DYDBmm3M.js +0 -6
  342. package/ui/dist/assets/wifi-off-BBuIGbiP.js +0 -6
  343. package/ui/dist/assets/zoom-out-D47_pRAO.js +0 -16
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkTab-RRpPpEOg.js","assets/jsx-runtime-B15e6lOy.js","assets/external-link-CpQLWKKE.js","assets/createLucideIcon-qnlrxww7.js","assets/pause-C4TDJSfA.js","assets/play-9WxZWVHA.js","assets/plus-CHryCIkk.js","assets/rotate-ccw-Cw1T2W1T.js","assets/trash-2-CwUv7ww1.js","assets/index-WI-E4I3h.js","assets/index-Cz8190xO.css","assets/ConfirmDialog-6hcNjmAh.js","assets/clsx-CjueKrWZ.js","assets/SessionsTab-BJipiVJs.js","assets/CPInbox-CDvefgNH.js","assets/bot-CWDCc265.js","assets/pencil-Dd_vzHE-.js","assets/square-DlcoJ1ZM.js","assets/shared-DLz_Jtg3.js","assets/PageHeader-CH85uoZG.js","assets/chevron-right-A_pvnRh_.js","assets/EmptyState-D-Dg8B8r.js","assets/SkeletonLoader-9H7QWa9E.js","assets/DataTable-KVqtDzvP.js","assets/StatCard-wmSgMAM3.js","assets/clock-DSPgndSD.js","assets/funnel-D2Dkn8Pf.js","assets/message-square-BpzrINHz.js","assets/send-D7iQD57b.js","assets/shield-check-Cd50jCAn.js","assets/approvalHeadline-BRg3ReTi.js","assets/CPFiles-BJ49tzai.js","assets/file-text-BbGTi-Po.js","assets/flask-conical-B1YVft4E.js","assets/folder-EbR-w2Mq.js","assets/refresh-cw-Disd5wRB.js","assets/search-aNVcX-nv.js","assets/TraceViewer-CYAzIcfB.js","assets/arrow-left-4c2FnES1.js","assets/chart-column-hhZMdCgB.js","assets/git-branch-CQ2yNSzU.js","assets/trending-up-Ba9TwEow.js","assets/CPSocial-B-gHgvEw.js","assets/lightbulb-BY7CpMte.js","assets/CPDashboard-DA8-tE-l.js","assets/dollar-sign-D9siqK91.js","assets/list-todo-DfnNUV_T.js","assets/CPGoals-h0dKL5V_.js","assets/CPAgents-B6wSSQZM.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./bot-CWDCc265.js";import{t as a}from"./chart-column-hhZMdCgB.js";import{t as o}from"./chevron-right-A_pvnRh_.js";import{n as s,t as c}from"./shared-DLz_Jtg3.js";import{t as l}from"./circle-stop-yZuG9ZAE.js";import{t as u}from"./clock-DSPgndSD.js";import{t as d}from"./dollar-sign-D9siqK91.js";import{t as f}from"./file-text-BbGTi-Po.js";import{t as p}from"./git-branch-CQ2yNSzU.js";import{t as m}from"./message-square-BpzrINHz.js";import{t as h}from"./pause-C4TDJSfA.js";import{t as g}from"./plus-CHryCIkk.js";import{t as _}from"./refresh-cw-Disd5wRB.js";import{t as v}from"./send-D7iQD57b.js";import{t as y}from"./terminal-DgFz2Vsf.js";import{t as b}from"./trash-2-CwUv7ww1.js";import{$ as x,A as S,B as C,Ct as w,Gn as ee,H as T,I as E,Jn as te,Kn as D,Ln as ne,N as re,St as ie,U as O,Wn as ae,X as oe,Y as se,Z as ce,a as k,bt as le,c as A,et as ue,f as j,gt as de,h as M,j as N,kt as fe,p as pe,pn as me,rt as P,sr as F,u as I,vn as L,wn as R,xt as z}from"./index-WI-E4I3h.js";import{r as B,t as V}from"./ConfirmDialog-6hcNjmAh.js";import{t as he}from"./approvalHeadline-BRg3ReTi.js";var H=r(`briefcase`,[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),U=r(`building-2`,[[`path`,{d:`M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z`,key:`1b4qmf`}],[`path`,{d:`M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2`,key:`i71pzd`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2`,key:`10jefs`}],[`path`,{d:`M10 6h4`,key:`1itunk`}],[`path`,{d:`M10 10h4`,key:`tcdvrf`}],[`path`,{d:`M10 14h4`,key:`kelpxr`}],[`path`,{d:`M10 18h4`,key:`1ulq68`}]]),ge=r(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),W=r(`scale`,[[`path`,{d:`m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z`,key:`7g6ntu`}],[`path`,{d:`m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z`,key:`ijws7r`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}],[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2`,key:`3gwbw2`}]]),G=e(t(),1),K=n();function _e(e){switch(e){case`active`:return(0,K.jsx)(E,{size:12,className:`text-success animate-pulse`});case`paused`:return(0,K.jsx)(h,{size:12,className:`text-warning`});case`error`:return(0,K.jsx)(j,{size:12,className:`text-error`});default:return(0,K.jsx)(i,{size:12,className:`text-text-muted`})}}function ve(e){switch(e){case`active`:return`border-success/30 bg-success/5`;case`paused`:return`border-warning/30 bg-warning/5`;case`error`:return`border-error/30 bg-error/5`;default:return`border-border bg-bg-secondary`}}function ye({agents:e,runs:t,collapsed:n=!1,onToggle:r,onAgentClick:i}){let[a,s]=(0,G.useState)(null);return n?(0,K.jsxs)(`div`,{className:`w-10 border-l border-border bg-bg-secondary flex flex-col items-center py-3 gap-3 shrink-0`,children:[(0,K.jsx)(`button`,{onClick:r,className:`p-1.5 rounded hover:bg-bg-tertiary text-text-muted`,children:(0,K.jsx)(re,{size:14})}),e.map(e=>(0,K.jsxs)(`button`,{className:`relative`,title:e.name,onClick:()=>i?.(e),children:[(0,K.jsx)(`div`,{className:`w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-bold ${e.status===`error`?`bg-error/20 text-error`:e.status===`active`?`bg-success/20 text-success`:`bg-bg-tertiary text-text-muted`}`,children:e.name.charAt(0).toUpperCase()}),e.status===`active`&&(0,K.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-success animate-pulse`})]},e.id))]}):(0,K.jsxs)(`div`,{className:`w-64 border-l border-border bg-bg-secondary flex flex-col h-full shrink-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold text-text-muted uppercase tracking-wide`,children:`Agents`}),(0,K.jsx)(`button`,{onClick:r,className:`p-1 rounded hover:bg-bg-tertiary text-text-muted`,children:(0,K.jsx)(o,{size:14})})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-2 space-y-2`,children:[e.length===0&&(0,K.jsx)(`div`,{className:`text-center py-4 text-xs text-text-muted`,children:`No agents registered`}),e.map(e=>{let n=a===e.id,r=t.filter(t=>t.agentId===e.id),c=r[0],l=r.filter(e=>e.status===`failed`||e.status===`error`).length;return(0,K.jsxs)(`div`,{className:`rounded-lg border p-2 cursor-pointer transition-colors ${ve(e.status)}`,onClick:t=>{t.target.closest(`.expand-toggle`)?s(n?null:e.id):i?.(e)},children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`w-7 h-7 rounded-full flex items-center justify-center text-[10px] font-bold ${e.status===`error`?`bg-error/20 text-error`:e.status===`active`?`bg-success/20 text-success`:`bg-bg-tertiary text-text-muted`}`,children:e.name.charAt(0).toUpperCase()}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium truncate`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-[10px] text-text-muted flex items-center gap-1`,children:[_e(e.status),(0,K.jsx)(`span`,{className:`capitalize`,children:e.status}),e.model&&(0,K.jsxs)(`span`,{className:`truncate`,children:[`· `,e.model.split(`/`).pop()]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.status===`active`&&(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-success animate-pulse`}),(0,K.jsx)(`button`,{className:`expand-toggle p-0.5 rounded hover:bg-bg-tertiary text-text-muted`,onClick:t=>{t.stopPropagation(),s(n?null:e.id)},children:(0,K.jsx)(o,{size:12,className:`transition-transform ${n?`rotate-90`:``}`})})]})]}),n&&(0,K.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-border/50 pt-2`,children:[(0,K.jsxs)(`div`,{className:`text-[10px] text-text-muted space-y-0.5`,children:[(0,K.jsxs)(`div`,{children:[`Role: `,e.role||`general`]}),(0,K.jsxs)(`div`,{children:[`Tasks: `,e.totalTasksCompleted??0,` completed`]}),e.totalCostUsd!==void 0&&(0,K.jsxs)(`div`,{children:[`Cost: $`,e.totalCostUsd.toFixed(2)]}),l>0&&(0,K.jsxs)(`div`,{className:`text-error`,children:[l,` failed run`,l===1?``:`s`]})]}),c&&(0,K.jsxs)(`div`,{className:`text-[10px] bg-bg rounded p-1.5 border border-border`,children:[(0,K.jsxs)(`div`,{className:`font-medium text-text-secondary flex items-center gap-1`,children:[c.status===`succeeded`?(0,K.jsx)(N,{size:10,className:`text-success`}):c.status===`failed`||c.status===`error`?(0,K.jsx)(S,{size:10,className:`text-error`}):(0,K.jsx)(E,{size:10,className:`text-cyan animate-pulse`}),`Latest run`]}),(0,K.jsxs)(`div`,{className:c.status===`failed`||c.status===`error`?`text-error`:`text-success`,children:[c.status,` · `,c.toolsUsed?.length??0,` tools`]}),c.error&&(0,K.jsx)(`div`,{className:`text-error truncate mt-0.5`,children:c.error})]})]})]},e.id)})]})]})}function q(e){let t={active:`bg-success/10 text-success border-success/20`,idle:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,paused:`bg-warning/10 text-warning border-warning/20`,error:`bg-error/10 text-error border-error/20`,stopped:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`};return t[e]||t.idle}function J(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function be({agent:e,onClose:t}){let{toast:n}=k(),[r,i]=(0,G.useState)([]),[o,s]=(0,G.useState)([]),[c,l]=(0,G.useState)(!0),[u,f]=(0,G.useState)(null),m=(0,G.useCallback)(async()=>{try{let[t,n]=await Promise.all([w(e.id,10),me(20,void 0)]);i(t),s(n.traces||[])}catch(e){l(t=>(t&&n(`error`,`Couldn't load agent activity — try again. ${e.message}`),t))}l(!1)},[e.id,n]);(0,G.useEffect)(()=>{m();let e=setInterval(m,1e4);return()=>clearInterval(e)},[m]);let h=r[0],g=r.filter(e=>e.status===`failed`||e.status===`error`),_=r.reduce((e,t)=>e+t.toolsUsed.length,0);return(0,K.jsx)(B,{open:!0,onClose:t,size:`lg`,title:e.name,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold border ${q(e.status)}`,children:e.name.charAt(0).toUpperCase()}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold text-text`,children:e.name}),(0,K.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full border capitalize ${q(e.status)}`,children:e.status})]}),(0,K.jsxs)(`div`,{className:`text-[11px] text-text-muted mt-0.5`,children:[e.title||e.role,` · `,e.model.split(`/`).pop(),` · heartbeat `,J(e.lastHeartbeat),` ago`]})]})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:[{icon:N,label:`Tasks`,value:e.totalTasksCompleted,color:`text-success`},{icon:d,label:`Cost`,value:`$${e.totalCostUsd.toFixed(2)}`,color:`text-warning`},{icon:A,label:`Tools`,value:_,color:`text-accent`},{icon:S,label:`Failed`,value:g.length,color:g.length>0?`text-error`:`text-text-muted`}].map(e=>(0,K.jsxs)(`div`,{className:`bg-bg-secondary border border-border rounded-lg p-2.5 text-center`,children:[(0,K.jsx)(e.icon,{size:14,className:`mx-auto mb-1 ${e.color}`}),(0,K.jsx)(`div`,{className:`text-sm font-bold text-text`,children:e.value}),(0,K.jsx)(`div`,{className:`text-[9px] text-text-muted uppercase tracking-wider`,children:e.label})]},e.label))}),e.status===`active`&&h&&h.status===`running`&&(0,K.jsxs)(`div`,{className:`bg-success/5 border border-success/20 rounded-lg p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-success mb-1`,children:[(0,K.jsx)(E,{size:12,className:`animate-pulse`}),(0,K.jsx)(`span`,{className:`font-medium`,children:`Currently working`})]}),(0,K.jsxs)(`div`,{className:`text-[11px] text-text-secondary`,children:[`Run started `,J(h.startedAt),` ago · `,h.toolsUsed.length,` tools used so far`]})]}),e.status===`error`&&h?.error&&(0,K.jsxs)(`div`,{className:`bg-error/5 border border-error/20 rounded-lg p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-error mb-1`,children:[(0,K.jsx)(j,{size:12}),(0,K.jsx)(`span`,{className:`font-medium`,children:`Last error`})]}),(0,K.jsx)(`div`,{className:`text-[11px] text-text-secondary font-mono`,children:h.error})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-text-secondary`,children:[(0,K.jsx)(p,{size:12,className:`text-accent`}),`Recent Runs`]}),(0,K.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[r.length,` total`]})]}),c?(0,K.jsx)(`div`,{className:`space-y-1.5`,children:[1,2,3].map(e=>(0,K.jsx)(`div`,{className:`h-10 rounded-lg bg-bg-secondary animate-pulse`},e))}):r.length===0?(0,K.jsx)(`div`,{className:`text-center py-4 text-[11px] text-text-muted`,children:`No runs recorded yet`}):(0,K.jsx)(`div`,{className:`space-y-1.5 max-h-48 overflow-y-auto pr-1`,children:r.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 rounded-lg bg-bg-secondary border border-border`,children:[e.status===`succeeded`?(0,K.jsx)(N,{size:12,className:`text-success shrink-0`}):e.status===`failed`||e.status===`error`?(0,K.jsx)(S,{size:12,className:`text-error shrink-0`}):(0,K.jsx)(xe,{size:12,className:`text-cyan animate-spin shrink-0`}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`text-[11px] text-text-secondary truncate`,children:[e.source,` · `,e.toolsUsed.length,` tools`]}),(0,K.jsxs)(`div`,{className:`text-[10px] text-text-muted`,children:[e.durationMs?`${e.durationMs}ms`:`...`,` · `,J(e.startedAt),` ago`]})]}),e.error&&(0,K.jsx)(`span`,{className:`text-[10px] text-error truncate max-w-[120px]`,title:e.error,children:e.error})]},e.id))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-text-secondary`,children:[(0,K.jsx)(a,{size:12,className:`text-accent`}),`Recent Traces`]}),(0,K.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[o.length,` loaded`]})]}),o.length===0?(0,K.jsx)(`div`,{className:`text-center py-4 text-[11px] text-text-muted`,children:`No traces available`}):(0,K.jsx)(`div`,{className:`space-y-1 max-h-40 overflow-y-auto pr-1`,children:o.slice(0,10).map(e=>(0,K.jsxs)(`button`,{onClick:()=>f(e),className:`w-full text-left px-2.5 py-2 rounded-lg bg-bg-secondary border border-border hover:bg-bg-secondary/30 transition-colors`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.status===`running`?(0,K.jsx)(E,{size:12,className:`text-cyan animate-pulse shrink-0`}):e.status===`completed`?(0,K.jsx)(N,{size:12,className:`text-success shrink-0`}):(0,K.jsx)(S,{size:12,className:`text-error shrink-0`}),(0,K.jsx)(`span`,{className:`text-[11px] text-text-secondary truncate flex-1`,children:e.message}),(0,K.jsx)(`span`,{className:`text-[10px] text-text-muted shrink-0`,children:e.totalMs?`${e.totalMs}ms`:`...`})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 mt-0.5 text-[10px] text-text-muted ml-5`,children:[(0,K.jsxs)(`span`,{children:[e.toolCalls.length,` tools`]}),(0,K.jsxs)(`span`,{children:[e.rounds,` rounds`]}),e.error&&(0,K.jsx)(`span`,{className:`text-error truncate`,children:e.error})]})]},e.traceId))})]}),u&&(0,K.jsx)(Se,{trace:u,onClose:()=>f(null)})]})})}function xe({size:e,className:t}){return(0,K.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`animate-spin ${t||``}`,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,fill:`none`,strokeDasharray:`31.4 31.4`,opacity:`0.3`}),(0,K.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`,stroke:`currentColor`,strokeWidth:`3`,fill:`none`})]})}function Se({trace:e,onClose:t}){return(0,K.jsx)(B,{open:!0,onClose:t,size:`md`,title:`Trace ${e.traceId.slice(0,8)}`,children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`div`,{className:`text-xs text-text-secondary truncate`,children:e.message}),(0,K.jsxs)(`div`,{className:`flex gap-3 text-[10px] text-text-muted`,children:[(0,K.jsx)(`span`,{className:e.status===`completed`?`text-success`:e.status===`failed`?`text-error`:`text-cyan`,children:e.status}),(0,K.jsxs)(`span`,{children:[e.totalMs,`ms`]}),(0,K.jsxs)(`span`,{children:[e.rounds,` rounds`]}),e.model&&(0,K.jsx)(`span`,{children:e.model.split(`/`).pop()})]}),e.spans.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-text-muted mb-1`,children:`Spans`}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.spans.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,K.jsx)(u,{size:10,className:`text-text-muted shrink-0`}),(0,K.jsx)(`span`,{className:`text-text-secondary font-mono`,children:e.name}),(0,K.jsxs)(`span`,{className:`text-text-muted`,children:[e.durationMs,`ms`]})]},t))})]}),e.toolCalls.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-text-muted mb-1`,children:`Tool Calls`}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.toolCalls.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,K.jsx)(A,{size:10,className:e.success?`text-success`:`text-error`}),(0,K.jsx)(`span`,{className:`text-text-secondary font-mono`,children:e.tool}),(0,K.jsxs)(`span`,{className:`text-text-muted`,children:[e.durationMs,`ms`]}),(0,K.jsxs)(`span`,{className:`text-text-muted`,children:[`round `,e.round]})]},t))})]}),e.error&&(0,K.jsxs)(`div`,{className:`bg-error/5 border border-error/20 rounded-lg p-2.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] text-error uppercase tracking-wider mb-1`,children:`Error`}),(0,K.jsx)(`div`,{className:`text-[11px] text-text-secondary font-mono`,children:e.error})]})]})})}function Y({label:e}){return(0,K.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin`}),(0,K.jsxs)(`span`,{className:`text-sm text-text-muted`,children:[`Loading `,e,`…`]})]})})}function X(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function Z({status:e}){let t={active:`bg-success/10 text-success`,idle:`bg-warning/10 text-warning`,running:`bg-cyan/10 text-cyan`,paused:`bg-info/10 text-info`,error:`bg-error/10 text-error`,stopped:`bg-bg-tertiary text-text-muted`,pending:`bg-warning/10 text-warning`,approved:`bg-success/10 text-success`,rejected:`bg-error/10 text-error`,succeeded:`bg-success/10 text-success`,failed:`bg-error/10 text-error`,backlog:`bg-bg-tertiary text-text-muted`,todo:`bg-info/10 text-info`,in_progress:`bg-cyan/10 text-cyan`,in_review:`bg-purple/10 text-purple-light`,done:`bg-success/10 text-success`,blocked:`bg-error/10 text-error`,cancelled:`bg-bg-tertiary text-text-muted`,critical:`bg-error/10 text-error`,high:`bg-warning/10 text-warning`,medium:`bg-warning/10 text-warning`,low:`bg-bg-tertiary text-text-muted`},n=e||`unknown`;return(0,K.jsx)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium ${t[n]||`bg-bg-tertiary text-text-muted`}`,children:n.replace(`_`,` `)})}function Q({icon:e,title:t,count:n,action:r,help:i}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(e,{size:14,className:`text-accent-light`}),(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-text`,children:t}),n!==void 0&&(0,K.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-accent/10 text-accent-light`,children:n}),i&&(0,K.jsx)(c,{title:i.title,description:i.description})]}),r]})}function Ce({agents:e}){let{toast:t}=k(),[n,r]=(0,G.useState)([]),[i,a]=(0,G.useState)([]),[o,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(null),h=(0,G.useCallback)(()=>{ie().then(r).catch(()=>{}),L().then(e=>a(e)).catch(()=>{})},[]);(0,G.useEffect)(()=>{h()},[h]);let _=async()=>{if(l.trim())try{await ce({name:l.trim(),mission:d.trim()||void 0}),u(``),f(``),c(!1),t(`success`,`Company created.`),h()}catch(e){t(`error`,`Couldn't create company — try again. ${e.message}`)}},v=async(e,n,r)=>{try{await te(e,{[n]:r}),h()}catch(e){t(`error`,`Couldn't save company — try again. ${e.message}`)}},y=async()=>{if(p)try{await P(p.id),m(null),t(`success`,`Company deleted.`),h()}catch(e){t(`error`,`Couldn't delete company — try again. ${e.message}`)}},x=async(e,n,r)=>{try{await ae(e,{[n]:r||void 0}),h()}catch(e){t(`error`,`Couldn't save agent — try again. ${e.message}`)}},S=[`ceo`,`manager`,`engineer`,`researcher`,`general`];function C(t,n=0){let r=e.find(e=>e.id===t.id)?.reportsTo||``;return t.model&&t.model.split(`/`).pop(),(0,K.jsxs)(`div`,{className:n>0?`ml-6 border-l border-border pl-4`:``,children:[(0,K.jsxs)(`div`,{className:`bg-bg-tertiary/30 border border-border rounded-xl p-3.5 mb-2 max-w-lg`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-2 gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[14px] font-semibold text-text min-w-0`,children:(0,K.jsx)(s,{value:t.name,onSave:e=>x(t.id,`name`,e),placeholder:`Agent name`})}),(0,K.jsx)(Z,{status:t.status})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[72px_1fr] gap-x-3 gap-y-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`text-text-muted`,children:`Title`}),(0,K.jsx)(`span`,{className:`text-text-secondary min-w-0`,children:(0,K.jsx)(s,{value:t.title||``,onSave:e=>x(t.id,`title`,e),placeholder:`Add a title`,emptyLabel:`—`})}),(0,K.jsx)(`span`,{className:`text-text-muted`,children:`Role`}),(0,K.jsx)(`select`,{value:t.role,onChange:e=>x(t.id,`role`,e.target.value),className:`bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary capitalize focus:outline-none focus:border-accent/30 justify-self-start`,children:S.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))}),(0,K.jsx)(`span`,{className:`text-text-muted`,children:`Reports to`}),(0,K.jsxs)(`select`,{value:r,onChange:e=>x(t.id,`reportsTo`,e.target.value),className:`bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[11px] text-text-secondary focus:outline-none focus:border-accent/30 justify-self-start`,children:[(0,K.jsx)(`option`,{value:``,children:`— nobody`}),e.filter(e=>e.id!==t.id).map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,K.jsx)(`span`,{className:`text-text-muted`,children:`Model`}),(0,K.jsx)(`span`,{className:`text-text-secondary min-w-0`,children:(0,K.jsx)(s,{value:t.model||``,onSave:e=>x(t.id,`model`,e),placeholder:`e.g. ollama/qwen3.5:cloud`,emptyLabel:`—`})})]})]}),t.reports.map(e=>C(e,n+1))]},t.id)}return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:U,title:`Organization Chart`,count:e.length}),(0,K.jsx)(`div`,{className:`p-4`,children:n.length===0?(0,K.jsxs)(`div`,{className:`text-center py-8`,children:[(0,K.jsx)(U,{size:24,className:`mx-auto mb-2 text-text/10`}),(0,K.jsx)(`p`,{className:`text-[12px] text-text-muted`,children:`No agents in org chart yet`}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-muted mt-1`,children:`Spawn agents from the Agents tab, then set "Reports to" on each to build the hierarchy.`})]}):n.map(e=>C(e))})]}),(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:H,title:`Companies`,count:i.length,action:(0,K.jsxs)(`button`,{onClick:()=>c(!0),className:`flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover`,children:[(0,K.jsx)(g,{size:10}),` New`]})}),o&&(0,K.jsxs)(`div`,{className:`p-4 border-b border-border bg-bg-secondary/30 space-y-2`,children:[(0,K.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Company name...`,className:`w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30`,onKeyDown:e=>e.key===`Enter`&&_()}),(0,K.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:`Mission (optional)...`,className:`w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text-secondary placeholder-white/15 focus:outline-none focus:border-accent/30`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{onClick:_,className:`px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg`,children:`Create`}),(0,K.jsx)(`button`,{onClick:()=>c(!1),className:`px-3 py-1.5 text-[11px] text-text-muted`,children:`Cancel`})]})]}),(0,K.jsx)(`div`,{className:`divide-y divide-border/30`,children:i.length===0?(0,K.jsx)(`div`,{className:`py-6 text-center text-[12px] text-text-muted`,children:`No companies yet — click "+ New" to create one.`}):i.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-bg-secondary/30 transition-colors`,children:[(0,K.jsx)(H,{size:14,className:`text-accent-light flex-shrink-0`}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[(0,K.jsx)(`div`,{className:`text-[13px] text-text font-medium`,children:(0,K.jsx)(s,{value:e.name,onSave:t=>v(e.id,`name`,t),placeholder:`Company name`})}),(0,K.jsx)(`div`,{className:`text-[10px] text-text-muted`,children:(0,K.jsx)(s,{value:e.mission||``,onSave:t=>v(e.id,`mission`,t),placeholder:`Add a mission`,emptyLabel:`(no mission — click to add)`})})]}),(0,K.jsx)(Z,{status:e.status||`active`}),(0,K.jsx)(`button`,{onClick:()=>m({id:e.id,name:e.name}),className:`p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors`,title:`Delete company`,children:(0,K.jsx)(b,{size:12})})]},e.id))})]}),(0,K.jsx)(V,{open:!!p,title:`Delete company "${p?.name||``}"?`,message:`This removes the company record. Agents and goals linked to it stay; they just lose the company association. This can't be undone.`,confirmLabel:`Delete`,onConfirm:y,onCancel:()=>m(null)})]})}function we({agents:e}){let{toast:t}=k(),[n,r]=(0,G.useState)([]),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(`medium`),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),_=(0,G.useCallback)(()=>{z(i?{status:i}:void 0).then(r).catch(e=>{t(`error`,`Couldn't load issues — try again. ${e.message}`)})},[i,t]);(0,G.useEffect)(()=>{_()},[_]);let v=async()=>{if(c.trim())try{await oe({title:c,priority:u}),l(``),s(!1),t(`success`,`Issue created.`),_()}catch(e){t(`error`,`Couldn't create issue — try again. ${e.message}`)}},y=async(e,n)=>{try{await D(e,{status:n}),_()}catch(e){t(`error`,`Couldn't update issue status — try again. ${e.message}`)}},x=async(e,n)=>{try{await D(e,{assigneeAgentId:n||void 0}),_()}catch(e){t(`error`,`Couldn't update assignee — try again. ${e.message}`)}},S=async()=>{if(m)try{await ue(m),h(null),f===m&&p(null),t(`success`,`Issue deleted.`),_()}catch(e){t(`error`,`Couldn't delete issue — try again. ${e.message}`)}},C=[`backlog`,`todo`,`in_progress`,`in_review`,`done`,`blocked`];return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`button`,{onClick:()=>a(``),className:`px-2.5 py-1 text-[10px] rounded-lg transition-colors ${i?`bg-bg-tertiary text-text-muted hover:text-text-secondary`:`bg-accent text-text`}`,children:`All`}),C.map(e=>(0,K.jsx)(`button`,{onClick:()=>a(e),className:`px-2.5 py-1 text-[10px] rounded-lg transition-colors ${i===e?`bg-accent text-text`:`bg-bg-tertiary text-text-muted hover:text-text-secondary`}`,children:e.replace(`_`,` `)},e))]}),(0,K.jsxs)(`button`,{onClick:()=>s(!0),className:`flex items-center gap-1 px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg hover:bg-accent-hover`,children:[(0,K.jsx)(g,{size:12}),` New Issue`]})]}),o&&(0,K.jsxs)(`div`,{className:`bg-bg-tertiary/30 border border-border rounded-xl p-4 space-y-3`,children:[(0,K.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`Issue title...`,className:`w-full bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[13px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30`,onKeyDown:e=>e.key===`Enter`&&v()}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),className:`bg-bg-tertiary border border-border rounded-lg px-2 py-1.5 text-[11px] text-text-secondary focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`low`,children:`Low`}),(0,K.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,K.jsx)(`option`,{value:`high`,children:`High`}),(0,K.jsx)(`option`,{value:`critical`,children:`Critical`})]}),(0,K.jsx)(`button`,{onClick:v,className:`px-3 py-1.5 text-[11px] bg-accent text-text rounded-lg`,children:`Create`}),(0,K.jsx)(`button`,{onClick:()=>s(!1),className:`px-3 py-1.5 text-[11px] text-text-muted hover:text-text-secondary`,children:`Cancel`})]})]}),(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:H,title:`Issues`,count:n.length}),(0,K.jsx)(`div`,{className:`divide-y divide-border/30`,children:n.length===0?(0,K.jsx)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:`No issues found — click "+ New Issue" to create one.`}):n.map(t=>(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-bg-secondary/30 transition-colors`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-text-muted font-mono w-14`,children:t.identifier}),(0,K.jsx)(Z,{status:t.priority||`medium`}),(0,K.jsx)(`button`,{onClick:()=>p(t.id),className:`text-[12px] text-text-secondary flex-1 truncate text-left hover:text-text transition-colors`,title:`Open details`,children:t.title}),(0,K.jsxs)(`select`,{value:t.assigneeAgentId||``,onChange:e=>x(t.id,e.target.value),onClick:e=>e.stopPropagation(),className:`bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[10px] text-text-secondary focus:outline-none max-w-[120px]`,title:`Assignee`,children:[(0,K.jsx)(`option`,{value:``,children:`unassigned`}),e.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,K.jsxs)(`select`,{value:t.status,onChange:e=>y(t.id,e.target.value),onClick:e=>e.stopPropagation(),className:`bg-bg-tertiary border border-border rounded px-1.5 py-0.5 text-[10px] text-text-secondary focus:outline-none`,children:[C.map(e=>(0,K.jsx)(`option`,{value:e,children:e.replace(`_`,` `)},e)),(0,K.jsx)(`option`,{value:`cancelled`,children:`cancelled`})]}),(0,K.jsx)(`button`,{onClick:()=>h(t.id),className:`p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors`,title:`Delete issue`,children:(0,K.jsx)(b,{size:12})})]},t.id))})]}),f&&(0,K.jsx)(Te,{issueId:f,agents:e,onClose:()=>{p(null),_()},onRequestDelete:()=>h(f)}),(0,K.jsx)(V,{open:!!m,title:`Delete this issue?`,message:`This can't be undone. The issue and all its comments will be removed.`,confirmLabel:`Delete`,onConfirm:S,onCancel:()=>h(null)})]})}function Te({issueId:e,agents:t,onClose:n,onRequestDelete:r}){let{toast:i}=k(),[a,o]=(0,G.useState)(null),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),f=(0,G.useCallback)(async()=>{try{let t=await le(e);o(t)}catch(e){i(`error`,`Couldn't load issue details — try again. ${e.message}`)}},[e,i]);(0,G.useEffect)(()=>{f()},[f]);let p=async(t,n)=>{try{await D(e,{[t]:n}),f()}catch(e){i(`error`,`Couldn't save issue — try again. ${e.message}`)}},m=async t=>{try{await D(e,{priority:t}),f()}catch(e){i(`error`,`Couldn't update priority — try again. ${e.message}`)}},h=async t=>{try{await D(e,{assigneeAgentId:t||void 0}),f()}catch(e){i(`error`,`Couldn't update assignee — try again. ${e.message}`)}},g=async()=>{if(c.trim()){d(!0);try{await C(e,c.trim(),{user:`board`}),l(``),f()}catch(e){i(`error`,`Couldn't post comment — try again. ${e.message}`)}finally{d(!1)}}};return(0,K.jsx)(B,{open:!0,onClose:n,size:`lg`,title:a?`${a.identifier}`:`Loading…`,children:a?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-text-muted/70 mb-1`,children:`Title`}),(0,K.jsx)(`div`,{className:`text-[14px] text-text`,children:(0,K.jsx)(s,{value:a.title,onSave:e=>p(`title`,e),placeholder:`Issue title`})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-text-muted/70 mb-1`,children:`Description`}),(0,K.jsx)(`div`,{className:`text-[12px] text-text-secondary whitespace-pre-wrap`,children:(0,K.jsx)(s,{value:a.description||``,onSave:e=>p(`description`,e),placeholder:`Add a description…`,multiline:!0,emptyLabel:`(none — click to add)`})})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-[11px]`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-text-muted/70 uppercase tracking-wider text-[10px] mb-1`,children:`Priority`}),(0,K.jsxs)(`select`,{value:a.priority||`medium`,onChange:e=>m(e.target.value),className:`bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none w-full`,children:[(0,K.jsx)(`option`,{value:`low`,children:`Low`}),(0,K.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,K.jsx)(`option`,{value:`high`,children:`High`}),(0,K.jsx)(`option`,{value:`critical`,children:`Critical`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-text-muted/70 uppercase tracking-wider text-[10px] mb-1`,children:`Assignee`}),(0,K.jsxs)(`select`,{value:a.assigneeAgentId||``,onChange:e=>h(e.target.value),className:`bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none w-full`,children:[(0,K.jsx)(`option`,{value:``,children:`unassigned`}),t.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-text-muted/70 uppercase tracking-wider text-[10px] mb-1`,children:`Status`}),(0,K.jsx)(`div`,{className:`text-text capitalize`,children:a.status.replace(/_/g,` `)})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-[10px] uppercase tracking-wider text-text-muted/70 mb-2`,children:[`Comments (`,a.comments?.length||0,`)`]}),(0,K.jsx)(`div`,{className:`space-y-2 max-h-[240px] overflow-y-auto pr-1`,children:(a.comments||[]).length===0?(0,K.jsx)(`div`,{className:`text-[11px] text-text-muted italic`,children:`No comments yet.`}):a.comments.map(e=>(0,K.jsxs)(`div`,{className:`bg-bg-secondary/30 border border-border/50 rounded-lg px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-muted/70 mb-1`,children:[(0,K.jsx)(`span`,{className:`text-text-secondary`,children:e.authorAgentId||e.authorUser||`unknown`}),(0,K.jsx)(`span`,{children:`·`}),(0,K.jsxs)(`span`,{children:[X(e.createdAt),` ago`]})]}),(0,K.jsx)(`div`,{className:`text-[12px] text-text whitespace-pre-wrap`,children:e.body})]},e.id))}),(0,K.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,K.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),g())},placeholder:`Add a comment — Enter to post`,disabled:u,className:`flex-1 bg-bg-tertiary border border-border rounded px-3 py-1.5 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30`}),(0,K.jsx)(`button`,{onClick:g,disabled:u||!c.trim(),className:`px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50`,children:`Post`})]})]}),(0,K.jsxs)(`div`,{className:`flex justify-between items-center pt-2 border-t border-border`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] text-text-muted`,children:[`Created `,X(a.createdAt),` ago`]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{onClick:r,className:`px-3 py-1.5 text-[11px] text-error hover:bg-error/10 rounded`,children:`Delete issue`}),(0,K.jsx)(`button`,{onClick:n,className:`px-3 py-1.5 text-[11px] text-text-secondary hover:text-text bg-bg-tertiary rounded`,children:`Close`})]})]})]}):(0,K.jsx)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:`Loading…`})})}function Ee({budgets:e,onRefresh:t}){let{toast:n}=k(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:d,title:`Budget Policies`,count:e.length,action:(0,K.jsxs)(`button`,{onClick:()=>o(!0),className:`flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover`,children:[(0,K.jsx)(g,{size:10}),` New Budget`]})}),(0,K.jsx)(`div`,{className:`p-4 space-y-3`,children:e.length===0?(0,K.jsx)(`div`,{className:`text-center py-6 text-[12px] text-text-muted`,children:`No budget policies yet — click "+ New Budget" to set spending limits per agent, goal, or globally.`}):e.map(e=>{let t=e.limitUsd>0?Math.min(100,e.currentSpend/e.limitUsd*100):0,n=t>=100?`bg-error`:t>=80?`bg-warning`:`bg-success`;return(0,K.jsxs)(`div`,{className:`bg-bg-tertiary/30 border border-border rounded-lg p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,K.jsx)(`span`,{className:`text-[12px] font-medium text-text`,children:e.name}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-text-muted capitalize`,children:e.scope.type}),(0,K.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:e.period}),(0,K.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded ${e.enabled?`text-success bg-success/10`:`text-text-muted bg-bg-tertiary`}`,children:e.enabled?`on`:`off`}),(0,K.jsx)(`button`,{onClick:()=>i(e),className:`text-[10px] text-text-muted hover:text-text-secondary px-1`,title:`Edit budget`,children:`Edit`}),(0,K.jsx)(`button`,{onClick:()=>c(e),className:`p-1 rounded text-text-muted hover:text-error hover:bg-error/10 transition-colors`,title:`Delete budget`,children:(0,K.jsx)(b,{size:12})})]})]}),(0,K.jsx)(`div`,{className:`h-1.5 bg-bg-tertiary rounded-full overflow-hidden mb-1.5`,children:(0,K.jsx)(`div`,{className:`h-full ${n} rounded-full transition-all`,style:{width:`${t}%`}})}),(0,K.jsxs)(`div`,{className:`flex justify-between text-[10px] text-text-muted`,children:[(0,K.jsxs)(`span`,{children:[`$`,e.currentSpend.toFixed(2),` spent`]}),(0,K.jsxs)(`span`,{children:[`$`,e.limitUsd.toFixed(2),` limit · action: `,e.action]})]})]},e.id)})}),(a||r)&&(0,K.jsx)(De,{existing:r,onClose:()=>{o(!1),i(null)},onSaved:()=>{o(!1),i(null),t()}}),(0,K.jsx)(V,{open:!!s,title:`Delete budget "${s?.name||``}"?`,message:`The policy and its spend history are removed. Agents/goals it covered will no longer be budget-enforced unless another policy applies.`,confirmLabel:`Delete`,onConfirm:async()=>{if(s)try{await x(s.id),c(null),n(`success`,`Budget deleted.`),t()}catch(e){n(`error`,`Couldn't delete budget — try again. ${e.message}`)}},onCancel:()=>c(null)})]})}function De({existing:e,onClose:t,onSaved:n}){let{toast:r}=k(),i=!!e,[a,o]=(0,G.useState)(e?.name||``),[s,c]=(0,G.useState)(e?.scope.type||`global`),[l,u]=(0,G.useState)(e?.scope.targetId||``),[d,f]=(0,G.useState)(e?.period||`daily`),[p,m]=(0,G.useState)(e?.limitUsd?.toString()||`10`),[h,g]=(0,G.useState)(e?.warningThresholdPercent?.toString()||`80`),[_,v]=(0,G.useState)(e?.action||`warn`),[y,b]=(0,G.useState)(e?.enabled??!0),[x,S]=(0,G.useState)(!1);return(0,K.jsx)(B,{open:!0,onClose:t,size:`md`,title:i?`Edit Budget Policy`:`New Budget Policy`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{onClick:t,className:`px-3 py-1.5 text-[11px] text-text-secondary hover:text-text`,children:`Cancel`}),(0,K.jsx)(`button`,{onClick:async()=>{if(a.trim()){S(!0);try{let t={name:a.trim(),scope:{type:s,targetId:s===`global`?void 0:l||void 0},period:d,limitUsd:Number(p)||0,warningThresholdPercent:Number(h)||80,action:_,enabled:y};i&&e?await ee(e.id,t):await se(t),r(`success`,i?`Budget updated.`:`Budget created.`),n()}catch(e){r(`error`,`Couldn't save budget — try again. ${e.message}`)}finally{S(!1)}}},disabled:x||!a.trim(),className:`px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50`,children:x?`Saving…`:i?`Save changes`:`Create budget`})]}),children:(0,K.jsxs)(`div`,{className:`space-y-3 text-[12px]`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Name`}),(0,K.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`e.g. Daily global cap`,className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Scope`}),(0,K.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`global`,children:`Global (all agents)`}),(0,K.jsx)(`option`,{value:`agent`,children:`Per-agent`}),(0,K.jsx)(`option`,{value:`goal`,children:`Per-goal`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Target ID`}),(0,K.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:s===`global`?`n/a`:s===`agent`?`agent-id`:`goal-id`,disabled:s===`global`,className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none disabled:opacity-40`})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Period`}),(0,K.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`daily`,children:`Daily`}),(0,K.jsx)(`option`,{value:`weekly`,children:`Weekly`}),(0,K.jsx)(`option`,{value:`monthly`,children:`Monthly`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Limit (USD)`}),(0,K.jsx)(`input`,{type:`number`,step:`0.01`,value:p,onChange:e=>m(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Warn at %`}),(0,K.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:h,onChange:e=>g(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40`})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Action at limit`}),(0,K.jsxs)(`select`,{value:_,onChange:e=>v(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`warn`,children:`Warn only`}),(0,K.jsx)(`option`,{value:`pause`,children:`Pause agent`}),(0,K.jsx)(`option`,{value:`stop`,children:`Stop agent`})]})]}),(0,K.jsx)(`div`,{className:`flex items-end gap-2`,children:(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-text-secondary cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`accent-accent`}),(0,K.jsx)(`span`,{children:`Enabled`})]})})]})]})})}function Oe({dashboard:e}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[u,d]=(0,G.useState)(),f=(0,G.useRef)(null),p=(0,G.useRef)(null),h=(0,G.useCallback)(()=>{let t=e,n=t.agents.map(e=>`${e.name} (${e.status}, ${e.role}, cost=$${e.totalCostUsd.toFixed(2)})`).join(`; `)||`none`;return`[COMMAND POST] ${t.totalAgents} agents (${t.activeAgents} active), ${t.activeCheckouts} locked tasks, budget ${Math.round(t.budgetUtilization??0)}% used, ${t.goalTree?.length??0} goals. Agents: ${n}. You manage this agent organization. Be concise.\n\n`},[e]),g=(0,G.useCallback)(async()=>{let e=r.trim();if(!e||a)return;i(``),n(t=>[...t,{role:`user`,content:e}]),o(!0),c(``);let t=new AbortController;f.current=t;let s=``,l=u;try{await ne(h()+e,u,e=>{e.type===`token`&&(s+=e.data,c(s)),e.type===`done`&&e.sessionId&&(l=e.sessionId)},t.signal),l&&d(l),s&&n(e=>[...e,{role:`assistant`,content:s}])}catch(e){e.name!==`AbortError`&&n(t=>[...t,{role:`assistant`,content:`Error: ${e.message}`}])}finally{o(!1),c(``),f.current=null}},[r,a,u,h]);return(0,G.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,s]),(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden flex flex-col`,style:{height:400},children:[(0,K.jsx)(Q,{icon:m,title:`Console`,action:a?(0,K.jsxs)(`button`,{onClick:()=>f.current?.abort(),className:`text-[10px] text-error flex items-center gap-1`,children:[(0,K.jsx)(l,{size:12}),`Stop`]}):void 0}),(0,K.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto px-4 py-3 space-y-2`,children:[t.length===0&&!a&&(0,K.jsxs)(`div`,{className:`text-center py-6`,children:[(0,K.jsx)(`p`,{className:`text-[11px] text-text-muted mb-3`,children:`Manage your organization through natural language`}),(0,K.jsx)(`div`,{className:`flex flex-wrap justify-center gap-1.5`,children:[`Status report`,`Create issue: Research competitors`,`Spawn a research agent`,`Set $50/day budget`].map(e=>(0,K.jsx)(`button`,{onClick:()=>i(e),className:`text-[10px] text-text-muted hover:text-text-muted px-2.5 py-1 rounded-full border border-border hover:border-border-light`,children:e},e))})]}),t.map((e,t)=>(0,K.jsx)(`div`,{className:`flex ${e.role===`user`?`justify-end`:`justify-start`}`,children:(0,K.jsx)(`div`,{className:`max-w-[85%] px-3 py-2 rounded-xl text-[12px] leading-relaxed whitespace-pre-wrap ${e.role===`user`?`bg-accent/80 text-text rounded-br-sm`:`bg-bg-tertiary text-text-secondary border border-border rounded-bl-sm`}`,children:e.content})},t)),a&&s&&(0,K.jsx)(`div`,{className:`flex justify-start`,children:(0,K.jsxs)(`div`,{className:`max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-bg-tertiary text-text-secondary border border-border text-[12px] whitespace-pre-wrap`,children:[s,(0,K.jsx)(`span`,{className:`inline-block w-1 h-3.5 bg-accent-light ml-0.5 animate-pulse`})]})}),a&&!s&&(0,K.jsx)(`div`,{className:`flex justify-start`,children:(0,K.jsx)(`div`,{className:`px-3 py-2 rounded-xl bg-bg-tertiary border border-border`,children:(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce`}),(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce`,style:{animationDelay:`150ms`}}),(0,K.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-text-muted/20 animate-bounce`,style:{animationDelay:`300ms`}})]})})})]}),(0,K.jsx)(`div`,{className:`px-3 py-2 border-t border-border`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:`Tell Command Post what to do...`,className:`flex-1 bg-bg-tertiary border border-border rounded-lg px-3 py-2 text-[12px] text-text placeholder-white/20 focus:outline-none focus:border-accent/30`}),(0,K.jsx)(`button`,{onClick:g,disabled:!r.trim()||a,className:`p-2 rounded-lg bg-accent text-text hover:bg-accent-hover disabled:opacity-30`,children:(0,K.jsx)(v,{size:14})})]})})]})}function ke({onClose:e,onCreated:t}){let{toast:n}=k(),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)([{role:`pragmatist`,model:``},{role:`skeptic`,model:``}]),[s,c]=(0,G.useState)(2),[l,u]=(0,G.useState)(`judge`),[d,f]=(0,G.useState)(!1),p=()=>{a.length>=5||o([...a,{role:`participant-${a.length+1}`,model:``}])},m=e=>{a.length<=2||o(a.filter((t,n)=>n!==e))},h=(e,t)=>{o(a.map((n,r)=>r===e?{...n,...t}:n))};return(0,K.jsx)(B,{open:!0,onClose:e,title:`Start a new debate`,size:`lg`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{onClick:e,className:`px-3 py-1.5 text-[11px] text-text-secondary hover:text-text`,children:`Cancel`}),(0,K.jsx)(`button`,{onClick:async()=>{if(!(!r.trim()||a.length<2)){f(!0);try{let e=await T(`/api/command-post/debates`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({question:r.trim(),participants:a.map(e=>({role:e.role.trim()||`participant`,model:e.model.trim()||void 0})),rounds:s,resolution:l})});if(!e.ok)throw Error(`${e.status} ${e.statusText}`);n(`success`,`Debate finished — transcript saved.`),t()}catch(e){n(`error`,`Debate failed — try again. ${e.message}`)}finally{f(!1)}}},disabled:d||!r.trim()||a.length<2,className:`px-3 py-1.5 text-[11px] bg-accent text-text rounded hover:bg-accent-hover disabled:opacity-50`,children:d?`Running debate…`:`Run debate`})]}),children:(0,K.jsxs)(`div`,{className:`space-y-3 text-[12px]`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Question`}),(0,K.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Should we cache the Ollama probe results for 7 days or 30 days?`,rows:2,className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none focus:border-accent/40 resize-none`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsxs)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:[`Participants (`,a.length,`/5)`]}),(0,K.jsx)(`button`,{onClick:p,disabled:a.length>=5,className:`text-[10px] text-accent-light/70 hover:text-accent-light disabled:opacity-40`,children:`+ Add participant`})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:a.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,K.jsx)(`input`,{value:e.role,onChange:e=>h(t,{role:e.target.value}),placeholder:`role (e.g. pragmatist)`,className:`flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text focus:outline-none`}),(0,K.jsx)(`input`,{value:e.model,onChange:e=>h(t,{model:e.target.value}),placeholder:`model (optional — defaults to agent.model)`,className:`flex-1 bg-bg-tertiary border border-border rounded px-2 py-1 text-text-secondary focus:outline-none`}),(0,K.jsx)(`button`,{onClick:()=>m(t),disabled:a.length<=2,className:`text-text-muted hover:text-error disabled:opacity-20 px-1`,title:`Remove`,children:`×`})]},t))})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Rounds`}),(0,K.jsx)(`select`,{value:s,onChange:e=>c(Number(e.target.value)),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none`,children:[1,2,3,4].map(e=>(0,K.jsxs)(`option`,{value:e,children:[e,` round`,e===1?``:`s`]},e))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`text-[10px] uppercase tracking-wider text-text-muted`,children:`Resolution`}),(0,K.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),className:`mt-1 w-full bg-bg-tertiary border border-border rounded px-2 py-1.5 text-text focus:outline-none`,children:[(0,K.jsx)(`option`,{value:`judge`,children:`Judge (LLM picks winner)`}),(0,K.jsx)(`option`,{value:`synthesize`,children:`Synthesize (LLM merges)`}),(0,K.jsx)(`option`,{value:`vote`,children:`Vote (word-overlap consensus)`})]})]})]}),(0,K.jsx)(`div`,{className:`text-[10px] text-text-muted/70 italic`,children:`Runs live — 1-3 minutes depending on model + rounds. Transcript saves automatically.`})]})})}function Ae(){let{toast:e}=k(),[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(`pending`),[a,o]=(0,G.useState)(!1),s=(0,G.useCallback)(async()=>{o(!0);try{let e=await de(r===`all`?void 0:r);n(e)}catch(t){e(`error`,`Couldn't load approvals — try again. ${t.message}`)}o(!1)},[r,e]);(0,G.useEffect)(()=>{s()},[s]);let c=async t=>{try{await O(t,`board`),e(`success`,`Approved.`)}catch(t){e(`error`,`Couldn't approve — try again. ${t.message}`)}s()},l=async t=>{try{await R(t,`board`),e(`success`,`Rejected.`)}catch(t){e(`error`,`Couldn't reject — try again. ${t.message}`)}s()},u=t.filter(e=>r===`all`?!0:e.status===r);return(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:M,title:`Approvals`,count:u.length,help:{title:`Approvals`,description:`Human-in-the-loop decisions for hiring agents, budget overrides, goal proposals, and self-modification requests.`},action:(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:[`pending`,`approved`,`rejected`,`all`].map(e=>(0,K.jsx)(`button`,{onClick:()=>i(e),className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===e?`bg-accent text-text`:`bg-bg-tertiary text-text-muted hover:text-text`}`,children:e},e))})}),(0,K.jsx)(`div`,{className:`divide-y divide-border/30`,children:a?(0,K.jsx)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:`Loading...`}):u.length===0?(0,K.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:[`No `,r,` approvals.`]}):u.map(e=>(0,K.jsxs)(`div`,{className:`px-4 py-3 hover:bg-bg-tertiary/30 transition-colors`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsx)(`span`,{className:`text-[12px] text-text flex-1 truncate pr-2`,children:e.type.replace(/_/g,` `)}),(0,K.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e.status===`pending`?`bg-warning/10 text-warning`:e.status===`approved`?`bg-success/10 text-success`:`bg-error/10 text-error`}`,children:e.status})]}),(0,K.jsx)(`div`,{className:`text-[10px] text-text-muted mb-2 truncate`,children:he(e)?.headline}),e.status===`pending`&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:()=>c(e.id),className:`px-2 py-0.5 text-[10px] bg-success text-text rounded hover:bg-success/80`,children:`Approve`}),(0,K.jsx)(`button`,{onClick:()=>l(e.id),className:`px-2 py-0.5 text-[10px] bg-error text-text rounded hover:bg-error/80`,children:`Reject`})]}),e.decidedBy&&(0,K.jsxs)(`div`,{className:`text-[10px] text-text-muted mt-1`,children:[`By `,e.decidedBy,` `,e.decidedAt?X(e.decidedAt)+` ago`:``]})]},e.id))})]})}function je(){let{toast:e}=k(),[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=(0,G.useCallback)(async()=>{o(!0);try{let e=await T(`/api/command-post/debates`);if(e.ok){let t=await e.json();n(t?.items||[])}}catch(t){e(`error`,`Couldn't load debates — try again. ${t.message}`)}o(!1)},[e]);(0,G.useEffect)(()=>{l()},[l]);let u=async t=>{try{let e=await T(`/api/command-post/debates/${t}`);if(e.ok){let t=await e.json();i(t)}}catch(t){e(`error`,`Couldn't open debate transcript — try again. ${t.message}`)}};if(r){let e=new Map;for(let t of r.turns){let n=e.get(t.round)||[];n.push(t),e.set(t.round,n)}return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`button`,{onClick:()=>i(null),className:`text-[11px] text-text-muted hover:text-text-secondary`,children:`← Back to debates`}),(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl p-4`,children:[(0,K.jsx)(`div`,{className:`text-[13px] font-semibold text-text mb-1`,children:r.question}),(0,K.jsxs)(`div`,{className:`text-[10px] text-text-muted/70`,children:[r.resolution,` • `,r.rounds,` round`,r.rounds===1?``:`s`,` • `,(r.durationMs/1e3).toFixed(1),`s`]}),r.winner&&(0,K.jsxs)(`div`,{className:`mt-3 p-3 bg-success/[0.06] border border-success/30 rounded-lg`,children:[(0,K.jsxs)(`div`,{className:`text-[11px] text-success/80/80 uppercase tracking-wider`,children:[`Winner: `,r.winner.role]}),(0,K.jsx)(`div`,{className:`text-[12px] text-text mt-1`,children:r.winner.content}),r.winner.justification&&(0,K.jsx)(`div`,{className:`text-[10px] text-text-muted italic mt-2`,children:r.winner.justification})]})]}),[...e.entries()].sort((e,t)=>e[0]-t[0]).map(([e,t])=>(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`px-4 py-2 border-b border-border/50 text-[11px] font-medium text-text-secondary uppercase tracking-wider`,children:[`Round `,e]}),(0,K.jsx)(`div`,{className:`divide-y divide-border/30`,children:t.map((e,t)=>(0,K.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-semibold text-accent-light/80 mb-1`,children:e.role}),(0,K.jsx)(`div`,{className:`text-[11px] text-text-secondary whitespace-pre-wrap`,children:e.content}),(0,K.jsxs)(`div`,{className:`text-[9px] text-text-muted mt-1`,children:[e.model.split(`/`).pop(),` • `,e.durationMs,`ms`]})]},t))})]},e))]})}return(0,K.jsxs)(`div`,{className:`bg-bg-secondary/50 border border-border rounded-2xl overflow-hidden`,children:[(0,K.jsx)(Q,{icon:W,title:`Debates`,count:t.length,help:{title:`Debates`,description:`Pit two or more agents against each other to explore different sides of a decision. Useful for risk assessment and trade-off analysis.`},action:(0,K.jsxs)(`button`,{onClick:()=>c(!0),className:`flex items-center gap-1 px-2.5 py-1 text-[10px] bg-accent text-text rounded-lg hover:bg-accent-hover`,children:[(0,K.jsx)(g,{size:10}),` New Debate`]})}),s&&(0,K.jsx)(ke,{onClose:()=>c(!1),onCreated:()=>{c(!1),l()}}),(0,K.jsx)(`div`,{className:`divide-y divide-border/30`,children:a?(0,K.jsx)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:`Loading...`}):t.length===0?(0,K.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-text-muted`,children:[`No debates yet. Call the `,(0,K.jsx)(`code`,{className:`text-accent-light/70`,children:`agent_debate`}),` tool to start one.`]}):t.map(e=>(0,K.jsxs)(`button`,{onClick:()=>u(e.id),className:`w-full text-left px-4 py-3 hover:bg-bg-tertiary/30 transition-colors`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsx)(`div`,{className:`text-[12px] text-text flex-1 truncate pr-2`,children:e.question}),(0,K.jsxs)(`span`,{className:`text-[10px] text-text-muted whitespace-nowrap`,children:[X(e.startedAt),` ago`]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-text-muted`,children:[(0,K.jsx)(`span`,{children:e.resolution}),(0,K.jsxs)(`span`,{children:[e.rounds,` round`,e.rounds===1?``:`s`]}),(0,K.jsxs)(`span`,{children:[(e.durationMs/1e3).toFixed(1),`s`]}),e.winnerRole&&(0,K.jsxs)(`span`,{className:`text-success/80/70`,children:[`winner: `,e.winnerRole]})]})]},e.id))})]})}var Me=[{label:`Overview`,tabs:[{id:`Dashboard`,label:`Dashboard`,icon:a}]},{label:`Operations`,tabs:[{id:`Social`,label:`Social`,icon:m},{id:`Inbox`,label:`Inbox`,icon:ge},{id:`Goals`,label:`Goals`,icon:pe},{id:`Work`,label:`Work`,icon:H},{id:`Sessions`,label:`Sessions`,icon:u}]},{label:`Governance`,tabs:[{id:`Issues`,label:`Issues`,icon:m},{id:`Approvals`,label:`Approvals`,icon:M},{id:`Org Chart`,label:`Org Chart`,icon:p},{id:`Agents`,label:`Agents`,icon:I},{id:`Files`,label:`Files`,icon:f},{id:`Debates`,label:`Debates`,icon:W},{id:`Costs`,label:`Costs`,icon:d}]},{label:`System`,tabs:[{id:`Traces`,label:`Traces`,icon:E},{id:`Console`,label:`Console`,icon:y}]}],Ne=(0,G.lazy)(()=>F(()=>import(`./WorkTab-RRpPpEOg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Pe=(0,G.lazy)(()=>F(()=>import(`./SessionsTab-BJipiVJs.js`),__vite__mapDeps([13,1,9,3,10,11,12]))),$=(0,G.lazy)(()=>F(()=>import(`./CPInbox-CDvefgNH.js`),__vite__mapDeps([14,1,3,15,16,17,18,9,10,12,19,20,11,21,22,23,24,25,26,27,7,28,29,30]))),Fe=(0,G.lazy)(()=>F(()=>import(`./CPFiles-BJ49tzai.js`),__vite__mapDeps([31,1,32,3,33,34,35,36,9,10,19,20]))),Ie=(0,G.lazy)(()=>F(()=>import(`./TraceViewer-CYAzIcfB.js`),__vite__mapDeps([37,1,38,3,39,25,40,36,41,9,10]))),Le=(0,G.lazy)(()=>F(()=>import(`./CPSocial-B-gHgvEw.js`),__vite__mapDeps([42,1,3,25,43,27,35,28,9,10]))),Re=(0,G.lazy)(()=>F(()=>import(`./CPDashboard-DA8-tE-l.js`),__vite__mapDeps([44,1,18,3,16,9,10,12,19,20,11,21,22,23,24,45,46,35]))),ze=(0,G.lazy)(()=>F(()=>import(`./CPGoals-h0dKL5V_.js`),__vite__mapDeps([47,1,20,3,18,16,9,10,12,19,11,21,22,23,24,6,8]))),Be=(0,G.lazy)(()=>F(()=>import(`./CPAgents-B6wSSQZM.js`),__vite__mapDeps([48,1,18,3,16,9,10,12,19,20,11,21,22,23,24])));function Ve(){let[e,t]=(0,G.useState)(`Dashboard`),[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)([]),[o,s]=(0,G.useState)(!0),[c,l]=(0,G.useState)(null),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=(0,G.useCallback)(async()=>{try{let[e,t]=await Promise.allSettled([fe(),w()]);e.status===`fulfilled`&&(r(e.value),d(e.value.recentActivity||[])),t.status===`fulfilled`&&a(t.value),l(null)}catch(e){l(e.message)}s(!1)},[]);if((0,G.useEffect)(()=>{g()},[g]),(0,G.useEffect)(()=>{if(!n)return;let e=localStorage.getItem(`titan-token`),t=e?`/api/command-post/stream?token=${e}`:`/api/command-post/stream`,i=new EventSource(t),a=0;return i.addEventListener(`commandpost:activity`,e=>{a=0;try{d(t=>[...t.slice(-49),JSON.parse(e.data)])}catch{}}),i.addEventListener(`commandpost:agent:status`,e=>{a=0;try{let t=JSON.parse(e.data);r(e=>e&&{...e,agents:e.agents.map(e=>e.id===t.agentId?{...e,status:t.status}:e)})}catch{}}),i.onerror=()=>{a++,a>5&&i.close()},()=>i.close()},[n]),(0,G.useEffect)(()=>{let e=setInterval(g,3e4);return()=>clearInterval(e)},[g]),o)return(0,K.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin`}),(0,K.jsx)(`span`,{className:`text-sm text-text-muted`,children:`Loading Command Post...`})]})});if(c)return(0,K.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsx)(j,{className:`mx-auto mb-3 text-warning`,size:32}),(0,K.jsx)(`p`,{className:`text-sm text-text-secondary mb-4`,children:c}),(0,K.jsx)(`button`,{onClick:g,className:`px-4 py-2 text-sm bg-bg-tertiary rounded-lg hover:bg-border text-text-secondary transition-colors`,children:`Retry`})]})});let v=n??{agents:[],totalAgents:0,activeAgents:0,activeCheckouts:0,budgetUtilization:0,recentActivity:[],checkouts:[],budgets:[],goalTree:[],companies:[]},y=Me.flatMap(e=>e.tabs.map(t=>({...t,group:e.label})));return(0,K.jsxs)(`div`,{className:`h-full flex overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto`,children:[(0,K.jsx)(`div`,{className:`sticky top-0 z-20 border-b border-border bg-bg/95 backdrop-blur`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-3 px-4 md:px-6 py-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`text-sm font-bold text-text`,children:`Command Post`}),(0,K.jsx)(`p`,{className:`text-[10px] text-text-muted`,children:`Agent governance`})]}),(0,K.jsx)(`div`,{className:`flex-1 min-w-0 overflow-x-auto`,children:(0,K.jsx)(`div`,{className:`flex items-center gap-1`,children:y.map(n=>{let r=e===n.id;return(0,K.jsxs)(`button`,{onClick:()=>t(n.id),title:`${n.group}: ${n.label}`,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-[12px] transition-all duration-150 ${r?`bg-accent/10 text-accent-light font-medium`:`text-text-secondary hover:text-text hover:bg-bg-tertiary/50`}`,children:[(0,K.jsx)(n.icon,{size:14,className:r?`text-accent-light`:`text-text-muted`}),(0,K.jsx)(`span`,{children:n.label})]},n.id)})})}),(0,K.jsxs)(`button`,{onClick:g,className:`shrink-0 flex items-center justify-center gap-1.5 px-2.5 py-1.5 text-[11px] text-text-muted bg-bg-tertiary/50 border border-border rounded-lg hover:bg-bg-tertiary transition-colors`,children:[(0,K.jsx)(_,{size:12,className:o?`animate-spin`:``}),`Refresh`]})]})}),(0,K.jsx)(`div`,{className:`max-w-6xl mx-auto px-4 md:px-6 py-4 md:py-6`,children:(0,K.jsx)(()=>{switch(e){case`Dashboard`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`dashboard`}),children:(0,K.jsx)(Re,{})});case`Social`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`social`}),children:(0,K.jsx)(Le,{})});case`Inbox`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`inbox`}),children:(0,K.jsx)($,{})});case`Goals`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`goals`}),children:(0,K.jsx)(ze,{})});case`Work`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`work`}),children:(0,K.jsx)(Ne,{})});case`Sessions`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`sessions`}),children:(0,K.jsx)(Pe,{})});case`Issues`:return(0,K.jsx)(we,{agents:v.agents});case`Approvals`:return(0,K.jsx)(Ae,{});case`Org Chart`:return(0,K.jsx)(Ce,{agents:v.agents});case`Agents`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`agents`}),children:(0,K.jsx)(Be,{})});case`Files`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`files`}),children:(0,K.jsx)(Fe,{})});case`Debates`:return(0,K.jsx)(je,{});case`Costs`:return(0,K.jsx)(Ee,{budgets:v.budgets,onRefresh:g});case`Traces`:return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(Y,{label:`traces`}),children:(0,K.jsx)(Ie,{})});case`Console`:return(0,K.jsx)(Oe,{dashboard:v});default:return null}},{})})]}),(0,K.jsx)(ye,{collapsed:f,onToggle:()=>p(!f),agents:v.agents,runs:i,onAgentClick:e=>h(e)}),m&&(0,K.jsx)(be,{agent:m,onClose:()=>h(null)})]})}export{Ve as default};
@@ -0,0 +1,9 @@
1
+ import{a as e,c as t,i as n,n as r,s as i,t as a}from"./jsx-runtime-B15e6lOy.js";import{b as o,s}from"./index-WI-E4I3h.js";import{t as c}from"./clsx-CjueKrWZ.js";var l=a(),u=t(r(),1),d=(0,u.createContext)({});function f(e){let t=(0,u.useRef)(null);return t.current===null&&(t.current=e()),t.current}var p=typeof window<`u`?u.useLayoutEffect:u.useEffect,m=(0,u.createContext)(null);function h(e,t){e.indexOf(t)===-1&&e.push(t)}function g(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var _=(e,t,n)=>n>t?t:n<e?e:n,v={},y=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function b(e){return typeof e==`object`&&!!e}var x=e=>/^0[^.\s]+$/u.test(e);function S(e){let t;return()=>(t===void 0&&(t=e()),t)}var C=e=>e,w=(e,t)=>n=>t(e(n)),T=(...e)=>e.reduce(w),E=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},D=class{constructor(){this.subscriptions=[]}add(e){return h(this.subscriptions,e),()=>g(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},O=e=>e*1e3,k=e=>e/1e3;function ee(e,t){return t?1e3/t*e:0}var te=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ne=1e-7,re=12;function ie(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=te(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>ne&&++s<re);return o}function ae(e,t,n,r){if(e===t&&n===r)return C;let i=t=>ie(t,0,1,e,n);return e=>e===0||e===1?e:te(i(e),t,r)}var oe=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,se=e=>t=>1-e(1-t),ce=ae(.33,1.53,.69,.99),le=se(ce),ue=oe(le),de=e=>(e*=2)<1?.5*le(e):.5*(2-2**(-10*(e-1))),fe=e=>1-Math.sin(Math.acos(e)),pe=se(fe),me=oe(fe),he=ae(.42,0,1,1),ge=ae(0,0,.58,1),_e=ae(.42,0,.58,1),ve=e=>Array.isArray(e)&&typeof e[0]!=`number`,ye=e=>Array.isArray(e)&&typeof e[0]==`number`,be={linear:C,easeIn:he,easeInOut:_e,easeOut:ge,circIn:fe,circInOut:me,circOut:pe,backIn:le,backInOut:ue,backOut:ce,anticipate:de},xe=e=>typeof e==`string`,Se=e=>{if(ye(e)){e.length;let[t,n,r,i]=e;return ae(t,n,r,i)}else if(xe(e))return be[e],`${e}`,be[e];return e},Ce=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],A={value:null,addProjectionMetrics:null};function we(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&A.value&&A.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Te=40;function Ee(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Ce.reduce((e,n)=>(e[n]=we(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=v.useManualTiming?i.timestamp:performance.now();n=!1,v.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,Te),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Ce.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Ce.length;t++)o[Ce[t]].cancel(e)},state:i,steps:o}}var{schedule:j,cancel:M,state:N,steps:De}=Ee(typeof requestAnimationFrame<`u`?requestAnimationFrame:C,!0),Oe;function ke(){Oe=void 0}var P={now:()=>(Oe===void 0&&P.set(N.isProcessing||v.useManualTiming?N.timestamp:performance.now()),Oe),set:e=>{Oe=e,queueMicrotask(ke)}},Ae={layout:0,mainThread:0,waapi:0},je=e=>t=>typeof t==`string`&&t.startsWith(e),Me=je(`--`),Ne=je(`var(--`),Pe=e=>Ne(e)?Fe.test(e.split(`/*`)[0].trim()):!1,Fe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ie(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Le={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Re={...Le,transform:e=>_(0,1,e)},ze={...Le,default:1},Be=e=>Math.round(e*1e5)/1e5,Ve=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function He(e){return e==null}var Ue=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,We=(e,t)=>n=>!!(typeof n==`string`&&Ue.test(n)&&n.startsWith(e)||t&&!He(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ge=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ve);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Ke=e=>_(0,255,e),qe={...Le,transform:e=>Math.round(Ke(e))},F={test:We(`rgb`,`red`),parse:Ge(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+qe.transform(e)+`, `+qe.transform(t)+`, `+qe.transform(n)+`, `+Be(Re.transform(r))+`)`};function Je(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Ye={test:We(`#`),parse:Je,transform:F.transform},Xe=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),I=Xe(`deg`),L=Xe(`%`),R=Xe(`px`),Ze=Xe(`vh`),Qe=Xe(`vw`),$e={...L,parse:e=>L.parse(e)/100,transform:e=>L.transform(e*100)},et={test:We(`hsl`,`hue`),parse:Ge(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+L.transform(Be(t))+`, `+L.transform(Be(n))+`, `+Be(Re.transform(r))+`)`},z={test:e=>F.test(e)||Ye.test(e)||et.test(e),parse:e=>F.test(e)?F.parse(e):et.test(e)?et.parse(e):Ye.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?F.transform(e):et.transform(e),getAnimatableNone:e=>{let t=z.parse(e);return t.alpha=0,z.transform(t)}},tt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function nt(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ve)?.length||0)+(e.match(tt)?.length||0)>0}var rt=`number`,it=`color`,at=`var`,ot=`var(`,st="${}",ct=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lt(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(ct,e=>(z.test(e)?(r.color.push(a),i.push(it),n.push(z.parse(e))):e.startsWith(ot)?(r.var.push(a),i.push(at),n.push(e)):(r.number.push(a),i.push(rt),n.push(parseFloat(e))),++a,st)).split(st),indexes:r,types:i}}function ut(e){return lt(e).values}function dt({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===rt?i+=Be(r[a]):e===it?i+=z.transform(r[a]):i+=r[a]}return i}}function ft(e){return dt(lt(e))}var pt=e=>typeof e==`number`?0:z.test(e)?z.getAnimatableNone(e):e,mt=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:pt(e);function ht(e){let t=lt(e);return dt(t)(t.values.map((e,n)=>mt(e,t.split[n])))}var B={test:nt,parse:ut,createTransformer:ft,getAnimatableNone:ht};function gt(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function _t({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=gt(s,r,e+1/3),a=gt(s,r,e),o=gt(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function vt(e,t){return n=>n>0?t:e}var V=(e,t,n)=>e+(t-e)*n,yt=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},bt=[Ye,F,et],xt=e=>bt.find(t=>t.test(e));function St(e){let t=xt(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===et&&(n=_t(n)),n}var Ct=(e,t)=>{let n=St(e),r=St(t);if(!n||!r)return vt(e,t);let i={...n};return e=>(i.red=yt(n.red,r.red,e),i.green=yt(n.green,r.green,e),i.blue=yt(n.blue,r.blue,e),i.alpha=V(n.alpha,r.alpha,e),F.transform(i))},wt=new Set([`none`,`hidden`]);function Tt(e,t){return wt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Et(e,t){return n=>V(e,t,n)}function Dt(e){return typeof e==`number`?Et:typeof e==`string`?Pe(e)?vt:z.test(e)?Ct:jt:Array.isArray(e)?Ot:typeof e==`object`?z.test(e)?Ct:kt:vt}function Ot(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Dt(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function kt(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Dt(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function At(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var jt=(e,t)=>{let n=B.createTransformer(t),r=lt(e),i=lt(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?wt.has(e)&&!i.values.length||wt.has(t)&&!r.values.length?Tt(e,t):T(Ot(At(r,i),i.values),n):(`${e}${t}`,vt(e,t))};function Mt(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?V(e,t,n):Dt(e)(e,t)}var Nt=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>j.update(t,e),stop:()=>M(t),now:()=>N.isProcessing?N.timestamp:P.now()}},Pt=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Ft=2e4;function It(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Lt(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(It(r),Ft);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:k(i)}}var H={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Rt(e,t){return e*Math.sqrt(1-t*t)}var zt=12;function Bt(e,t,n){let r=n;for(let n=1;n<zt;n++)r-=e(r)/t(r);return r}var Vt=.001;function Ht({duration:e=H.duration,bounce:t=H.bounce,velocity:n=H.velocity,mass:r=H.mass}){let i,a;H.maxDuration;let o=1-t;o=_(H.minDamping,H.maxDamping,o),e=_(H.minDuration,H.maxDuration,k(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Rt(t,o),c=Math.exp(-i);return Vt-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Rt(t**2,o);return(-i(t)+Vt>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Bt(i,a,s);if(e=O(e),isNaN(c))return{stiffness:H.stiffness,damping:H.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Ut=[`duration`,`bounce`],Wt=[`stiffness`,`damping`,`mass`];function Gt(e,t){return t.some(t=>e[t]!==void 0)}function Kt(e){let t={velocity:H.velocity,stiffness:H.stiffness,damping:H.damping,mass:H.mass,isResolvedFromDuration:!1,...e};if(!Gt(e,Wt)&&Gt(e,Ut))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*_(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:H.mass,stiffness:i,damping:a}}else{let n=Ht({...e,velocity:0});t={...t,...n,mass:H.mass},t.isResolvedFromDuration=!0}return t}function qt(e=H.visualDuration,t=H.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Kt({...n,velocity:-k(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=k(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?H.restSpeed.granular:H.restSpeed.default,i||=v?H.restDelta.granular:H.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Rt(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(S*Math.sin(x*e)+g*Math.cos(x*e))},C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>O(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=O(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=O(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(It(T),Ft),t=Pt(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}qt.applyToOptions=e=>{let t=Lt(e,100,qt);return e.ease=t.ease,e.duration=O(t.duration),e.type=`keyframes`,e};var Jt=5;function Yt(e,t,n){let r=Math.max(t-Jt,0);return ee(n-e(r),t-r)}function Xt({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=qt({keyframes:[f.value,m(f.value)],velocity:Yt(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Zt(e,t,n){let r=[],i=n||v.mix||Mt,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=T(Array.isArray(t)?t[n]||C:t,a)),r.push(a)}return r}function Qt(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Zt(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=E(e[r],e[r+1],n);return s[r](i)};return n?t=>l(_(e[0],e[a-1],t)):l}function $t(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=E(0,t,r);e.push(V(n,1,i))}}function en(e){let t=[0];return $t(t,e.length-1),t}function tn(e,t){return e.map(e=>e*t)}function nn(e,t){return e.map(()=>t||_e).splice(0,e.length-1)}function rn({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ve(r)?r.map(Se):Se(r),a={done:!1,value:t[0]},o=Qt(tn(n&&n.length===t.length?n:en(t),e),t,{ease:Array.isArray(i)?i:nn(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var an=e=>e!==null;function on(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(an),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var sn={decay:Xt,inertia:Xt,tween:rn,keyframes:rn,spring:qt};function cn(e){typeof e.type==`string`&&(e.type=sn[e.type])}var ln=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},un=e=>e/100,dn=class extends ln{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==P.now()&&this.tick(P.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Ae.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;cn(e);let{type:t=rn,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||rn;s!==rn&&typeof o[0]!=`number`&&(this.mixKeyframes=T(un,Mt(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=It(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let y=this.currentTime,b=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(b=a)),y=_(0,1,n)*o}let x=v?{done:!1,value:l[0]}:b.next(y);i&&!v&&(x.value=i(x.value));let{done:S}=x;!v&&s!==null&&(S=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let C=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&S);return C&&p!==Xt&&(x.value=on(l,this.options,h,this.speed)),m&&m(x.value),C&&this.finish(),x}then(e,t){return this.finished.then(e,t)}get duration(){return k(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+k(e)}get time(){return k(this.currentTime)}set time(e){e=O(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Yt(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(P.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=k(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Nt,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(P.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Ae.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function fn(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var U=e=>e*180/Math.PI,pn=e=>hn(U(Math.atan2(e[1],e[0]))),mn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:pn,rotateZ:pn,skewX:e=>U(Math.atan(e[1])),skewY:e=>U(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},hn=e=>(e%=360,e<0&&(e+=360),e),gn=pn,_n=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vn=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),yn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:_n,scaleY:vn,scale:e=>(_n(e)+vn(e))/2,rotateX:e=>hn(U(Math.atan2(e[6],e[5]))),rotateY:e=>hn(U(Math.atan2(-e[2],e[0]))),rotateZ:gn,rotate:gn,skewX:e=>U(Math.atan(e[4])),skewY:e=>U(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function bn(e){return+!!e.includes(`scale`)}function xn(e,t){if(!e||e===`none`)return bn(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=yn,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mn,i=t}if(!i)return bn(t);let a=r[t],o=i[1].split(`,`).map(Cn);return typeof a==`function`?a(o):o[a]}var Sn=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return xn(n,t)};function Cn(e){return parseFloat(e.trim())}var wn=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Tn=new Set(wn),En=e=>e===Le||e===R,Dn=new Set([`x`,`y`,`z`]),On=wn.filter(e=>!Dn.has(e));function kn(e){let t=[];return On.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var W={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>xn(t,`x`),y:(e,{transform:t})=>xn(t,`y`)};W.translateX=W.x,W.translateY=W.y;var G=new Set,An=!1,jn=!1,Mn=!1;function Nn(){if(jn){let e=Array.from(G).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=kn(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}jn=!1,An=!1,G.forEach(e=>e.complete(Mn)),G.clear()}function Pn(){G.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(jn=!0)})}function Fn(){Mn=!0,Pn(),Nn(),Mn=!1}var In=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(G.add(this),An||(An=!0,j.read(Pn),j.resolveKeyframes(Nn))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}fn(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),G.delete(this)}cancel(){this.state===`scheduled`&&(G.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ln=e=>e.startsWith(`--`);function Rn(e,t,n){Ln(t)?e.style.setProperty(t,n):e.style[t]=n}var zn={};function Bn(e,t){let n=S(e);return()=>zn[t]??n()}var Vn=Bn(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Hn=Bn(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Un=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wn={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Un([0,.65,.55,1]),circOut:Un([.55,0,1,.45]),backIn:Un([.31,.01,.66,-.59]),backOut:Un([.33,1.53,.69,.99])};function Gn(e,t){if(e)return typeof e==`function`?Hn()?Pt(e,t):`ease-out`:ye(e)?Un(e):Array.isArray(e)?e.map(e=>Gn(e,t)||Wn.easeOut):Wn[e]}function Kn(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Gn(s,i);Array.isArray(d)&&(u.easing=d),A.value&&Ae.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return A.value&&p.finished.finally(()=>{Ae.waapi--}),p}function qn(e){return typeof e==`function`&&`applyToOptions`in e}function Jn({type:e,...t}){return qn(e)&&Hn()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Yn=class extends ln{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Jn(e);this.animation=Kn(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=on(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Rn(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return k(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+k(e)}get time(){return k(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=O(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Vn()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),C):r(this)}},Xn={anticipate:de,backInOut:ue,circInOut:me};function Zn(e){return e in Xn}function Qn(e){typeof e.ease==`string`&&Zn(e.ease)&&(e.ease=Xn[e.ease])}var $n=10,er=class extends Yn{constructor(e){Qn(e),cn(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new dn({...a,autoplay:!1}),s=Math.max($n,P.now()-this.startTime),c=_(0,$n,s-$n),l=o.sample(s).value,{name:u}=this.options;i&&u&&Rn(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},tr=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(B.test(e)||e===`0`)&&!e.startsWith(`url(`));function nr(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function rr(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=tr(i,t),s=tr(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:nr(e)||(n===`spring`||qn(n))&&r}function ir(e){e.duration=0,e.type=`keyframes`}var ar=new Set([`opacity`,`clipPath`,`filter`,`transform`]),or=S(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function sr(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return or()&&n&&ar.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var cr=40,lr=class extends ln{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=P.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||In;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=P.now(),rr(e,i,a,o)||((v.instantAnimations||!s)&&l?.(on(e,n,t)),e[0]=e[e.length-1],ir(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>cr?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&sr(u),f=u.motionValue?.owner?.current,p=d?new er({...u,element:f}):new dn(u);p.finished.then(()=>{this.notifyFinished()}).catch(C),this.pendingTimeline&&=(this.stopTimeline=p.attachTimeline(this.pendingTimeline),void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Fn()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function ur(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var dr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fr(e){let t=dr.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function pr(e,t,n=1){`${e}`;let[r,i]=fr(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return y(e)?parseFloat(e):e}return Pe(i)?pr(i,t,n+1):i}var mr={type:`spring`,stiffness:500,damping:25,restSpeed:10},hr=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gr={type:`keyframes`,duration:.8},_r={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},vr=(e,{keyframes:t})=>t.length>2?gr:Tn.has(e)?e.startsWith(`scale`)?hr(t[1]):mr:_r,yr=e=>e!==null;function br(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(yr),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}function xr(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Sr(e,t){let n=e?.[t]??e?.default??e;return n===e?n:xr(n,e)}function Cr({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var wr=(e,t,n,r={},i,a)=>o=>{let s=Sr(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=O(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Cr(s)||Object.assign(u,vr(e,u)),u.duration&&=O(u.duration),u.repeatDelay&&=O(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(ir(u),u.delay===0&&(d=!0)),(v.instantAnimations||v.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,ir(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=br(u.keyframes,s);if(e!==void 0){j.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new dn(u):new lr(u)};function Tr(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Er(e,t,n,r){if(typeof t==`function`){let[i,a]=Tr(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Tr(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Dr(e,t,n){let r=e.getProps();return Er(r,t,n===void 0?r.custom:n,e)}var Or=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...wn]),kr=30,Ar=e=>!isNaN(parseFloat(e)),jr={current:void 0},Mr=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=P.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=P.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ar(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new D);let n=this.events[e].add(t);return e===`change`?()=>{n(),j.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return jr.current&&jr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=P.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>kr)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,kr);return ee(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Nr(e,t){return new Mr(e,t)}var Pr=e=>Array.isArray(e);function Fr(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Nr(n))}function Ir(e){return Pr(e)?e[e.length-1]||0:e}function Lr(e,t){let{transitionEnd:n={},transition:r={},...i}=Dr(e,t)||{};i={...i,...n};for(let t in i)Fr(e,t,Ir(i[t]))}var K=e=>!!(e&&e.getVelocity);function Rr(e){return!!(K(e)&&e.add)}function zr(e,t){let n=e.getValue(`willChange`);if(Rr(n))return n.add(t);if(!n&&v.WillChange){let n=new v.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Br(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Vr=`data-`+Br(`framerAppearId`);function Hr(e){return e.props[Vr]}function Ur({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Wr(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?xr(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Ur(d,t))continue;let o={delay:n,...Sr(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating&&!Array.isArray(i)&&i===c&&!o.velocity)continue;let f=!1;if(window.MotionHandoffAnimation){let n=Hr(e);if(n){let e=window.MotionHandoffAnimation(n,t,j);e!==null&&(o.startTime=e,f=!0)}}zr(e,t);let p=l??e.shouldReduceMotion;r.start(wr(t,r,i,p&&Or.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>j.update(()=>{o&&Lr(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Gr(e,t,n={}){let r=Dr(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Wr(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Kr(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Kr(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Gr(c,t,{...o,delay:n+(typeof r==`function`?0:r)+ur(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function qr(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Gr(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Gr(e,t,n);else{let i=typeof t==`function`?Dr(e,t,n.custom):t;r=Promise.all(Wr(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Jr={test:e=>e===`auto`,parse:e=>e},Yr=e=>t=>t.test(e),Xr=[Le,R,L,I,Qe,Ze,Jr],Zr=e=>Xr.find(Yr(e));function Qr(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||x(e)}var $r=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function ei(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ve)||[];if(!r)return e;let i=n.replace(r,``),a=+!!$r.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var ti=/\b([a-z-]*)\(.*?\)/gu,ni={...B,getAnimatableNone:e=>{let t=e.match(ti);return t?t.map(ei).join(` `):e}},ri={...B,getAnimatableNone:e=>{let t=B.parse(e);return B.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ii={...Le,transform:Math.round},ai={borderWidth:R,borderTopWidth:R,borderRightWidth:R,borderBottomWidth:R,borderLeftWidth:R,borderRadius:R,borderTopLeftRadius:R,borderTopRightRadius:R,borderBottomRightRadius:R,borderBottomLeftRadius:R,width:R,maxWidth:R,height:R,maxHeight:R,top:R,right:R,bottom:R,left:R,inset:R,insetBlock:R,insetBlockStart:R,insetBlockEnd:R,insetInline:R,insetInlineStart:R,insetInlineEnd:R,padding:R,paddingTop:R,paddingRight:R,paddingBottom:R,paddingLeft:R,paddingBlock:R,paddingBlockStart:R,paddingBlockEnd:R,paddingInline:R,paddingInlineStart:R,paddingInlineEnd:R,margin:R,marginTop:R,marginRight:R,marginBottom:R,marginLeft:R,marginBlock:R,marginBlockStart:R,marginBlockEnd:R,marginInline:R,marginInlineStart:R,marginInlineEnd:R,fontSize:R,backgroundPositionX:R,backgroundPositionY:R,rotate:I,rotateX:I,rotateY:I,rotateZ:I,scale:ze,scaleX:ze,scaleY:ze,scaleZ:ze,skew:I,skewX:I,skewY:I,distance:R,translateX:R,translateY:R,translateZ:R,x:R,y:R,z:R,perspective:R,transformPerspective:R,opacity:Re,originX:$e,originY:$e,originZ:R,zIndex:ii,fillOpacity:Re,strokeOpacity:Re,numOctaves:ii},oi={...ai,color:z,backgroundColor:z,outlineColor:z,fill:z,stroke:z,borderColor:z,borderTopColor:z,borderRightColor:z,borderBottomColor:z,borderLeftColor:z,filter:ni,WebkitFilter:ni,mask:ri,WebkitMask:ri},si=e=>oi[e],ci=new Set([ni,ri]);function li(e,t){let n=si(e);return ci.has(n)||(n=B),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var ui=new Set([`auto`,`none`,`0`]);function di(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!ui.has(t)&&lt(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=li(n,i)}var fi=class extends In{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Pe(r))){let i=pr(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Or.has(n)||e.length!==2)return;let[r,i]=e,a=Zr(r),o=Zr(i);if(Ie(r)!==Ie(i)&&W[n]){this.needsMeasurement=!0;return}if(a!==o)if(En(a)&&En(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else W[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Qr(e[t]))&&n.push(t);n.length&&di(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=W[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=W[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},pi=new Set([`opacity`,`clipPath`,`filter`,`transform`]);function mi(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var hi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function gi(e){return b(e)&&`offsetHeight`in e}var{schedule:_i,cancel:vi}=Ee(queueMicrotask,!1),q={x:!1,y:!1};function yi(){return q.x||q.y}function bi(e){return e===`x`||e===`y`?q[e]?null:(q[e]=!0,()=>{q[e]=!1}):q.x||q.y?null:(q.x=q.y=!0,()=>{q.x=q.y=!1})}function xi(e,t){let n=mi(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Si(e){return!(e.pointerType===`touch`||yi())}function Ci(e,t,n={}){let[r,i,a]=xi(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Si(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var wi=(e,t)=>t?e===t?!0:wi(e,t.parentElement):!1,Ti=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Ei=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Di(e){return Ei.has(e.tagName)||e.isContentEditable===!0}var Oi=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function ki(e){return Oi.has(e.tagName)||e.isContentEditable===!0}var Ai=new WeakSet;function ji(e){return t=>{t.key===`Enter`&&e(t)}}function Mi(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Ni=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=ji(()=>{if(Ai.has(n))return;Mi(n,`down`);let e=ji(()=>{Mi(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Mi(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Pi(e){return Ti(e)&&!yi()}var Fi=new WeakSet;function Ii(e,t,n={}){let[r,i,a]=xi(e,n),o=e=>{let r=e.currentTarget;if(!Pi(e)||Fi.has(e))return;Ai.add(r),n.stopPropagation&&Fi.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ai.has(r)&&Ai.delete(r),Pi(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||wi(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),gi(e)&&(e.addEventListener(`focus`,e=>Ni(e,i)),!Di(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Li(e){return b(e)&&`ownerSVGElement`in e}var Ri=new WeakMap,zi,Bi=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Li(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Vi=Bi(`inline`,`width`,`offsetWidth`),Hi=Bi(`block`,`height`,`offsetHeight`);function Ui({target:e,borderBoxSize:t}){Ri.get(e)?.forEach(n=>{n(e,{get width(){return Vi(e,t)},get height(){return Hi(e,t)}})})}function Wi(e){e.forEach(Ui)}function Gi(){typeof ResizeObserver>`u`||(zi=new ResizeObserver(Wi))}function Ki(e,t){zi||Gi();let n=mi(e);return n.forEach(e=>{let n=Ri.get(e);n||(n=new Set,Ri.set(e,n)),n.add(t),zi?.observe(e)}),()=>{n.forEach(e=>{let n=Ri.get(e);n?.delete(t),n?.size||zi?.unobserve(e)})}}var qi=new Set,Ji;function Yi(){Ji=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};qi.forEach(t=>t(e))},window.addEventListener(`resize`,Ji)}function Xi(e){return qi.add(e),Ji||Yi(),()=>{qi.delete(e),!qi.size&&typeof Ji==`function`&&(window.removeEventListener(`resize`,Ji),Ji=void 0)}}function Zi(e,t){return typeof e==`function`?Xi(e):Ki(e,t)}function Qi(e){return Li(e)&&e.tagName===`svg`}var $i=[...Xr,z,B],ea=e=>$i.find(Yr(e)),ta=()=>({translate:0,scale:1,origin:0,originPoint:0}),na=()=>({x:ta(),y:ta()}),ra=()=>({min:0,max:0}),J=()=>({x:ra(),y:ra()}),ia=new WeakMap;function aa(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function oa(e){return typeof e==`string`||Array.isArray(e)}var sa=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],ca=[`initial`,...sa];function la(e){return aa(e.animate)||ca.some(t=>oa(e[t]))}function ua(e){return!!(la(e)||e.variants)}function da(e,t,n){for(let r in t){let i=t[r],a=n[r];if(K(i))e.addValue(r,i);else if(K(a))e.addValue(r,Nr(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Nr(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var fa={current:null},pa={current:!1},ma=typeof window<`u`;function ha(){if(pa.current=!0,ma)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>fa.current=e.matches;e.addEventListener(`change`,t),t()}else fa.current=!1}var ga=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],_a={};function va(e){_a=e}function ya(){return _a}var ba=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=In,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=P.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,j.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=la(t),this.isVariantNode=ua(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&K(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,ia.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(pa.current||ha(),this.shouldReduceMotion=fa.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),M(this.notifyUpdate),M(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&pi.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Yn({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:O(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Tn.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&j.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in _a){let t=_a[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):J()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<ga.length;t++){let n=ga[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=da(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Nr(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(y(n)||x(n))?n=parseFloat(n):!ea(n)&&B.test(t)&&(n=li(e,t)),this.setBaseTarget(e,K(n)?n.get():n)),K(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Er(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!K(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new D),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){_i.render(this.render)}},xa=class extends ba{constructor(){super(...arguments),this.KeyframeResolver=fi}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;K(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Y=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Sa({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Ca({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function wa(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ta(e){return e===void 0||e===1}function Ea({scale:e,scaleX:t,scaleY:n}){return!Ta(e)||!Ta(t)||!Ta(n)}function X(e){return Ea(e)||Da(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Da(e){return Oa(e.x)||Oa(e.y)}function Oa(e){return e&&e!==`0%`}function ka(e,t,n){return n+t*(e-n)}function Aa(e,t,n,r,i){return i!==void 0&&(e=ka(e,i,r)),ka(e,n,r)+t}function ja(e,t=0,n=1,r,i){e.min=Aa(e.min,t,n,r,i),e.max=Aa(e.max,t,n,r,i)}function Ma(e,{x:t,y:n}){ja(e.x,t.translate,t.scale,t.originPoint),ja(e.y,n.translate,n.scale,n.originPoint)}var Na=.999999999999,Pa=1.0000000000001;function Fa(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&za(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ma(e,o)),r&&X(a.latestValues)&&za(e,a.latestValues,a.layout?.layoutBox))}t.x<Pa&&t.x>Na&&(t.x=1),t.y<Pa&&t.y>Na&&(t.y=1)}function Ia(e,t){e.min+=t,e.max+=t}function La(e,t,n,r,i=.5){ja(e,t,n,V(e.min,e.max,i),r)}function Ra(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function za(e,t,n){let r=n??e;La(e.x,Ra(t.x,r.x),t.scaleX,t.scale,t.originX),La(e.y,Ra(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ba(e,t){return Sa(wa(e.getBoundingClientRect(),t))}function Va(e,t,n){let r=Ba(e,n),{scroll:i}=t;return i&&(Ia(r.x,i.offset.x),Ia(r.y,i.offset.y)),r}var Ha={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Ua=wn.length;function Wa(e,t,n){let r=``,i=!0;for(let a=0;a<Ua;a++){let o=wn[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=hi(s,ai[o]);if(!c){i=!1;let t=Ha[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Ga(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Tn.has(e)){o=!0;continue}else if(Me(e)){i[e]=n;continue}else{let t=hi(n,ai[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Wa(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Ka(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function qa(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ja={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(R.test(e))e=parseFloat(e);else return e;return`${qa(e,t.target.x)}% ${qa(e,t.target.y)}%`}},Ya={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=B.parse(e);if(i.length>5)return r;let a=B.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=V(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Xa={borderRadius:{...Ja,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:Ya};function Za(e,{layout:t,layoutId:n}){return Tn.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Xa[e]||e===`opacity`)}function Qa(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(K(r[t])||i&&K(i[t])||Za(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function $a(e){return window.getComputedStyle(e)}var eo=class extends xa{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Ka}readValueFromInstance(e,t){if(Tn.has(t))return this.projection?.isProjecting?bn(t):Sn(e,t);{let n=$a(e),r=(Me(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ba(e,t)}build(e,t,n){Ga(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Qa(e,t,n)}},to={offset:`stroke-dashoffset`,array:`stroke-dasharray`},no={offset:`strokeDashoffset`,array:`strokeDasharray`};function ro(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?to:no;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var io=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function ao(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Ga(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of io)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&ro(d,i,a,o,!1)}var oo=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),so=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function co(e,t,n,r){Ka(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(oo.has(n)?n:Br(n),t.attrs[n])}function lo(e,t,n){let r=Qa(e,t,n);for(let n in e)if(K(e[n])||K(t[n])){let t=wn.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var uo=class extends xa{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=J}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Tn.has(t)){let e=si(t);return e&&e.default||0}return t=oo.has(t)?t:Br(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return lo(e,t,n)}build(e,t,n){ao(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){co(e,t,n,r)}mount(e){this.isSVGTag=so(e.tagName),super.mount(e)}},fo=ca.length;function po(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&po(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<fo;n++){let r=ca[n],i=e.props[r];(oa(i)||i===!1)&&(t[r]=i)}return t}function mo(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var ho=[...sa].reverse(),go=sa.length;function _o(e){return t=>Promise.all(t.map(({animation:t,options:n})=>qr(e,t,n)))}function vo(e){let t=_o(e),n=xo(),r=!0,i=!1,a=t=>(n,r)=>{let i=Dr(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=po(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<go;t++){let p=ho[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=oa(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||aa(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=yo(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=Pr(t)&&Pr(n)?!mo(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Dr(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=ur(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Dr(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=xo(),i=!0}}}function yo(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!mo(t,e):!1}function bo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xo(){return{animate:bo(!0),whileInView:bo(),whileHover:bo(),whileTap:bo(),whileDrag:bo(),whileFocus:bo(),exit:bo()}}function So(e,t){e.min=t.min,e.max=t.max}function Z(e,t){So(e.x,t.x),So(e.y,t.y)}function Co(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var wo=.9999,To=1.0001,Eo=-.01,Do=.01;function Q(e){return e.max-e.min}function Oo(e,t,n){return Math.abs(e-t)<=n}function ko(e,t,n,r=.5){e.origin=r,e.originPoint=V(t.min,t.max,e.origin),e.scale=Q(n)/Q(t),e.translate=V(n.min,n.max,e.origin)-e.originPoint,(e.scale>=wo&&e.scale<=To||isNaN(e.scale))&&(e.scale=1),(e.translate>=Eo&&e.translate<=Do||isNaN(e.translate))&&(e.translate=0)}function Ao(e,t,n,r){ko(e.x,t.x,n.x,r?r.originX:void 0),ko(e.y,t.y,n.y,r?r.originY:void 0)}function jo(e,t,n){e.min=n.min+t.min,e.max=e.min+Q(t)}function Mo(e,t,n){jo(e.x,t.x,n.x),jo(e.y,t.y,n.y)}function No(e,t,n){e.min=t.min-n.min,e.max=e.min+Q(t)}function Po(e,t,n){No(e.x,t.x,n.x),No(e.y,t.y,n.y)}function Fo(e,t,n,r,i){return e-=t,e=ka(e,1/n,r),i!==void 0&&(e=ka(e,1/i,r)),e}function Io(e,t=0,n=1,r=.5,i,a=e,o=e){if(L.test(t)&&(t=parseFloat(t),t=V(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=V(a.min,a.max,r);e===a&&(s-=t),e.min=Fo(e.min,t,n,s,i),e.max=Fo(e.max,t,n,s,i)}function Lo(e,t,[n,r,i],a,o){Io(e,t[n],t[r],t[i],t.scale,a,o)}var Ro=[`x`,`scaleX`,`originX`],zo=[`y`,`scaleY`,`originY`];function Bo(e,t,n,r){Lo(e.x,t,Ro,n?n.x:void 0,r?r.x:void 0),Lo(e.y,t,zo,n?n.y:void 0,r?r.y:void 0)}function Vo(e){return e.translate===0&&e.scale===1}function Ho(e){return Vo(e.x)&&Vo(e.y)}function Uo(e,t){return e.min===t.min&&e.max===t.max}function Wo(e,t){return Uo(e.x,t.x)&&Uo(e.y,t.y)}function Go(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ko(e,t){return Go(e.x,t.x)&&Go(e.y,t.y)}function qo(e){return Q(e.x)/Q(e.y)}function Jo(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function $(e){return[e(`x`),e(`y`)]}function Yo(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Xo=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],Zo=Xo.length,Qo=e=>typeof e==`string`?parseFloat(e):e,$o=e=>typeof e==`number`||R.test(e);function es(e,t,n,r,i,a){i?(e.opacity=V(0,n.opacity??1,ns(r)),e.opacityExit=V(t.opacity??1,0,rs(r))):a&&(e.opacity=V(t.opacity??1,n.opacity??1,r));for(let i=0;i<Zo;i++){let a=`border${Xo[i]}Radius`,o=ts(t,a),s=ts(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||$o(o)===$o(s)?(e[a]=Math.max(V(Qo(o),Qo(s),r),0),(L.test(s)||L.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=V(t.rotate||0,n.rotate||0,r))}function ts(e,t){return e[t]===void 0?e.borderRadius:e[t]}var ns=is(0,.5,pe),rs=is(.5,.95,C);function is(e,t,n){return r=>r<e?0:r>t?1:n(E(e,t,r))}function as(e,t,n){let r=K(e)?e:Nr(e);return r.start(wr(``,r,t,n)),r.animation}function os(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var ss=(e,t)=>e.depth-t.depth,cs=class{constructor(){this.children=[],this.isDirty=!1}add(e){h(this.children,e),this.isDirty=!0}remove(e){g(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ss),this.isDirty=!1,this.children.forEach(e)}};function ls(e,t){let n=P.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(M(r),e(a-t))};return j.setup(r,!0),()=>M(r)}function us(e){return K(e)?e.get():e}var ds=class{constructor(){this.members=[]}add(e){h(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(g(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(g(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},fs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ps={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},ms=[``,`X`,`Y`,`Z`],hs=1e3,gs=0;function _s(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function vs(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Hr(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,j,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&vs(r)}function ys({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=gs++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,A.value&&(ps.nodes=ps.calculatedTargetDeltas=ps.calculatedProjections=0),this.nodes.forEach(Ss),this.nodes.forEach(ks),this.nodes.forEach(As),this.nodes.forEach(Cs),A.addProjectionMetrics&&A.addProjectionMetrics(ps)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new cs)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new D),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=Li(t)&&!Qi(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;j.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=ls(i,250),fs.hasAnimatedSinceResize&&(fs.hasAnimatedSinceResize=!1,this.nodes.forEach(Os)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Ls,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Ko(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Sr(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||Os(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),M(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(js),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&vs(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ts);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Es);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Ds),this.nodes.forEach(bs),this.nodes.forEach(xs)):this.nodes.forEach(Es),this.clearAllSnapshots();let e=P.now();N.delta=_(0,1e3/60,e-N.timestamp),N.timestamp=e,N.isProcessing=!0,De.update.process(N),De.preRender.process(N),De.render.process(N),N.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,_i.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ws),this.sharedNodes.forEach(Ms)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,j.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){j.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Q(this.snapshot.measuredBox.x)&&!Q(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=J(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Ho(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||X(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),Vs(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return J();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Us))){let{scroll:e}=this.root;e&&(Ia(t.x,e.offset.x),Ia(t.y,e.offset.y))}return t}removeElementScroll(e){let t=J();if(Z(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Z(t,e),Ia(t.x,i.offset.x),Ia(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=J();Z(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&za(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),X(r.latestValues)&&za(n,r.latestValues,r.layout?.layoutBox)}return X(this.latestValues)&&za(n,this.latestValues,this.layout?.layoutBox),n}removeTransform(e){let t=J();Z(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!X(n.latestValues))continue;let r;n.instance&&(Ea(n.latestValues)&&n.updateSnapshot(),r=J(),Z(r,n.measurePageBox())),Bo(t,n.latestValues,n.snapshot?.layoutBox,r)}return X(this.latestValues)&&Bo(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==N.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=N.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=J(),this.targetWithTransforms=J()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Mo(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Z(this.target,this.layout.layoutBox),Ma(this.target,this.targetDelta)):Z(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),A.value&&ps.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Ea(this.parent.latestValues)||Da(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=J(),this.relativeTargetOrigin=J(),Po(this.relativeTargetOrigin,t,n),Z(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===N.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Z(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Fa(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=J());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Co(this.prevProjectionDelta.x,this.projectionDelta.x),Co(this.prevProjectionDelta.y,this.projectionDelta.y)),Ao(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Jo(this.projectionDelta.x,this.prevProjectionDelta.x)||!Jo(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),A.value&&ps.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=na(),this.projectionDelta=na(),this.projectionDeltaWithTransform=na()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=na();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=J(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Is));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;Ns(a.x,e.x,n),Ns(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Po(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Fs(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Wo(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=J(),Z(d,this.relativeTarget)),s&&(this.animationValues=i,es(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(M(this.pendingAnimation),void 0),this.pendingAnimation=j.update(()=>{fs.hasAnimatedSinceResize=!0,Ae.layout++,this.motionValue||=Nr(0),this.motionValue.jump(0,!1),this.currentAnimation=as(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Ae.layout--},onComplete:()=>{Ae.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(hs),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&Hs(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||J();let t=Q(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Q(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Z(t,n),za(t,i),Ao(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new ds),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&_s(`z`,e,r,this.animationValues);for(let t=0;t<ms.length;t++)_s(`rotate${ms[t]}`,e,r,this.animationValues),_s(`skew${ms[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=us(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=us(t?.pointerEvents)||``),this.hasProjected&&!X(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Yo(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Xa){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Xa[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?us(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Ts),this.root.sharedNodes.clear()}}}function bs(e){e.updateLayout()}function xs(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?$(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Q(r);r.min=n[e].min,r.max=r.min+i}):Hs(i,t.layoutBox,n)&&$(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Q(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=na();Ao(o,n,t.layoutBox);let s=na();a?Ao(s,e.applyTransform(r,!0),t.measuredBox):Ao(s,n,t.layoutBox);let c=!Ho(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=J();Po(o,t.layoutBox,i.layoutBox);let s=J();Po(s,n,a.layoutBox),Ko(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Ss(e){A.value&&ps.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Cs(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ws(e){e.clearSnapshot()}function Ts(e){e.clearMeasurements()}function Es(e){e.isLayoutDirty=!1}function Ds(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Os(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ks(e){e.resolveTargetDelta()}function As(e){e.calcProjection()}function js(e){e.resetSkewAndRotation()}function Ms(e){e.removeLeadSnapshot()}function Ns(e,t,n){e.translate=V(t.translate,0,n),e.scale=V(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Ps(e,t,n,r){e.min=V(t.min,n.min,r),e.max=V(t.max,n.max,r)}function Fs(e,t,n,r){Ps(e.x,t.x,n.x,r),Ps(e.y,t.y,n.y,r)}function Is(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var Ls={duration:.45,ease:[.4,0,.1,1]},Rs=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zs=Rs(`applewebkit/`)&&!Rs(`chrome/`)?Math.round:C;function Bs(e){e.min=zs(e.min),e.max=zs(e.max)}function Vs(e){Bs(e.x),Bs(e.y)}function Hs(e,t,n){return e===`position`||e===`preserve-aspect`&&!Oo(qo(t),qo(n),.2)}function Us(e){return e!==e.root&&e.scroll?.wasRoot}var Ws=ys({attachResizeListener:(e,t)=>os(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Gs={current:void 0},Ks=ys({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Gs.current){let e=new Ws({});e.mount(window),e.setOptions({layoutScroll:!0}),Gs.current=e}return Gs.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),qs=(0,u.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Js(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ys(...e){return t=>{let n=!1,r=e.map(e=>{let r=Js(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Js(e[t],null)}}}}function Xs(...e){return u.useCallback(Ys(...e),e)}var Zs=class extends u.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(gi(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=gi(e)&&e.offsetWidth||0,r=gi(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}};function Qs({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,u.useId)(),s=(0,u.useRef)(null),c=(0,u.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=(0,u.useContext)(qs),f=Xs(s,e.props?.ref??e?.ref);return(0,u.useInsertionEffect)(()=>{let{width:e,height:l,top:u,left:f,right:p,bottom:m}=c.current;if(t||a===!1||!s.current||!e||!l)return;let h=n===`left`?`left: ${f}`:`right: ${p}`,g=r===`bottom`?`bottom: ${m}`:`top: ${u}`;s.current.dataset.motionPopId=o;let _=document.createElement(`style`);d&&(_.nonce=d);let v=i??document.head;return v.appendChild(_),_.sheet&&_.sheet.insertRule(`
2
+ [data-motion-pop-id="${o}"] {
3
+ position: absolute !important;
4
+ width: ${e}px !important;
5
+ height: ${l}px !important;
6
+ ${h}px !important;
7
+ ${g}px !important;
8
+ }
9
+ `),()=>{v.contains(_)&&v.removeChild(_)}},[t]),(0,l.jsx)(Zs,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:u.cloneElement(e,{ref:f})})}var $s=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:d})=>{let p=f(ec),h=(0,u.useId)(),g=!0,_=(0,u.useMemo)(()=>(g=!1,{id:h,initial:t,isPresent:n,custom:i,onExitComplete:e=>{p.set(e,!0);for(let e of p.values())if(!e)return;r&&r()},register:e=>(p.set(e,!1),()=>p.delete(e))}),[n,p,r]);return a&&g&&(_={..._}),(0,u.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[n]),u.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),e=(0,l.jsx)(Qs,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:d,children:e}),(0,l.jsx)(m.Provider,{value:_,children:e})};function ec(){return new Map}function tc(e=!0){let t=(0,u.useContext)(m);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,u.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var nc=e=>e.key||``;function rc(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}var ic=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:m})=>{let[h,g]=tc(o),_=(0,u.useMemo)(()=>rc(e),[e]),v=o&&!h?[]:_.map(nc),y=(0,u.useRef)(!0),b=(0,u.useRef)(_),x=f(()=>new Map),S=(0,u.useRef)(new Set),[C,w]=(0,u.useState)(_),[T,E]=(0,u.useState)(_);p(()=>{y.current=!1,b.current=_;for(let e=0;e<T.length;e++){let t=nc(T[e]);v.includes(t)?(x.delete(t),S.current.delete(t)):x.get(t)!==!0&&x.set(t,!1)}},[T,v.length,v.join(`-`)]);let D=[];if(_!==C){let e=[..._];for(let t=0;t<T.length;t++){let n=T[t],r=nc(n);v.includes(r)||(e.splice(t,0,n),D.push(n))}return a===`wait`&&D.length&&(e=D),E(rc(e)),w(_),null}let{forceRender:O}=(0,u.useContext)(d);return(0,l.jsx)(l.Fragment,{children:T.map(e=>{let u=nc(e),d=o&&!h?!1:_===T||v.includes(u);return(0,l.jsx)($s,{isPresent:d,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:m,onExitComplete:d?void 0:()=>{if(S.current.has(u))return;if(S.current.add(u),x.has(u))x.set(u,!0);else return;let e=!0;x.forEach(t=>{t||(e=!1)}),e&&(O?.(),E(b.current),o&&g?.(),r&&r())},anchorX:s,anchorY:c,children:e},u)})})},ac=(0,u.createContext)({strict:!1}),oc={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},sc=!1;function cc(){if(sc)return;let e={};for(let t in oc)e[t]={isEnabled:e=>oc[t].some(t=>!!e[t])};va(e),sc=!0}function lc(){return cc(),ya()}function uc(e){let t=lc();for(let n in e)t[n]={...t[n],...e[n]};va(t)}var dc=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function fc(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||dc.has(e)}var pc=e({default:()=>mc}),mc,hc=n((()=>{throw mc={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),gc=e=>!fc(e);function _c(e){typeof e==`function`&&(gc=t=>t.startsWith(`on`)?!fc(t):e(t))}try{_c((hc(),i(pc)).default)}catch{}function vc(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(gc(i)||n===!0&&fc(i)||!t&&!fc(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var yc=(0,u.createContext)({});function bc(e,t){if(la(e)){let{initial:t,animate:n}=e;return{initial:t===!1||oa(t)?t:void 0,animate:oa(n)?n:void 0}}return e.inherit===!1?{}:t}function xc(e){let{initial:t,animate:n}=bc(e,(0,u.useContext)(yc));return(0,u.useMemo)(()=>({initial:t,animate:n}),[Sc(t),Sc(n)])}function Sc(e){return Array.isArray(e)?e.join(` `):e}var Cc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function wc(e,t,n){for(let r in t)!K(t[r])&&!Za(r,n)&&(e[r]=t[r])}function Tc({transformTemplate:e},t){return(0,u.useMemo)(()=>{let n=Cc();return Ga(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ec(e,t){let n=e.style||{},r={};return wc(r,n,e),Object.assign(r,Tc(e,t)),r}function Dc(e,t){let n={},r=Ec(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Oc=()=>({...Cc(),attrs:{}});function kc(e,t,n,r){let i=(0,u.useMemo)(()=>{let n=Oc();return ao(n,t,so(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};wc(t,e.style,e),i.style={...t,...i.style}}return i}var Ac=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function jc(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Ac.indexOf(e)>-1||/[A-Z]/u.test(e))}function Mc(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??jc(e)?kc:Dc)(t,r,i,e),c=vc(t,typeof e==`string`,a),l=e===u.Fragment?{}:{...c,...s,ref:n},{children:d}=t,f=(0,u.useMemo)(()=>K(d)?d.get():d,[d]);return(0,u.createElement)(e,{...l,children:f})}function Nc({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Pc(n,r,i,e),renderState:t()}}function Pc(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=us(a[e]);let{initial:o,animate:s}=e,c=la(e),l=ua(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!aa(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=Er(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Fc=e=>(t,n)=>{let r=(0,u.useContext)(yc),i=(0,u.useContext)(m),a=()=>Nc(e,t,r,i);return n?a():f(a)},Ic=Fc({scrapeMotionValuesFromProps:Qa,createRenderState:Cc}),Lc=Fc({scrapeMotionValuesFromProps:lo,createRenderState:Oc}),Rc=Symbol.for(`motionComponentSymbol`);function zc(e,t,n){let r=(0,u.useRef)(n);(0,u.useInsertionEffect)(()=>{r.current=n});let i=(0,u.useRef)(null);return(0,u.useCallback)(n=>{n&&e.onMount?.(n);let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n);t&&(n?t.mount(n):t.unmount())},[t])}var Bc=(0,u.createContext)({});function Vc(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Hc(e,t,n,r,i,a){let{visualElement:o}=(0,u.useContext)(yc),s=(0,u.useContext)(ac),c=(0,u.useContext)(m),l=(0,u.useContext)(qs),d=l.reducedMotion,f=l.skipAnimations,h=(0,u.useRef)(null),g=(0,u.useRef)(!1);r||=s.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:f,isSVG:a}),g.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));let _=h.current,v=(0,u.useContext)(Bc);_&&!_.projection&&i&&(_.type===`html`||_.type===`svg`)&&Uc(h.current,n,i,v);let y=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{_&&y.current&&_.update(n,c)});let b=n[Vr],x=(0,u.useRef)(!!b&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return p(()=>{g.current=!0,_&&(y.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),_.scheduleRenderMicrotask(),x.current&&_.animationState&&_.animationState.animateChanges())}),(0,u.useEffect)(()=>{_&&(!x.current&&_.animationState&&_.animationState.animateChanges(),x.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),!1),_.enteringChildren=void 0)}),_}function Uc(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Wc(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Vc(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function Wc(e){if(e)return e.options.allowProjection===!1?Wc(e.parent):e.projection}function Gc(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&uc(r);let a=n?n===`svg`:jc(e),o=a?Lc:Ic;function s(n,s){let c,d={...(0,u.useContext)(qs),...n,layoutId:Kc(n)},{isStatic:f}=d,p=xc(n),m=o(n,f);if(!f&&typeof window<`u`){qc(d,r);let t=Jc(d);c=t.MeasureLayout,p.visualElement=Hc(e,m,d,i,t.ProjectionNode,a)}return(0,l.jsxs)(yc.Provider,{value:p,children:[c&&p.visualElement?(0,l.jsx)(c,{visualElement:p.visualElement,...d}):null,Mc(e,n,zc(m,p.visualElement,s),m,f,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,u.forwardRef)(s);return c[Rc]=e,c}function Kc({layoutId:e}){let t=(0,u.useContext)(d).id;return t&&e!==void 0?t+`-`+e:e}function qc(e,t){(0,u.useContext)(ac).strict}function Jc(e){let{drag:t,layout:n}=lc();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Yc(e,t){if(typeof Proxy>`u`)return Gc;let n=new Map,r=(n,r)=>Gc(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Gc(a,void 0,e,t)),n.get(a))})}var Xc=(e,t)=>t.isSVG??jc(e)?new uo(t):new eo(t,{allowProjection:e!==u.Fragment}),Zc=class extends Y{constructor(e){super(e),e.animationState||=vo(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();aa(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Qc=0,$c={animation:{Feature:Zc},exit:{Feature:class extends Y{constructor(){super(...arguments),this.id=Qc++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function el(e){return{point:{x:e.pageX,y:e.pageY}}}var tl=e=>t=>Ti(t)&&e(t,el(t));function nl(e,t,n,r){return os(e,t,tl(n),r)}var rl=({current:e})=>e?e.ownerDocument.defaultView:null,il=(e,t)=>Math.abs(e-t);function al(e,t){let n=il(e.x,t.x),r=il(e.y,t.y);return Math.sqrt(n**2+r**2)}var ol=new Set([`auto`,`scroll`]),sl=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=cl(this.lastRawMoveEventInfo,this.transformPagePoint));let e=ul(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=al(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=N;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=cl(t,this.transformPagePoint),j.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=ul(e.type===`pointercancel`?this.lastMoveEventInfo:cl(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Ti(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=cl(el(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=N;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,ul(s,this.history)),this.removeListeners=T(nl(this.contextWindow,`pointermove`,this.handlePointerMove),nl(this.contextWindow,`pointerup`,this.handlePointerUp),nl(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(ol.has(e.overflowX)||ol.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),j.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),M(this.updatePoint)}};function cl(e,t){return t?{point:t(e.point)}:e}function ll(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ul({point:e},t){return{point:e,delta:ll(e,fl(t)),offset:ll(e,dl(t)),velocity:pl(t,.1)}}function dl(e){return e[0]}function fl(e){return e[e.length-1]}function pl(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=fl(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>O(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>O(t)*2&&(r=e[1]);let a=k(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ml(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?V(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?V(n,e,r.max):Math.min(e,n)),e}function hl(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function gl(e,{top:t,left:n,bottom:r,right:i}){return{x:hl(e.x,n,i),y:hl(e.y,t,r)}}function _l(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function vl(e,t){return{x:_l(e.x,t.x),y:_l(e.y,t.y)}}function yl(e,t){let n=.5,r=Q(e),i=Q(t);return i>r?n=E(t.min,t.max-r,e.min):r>i&&(n=E(e.min,e.max-i,t.min)),_(0,1,n)}function bl(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var xl=.35;function Sl(e=xl){return e===!1?e=0:e===!0&&(e=xl),{x:Cl(e,`left`,`right`),y:Cl(e,`top`,`bottom`)}}function Cl(e,t,n){return{min:wl(e,t),max:wl(e,n)}}function wl(e,t){return typeof e==`number`?e:e[t]||0}var Tl=new WeakMap,El=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=J(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(el(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=bi(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),$(e=>{let t=this.getAxisMotionValue(e).get()||0;if(L.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=Q(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&j.update(()=>i(e,t),!1,!0),zr(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Al(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&j.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new sl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:rl(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&j.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!kl(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=ml(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Vc(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=gl(n.layoutBox,e):this.constraints=!1,this.elastic=Sl(t),r!==this.constraints&&!Vc(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&$(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=bl(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Vc(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Va(n,r.root,this.visualElement.getTransformPagePoint()),a=vl(r.layout.layoutBox,i);if(t){let e=t(Ca(a));this.hasMutatedConstraints=!!e,e&&(a=Sa(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=$(o=>{if(!kl(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return zr(this.visualElement,e),n.start(wr(e,n,0,t,this.visualElement,!1))}stopAnimation(){$(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){$(t=>{let{drag:n}=this.getProps();if(!kl(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-V(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Vc(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};$(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=yl({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),$(t=>{if(!kl(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(V(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Tl.set(this.visualElement,this);let e=this.visualElement.current,t=nl(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&ki(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();Vc(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=Ol(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),j.read(r);let o=os(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&($(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=xl,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Dl(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Ol(e,t,n){let r=Zi(e,Dl(n)),i=Zi(t,Dl(n));return()=>{r(),i()}}function kl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Al(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var jl=class extends Y{constructor(e){super(e),this.removeGroupControls=C,this.removeListeners=C,this.controls=new El(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||C}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Ml=e=>(t,n)=>{e&&j.update(()=>e(t,n),!1,!0)},Nl=class extends Y{constructor(){super(...arguments),this.removePointerDownListener=C}onPointerDown(e){this.session=new sl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rl(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ml(e),onStart:Ml(t),onMove:Ml(n),onEnd:(e,t)=>{delete this.session,r&&j.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=nl(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Pl=!1,Fl=class extends u.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Pl&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),fs.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Pl=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||j.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),_i.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Pl=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Il(e){let[t,n]=tc(),r=(0,u.useContext)(d);return(0,l.jsx)(Fl,{...e,layoutGroup:r,switchLayoutGroup:(0,u.useContext)(Bc),isPresent:t,safeToRemove:n})}var Ll={pan:{Feature:Nl},drag:{Feature:jl,ProjectionNode:Ks,MeasureLayout:Il}};function Rl(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&j.postRender(()=>i(t,el(t)))}var zl=class extends Y{mount(){let{current:e}=this.node;e&&(this.unmount=Ci(e,(e,t)=>(Rl(this.node,t,`Start`),e=>Rl(this.node,e,`End`))))}unmount(){}},Bl=class extends Y{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=T(os(this.node.current,`focus`,()=>this.onFocus()),os(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Vl(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&j.postRender(()=>i(t,el(t)))}var Hl=class extends Y{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Ii(e,(e,t)=>(Vl(this.node,t,`Start`),(e,{success:t})=>Vl(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Ul=new WeakMap,Wl=new WeakMap,Gl=e=>{let t=Ul.get(e.target);t&&t(e)},Kl=e=>{e.forEach(Gl)};function ql({root:e,...t}){let n=e||document;Wl.has(n)||Wl.set(n,{});let r=Wl.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Kl,{root:e,...t})),r[i]}function Jl(e,t,n){let r=ql(t);return Ul.set(e,n),r.observe(e),()=>{Ul.delete(e),r.unobserve(e)}}var Yl={some:0,all:1},Xl=class extends Y{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Yl[r]};return Jl(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Zl(e,t))&&this.startObserver()}unmount(){}};function Zl({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Ql={inView:{Feature:Xl},tap:{Feature:Hl},focus:{Feature:Bl},hover:{Feature:zl}},$l={layout:{ProjectionNode:Ks,MeasureLayout:Il}},eu=Yc({...$c,...Ql,...Ll,...$l},Xc),tu={sm:`max-w-sm`,md:`max-w-lg`,lg:`max-w-2xl`},nu=`a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])`;function ru({open:e,onClose:t,title:n,children:r,footer:i,size:a=`md`,hideCloseButton:o=!1,ariaLabel:d}){let f=(0,u.useRef)(null),p=(0,u.useRef)(null),m=(0,u.useId)(),h=(0,u.useCallback)(e=>{if(e.key===`Escape`){t();return}if(e.key!==`Tab`||!f.current)return;let n=Array.from(f.current.querySelectorAll(nu)).filter(e=>e.offsetParent!==null);if(n.length===0){e.preventDefault(),f.current.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===f.current)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())},[t]);return(0,u.useEffect)(()=>{if(!e)return;p.current=document.activeElement,document.addEventListener(`keydown`,h);let t=requestAnimationFrame(()=>{let e=f.current;e&&(e.querySelector(nu)??e).focus()});return()=>{document.removeEventListener(`keydown`,h),cancelAnimationFrame(t),p.current?.focus?.()}},[e,h]),(0,l.jsx)(ic,{children:e&&(0,l.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,l.jsx)(eu.div,{className:`absolute inset-0 titan-menu-overlay`,onClick:t,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}}),(0,l.jsxs)(eu.div,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-labelledby":n?m:void 0,"aria-label":n?void 0:d,tabIndex:-1,className:c(`relative w-full mx-4 titan-modal-surface outline-none`,tu[a]),initial:{opacity:0,y:-16,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-16,scale:.97},transition:{duration:.2,ease:`easeOut`},children:[n&&(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3`,style:{borderBottom:`1px solid var(--theme-menu-border)`},children:[(0,l.jsx)(`h2`,{id:m,className:`text-base font-semibold`,style:{color:`var(--theme-ink)`,fontFamily:`var(--theme-font-display)`},children:n}),!o&&(0,l.jsx)(`button`,{type:`button`,onClick:t,className:`titan-close-btn`,"aria-label":`Close`,children:(0,l.jsx)(s,{size:16})})]}),(0,l.jsx)(`div`,{className:`px-4 py-4`,style:{color:`var(--theme-ink)`,fontFamily:`var(--theme-font-display)`},children:r}),i&&(0,l.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-4 py-3`,style:{borderTop:`1px solid var(--theme-menu-border)`},children:i})]})]})})}var iu={primary:`text-white shadow-sm glow-accent-hover bg-[image:var(--gradient-accent)] hover:brightness-110`,secondary:`bg-bg-tertiary text-text border border-border hover:border-border-light hover:bg-bg-secondary`,ghost:`text-text-secondary hover:text-text hover:bg-bg-tertiary`,danger:`bg-error/10 text-error border border-error/20 hover:bg-error/20`},au={sm:`px-2.5 py-1 text-xs gap-1.5 rounded-md`,md:`px-3.5 py-2 text-sm gap-2 rounded-lg`,lg:`px-5 py-2.5 text-sm gap-2 rounded-lg`},ou=(0,u.forwardRef)(({variant:e=`primary`,size:t=`md`,icon:n,loading:r,disabled:i,children:a,className:s,...u},d)=>(0,l.jsxs)(`button`,{ref:d,disabled:i||r,"aria-busy":r||void 0,className:c(`inline-flex items-center justify-center font-medium transition-all`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,`disabled:opacity-50 disabled:pointer-events-none`,iu[e],au[t],s),...u,children:[r?(0,l.jsx)(o,{size:t===`sm`?14:16,className:`animate-spin`}):n,a]}));ou.displayName=`Button`;function su({open:e,title:t,message:n,confirmLabel:r=`Confirm`,cancelLabel:i=`Cancel`,variant:a=`danger`,onConfirm:o,onCancel:s}){let[c,d]=(0,u.useState)(!1);return(0,l.jsx)(ru,{open:e,onClose:()=>!c&&s(),title:t,size:`sm`,footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ou,{variant:`ghost`,size:`sm`,onClick:s,disabled:c,children:i}),(0,l.jsx)(ou,{variant:a===`danger`?`danger`:`primary`,size:`sm`,onClick:async()=>{d(!0);try{await o()}finally{d(!1)}},loading:c,children:r})]}),children:(0,l.jsx)(`div`,{className:`text-sm text-text-secondary leading-relaxed`,children:n})})}export{ic as a,eu as i,ou as n,ru as r,su as t};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./clock-DSPgndSD.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{n as a,t as o}from"./toggle-right-BMaR-sfT.js";import{t as s}from"./trash-2-CwUv7ww1.js";import{Vn as c,a as l,it as u,jt as d}from"./index-WI-E4I3h.js";import{t as f}from"./PageHeader-CH85uoZG.js";import{t as p}from"./ConfirmDialog-6hcNjmAh.js";import{t as m}from"./EmptyState-D-Dg8B8r.js";var h=e(t(),1),g=n();function _(){let{toast:e}=l(),[t,n]=(0,h.useState)([]),[_,v]=(0,h.useState)(!0),[y,b]=(0,h.useState)(null),x=(0,h.useCallback)(async()=>{v(!0);try{let e=await d();n(e.jobs||[])}catch(t){e(`error`,`Couldn't load cron jobs — try again. (${t.message})`)}v(!1)},[e]);(0,h.useEffect)(()=>{x()},[x]);let S=async t=>{try{await c(t),await x(),e(`success`,`Cron job updated.`)}catch(t){e(`error`,`Couldn't toggle cron job — try again. (${t.message})`)}},C=async t=>{try{await u(t),await x(),e(`success`,`Cron job deleted.`)}catch(t){e(`error`,`Couldn't delete cron job — try again. (${t.message})`)}};return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(f,{title:`Cron Scheduler`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`System`},{label:`Cron`}]}),(0,g.jsx)(`div`,{className:`flex gap-2`,children:(0,g.jsxs)(`button`,{onClick:x,disabled:_,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,g.jsx)(i,{className:`w-4 h-4 ${_?`animate-spin`:``}`}),` Refresh`]})}),(0,g.jsxs)(`div`,{className:`space-y-2`,children:[!_&&t.length===0&&(0,g.jsx)(m,{icon:(0,g.jsx)(r,{className:`w-8 h-8`}),title:`No scheduled jobs yet`,description:`Cron jobs run tasks for you on a schedule — like "summarize my inbox every morning at 8". Ask TITAN in chat: "every weekday at 8am, check the news and brief me".`}),t.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center justify-between p-3 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsx)(r,{className:`w-4 h-4 text-[#6366f1]`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-sm text-[#e4e4e7]`,children:e.name}),(0,g.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[e.schedule,` • `,e.command]})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`button`,{onClick:()=>S(e.id),className:`p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46]`,children:e.enabled?(0,g.jsx)(o,{className:`w-4 h-4 text-emerald-400`}):(0,g.jsx)(a,{className:`w-4 h-4 text-[#52525b]`})}),(0,g.jsx)(`button`,{onClick:()=>b(e.id),className:`p-1.5 rounded-md bg-[#27272a] text-[#a1a1aa] hover:bg-[#3f3f46] hover:text-red-400`,children:(0,g.jsx)(s,{className:`w-3.5 h-3.5`})})]})]},e.id))]}),(0,g.jsx)(p,{open:y!==null,title:`Delete cron job?`,message:`This can't be undone.`,confirmLabel:`Delete`,onConfirm:async()=>{let e=y;b(null),e&&await C(e)},onCancel:()=>b(null)})]})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-B15e6lOy.js";var t=e();function n({columns:e,data:n,onRowClick:r,emptyMessage:i=`No data available`}){return(0,t.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-bg-secondary`,children:(0,t.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,t.jsx)(`thead`,{children:(0,t.jsx)(`tr`,{className:`bg-bg-tertiary`,children:e.map(e=>(0,t.jsx)(`th`,{className:`px-4 py-3 text-sm font-medium text-text-secondary ${e.className??``}`,children:e.header},e.key))})}),(0,t.jsx)(`tbody`,{children:n.length===0?(0,t.jsx)(`tr`,{children:(0,t.jsx)(`td`,{colSpan:e.length,className:`px-4 py-12 text-center text-text-muted`,children:i})}):n.map((n,i)=>(0,t.jsx)(`tr`,{onClick:()=>r?.(n),className:`border-t border-border transition-colors hover:bg-bg-tertiary/50 ${r?`cursor-pointer`:``}`,children:e.map(e=>(0,t.jsx)(`td`,{className:`px-4 py-3 text-text ${e.className??``}`,children:e.render?e.render(n):String(n[e.key]??``)},e.key))},i))})]})})}export{n as t};
@@ -0,0 +1,5 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./createLucideIcon-qnlrxww7.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{It as a,Wt as o,f as s,lt as c,m as l,yn as u}from"./index-WI-E4I3h.js";import{t as d}from"./PageHeader-CH85uoZG.js";var f=r(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),p=r(`moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),m=e(t(),1),h=n();function g(){let[e,t]=(0,m.useState)(null),[n,r]=(0,m.useState)([]),[g,_]=(0,m.useState)(null),[v,y]=(0,m.useState)(!0),[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(null),w=(0,m.useCallback)(async()=>{try{let e=await u(60);r(e.dates)}catch{}},[]),T=(0,m.useCallback)(async()=>{y(!0),C(null);try{let e=await o();t(e),_(e?.date??null)}catch(e){C(e.message)}y(!1)},[]),E=(0,m.useCallback)(async e=>{y(!0),C(null);try{let n=await a(e);t(n),_(e)}catch(e){C(e.message)}y(!1)},[]),D=(0,m.useCallback)(async()=>{x(!0),C(null);try{let e=await c();t(e),_(e.date),await w()}catch(e){C(e.message)}x(!1)},[w]);return(0,m.useEffect)(()=>{let e=!1;return(async()=>{y(!0),C(null);try{let n=await u(60);if(e)return;if(r(n.dates),n.dates.length===0){t(null),_(null);return}let i=await o();if(e)return;t(i),_(i?.date??null)}catch(t){e||C(t.message)}finally{e||y(!1)}})(),()=>{e=!0}},[]),(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(d,{title:`Dream Mode`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Identity`},{label:`Dreams`}]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsxs)(`button`,{onClick:T,disabled:v,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,h.jsx)(i,{className:`w-4 h-4 ${v?`animate-spin`:``}`}),` Latest`]}),(0,h.jsxs)(`button`,{onClick:D,disabled:b,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1]/20 text-[#a5b4fc] text-sm font-medium hover:bg-[#6366f1]/30 disabled:opacity-50`,title:`Run a dream cycle right now instead of waiting for the nightly cron`,children:[(0,h.jsx)(l,{className:`w-4 h-4 ${b?`animate-spin`:``}`}),` `,b?`Generating…`:`Generate now`]})]}),S&&(0,h.jsxs)(`div`,{className:`p-3 rounded-lg border border-red-900/50 bg-red-950/20 text-sm text-red-300 flex items-start gap-2`,children:[(0,h.jsx)(s,{className:`w-4 h-4 mt-0.5 shrink-0`}),(0,h.jsx)(`span`,{children:S})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[200px_1fr] gap-4`,children:[(0,h.jsxs)(`div`,{className:`space-y-1`,children:[(0,h.jsxs)(`div`,{className:`text-xs uppercase tracking-wide text-text mb-2 flex items-center gap-1`,children:[(0,h.jsx)(f,{className:`w-3 h-3`}),` History`]}),n.length===0&&(0,h.jsx)(`div`,{className:`text-xs text-text-secondary p-2`,children:`No dreams yet. Run "Generate now" or wait for the nightly cron.`}),(0,h.jsx)(`div`,{className:`space-y-1 max-h-[60vh] overflow-y-auto`,children:n.map(e=>(0,h.jsx)(`button`,{onClick:()=>E(e),className:`w-full text-left text-xs px-2 py-1.5 rounded ${g===e?`bg-[#27272a] text-[#e4e4e7]`:`text-[#a1a1aa] hover:bg-[#1a1a1f]`}`,children:e},e))})]}),(0,h.jsxs)(`div`,{className:`min-w-0`,children:[!e&&!v&&(0,h.jsxs)(`div`,{className:`p-6 text-center text-[#52525b] text-sm rounded-lg border border-[#27272a] bg-[#0a0a0f]`,children:[(0,h.jsx)(p,{className:`w-8 h-8 mx-auto mb-2 opacity-50`}),`No dream selected.`]}),e&&(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-[#52525b] flex-wrap`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(p,{className:`w-3 h-3`}),` `,e.date]}),(0,h.jsx)(`span`,{children:`•`}),(0,h.jsxs)(`span`,{children:[`model: `,(0,h.jsx)(`span`,{className:`text-[#a1a1aa]`,children:e.model})]}),(0,h.jsx)(`span`,{children:`•`}),(0,h.jsxs)(`span`,{children:[e.activity.successfulTrajectories,`/`,e.activity.trajectories,` trajectories`]}),(0,h.jsx)(`span`,{children:`•`}),(0,h.jsxs)(`span`,{children:[e.activity.toolsExercised.length,` tools`]})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[e.sectionsEmitted.map(e=>(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded bg-emerald-950/40 text-emerald-300`,children:e},e)),Object.entries(e.sectionsSkipped).map(([e,t])=>(0,h.jsxs)(`span`,{title:t,className:`text-[10px] uppercase tracking-wide px-2 py-0.5 rounded bg-[#27272a] text-[#52525b]`,children:[e,` skipped`]},e))]}),(0,h.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-2`,children:Object.entries(e.drives.delta).map(([t,n])=>{let r=e.drives.start[t]??0,i=e.drives.end[t]??0,a=n>.005?`↑`:n<-.005?`↓`:`·`,o=n>.005?`text-emerald-300`:n<-.005?`text-red-300`:`text-[#52525b]`;return(0,h.jsxs)(`div`,{className:`p-2 rounded bg-[#0a0a0f] border border-[#27272a]`,children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-[#52525b]`,children:t}),(0,h.jsxs)(`div`,{className:`text-xs text-[#a1a1aa]`,children:[r.toFixed(2),` → `,i.toFixed(2)]}),(0,h.jsxs)(`div`,{className:`text-xs font-medium ${o}`,children:[a,` `,n>=0?`+`:``,n.toFixed(3)]})]},t)})}),(0,h.jsx)(`div`,{className:`p-4 rounded-lg border border-[#27272a] bg-[#0a0a0f] prose prose-invert prose-sm max-w-none`,children:e.markdown.split(/^## /m).map((e,t)=>{if(t===0)return(0,h.jsx)(`div`,{className:`mb-4`,children:e.split(`
2
+ `).filter(e=>e.trim()).map((e,t)=>e.startsWith(`# `)?(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-[#e4e4e7] mb-1`,children:e.slice(2)},t):e.startsWith(`*`)&&e.endsWith(`*`)?(0,h.jsx)(`p`,{className:`text-xs italic text-[#52525b]`,children:e.slice(1,-1)},t):(0,h.jsx)(`p`,{className:`text-sm text-[#a1a1aa]`,children:e},t))},`head`);let n=e.indexOf(`
3
+ `),r=n>=0?e.slice(0,n):e,i=n>=0?e.slice(n+1).trim():``;return(0,h.jsxs)(`div`,{className:`mb-4`,children:[(0,h.jsx)(`h3`,{className:`text-sm font-semibold text-[#e4e4e7] mb-2`,children:r}),i.split(`
4
+
5
+ `).filter(e=>e.trim()).map((e,t)=>(0,h.jsx)(`p`,{className:`text-sm text-[#d4d4d8] leading-relaxed mb-2`,children:e},t))]},`s${t}`)})}),e.audioPath&&(0,h.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[`audio: `,(0,h.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-[#0a0a0f]`,children:e.audioPath})]})]})]})]})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-B15e6lOy.js";import{n as t}from"./ConfirmDialog-6hcNjmAh.js";var n=e();function r({icon:e,title:r,description:i,action:a,className:o}){return(0,n.jsxs)(`div`,{className:`titan-empty-state flex flex-col items-center justify-center px-6 py-14 text-center ${o??``}`,children:[e&&(0,n.jsx)(`div`,{className:`mb-4 flex h-14 w-14 items-center justify-center rounded-md border text-text-muted`,children:e}),(0,n.jsx)(`h3`,{className:`text-sm font-semibold text-text`,children:r}),i&&(0,n.jsx)(`p`,{className:`mt-2 max-w-sm text-xs leading-5 text-text-muted`,children:i}),a&&(0,n.jsx)(t,{variant:`secondary`,size:`sm`,onClick:a.onClick,className:`mt-4`,children:a.label})]})}export{r as t};
@@ -0,0 +1,2 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./chevron-right-A_pvnRh_.js";import{t as i}from"./circle-check-big-C-JUM7wb.js";import{t as a}from"./layers-BPu5SRjI.js";import{t as o}from"./play-9WxZWVHA.js";import{t as s}from"./refresh-cw-Disd5wRB.js";import{t as c}from"./trending-up-Ba9TwEow.js";import{A as l,F as u,H as d,M as f,P as p,b as m,c as h,g}from"./index-WI-E4I3h.js";var _=e(t(),1),v={"widget-creation":`Widget Creation`,safety:`Safety`,"tool-routing":`Tool Routing`,"gate-format":`Gate Format`,pipeline:`Pipeline Classification`,adversarial:`Adversarial`,"tool-routing-v2":`Tool Routing v2`,session:`Session Management`,"widget-v2":`Widget v2`,"gate-format-v2":`Gate Format v2`,content:`Content Quality`};async function y(){let e=await d(`/api/eval/suites`);if(!e.ok)throw Error(`/api/eval/suites failed: ${e.status}`);let t=await e.json();return Array.isArray(t.suites)?t.suites:[]}async function b(e){let t=await d(`/api/eval/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({suite:e})});if(!t.ok){let e=await t.text().catch(()=>``);throw Error(`/api/eval/run failed: ${t.status} ${e.slice(0,200)}`)}return t.json()}function x(e){return e.total?Math.round(e.passed/e.total*100):NaN}function S(e){return Number.isNaN(e)?`slate`:e>=100?`emerald`:e>=80?`amber`:`red`}function C(e){let t=[];for(let n of e.split(`
2
+ `)){let e=n.trim();if(!e||e.startsWith(`#`))continue;let r=e.match(/^([a-zA-Z_:][a-zA-Z0-9_:]*)(?:\{([^}]*)\})?\s+([0-9eE+\-.NaN]+)/);if(!r)continue;let i={};if(r[2])for(let e of r[2].split(`,`)){let[t,...n]=e.split(`=`);if(!t)continue;let r=n.join(`=`).trim().replace(/^"|"$/g,``);i[t.trim()]=r}let a=Number(r[3]);Number.isNaN(a)||t.push({name:r[1],labels:i,value:a})}return t}async function w(e){let t=await d(`/metrics`);if(!t.ok)throw Error(`/metrics failed: ${t.status}`);let n=C(await t.text());return e?n.filter(t=>t.name===e||t.name.startsWith(`${e}_`)):n}var T=n(),E={emerald:`bg-emerald-500/15 text-emerald-300 border-emerald-500/40`,amber:`bg-amber-500/15 text-amber-300 border-amber-500/40`,red:`bg-red-500/15 text-red-300 border-red-500/40`,slate:`bg-slate-500/15 text-slate-300 border-slate-500/40`},D=[{id:`suites`,label:`Suites`,icon:a},{id:`memory`,label:`Memory Regression`,icon:u},{id:`redteam`,label:`Red Team`,icon:g},{id:`trends`,label:`Trends`,icon:c}];function O(){let[e,t]=(0,_.useState)(`suites`),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=(0,_.useCallback)(async()=>{a(!0);try{let e=await y();r(t=>{let n=new Map(t.map(e=>[e.name,e]));return e.map(e=>n.get(e)??{name:e,status:`idle`})})}catch(e){console.error(`listEvalSuites failed:`,e),r([])}finally{a(!1)}},[]);(0,_.useEffect)(()=>{u()},[u]);let d=(0,_.useCallback)(async e=>{r(t=>t.map(t=>t.name===e?{...t,status:`running`,error:void 0}:t));try{let t=await b(e);r(n=>n.map(n=>n.name===e?{...n,status:`done`,result:t}:n))}catch(t){r(n=>n.map(n=>n.name===e?{...n,status:`error`,error:t.message}:n))}},[]),p=(0,_.useCallback)(async()=>{for(let e of n)await d(e.name)},[n,d]),h=n.reduce((e,t)=>({total:e.total+(t.result?.total??0),passed:e.passed+(t.result?.passed??0),failed:e.failed+(t.result?.failed??0)}),{total:0,passed:0,failed:0}),g=x(h),v=S(g),C=n.some(e=>e.status===`running`);return(0,T.jsxs)(`div`,{className:`flex h-full flex-col gap-4 p-4 text-slate-200`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Eval Harness`}),(0,T.jsx)(`div`,{className:`flex items-center gap-1 rounded border border-slate-700 bg-slate-800/40 p-0.5`,children:D.map(n=>{let r=n.icon;return(0,T.jsxs)(`button`,{onClick:()=>t(n.id),className:`flex items-center gap-1.5 rounded px-2.5 py-1 text-xs ${n.id===e?`bg-slate-700/80 text-slate-100`:`text-slate-400 hover:bg-slate-700/30`}`,children:[(0,T.jsx)(r,{className:`h-3 w-3`}),n.label]},n.id)})}),e===`suites`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{onClick:u,disabled:i||C,className:`rounded border border-slate-700 bg-slate-800/40 p-1.5 hover:bg-slate-800 disabled:opacity-50`,title:`Refresh suite list`,children:(0,T.jsx)(s,{className:`h-3.5 w-3.5 ${i?`animate-spin`:``}`})}),(0,T.jsxs)(`button`,{onClick:p,disabled:n.length===0||C,className:`ml-auto flex items-center gap-1.5 rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1.5 text-sm text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-50`,children:[C?(0,T.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),`Run all suites`]})]})]}),e===`suites`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border p-3 text-sm ${E[v]}`,children:[(0,T.jsxs)(`div`,{className:`font-medium`,children:[`Overall: `,h.passed,`/`,h.total,` passed`,Number.isFinite(g)&&(0,T.jsxs)(`span`,{className:`ml-2 opacity-80`,children:[`(`,g,`%)`]})]}),h.failed>0&&(0,T.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),h.failed,` failure`,h.failed===1?``:`s`]})]}),(0,T.jsxs)(`div`,{className:`flex-1 space-y-2 overflow-auto`,children:[n.length===0&&!i&&(0,T.jsxs)(`div`,{className:`rounded border border-slate-700 bg-slate-800/30 p-4 text-center text-sm text-slate-400`,children:[`No eval suites available. Verify `,(0,T.jsx)(`code`,{className:`font-mono text-xs`,children:`/api/eval/suites`}),` on the gateway.`]}),n.map(e=>(0,T.jsx)(N,{suite:e,expanded:c===e.name,onToggle:()=>l(t=>t===e.name?null:e.name),onRun:()=>d(e.name)},e.name))]})]}),e===`memory`&&(0,T.jsx)(k,{suites:n,onRun:d}),e===`redteam`&&(0,T.jsx)(j,{suites:n,onRun:d}),e===`trends`&&(0,T.jsx)(M,{})]})}function k({suites:e,onRun:t}){let n=e.flatMap(e=>(e.result?.results??[]).filter(e=>/memory|recall|stale|distract|context/i.test(e.name)).map(t=>({suite:e.name,case:t})));if(n.length===0)return(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded border border-dashed border-slate-700 bg-slate-800/20 p-8 text-center`,children:(0,T.jsxs)(`div`,{children:[(0,T.jsx)(u,{className:`mx-auto mb-2 h-6 w-6 text-slate-500`}),(0,T.jsx)(`div`,{className:`text-sm text-slate-300`,children:`No memory regression results yet.`}),(0,T.jsxs)(`div`,{className:`mt-1 text-xs text-slate-500`,children:[`Run a suite that contains memory cases (session, content). Multi-turn fact recall is asserted via tape replay in `,(0,T.jsx)(`code`,{className:`font-mono`,children:`tests/eval/memory.test.ts`}),`.`]}),(0,T.jsxs)(`div`,{className:`mt-3 flex justify-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>t(`session`),className:`rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/20`,children:`Run session suite`}),(0,T.jsx)(`button`,{onClick:()=>t(`content`),className:`rounded border border-emerald-500/40 bg-emerald-500/10 px-3 py-1 text-xs text-emerald-300 hover:bg-emerald-500/20`,children:`Run content suite`})]})]})});let r=n.filter(e=>e.case.passed).length;return(0,T.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 overflow-auto`,children:[(0,T.jsx)(`div`,{className:`rounded-lg border p-3 text-sm ${E[S(r/n.length*100)]}`,children:(0,T.jsxs)(`div`,{className:`font-medium`,children:[`Memory recall: `,r,`/`,n.length,` cases passed`,(0,T.jsxs)(`span`,{className:`ml-2 opacity-80`,children:[`(`,Math.round(r/n.length*100),`%)`]})]})}),(0,T.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>(0,T.jsxs)(`div`,{className:`rounded p-2 text-xs ${e.case.passed?`bg-slate-800/30`:`bg-red-950/30`}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.case.passed?(0,T.jsx)(i,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,T.jsx)(l,{className:`h-3.5 w-3.5 text-red-400`}),(0,T.jsx)(`div`,{className:`font-mono text-slate-200`,children:e.case.name}),(0,T.jsx)(`div`,{className:`ml-auto text-[10px] text-slate-500`,children:e.suite})]}),!e.case.passed&&e.case.errors.length>0&&(0,T.jsx)(`ul`,{className:`mt-1 ml-5 list-disc text-red-300`,children:e.case.errors.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))})]},`${e.suite}/${e.case.name}`))})]})}var A=[{id:`ignore-prev`,label:`Ignore-previous`,pattern:/ignore.*(previous|prior)|disregard|forget/i},{id:`dan`,label:`DAN / persona swap`,pattern:/\bDAN\b|do anything|jailbreak/i},{id:`prompt-extract`,label:`Prompt extraction`,pattern:/system prompt|reveal|extract|leak/i},{id:`path-traversal`,label:`Path traversal`,pattern:/\.\.\/|\/etc\/passwd|path traversal/i},{id:`shell-inject`,label:`Shell injection`,pattern:/;.*rm|`whoami`|\$\(|\| ?bash/i},{id:`url-scheme`,label:`URL scheme abuse`,pattern:/file:\/\/|dict:\/\/|gopher:\/\//i},{id:`markdown-js`,label:`Markdown JS link`,pattern:/\[.*\]\(javascript:/i},{id:`other`,label:`Other`,pattern:/.*/}];function j({suites:e,onRun:t}){let n=e.find(e=>e.name===`adversarial`)?.result?.results??[];if(n.length===0)return(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded border border-dashed border-slate-700 bg-slate-800/20 p-8 text-center`,children:(0,T.jsxs)(`div`,{children:[(0,T.jsx)(g,{className:`mx-auto mb-2 h-6 w-6 text-slate-500`}),(0,T.jsx)(`div`,{className:`text-sm text-slate-300`,children:`No red-team results yet.`}),(0,T.jsx)(`div`,{className:`mt-1 text-xs text-slate-500`,children:`Run the adversarial suite to populate this grid.`}),(0,T.jsx)(`button`,{onClick:()=>t(`adversarial`),className:`mt-3 rounded border border-red-500/40 bg-red-500/10 px-3 py-1 text-xs text-red-300 hover:bg-red-500/20`,children:`Run adversarial suite`})]})});let r=A.map(e=>{let t=n.filter(t=>e.pattern.test(t.name)||e.pattern.test(t.content||``)),r=t.filter(e=>e.passed).length;return{vector:e,total:t.length,blocked:r,matched:t}}).filter(e=>e.total>0);return(0,T.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 overflow-auto`,children:[(0,T.jsx)(`div`,{className:`text-xs text-slate-400`,children:`Pass = attack BLOCKED (TITAN refused or sanitized). Fail = attack possibly EXPLOITED — investigate the case.`}),(0,T.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>{let t=e.total>0?Math.round(e.blocked/e.total*100):0,n=S(t);return(0,T.jsxs)(`div`,{className:`rounded-lg border p-3 ${E[n]}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),e.vector.label]}),(0,T.jsxs)(`div`,{className:`mt-1 text-xs`,children:[e.blocked,`/`,e.total,` blocked (`,t,`%)`]}),(0,T.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[e.matched.slice(0,4).map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[e.passed?(0,T.jsx)(i,{className:`h-2.5 w-2.5 text-emerald-400`}):(0,T.jsx)(l,{className:`h-2.5 w-2.5 text-red-400`}),(0,T.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.name)),e.matched.length>4&&(0,T.jsxs)(`div`,{className:`text-[10px] text-slate-500`,children:[`+ `,e.matched.length-4,` more`]})]})]},e.vector.id)})})]})}function M(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,c]=(0,_.useState)(null),l=(0,_.useCallback)(async()=>{r(!0),a(null);try{let e=await w(`titan_eval`);t(e),c(new Date)}catch(e){a(e.message)}finally{r(!1)}},[]);(0,_.useEffect)(()=>{l();let e=setInterval(l,3e4);return()=>clearInterval(e)},[l]);let u=(0,_.useMemo)(()=>e.filter(e=>e.name===`titan_eval_pass_rate`&&e.labels.suite).map(e=>({suite:e.labels.suite,rate:e.value})).sort((e,t)=>e.rate-t.rate),[e]),d=(0,_.useMemo)(()=>{let t=new Map;for(let n of e){if(!n.labels.suite)continue;let e=t.get(n.labels.suite)??{passed:0,failed:0,timeouts:0,errors:0};n.name===`titan_eval_cases_total`?n.labels.outcome===`passed`?e.passed=n.value:n.labels.outcome===`failed`&&(e.failed=n.value):n.name===`titan_eval_timeout_total`?e.timeouts+=n.value:n.name===`titan_eval_error_total`&&(e.errors+=n.value),t.set(n.labels.suite,e)}return t},[e]),p=(0,_.useMemo)(()=>{let e=0,t=0;for(let n of d.values())e+=n.timeouts,t+=n.errors;return{timeouts:e,errors:t}},[d]);return(0,T.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 overflow-auto`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-slate-400`,children:[(0,T.jsxs)(`span`,{children:[`Live from `,(0,T.jsx)(`code`,{className:`font-mono`,children:`/metrics`}),` (titan_eval_* gauges + counters).`]}),(0,T.jsx)(`span`,{className:`ml-auto`,children:o?`updated ${o.toLocaleTimeString()}`:``}),(0,T.jsx)(`button`,{onClick:l,disabled:n,className:`rounded border border-slate-700 bg-slate-800/40 p-1 hover:bg-slate-800 disabled:opacity-50`,children:(0,T.jsx)(s,{className:`h-3 w-3 ${n?`animate-spin`:``}`})})]}),(p.timeouts>0||p.errors>0)&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-amber-500/40 bg-amber-500/10 p-2 text-xs text-amber-300`,children:[(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),(0,T.jsx)(`span`,{className:`font-medium`,children:`Operational drift:`}),p.timeouts>0&&(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`strong`,{children:p.timeouts}),` timeout`,p.timeouts===1?``:`s`]}),p.errors>0&&(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`strong`,{children:p.errors}),` error`,p.errors===1?``:`s`]}),(0,T.jsx)(`span`,{className:`ml-auto opacity-70`,children:`across all suites, lifetime totals from /metrics`})]}),i&&(0,T.jsx)(`div`,{className:`rounded border border-red-500/40 bg-red-500/10 p-2 text-xs text-red-300`,children:i}),u.length===0&&!i&&(0,T.jsxs)(`div`,{className:`rounded border border-dashed border-slate-700 bg-slate-800/20 p-6 text-center text-sm text-slate-400`,children:[`No eval pass-rate metrics yet. Run a suite via the Suites tab to populate `,(0,T.jsx)(`code`,{className:`font-mono`,children:`titan_eval_pass_rate`}),`.`]}),(0,T.jsx)(`div`,{className:`space-y-1.5`,children:u.map(({suite:e,rate:t})=>{let n=d.get(e),r=S(t),i=v[e]??e;return(0,T.jsx)(`div`,{className:`rounded border p-2 text-xs ${E[r]}`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`w-32 truncate font-medium text-slate-200`,children:i}),(0,T.jsx)(`div`,{className:`relative h-4 flex-1 overflow-hidden rounded bg-slate-800/60`,children:(0,T.jsx)(`div`,{className:`h-full ${r===`emerald`?`bg-emerald-500/60`:r===`amber`?`bg-amber-500/60`:r===`red`?`bg-red-500/60`:`bg-slate-500/60`}`,style:{width:`${t/100*100}%`}})}),(0,T.jsxs)(`div`,{className:`w-16 text-right font-mono`,children:[t,`%`]}),n&&(0,T.jsxs)(`div`,{className:`w-44 text-right text-[10px] text-slate-500`,children:[n.passed,`/`,n.passed+n.failed,` ever`,n.timeouts>0&&(0,T.jsxs)(`span`,{className:`ml-1 text-amber-400`,children:[`· `,n.timeouts,` timeout`,n.timeouts===1?``:`s`]}),n.errors>0&&(0,T.jsxs)(`span`,{className:`ml-1 text-red-400`,children:[`· `,n.errors,` error`,n.errors===1?``:`s`]})]})]})},e)})})]})}function N({suite:e,expanded:t,onToggle:n,onRun:i}){let a=v[e.name]??e.name,s=e.result?x(e.result):NaN,c=S(s);return(0,T.jsxs)(`div`,{className:`rounded-lg border ${E[c]}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(`button`,{onClick:n,disabled:!e.result,className:`text-slate-300 disabled:opacity-30`,"aria-label":t?`Collapse`:`Expand`,children:t?(0,T.jsx)(p,{className:`h-4 w-4`}):(0,T.jsx)(r,{className:`h-4 w-4`})}),(0,T.jsx)(`div`,{className:`font-medium text-slate-100`,children:a}),(0,T.jsx)(`div`,{className:`text-xs text-slate-400`,children:e.result?`${e.result.passed}/${e.result.total} (${s}%)`:e.status===`running`?`running…`:e.status===`error`?`error: ${e.error}`:`idle`}),e.result?.durationMs!==void 0&&(0,T.jsxs)(`div`,{className:`text-xs text-slate-500`,children:[(e.result.durationMs/1e3).toFixed(1),`s`]}),(0,T.jsxs)(`button`,{onClick:i,disabled:e.status===`running`,className:`ml-auto flex items-center gap-1 rounded border border-slate-600 bg-slate-800/60 px-2 py-1 text-xs text-slate-200 hover:bg-slate-800 disabled:opacity-50`,children:[e.status===`running`?(0,T.jsx)(m,{className:`h-3 w-3 animate-spin`}):(0,T.jsx)(o,{className:`h-3 w-3`}),`Run`]})]}),t&&e.result&&(0,T.jsx)(`div`,{className:`space-y-1.5 border-t border-slate-700/40 px-3 py-2`,children:e.result.results.map(e=>(0,T.jsx)(P,{caseResult:e},e.name))})]})}function P({caseResult:e}){let t=e.expectedToolSequence!==void 0&&JSON.stringify(e.expectedToolSequence)!==JSON.stringify(e.toolsUsed);return(0,T.jsxs)(`div`,{className:`rounded p-2 text-xs ${e.passed?`bg-slate-800/30`:`bg-red-950/30`}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.passed?(0,T.jsx)(i,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,T.jsx)(l,{className:`h-3.5 w-3.5 text-red-400`}),(0,T.jsx)(`div`,{className:`font-mono text-slate-200`,children:e.name}),(0,T.jsxs)(`div`,{className:`ml-auto text-slate-500`,children:[e.durationMs,`ms`]})]}),!e.passed&&e.errors.length>0&&(0,T.jsx)(`ul`,{className:`mt-1 ml-5 list-disc text-red-300`,children:e.errors.map((e,t)=>(0,T.jsx)(`li`,{children:e},t))}),t&&(0,T.jsxs)(`div`,{className:`mt-2 ml-5 grid grid-cols-2 gap-2 rounded bg-slate-900/40 p-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-center gap-1 text-slate-400`,children:[(0,T.jsx)(h,{className:`h-3 w-3`}),` expected`]}),(e.expectedToolSequence??[]).map((e,t)=>(0,T.jsxs)(`div`,{className:`font-mono text-emerald-300`,children:[t+1,`. `,e]},t))]}),(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-center gap-1 text-slate-400`,children:[(0,T.jsx)(h,{className:`h-3 w-3`}),` actual`]}),e.toolsUsed.length===0&&(0,T.jsx)(`div`,{className:`italic text-slate-500`,children:`(no tool calls)`}),e.toolsUsed.map((t,n)=>(0,T.jsxs)(`div`,{className:`font-mono ${e.expectedToolSequence?.[n]===t?`text-emerald-300`:`text-red-300`}`,children:[n+1,`. `,t]},n))]})]})]})}export{O as default};
@@ -0,0 +1 @@
1
+ import{c as e,n as t,t as n}from"./jsx-runtime-B15e6lOy.js";import{t as r}from"./play-9WxZWVHA.js";import{t as i}from"./refresh-cw-Disd5wRB.js";import{Bt as a,M as o,Pn as s,Rt as c,a as l,dn as u,f as d}from"./index-WI-E4I3h.js";import{t as f}from"./PageHeader-CH85uoZG.js";var p=e(t(),1),m=n();function h(){let{toast:e}=l(),[t,n]=(0,p.useState)(null),[h,g]=(0,p.useState)([]),[_,v]=(0,p.useState)([]),[y,b]=(0,p.useState)(!0),[x,S]=(0,p.useState)(!1),C=(0,p.useCallback)(async()=>{b(!0);try{let[e,t,r]=await Promise.all([u(),c(),a()]);n(e),g(t.tests||[]),v(r.tests||[])}catch(t){e(`error`,`Couldn't load test health — try again. (${t.message})`)}b(!1)},[e]);return(0,p.useEffect)(()=>{C()},[C]),(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsx)(f,{title:`Test Lab`,breadcrumbs:[{label:`Admin`,href:`/overview`},{label:`Quality`},{label:`Tests`}]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsxs)(`button`,{onClick:C,disabled:y,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#27272a] text-[#a1a1aa] text-sm font-medium hover:bg-[#3f3f46] disabled:opacity-50`,children:[(0,m.jsx)(i,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),` Refresh`]}),(0,m.jsxs)(`button`,{onClick:async()=>{S(!0);try{await s(),await C(),e(`success`,`Test run started.`)}catch(t){e(`error`,`Couldn't run tests — try again. (${t.message})`)}S(!1)},disabled:x,className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-[#6366f1] text-white text-sm font-medium hover:bg-[#4f46e5] disabled:opacity-50`,children:[(0,m.jsx)(r,{className:`w-4 h-4`}),` `,x?`Running...`:`Run Tests`]})]}),t&&(0,m.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Total`}),(0,m.jsx)(`div`,{className:`text-sm font-semibold text-[#e4e4e7]`,children:t.total})]}),(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Passing`}),(0,m.jsx)(`div`,{className:`text-sm font-semibold text-emerald-400`,children:t.passing})]}),(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Failing`}),(0,m.jsx)(`div`,{className:`text-sm font-semibold text-red-400`,children:t.failing})]}),(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-[#0a0a0f] border border-[#27272a]`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#52525b]`,children:`Flaky`}),(0,m.jsx)(`div`,{className:`text-sm font-semibold text-amber-400`,children:t.flaky})]})]}),h.length>0&&(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium text-[#e4e4e7] flex items-center gap-2`,children:[(0,m.jsx)(o,{className:`w-4 h-4 text-red-400`}),` Failing Tests`]}),h.map(e=>(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-red-950/20 border border-red-900/50`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#e4e4e7]`,children:e.name}),(0,m.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[e.suite,` • `,e.error.slice(0,60)]})]},e.name))]}),_.length>0&&(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium text-[#e4e4e7] flex items-center gap-2`,children:[(0,m.jsx)(d,{className:`w-4 h-4 text-amber-400`}),` Flaky Tests`]}),_.map(e=>(0,m.jsxs)(`div`,{className:`p-2 rounded-lg bg-amber-950/20 border border-amber-900/50`,children:[(0,m.jsx)(`div`,{className:`text-xs text-[#e4e4e7]`,children:e.name}),(0,m.jsxs)(`div`,{className:`text-xs text-[#52525b]`,children:[e.suite,` • `,e.passRate.toFixed(1),`% pass rate`]})]},e.name))]})]})}export{h as default};