@hotmeshio/long-tail 0.4.11 → 0.4.12

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 (147) hide show
  1. package/dashboard/dist/assets/{AdminDashboard-Z32TwYm9.js → AdminDashboard-B7AFFt4L.js} +2 -2
  2. package/dashboard/dist/assets/{AdminDashboard-Z32TwYm9.js.map → AdminDashboard-B7AFFt4L.js.map} +1 -1
  3. package/dashboard/dist/assets/{AgentConfigPage-uedbi7zT.js → AgentConfigPage-CjuCbr5J.js} +2 -2
  4. package/dashboard/dist/assets/{AgentConfigPage-uedbi7zT.js.map → AgentConfigPage-CjuCbr5J.js.map} +1 -1
  5. package/dashboard/dist/assets/{AgentDetailPage-rRQtJQIE.js → AgentDetailPage-DnHaUCS5.js} +2 -2
  6. package/dashboard/dist/assets/{AgentDetailPage-rRQtJQIE.js.map → AgentDetailPage-DnHaUCS5.js.map} +1 -1
  7. package/dashboard/dist/assets/{AgentsPage-w9zOW2GX.js → AgentsPage-BR2-PdTq.js} +2 -2
  8. package/dashboard/dist/assets/{AgentsPage-w9zOW2GX.js.map → AgentsPage-BR2-PdTq.js.map} +1 -1
  9. package/dashboard/dist/assets/{AvailableEscalationsPage-DZ4ut6rj.js → AvailableEscalationsPage-CEkeo_N4.js} +2 -2
  10. package/dashboard/dist/assets/{AvailableEscalationsPage-DZ4ut6rj.js.map → AvailableEscalationsPage-CEkeo_N4.js.map} +1 -1
  11. package/dashboard/dist/assets/{BotPicker-BW3DEEsk.js → BotPicker-CAowL3ib.js} +2 -2
  12. package/dashboard/dist/assets/{BotPicker-BW3DEEsk.js.map → BotPicker-CAowL3ib.js.map} +1 -1
  13. package/dashboard/dist/assets/{CapabilitiesPage-y7fFEpue.js → CapabilitiesPage-CSUKBvEN.js} +2 -2
  14. package/dashboard/dist/assets/{CapabilitiesPage-y7fFEpue.js.map → CapabilitiesPage-CSUKBvEN.js.map} +1 -1
  15. package/dashboard/dist/assets/{CollapsibleSection-BqCrlb0a.js → CollapsibleSection-Bv6ixURp.js} +2 -2
  16. package/dashboard/dist/assets/{CollapsibleSection-BqCrlb0a.js.map → CollapsibleSection-Bv6ixURp.js.map} +1 -1
  17. package/dashboard/dist/assets/{CredentialsPage-jr9En3Wc.js → CredentialsPage-CdPKxRBj.js} +2 -2
  18. package/dashboard/dist/assets/{CredentialsPage-jr9En3Wc.js.map → CredentialsPage-CdPKxRBj.js.map} +1 -1
  19. package/dashboard/dist/assets/{CronLabel-CcPaepiQ.js → CronLabel-BtdXRDqs.js} +2 -2
  20. package/dashboard/dist/assets/{CronLabel-CcPaepiQ.js.map → CronLabel-BtdXRDqs.js.map} +1 -1
  21. package/dashboard/dist/assets/{CustomDurationPicker-CPkebwlV.js → CustomDurationPicker-Mq3SLUuv.js} +2 -2
  22. package/dashboard/dist/assets/{CustomDurationPicker-CPkebwlV.js.map → CustomDurationPicker-Mq3SLUuv.js.map} +1 -1
  23. package/dashboard/dist/assets/{ElapsedCell-BjL_EpqA.js → ElapsedCell-DOTqB4ZX.js} +2 -2
  24. package/dashboard/dist/assets/{ElapsedCell-BjL_EpqA.js.map → ElapsedCell-DOTqB4ZX.js.map} +1 -1
  25. package/dashboard/dist/assets/{EscalationsOverview-DyFZKf53.js → EscalationsOverview-DSM8Mnb-.js} +2 -2
  26. package/dashboard/dist/assets/{EscalationsOverview-DyFZKf53.js.map → EscalationsOverview-DSM8Mnb-.js.map} +1 -1
  27. package/dashboard/dist/assets/{EventTable-BFTY1gJh.js → EventTable-C-HagWbs.js} +2 -2
  28. package/dashboard/dist/assets/{EventTable-BFTY1gJh.js.map → EventTable-C-HagWbs.js.map} +1 -1
  29. package/dashboard/dist/assets/{HomePage-DtCV15bZ.js → HomePage-BkMEYnRK.js} +2 -2
  30. package/dashboard/dist/assets/{HomePage-DtCV15bZ.js.map → HomePage-BkMEYnRK.js.map} +1 -1
  31. package/dashboard/dist/assets/{ListToolbar-BEWIH8y8.js → ListToolbar-o8xSCSVv.js} +2 -2
  32. package/dashboard/dist/assets/{ListToolbar-BEWIH8y8.js.map → ListToolbar-o8xSCSVv.js.map} +1 -1
  33. package/dashboard/dist/assets/{McpOverview-CAC72Qkp.js → McpOverview-C4man2br.js} +2 -2
  34. package/dashboard/dist/assets/{McpOverview-CAC72Qkp.js.map → McpOverview-C4man2br.js.map} +1 -1
  35. package/dashboard/dist/assets/{McpQueryDetailPage-Cs5SwLE8.js → McpQueryDetailPage-UR0bySPJ.js} +2 -2
  36. package/dashboard/dist/assets/{McpQueryDetailPage-Cs5SwLE8.js.map → McpQueryDetailPage-UR0bySPJ.js.map} +1 -1
  37. package/dashboard/dist/assets/{McpQueryPage-CbzTE3lo.js → McpQueryPage-C-mzOcGH.js} +2 -2
  38. package/dashboard/dist/assets/{McpQueryPage-CbzTE3lo.js.map → McpQueryPage-C-mzOcGH.js.map} +1 -1
  39. package/dashboard/dist/assets/{McpRunDetailPage-BJKdHgWh.js → McpRunDetailPage-bJl08JSG.js} +2 -2
  40. package/dashboard/dist/assets/{McpRunDetailPage-BJKdHgWh.js.map → McpRunDetailPage-bJl08JSG.js.map} +1 -1
  41. package/dashboard/dist/assets/{McpRunsPage-BVt_3aJW.js → McpRunsPage-i2FGJ6yf.js} +2 -2
  42. package/dashboard/dist/assets/{McpRunsPage-BVt_3aJW.js.map → McpRunsPage-i2FGJ6yf.js.map} +1 -1
  43. package/dashboard/dist/assets/{OperatorDashboard-B8dwVFC4.js → OperatorDashboard-DLpqyLle.js} +2 -2
  44. package/dashboard/dist/assets/{OperatorDashboard-B8dwVFC4.js.map → OperatorDashboard-DLpqyLle.js.map} +1 -1
  45. package/dashboard/dist/assets/{ProcessDetailPage-DBun2ogu.js → ProcessDetailPage-8cJEBC_E.js} +2 -2
  46. package/dashboard/dist/assets/{ProcessDetailPage-DBun2ogu.js.map → ProcessDetailPage-8cJEBC_E.js.map} +1 -1
  47. package/dashboard/dist/assets/{ProcessesListPage-TDjac8Lk.js → ProcessesListPage-CiprI5Wj.js} +2 -2
  48. package/dashboard/dist/assets/{ProcessesListPage-TDjac8Lk.js.map → ProcessesListPage-CiprI5Wj.js.map} +1 -1
  49. package/dashboard/dist/assets/{RolesPage-NkVRnqrM.js → RolesPage-xo6AgPym.js} +2 -2
  50. package/dashboard/dist/assets/{RolesPage-NkVRnqrM.js.map → RolesPage-xo6AgPym.js.map} +1 -1
  51. package/dashboard/dist/assets/{RunAsSelector-DRMoYomI.js → RunAsSelector-DPXWgduq.js} +2 -2
  52. package/dashboard/dist/assets/{RunAsSelector-DRMoYomI.js.map → RunAsSelector-DPXWgduq.js.map} +1 -1
  53. package/dashboard/dist/assets/{SwimlaneTimeline-DsPrsDBU.js → SwimlaneTimeline-BzG8QxYs.js} +2 -2
  54. package/dashboard/dist/assets/{SwimlaneTimeline-DsPrsDBU.js.map → SwimlaneTimeline-BzG8QxYs.js.map} +1 -1
  55. package/dashboard/dist/assets/{TaskDetailPage-CZPxCOgP.js → TaskDetailPage-Ck_0-iO2.js} +2 -2
  56. package/dashboard/dist/assets/{TaskDetailPage-CZPxCOgP.js.map → TaskDetailPage-Ck_0-iO2.js.map} +1 -1
  57. package/dashboard/dist/assets/{TasksListPage-BYC4Mbx8.js → TasksListPage-DtR4F0ho.js} +2 -2
  58. package/dashboard/dist/assets/{TasksListPage-BYC4Mbx8.js.map → TasksListPage-DtR4F0ho.js.map} +1 -1
  59. package/dashboard/dist/assets/{TimeAgo-C3j486uV.js → TimeAgo-BLNstYO1.js} +2 -2
  60. package/dashboard/dist/assets/{TimeAgo-C3j486uV.js.map → TimeAgo-BLNstYO1.js.map} +1 -1
  61. package/dashboard/dist/assets/{TimestampCell-DoBoqZGS.js → TimestampCell-DxIz3l1J.js} +2 -2
  62. package/dashboard/dist/assets/{TimestampCell-DoBoqZGS.js.map → TimestampCell-DxIz3l1J.js.map} +1 -1
  63. package/dashboard/dist/assets/{ToolTestPanel-CoB5Ybz3.js → ToolTestPanel-AVDlqGQI.js} +2 -2
  64. package/dashboard/dist/assets/{ToolTestPanel-CoB5Ybz3.js.map → ToolTestPanel-AVDlqGQI.js.map} +1 -1
  65. package/dashboard/dist/assets/{TopicDetailPage-Bl6daecJ.js → TopicDetailPage-DQkoAlsj.js} +2 -2
  66. package/dashboard/dist/assets/{TopicDetailPage-Bl6daecJ.js.map → TopicDetailPage-DQkoAlsj.js.map} +1 -1
  67. package/dashboard/dist/assets/{TopicsPage-CTU8fi_i.js → TopicsPage-BdnJ7E_S.js} +2 -2
  68. package/dashboard/dist/assets/{TopicsPage-CTU8fi_i.js.map → TopicsPage-BdnJ7E_S.js.map} +1 -1
  69. package/dashboard/dist/assets/{UserName-16nVz3Sw.js → UserName-Bk-pzKYb.js} +2 -2
  70. package/dashboard/dist/assets/{UserName-16nVz3Sw.js.map → UserName-Bk-pzKYb.js.map} +1 -1
  71. package/dashboard/dist/assets/{WorkflowExecutionPage-RYeTXRHH.js → WorkflowExecutionPage-B6mBqWq6.js} +2 -2
  72. package/dashboard/dist/assets/{WorkflowExecutionPage-RYeTXRHH.js.map → WorkflowExecutionPage-B6mBqWq6.js.map} +1 -1
  73. package/dashboard/dist/assets/{WorkflowsDashboard-B8tyWMBl.js → WorkflowsDashboard-nXLTR0OO.js} +2 -2
  74. package/dashboard/dist/assets/{WorkflowsDashboard-B8tyWMBl.js.map → WorkflowsDashboard-nXLTR0OO.js.map} +1 -1
  75. package/dashboard/dist/assets/{WorkflowsOverview-Bd7eUOlY.js → WorkflowsOverview-BdSHBzzd.js} +2 -2
  76. package/dashboard/dist/assets/{WorkflowsOverview-Bd7eUOlY.js.map → WorkflowsOverview-BdSHBzzd.js.map} +1 -1
  77. package/dashboard/dist/assets/{YamlWorkflowsPage-CISGkpSa.js → YamlWorkflowsPage-BsO4L_SW.js} +2 -2
  78. package/dashboard/dist/assets/{YamlWorkflowsPage-CISGkpSa.js.map → YamlWorkflowsPage-BsO4L_SW.js.map} +1 -1
  79. package/dashboard/dist/assets/{agents-DdrWb9IA.js → agents-CtF0uBav.js} +2 -2
  80. package/dashboard/dist/assets/{agents-DdrWb9IA.js.map → agents-CtF0uBav.js.map} +1 -1
  81. package/dashboard/dist/assets/{bots-DNEC8CB_.js → bots-DOP_eck8.js} +2 -2
  82. package/dashboard/dist/assets/{bots-DNEC8CB_.js.map → bots-DOP_eck8.js.map} +1 -1
  83. package/dashboard/dist/assets/{capabilities-x0lc5Qr5.js → capabilities-DvxG02aF.js} +2 -2
  84. package/dashboard/dist/assets/{capabilities-x0lc5Qr5.js.map → capabilities-DvxG02aF.js.map} +1 -1
  85. package/dashboard/dist/assets/{controlplane-BKtGwxSj.js → controlplane-Dmq81vAY.js} +2 -2
  86. package/dashboard/dist/assets/{controlplane-BKtGwxSj.js.map → controlplane-Dmq81vAY.js.map} +1 -1
  87. package/dashboard/dist/assets/{escalation-Cp3QJCTq.js → escalation-BP3UWfIe.js} +2 -2
  88. package/dashboard/dist/assets/{escalation-Cp3QJCTq.js.map → escalation-BP3UWfIe.js.map} +1 -1
  89. package/dashboard/dist/assets/{escalation-columns-_wkDseNt.js → escalation-columns-BayccZzU.js} +2 -2
  90. package/dashboard/dist/assets/{escalation-columns-_wkDseNt.js.map → escalation-columns-BayccZzU.js.map} +1 -1
  91. package/dashboard/dist/assets/{helpers-Bkhi987m.js → helpers-B_PYr0pL.js} +2 -2
  92. package/dashboard/dist/assets/{helpers-Bkhi987m.js.map → helpers-B_PYr0pL.js.map} +1 -1
  93. package/dashboard/dist/assets/{index-DB_zkstT.js → index-B3wGNZN2.js} +2 -2
  94. package/dashboard/dist/assets/{index-DB_zkstT.js.map → index-B3wGNZN2.js.map} +1 -1
  95. package/dashboard/dist/assets/{index-CmEmMw8h.js → index-B80zLZVl.js} +2 -2
  96. package/dashboard/dist/assets/{index-CmEmMw8h.js.map → index-B80zLZVl.js.map} +1 -1
  97. package/dashboard/dist/assets/{index-x7kIRS2q.js → index-Bb1ycul8.js} +2 -2
  98. package/dashboard/dist/assets/{index-x7kIRS2q.js.map → index-Bb1ycul8.js.map} +1 -1
  99. package/dashboard/dist/assets/{index-CGy9PrdX.js → index-BnB7G5bA.js} +16 -16
  100. package/dashboard/dist/assets/index-BnB7G5bA.js.map +1 -0
  101. package/dashboard/dist/assets/{index-BhPDvjQ6.js → index-BnVnJcXw.js} +2 -2
  102. package/dashboard/dist/assets/{index-BhPDvjQ6.js.map → index-BnVnJcXw.js.map} +1 -1
  103. package/dashboard/dist/assets/{index-D6EMWmS-.js → index-Bv0eLXZq.js} +2 -2
  104. package/dashboard/dist/assets/{index-D6EMWmS-.js.map → index-Bv0eLXZq.js.map} +1 -1
  105. package/dashboard/dist/assets/{index-BOnE32zg.js → index-CkcPZdQm.js} +2 -2
  106. package/dashboard/dist/assets/{index-BOnE32zg.js.map → index-CkcPZdQm.js.map} +1 -1
  107. package/dashboard/dist/assets/{index-zK7nCOfQ.js → index-CsagXf3M.js} +2 -2
  108. package/dashboard/dist/assets/{index-zK7nCOfQ.js.map → index-CsagXf3M.js.map} +1 -1
  109. package/dashboard/dist/assets/{index-CVv6Hs0J.js → index-DQs-LMoa.js} +2 -2
  110. package/dashboard/dist/assets/{index-CVv6Hs0J.js.map → index-DQs-LMoa.js.map} +1 -1
  111. package/dashboard/dist/assets/{index-cUV1o7mj.js → index-Do1x4kN0.js} +2 -2
  112. package/dashboard/dist/assets/{index-cUV1o7mj.js.map → index-Do1x4kN0.js.map} +1 -1
  113. package/dashboard/dist/assets/{index-CTl3ROOo.js → index-DzQBDt3K.js} +2 -2
  114. package/dashboard/dist/assets/{index-CTl3ROOo.js.map → index-DzQBDt3K.js.map} +1 -1
  115. package/dashboard/dist/assets/{index-rQpU8PEa.js → index-EqKHsaVz.js} +2 -2
  116. package/dashboard/dist/assets/{index-rQpU8PEa.js.map → index-EqKHsaVz.js.map} +1 -1
  117. package/dashboard/dist/assets/{index-Dig8_eMS.js → index-ox042ec_.js} +2 -2
  118. package/dashboard/dist/assets/{index-Dig8_eMS.js.map → index-ox042ec_.js.map} +1 -1
  119. package/dashboard/dist/assets/{knowledge-BDr9CzZ7.js → knowledge--SApApck.js} +2 -2
  120. package/dashboard/dist/assets/{knowledge-BDr9CzZ7.js.map → knowledge--SApApck.js.map} +1 -1
  121. package/dashboard/dist/assets/{mcp-CCWQrZNk.js → mcp-dn9iPrzm.js} +2 -2
  122. package/dashboard/dist/assets/{mcp-CCWQrZNk.js.map → mcp-dn9iPrzm.js.map} +1 -1
  123. package/dashboard/dist/assets/{mcp-query-DYy5Xha0.js → mcp-query-CgiU2UR6.js} +2 -2
  124. package/dashboard/dist/assets/{mcp-query-DYy5Xha0.js.map → mcp-query-CgiU2UR6.js.map} +1 -1
  125. package/dashboard/dist/assets/{mcp-runs-DIh5XCg1.js → mcp-runs-BN5MrKai.js} +2 -2
  126. package/dashboard/dist/assets/{mcp-runs-DIh5XCg1.js.map → mcp-runs-BN5MrKai.js.map} +1 -1
  127. package/dashboard/dist/assets/{namespaces-CAaahBQS.js → namespaces-D93H3wFO.js} +2 -2
  128. package/dashboard/dist/assets/{namespaces-CAaahBQS.js.map → namespaces-D93H3wFO.js.map} +1 -1
  129. package/dashboard/dist/assets/{roles-DIjyTYc4.js → roles-DuOWZTpx.js} +2 -2
  130. package/dashboard/dist/assets/{roles-DIjyTYc4.js.map → roles-DuOWZTpx.js.map} +1 -1
  131. package/dashboard/dist/assets/{tasks-DiBPwT-p.js → tasks-DoCbLKz4.js} +2 -2
  132. package/dashboard/dist/assets/{tasks-DiBPwT-p.js.map → tasks-DoCbLKz4.js.map} +1 -1
  133. package/dashboard/dist/assets/{topics-CDjGhp4t.js → topics-CS7Sxf_-.js} +2 -2
  134. package/dashboard/dist/assets/{topics-CDjGhp4t.js.map → topics-CS7Sxf_-.js.map} +1 -1
  135. package/dashboard/dist/assets/{useEventHooks-BXzvSJIr.js → useEventHooks-CrIe_Ulh.js} +2 -2
  136. package/dashboard/dist/assets/{useEventHooks-BXzvSJIr.js.map → useEventHooks-CrIe_Ulh.js.map} +1 -1
  137. package/dashboard/dist/assets/{useYamlActivityEvents-CAkKAAX5.js → useYamlActivityEvents-JzvzGsUR.js} +2 -2
  138. package/dashboard/dist/assets/{useYamlActivityEvents-CAkKAAX5.js.map → useYamlActivityEvents-JzvzGsUR.js.map} +1 -1
  139. package/dashboard/dist/assets/{users-DmkMv9Hc.js → users-DnxSh2dX.js} +2 -2
  140. package/dashboard/dist/assets/{users-DmkMv9Hc.js.map → users-DnxSh2dX.js.map} +1 -1
  141. package/dashboard/dist/assets/{workflows-Bwikzl2q.js → workflows-zFmmxc08.js} +2 -2
  142. package/dashboard/dist/assets/{workflows-Bwikzl2q.js.map → workflows-zFmmxc08.js.map} +1 -1
  143. package/dashboard/dist/assets/{yaml-workflows--YR7XQ5F.js → yaml-workflows-VSax0tKa.js} +2 -2
  144. package/dashboard/dist/assets/{yaml-workflows--YR7XQ5F.js.map → yaml-workflows-VSax0tKa.js.map} +1 -1
  145. package/dashboard/dist/index.html +1 -1
  146. package/package.json +1 -1
  147. package/dashboard/dist/assets/index-CGy9PrdX.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as Ne}from"./PageHeaderWithStats-DQmNXYcG.js";import{F as ve,b as Ce}from"./FilterBar-Ck4K4rzu.js";import{u as Se}from"./useFilterParams-x-Dg0Vgz.js";import{u as te,a as se,b as $e,c as _e,d as Te}from"./controlplane-BKtGwxSj.js";import{M as Ee}from"./Modal-CSrxpXeM.js";import{K as Z,ao as U,P as Re,ap as Y,aq as J,o as ne,I as Me,A as Pe,a5 as Ae,R as Le,S as We,ar as Qe,E as Fe,Z as Oe,as as Ie}from"./vendor-icons-5gSix3t2.js";import{C as z}from"./CollapsibleSection-BqCrlb0a.js";import{T as Be}from"./TaskQueuePill-BSFLiBcf.js";import{D as ze}from"./DataTable-D9yuBv0w.js";import{C as W,c as Je,J as De}from"./index-CGy9PrdX.js";import{R as Ue,a as X}from"./RowActions-Dg-Fsm5O.js";import{f as Ve}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";const qe=[{label:"15m",value:"15m"},{label:"30m",value:"30m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"7d",value:"7d"}],re={pong:"text-status-success",ping:"text-accent",throttle:"text-status-warning",job:"text-purple-400",work:"text-text-secondary",activate:"text-status-error",cron:"text-text-tertiary",user:"text-text-secondary"},He={pong:"roll call",ping:"ping",throttle:"throttle",job:"job",work:"work",activate:"activate",cron:"cron",user:"user"},Ke=250;function A(t){return!!t.worker_topic}function L(t){return typeof t.throttle=="number"&&t.throttle!==0}function V(t){return t===void 0||t===0?"Normal":t===-1?"Paused":t>=864e5?`${(t/864e5).toFixed(0)}d`:t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}function Ge(t){if(!t)return null;const s=t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d+)$/);if(s){const[,r,n,a,d,l,g,c]=s;return new Date(`${r}-${n}-${a}T${d}:${l}:${g}.${c}Z`)}const o=new Date(t);return isNaN(o.getTime())?null:o}function Ze(t){const s=Ge(t);if(!s)return"--";const o=Date.now()-s.getTime();if(o<0||isNaN(o))return"--";const r=Math.floor(o/1e3);if(r<60)return`${r}s`;const n=Math.floor(r/60);if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}h ${n%60}m`:`${Math.floor(a/24)}d ${a%24}h`}function ae(t){return t.replace(/^hmsh:[^:]+:x:/,"")||"(engine)"}function F(t){const s=t.match(/^([^:]+)::(.+?)-[A-Za-z0-9_]{10,}$/);return s?s[2]:t.length>20?t.slice(0,20)+"...":t}function Ye(t){const s=t.match(/^([^:]+)::/);return(s==null?void 0:s[1])||""}const oe=[{key:"pong",label:"Roll Call",description:"Node health check responses"},{key:"ping",label:"Ping",description:"Health check broadcasts"},{key:"throttle",label:"Throttle",description:"Throttle commands"},{key:"job",label:"Job",description:"Job lifecycle events"},{key:"work",label:"Work",description:"Worker dispatch events"},{key:"activate",label:"Activate",description:"Worker activation"},{key:"cron",label:"Cron",description:"Cron schedule triggers"},{key:"user",label:"User",description:"User-defined messages"}];function O(t){return`${t.engine_id}-${t.worker_topic||"engine"}`}function Xe(t){const s=new Map;for(const o of t){if(!o.worker_topic)continue;const r=o.worker_topic;s.has(r)||s.set(r,[]),s.get(r).push(o)}return s}function R(t){let s=0,o=0,r=0;for(const n of t)if(n.counts)for(const[a,d]of Object.entries(n.counts))s+=d,a==="200"?o+=d:a==="500"&&(r+=d);return{total:s,success:o,errors:r}}function et(t){let s=0;for(const o of t)typeof o.stream_depth=="number"&&(s+=o.stream_depth);return s}function tt(t){if(t.length===0)return"healthy";if(t.every(r=>r.throttle===-1))return"paused";const{errors:o}=R(t);return o>0||t.some(L)?"degraded":"healthy"}function st({activeAppId:t,allProfiles:s,profiles:o}){const r=te(),[n,a]=i.useState(new Set),[d,l]=i.useState(!1),[g,c]=i.useState([]);i.useEffect(()=>{a(new Set)},[t]);const w=i.useCallback(p=>{a(S=>{const b=new Set(S),$=O(p);return b.has($)?b.delete($):b.add($),b})},[]),f=i.useCallback(()=>{n.size===o.length?a(new Set):a(new Set(o.map(O)))},[o,n.size]),y=i.useMemo(()=>{const p=o.filter(N=>n.has(O(N)));if(p.length===0)return[];if(p.length===s.length)return[{label:"Entire Mesh"}];const S=p.filter(N=>!A(N)),b=p.filter(A),$=[];for(const N of S)$.push({label:`Engine ${N.engine_id}`,guid:N.engine_id,scope:"engines"});const M=new Map;for(const N of b){const T=N.worker_topic;M.has(T)||M.set(T,[]),M.get(T).push(N)}for(const[N,T]of M){const I=s.filter(P=>P.worker_topic===N);if(T.length===I.length)$.push({label:N,topic:N});else for(const P of T)$.push({label:`${N} ${P.engine_id}`,guid:P.engine_id})}return $},[o,s,n]);return{selectedIds:n,setSelectedIds:a,toggleCheckbox:w,toggleAll:f,throttleModalOpen:d,throttleTargets:g,selectedThrottleTargets:y,throttleMutation:r,handleBulkThrottle:p=>{const S=g.length>0?g:y;for(const b of S)r.mutate({appId:t,throttle:p,...b.topic?{topic:b.topic}:{},...b.guid?{guid:b.guid}:{},...b.scope?{scope:b.scope}:{}});l(!1),c([])},handleRowClick:(p,S)=>{const b=A(p)?`${p.worker_topic} ${p.engine_id}`:`Engine ${p.engine_id}`;c([{label:b,guid:p.engine_id,scope:S||(A(p)?"workers":"engines")}]),l(!0)},handleBulkThrottleOpen:()=>{c(y),l(!0)},handleResumeThrottle:(p,S)=>{const b=S||(A(p)?"workers":"engines");r.mutate({appId:t,throttle:0,guid:p.engine_id,scope:b})},handleResumeQueue:p=>{r.mutate({appId:t,throttle:0,topic:p})},handleQueueThrottle:p=>{c([{label:p,topic:p}]),l(!0)},closeThrottleModal:()=>{l(!1),c([])}}}const nt=[{label:"Resume",ms:0},{label:"0.5s",ms:500},{label:"1s",ms:1e3},{label:"5s",ms:5e3},{label:"30s",ms:3e4},{label:"Pause",ms:-1}];function rt({target:t}){const s=t.label==="Entire Mesh",o=t.label==="All Engines"||t.label.startsWith("Engine "),r=s?"bg-status-error/10 text-status-error":o?"bg-blue-500/10 text-blue-500":"bg-accent/[0.06] text-text-secondary",n=t.scope==="engines"?"engine only":t.scope==="workers"?"worker only":t.guid?"guid":t.topic?"topic":"mesh";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[10px] font-medium rounded-lg ${r}`,children:[t.label,e.jsx("span",{className:"text-[8px] opacity-50",children:n})]})}function at({open:t,onClose:s,targets:o,onApply:r,isPending:n}){const[a,d]=i.useState("");return e.jsx(Ee,{open:t,onClose:s,title:"Adjust Throttle",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Targets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map((l,g)=>e.jsx(rt,{target:l},l.guid||l.topic||g))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:nt.map(l=>e.jsx("button",{onClick:()=>r(l.ms),disabled:n,className:`px-3 py-1.5 text-xs rounded transition-colors ${l.ms===-1?"bg-status-error/10 text-status-error hover:bg-status-error/20":l.ms===0?"bg-status-success/10 text-status-success hover:bg-status-success/20":"bg-surface-sunken text-text-secondary hover:bg-surface-hover"} disabled:opacity-50`,children:l.label},l.label))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Custom delay (seconds)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"number",step:"0.1",min:"0",value:a,onChange:l=>d(l.target.value),placeholder:"e.g. 2.5",className:"input text-xs py-1.5 px-3 w-28"}),e.jsx("button",{onClick:()=>{const l=parseFloat(a);isNaN(l)||l<0||r(Math.round(l*1e3))},disabled:n,className:"btn-primary text-xs py-1.5 px-4 disabled:opacity-50",children:"Apply"})]})]})]})})}function ot(){const{data:t}=se(),s=te(),[o,r]=i.useState(null),[n,a]=i.useState(!1),d=(t==null?void 0:t.apps)??[],l=i.useCallback(async(c,w="all")=>{if(d.length===0)return;a(!0);const f=await Promise.allSettled(d.map(k=>s.mutateAsync({appId:k.appId,throttle:c,...w!=="all"?{scope:w}:{}}))),y=f.filter(k=>k.status==="rejected").length;y>0&&console.error(`Emergency throttle: ${y}/${f.length} apps failed`),a(!1),r(null)},[d,s]),g=c=>c==="engines"?"engines":c==="workers"?"workers":"everything";return o?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-status-error",children:["Pause ",g(o.scope),"?"]}),e.jsx("button",{onClick:()=>l(o.ms,o.scope),disabled:n,className:"px-2.5 py-1 text-xs rounded-md bg-status-error text-white hover:bg-status-error/90 transition-colors disabled:opacity-50",children:n?e.jsx(Z,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm"}),e.jsx("button",{onClick:()=>r(null),disabled:n,className:"px-2.5 py-1 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>r({ms:-1,scope:"all"}),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-error/80 hover:text-status-error hover:bg-status-error/10 transition-colors disabled:opacity-50",title:"Pause all engines and workers",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Pause All"]}),e.jsxs("button",{onClick:()=>l(0),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-success/80 hover:text-status-success hover:bg-status-success/10 transition-colors disabled:opacity-50",title:"Resume all engines and workers",children:[n?e.jsx(Z,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Re,{className:"w-3.5 h-3.5"}),"Resume All"]})]})}function lt({byStream:t,onNodeFilter:s}){const[o,r]=i.useState(!1);if(i.useEffect(()=>{r(!1);const c=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(c)},[t]),t.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary py-4 text-center",children:"No activity in this period"});const n=t.filter(c=>c.stream_type==="engine"),a=t.filter(c=>c.stream_type==="worker"),d=Math.max(...t.map(c=>c.count)),l=c=>{const w=d>0?c.count/d*100:0,f=c.stream_type==="engine",y=f?"(all engines)":ae(c.stream_name),k=f?"bg-blue-500/70":"bg-accent/60",C=f?"text-blue-500":"text-text-tertiary";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-[9px] font-mono ${C} w-36 truncate text-right shrink-0`,title:c.stream_name,children:y}),e.jsx("div",{className:"flex-1 h-4 bg-surface-sunken rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${k} rounded transition-all duration-500 ease-out`,style:{width:o?`${w}%`:"0%"}})}),e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-secondary w-12 text-right shrink-0",children:c.count.toLocaleString()})]},`${c.stream_type}-${c.stream_name}`)},g="text-[9px] uppercase tracking-widest font-semibold mb-1 cursor-pointer hover:underline";return e.jsxs("div",{className:"space-y-1.5",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${g} text-blue-500/70 hover:text-blue-500`,onClick:()=>s==null?void 0:s("engines"),children:"Engine Stream"}),n.map(l),a.length>0&&e.jsx("div",{className:"h-2"})]}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${g} text-accent/70 hover:text-accent`,onClick:()=>s==null?void 0:s("workers"),children:"Worker Streams"}),a.map(l)]})]})}function it({queue:t,workers:s,expanded:o,onToggle:r,onWorkerClick:n,onResumeThrottle:a,onQueueThrottle:d,onResumeQueue:l,byStream:g,activeDuration:c}){const w=i.useMemo(()=>{const u=g.find(m=>m.stream_type==="worker"&&ae(m.stream_name)===t);return(u==null?void 0:u.count)??0},[g,t]),f=i.useMemo(()=>tt(s),[s]),y=i.useMemo(()=>et(s),[s]),{errors:k}=i.useMemo(()=>R(s),[s]),C=f==="paused"?"bg-status-error":f==="degraded"?"bg-status-warning":"bg-status-success",x=i.useMemo(()=>[...s].sort((u,m)=>R([m]).total-R([u]).total),[s]),j=i.useMemo(()=>[{key:"engine_id",label:"Router",render:u=>{var p;const m=u.engine_id.replace(/^[^:]+::/,"").replace(/-[A-Za-z0-9_]{10,}$/,"")||u.engine_id,_=((p=u.engine_id.match(/^([^:]+)::/))==null?void 0:p[1])||"";return e.jsxs("div",{className:"flex items-center gap-2",title:u.engine_id,children:[e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[180px]",children:m}),_&&e.jsx("span",{className:"text-[9px] text-text-tertiary/50",children:_})]})}},{key:"processed",label:"Processed",render:u=>{const m=R([u]);return e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-tertiary",children:m.total>0?m.total.toLocaleString():"--"})},className:"w-24"},{key:"throttle",label:"Throttle",render:u=>{const m=u.throttle;return m===-1?e.jsx("span",{className:"text-xs text-status-error font-medium",children:"Paused"}):m&&m>0?e.jsx("span",{className:"text-xs text-status-warning font-medium",children:V(m)}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"0"})},className:"w-24"},{key:"actions",label:"",render:u=>e.jsxs(Ue,{children:[L(u)&&e.jsx(X,{icon:Y,title:"Resume (remove throttle)",onClick:()=>a(u),colorClass:"text-text-tertiary hover:text-status-success"}),e.jsx(X,{icon:J,title:"Adjust throttle",onClick:()=>n(u)})]}),className:"w-16"}],[n,a]);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(t),className:"group/row relative flex items-center gap-3 w-full py-2 hover:bg-surface-hover transition-colors text-left rounded",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${C}`,title:f}),e.jsx(ne,{className:`w-3.5 h-3.5 text-text-tertiary/50 transition-transform duration-200 ${o?"rotate-90":""}`,strokeWidth:2}),e.jsx(Be,{queue:t,size:"sm"}),e.jsx("span",{className:"flex-1"}),k>0&&e.jsxs("span",{className:"text-[10px] text-status-error font-medium mr-2",children:[k," errors"]}),y>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-status-warning w-20",children:[e.jsx(Me,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:y.toLocaleString()})]}),e.jsxs("span",{className:`flex items-center gap-1 text-xs w-24 ${s.some(L)?"text-status-warning":"text-text-tertiary"}`,children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:s.length}),e.jsx("span",{children:"workers"})]}),e.jsx("span",{className:"flex items-center gap-1 text-xs font-mono text-text-tertiary w-28 justify-end mr-16",children:w>0?e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),w.toLocaleString()," in ",c]}):e.jsx("span",{className:"text-text-tertiary/40",children:"—"})}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/row:opacity-100 transition-opacity flex items-center gap-2",children:[s.some(L)&&e.jsx(Y,{className:"w-4 h-4 text-text-tertiary hover:text-status-success",strokeWidth:1.5,onClick:u=>{u.stopPropagation(),l(t)}}),e.jsx(J,{className:"w-4 h-4 text-text-tertiary hover:text-accent",strokeWidth:1.5,onClick:u=>{u.stopPropagation(),d(t)}})]})]}),e.jsx(W,{open:o,children:e.jsx("div",{className:"ml-6",children:e.jsx(ze,{columns:j,data:x,keyFn:O,onRowClick:n,emptyMessage:"No workers",inline:!0})})})]})}let ct=0;function dt(t){const s=t.data||{},o=s.topic?String(s.topic):"",r=s.guid?String(s.guid).slice(0,8):"";switch(t.type){case"pong":return o?`Worker ${r}... on "${o}" responded`:`Engine ${r}... responded`;case"ping":return"Roll call broadcast";case"throttle":{const n=s.throttle,a=o?`queue "${o}"`:r?`node ${r}...`:"all nodes";return`${V(n)} applied to ${a}`}case"job":return`Job ${r?r+"...":""} ${s.status||"updated"}`;case"work":return`Dispatched to "${o||"worker"}" ${r?"("+r+"...)":""}`;case"activate":return`Worker "${o||"unknown"}" activated`;case"cron":return`Cron triggered ${o?'"'+o+'"':""}`;default:return o||r||t.type}}function ut(t){const s=[];let o=0;for(;o<t.length;){const r=t[o];if(r.type==="pong"){let n=o+1;for(;n<t.length&&t[n].type==="pong";)n++;const a=t.slice(o,n);if(a.length>=3)s.push({kind:"group",type:"pong",count:a.length,firstTimestamp:a[a.length-1].timestamp,lastTimestamp:a[0].timestamp,events:a});else for(const d of a)s.push({kind:"single",event:d});o=n}else s.push({kind:"single",event:r}),o++}return s}function le({event:t}){const[s,o]=i.useState(!1);return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${re[t.type]||"text-text-tertiary"} bg-surface-sunken whitespace-nowrap shrink-0`,children:He[t.type]||t.type}),e.jsx("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:dt(t)}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"pb-2",children:e.jsx(De,{data:t.data})})})]})}function xt({group:t}){const[s,o]=i.useState(!1),r=t.events.filter(a=>{var d;return!((d=a.data)!=null&&d.topic)}).length,n=t.count-r;return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.lastTimestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${re.pong} bg-surface-sunken whitespace-nowrap shrink-0`,children:"roll call"}),e.jsxs("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:[t.count," nodes responded",r>0&&n>0?` (${r} engine${r!==1?"s":""}, ${n} worker${n!==1?"s":""})`:r>0?` (${r} engine${r!==1?"s":""})`:` (${n} worker${n!==1?"s":""})`]}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"ml-4",children:t.events.map(a=>e.jsx(le,{event:a},a.id))})})]})}function pt({channels:t,onToggle:s,customFilter:o,onCustomFilterChange:r}){return e.jsxs("div",{className:"space-y-3 pb-3 border-b border-surface-border mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Channels"}),e.jsx("p",{className:"text-[9px] text-text-tertiary",children:"Unchecked channels are dropped before buffering"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1",children:oe.map(n=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-0.5",children:[e.jsx("input",{type:"checkbox",checked:t.has(n.key),onChange:()=>s(n.key),className:"w-3 h-3 rounded border-border accent-accent"}),e.jsx("span",{className:"text-[10px] text-text-secondary",title:n.description,children:n.label})]},n.key))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Text Filter"}),e.jsx("input",{type:"text",value:o,onChange:n=>r(n.target.value),placeholder:"pong",className:"input text-[10px] font-mono py-1 px-2 w-full"}),e.jsxs("p",{className:"text-[9px] text-text-tertiary mt-1",children:["Filter by event type, e.g. ",e.jsx("span",{className:"font-mono",children:"pong"}),", ",e.jsx("span",{className:"font-mono",children:"throttle"}),", or any text in the event data."]})]})]})}function ht({bridgeActive:t}){const[s,o]=i.useState(!1),[r,n]=i.useState(!1),[a,d]=i.useState([]),[l,g]=i.useState(()=>new Set(oe.map(x=>x.key))),[c,w]=i.useState(""),f=i.useRef(l);i.useEffect(()=>{f.current=l},[l]);const y=i.useRef(c);i.useEffect(()=>{y.current=c},[c]);const k=x=>{g(j=>{const u=new Set(j);return u.has(x)?u.delete(x):u.add(x),u})};Je("lt.events.mesh.>",i.useCallback(x=>{var m;const j=((m=x.type)==null?void 0:m.replace("mesh.",""))||"unknown";if(!f.current.has(j))return;const u=y.current;u&&!`${j} ${JSON.stringify(x.data||x)}`.toLowerCase().includes(u.toLowerCase())||d(_=>[{id:++ct,type:j,timestamp:x.timestamp||new Date().toISOString(),data:x.data||x},..._].slice(0,Ke))},[]));const C=()=>d([]);return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] sticky top-14 self-start max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),e.jsx(Le,{className:`w-3 h-3 ${t?"text-status-success animate-pulse":"text-text-tertiary"}`}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:t?"Live":"..."}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{o(x=>!x),n(!1)},className:`p-1 rounded transition-colors ${s?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"Configure channels",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{n(x=>!x),o(!1)},className:`p-1 rounded transition-colors ${r?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"View raw JSON",children:e.jsx(Qe,{className:"w-3.5 h-3.5"})}),a.length>0&&e.jsx("button",{onClick:C,className:"p-1 rounded text-text-tertiary hover:text-text-primary transition-colors",title:"Clear events",children:e.jsx(Fe,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(W,{open:s,children:e.jsx(pt,{channels:l,onToggle:k,customFilter:c,onCustomFilterChange:w})}),e.jsx(W,{open:r,children:e.jsx("div",{className:"pb-3 border-b border-surface-border mb-3",children:e.jsx("pre",{className:"text-[9px] font-mono text-text-tertiary bg-surface-sunken rounded-lg p-3 max-h-[50vh] overflow-auto whitespace-pre-wrap",children:JSON.stringify(a.slice(0,50),null,2)})})}),a.length>0&&e.jsxs("p",{className:"text-[9px] text-text-tertiary mb-2",children:[a.length," events"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary py-6 text-center",children:t?"Waiting for events...":"Subscribing..."}):ut(a).map((x,j)=>x.kind==="group"?e.jsx(xt,{group:x},`grp-${j}`):e.jsx(le,{event:x.event},x.event.id))})]})}function mt(t){const s=[],o=[],r=[];for(const n of t)L(n)?r.push(n):n.is_scout||R([n]).total>0?s.push(n):o.push(n);return s.sort((n,a)=>n.is_scout&&!a.is_scout?-1:!n.is_scout&&a.is_scout?1:R([a]).total-R([n]).total),o.sort((n,a)=>F(n.engine_id).localeCompare(F(a.engine_id))),r.sort((n,a)=>F(n.engine_id).localeCompare(F(a.engine_id))),{active:s,idle:o,paused:r}}function D({engine:t,isFirst:s,onThrottle:o}){const r=F(t.engine_id),n=Ye(t.engine_id),a=R([t]),d=t.stream_depth??0,l=L(t);return e.jsxs("div",{className:"group/row flex items-center gap-3 py-2 hover:bg-surface-hover/50 transition-colors rounded px-1",children:[l?e.jsx(U,{className:"w-3.5 h-3.5 text-status-warning shrink-0",strokeWidth:1.5}):e.jsx(Oe,{className:`w-3.5 h-3.5 shrink-0 ${a.total>0||t.is_scout?"text-status-success":"text-text-tertiary/30"}`,strokeWidth:1.5}),e.jsx("span",{className:`${s?"text-base font-medium":"text-xs"} text-text-primary truncate max-w-[180px]`,title:t.engine_id,children:r}),n&&e.jsx("span",{className:"text-[10px] text-text-tertiary/50",children:n}),t.is_scout&&e.jsx("span",{className:"text-[9px] text-amber-500 uppercase tracking-widest",children:"scout"}),e.jsx("span",{className:"flex-1"}),l&&e.jsx("span",{className:"text-[10px] text-status-warning",children:t.throttle===-1?"Paused":V(t.throttle)}),a.total>0&&e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-tertiary w-16 text-right",children:a.total.toLocaleString()}),d>0&&e.jsxs("span",{className:`text-[10px] font-mono tabular-nums w-14 text-right ${d>100?"text-status-warning":"text-text-tertiary/50"}`,children:[d.toLocaleString()," q"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary/40 w-12 text-right",children:Ze(t.inited)}),e.jsx("span",{className:"opacity-0 group-hover/row:opacity-100 transition-opacity",children:e.jsx("button",{onClick:g=>{g.stopPropagation(),o(t)},className:"text-text-tertiary hover:text-accent transition-colors",title:l?"Resume / adjust throttle":"Pause / throttle",children:e.jsx(J,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function ee({label:t,engines:s,onThrottle:o}){const[r,n]=i.useState(!1);return s.length===0?null:e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1.5 text-[10px] text-text-tertiary hover:text-text-secondary transition-colors py-1",children:[e.jsx(ne,{className:`w-3 h-3 transition-transform duration-200 ${r?"rotate-90":""}`,strokeWidth:2}),s.length," ",t]}),e.jsx(W,{open:r,children:e.jsx("div",{className:"ml-1",children:s.map(a=>e.jsx(D,{engine:a,onThrottle:o},a.engine_id))})})]})}function gt({engines:t,onThrottle:s,isLoading:o}){const{active:r,idle:n,paused:a}=i.useMemo(()=>mt(t),[t]);return o?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering engines..."}):t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No engines found."}):r.length===0&&n.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(U,{className:"w-4 h-4 text-status-error shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-base text-status-error font-medium",children:["All ",t.length," engines paused"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary ml-7",children:"Messages are accumulating. Resume at least one engine to restore processing."}),e.jsx("div",{className:"ml-1 mt-2",children:a.map(d=>e.jsx(D,{engine:d,onThrottle:s},d.engine_id))})]}):e.jsxs("div",{children:[r.map((d,l)=>e.jsx(D,{engine:d,isFirst:l===0,onThrottle:s},d.engine_id)),e.jsx(ee,{label:"idle",engines:n,onThrottle:s}),e.jsx(ee,{label:"paused",engines:a,onThrottle:s})]})}function ft({collapsed:t,toggleSection:s,activeDuration:o,streamStats:r,isLoading:n,queueMap:a,expandedQueues:d,toggleQueue:l,allQueuesExpanded:g,toggleAllQueues:c,handleRowClick:w,handleResumeThrottle:f,handleQueueThrottle:y,handleResumeQueue:k,engines:C,bridgeActive:x}){return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-12 mt-10",children:[e.jsx(z,{title:`Message Volume (${o})`,sectionKey:"volume",isCollapsed:!!t.volume,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(lt,{byStream:(r==null?void 0:r.byStream)??[],onNodeFilter:()=>{},onQueueFilter:()=>{}})}),e.jsx(z,{title:`Engine Routers (${C.length})`,sectionKey:"engines",isCollapsed:!!t.engines,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(gt,{engines:C,onThrottle:w,isLoading:n})}),e.jsx(z,{title:"Worker Routers",sectionKey:"queues",isCollapsed:!!t.queues,onToggle:s,contentClassName:"mt-4 ml-7 flex flex-col gap-0",children:n?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering mesh nodes..."}):a.size===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:'No worker routers found. Click "Roll Call" to discover.'}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("button",{onClick:c,className:"text-[10px] text-accent hover:underline",children:g?"Collapse all":"Expand all"})}),[...a.entries()].sort(([j],[u])=>j.localeCompare(u)).map(([j,u])=>e.jsx(it,{queue:j,workers:u,expanded:d.has(j),onToggle:l,onWorkerClick:w,onResumeThrottle:f,onQueueThrottle:y,onResumeQueue:k,byStream:(r==null?void 0:r.byStream)??[],activeDuration:o},j))]})})]}),e.jsx(ht,{bridgeActive:x})]})}function Mt(){var K;const{data:t}=se(),s=(t==null?void 0:t.apps)??[],{filters:o,setFilter:r}=Se({filters:{app_id:"",duration:"1h"}}),n=((K=s[0])==null?void 0:K.appId)??"durable",a=o.app_id||n,d=o.duration||"1h",l=$e(),g=6e4,{data:c,isLoading:w,error:f,refetch:y,isFetching:k}=_e(a,g),{data:C}=Te(a,d,void 0,g),x=i.useMemo(()=>[...(c==null?void 0:c.profiles)??[]].sort((v,E)=>{const B=v.worker_topic||v.stream||"",Q=E.worker_topic||E.stream||"";return!v.worker_topic&&E.worker_topic?-1:v.worker_topic&&!E.worker_topic?1:B.localeCompare(Q)}),[c==null?void 0:c.profiles]),j=i.useMemo(()=>x.filter(h=>!A(h)),[x]),u=i.useMemo(()=>x.filter(A),[x]),m=i.useMemo(()=>Xe(x),[x]),_=x.filter(L).length,p=i.useMemo(()=>{const h=new Set(s.map(v=>v.appId));return a&&h.add(a),[...h].sort().map(v=>({value:v,label:v}))},[s,a]),[S]=Ve(),b=S.get("queue"),[$,M]=i.useState(()=>b?new Set([b]):new Set),N=i.useCallback(h=>{M(v=>{const E=v.has(h),B=E?new Set:new Set([h]),Q=new URLSearchParams(window.location.search);E?Q.delete("queue"):Q.set("queue",h);const G=Q.toString();return window.history.pushState(null,"",G?`?${G}`:window.location.pathname),B})},[]),T=m.size>0&&[...m.keys()].every(h=>$.has(h)),I=i.useCallback(()=>{M(T?new Set:new Set(m.keys()))},[T,m]),P="lt:controlplane:collapsed",[ie,ce]=i.useState(()=>{try{const h=JSON.parse(localStorage.getItem(P)||"{}");return b&&(h.queues=!1),h}catch{return{}}}),de=i.useCallback(h=>{ce(v=>{const E={...v,[h]:!v[h]};return localStorage.setItem(P,JSON.stringify(E)),E})},[]),{throttleModalOpen:ue,throttleTargets:q,selectedThrottleTargets:xe,throttleMutation:pe,handleBulkThrottle:he,handleRowClick:me,handleResumeThrottle:ge,handleResumeQueue:fe,handleQueueThrottle:be,closeThrottleModal:je}=st({activeAppId:a,allProfiles:x,profiles:x}),ye=i.useMemo(()=>{const h=[{label:"Engines",value:j.length,dotClass:"bg-blue-500"},{label:"Workers",value:u.length,dotClass:"bg-text-secondary"},{label:"Topics",value:m.size}];return _>0&&h.push({label:"Throttled",value:_,dotClass:"bg-status-warning"}),h},[j.length,u.length,m.size,_]),[H,we]=i.useState(!1),ke=i.useCallback(()=>{l.mutate({appId:a},{onSuccess:()=>we(!0)})},[a,l]);return i.useEffect(()=>{!H&&a&&ke()},[a]),e.jsxs("div",{children:[e.jsx(Ne,{title:"Routers",docsHash:"#docs:dashboard.md:task-queues",stats:ye,actions:e.jsx(ot,{})}),e.jsxs(ve,{actions:e.jsx("div",{className:"flex items-center gap-1",children:qe.map(h=>e.jsx("button",{onClick:()=>r("duration",h.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${d===h.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.label},h.value))}),children:[e.jsx(Ce,{label:"Application",value:o.app_id,onChange:h=>r("app_id",h),options:p}),e.jsxs("button",{onClick:()=>y(),disabled:k,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:[e.jsx(Ie,{className:`w-3.5 h-3.5 ${k?"animate-spin":""}`}),"Roll Call"]})]}),f&&e.jsx("div",{className:"mb-6 px-4 py-3 rounded bg-status-error/10 border border-status-error/20",children:e.jsx("p",{className:"text-xs text-status-error font-medium",children:f.message==="Session expired"?"Session expired — please log in again.":`Failed to load mesh data: ${f.message}`})}),e.jsx(ft,{collapsed:ie,toggleSection:de,activeDuration:d,streamStats:C,isLoading:w,queueMap:m,expandedQueues:$,toggleQueue:N,allQueuesExpanded:T,toggleAllQueues:I,handleRowClick:me,handleResumeThrottle:ge,handleQueueThrottle:be,handleResumeQueue:fe,engines:j,bridgeActive:H}),e.jsx(at,{open:ue,onClose:je,targets:q.length>0?q:xe,onApply:he,isPending:pe.isPending})]})}export{Mt as ControlPlanePage};
2
- //# sourceMappingURL=index-cUV1o7mj.js.map
1
+ import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as Ne}from"./PageHeaderWithStats-DQmNXYcG.js";import{F as ve,b as Ce}from"./FilterBar-Ck4K4rzu.js";import{u as Se}from"./useFilterParams-x-Dg0Vgz.js";import{u as te,a as se,b as $e,c as _e,d as Te}from"./controlplane-Dmq81vAY.js";import{M as Ee}from"./Modal-CSrxpXeM.js";import{K as Z,ao as U,P as Re,ap as Y,aq as J,o as ne,I as Me,A as Pe,a5 as Ae,R as Le,S as We,ar as Qe,E as Fe,Z as Oe,as as Ie}from"./vendor-icons-5gSix3t2.js";import{C as z}from"./CollapsibleSection-Bv6ixURp.js";import{T as Be}from"./TaskQueuePill-BSFLiBcf.js";import{D as ze}from"./DataTable-D9yuBv0w.js";import{C as W,c as Je,J as De}from"./index-BnB7G5bA.js";import{R as Ue,a as X}from"./RowActions-Dg-Fsm5O.js";import{f as Ve}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";const qe=[{label:"15m",value:"15m"},{label:"30m",value:"30m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"7d",value:"7d"}],re={pong:"text-status-success",ping:"text-accent",throttle:"text-status-warning",job:"text-purple-400",work:"text-text-secondary",activate:"text-status-error",cron:"text-text-tertiary",user:"text-text-secondary"},He={pong:"roll call",ping:"ping",throttle:"throttle",job:"job",work:"work",activate:"activate",cron:"cron",user:"user"},Ke=250;function A(t){return!!t.worker_topic}function L(t){return typeof t.throttle=="number"&&t.throttle!==0}function V(t){return t===void 0||t===0?"Normal":t===-1?"Paused":t>=864e5?`${(t/864e5).toFixed(0)}d`:t>=36e5?`${(t/36e5).toFixed(1)}h`:t>=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${t}ms`}function Ge(t){if(!t)return null;const s=t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})\.(\d+)$/);if(s){const[,r,n,a,d,l,g,c]=s;return new Date(`${r}-${n}-${a}T${d}:${l}:${g}.${c}Z`)}const o=new Date(t);return isNaN(o.getTime())?null:o}function Ze(t){const s=Ge(t);if(!s)return"--";const o=Date.now()-s.getTime();if(o<0||isNaN(o))return"--";const r=Math.floor(o/1e3);if(r<60)return`${r}s`;const n=Math.floor(r/60);if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}h ${n%60}m`:`${Math.floor(a/24)}d ${a%24}h`}function ae(t){return t.replace(/^hmsh:[^:]+:x:/,"")||"(engine)"}function F(t){const s=t.match(/^([^:]+)::(.+?)-[A-Za-z0-9_]{10,}$/);return s?s[2]:t.length>20?t.slice(0,20)+"...":t}function Ye(t){const s=t.match(/^([^:]+)::/);return(s==null?void 0:s[1])||""}const oe=[{key:"pong",label:"Roll Call",description:"Node health check responses"},{key:"ping",label:"Ping",description:"Health check broadcasts"},{key:"throttle",label:"Throttle",description:"Throttle commands"},{key:"job",label:"Job",description:"Job lifecycle events"},{key:"work",label:"Work",description:"Worker dispatch events"},{key:"activate",label:"Activate",description:"Worker activation"},{key:"cron",label:"Cron",description:"Cron schedule triggers"},{key:"user",label:"User",description:"User-defined messages"}];function O(t){return`${t.engine_id}-${t.worker_topic||"engine"}`}function Xe(t){const s=new Map;for(const o of t){if(!o.worker_topic)continue;const r=o.worker_topic;s.has(r)||s.set(r,[]),s.get(r).push(o)}return s}function R(t){let s=0,o=0,r=0;for(const n of t)if(n.counts)for(const[a,d]of Object.entries(n.counts))s+=d,a==="200"?o+=d:a==="500"&&(r+=d);return{total:s,success:o,errors:r}}function et(t){let s=0;for(const o of t)typeof o.stream_depth=="number"&&(s+=o.stream_depth);return s}function tt(t){if(t.length===0)return"healthy";if(t.every(r=>r.throttle===-1))return"paused";const{errors:o}=R(t);return o>0||t.some(L)?"degraded":"healthy"}function st({activeAppId:t,allProfiles:s,profiles:o}){const r=te(),[n,a]=i.useState(new Set),[d,l]=i.useState(!1),[g,c]=i.useState([]);i.useEffect(()=>{a(new Set)},[t]);const w=i.useCallback(p=>{a(S=>{const b=new Set(S),$=O(p);return b.has($)?b.delete($):b.add($),b})},[]),f=i.useCallback(()=>{n.size===o.length?a(new Set):a(new Set(o.map(O)))},[o,n.size]),y=i.useMemo(()=>{const p=o.filter(N=>n.has(O(N)));if(p.length===0)return[];if(p.length===s.length)return[{label:"Entire Mesh"}];const S=p.filter(N=>!A(N)),b=p.filter(A),$=[];for(const N of S)$.push({label:`Engine ${N.engine_id}`,guid:N.engine_id,scope:"engines"});const M=new Map;for(const N of b){const T=N.worker_topic;M.has(T)||M.set(T,[]),M.get(T).push(N)}for(const[N,T]of M){const I=s.filter(P=>P.worker_topic===N);if(T.length===I.length)$.push({label:N,topic:N});else for(const P of T)$.push({label:`${N} ${P.engine_id}`,guid:P.engine_id})}return $},[o,s,n]);return{selectedIds:n,setSelectedIds:a,toggleCheckbox:w,toggleAll:f,throttleModalOpen:d,throttleTargets:g,selectedThrottleTargets:y,throttleMutation:r,handleBulkThrottle:p=>{const S=g.length>0?g:y;for(const b of S)r.mutate({appId:t,throttle:p,...b.topic?{topic:b.topic}:{},...b.guid?{guid:b.guid}:{},...b.scope?{scope:b.scope}:{}});l(!1),c([])},handleRowClick:(p,S)=>{const b=A(p)?`${p.worker_topic} ${p.engine_id}`:`Engine ${p.engine_id}`;c([{label:b,guid:p.engine_id,scope:S||(A(p)?"workers":"engines")}]),l(!0)},handleBulkThrottleOpen:()=>{c(y),l(!0)},handleResumeThrottle:(p,S)=>{const b=S||(A(p)?"workers":"engines");r.mutate({appId:t,throttle:0,guid:p.engine_id,scope:b})},handleResumeQueue:p=>{r.mutate({appId:t,throttle:0,topic:p})},handleQueueThrottle:p=>{c([{label:p,topic:p}]),l(!0)},closeThrottleModal:()=>{l(!1),c([])}}}const nt=[{label:"Resume",ms:0},{label:"0.5s",ms:500},{label:"1s",ms:1e3},{label:"5s",ms:5e3},{label:"30s",ms:3e4},{label:"Pause",ms:-1}];function rt({target:t}){const s=t.label==="Entire Mesh",o=t.label==="All Engines"||t.label.startsWith("Engine "),r=s?"bg-status-error/10 text-status-error":o?"bg-blue-500/10 text-blue-500":"bg-accent/[0.06] text-text-secondary",n=t.scope==="engines"?"engine only":t.scope==="workers"?"worker only":t.guid?"guid":t.topic?"topic":"mesh";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[10px] font-medium rounded-lg ${r}`,children:[t.label,e.jsx("span",{className:"text-[8px] opacity-50",children:n})]})}function at({open:t,onClose:s,targets:o,onApply:r,isPending:n}){const[a,d]=i.useState("");return e.jsx(Ee,{open:t,onClose:s,title:"Adjust Throttle",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Targets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map((l,g)=>e.jsx(rt,{target:l},l.guid||l.topic||g))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:nt.map(l=>e.jsx("button",{onClick:()=>r(l.ms),disabled:n,className:`px-3 py-1.5 text-xs rounded transition-colors ${l.ms===-1?"bg-status-error/10 text-status-error hover:bg-status-error/20":l.ms===0?"bg-status-success/10 text-status-success hover:bg-status-success/20":"bg-surface-sunken text-text-secondary hover:bg-surface-hover"} disabled:opacity-50`,children:l.label},l.label))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Custom delay (seconds)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"number",step:"0.1",min:"0",value:a,onChange:l=>d(l.target.value),placeholder:"e.g. 2.5",className:"input text-xs py-1.5 px-3 w-28"}),e.jsx("button",{onClick:()=>{const l=parseFloat(a);isNaN(l)||l<0||r(Math.round(l*1e3))},disabled:n,className:"btn-primary text-xs py-1.5 px-4 disabled:opacity-50",children:"Apply"})]})]})]})})}function ot(){const{data:t}=se(),s=te(),[o,r]=i.useState(null),[n,a]=i.useState(!1),d=(t==null?void 0:t.apps)??[],l=i.useCallback(async(c,w="all")=>{if(d.length===0)return;a(!0);const f=await Promise.allSettled(d.map(k=>s.mutateAsync({appId:k.appId,throttle:c,...w!=="all"?{scope:w}:{}}))),y=f.filter(k=>k.status==="rejected").length;y>0&&console.error(`Emergency throttle: ${y}/${f.length} apps failed`),a(!1),r(null)},[d,s]),g=c=>c==="engines"?"engines":c==="workers"?"workers":"everything";return o?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-status-error",children:["Pause ",g(o.scope),"?"]}),e.jsx("button",{onClick:()=>l(o.ms,o.scope),disabled:n,className:"px-2.5 py-1 text-xs rounded-md bg-status-error text-white hover:bg-status-error/90 transition-colors disabled:opacity-50",children:n?e.jsx(Z,{className:"w-3.5 h-3.5 animate-spin"}):"Confirm"}),e.jsx("button",{onClick:()=>r(null),disabled:n,className:"px-2.5 py-1 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>r({ms:-1,scope:"all"}),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-error/80 hover:text-status-error hover:bg-status-error/10 transition-colors disabled:opacity-50",title:"Pause all engines and workers",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Pause All"]}),e.jsxs("button",{onClick:()=>l(0),disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md text-status-success/80 hover:text-status-success hover:bg-status-success/10 transition-colors disabled:opacity-50",title:"Resume all engines and workers",children:[n?e.jsx(Z,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Re,{className:"w-3.5 h-3.5"}),"Resume All"]})]})}function lt({byStream:t,onNodeFilter:s}){const[o,r]=i.useState(!1);if(i.useEffect(()=>{r(!1);const c=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(c)},[t]),t.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary py-4 text-center",children:"No activity in this period"});const n=t.filter(c=>c.stream_type==="engine"),a=t.filter(c=>c.stream_type==="worker"),d=Math.max(...t.map(c=>c.count)),l=c=>{const w=d>0?c.count/d*100:0,f=c.stream_type==="engine",y=f?"(all engines)":ae(c.stream_name),k=f?"bg-blue-500/70":"bg-accent/60",C=f?"text-blue-500":"text-text-tertiary";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-[9px] font-mono ${C} w-36 truncate text-right shrink-0`,title:c.stream_name,children:y}),e.jsx("div",{className:"flex-1 h-4 bg-surface-sunken rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${k} rounded transition-all duration-500 ease-out`,style:{width:o?`${w}%`:"0%"}})}),e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-secondary w-12 text-right shrink-0",children:c.count.toLocaleString()})]},`${c.stream_type}-${c.stream_name}`)},g="text-[9px] uppercase tracking-widest font-semibold mb-1 cursor-pointer hover:underline";return e.jsxs("div",{className:"space-y-1.5",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${g} text-blue-500/70 hover:text-blue-500`,onClick:()=>s==null?void 0:s("engines"),children:"Engine Stream"}),n.map(l),a.length>0&&e.jsx("div",{className:"h-2"})]}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${g} text-accent/70 hover:text-accent`,onClick:()=>s==null?void 0:s("workers"),children:"Worker Streams"}),a.map(l)]})]})}function it({queue:t,workers:s,expanded:o,onToggle:r,onWorkerClick:n,onResumeThrottle:a,onQueueThrottle:d,onResumeQueue:l,byStream:g,activeDuration:c}){const w=i.useMemo(()=>{const u=g.find(m=>m.stream_type==="worker"&&ae(m.stream_name)===t);return(u==null?void 0:u.count)??0},[g,t]),f=i.useMemo(()=>tt(s),[s]),y=i.useMemo(()=>et(s),[s]),{errors:k}=i.useMemo(()=>R(s),[s]),C=f==="paused"?"bg-status-error":f==="degraded"?"bg-status-warning":"bg-status-success",x=i.useMemo(()=>[...s].sort((u,m)=>R([m]).total-R([u]).total),[s]),j=i.useMemo(()=>[{key:"engine_id",label:"Router",render:u=>{var p;const m=u.engine_id.replace(/^[^:]+::/,"").replace(/-[A-Za-z0-9_]{10,}$/,"")||u.engine_id,_=((p=u.engine_id.match(/^([^:]+)::/))==null?void 0:p[1])||"";return e.jsxs("div",{className:"flex items-center gap-2",title:u.engine_id,children:[e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[180px]",children:m}),_&&e.jsx("span",{className:"text-[9px] text-text-tertiary/50",children:_})]})}},{key:"processed",label:"Processed",render:u=>{const m=R([u]);return e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-tertiary",children:m.total>0?m.total.toLocaleString():"--"})},className:"w-24"},{key:"throttle",label:"Throttle",render:u=>{const m=u.throttle;return m===-1?e.jsx("span",{className:"text-xs text-status-error font-medium",children:"Paused"}):m&&m>0?e.jsx("span",{className:"text-xs text-status-warning font-medium",children:V(m)}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"0"})},className:"w-24"},{key:"actions",label:"",render:u=>e.jsxs(Ue,{children:[L(u)&&e.jsx(X,{icon:Y,title:"Resume (remove throttle)",onClick:()=>a(u),colorClass:"text-text-tertiary hover:text-status-success"}),e.jsx(X,{icon:J,title:"Adjust throttle",onClick:()=>n(u)})]}),className:"w-16"}],[n,a]);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>r(t),className:"group/row relative flex items-center gap-3 w-full py-2 hover:bg-surface-hover transition-colors text-left rounded",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${C}`,title:f}),e.jsx(ne,{className:`w-3.5 h-3.5 text-text-tertiary/50 transition-transform duration-200 ${o?"rotate-90":""}`,strokeWidth:2}),e.jsx(Be,{queue:t,size:"sm"}),e.jsx("span",{className:"flex-1"}),k>0&&e.jsxs("span",{className:"text-[10px] text-status-error font-medium mr-2",children:[k," errors"]}),y>0&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-status-warning w-20",children:[e.jsx(Me,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:y.toLocaleString()})]}),e.jsxs("span",{className:`flex items-center gap-1 text-xs w-24 ${s.some(L)?"text-status-warning":"text-text-tertiary"}`,children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"font-mono tabular-nums",children:s.length}),e.jsx("span",{children:"workers"})]}),e.jsx("span",{className:"flex items-center gap-1 text-xs font-mono text-text-tertiary w-28 justify-end mr-16",children:w>0?e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),w.toLocaleString()," in ",c]}):e.jsx("span",{className:"text-text-tertiary/40",children:"—"})}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover/row:opacity-100 transition-opacity flex items-center gap-2",children:[s.some(L)&&e.jsx(Y,{className:"w-4 h-4 text-text-tertiary hover:text-status-success",strokeWidth:1.5,onClick:u=>{u.stopPropagation(),l(t)}}),e.jsx(J,{className:"w-4 h-4 text-text-tertiary hover:text-accent",strokeWidth:1.5,onClick:u=>{u.stopPropagation(),d(t)}})]})]}),e.jsx(W,{open:o,children:e.jsx("div",{className:"ml-6",children:e.jsx(ze,{columns:j,data:x,keyFn:O,onRowClick:n,emptyMessage:"No workers",inline:!0})})})]})}let ct=0;function dt(t){const s=t.data||{},o=s.topic?String(s.topic):"",r=s.guid?String(s.guid).slice(0,8):"";switch(t.type){case"pong":return o?`Worker ${r}... on "${o}" responded`:`Engine ${r}... responded`;case"ping":return"Roll call broadcast";case"throttle":{const n=s.throttle,a=o?`queue "${o}"`:r?`node ${r}...`:"all nodes";return`${V(n)} applied to ${a}`}case"job":return`Job ${r?r+"...":""} ${s.status||"updated"}`;case"work":return`Dispatched to "${o||"worker"}" ${r?"("+r+"...)":""}`;case"activate":return`Worker "${o||"unknown"}" activated`;case"cron":return`Cron triggered ${o?'"'+o+'"':""}`;default:return o||r||t.type}}function ut(t){const s=[];let o=0;for(;o<t.length;){const r=t[o];if(r.type==="pong"){let n=o+1;for(;n<t.length&&t[n].type==="pong";)n++;const a=t.slice(o,n);if(a.length>=3)s.push({kind:"group",type:"pong",count:a.length,firstTimestamp:a[a.length-1].timestamp,lastTimestamp:a[0].timestamp,events:a});else for(const d of a)s.push({kind:"single",event:d});o=n}else s.push({kind:"single",event:r}),o++}return s}function le({event:t}){const[s,o]=i.useState(!1);return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${re[t.type]||"text-text-tertiary"} bg-surface-sunken whitespace-nowrap shrink-0`,children:He[t.type]||t.type}),e.jsx("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:dt(t)}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"pb-2",children:e.jsx(De,{data:t.data})})})]})}function xt({group:t}){const[s,o]=i.useState(!1),r=t.events.filter(a=>{var d;return!((d=a.data)!=null&&d.topic)}).length,n=t.count-r;return e.jsxs("div",{className:"border-b border-surface-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-2 py-1.5 w-full text-left hover:bg-surface-hover/50 transition-colors",children:[e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0",children:new Date(t.lastTimestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("span",{className:`text-[9px] font-medium px-1 py-0.5 rounded ${re.pong} bg-surface-sunken whitespace-nowrap shrink-0`,children:"roll call"}),e.jsxs("span",{className:"text-[9px] text-text-secondary flex-1 min-w-0 truncate",children:[t.count," nodes responded",r>0&&n>0?` (${r} engine${r!==1?"s":""}, ${n} worker${n!==1?"s":""})`:r>0?` (${r} engine${r!==1?"s":""})`:` (${n} worker${n!==1?"s":""})`]}),e.jsx("svg",{className:`w-2.5 h-2.5 text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),e.jsx(W,{open:s,children:e.jsx("div",{className:"ml-4",children:t.events.map(a=>e.jsx(le,{event:a},a.id))})})]})}function pt({channels:t,onToggle:s,customFilter:o,onCustomFilterChange:r}){return e.jsxs("div",{className:"space-y-3 pb-3 border-b border-surface-border mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Channels"}),e.jsx("p",{className:"text-[9px] text-text-tertiary",children:"Unchecked channels are dropped before buffering"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-1",children:oe.map(n=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-0.5",children:[e.jsx("input",{type:"checkbox",checked:t.has(n.key),onChange:()=>s(n.key),className:"w-3 h-3 rounded border-border accent-accent"}),e.jsx("span",{className:"text-[10px] text-text-secondary",title:n.description,children:n.label})]},n.key))}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Text Filter"}),e.jsx("input",{type:"text",value:o,onChange:n=>r(n.target.value),placeholder:"pong",className:"input text-[10px] font-mono py-1 px-2 w-full"}),e.jsxs("p",{className:"text-[9px] text-text-tertiary mt-1",children:["Filter by event type, e.g. ",e.jsx("span",{className:"font-mono",children:"pong"}),", ",e.jsx("span",{className:"font-mono",children:"throttle"}),", or any text in the event data."]})]})]})}function ht({bridgeActive:t}){const[s,o]=i.useState(!1),[r,n]=i.useState(!1),[a,d]=i.useState([]),[l,g]=i.useState(()=>new Set(oe.map(x=>x.key))),[c,w]=i.useState(""),f=i.useRef(l);i.useEffect(()=>{f.current=l},[l]);const y=i.useRef(c);i.useEffect(()=>{y.current=c},[c]);const k=x=>{g(j=>{const u=new Set(j);return u.has(x)?u.delete(x):u.add(x),u})};Je("lt.events.mesh.>",i.useCallback(x=>{var m;const j=((m=x.type)==null?void 0:m.replace("mesh.",""))||"unknown";if(!f.current.has(j))return;const u=y.current;u&&!`${j} ${JSON.stringify(x.data||x)}`.toLowerCase().includes(u.toLowerCase())||d(_=>[{id:++ct,type:j,timestamp:x.timestamp||new Date().toISOString(),data:x.data||x},..._].slice(0,Ke))},[]));const C=()=>d([]);return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] sticky top-14 self-start max-h-[calc(100vh-8rem)] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),e.jsx(Le,{className:`w-3 h-3 ${t?"text-status-success animate-pulse":"text-text-tertiary"}`}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:t?"Live":"..."}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{o(x=>!x),n(!1)},className:`p-1 rounded transition-colors ${s?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"Configure channels",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{n(x=>!x),o(!1)},className:`p-1 rounded transition-colors ${r?"text-accent bg-accent/10":"text-text-tertiary hover:text-text-primary"}`,title:"View raw JSON",children:e.jsx(Qe,{className:"w-3.5 h-3.5"})}),a.length>0&&e.jsx("button",{onClick:C,className:"p-1 rounded text-text-tertiary hover:text-text-primary transition-colors",title:"Clear events",children:e.jsx(Fe,{className:"w-3.5 h-3.5"})})]})]}),e.jsx(W,{open:s,children:e.jsx(pt,{channels:l,onToggle:k,customFilter:c,onCustomFilterChange:w})}),e.jsx(W,{open:r,children:e.jsx("div",{className:"pb-3 border-b border-surface-border mb-3",children:e.jsx("pre",{className:"text-[9px] font-mono text-text-tertiary bg-surface-sunken rounded-lg p-3 max-h-[50vh] overflow-auto whitespace-pre-wrap",children:JSON.stringify(a.slice(0,50),null,2)})})}),a.length>0&&e.jsxs("p",{className:"text-[9px] text-text-tertiary mb-2",children:[a.length," events"]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary py-6 text-center",children:t?"Waiting for events...":"Subscribing..."}):ut(a).map((x,j)=>x.kind==="group"?e.jsx(xt,{group:x},`grp-${j}`):e.jsx(le,{event:x.event},x.event.id))})]})}function mt(t){const s=[],o=[],r=[];for(const n of t)L(n)?r.push(n):n.is_scout||R([n]).total>0?s.push(n):o.push(n);return s.sort((n,a)=>n.is_scout&&!a.is_scout?-1:!n.is_scout&&a.is_scout?1:R([a]).total-R([n]).total),o.sort((n,a)=>F(n.engine_id).localeCompare(F(a.engine_id))),r.sort((n,a)=>F(n.engine_id).localeCompare(F(a.engine_id))),{active:s,idle:o,paused:r}}function D({engine:t,isFirst:s,onThrottle:o}){const r=F(t.engine_id),n=Ye(t.engine_id),a=R([t]),d=t.stream_depth??0,l=L(t);return e.jsxs("div",{className:"group/row flex items-center gap-3 py-2 hover:bg-surface-hover/50 transition-colors rounded px-1",children:[l?e.jsx(U,{className:"w-3.5 h-3.5 text-status-warning shrink-0",strokeWidth:1.5}):e.jsx(Oe,{className:`w-3.5 h-3.5 shrink-0 ${a.total>0||t.is_scout?"text-status-success":"text-text-tertiary/30"}`,strokeWidth:1.5}),e.jsx("span",{className:`${s?"text-base font-medium":"text-xs"} text-text-primary truncate max-w-[180px]`,title:t.engine_id,children:r}),n&&e.jsx("span",{className:"text-[10px] text-text-tertiary/50",children:n}),t.is_scout&&e.jsx("span",{className:"text-[9px] text-amber-500 uppercase tracking-widest",children:"scout"}),e.jsx("span",{className:"flex-1"}),l&&e.jsx("span",{className:"text-[10px] text-status-warning",children:t.throttle===-1?"Paused":V(t.throttle)}),a.total>0&&e.jsx("span",{className:"text-[10px] font-mono tabular-nums text-text-tertiary w-16 text-right",children:a.total.toLocaleString()}),d>0&&e.jsxs("span",{className:`text-[10px] font-mono tabular-nums w-14 text-right ${d>100?"text-status-warning":"text-text-tertiary/50"}`,children:[d.toLocaleString()," q"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary/40 w-12 text-right",children:Ze(t.inited)}),e.jsx("span",{className:"opacity-0 group-hover/row:opacity-100 transition-opacity",children:e.jsx("button",{onClick:g=>{g.stopPropagation(),o(t)},className:"text-text-tertiary hover:text-accent transition-colors",title:l?"Resume / adjust throttle":"Pause / throttle",children:e.jsx(J,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function ee({label:t,engines:s,onThrottle:o}){const[r,n]=i.useState(!1);return s.length===0?null:e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>n(!r),className:"flex items-center gap-1.5 text-[10px] text-text-tertiary hover:text-text-secondary transition-colors py-1",children:[e.jsx(ne,{className:`w-3 h-3 transition-transform duration-200 ${r?"rotate-90":""}`,strokeWidth:2}),s.length," ",t]}),e.jsx(W,{open:r,children:e.jsx("div",{className:"ml-1",children:s.map(a=>e.jsx(D,{engine:a,onThrottle:o},a.engine_id))})})]})}function gt({engines:t,onThrottle:s,isLoading:o}){const{active:r,idle:n,paused:a}=i.useMemo(()=>mt(t),[t]);return o?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering engines..."}):t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No engines found."}):r.length===0&&n.length===0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(U,{className:"w-4 h-4 text-status-error shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-base text-status-error font-medium",children:["All ",t.length," engines paused"]})]}),e.jsx("p",{className:"text-[10px] text-text-tertiary ml-7",children:"Messages are accumulating. Resume at least one engine to restore processing."}),e.jsx("div",{className:"ml-1 mt-2",children:a.map(d=>e.jsx(D,{engine:d,onThrottle:s},d.engine_id))})]}):e.jsxs("div",{children:[r.map((d,l)=>e.jsx(D,{engine:d,isFirst:l===0,onThrottle:s},d.engine_id)),e.jsx(ee,{label:"idle",engines:n,onThrottle:s}),e.jsx(ee,{label:"paused",engines:a,onThrottle:s})]})}function ft({collapsed:t,toggleSection:s,activeDuration:o,streamStats:r,isLoading:n,queueMap:a,expandedQueues:d,toggleQueue:l,allQueuesExpanded:g,toggleAllQueues:c,handleRowClick:w,handleResumeThrottle:f,handleQueueThrottle:y,handleResumeQueue:k,engines:C,bridgeActive:x}){return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-12 mt-10",children:[e.jsx(z,{title:`Message Volume (${o})`,sectionKey:"volume",isCollapsed:!!t.volume,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(lt,{byStream:(r==null?void 0:r.byStream)??[],onNodeFilter:()=>{},onQueueFilter:()=>{}})}),e.jsx(z,{title:`Engine Routers (${C.length})`,sectionKey:"engines",isCollapsed:!!t.engines,onToggle:s,contentClassName:"mt-4 ml-7",children:e.jsx(gt,{engines:C,onThrottle:w,isLoading:n})}),e.jsx(z,{title:"Worker Routers",sectionKey:"queues",isCollapsed:!!t.queues,onToggle:s,contentClassName:"mt-4 ml-7 flex flex-col gap-0",children:n?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Discovering mesh nodes..."}):a.size===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:'No worker routers found. Click "Roll Call" to discover.'}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end mb-2",children:e.jsx("button",{onClick:c,className:"text-[10px] text-accent hover:underline",children:g?"Collapse all":"Expand all"})}),[...a.entries()].sort(([j],[u])=>j.localeCompare(u)).map(([j,u])=>e.jsx(it,{queue:j,workers:u,expanded:d.has(j),onToggle:l,onWorkerClick:w,onResumeThrottle:f,onQueueThrottle:y,onResumeQueue:k,byStream:(r==null?void 0:r.byStream)??[],activeDuration:o},j))]})})]}),e.jsx(ht,{bridgeActive:x})]})}function Mt(){var K;const{data:t}=se(),s=(t==null?void 0:t.apps)??[],{filters:o,setFilter:r}=Se({filters:{app_id:"",duration:"1h"}}),n=((K=s[0])==null?void 0:K.appId)??"durable",a=o.app_id||n,d=o.duration||"1h",l=$e(),g=6e4,{data:c,isLoading:w,error:f,refetch:y,isFetching:k}=_e(a,g),{data:C}=Te(a,d,void 0,g),x=i.useMemo(()=>[...(c==null?void 0:c.profiles)??[]].sort((v,E)=>{const B=v.worker_topic||v.stream||"",Q=E.worker_topic||E.stream||"";return!v.worker_topic&&E.worker_topic?-1:v.worker_topic&&!E.worker_topic?1:B.localeCompare(Q)}),[c==null?void 0:c.profiles]),j=i.useMemo(()=>x.filter(h=>!A(h)),[x]),u=i.useMemo(()=>x.filter(A),[x]),m=i.useMemo(()=>Xe(x),[x]),_=x.filter(L).length,p=i.useMemo(()=>{const h=new Set(s.map(v=>v.appId));return a&&h.add(a),[...h].sort().map(v=>({value:v,label:v}))},[s,a]),[S]=Ve(),b=S.get("queue"),[$,M]=i.useState(()=>b?new Set([b]):new Set),N=i.useCallback(h=>{M(v=>{const E=v.has(h),B=E?new Set:new Set([h]),Q=new URLSearchParams(window.location.search);E?Q.delete("queue"):Q.set("queue",h);const G=Q.toString();return window.history.pushState(null,"",G?`?${G}`:window.location.pathname),B})},[]),T=m.size>0&&[...m.keys()].every(h=>$.has(h)),I=i.useCallback(()=>{M(T?new Set:new Set(m.keys()))},[T,m]),P="lt:controlplane:collapsed",[ie,ce]=i.useState(()=>{try{const h=JSON.parse(localStorage.getItem(P)||"{}");return b&&(h.queues=!1),h}catch{return{}}}),de=i.useCallback(h=>{ce(v=>{const E={...v,[h]:!v[h]};return localStorage.setItem(P,JSON.stringify(E)),E})},[]),{throttleModalOpen:ue,throttleTargets:q,selectedThrottleTargets:xe,throttleMutation:pe,handleBulkThrottle:he,handleRowClick:me,handleResumeThrottle:ge,handleResumeQueue:fe,handleQueueThrottle:be,closeThrottleModal:je}=st({activeAppId:a,allProfiles:x,profiles:x}),ye=i.useMemo(()=>{const h=[{label:"Engines",value:j.length,dotClass:"bg-blue-500"},{label:"Workers",value:u.length,dotClass:"bg-text-secondary"},{label:"Topics",value:m.size}];return _>0&&h.push({label:"Throttled",value:_,dotClass:"bg-status-warning"}),h},[j.length,u.length,m.size,_]),[H,we]=i.useState(!1),ke=i.useCallback(()=>{l.mutate({appId:a},{onSuccess:()=>we(!0)})},[a,l]);return i.useEffect(()=>{!H&&a&&ke()},[a]),e.jsxs("div",{children:[e.jsx(Ne,{title:"Routers",docsHash:"#docs:dashboard.md:task-queues",stats:ye,actions:e.jsx(ot,{})}),e.jsxs(ve,{actions:e.jsx("div",{className:"flex items-center gap-1",children:qe.map(h=>e.jsx("button",{onClick:()=>r("duration",h.value),className:`px-3 py-1 text-xs rounded-full transition-colors ${d===h.value?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.label},h.value))}),children:[e.jsx(Ce,{label:"Application",value:o.app_id,onChange:h=>r("app_id",h),options:p}),e.jsxs("button",{onClick:()=>y(),disabled:k,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary transition-colors disabled:opacity-50",children:[e.jsx(Ie,{className:`w-3.5 h-3.5 ${k?"animate-spin":""}`}),"Roll Call"]})]}),f&&e.jsx("div",{className:"mb-6 px-4 py-3 rounded bg-status-error/10 border border-status-error/20",children:e.jsx("p",{className:"text-xs text-status-error font-medium",children:f.message==="Session expired"?"Session expired — please log in again.":`Failed to load mesh data: ${f.message}`})}),e.jsx(ft,{collapsed:ie,toggleSection:de,activeDuration:d,streamStats:C,isLoading:w,queueMap:m,expandedQueues:$,toggleQueue:N,allQueuesExpanded:T,toggleAllQueues:I,handleRowClick:me,handleResumeThrottle:ge,handleQueueThrottle:be,handleResumeQueue:fe,engines:j,bridgeActive:H}),e.jsx(at,{open:ue,onClose:je,targets:q.length>0?q:xe,onApply:he,isPending:pe.isPending})]})}export{Mt as ControlPlanePage};
2
+ //# sourceMappingURL=index-Do1x4kN0.js.map