@hotmeshio/long-tail 0.10.7 → 0.10.8
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.
- package/build/types/index.d.ts +1 -1
- package/dashboard/dist/assets/{AdminDashboard-CYlm0_J0.js → AdminDashboard-D0HdEkT9.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-CYlm0_J0.js.map → AdminDashboard-D0HdEkT9.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-BttOMcj_.js → AgentConfigPage-CtURUMOV.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-BttOMcj_.js.map → AgentConfigPage-CtURUMOV.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-D9JdkWV8.js → AgentDetailPage-C5AnjpD9.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-D9JdkWV8.js.map → AgentDetailPage-C5AnjpD9.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-AqGtEOL1.js → AgentsPage-DBequneI.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-AqGtEOL1.js.map → AgentsPage-DBequneI.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-rKbrcY8Y.js → AvailableEscalationsPage-Bk7fFV2e.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-rKbrcY8Y.js.map → AvailableEscalationsPage-Bk7fFV2e.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-Bj4MB_so.js → BotPicker-BMXokkH7.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-Bj4MB_so.js.map → BotPicker-BMXokkH7.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-DzLP5-ad.js → CapabilitiesPage-w-D6xraE.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-DzLP5-ad.js.map → CapabilitiesPage-w-D6xraE.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CReMhtzK.js → CollapsibleSection-IPL1H1bQ.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CReMhtzK.js.map → CollapsibleSection-IPL1H1bQ.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-Z8N8ccJ1.js → CountdownTimer-D-CpxYDO.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-Z8N8ccJ1.js.map → CountdownTimer-D-CpxYDO.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-D_2T6vSb.js → CredentialsPage-DR48hDES.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-D_2T6vSb.js.map → CredentialsPage-DR48hDES.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DBmKrLvL.js → CronLabel-KQEj0cDS.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DBmKrLvL.js.map → CronLabel-KQEj0cDS.js.map} +1 -1
- package/dashboard/dist/assets/CustomDurationPicker-_KceggR9.js +2 -0
- package/dashboard/dist/assets/CustomDurationPicker-_KceggR9.js.map +1 -0
- package/dashboard/dist/assets/{ElapsedCell-C0LbM8o2.js → ElapsedCell-Cflz7Pb5.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-C0LbM8o2.js.map → ElapsedCell-Cflz7Pb5.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-CkEJnFKd.js → EscalationListSchemaPage-BTBZ8OBY.js} +2 -2
- package/dashboard/dist/assets/{EscalationListSchemaPage-CkEJnFKd.js.map → EscalationListSchemaPage-BTBZ8OBY.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-CnlwGAIE.js → EscalationSchemaPage-Cd9fR2EA.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-CnlwGAIE.js.map → EscalationSchemaPage-Cd9fR2EA.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DFM-f7do.js → EscalationsOverview-BzNFcA0i.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DFM-f7do.js.map → EscalationsOverview-BzNFcA0i.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-Q3iICRf_.js → EventTable-S2BJqOt2.js} +2 -2
- package/dashboard/dist/assets/{EventTable-Q3iICRf_.js.map → EventTable-S2BJqOt2.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-B0taDH7I.js → FilterBar-CeXwNVn6.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-B0taDH7I.js.map → FilterBar-CeXwNVn6.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-B_P3pJeA.js → GraphInvokePage-CBjXjOLX.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-B_P3pJeA.js.map → GraphInvokePage-CBjXjOLX.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-lu88PzQH.js → HomePage-NMLaXTvf.js} +2 -2
- package/dashboard/dist/assets/{HomePage-lu88PzQH.js.map → HomePage-NMLaXTvf.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-ueCQtu5C.js → ListToolbar-Dx6DuFdR.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-ueCQtu5C.js.map → ListToolbar-Dx6DuFdR.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DMaRUXnA.js → McpOverview-Cj8_UyWJ.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DMaRUXnA.js.map → McpOverview-Cj8_UyWJ.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-D6YSD94n.js → McpQueryDetailPage-Bqh8GChr.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-D6YSD94n.js.map → McpQueryDetailPage-Bqh8GChr.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-CNGNB59o.js → McpQueryPage-CqFkBwBR.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-CNGNB59o.js.map → McpQueryPage-CqFkBwBR.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CJ9hDTNs.js → McpRunDetailPage-BqhRwkGk.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CJ9hDTNs.js.map → McpRunDetailPage-BqhRwkGk.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-_UaoIwzX.js → McpRunsPage-CNXYU4iX.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-_UaoIwzX.js.map → McpRunsPage-CNXYU4iX.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-C7UB_d-X.js +2 -0
- package/dashboard/dist/assets/OperationsPage-C7UB_d-X.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-DwbPAPaf.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-DwbPAPaf.js.map +1 -0
- package/dashboard/dist/assets/{ProcessDetailPage-CxJ5BSDk.js → ProcessDetailPage-ChGWcwSp.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-CxJ5BSDk.js.map → ProcessDetailPage-ChGWcwSp.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-GQMOo5Wo.js → ProcessesListPage-DatKHVkd.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-GQMOo5Wo.js.map → ProcessesListPage-DatKHVkd.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-Bh5qdI0w.js → RoleDetailPage-GJ_coHsM.js} +2 -2
- package/dashboard/dist/assets/{RoleDetailPage-Bh5qdI0w.js.map → RoleDetailPage-GJ_coHsM.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-BIg3_Em6.js → RolesPage-CPKw336d.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-BIg3_Em6.js.map → RolesPage-CPKw336d.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DQp_keSD.js → RunAsSelector-VbBn0o7s.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DQp_keSD.js.map → RunAsSelector-VbBn0o7s.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-qLaLa33X.js → StickyPagination-BI8tDf2V.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-qLaLa33X.js.map → StickyPagination-BI8tDf2V.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Bi37x95H.js → StreamMessageDetail-BObbEz7P.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Bi37x95H.js.map → StreamMessageDetail-BObbEz7P.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BdNhoiW8.js → SwimlaneTimeline-BHjAtOGC.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BdNhoiW8.js.map → SwimlaneTimeline-BHjAtOGC.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-ngdXRgQp.js → TaskDetailPage-B-E1dqUw.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-ngdXRgQp.js.map → TaskDetailPage-B-E1dqUw.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-BIE7nrdE.js → TasksListPage-urJ4XiUi.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-BIE7nrdE.js.map → TasksListPage-urJ4XiUi.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-C6FZSNZp.js → TimeAgo-D6Dg0SQs.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-C6FZSNZp.js.map → TimeAgo-D6Dg0SQs.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DI5zPUgV.js → TimestampCell-DG__Gr-e.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DI5zPUgV.js.map → TimestampCell-DG__Gr-e.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-Dli94RPI.js → ToolTestPanel-D-hGLf95.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-Dli94RPI.js.map → ToolTestPanel-D-hGLf95.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-vPtXb7gD.js → TopicDetailPage-B10i4xV2.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-vPtXb7gD.js.map → TopicDetailPage-B10i4xV2.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-BwiEX0pU.js → TopicsPage-C5THflVQ.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BwiEX0pU.js.map → TopicsPage-C5THflVQ.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-YozoXJA1.js → UserName-CZTpouta.js} +2 -2
- package/dashboard/dist/assets/{UserName-YozoXJA1.js.map → UserName-CZTpouta.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-Bce8g08l.js → WorkflowExecutionPage-mbnj6saI.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-Bce8g08l.js.map → WorkflowExecutionPage-mbnj6saI.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-DpVAH35I.js → WorkflowsDashboard-DC_9GrpY.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-DpVAH35I.js.map → WorkflowsDashboard-DC_9GrpY.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-Bp2pxXJO.js → WorkflowsOverview-ClSH1UwG.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-Bp2pxXJO.js.map → WorkflowsOverview-ClSH1UwG.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CL_kD0mX.js → YamlWorkflowDetailPage-BkgoB7oD.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CL_kD0mX.js.map → YamlWorkflowDetailPage-BkgoB7oD.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-Dtt3x3_T.js → YamlWorkflowsPage-Db_REA2f.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-Dtt3x3_T.js.map → YamlWorkflowsPage-Db_REA2f.js.map} +1 -1
- package/dashboard/dist/assets/{agents-xhtLVBwq.js → agents-Dvb8j9AB.js} +2 -2
- package/dashboard/dist/assets/{agents-xhtLVBwq.js.map → agents-Dvb8j9AB.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DZ1MQUms.js → bots-D9jYHjBM.js} +2 -2
- package/dashboard/dist/assets/{bots-DZ1MQUms.js.map → bots-D9jYHjBM.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-B8j2h7Jn.js → capabilities-BAto9JcQ.js} +2 -2
- package/dashboard/dist/assets/{capabilities-B8j2h7Jn.js.map → capabilities-BAto9JcQ.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-DKijNA6h.js → controlplane-2Aic2Tfm.js} +2 -2
- package/dashboard/dist/assets/{controlplane-DKijNA6h.js.map → controlplane-2Aic2Tfm.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-DjoZ4dDb.js → escalation-columns-DPKPJtw3.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-DjoZ4dDb.js.map → escalation-columns-DPKPJtw3.js.map} +1 -1
- package/dashboard/dist/assets/{index-DrPWIFSv.js → index-4zRmxPwA.js} +2 -2
- package/dashboard/dist/assets/{index-DrPWIFSv.js.map → index-4zRmxPwA.js.map} +1 -1
- package/dashboard/dist/assets/{index-BqeQGQ4K.js → index-B5JgykZD.js} +2 -2
- package/dashboard/dist/assets/{index-BqeQGQ4K.js.map → index-B5JgykZD.js.map} +1 -1
- package/dashboard/dist/assets/{index-BCIJE--_.js → index-BW7-Q9Qf.js} +2 -2
- package/dashboard/dist/assets/{index-BCIJE--_.js.map → index-BW7-Q9Qf.js.map} +1 -1
- package/dashboard/dist/assets/{index-DYCCUmSM.js → index-BZbDwh_Y.js} +2 -2
- package/dashboard/dist/assets/{index-DYCCUmSM.js.map → index-BZbDwh_Y.js.map} +1 -1
- package/dashboard/dist/assets/{index-CMv6YMJY.js → index-BzQIzZfd.js} +2 -2
- package/dashboard/dist/assets/{index-CMv6YMJY.js.map → index-BzQIzZfd.js.map} +1 -1
- package/dashboard/dist/assets/{index-DcDEJ6b_.js → index-C-T1Wq0Z.js} +2 -2
- package/dashboard/dist/assets/{index-DcDEJ6b_.js.map → index-C-T1Wq0Z.js.map} +1 -1
- package/dashboard/dist/assets/{index-C6UuVkz7.js → index-CKxFjMtw.js} +4 -4
- package/dashboard/dist/assets/{index-C6UuVkz7.js.map → index-CKxFjMtw.js.map} +1 -1
- package/dashboard/dist/assets/{index-0SzWFShg.js → index-CeM012DJ.js} +2 -2
- package/dashboard/dist/assets/{index-0SzWFShg.js.map → index-CeM012DJ.js.map} +1 -1
- package/dashboard/dist/assets/{index-ChHD9p_I.js → index-KkikDsJ2.js} +2 -2
- package/dashboard/dist/assets/{index-ChHD9p_I.js.map → index-KkikDsJ2.js.map} +1 -1
- package/dashboard/dist/assets/index-Pmvw74oY.css +1 -0
- package/dashboard/dist/assets/{index-B0ktIiOY.js → index-_Q1Wf2A8.js} +2 -2
- package/dashboard/dist/assets/{index-B0ktIiOY.js.map → index-_Q1Wf2A8.js.map} +1 -1
- package/dashboard/dist/assets/index-jkVeGCkD.js +5 -0
- package/dashboard/dist/assets/index-jkVeGCkD.js.map +1 -0
- package/dashboard/dist/assets/{index-Cp1jJHm1.js → index-oHU-ramT.js} +2 -2
- package/dashboard/dist/assets/{index-Cp1jJHm1.js.map → index-oHU-ramT.js.map} +1 -1
- package/dashboard/dist/assets/{index-DWDEa8jS.js → index-peRHL38z.js} +2 -2
- package/dashboard/dist/assets/{index-DWDEa8jS.js.map → index-peRHL38z.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-Dl3cOfFR.js → knowledge-DO8idX0e.js} +2 -2
- package/dashboard/dist/assets/{knowledge-Dl3cOfFR.js.map → knowledge-DO8idX0e.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-BwjeqkHn.js → mcp-BGpQlkFp.js} +2 -2
- package/dashboard/dist/assets/{mcp-BwjeqkHn.js.map → mcp-BGpQlkFp.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-C1Rlt4az.js → mcp-query-DT0SCB9l.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-C1Rlt4az.js.map → mcp-query-DT0SCB9l.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-BGIUgIH_.js → pipelines-CYk7cN6-.js} +2 -2
- package/dashboard/dist/assets/{pipelines-BGIUgIH_.js.map → pipelines-CYk7cN6-.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CnC1xEaD.js → tasks-B4Y5xbF0.js} +2 -2
- package/dashboard/dist/assets/{tasks-CnC1xEaD.js.map → tasks-B4Y5xbF0.js.map} +1 -1
- package/dashboard/dist/assets/{topics-C6EcHi07.js → topics-CVnqDw3B.js} +2 -2
- package/dashboard/dist/assets/{topics-C6EcHi07.js.map → topics-CVnqDw3B.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-Cyq4DiQA.js → useEventHooks-D8bVEx-w.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-Cyq4DiQA.js.map → useEventHooks-D8bVEx-w.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-Ci_oA5Tq.js → useNamespace-B1t3hsGf.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-Ci_oA5Tq.js.map → useNamespace-B1t3hsGf.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-u8RUiMma.js → useYamlActivityEvents-B8Ru07xQ.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-u8RUiMma.js.map → useYamlActivityEvents-B8Ru07xQ.js.map} +1 -1
- package/dashboard/dist/assets/{users-DtiYvg8z.js → users-C8H4jjTq.js} +2 -2
- package/dashboard/dist/assets/{users-DtiYvg8z.js.map → users-C8H4jjTq.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-BysPDsh9.js → workflows-BAdI5k--.js} +2 -2
- package/dashboard/dist/assets/{workflows-BysPDsh9.js.map → workflows-BAdI5k--.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-31qtxg5W.js → yaml-workflows-Bf2aQS-M.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-31qtxg5W.js.map → yaml-workflows-Bf2aQS-M.js.map} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/docs/api/http/escalations.md +1 -1
- package/docs/hitl/escalation.md +1 -1
- package/docs/hitl/x-lt-embed.md +41 -12
- package/docs/hitl/x-lt-list-schema.md +15 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/CustomDurationPicker-BTmpAQOL.js +0 -2
- package/dashboard/dist/assets/CustomDurationPicker-BTmpAQOL.js.map +0 -1
- package/dashboard/dist/assets/OperationsPage-CTfwuWXR.js +0 -2
- package/dashboard/dist/assets/OperationsPage-CTfwuWXR.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-DMPJmgP_.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-DMPJmgP_.js.map +0 -1
- package/dashboard/dist/assets/index-Dh5Y3hq7.js +0 -5
- package/dashboard/dist/assets/index-Dh5Y3hq7.js.map +0 -1
- package/dashboard/dist/assets/index-WSGppNeK.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProcessesListPage-DatKHVkd.js","./vendor-query-B2UbickB.js","./tasks-B4Y5xbF0.js","./workflows-BAdI5k--.js","./useEventHooks-D8bVEx-w.js","./useFilterParams-CvRyYHJN.js","./vendor-react-BpdAFEQc.js","./useDebouncedValue-BA5S7V54.js","./api-path-u2Jf9QXS.js","./DataTable-BTu2AaEl.js","./EmptyState-BcsfPq9T.js","./TimestampCell-DG__Gr-e.js","./StickyPagination-BI8tDf2V.js","./FilterBar-CeXwNVn6.js","./vendor-icons-BE_WrH2z.js","./PageHeader-DlcE3U5L.js","./ListToolbar-Dx6DuFdR.js","./WorkflowPill-DlSVXnnj.js","./ProcessDetailPage-ChGWcwSp.js","./PageHeaderWithStats-BMhnR3-9.js","./StatusBadge-BbqghFMi.js","./RolePill-dzo14hB_.js","./UserName-CZTpouta.js","./users-C8H4jjTq.js","./McpOverview-Cj8_UyWJ.js","./mcp-BGpQlkFp.js","./pipelines-CYk7cN6-.js","./yaml-workflows-Bf2aQS-M.js","./controlplane-2Aic2Tfm.js","./StatCard-DBANWIss.js","./McpRunsPage-CNXYU4iX.js","./useNamespace-B1t3hsGf.js","./ElapsedCell-Cflz7Pb5.js","./RowActions-BA9L9djf.js","./McpRunDetailPage-BqhRwkGk.js","./CopyableId-BpB-NvDh.js","./CollapsibleSection-IPL1H1bQ.js","./EventTable-S2BJqOt2.js","./SwimlaneTimeline-BHjAtOGC.js","./StreamMessageDetail-BObbEz7P.js","./McpQueryPage-CqFkBwBR.js","./mcp-query-DT0SCB9l.js","./McpQueryDetailPage-Bqh8GChr.js","./TagInput-cyhTZTwe.js","./useYamlActivityEvents-B8Ru07xQ.js","./helpers-DzO-OGPe.js","./RunAsSelector-VbBn0o7s.js","./BotPicker-BMXokkH7.js","./bots-D9jYHjBM.js","./ToolPill-CKHYG6eV.js","./TimeAgo-D6Dg0SQs.js","./EscalationsOverview-BzNFcA0i.js","./AvailableEscalationsPage-Bk7fFV2e.js","./task-queues-7-sHKPsN.js","./CustomDurationPicker-_KceggR9.js","./Modal-CA2Iv02H.js","./CountdownTimer-D-CpxYDO.js","./constants-BHkpVaqx.js","./role-display-Dvo2lDpU.js","./escalation-columns-DPKPJtw3.js","./PriorityBadge-CCERr9vQ.js","./OperatorDashboard-DwbPAPaf.js","./index-jkVeGCkD.js","./WorkflowsOverview-ClSH1UwG.js","./index-C-T1Wq0Z.js","./NamespacePill-DQGzN0Ph.js","./WorkflowsDashboard-DC_9GrpY.js","./YamlWorkflowsPage-Db_REA2f.js","./GraphInvokePage-CBjXjOLX.js","./YamlWorkflowDetailPage-BkgoB7oD.js","./TasksListPage-urJ4XiUi.js","./TaskDetailPage-B-E1dqUw.js","./WorkflowExecutionPage-mbnj6saI.js","./AdminDashboard-D0HdEkT9.js","./index-BW7-Q9Qf.js","./TaskQueuePill-_zIpG4bG.js","./index-4zRmxPwA.js","./ConfirmDeleteModal-DD7SEMeX.js","./index-BzQIzZfd.js","./ToolTestPanel-D-hGLf95.js","./index-B5JgykZD.js","./index-_Q1Wf2A8.js","./RolesPage-CPKw336d.js","./RoleDetailPage-GJ_coHsM.js","./EscalationSchemaPage-Cd9fR2EA.js","./EscalationListSchemaPage-BTBZ8OBY.js","./index-BZbDwh_Y.js","./OperationsPage-C7UB_d-X.js","./index-oHU-ramT.js","./index-peRHL38z.js","./CredentialsPage-DR48hDES.js","./index-CeM012DJ.js","./DropZone-BrnAkQxF.js","./index-KkikDsJ2.js","./knowledge-DO8idX0e.js","./HomePage-NMLaXTvf.js","./AgentsPage-DBequneI.js","./agents-Dvb8j9AB.js","./AgentDetailPage-C5AnjpD9.js","./CronLabel-KQEj0cDS.js","./AgentConfigPage-CtURUMOV.js","./capabilities-BAto9JcQ.js","./topics-CVnqDw3B.js","./CapabilitiesPage-w-D6xraE.js","./TopicsPage-C5THflVQ.js","./TopicDetailPage-B10i4xV2.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var Xx=Object.defineProperty;var Zx=(i,t,s)=>t in i?Xx(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var v=(i,t,s)=>Zx(i,typeof t!="symbol"?t+"":t,s);import{r as Wx,a as A,j as h,u as ht,b as bt,c as Et,Q as ev,d as tv}from"./vendor-query-B2UbickB.js";import{r as nv,u as Sn,a as th,L as Ni,N as Tr,b as Eg,c as Ln,O as Sr,d as sv,R as iv}from"./vendor-react-BpdAFEQc.js";import{X as Yn,E as rv,S as av,M as lv,C as jg,a as Nf,I as Tf,R as Ag,B as Og,U as ov,b as cv,L as uv,c as fv,Z as hv,P as d0,d as Ng,e as dv,f as m0,g as p0,h as g0,i as mv,W as nh,j as pv,k as gv,F as yv,l as bv,m as xv,N as vv,n as _v,D as wv,o as Tg,p as kg,q as Sv,r as Ev,s as jv,t as Av,u as Ov,G as Nv,T as Tv,v as kv,w as Cv,x as Mv}from"./vendor-icons-BE_WrH2z.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(o){if(o.ep)return;o.ep=!0;const f=s(o);fetch(o.href,f)}})();var uf={exports:{}},Ta={},ff={exports:{}},hf={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
@@ -50,7 +50,7 @@ ${g}`),_(M);return}m(null,z),a.strategy===Mn.Count&&(y--,y===0&&_()),a.strategy=
|
|
|
50
50
|
|
|
51
51
|
${m.stack}`),g.unsubscribe(),d.reject(y)):(y=zg(E),y?(m&&(y.stack+=`
|
|
52
52
|
|
|
53
|
-
${m.stack}`),d.reject(y)):d.resolve(E))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:f,headers:a.headers}),d}else{const f=new Lg(this.protocol.muxSubscriptions,t,a,o);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.isDraining()?Promise.reject(he.errorForCode(ae.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new St;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new E_(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ae.NoResponders&&(o.code=ae.JetStreamNotEnabled),o}return s}jetstream(t={}){return new fh(this,t)}getServerVersion(){const t=this.info;return t?Ti(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw he.errorForCode(ae.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new N_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.isDraining()?Promise.reject(he.errorForCode(ae.ConnectionDraining)):this.protocol.reconnect()}}class N_{constructor(t){v(this,"nc");this.nc=t}add(t){try{return new Ka(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new l_(this.nc,t,s)}}class T_{constructor(t,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get($o)||"PUT"}get length(){const t=this.sm.header.get(Bt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class k_{constructor(t,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=t,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(ah(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get($o))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Bt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Qg extends x1{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=ms(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=ei.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,d,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new he(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ae.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(ah(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,d=m=>{var E,_,O,R;const g=Wv(409,`${_n.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((O=(_=this.info)==null?void 0:_.ordered_consumer_sequence)==null?void 0:O.stream_seq)||0;return this._resetOrderedConsumer(M+1),(R=this.monitor)==null||R.restart(),!1}return!f.noIterator};this.monitor=new oh(s,d,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Bt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Bt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class C_ extends Qg{constructor(t,s,a){super(t,s,a)}pull(t={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const y=this.js.nc.features.get(Le.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);d.max_bytes=t.max_bytes}let m=0;t.expires&&t.expires>0&&(m=t.expires,d.expires=nt(m));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=nt(g)),g&&m===0)throw new Error("idle_heartbeat requires expires");if(g>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&g&&(this.monitor?this.monitor._change(g,m):this._setupHbMonitoring(g,m));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,_=this.sub.subject;y.nc.publish(E,y.jc.encode(d),{reply:_})}}}function M_(i,t){return i?D_(t):R_(t)}function R_(i){return(t,s)=>t?[t,null]:(t=Ar(s),t?[t,null]:[null,Fa(s,i)])}function D_(i){return(t,s)=>{if(t)return[t,null];const a=Ar(s);return a!==null?[Kg(a),null]:[null,Fa(s,i)]}}function Kg(i){if(i!==null)switch(i.code){case ae.JetStream404NoMessages:case ae.JetStream408RequestTimeout:return null;case ae.JetStream409:return e1(i)?i:null;default:return i}return null}function q_(i){i&&i.ack()}function z_(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class U_{constructor(t,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=z_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Ca[0]&&t[1]===Ca[1]&&t[2]===Ca[2]&&t[3]===Ca[3]}async ackAck(t){var a;t=t||{},t.timeout=t.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((a=f.options)!=null&&a.noAsyncTraces),m=new Lg(f.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);f.request(m);try{f.publish(this.msg.reply,V0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(g){m.cancel(g)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(g){m.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(V0)}nak(t){let s=y_;t&&(s=Mf().encode(`-NAK ${JSON.stringify({delay:nt(t)})}`)),this.doAck(s)}working(){this.doAck(Ca)}next(t,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Rn().encode(a),f=Mr.concat(b_,v_,o),d=t?{reply:t}:void 0;this.msg.respond(f,d)}term(t=""){let s=x_;(t==null?void 0:t.length)>0&&(s=Mf().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const B_="1.30.3",L_="nats.ws";class P_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=B_,this.lang=L_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,s){const a=st();if(s.tls)return a.reject(new he("tls",ae.InvalidOption)),a;this.options=s;const o=t.src;if(s.wsFactory){const{socket:f,encrypted:d}=await s.wsFactory(t.src,s);this.socket=f,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=Mr.concat(...this.yields),m=j1(d);if(m!==""){const g=W1.exec(m);if(!g){s.debug&&console.error("!!!",_o(d)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);X1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new he(d.message,ae.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Rr(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${_o(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${_o(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${_o(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function H_(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let f,d;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",f="wss:";break;default:d=a.port||t===!0?"443":"80",f=t===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${g}${y}`}function $_(i={}){return v1({defaultPort:443,urlParseFn:H_,factory:()=>new P_}),hh.connect(i)}const Y_=null,G_=null,Xg="lt.events";function Zg(i,t){const s=i.split("."),a=t.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Xa=A.createContext({connected:!1,subscribe:()=>()=>{}});function V_(){const{connected:i}=A.useContext(Xa);return{connected:i}}function Wg(i,t){const{subscribe:s}=A.useContext(Xa),a=A.useRef(t);a.current=t,A.useEffect(()=>s(i,f=>a.current(f)),[s,i])}const I_=A.createContext({connected:!1,subscribe:()=>()=>{}}),F_=Mf();function J_({children:i,url:t,token:s}){const a=A.useRef(null),o=A.useRef(null),[f,d]=A.useState(!1),m=A.useRef(null),g=A.useRef(new Map),y=A.useCallback((O,R)=>{const M=g.current;return M.has(O)||M.set(O,new Set),M.get(O).add(R),()=>{const z=M.get(O);z&&(z.delete(R),z.size===0&&M.delete(O))}},[]),E=A.useCallback((O,R)=>{for(const[M,z]of g.current)if(Zg(O,M))for(const F of z)try{F(R)}catch{}},[]),_=A.useCallback(async()=>{try{if(a.current)return;const O=t||Y_;if(!O){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const R=await $_({servers:O,token:s||G_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=R,d(!0);const M=R.subscribe("lt.>");o.current=M,(async()=>{for await(const z of M)try{const F=JSON.parse(F_.decode(z.data));E(z.subject,F)}catch{}})(),(async()=>{for await(const z of R.status())z.type==="disconnect"||z.type==="error"?d(!1):z.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(_,3e3)}},[E]);return A.useEffect(()=>(_(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[_]),h.jsx(I_.Provider,{value:{connected:f,subscribe:y},children:h.jsx(Xa.Provider,{value:{connected:f,subscribe:y},children:i})})}const Gn=Object.create(null);Gn.open="0";Gn.close="1";Gn.ping="2";Gn.pong="3";Gn.message="4";Gn.upgrade="5";Gn.noop="6";const Co=Object.create(null);Object.keys(Gn).forEach(i=>{Co[Gn[i]]=i});const If={type:"error",data:"parser error"},ey=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ty=typeof ArrayBuffer=="function",ny=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,dh=({type:i,data:t},s,a)=>ey&&t instanceof Blob?s?a(t):F0(t,a):ty&&(t instanceof ArrayBuffer||ny(t))?s?a(t):F0(new Blob([t]),a):a(Gn[i]+(t||"")),F0=(i,t)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];t("b"+(a||""))},s.readAsDataURL(i)};function J0(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let _f;function Q_(i,t){if(ey&&i.data instanceof Blob)return i.data.arrayBuffer().then(J0).then(t);if(ty&&(i.data instanceof ArrayBuffer||ny(i.data)))return t(J0(i.data));dh(i,!1,s=>{_f||(_f=new TextEncoder),t(_f.encode(s))})}const Q0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ba=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Q0.length;i++)Ba[Q0.charCodeAt(i)]=i;const K_=i=>{let t=i.length*.75,s=i.length,a,o=0,f,d,m,g;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const y=new ArrayBuffer(t),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ba[i.charCodeAt(a)],d=Ba[i.charCodeAt(a+1)],m=Ba[i.charCodeAt(a+2)],g=Ba[i.charCodeAt(a+3)],E[o++]=f<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},X_=typeof ArrayBuffer=="function",mh=(i,t)=>{if(typeof i!="string")return{type:"message",data:sy(i,t)};const s=i.charAt(0);return s==="b"?{type:"message",data:Z_(i.substring(1),t)}:Co[s]?i.length>1?{type:Co[s],data:i.substring(1)}:{type:Co[s]}:If},Z_=(i,t)=>{if(X_){const s=K_(i);return sy(s,t)}else return{base64:!0,data:i}},sy=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},iy="",W_=(i,t)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((f,d)=>{dh(f,!1,m=>{a[d]=m,++o===s&&t(a.join(iy))})})},ew=(i,t)=>{const s=i.split(iy),a=[];for(let o=0;o<s.length;o++){const f=mh(s[o],t);if(a.push(f),f.type==="error")break}return a};function tw(){return new TransformStream({transform(i,t){Q_(i,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let wf;function jo(i){return i.reduce((t,s)=>t+s.length,0)}function Ao(i,t){if(i[0].length===t)return i.shift();const s=new Uint8Array(t);let a=0;for(let o=0;o<t;o++)s[o]=i[0][a++],a===i[0].length&&(i.shift(),a=0);return i.length&&a<i[0].length&&(i[0]=i[0].slice(a)),s}function nw(i,t){wf||(wf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(jo(s)<1)break;const g=Ao(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(jo(s)<2)break;const g=Ao(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(jo(s)<8)break;const g=Ao(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(If);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(jo(s)<o)break;const g=Ao(s,o);m.enqueue(mh(f?g:wf.decode(g),t)),a=0}if(o===0||o>i){m.enqueue(If);break}}}})}const ry=4;function yt(i){if(i)return sw(i)}function sw(i){for(var t in yt.prototype)i[t]=yt.prototype[t];return i}yt.prototype.on=yt.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};yt.prototype.once=function(i,t){function s(){this.off(i,s),t.apply(this,arguments)}return s.fn=t,this.on(i,s),this};yt.prototype.off=yt.prototype.removeListener=yt.prototype.removeAllListeners=yt.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===t||a.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};yt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)t[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,t)}return this};yt.prototype.emitReserved=yt.prototype.emit;yt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};yt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Xo=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),wn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),iw="arraybuffer";function ay(i,...t){return t.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const rw=wn.setTimeout,aw=wn.clearTimeout;function Zo(i,t){t.useNativeTimers?(i.setTimeoutFn=rw.bind(wn),i.clearTimeoutFn=aw.bind(wn)):(i.setTimeoutFn=wn.setTimeout.bind(wn),i.clearTimeoutFn=wn.clearTimeout.bind(wn))}const lw=1.33;function ow(i){return typeof i=="string"?cw(i):Math.ceil((i.byteLength||i.size)*lw)}function cw(i){let t=0,s=0;for(let a=0,o=i.length;a<o;a++)t=i.charCodeAt(a),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(a++,s+=4);return s}function ly(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function uw(i){let t="";for(let s in i)i.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return t}function fw(i){let t={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");t[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return t}class hw extends Error{constructor(t,s,a){super(t),this.description=s,this.context=a,this.type="TransportError"}}class ph extends yt{constructor(t){super(),this.writable=!1,Zo(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,a){return super.emitReserved("error",new hw(t,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=mh(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=uw(t);return s.length?"?"+s:""}}class dw extends ph{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};ew(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,W_(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=ly()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let oy=!1;try{oy=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const mw=oy;function pw(){}class gw extends dw{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||a!==t.port}}doWrite(t,s){const a=this.request({method:"POST",data:t});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=t}}class $n extends yt{constructor(t,s,a){super(),this.createRequest=t,Zo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var t;const s=ay(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=$n.requestsCount++,$n.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=pw,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete $n.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}$n.requestsCount=0;$n.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",K0);else if(typeof addEventListener=="function"){const i="onpagehide"in wn?"pagehide":"unload";addEventListener(i,K0,!1)}}function K0(){for(let i in $n.requests)$n.requests.hasOwnProperty(i)&&$n.requests[i].abort()}const yw=(function(){const i=cy({xdomain:!1});return i&&i.responseType!==null})();class bw extends gw{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=yw&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new $n(cy,this.uri(),t)}}function cy(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||mw))return new XMLHttpRequest}catch{}if(!t)try{return new wn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const uy=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class xw extends ph{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,a=uy?{}:ay(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;dh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=ly()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Sf=wn.WebSocket||wn.MozWebSocket;class vw extends xw{createSocket(t,s,a){return uy?new Sf(t,s,a):s?new Sf(t,s):new Sf(t)}doWrite(t,s){this.ws.send(s)}}class _w extends ph{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=nw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=t.readable.pipeThrough(s).getReader(),o=tw();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;this._writer.write(a).then(()=>{o&&Xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ww={websocket:vw,webtransport:_w,polling:bw},Sw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ew=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ff(i){if(i.length>8e3)throw"URI too long";const t=i,s=i.indexOf("["),a=i.indexOf("]");s!=-1&&a!=-1&&(i=i.substring(0,s)+i.substring(s,a).replace(/:/g,";")+i.substring(a,i.length));let o=Sw.exec(i||""),f={},d=14;for(;d--;)f[Ew[d]]=o[d]||"";return s!=-1&&a!=-1&&(f.source=t,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=jw(f,f.path),f.queryKey=Aw(f,f.query),f}function jw(i,t){const s=/\/{2,9}/g,a=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&a.splice(0,1),t.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Aw(i,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Jf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Mo=[];Jf&&addEventListener("offline",()=>{Mo.forEach(i=>i())},!1);class Ws extends yt{constructor(t,s){if(super(),this.binaryType=iw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const a=Ff(t);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Ff(s.host).host);Zo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=fw(this.opts.query)),Jf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Mo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=ry,s.transport=t,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Ws.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Ws.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=ow(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Xo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,a){return this._sendPacket("message",t,s,a),this}send(t,s,a){return this._sendPacket("message",t,s,a),this}_sendPacket(t,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:t,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():t()}):this.upgrading?a():t()),this}_onError(t){if(Ws.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Jf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Mo.indexOf(this._offlineEventListener);a!==-1&&Mo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}Ws.protocol=ry;class Ow extends Ws{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),a=!1;Ws.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",_=>{if(!a)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Ws.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=s.name,this.emitReserved("upgradeError",O)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const d=_=>{const O=new Error("probe error: "+_);O.transport=s.name,f(),this.emitReserved("upgradeError",O)};function m(){d("transport closed")}function g(){d("socket closed")}function y(_){s&&_.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",d),s.once("close",m),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let a=0;a<t.length;a++)~this.transports.indexOf(t[a])&&s.push(t[a]);return s}}let Nw=class extends Ow{constructor(t,s={}){const a=typeof t=="object"?t:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>ww[o]).filter(o=>!!o)),super(t,a)}};function Tw(i,t="",s){let a=i;s=s||typeof location<"u"&&location,i==null&&(i=s.protocol+"//"+s.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=s.protocol+i:i=s.host+i),/^(https?|wss?):\/\//.test(i)||(typeof s<"u"?i=s.protocol+"//"+i:i="https://"+i),a=Ff(i)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+t,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const kw=typeof ArrayBuffer=="function",Cw=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,fy=Object.prototype.toString,Mw=typeof Blob=="function"||typeof Blob<"u"&&fy.call(Blob)==="[object BlobConstructor]",Rw=typeof File=="function"||typeof File<"u"&&fy.call(File)==="[object FileConstructor]";function gh(i){return kw&&(i instanceof ArrayBuffer||Cw(i))||Mw&&i instanceof Blob||Rw&&i instanceof File}function Ro(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Ro(i[s]))return!0;return!1}if(gh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Ro(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Ro(i[s]))return!0;return!1}function Dw(i){const t=[],s=i.data,a=i;return a.data=Qf(s,t),a.attachments=t.length,{packet:a,buffers:t}}function Qf(i,t){if(!i)return i;if(gh(i)){const s={_placeholder:!0,num:t.length};return t.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=Qf(i[a],t);return s}else if(typeof i=="object"&&!(i instanceof Date)){const s={};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=Qf(i[a],t));return s}return i}function qw(i,t){return i.data=Kf(i.data,t),delete i.attachments,i}function Kf(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=Kf(i[s],t);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=Kf(i[s],t));return i}const zw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Be;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Be||(Be={}));class Uw{constructor(t){this.replacer=t}encode(t){return(t.type===Be.EVENT||t.type===Be.ACK)&&Ro(t)?this.encodeAsBinary({type:t.type===Be.EVENT?Be.BINARY_EVENT:Be.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Be.BINARY_EVENT||t.type===Be.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=Dw(t),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class yh extends yt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const a=s.type===Be.BINARY_EVENT;a||s.type===Be.BINARY_ACK?(s.type=a?Be.EVENT:Be.ACK,this.reconstructor=new Bw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(gh(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const a={type:Number(t.charAt(0))};if(Be[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Be.BINARY_EVENT||a.type===Be.BINARY_ACK){const f=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(f,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Lw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(t.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););a.nsp=t.substring(f,s)}else a.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}a.id=Number(t.substring(f,s+1))}if(t.charAt(++s)){const f=this.tryParse(t.substr(s));if(yh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Be.CONNECT:return X0(s);case Be.DISCONNECT:return s===void 0;case Be.CONNECT_ERROR:return typeof s=="string"||X0(s);case Be.EVENT:case Be.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&zw.indexOf(s[0])===-1);case Be.ACK:case Be.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Bw{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=qw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Lw=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function X0(i){return Object.prototype.toString.call(i)==="[object Object]"}const Pw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:yh,Encoder:Uw,get PacketType(){return Be}},Symbol.toStringTag,{value:"Module"}));function Cn(i,t,s){return i.on(t,s),function(){i.off(t,s)}}const Hw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class hy extends yt{constructor(t,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Cn(t,"open",this.onopen.bind(this)),Cn(t,"packet",this.onpacket.bind(this)),Cn(t,"error",this.onerror.bind(this)),Cn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var a,o,f;if(Hw.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Be.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,_=s.pop();this._registerAckCallback(E,_),d.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===t&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((a,o)=>{const f=(d,m)=>d?o(d):a(m);f.withError=!0,s.push(f),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(a=>String(a.id)===t)){const a=this.acks[t];delete this.acks[t],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Be.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Be.EVENT:case Be.BINARY_EVENT:this.onevent(t);break;case Be.ACK:case Be.BINARY_ACK:this.onack(t);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:Be.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,t.data)}}}function Dr(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Dr.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};Dr.prototype.reset=function(){this.attempts=0};Dr.prototype.setMin=function(i){this.ms=i};Dr.prototype.setMax=function(i){this.max=i};Dr.prototype.setJitter=function(i){this.jitter=i};class Xf extends yt{constructor(t,s){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Zo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Dr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||Pw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Nw(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Cn(s,"open",function(){a.onopen(),t&&t()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),t?t(m):this.maybeReconnectOnOpen()},d=Cn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},m);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Cn(t,"ping",this.onping.bind(this)),Cn(t,"data",this.ondata.bind(this)),Cn(t,"error",this.onerror.bind(this)),Cn(t,"close",this.onclose.bind(this)),Cn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Xo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new hy(this,t,s),this.nsps[t]=a),a}_destroy(t){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let a=0;a<s.length;a++)this.engine.write(s[a],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ma={};function Do(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const s=Tw(i,t.path||"/socket.io"),a=s.source,o=s.id,f=s.path,d=Ma[o]&&f in Ma[o].nsps,m=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return m?g=new Xf(a,t):(Ma[o]||(Ma[o]=new Xf(a,t)),g=Ma[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(Do,{Manager:Xf,Socket:hy,io:Do,connect:Do});const $w=A.createContext({connected:!1,subscribe:()=>()=>{}});function Yw({children:i}){const t=A.useRef(null),[s,a]=A.useState(!1),o=A.useRef(new Map),f=A.useCallback((m,g)=>{const y=o.current;return y.has(m)||y.set(m,new Set),y.get(m).add(g),()=>{const E=y.get(m);E&&(E.delete(g),E.size===0&&y.delete(m))}},[]),d=A.useCallback((m,g)=>{for(const[y,E]of o.current)if(Zg(m,y))for(const _ of E)try{_(g)}catch{}},[]);return A.useEffect(()=>{const m=Mg(),g=Do({path:`${Tt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const _=typeof E=="string"?JSON.parse(E):E;d(y,_)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,a(!1)}},[d]),h.jsx($w.Provider,{value:{connected:s,subscribe:f},children:h.jsx(Xa.Provider,{value:{connected:s,subscribe:f},children:i})})}function Gw({children:i}){const[t,s]=A.useState(null),[a,o]=A.useState({url:null,token:null});return A.useEffect(()=>{let f=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Tt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(m=y==null?void 0:y.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let _=y.events.natsWsUrl??null,O=null;const R=Mg();if(R)try{const M=await fetch(`${Tt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${R}`}});if(M.ok){const z=await M.json();_=z.natsWsUrl??_,O=z.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:_,token:O})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return d(),()=>{f=!0}},[]),t==="nats"?h.jsx(J_,{url:a.url,token:a.token,children:i}):t==="socketio"?h.jsx(Yw,{children:i}):h.jsx(h.Fragment,{children:i})}const bh="lt_view_as",xh="lt_ai_override",Zf="lt_graph_enabled";function dy(){try{const i=localStorage.getItem(xh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Vw(i){try{localStorage.setItem(xh,String(i))}catch{}}function Iw(){try{localStorage.removeItem(xh)}catch{}}function vh(){try{const i=localStorage.getItem(bh);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function Fw(i){try{localStorage.setItem(bh,i)}catch{}window.location.reload()}function Wf(){try{localStorage.removeItem(bh)}catch{}window.location.reload()}function my(){try{return localStorage.getItem(Zf)==="true"}catch{return!1}}function Jw(i){try{i?localStorage.setItem(Zf,"true"):localStorage.removeItem(Zf)}catch{}}function py(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=Vn(),a=vh(),o=i||s("engineer"),f=t("admin"),d=i||t("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":f,canBulk:a?a==="admin":d,viewAs:a,realIsBuilder:o}}function gy(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=Vn(),a=i?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",o=vh(),f=o==="admin"||o==="engineer"||o==="operator"?o:null,d=f??a;return{tier:d,realTier:a,viewAs:f,canSeePaceBoard:d==="superadmin"||d==="admin",canSeeWorkflows:d==="superadmin"||d==="engineer",showTaskQueueCards:d==="operator"}}const Qw="lt_ai_override";function Kw(){return we("/settings")}function Xw(){try{if(localStorage.getItem(Qw)==="off")return!1}catch{}return null}function Mi(){var s;const i=ht({queryKey:["settings"],queryFn:Kw,staleTime:1/0}),t=Xw();return i.data&&t===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const _h=A.createContext(null),Ef="lt_sidebar_collapsed",yy="(max-width: 1023px)";function Zw(){try{return window.matchMedia(yy).matches}catch{return!1}}function Ww({children:i}){const[t,s]=A.useState(()=>{if(Zw())return!0;try{return localStorage.getItem(Ef)==="true"}catch{return!1}});A.useEffect(()=>{let o;try{o=window.matchMedia(yy)}catch{return}const f=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(Ef)==="true")}catch{s(!1)}};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=A.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(Ef,String(f))}catch{}return f})},[]);return h.jsx(_h.Provider,{value:{collapsed:t,toggle:a},children:i})}function eS({children:i}){return h.jsx(_h.Provider,{value:{collapsed:!1,toggle:()=>{}},children:i})}function wh(){const i=A.useContext(_h);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}const Z0=380,Sh=A.createContext(null);function tS({children:i}){const[t,s]=A.useState({node:null,width:Z0,open:!1,ownerKey:null}),a=Sn(),o=A.useRef(a.pathname),f=A.useCallback((m,g)=>{s({node:m,width:(g==null?void 0:g.width)??Z0,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=A.useCallback(m=>{s(g=>typeof m=="string"&&g.ownerKey!==m?g:{...g,open:!1})},[]);return A.useEffect(()=>{a.pathname!==o.current&&(o.current=a.pathname,s(m=>m.open||m.node?{...m,node:null,open:!1,ownerKey:null}:m))},[a.pathname]),h.jsx(Sh.Provider,{value:{...t,setPanel:f,closePanel:d},children:i})}function nS(){const i=A.useContext(Sh);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function Hj(){return A.useContext(Sh)}function sS({open:i,width:t=380,children:s,className:a=""}){const[o,f]=A.useState(i);return A.useEffect(()=>{i&&f(!0)},[i]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${a}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!i&&d.propertyName==="width"&&f(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function $j({label:i,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:i}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function Yj({views:i,activeId:t,onViewChange:s,onClose:a,headerActions:o,stickyClassName:f}){const d=i.find(m=>m.id===t)??i[0];return d?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${f??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:"flex items-center justify-between pl-4 pr-3 pt-3 shrink-0",children:[h.jsx("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":"Panel view",children:i.map(m=>{const g=m.icon,y=m.id===d.id;return h.jsx("button",{role:"radio","aria-checked":y,onClick:()=>s(m.id),title:m.label,className:`p-1.5 rounded-md transition-colors ${y?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.jsx(g,{className:"w-3.5 h-3.5"})},m.id)})}),h.jsxs("div",{className:"flex items-center gap-1",children:[o,a&&h.jsx("button",{onClick:a,title:"Close panel",className:"p-1 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors",children:h.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:d.label}),h.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5 pt-1",children:d.content})]})}):null}function by(i,t){var s,a,o,f,d;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&i.set("block",JSON.stringify(t.block)),(a=t.range)!=null&&a.length&&i.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&i.set("exists",JSON.stringify(t.exists)),(f=t.roles)!=null&&f.length&&i.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function Gj(i,t){const s=i??"24h";return ht({queryKey:["stationMetrics",s],queryFn:()=>we(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function Vj(i){const t=i?`?period=${i}`:"";return ht({queryKey:["escalationStats",i],queryFn:()=>we(`/escalations/stats${t}`)})}function Ij(){return ht({queryKey:["escalationTypes"],queryFn:()=>we("/escalations/types")})}function Fj(i=!0){return ht({queryKey:["escalationFacetKeys"],queryFn:()=>we("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function xy(i){const{enabled:t=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),by(o,a),ht({queryKey:["escalations",a],queryFn:()=>we(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function vy(i){const{enabled:t=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),by(o,a),ht({queryKey:["escalations","available",a],queryFn:()=>we(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Jj(i){return ht({queryKey:["escalations","by-workflow",i],queryFn:()=>we(`/escalations/by-workflow/${i}`),enabled:!!i})}function Qj(i){return ht({queryKey:["escalations",i],queryFn:()=>we(`/escalations/${i}`),enabled:!!i})}function Kj(){const i=bt();return Et({mutationFn:({id:t,durationMinutes:s})=>we(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function Xj(){const i=bt();return Et({mutationFn:t=>we(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function Zj(){const i=bt();return Et({mutationFn:({id:t,resolverPayload:s})=>we(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function Wj(){const i=bt();return Et({mutationFn:({id:t,targetRole:s})=>we(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function eA(){const i=bt();return Et({mutationFn:({ids:t,priority:s})=>we("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function tA(){const i=bt();return Et({mutationFn:({ids:t,durationMinutes:s})=>we("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function nA(){const i=bt();return Et({mutationFn:({ids:t,targetUserId:s,durationMinutes:a})=>we("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function sA(){const i=bt();return Et({mutationFn:({ids:t,targetRole:s})=>we("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:t,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function iA(){const i=bt();return Et({mutationFn:({ids:t,hint:s})=>we("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function rA(){const i=bt();return Et({mutationFn:t=>we(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function aA(){const i=bt();return Et({mutationFn:({ids:t})=>we("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function iS(){const{user:i}=Vn(),t=i==null?void 0:i.userId,s=bt(),a=A.useRef(null),o=A.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);Wg(`${Xg}.system.escalation.>`,o);const{data:f}=vy({limit:1}),{data:d}=xy({assigned_to:t,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(d==null?void 0:d.total)??0}}function Yo({size:i="sm",hideLabel:t=!1,className:s="",appName:a="LongTail",variant:o="full"}){const f=i==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":a,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Tt}/logo512.png)`,width:"120px",height:"120px",top:"-25px",left:"-90px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":a,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Tt}/logo512.png)`}})});const d=f?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",m=f?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":a,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${Tt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${m} ${t?"opacity-0":""}`,children:a})]})}const rS=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],aS=["operator","engineer","admin","superadmin"];function W0(i){return aS.indexOf(i)}function lS(i,t){return W0(i)>=W0(t)}function oS({onClose:i}){var re,Oe,ke,Se,q,ne;const{isSuperAdmin:t,hasRoleType:s,hasRole:a}=Vn(),{data:o}=Mi(),f=vh(),d=!!((re=o==null?void 0:o.ai)!=null&&re.enabled),m=dy(),g=m!==null?m:d,[y,E]=A.useState(g),_=(Oe=o==null?void 0:o.features)==null?void 0:Oe.graphWorkflows,O=_==null,[R,M]=A.useState(_===!0||O&&my()),z=t?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",F=((ke=o==null?void 0:o.branding)==null?void 0:ke.appName)??"LongTail",ie=(Se=o==null?void 0:o.environment)==null?void 0:Se.longTailVersion,$=(q=o==null?void 0:o.environment)==null?void 0:q.hotmeshVersion,ce=(ne=o==null?void 0:o.environment)==null?void 0:ne.nodeEnv;A.useEffect(()=>{const se=ge=>{ge.key==="Escape"&&i()};return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[i]);const ee=rS.filter(se=>lS(z,se.minTier)),T=ee.length>1,Q=[...T?[{id:"viewas",label:"View As",icon:rv}]:[],{id:"features",label:"Features",icon:av}],[le,I]=A.useState(Q[0].id),V=se=>{se===null?Wf():Fw(se)},W=()=>{const se=!y;E(se),se===d?Iw():Vw(se),window.location.reload()},oe=()=>{const se=!R;M(se),Jw(se),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:se=>se.stopPropagation(),children:[h.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Yn,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Tt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:F}),ie&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",ie,$&&h.jsxs(h.Fragment,{children:[" · HotMesh v",$]}),ce&&ce!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:ce})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),Q.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Q.map(se=>{const ge=le===se.id;return h.jsxs("button",{role:"tab","aria-selected":ge,onClick:()=>I(se.id),title:se.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${ge?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(se.icon,{className:"w-5 h-5",strokeWidth:1.5,...ge?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:se.label})]},se.id)})}),le==="viewas"&&T&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),ee.map(se=>{const ge=f===se.id,be=se.id===null?`Your view · ${z}`:se.label;return h.jsxs("button",{onClick:()=>V(se.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${ge?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:ge&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${ge?"text-accent":"text-text-primary group-hover:text-accent"}`,children:be}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:se.description})]})]},String(se.id))})]}),le==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:W,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:y?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${y?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${y?"translate-x-4":"translate-x-0"}`})})]}),O&&h.jsxs("button",{onClick:oe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:R?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${R?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${R?"translate-x-4":"translate-x-0"}`})})]})]}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const _y=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],eg="blue",wy="lt.theme";let Sy=[];function cS(i){const t=new Set(_y.map(a=>a.id)),s=new Set;Sy=i.filter(a=>!(a!=null&&a.id)||t.has(a.id)||s.has(a.id)?!1:(s.add(a.id),!0))}function uS(){return[..._y,...Sy]}function Ey(){try{return localStorage.getItem(wy)||eg}catch{return eg}}function jy(i){document.documentElement.dataset.theme=i}function fS(i){try{localStorage.setItem(wy,i)}catch{}jy(i)}const Ay="lt:bookmarks";function hS(){try{const i=localStorage.getItem(Ay);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function tg(i){try{localStorage.setItem(Ay,JSON.stringify(i))}catch{}}function dS({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:s}){var ke,Se;const a=th(),{user:o,logout:f}=Vn(),{isBuilder:d,isOps:m,viewAs:g,realIsBuilder:y}=py(),{available:E,mine:_}=iS();gy();const{connected:O}=V_(),{data:R}=Mi(),M=Sn(),[z,F]=A.useState(!1),[ie,$]=A.useState(!1),[ce,ee]=A.useState(Ey),[T,Q]=A.useState(hS),le=A.useRef(null),I=(ke=R==null?void 0:R.branding)==null?void 0:ke.appName,V=(Se=R==null?void 0:R.branding)==null?void 0:Se.themes,W=A.useMemo(()=>(cS(V??[]),uS()),[V]),oe=q=>{fS(q),ee(q)},re=()=>{const q=window.prompt("Bookmark label:");if(!(q!=null&&q.trim()))return;const ne=M.pathname+M.search,se=[...T,{label:q.trim(),url:ne}].sort((ge,be)=>ge.label.localeCompare(be.label));Q(se),tg(se),F(!1)},Oe=q=>{const ne=T.filter(se=>!(se.label===q.label&&se.url===q.url));Q(ne),tg(ne)};return A.useEffect(()=>{if(!z)return;const q=ne=>{le.current&&!le.current.contains(ne.target)&&F(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[z]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${z?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(lv,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsxs(Ni,{to:"/","aria-label":"Home",className:"shrink-0",onClick:q=>{(q.ctrlKey||q.metaKey)&&(q.preventDefault(),$(!0))},children:[h.jsx(Yo,{appName:I,className:"hidden lg:flex"}),h.jsx(Yo,{appName:I,variant:"comet",className:"flex lg:hidden"})]}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>a(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(jg,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>a(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(Nf,{className:"w-5 h-5",strokeWidth:2})})]}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(Ni,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${E>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(Tf,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),E>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:E})]}),h.jsxs(Ni,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${_>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(Tf,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),_>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:_})]}),(d||m)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),h.jsxs("button",{type:"button",onClick:()=>{O?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${O?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:O?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[h.jsx(Ag,{className:"w-4 h-4",strokeWidth:1.5}),"events"]})]}),y&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(Og,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Wf,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Yn,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:le,children:[h.jsxs("button",{onClick:()=>F(q=>!q),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(ov,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),z&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(Ni,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),(d||m)&&h.jsx("button",{onClick:()=>{F(!1),O?i==null||i():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:O?"Events":"Reconnect events"}),y&&h.jsx("button",{onClick:()=>{F(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Wf()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:W.map(q=>h.jsx("button",{type:"button",onClick:()=>oe(q.id),title:q.label,"aria-label":`${q.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${ce===q.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:q.swatch}},q.id))})]}),h.jsx("button",{onClick:()=>{F(!1),f()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[T.map(q=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Ni,{to:q.url,onClick:()=>F(!1),title:q.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:q.label}),h.jsx("button",{type:"button",onClick:()=>Oe(q),title:`Remove "${q.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Yn,{className:"w-3 h-3"})})]},`${q.label}::${q.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(cv,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),ie&&h.jsx(oS,{onClose:()=>$(!1)})]})}function Eh({open:i,children:t}){const[s,a]=A.useState(i);return A.useEffect(()=>{i&&a(!0)},[i]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||a(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function eh(i){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${s} justify-center w-10 h-10 mx-auto ${t?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?a:o}`}}function mS(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function pS({group:i,collapsed:t}){const{pathname:s}=Sn(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,f]=A.useState(a),d=o||a;return t?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx(Tr,{to:m.to,className:eh(!0),title:m.label,children:m.icon&&h.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>f(m=>!m),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:i.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Eh,{open:d,children:i.items.map(m=>h.jsxs(Tr,{to:m.to,end:m.end,className:mS(),children:[m.icon&&h.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:m.label})]},m.to))})]})}function gS(i){return i.kind==="group"}function yS({entry:i,collapsed:t}){const{pathname:s,search:a}=Sn(),o=i.to.includes("?"),f=i.icon&&h.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(o){const[d,m]=i.to.split("?"),g=s===d&&a===`?${m}`,y=eh(t)({isActive:g});return h.jsxs(Tr,{to:i.to,className:y,title:t?i.label:void 0,children:[f,!t&&h.jsx("span",{children:i.label})]})}return h.jsxs(Tr,{to:i.to,end:i.end,className:eh(t),title:t?i.label:void 0,children:[f,!t&&h.jsx("span",{children:i.label})]})}function ki({heading:i,entries:t}){const{collapsed:s}=wh();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(a=>gS(a)?h.jsx(pS,{group:a,collapsed:s},a.label):h.jsx(yS,{entry:a,collapsed:s},a.to))]})}function bS({aiEnabled:i=!1,isBuilder:t=!1,isOps:s=!1,viewAs:a=null,canSeePaceBoard:o=!1}){const f={to:"/operations",label:"Pace Board",icon:uv};if(!t&&(!s||a==="engineer"||a==="operator"))return null;if(!t)return h.jsx(ki,{heading:"Monitor",entries:o?[f]:[]});const d=[...o?[f]:[],{to:"/topics",label:"Event Topics",icon:Ag},{to:"/agents",label:i?"Agents":"Automations",icon:fv},{to:"/capabilities",label:"Capabilities",icon:hv}];return h.jsx(ki,{heading:"Monitor",entries:d})}function lA(){return ht({queryKey:["roles"],queryFn:()=>we("/roles")})}function oA(){return ht({queryKey:["roles","escalation-chains"],queryFn:()=>we("/roles/escalation-chains")})}function cA(i){return ht({queryKey:["roles",i,"escalation-targets"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/escalation-targets`),enabled:!!i})}function uA(){const i=bt();return Et({mutationFn:t=>we("/roles/escalation-chains",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function fA(){const i=bt();return Et({mutationFn:t=>we("/roles/escalation-chains",{method:"DELETE",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function xS(i){return ht({queryKey:["roles","details"],queryFn:()=>we("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function hA(i,t,s=!0){return ht({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function dA(i){return ht({queryKey:["roles",i,"schema-versions"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function mA(i,t,s=!0){return ht({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function pA(i){return ht({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function gA(){const i=bt();return Et({mutationFn:t=>we("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function yA(){const i=bt();return Et({mutationFn:({role:t,...s})=>we(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await i.cancelQueries({queryKey:["roles","details"]});const a=i.getQueryData(["roles","details"]);return a&&i.setQueryData(["roles","details"],{roles:a.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:a}},onError:(t,s,a)=>{a!=null&&a.previous&&i.setQueryData(["roles","details"],a.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function bA(){const i=bt();return Et({mutationFn:t=>we(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function vS(){return ht({queryKey:["me","preferences"],queryFn:()=>we("/me/preferences"),staleTime:6e4})}function _S(){const i=bt();return Et({mutationFn:t=>we("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}const vr=i=>{if(i)try{return JSON.parse(i)}catch{return}},Ai=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function wS(i){const t={},s=vr(i.get("facets"));Ai(s)||(t.facets=s);const a=vr(i.get("block"));Ai(a)||(t.block=a);const o=vr(i.get("range"));Ai(o)||(t.range=o);const f=vr(i.get("exists"));Ai(f)||(t.exists=f);const d=vr(i.get("roles"));Ai(d)||(t.roles=d);const m=vr(i.get("orderBy"));Ai(m)||(t.orderBy=m),i.get("available")!=null&&(t.available=i.get("available")==="true");const g=i.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function xA(i,t){const s=(a,o)=>Ai(o)?i.delete(a):i.set(a,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}function vA(i,t,s){const a=typeof t=="object"&&t!==null?JSON.stringify(t):t,o=encodeURIComponent(JSON.stringify({[i]:a}));return s?`/escalations/available?role=${encodeURIComponent(s)}&facets=${o}&status=all`:`/escalations/available?facets=${o}&status=all`}function _A(i){var t,s,a;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((s=i.range)==null?void 0:s.length)??0)+(((a=i.exists)==null?void 0:a.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function SS(i,t){const s=(i==null?void 0:i.pinnedViews)??[],a=new Set((i==null?void 0:i.hiddenRolePins)??[]),o=new Set(s.map(m=>m.label)),f=[...s],d=new Set;for(const{role:m,pins:g}of t)for(const y of g)o.has(y.label)||a.has(y.label)||d.has(y.label)||(d.add(y.label),f.push({...y,id:`role:${m}:${y.label}`,fromRole:m}));return f}function ES(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,a=wS(s),o=s.get("status")||void 0,f=t.pathname==="/escalations/available"&&(o===void 0||o==="available");return{available:f,params:{...a,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:f||o==="all"?void 0:o,search:s.get("search")||void 0}}}function jS(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function AS(){var ie;const{collapsed:i}=wh(),{user:t}=Vn(),s=vS(),a=_S(),o=A.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map($=>$.role)),[t]),{data:f}=xS({enabled:o.size>0}),d=bt();Wg(`${Xg}.system.escalation.>`,()=>{d.invalidateQueries({queryKey:["escalations"]})});const m=(ie=s.data)==null?void 0:ie.preferences,g=A.useMemo(()=>((f==null?void 0:f.roles)??[]).filter($=>o.has($.role)&&Array.isArray($.default_pins)&&$.default_pins.length>0).map($=>({role:$.role,pins:$.default_pins})),[f,o]),y=A.useMemo(()=>SS(m,g),[m,g]),E=(m==null?void 0:m.pinnedViews)??[],_=A.useRef(null),O=$=>a.mutate({pinnedViews:$}),R=$=>O(E.filter(ce=>ce.id!==$)),M=$=>O([...E,{id:jS(),label:$.label,url:$.url,badge:$.badge}]),z=$=>a.mutate({hiddenRolePins:[...(m==null?void 0:m.hiddenRolePins)??[],$]}),F=($,ce)=>{if($===ce)return;const ee=[...E],[T]=ee.splice($,1);ee.splice(ce,0,T),O(ee)};return y.length===0?null:h.jsxs("div",{className:"space-y-1",children:[i?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:"Pinned"}),y.map($=>{const ce=$.fromRole?-1:E.findIndex(ee=>ee.id===$.id);return h.jsx(OS,{pin:$,collapsed:i,draggable:ce!==-1,onDragStart:()=>{_.current=ce},onDropOn:()=>{_.current!==null&&ce!==-1&&F(_.current,ce),_.current=null},onRemove:$.fromRole?void 0:()=>R($.id),onPromote:$.fromRole?()=>M($):void 0,onHide:$.fromRole?()=>z($.label):void 0},$.id)})]})}function OS({pin:i,collapsed:t,draggable:s,onDragStart:a,onDropOn:o,onRemove:f,onPromote:d,onHide:m}){const{pathname:g,search:y}=Sn(),[E,_=""]=i.url.split("?"),O=g===E&&y===(_?`?${_}`:""),R="group flex items-center rounded-md transition-colors duration-150",M=O?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Tr,{to:i.url,className:`${R} ${M} justify-center w-10 h-10 mx-auto`,title:i.label,children:h.jsx(d0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${R} ${M}`,draggable:s,onDragStart:a,onDragOver:z=>z.preventDefault(),onDrop:o,children:[h.jsxs(Tr,{to:i.url,className:"flex items-center gap-3 pl-4 py-2 text-sm flex-1 min-w-0",children:[h.jsx(d0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate",children:i.label}),i.badge&&h.jsx(NS,{url:i.url}),i.fromRole&&h.jsx("span",{className:"shrink-0 text-2xs uppercase tracking-wider text-text-quaternary",title:`Provided by the ${i.fromRole} role`,children:"role"})]}),h.jsxs("span",{className:"flex items-center pr-2 gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(Ng,{className:"w-3 h-3"})}),m&&h.jsx("button",{onClick:m,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(dv,{className:"w-3 h-3"})}),f&&h.jsx("button",{onClick:f,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Yn,{className:"w-3 h-3"})})]})]})}function NS({url:i}){var d;const t=A.useMemo(()=>ES(i),[i]),s={limit:1,staleTime:15e3},a=vy({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=xy({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const f=t.available?a:o;return f.isError||((d=f.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-accent/10 text-accent text-2xs font-semibold tabular-nums",children:f.data.total})}function TS(){var f;const{data:i}=Mi(),t=(f=i==null?void 0:i.features)==null?void 0:f.graphWorkflows,s=t===!0||t!==!1&&my(),a=[{to:"/workflows/registry",label:"Registry",icon:m0},{to:"/workflows/durable/invoke",label:"Invoke",icon:p0},{to:"/workflows/executions",label:"Executions",icon:g0}],o=s?[{kind:"group",label:"Procedural",icon:mv,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:a},{kind:"group",label:"Graph",icon:nh,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:m0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:p0},{to:"/mcp/executions",label:"Executions",icon:g0}]}]:a;return h.jsx(ki,{heading:"Orchestrate",entries:o})}const kS=[{to:"/mcp/queries",label:"Designer",icon:pv},{to:"/mcp/servers",label:"Servers & Tools",icon:gv}];function CS(){return h.jsx(ki,{heading:"Design",entries:kS})}const MS=[{to:"/files",label:"Files",icon:yv},{to:"/knowledge",label:"Knowledge",icon:bv}];function RS(){return h.jsx(ki,{heading:"Storage",entries:MS})}function DS({isBuilder:i=!1,isOps:t=!1}){var d;const{data:s}=Mi(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:xv},...i||t?[{to:"/admin/roles",label:"Roles",icon:Tf}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:vv},{to:"/admin/streams",label:"Messages",icon:_v},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:wv}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(ki,{heading:"Identity & Access",entries:o}),i&&h.jsx(ki,{heading:"Infrastructure",entries:f})]})}function Oy({aiEnabled:i,isBuilder:t,isOps:s,viewAs:a,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(bS,{aiEnabled:i,isBuilder:t,isOps:s,viewAs:a,canSeePaceBoard:o}),h.jsx(AS,{}),t&&h.jsx(TS,{}),t&&i&&h.jsx(CS,{}),t&&h.jsx(RS,{}),(t||s)&&h.jsx(DS,{isBuilder:t,isOps:s})]})}function qS({open:i,onClose:t,...s}){const a=Sn();return A.useEffect(()=>{t()},[a.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${i?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Yn,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(eS,{children:h.jsx(Oy,{...s})})})]})]})}const Ny="lt_event_feed_patterns";function zS(i){if(i.startsWith("/topics/")){const f=decodeURIComponent(i.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const t=i.match(/^\/escalations\/detail\/(.+)/);if(t)return`lt.events.system.escalation.${t[1]}.>`;if(i.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=i.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const o=i.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function US(){try{const i=localStorage.getItem(Ny);return i?JSON.parse(i):[]}catch{return[]}}function jf(i){try{localStorage.setItem(Ny,JSON.stringify(i))}catch{}}function BS(){const{pathname:i}=Sn(),[t,s]=A.useState(US),a=A.useMemo(()=>zS(i),[i]),o=A.useMemo(()=>{const g=new Set([a,...t]);return Array.from(g)},[a,t]),f=A.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const _=[...E,y];return jf(_),_})},[]),d=A.useCallback(g=>{s(y=>{const E=y.filter(_=>_!==g);return jf(E),E})},[]),m=A.useCallback(()=>{s([]),jf([])},[]);return{patterns:o,pagePattern:a,userPatterns:t,addPattern:f,removePattern:d,clearUserPatterns:m}}function LS({children:i,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Af=280,ng="cubic-bezier(0.4, 0, 0.2, 1)",Oo=40;function PS(i){if(!i)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,a=t-Oo*2,o=s-Oo*2,f=i.width/a,d=i.height/o,m=i.left+i.width/2-(Oo+a/2),g=i.top+i.height/2-(Oo+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${d})`}function Ty({open:i,onClose:t,sourceRef:s,children:a}){const[o,f]=A.useState(null),d=A.useRef(null),m=A.useRef(!1);A.useEffect(()=>{var O,R;i&&!m.current?(d.current=((O=s==null?void 0:s.current)==null?void 0:O.getBoundingClientRect())??null,f("entering")):!i&&m.current&&o==="open"&&(d.current=((R=s==null?void 0:s.current)==null?void 0:R.getBoundingClientRect())??null,f("exiting")),m.current=i},[i,s,o]),A.useEffect(()=>{if(o!=="entering")return;const O=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(O)},[o]),A.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),A.useEffect(()=>{if(!o)return;const O=R=>{R.key==="Escape"&&t()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,t]);const g=A.useCallback(O=>{O.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(A.useEffect(()=>{if(o!=="exiting")return;const O=setTimeout(()=>f(null),Af+50);return()=>clearTimeout(O)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?PS(d.current):"none",_=y?0:1;return Eg.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Af}ms ${ng}, opacity ${Af}ms ${ng}`,transform:E,opacity:_,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:a}),document.body)}function HS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function $S({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function YS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function GS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function VS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function IS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function FS(i){const t=i.trim().split(`
|
|
53
|
+
${m.stack}`),d.reject(y)):d.resolve(E))}});return g.requestSubject=t,this.protocol.publish(t,s,{reply:f,headers:a.headers}),d}else{const f=new Lg(this.protocol.muxSubscriptions,t,a,o);this.protocol.request(f);try{this.publish(t,s,{reply:`${this.protocol.muxSubscriptions.baseInbox}${f.token}`,headers:a.headers})}catch(m){f.cancel(m)}const d=Promise.race([f.timer,f.deferred]);return d.catch(()=>{f.cancel()}),d}}flush(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.isDraining()?Promise.reject(he.errorForCode(ae.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new St;return t.iterClosed.then(()=>{const s=this.listeners.indexOf(t);this.listeners.splice(s,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((s,a)=>s==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const s=new E_(this,t);if(t.checkAPI!==!1)try{await s.getAccountInfo()}catch(a){const o=a;throw o.code===ae.NoResponders&&(o.code=ae.JetStreamNotEnabled),o}return s}jetstream(t={}){return new fh(this,t)}getServerVersion(){const t=this.info;return t?Ti(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw he.errorForCode(ae.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new N_(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(he.errorForCode(ae.ConnectionClosed)):this.isDraining()?Promise.reject(he.errorForCode(ae.ConnectionDraining)):this.protocol.reconnect()}}class N_{constructor(t){v(this,"nc");this.nc=t}add(t){try{return new Ka(this.nc,t).start()}catch(s){return Promise.reject(s)}}client(t,s){return new l_(this.nc,t,s)}}class T_{constructor(t,s,a){v(this,"bucket");v(this,"sm");v(this,"prefixLen");this.bucket=t,this.prefixLen=s,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get($o)||"PUT"}get length(){const t=this.sm.header.get(Bt.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class k_{constructor(t,s,a){v(this,"bucket");v(this,"key");v(this,"sm");this.bucket=t,this.key=s,this.sm=a}get value(){return this.sm.data}get created(){return new Date(ah(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get($o))||"PUT"}get delta(){return this.sm.info.pending}get length(){var s;const t=((s=this.sm.headers)==null?void 0:s.get(Bt.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Qg extends x1{constructor(s,a,o){super(s.nc,a,o);v(this,"js");v(this,"monitor");this.js=s,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(s){this.sub.info=s}get info(){return this.sub.info}_resetOrderedConsumer(s){if(this.info===null||this.sub.isClosed())return;const a=ms(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const f=this.info;f.config.name=ei.next(),f.ordered_consumer_sequence.delivery_seq=0,f.flow_control.heartbeat_count=0,f.flow_control.fc_count=0,f.flow_control.consumer_restarts++,f.deliver=a,f.config.deliver_subject=a,f.config.deliver_policy=ft.StartSequence,f.config.opt_start_seq=s;const d={};d.stream_name=this.info.stream,d.config=f.config;const m=`${f.api.prefix}.CONSUMER.CREATE.${f.stream}`;this.js._request(m,d,{retries:-1}).then(g=>{const y=g,E=this.sub.info;E.last=y,this.info.config=y.config,this.info.name=y.name}).catch(g=>{const y=new he(`unable to recreate ordered consumer ${f.stream} at seq ${s}`,ae.RequestError,g);this.sub.callback(y,{})})}_maybeSetupHbMonitoring(){var a,o;const s=((o=(a=this.info)==null?void 0:a.config)==null?void 0:o.idle_heartbeat)||0;s&&this._setupHbMonitoring(ah(s))}_setupHbMonitoring(s,a=0){const o={cancelAfter:0,maxOut:2};a&&(o.cancelAfter=a);const f=this.sub,d=m=>{var E,_,O,R;const g=Wv(409,`${_n.IdleHeartbeatMissed}: ${m}`,this.sub.subject);if(!((E=this.info)==null?void 0:E.ordered))this.sub.callback(null,g);else{if(!this.js.nc.protocol.connected)return!1;const M=((O=(_=this.info)==null?void 0:_.ordered_consumer_sequence)==null?void 0:O.stream_seq)||0;return this._resetOrderedConsumer(M+1),(R=this.monitor)==null||R.restart(),!1}return!f.noIterator};this.monitor=new oh(s,d,o)}_checkHbOrderConsumer(s){const a=s.headers.get(Bt.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const o=parseInt(s.headers.get(Bt.LastConsumerSeqHdr),10),f=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,o!==f.delivery_seq&&this._resetOrderedConsumer(f.stream_seq+1),!1}_checkOrderedConsumer(s){const a=this.info.ordered_consumer_sequence,o=s.info.streamSequence,f=s.info.deliverySequence;return f!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=f,a.stream_seq=o,!0)}async destroy(){this.isClosed()||await this.drain();const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.DELETE.${s.stream}.${a}`;await s.api._request(o)}async consumerInfo(){const s=this.sub.info,a=s.config.durable_name||s.name,o=`${s.api.prefix}.CONSUMER.INFO.${s.stream}.${a}`,f=await s.api._request(o);return s.last=f,f}}class C_ extends Qg{constructor(t,s,a){super(t,s,a)}pull(t={batch:1}){const{stream:s,config:a,name:o}=this.sub.info,f=a.durable_name??o,d={};if(d.batch=t.batch||1,d.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const y=this.js.nc.features.get(Le.JS_PULL_MAX_BYTES);if(!y.ok)throw new Error(`max_bytes is only supported on servers ${y.min} or better`);d.max_bytes=t.max_bytes}let m=0;t.expires&&t.expires>0&&(m=t.expires,d.expires=nt(m));let g=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(g=t.idle_heartbeat,d.idle_heartbeat=nt(g)),g&&m===0)throw new Error("idle_heartbeat requires expires");if(g>m)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),m&&g&&(this.monitor?this.monitor._change(g,m):this._setupHbMonitoring(g,m));const y=this.info.api,E=`${y.prefix}.CONSUMER.MSG.NEXT.${s}.${f}`,_=this.sub.subject;y.nc.publish(E,y.jc.encode(d),{reply:_})}}}function M_(i,t){return i?D_(t):R_(t)}function R_(i){return(t,s)=>t?[t,null]:(t=Ar(s),t?[t,null]:[null,Fa(s,i)])}function D_(i){return(t,s)=>{if(t)return[t,null];const a=Ar(s);return a!==null?[Kg(a),null]:[null,Fa(s,i)]}}function Kg(i){if(i!==null)switch(i.code){case ae.JetStream404NoMessages:case ae.JetStream408RequestTimeout:return null;case ae.JetStream409:return e1(i)?i:null;default:return i}return null}function q_(i){i&&i.ack()}function z_(i){const t=i.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const s={};return s.domain=t[2]==="_"?"":t[2],s.account_hash=t[3],s.stream=t[4],s.consumer=t[5],s.deliveryCount=parseInt(t[6],10),s.redeliveryCount=s.deliveryCount,s.redelivered=s.deliveryCount>1,s.streamSequence=parseInt(t[7],10),s.deliverySequence=parseInt(t[8],10),s.timestampNanos=parseInt(t[9],10),s.pending=parseInt(t[10],10),s}class U_{constructor(t,s){v(this,"msg");v(this,"di");v(this,"didAck");v(this,"timeout");this.msg=t,this.didAck=!1,this.timeout=s}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=z_(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===Ca[0]&&t[1]===Ca[1]&&t[2]===Ca[2]&&t[3]===Ca[3]}async ackAck(t){var a;t=t||{},t.timeout=t.timeout||this.timeout;const s=st();if(this.didAck)s.resolve(!1);else if(this.didAck=!0,this.msg.reply){const f=this.msg.publisher,d=!((a=f.options)!=null&&a.noAsyncTraces),m=new Lg(f.muxSubscriptions,this.msg.reply,{timeout:t.timeout},d);f.request(m);try{f.publish(this.msg.reply,V0,{reply:`${f.muxSubscriptions.baseInbox}${m.token}`})}catch(g){m.cancel(g)}try{await Promise.race([m.timer,m.deferred]),s.resolve(!0)}catch(g){m.cancel(g),s.reject(g)}}else s.resolve(!1);return s}ack(){this.doAck(V0)}nak(t){let s=y_;t&&(s=Mf().encode(`-NAK ${JSON.stringify({delay:nt(t)})}`)),this.doAck(s)}working(){this.doAck(Ca)}next(t,s={batch:1}){const a={};a.batch=s.batch||1,a.no_wait=s.no_wait||!1,s.expires&&s.expires>0&&(a.expires=nt(s.expires));const o=Rn().encode(a),f=Mr.concat(b_,v_,o),d=t?{reply:t}:void 0;this.msg.respond(f,d)}term(t=""){let s=x_;(t==null?void 0:t.length)>0&&(s=Mf().encode(`+TERM ${t}`)),this.doAck(s)}json(){return this.msg.json()}string(){return this.msg.string()}}const B_="1.30.3",L_="nats.ws";class P_{constructor(){v(this,"version");v(this,"lang");v(this,"closeError");v(this,"connected");v(this,"done");v(this,"socket");v(this,"options");v(this,"socketClosed");v(this,"encrypted");v(this,"peeked");v(this,"yields");v(this,"signal");v(this,"closedNotification");this.version=B_,this.lang=L_,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=st(),this.closedNotification=st()}async connect(t,s){const a=st();if(s.tls)return a.reject(new he("tls",ae.InvalidOption)),a;this.options=s;const o=t.src;if(s.wsFactory){const{socket:f,encrypted:d}=await s.wsFactory(t.src,s);this.socket=f,this.encrypted=d}else this.encrypted=o.indexOf("wss://")===0,this.socket=new WebSocket(o);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=f=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(f.data)),this.peeked){this.signal.resolve();return}const d=Mr.concat(...this.yields),m=j1(d);if(m!==""){const g=W1.exec(m);if(!g){s.debug&&console.error("!!!",_o(d)),a.reject(new Error("unexpected response from server"));return}try{const y=JSON.parse(g[1]);X1(y,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(y){a.reject(y);return}}},this.socket.onclose=f=>{if(this.isDiscarded())return;this.socketClosed=!0;let d;this.done||(f.wasClean||(d=new Error(f.reason)),this._closed(d))},this.socket.onerror=f=>{if(this.isDiscarded())return;const d=f,m=new he(d.message,ae.Unknown,new Error(d.error));a.reject(m)},a}disconnect(){this._closed(void 0,!0)}async _closed(t,s=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Rr(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}s&&this.closedNotification.resolve(t)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const t=this.yields;this.yields=[];for(let s=0;s<t.length;s++)this.options.debug&&console.info(`> ${_o(t[s])}`),yield t[s];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=st())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${_o(t)}`);return}catch(s){this.options.debug&&console.error(`!!! ${_o(t)}: ${s}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function H_(i,t){/^(.*:\/\/)(.*)/.test(i)||(typeof t=="boolean"?i=`${t===!0?"https":"http"}://${i}`:i=`https://${i}`);let a=new URL(i);const o=a.protocol.toLowerCase();o==="ws:"&&(t=!1),o==="wss:"&&(t=!0),o!=="https:"&&o!=="http"&&(i=i.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${i}`));let f,d;const m=a.hostname,g=a.pathname,y=a.search||"";switch(o){case"http:":case"ws:":case"nats:":d=a.port||"80",f="ws:";break;case"https:":case"wss:":case"tls:":d=a.port||"443",f="wss:";break;default:d=a.port||t===!0?"443":"80",f=t===!0?"wss:":"ws:";break}return`${f}//${m}:${d}${g}${y}`}function $_(i={}){return v1({defaultPort:443,urlParseFn:H_,factory:()=>new P_}),hh.connect(i)}const Y_=null,G_=null,Xg="lt.events";function Zg(i,t){const s=i.split("."),a=t.split(".");for(let o=0;o<a.length;o++){const f=a[o];if(f===">")return!0;if(o>=s.length||f!=="*"&&f!==s[o])return!1}return s.length===a.length}const Xa=A.createContext({connected:!1,subscribe:()=>()=>{}});function V_(){const{connected:i}=A.useContext(Xa);return{connected:i}}function Wg(i,t){const{subscribe:s}=A.useContext(Xa),a=A.useRef(t);a.current=t,A.useEffect(()=>s(i,f=>a.current(f)),[s,i])}const I_=A.createContext({connected:!1,subscribe:()=>()=>{}}),F_=Mf();function J_({children:i,url:t,token:s}){const a=A.useRef(null),o=A.useRef(null),[f,d]=A.useState(!1),m=A.useRef(null),g=A.useRef(new Map),y=A.useCallback((O,R)=>{const M=g.current;return M.has(O)||M.set(O,new Set),M.get(O).add(R),()=>{const z=M.get(O);z&&(z.delete(R),z.size===0&&M.delete(O))}},[]),E=A.useCallback((O,R)=>{for(const[M,z]of g.current)if(Zg(O,M))for(const F of z)try{F(R)}catch{}},[]),_=A.useCallback(async()=>{try{if(a.current)return;const O=t||Y_;if(!O){console.error("[lt-nats] no NATS WebSocket URL configured — set NATS_WS_URL on the server");return}const R=await $_({servers:O,token:s||G_||void 0,reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:2e3});a.current=R,d(!0);const M=R.subscribe("lt.>");o.current=M,(async()=>{for await(const z of M)try{const F=JSON.parse(F_.decode(z.data));E(z.subject,F)}catch{}})(),(async()=>{for await(const z of R.status())z.type==="disconnect"||z.type==="error"?d(!1):z.type==="reconnect"&&d(!0)})()}catch{d(!1),m.current=setTimeout(_,3e3)}},[E]);return A.useEffect(()=>(_(),()=>{m.current&&clearTimeout(m.current),o.current&&o.current.unsubscribe(),a.current&&(a.current.close().catch(()=>{}),a.current=null),d(!1)}),[_]),h.jsx(I_.Provider,{value:{connected:f,subscribe:y},children:h.jsx(Xa.Provider,{value:{connected:f,subscribe:y},children:i})})}const Gn=Object.create(null);Gn.open="0";Gn.close="1";Gn.ping="2";Gn.pong="3";Gn.message="4";Gn.upgrade="5";Gn.noop="6";const Co=Object.create(null);Object.keys(Gn).forEach(i=>{Co[Gn[i]]=i});const If={type:"error",data:"parser error"},ey=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ty=typeof ArrayBuffer=="function",ny=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,dh=({type:i,data:t},s,a)=>ey&&t instanceof Blob?s?a(t):F0(t,a):ty&&(t instanceof ArrayBuffer||ny(t))?s?a(t):F0(new Blob([t]),a):a(Gn[i]+(t||"")),F0=(i,t)=>{const s=new FileReader;return s.onload=function(){const a=s.result.split(",")[1];t("b"+(a||""))},s.readAsDataURL(i)};function J0(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let _f;function Q_(i,t){if(ey&&i.data instanceof Blob)return i.data.arrayBuffer().then(J0).then(t);if(ty&&(i.data instanceof ArrayBuffer||ny(i.data)))return t(J0(i.data));dh(i,!1,s=>{_f||(_f=new TextEncoder),t(_f.encode(s))})}const Q0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ba=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Q0.length;i++)Ba[Q0.charCodeAt(i)]=i;const K_=i=>{let t=i.length*.75,s=i.length,a,o=0,f,d,m,g;i[i.length-1]==="="&&(t--,i[i.length-2]==="="&&t--);const y=new ArrayBuffer(t),E=new Uint8Array(y);for(a=0;a<s;a+=4)f=Ba[i.charCodeAt(a)],d=Ba[i.charCodeAt(a+1)],m=Ba[i.charCodeAt(a+2)],g=Ba[i.charCodeAt(a+3)],E[o++]=f<<2|d>>4,E[o++]=(d&15)<<4|m>>2,E[o++]=(m&3)<<6|g&63;return y},X_=typeof ArrayBuffer=="function",mh=(i,t)=>{if(typeof i!="string")return{type:"message",data:sy(i,t)};const s=i.charAt(0);return s==="b"?{type:"message",data:Z_(i.substring(1),t)}:Co[s]?i.length>1?{type:Co[s],data:i.substring(1)}:{type:Co[s]}:If},Z_=(i,t)=>{if(X_){const s=K_(i);return sy(s,t)}else return{base64:!0,data:i}},sy=(i,t)=>{switch(t){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},iy="",W_=(i,t)=>{const s=i.length,a=new Array(s);let o=0;i.forEach((f,d)=>{dh(f,!1,m=>{a[d]=m,++o===s&&t(a.join(iy))})})},ew=(i,t)=>{const s=i.split(iy),a=[];for(let o=0;o<s.length;o++){const f=mh(s[o],t);if(a.push(f),f.type==="error")break}return a};function tw(){return new TransformStream({transform(i,t){Q_(i,s=>{const a=s.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const f=new DataView(o.buffer);f.setUint8(0,126),f.setUint16(1,a)}else{o=new Uint8Array(9);const f=new DataView(o.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(a))}i.data&&typeof i.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(s)})}})}let wf;function jo(i){return i.reduce((t,s)=>t+s.length,0)}function Ao(i,t){if(i[0].length===t)return i.shift();const s=new Uint8Array(t);let a=0;for(let o=0;o<t;o++)s[o]=i[0][a++],a===i[0].length&&(i.shift(),a=0);return i.length&&a<i[0].length&&(i[0]=i[0].slice(a)),s}function nw(i,t){wf||(wf=new TextDecoder);const s=[];let a=0,o=-1,f=!1;return new TransformStream({transform(d,m){for(s.push(d);;){if(a===0){if(jo(s)<1)break;const g=Ao(s,1);f=(g[0]&128)===128,o=g[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(jo(s)<2)break;const g=Ao(s,2);o=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),a=3}else if(a===2){if(jo(s)<8)break;const g=Ao(s,8),y=new DataView(g.buffer,g.byteOffset,g.length),E=y.getUint32(0);if(E>Math.pow(2,21)-1){m.enqueue(If);break}o=E*Math.pow(2,32)+y.getUint32(4),a=3}else{if(jo(s)<o)break;const g=Ao(s,o);m.enqueue(mh(f?g:wf.decode(g),t)),a=0}if(o===0||o>i){m.enqueue(If);break}}}})}const ry=4;function yt(i){if(i)return sw(i)}function sw(i){for(var t in yt.prototype)i[t]=yt.prototype[t];return i}yt.prototype.on=yt.prototype.addEventListener=function(i,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(t),this};yt.prototype.once=function(i,t){function s(){this.off(i,s),t.apply(this,arguments)}return s.fn=t,this.on(i,s),this};yt.prototype.off=yt.prototype.removeListener=yt.prototype.removeAllListeners=yt.prototype.removeEventListener=function(i,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+i];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var a,o=0;o<s.length;o++)if(a=s[o],a===t||a.fn===t){s.splice(o,1);break}return s.length===0&&delete this._callbacks["$"+i],this};yt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+i],a=1;a<arguments.length;a++)t[a-1]=arguments[a];if(s){s=s.slice(0);for(var a=0,o=s.length;a<o;++a)s[a].apply(this,t)}return this};yt.prototype.emitReserved=yt.prototype.emit;yt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};yt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Xo=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,s)=>s(t,0),wn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),iw="arraybuffer";function ay(i,...t){return t.reduce((s,a)=>(i.hasOwnProperty(a)&&(s[a]=i[a]),s),{})}const rw=wn.setTimeout,aw=wn.clearTimeout;function Zo(i,t){t.useNativeTimers?(i.setTimeoutFn=rw.bind(wn),i.clearTimeoutFn=aw.bind(wn)):(i.setTimeoutFn=wn.setTimeout.bind(wn),i.clearTimeoutFn=wn.clearTimeout.bind(wn))}const lw=1.33;function ow(i){return typeof i=="string"?cw(i):Math.ceil((i.byteLength||i.size)*lw)}function cw(i){let t=0,s=0;for(let a=0,o=i.length;a<o;a++)t=i.charCodeAt(a),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(a++,s+=4);return s}function ly(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function uw(i){let t="";for(let s in i)i.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(i[s]));return t}function fw(i){let t={},s=i.split("&");for(let a=0,o=s.length;a<o;a++){let f=s[a].split("=");t[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return t}class hw extends Error{constructor(t,s,a){super(t),this.description=s,this.context=a,this.type="TransportError"}}class ph extends yt{constructor(t){super(),this.writable=!1,Zo(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,s,a){return super.emitReserved("error",new hw(t,s,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const s=mh(t,this.socket.binaryType);this.onPacket(s)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,s={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const s=uw(t);return s.length?"?"+s:""}}class dw extends ph{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const s=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||s()})),this.writable||(a++,this.once("drain",function(){--a||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};ew(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,W_(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=ly()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let oy=!1;try{oy=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const mw=oy;function pw(){}class gw extends dw{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||a!==t.port}}doWrite(t,s){const a=this.request({method:"POST",data:t});a.on("success",s),a.on("error",(o,f)=>{this.onError("xhr post error",o,f)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,a)=>{this.onError("xhr poll error",s,a)}),this.pollXhr=t}}class $n extends yt{constructor(t,s,a){super(),this.createRequest=t,Zo(this,a),this._opts=a,this._method=a.method||"GET",this._uri=s,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var t;const s=ay(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(s);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=$n.requestsCount++,$n.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=pw,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete $n.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}$n.requestsCount=0;$n.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",K0);else if(typeof addEventListener=="function"){const i="onpagehide"in wn?"pagehide":"unload";addEventListener(i,K0,!1)}}function K0(){for(let i in $n.requests)$n.requests.hasOwnProperty(i)&&$n.requests[i].abort()}const yw=(function(){const i=cy({xdomain:!1});return i&&i.responseType!==null})();class bw extends gw{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=yw&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new $n(cy,this.uri(),t)}}function cy(i){const t=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||mw))return new XMLHttpRequest}catch{}if(!t)try{return new wn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const uy=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class xw extends ph{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,a=uy?{}:ay(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;dh(a,this.supportsBinary,f=>{try{this.doWrite(a,f)}catch{}o&&Xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=ly()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const Sf=wn.WebSocket||wn.MozWebSocket;class vw extends xw{createSocket(t,s,a){return uy?new Sf(t,s,a):s?new Sf(t,s):new Sf(t)}doWrite(t,s){this.ws.send(s)}}class _w extends ph{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=nw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=t.readable.pipeThrough(s).getReader(),o=tw();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const f=()=>{a.read().then(({done:m,value:g})=>{m||(this.onPacket(g),f())}).catch(m=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s<t.length;s++){const a=t[s],o=s===t.length-1;this._writer.write(a).then(()=>{o&&Xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ww={websocket:vw,webtransport:_w,polling:bw},Sw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ew=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ff(i){if(i.length>8e3)throw"URI too long";const t=i,s=i.indexOf("["),a=i.indexOf("]");s!=-1&&a!=-1&&(i=i.substring(0,s)+i.substring(s,a).replace(/:/g,";")+i.substring(a,i.length));let o=Sw.exec(i||""),f={},d=14;for(;d--;)f[Ew[d]]=o[d]||"";return s!=-1&&a!=-1&&(f.source=t,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=jw(f,f.path),f.queryKey=Aw(f,f.query),f}function jw(i,t){const s=/\/{2,9}/g,a=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&a.splice(0,1),t.slice(-1)=="/"&&a.splice(a.length-1,1),a}function Aw(i,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,f){o&&(s[o]=f)}),s}const Jf=typeof addEventListener=="function"&&typeof removeEventListener=="function",Mo=[];Jf&&addEventListener("offline",()=>{Mo.forEach(i=>i())},!1);class Ws extends yt{constructor(t,s){if(super(),this.binaryType=iw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const a=Ff(t);s.hostname=a.host,s.secure=a.protocol==="https"||a.protocol==="wss",s.port=a.port,a.query&&(s.query=a.query)}else s.host&&(s.hostname=Ff(s.host).host);Zo(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=fw(this.opts.query)),Jf&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Mo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=ry,s.transport=t,this.id&&(s.sid=this.id);const a=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Ws.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",Ws.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(s+=ow(o)),a>0&&s>this._maxPayload)return this.writeBuffer.slice(0,a);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Xo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,a){return this._sendPacket("message",t,s,a),this}send(t,s,a){return this._sendPacket("message",t,s,a),this}_sendPacket(t,s,a,o){if(typeof s=="function"&&(o=s,s=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const f={type:t,data:s,options:a};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},a=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():t()}):this.upgrading?a():t()),this}_onError(t){if(Ws.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Jf&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=Mo.indexOf(this._offlineEventListener);a!==-1&&Mo.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}Ws.protocol=ry;class Ow extends Ws{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let s=this.createTransport(t),a=!1;Ws.priorWebsocketSuccess=!1;const o=()=>{a||(s.send([{type:"ping",data:"probe"}]),s.once("packet",_=>{if(!a)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;Ws.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(E(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=s.name,this.emitReserved("upgradeError",O)}}))};function f(){a||(a=!0,E(),s.close(),s=null)}const d=_=>{const O=new Error("probe error: "+_);O.transport=s.name,f(),this.emitReserved("upgradeError",O)};function m(){d("transport closed")}function g(){d("socket closed")}function y(_){s&&_.name!==s.name&&f()}const E=()=>{s.removeListener("open",o),s.removeListener("error",d),s.removeListener("close",m),this.off("close",g),this.off("upgrading",y)};s.once("open",o),s.once("error",d),s.once("close",m),this.once("close",g),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{a||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let a=0;a<t.length;a++)~this.transports.indexOf(t[a])&&s.push(t[a]);return s}}let Nw=class extends Ow{constructor(t,s={}){const a=typeof t=="object"?t:s;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>ww[o]).filter(o=>!!o)),super(t,a)}};function Tw(i,t="",s){let a=i;s=s||typeof location<"u"&&location,i==null&&(i=s.protocol+"//"+s.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=s.protocol+i:i=s.host+i),/^(https?|wss?):\/\//.test(i)||(typeof s<"u"?i=s.protocol+"//"+i:i="https://"+i),a=Ff(i)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const f=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+f+":"+a.port+t,a.href=a.protocol+"://"+f+(s&&s.port===a.port?"":":"+a.port),a}const kw=typeof ArrayBuffer=="function",Cw=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,fy=Object.prototype.toString,Mw=typeof Blob=="function"||typeof Blob<"u"&&fy.call(Blob)==="[object BlobConstructor]",Rw=typeof File=="function"||typeof File<"u"&&fy.call(File)==="[object FileConstructor]";function gh(i){return kw&&(i instanceof ArrayBuffer||Cw(i))||Mw&&i instanceof Blob||Rw&&i instanceof File}function Ro(i,t){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let s=0,a=i.length;s<a;s++)if(Ro(i[s]))return!0;return!1}if(gh(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Ro(i.toJSON(),!0);for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&Ro(i[s]))return!0;return!1}function Dw(i){const t=[],s=i.data,a=i;return a.data=Qf(s,t),a.attachments=t.length,{packet:a,buffers:t}}function Qf(i,t){if(!i)return i;if(gh(i)){const s={_placeholder:!0,num:t.length};return t.push(i),s}else if(Array.isArray(i)){const s=new Array(i.length);for(let a=0;a<i.length;a++)s[a]=Qf(i[a],t);return s}else if(typeof i=="object"&&!(i instanceof Date)){const s={};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(s[a]=Qf(i[a],t));return s}return i}function qw(i,t){return i.data=Kf(i.data,t),delete i.attachments,i}function Kf(i,t){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<t.length)return t[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let s=0;s<i.length;s++)i[s]=Kf(i[s],t);else if(typeof i=="object")for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&(i[s]=Kf(i[s],t));return i}const zw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Be;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(Be||(Be={}));class Uw{constructor(t){this.replacer=t}encode(t){return(t.type===Be.EVENT||t.type===Be.ACK)&&Ro(t)?this.encodeAsBinary({type:t.type===Be.EVENT?Be.BINARY_EVENT:Be.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let s=""+t.type;return(t.type===Be.BINARY_EVENT||t.type===Be.BINARY_ACK)&&(s+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(s+=t.nsp+","),t.id!=null&&(s+=t.id),t.data!=null&&(s+=JSON.stringify(t.data,this.replacer)),s}encodeAsBinary(t){const s=Dw(t),a=this.encodeAsString(s.packet),o=s.buffers;return o.unshift(a),o}}class yh extends yt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let s;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(t);const a=s.type===Be.BINARY_EVENT;a||s.type===Be.BINARY_ACK?(s.type=a?Be.EVENT:Be.ACK,this.reconstructor=new Bw(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(gh(t)||t.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(t),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let s=0;const a={type:Number(t.charAt(0))};if(Be[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Be.BINARY_EVENT||a.type===Be.BINARY_ACK){const f=s+1;for(;t.charAt(++s)!=="-"&&s!=t.length;);const d=t.substring(f,s);if(d!=Number(d)||t.charAt(s)!=="-")throw new Error("Illegal attachments");const m=Number(d);if(!Lw(m)||m<0)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");a.attachments=m}if(t.charAt(s+1)==="/"){const f=s+1;for(;++s&&!(t.charAt(s)===","||s===t.length););a.nsp=t.substring(f,s)}else a.nsp="/";const o=t.charAt(s+1);if(o!==""&&Number(o)==o){const f=s+1;for(;++s;){const d=t.charAt(s);if(d==null||Number(d)!=d){--s;break}if(s===t.length)break}a.id=Number(t.substring(f,s+1))}if(t.charAt(++s)){const f=this.tryParse(t.substr(s));if(yh.isPayloadValid(a.type,f))a.data=f;else throw new Error("invalid payload")}return a}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,s){switch(t){case Be.CONNECT:return X0(s);case Be.DISCONNECT:return s===void 0;case Be.CONNECT_ERROR:return typeof s=="string"||X0(s);case Be.EVENT:case Be.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&zw.indexOf(s[0])===-1);case Be.ACK:case Be.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Bw{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const s=qw(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Lw=Number.isInteger||function(i){return typeof i=="number"&&isFinite(i)&&Math.floor(i)===i};function X0(i){return Object.prototype.toString.call(i)==="[object Object]"}const Pw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:yh,Encoder:Uw,get PacketType(){return Be}},Symbol.toStringTag,{value:"Module"}));function Cn(i,t,s){return i.on(t,s),function(){i.off(t,s)}}const Hw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class hy extends yt{constructor(t,s,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=s,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Cn(t,"open",this.onopen.bind(this)),Cn(t,"packet",this.onpacket.bind(this)),Cn(t,"error",this.onerror.bind(this)),Cn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...s){var a,o,f;if(Hw.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(s.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;const d={type:Be.EVENT,data:s};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){const E=this.ids++,_=s.pop();this._registerAckCallback(E,_),d.id=E}const m=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,g=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!m||(g?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,s){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[t]=s;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===t&&this.sendBuffer.splice(m,1);s.call(this,new Error("operation has timed out"))},o),d=(...m)=>{this.io.clearTimeoutFn(f),s.apply(this,m)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...s){return new Promise((a,o)=>{const f=(d,m)=>d?o(d):a(m);f.withError=!0,s.push(f),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...f)=>(this._queue[0],o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(o)):(this._queue.shift(),s&&s(null,...f)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(a=>String(a.id)===t)){const a=this.acks[t];delete this.acks[t],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Be.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Be.EVENT:case Be.BINARY_EVENT:this.onevent(t);break;case Be.ACK:case Be.BINARY_ACK:this.onack(t);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const a of s)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let a=!1;return function(...o){a||(a=!0,s.packet({type:Be.ACK,id:t,data:o}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const s=this._anyOutgoingListeners;for(let a=0;a<s.length;a++)if(t===s[a])return s.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const s=this._anyOutgoingListeners.slice();for(const a of s)a.apply(this,t.data)}}}function Dr(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Dr.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*i);i=(Math.floor(t*10)&1)==0?i-s:i+s}return Math.min(i,this.max)|0};Dr.prototype.reset=function(){this.attempts=0};Dr.prototype.setMin=function(i){this.ms=i};Dr.prototype.setMax=function(i){this.max=i};Dr.prototype.setJitter=function(i){this.jitter=i};class Xf extends yt{constructor(t,s){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Zo(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((a=s.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new Dr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const o=s.parser||Pw;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Nw(this.uri,this.opts);const s=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=Cn(s,"open",function(){a.onopen(),t&&t()}),f=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),t?t(m):this.maybeReconnectOnOpen()},d=Cn(s,"error",f);if(this._timeout!==!1){const m=this._timeout,g=this.setTimeoutFn(()=>{o(),f(new Error("timeout")),s.close()},m);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(o),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Cn(t,"ping",this.onping.bind(this)),Cn(t,"data",this.ondata.bind(this)),Cn(t,"error",this.onerror.bind(this)),Cn(t,"close",this.onclose.bind(this)),Cn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Xo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new hy(this,t,s),this.nsps[t]=a),a}_destroy(t){const s=Object.keys(this.nsps);for(const a of s)if(this.nsps[a].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let a=0;a<s.length;a++)this.engine.write(s[a],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},s);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ma={};function Do(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};const s=Tw(i,t.path||"/socket.io"),a=s.source,o=s.id,f=s.path,d=Ma[o]&&f in Ma[o].nsps,m=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let g;return m?g=new Xf(a,t):(Ma[o]||(Ma[o]=new Xf(a,t)),g=Ma[o]),s.query&&!t.query&&(t.query=s.queryKey),g.socket(s.path,t)}Object.assign(Do,{Manager:Xf,Socket:hy,io:Do,connect:Do});const $w=A.createContext({connected:!1,subscribe:()=>()=>{}});function Yw({children:i}){const t=A.useRef(null),[s,a]=A.useState(!1),o=A.useRef(new Map),f=A.useCallback((m,g)=>{const y=o.current;return y.has(m)||y.set(m,new Set),y.get(m).add(g),()=>{const E=y.get(m);E&&(E.delete(g),E.size===0&&y.delete(m))}},[]),d=A.useCallback((m,g)=>{for(const[y,E]of o.current)if(Zg(m,y))for(const _ of E)try{_(g)}catch{}},[]);return A.useEffect(()=>{const m=Mg(),g=Do({path:`${Tt}/socket.io`,transports:["polling","websocket"],upgrade:!0,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:2e3,...m?{auth:{token:m}}:{}});return t.current=g,console.log("[lt-socketio] connecting..."),g.on("connect",()=>{console.log("[lt-socketio] connected, id:",g.id),a(!0)}),g.on("disconnect",y=>{console.log("[lt-socketio] disconnected:",y),a(!1)}),g.on("connect_error",y=>{console.warn("[lt-socketio] connect error:",y.message),a(!1)}),g.onAny((y,E)=>{if(y.startsWith("lt."))try{const _=typeof E=="string"?JSON.parse(E):E;d(y,_)}catch{}}),()=>{g.removeAllListeners(),g.disconnect(),t.current=null,a(!1)}},[d]),h.jsx($w.Provider,{value:{connected:s,subscribe:f},children:h.jsx(Xa.Provider,{value:{connected:s,subscribe:f},children:i})})}function Gw({children:i}){const[t,s]=A.useState(null),[a,o]=A.useState({url:null,token:null});return A.useEffect(()=>{let f=!1;async function d(){var m;try{console.log("[lt-transport] detecting event transport...");const g=await fetch(`${Tt}/api/settings`);if(!g.ok){console.warn("[lt-transport] settings fetch failed, falling back to socketio"),f||s("socketio");return}const y=await g.json(),E=(m=y==null?void 0:y.events)==null?void 0:m.transport;if(console.log("[lt-transport] server reports:",E),!f){if(E==="nats"){let _=y.events.natsWsUrl??null,O=null;const R=Mg();if(R)try{const M=await fetch(`${Tt}/api/nats-credentials`,{headers:{Authorization:`Bearer ${R}`}});if(M.ok){const z=await M.json();_=z.natsWsUrl??_,O=z.natsToken??null}}catch{console.warn("[lt-transport] failed to fetch NATS credentials")}o({url:_,token:O})}s(E==="nats"?"nats":"socketio")}}catch(g){console.warn("[lt-transport] settings fetch error, falling back to socketio",g),f||s("socketio")}}return d(),()=>{f=!0}},[]),t==="nats"?h.jsx(J_,{url:a.url,token:a.token,children:i}):t==="socketio"?h.jsx(Yw,{children:i}):h.jsx(h.Fragment,{children:i})}const bh="lt_view_as",xh="lt_ai_override",Zf="lt_graph_enabled";function dy(){try{const i=localStorage.getItem(xh);if(i==="true")return!0;if(i==="false")return!1}catch{}return null}function Vw(i){try{localStorage.setItem(xh,String(i))}catch{}}function Iw(){try{localStorage.removeItem(xh)}catch{}}function vh(){try{const i=localStorage.getItem(bh);if(i==="admin"||i==="engineer"||i==="operator")return i}catch{}return null}function Fw(i){try{localStorage.setItem(bh,i)}catch{}window.location.reload()}function Wf(){try{localStorage.removeItem(bh)}catch{}window.location.reload()}function my(){try{return localStorage.getItem(Zf)==="true"}catch{return!1}}function Jw(i){try{i?localStorage.setItem(Zf,"true"):localStorage.removeItem(Zf)}catch{}}function py(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=Vn(),a=vh(),o=i||s("engineer"),f=t("admin"),d=i||t("admin");return{isBuilder:a?!1:o,isOps:a?a==="admin"||a==="engineer":f,canBulk:a?a==="admin":d,viewAs:a,realIsBuilder:o}}function gy(){const{isSuperAdmin:i,hasRoleType:t,hasRole:s}=Vn(),a=i?"superadmin":t("admin")?"admin":s("engineer")?"engineer":"operator",o=vh(),f=o==="admin"||o==="engineer"||o==="operator"?o:null,d=f??a;return{tier:d,realTier:a,viewAs:f,canSeePaceBoard:d==="superadmin"||d==="admin",canSeeWorkflows:d==="superadmin"||d==="engineer",showTaskQueueCards:d==="operator"}}const Qw="lt_ai_override";function Kw(){return we("/settings")}function Xw(){try{if(localStorage.getItem(Qw)==="off")return!1}catch{}return null}function Mi(){var s;const i=ht({queryKey:["settings"],queryFn:Kw,staleTime:1/0}),t=Xw();return i.data&&t===!1&&((s=i.data.ai)!=null&&s.enabled)?{...i,data:{...i.data,ai:{enabled:!1}}}:i}const _h=A.createContext(null),Ef="lt_sidebar_collapsed",yy="(max-width: 1023px)";function Zw(){try{return window.matchMedia(yy).matches}catch{return!1}}function Ww({children:i}){const[t,s]=A.useState(()=>{if(Zw())return!0;try{return localStorage.getItem(Ef)==="true"}catch{return!1}});A.useEffect(()=>{let o;try{o=window.matchMedia(yy)}catch{return}const f=d=>{if(d.matches)s(!0);else try{s(localStorage.getItem(Ef)==="true")}catch{s(!1)}};return o.addEventListener("change",f),()=>o.removeEventListener("change",f)},[]);const a=A.useCallback(()=>{s(o=>{const f=!o;try{localStorage.setItem(Ef,String(f))}catch{}return f})},[]);return h.jsx(_h.Provider,{value:{collapsed:t,toggle:a},children:i})}function eS({children:i}){return h.jsx(_h.Provider,{value:{collapsed:!1,toggle:()=>{}},children:i})}function wh(){const i=A.useContext(_h);if(!i)throw new Error("useSidebar must be used within SidebarProvider");return i}const Z0=380,Sh=A.createContext(null);function tS({children:i}){const[t,s]=A.useState({node:null,width:Z0,open:!1,ownerKey:null}),a=Sn(),o=A.useRef(a.pathname),f=A.useCallback((m,g)=>{s({node:m,width:(g==null?void 0:g.width)??Z0,open:!0,ownerKey:(g==null?void 0:g.key)??null})},[]),d=A.useCallback(m=>{s(g=>typeof m=="string"&&g.ownerKey!==m?g:{...g,open:!1})},[]);return A.useEffect(()=>{a.pathname!==o.current&&(o.current=a.pathname,s(m=>m.open||m.node?{...m,node:null,open:!1,ownerKey:null}:m))},[a.pathname]),h.jsx(Sh.Provider,{value:{...t,setPanel:f,closePanel:d},children:i})}function nS(){const i=A.useContext(Sh);if(!i)throw new Error("useShellPanel must be used within ShellPanelProvider");return i}function Hj(){return A.useContext(Sh)}function sS({open:i,width:t=380,children:s,className:a=""}){const[o,f]=A.useState(i);return A.useEffect(()=>{i&&f(!0)},[i]),h.jsx("div",{className:`shrink-0 overflow-hidden transition-[width] duration-300 ease-out ${a}`,style:{width:i?t:0,maxWidth:"50%"},onTransitionEnd:d=>{!i&&d.propertyName==="width"&&f(!1)},children:h.jsx("div",{style:{width:t},className:"h-full",children:o?s:null})})}function $j({label:i,children:t}){return h.jsxs("div",{children:[h.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:i}),h.jsx("dd",{className:"text-xs text-text-primary mt-0.5",children:t})]})}function Yj({views:i,activeId:t,onViewChange:s,onClose:a,headerActions:o,stickyClassName:f}){const d=i.find(m=>m.id===t)??i[0];return d?h.jsx("div",{className:"h-full bg-surface-hover",children:h.jsxs("div",{className:`flex flex-col ${f??"sticky top-0 z-10 max-h-[calc(100vh-3.5rem)]"}`,children:[h.jsxs("div",{className:"flex items-center justify-between pl-4 pr-3 pt-3 shrink-0",children:[h.jsx("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":"Panel view",children:i.map(m=>{const g=m.icon,y=m.id===d.id;return h.jsx("button",{role:"radio","aria-checked":y,onClick:()=>s(m.id),title:m.label,className:`p-1.5 rounded-md transition-colors ${y?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:h.jsx(g,{className:"w-3.5 h-3.5"})},m.id)})}),h.jsxs("div",{className:"flex items-center gap-1",children:[o,a&&h.jsx("button",{onClick:a,title:"Close panel",className:"p-1 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors",children:h.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),h.jsx("p",{className:"px-5 pt-2 pb-1 text-2xs font-semibold uppercase tracking-widest text-text-secondary shrink-0",children:d.label}),h.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5 pt-1",children:d.content})]})}):null}function by(i,t){var s,a,o,f,d;t.facets&&Object.keys(t.facets).length&&i.set("facets",JSON.stringify(t.facets)),(s=t.block)!=null&&s.length&&i.set("block",JSON.stringify(t.block)),(a=t.range)!=null&&a.length&&i.set("range",JSON.stringify(t.range)),(o=t.exists)!=null&&o.length&&i.set("exists",JSON.stringify(t.exists)),(f=t.roles)!=null&&f.length&&i.set("roles",JSON.stringify(t.roles)),(d=t.orderBy)!=null&&d.length&&i.set("orderBy",JSON.stringify(t.orderBy)),t.available!==void 0&&i.set("available",String(t.available)),t.jeopardy===!0&&i.set("jeopardy","1")}function Gj(i,t){const s=i??"24h";return ht({queryKey:["stationMetrics",s],queryFn:()=>we(`/escalations/station-metrics?period=${s}`),staleTime:5e3,enabled:(t==null?void 0:t.enabled)??!0})}function Vj(i){const t=i?`?period=${i}`:"";return ht({queryKey:["escalationStats",i],queryFn:()=>we(`/escalations/stats${t}`)})}function Ij(){return ht({queryKey:["escalationTypes"],queryFn:()=>we("/escalations/types")})}function Fj(i=!0){return ht({queryKey:["escalationFacetKeys"],queryFn:()=>we("/escalations/facet-keys"),enabled:i,staleTime:6e4})}function xy(i){const{enabled:t=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.status&&o.set("status",a.status),a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.assigned_to&&o.set("assigned_to",a.assigned_to),a.claimed&&o.set("claimed","true"),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),by(o,a),ht({queryKey:["escalations",a],queryFn:()=>we(`/escalations?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function vy(i){const{enabled:t=!0,staleTime:s,...a}=i,o=new URLSearchParams;return a.role&&o.set("role",a.role),a.type&&o.set("type",a.type),a.subtype&&o.set("subtype",a.subtype),a.priority&&o.set("priority",String(a.priority)),a.limit&&o.set("limit",String(a.limit)),a.offset!==void 0&&o.set("offset",String(a.offset)),a.sort_by&&o.set("sort_by",a.sort_by),a.order&&o.set("order",a.order),a.search&&o.set("search",a.search),by(o,a),ht({queryKey:["escalations","available",a],queryFn:()=>we(`/escalations/available?${o}`),enabled:t,...s!==void 0?{staleTime:s}:{}})}function Jj(i){return ht({queryKey:["escalations","by-workflow",i],queryFn:()=>we(`/escalations/by-workflow/${i}`),enabled:!!i})}function Qj(i){return ht({queryKey:["escalations",i],queryFn:()=>we(`/escalations/${i}`),enabled:!!i})}function Kj(){const i=bt();return Et({mutationFn:({id:t,durationMinutes:s})=>we(`/escalations/${t}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function Xj(){const i=bt();return Et({mutationFn:t=>we(`/escalations/${t}/release`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function Zj(){const i=bt();return Et({mutationFn:({id:t,resolverPayload:s})=>we(`/escalations/${t}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]}),i.resetQueries({queryKey:["tasks"]}),i.resetQueries({queryKey:["jobs"]})}})}function Wj(){const i=bt();return Et({mutationFn:({id:t,targetRole:s})=>we(`/escalations/${t}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:s})}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function eA(){const i=bt();return Et({mutationFn:({ids:t,priority:s})=>we("/escalations/priority",{method:"PATCH",body:JSON.stringify({ids:t,priority:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function tA(){const i=bt();return Et({mutationFn:({ids:t,durationMinutes:s})=>we("/escalations/bulk-claim",{method:"POST",body:JSON.stringify({ids:t,durationMinutes:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function nA(){const i=bt();return Et({mutationFn:({ids:t,targetUserId:s,durationMinutes:a})=>we("/escalations/bulk-assign",{method:"POST",body:JSON.stringify({ids:t,targetUserId:s,durationMinutes:a})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function sA(){const i=bt();return Et({mutationFn:({ids:t,targetRole:s})=>we("/escalations/bulk-escalate",{method:"PATCH",body:JSON.stringify({ids:t,targetRole:s})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function iA(){const i=bt();return Et({mutationFn:({ids:t,hint:s})=>we("/escalations/bulk-triage",{method:"POST",body:JSON.stringify({ids:t,...s?{hint:s}:{}})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function rA(){const i=bt();return Et({mutationFn:t=>we(`/escalations/${t}/cancel`,{method:"POST"}),onSuccess:()=>{i.resetQueries({queryKey:["escalations"]}),i.resetQueries({queryKey:["escalationStats"]})}})}function aA(){const i=bt();return Et({mutationFn:({ids:t})=>we("/escalations/bulk-cancel",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["escalations"],refetchType:"all"}),i.invalidateQueries({queryKey:["escalationStats"],refetchType:"all"})}})}function iS(){const{user:i}=Vn(),t=i==null?void 0:i.userId,s=bt(),a=A.useRef(null),o=A.useCallback(()=>{a.current||(a.current=setTimeout(()=>{a.current=null,s.invalidateQueries({queryKey:["escalations"]})},15e3))},[s]);Wg(`${Xg}.system.escalation.>`,o);const{data:f}=vy({limit:1}),{data:d}=xy({assigned_to:t,status:"pending",limit:1});return{available:(f==null?void 0:f.total)??0,mine:(d==null?void 0:d.total)??0}}function Yo({size:i="sm",hideLabel:t=!1,className:s="",appName:a="LongTail",variant:o="full"}){const f=i==="lg";if(o==="comet")return h.jsx("div",{className:`relative overflow-visible ${s}`,style:{width:"2.5rem",height:"2.5rem",flexShrink:0},children:h.jsx("span",{role:"img","aria-label":a,className:"logo-mark absolute pointer-events-none select-none",style:{"--logo-url":`url(${Tt}/logo512.png)`,width:"82px",height:"82px",top:"-12px",left:"-80px",transform:"rotate(232deg)",zIndex:-1,opacity:.55}})});if(o==="mark")return h.jsx("div",{className:`flex items-center ${s}`,children:h.jsx("span",{role:"img","aria-label":a,className:"logo-mark shrink-0 w-7 h-7",style:{"--logo-url":`url(${Tt}/logo512.png)`}})});const d=f?"w-[16rem] h-[16rem] -rotate-[120deg] opacity-40 -ml-10":"w-[12.5rem] h-[12.5rem] -rotate-[120deg] opacity-40 -ml-8",m=f?"text-[44px] font-normal text-text-primary tracking-[0.15em] -ml-[12.5rem]":"text-[36px] font-normal text-text-primary tracking-[0.15em] -ml-[9.75rem]";return h.jsxs("div",{className:`flex items-center ${s}`,style:{height:"50px"},children:[h.jsx("span",{role:"img","aria-label":a,className:`logo-mark shrink-0 z-0 ${d}`,style:{"--logo-url":`url(${Tt}/logo512.png)`}}),h.jsx("span",{className:`z-[1] transition-opacity duration-300 ${m} ${t?"opacity-0":""}`,children:a})]})}const rS=[{id:null,label:"Your view",description:"Full access based on your account role",minTier:"operator"},{id:"admin",label:"Admin",description:"Pace Board + identity management",minTier:"superadmin"},{id:"engineer",label:"Engineer",description:"Work queue + identity management",minTier:"admin"},{id:"operator",label:"Operator",description:"Escalation queue only",minTier:"engineer"}],aS=["operator","engineer","admin","superadmin"];function W0(i){return aS.indexOf(i)}function lS(i,t){return W0(i)>=W0(t)}function oS({onClose:i}){var re,Oe,ke,Se,q,ne;const{isSuperAdmin:t,hasRoleType:s,hasRole:a}=Vn(),{data:o}=Mi(),f=vh(),d=!!((re=o==null?void 0:o.ai)!=null&&re.enabled),m=dy(),g=m!==null?m:d,[y,E]=A.useState(g),_=(Oe=o==null?void 0:o.features)==null?void 0:Oe.graphWorkflows,O=_==null,[R,M]=A.useState(_===!0||O&&my()),z=t?"superadmin":s("admin")?"admin":a("engineer")?"engineer":"operator",F=((ke=o==null?void 0:o.branding)==null?void 0:ke.appName)??"LongTail",ie=(Se=o==null?void 0:o.environment)==null?void 0:Se.longTailVersion,$=(q=o==null?void 0:o.environment)==null?void 0:q.hotmeshVersion,ce=(ne=o==null?void 0:o.environment)==null?void 0:ne.nodeEnv;A.useEffect(()=>{const se=ge=>{ge.key==="Escape"&&i()};return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[i]);const ee=rS.filter(se=>lS(z,se.minTier)),T=ee.length>1,Q=[...T?[{id:"viewas",label:"View As",icon:rv}]:[],{id:"features",label:"Features",icon:av}],[le,I]=A.useState(Q[0].id),V=se=>{se===null?Wf():Fw(se)},W=()=>{const se=!y;E(se),se===d?Iw():Vw(se),window.location.reload()},oe=()=>{const se=!R;M(se),Jw(se),window.location.reload()};return h.jsx("div",{className:"fixed inset-0 z-[100] bg-surface-sunken/75 backdrop-blur-sm flex items-center justify-center",onClick:i,children:h.jsxs("div",{className:"relative w-[440px] max-h-[85vh] overflow-y-auto bg-surface-raised px-12 py-10",onClick:se=>se.stopPropagation(),children:[h.jsx("button",{onClick:i,className:"absolute top-4 right-4 text-text-quaternary hover:text-text-secondary transition-colors p-1","aria-label":"Close",children:h.jsx(Yn,{className:"w-4 h-4",strokeWidth:1.5})}),h.jsxs("div",{className:"flex flex-col items-center gap-3 pb-8",children:[h.jsx("span",{className:"logo-mark block w-20 h-20 opacity-50",style:{"--logo-url":`url(${Tt}/logo512.png)`}}),h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-2xl font-light text-text-primary tracking-[0.12em]",children:F}),ie&&h.jsxs("p",{className:"mt-1 text-2xs text-text-tertiary",children:["v",ie,$&&h.jsxs(h.Fragment,{children:[" · HotMesh v",$]}),ce&&ce!=="production"&&h.jsx("span",{className:"ml-1 text-status-warning",children:ce})]})]})]}),h.jsx("hr",{className:"border-surface-border/50 mb-6"}),Q.length>1&&h.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",role:"tablist",children:Q.map(se=>{const ge=le===se.id;return h.jsxs("button",{role:"tab","aria-selected":ge,onClick:()=>I(se.id),title:se.label,className:`flex flex-col items-center gap-1.5 px-5 py-2.5 rounded-lg transition-colors ${ge?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[h.jsx(se.icon,{className:"w-5 h-5",strokeWidth:1.5,...ge?{fill:"currentColor",fillOpacity:.15}:{}}),h.jsx("span",{className:"text-2xs font-medium",children:se.label})]},se.id)})}),le==="viewas"&&T&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"View As"}),ee.map(se=>{const ge=f===se.id,be=se.id===null?`Your view · ${z}`:se.label;return h.jsxs("button",{onClick:()=>V(se.id),className:"w-full text-left flex items-start gap-3 py-2.5 px-1 group",children:[h.jsx("span",{className:`mt-0.5 w-4 h-4 rounded-full border shrink-0 flex items-center justify-center transition-colors ${ge?"border-accent bg-accent":"border-surface-border group-hover:border-accent/60"}`,children:ge&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"})}),h.jsxs("span",{children:[h.jsx("span",{className:`block text-sm font-medium transition-colors ${ge?"text-accent":"text-text-primary group-hover:text-accent"}`,children:be}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:se.description})]})]},String(se.id))})]}),le==="features"&&h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-4",children:"Features"}),h.jsxs("button",{onClick:W,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"AI features"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:y?"Enabled — AI assist, agent labels, bulk AI actions":"Hidden — automation labels, no AI surfaces"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${y?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${y?"translate-x-4":"translate-x-0"}`})})]}),O&&h.jsxs("button",{onClick:oe,className:"w-full text-left flex items-center justify-between py-2.5 px-1 group",children:[h.jsxs("span",{children:[h.jsx("span",{className:"block text-sm font-medium text-text-primary group-hover:text-accent transition-colors",children:"Graph workflows"}),h.jsx("span",{className:"block text-xs text-text-secondary mt-0.5",children:R?"Visible — Graph section shown in Orchestrate sidebar":"Hidden — use Procedural workflows instead"})]}),h.jsx("span",{className:`shrink-0 ml-4 w-9 h-5 rounded-full transition-colors flex items-center px-0.5 ${R?"bg-accent":"bg-surface-border"}`,children:h.jsx("span",{className:`w-4 h-4 rounded-full bg-text-inverse shadow-sm transition-transform ${R?"translate-x-4":"translate-x-0"}`})})]})]}),h.jsx("hr",{className:"border-surface-border/50 mt-8"}),h.jsx("p",{className:"mt-4 text-2xs text-text-quaternary text-center",children:"Esc or click outside to close"})]})})}const _y=[{id:"violet",label:"Violet",swatch:"#7B3BE0"},{id:"red",label:"Brick",swatch:"#DC382D"},{id:"green",label:"Emerald",swatch:"#059669"},{id:"blue",label:"Electric",swatch:"#2563EB"},{id:"rose",label:"Raspberry",swatch:"#D6246E"},{id:"orange",label:"Harvest",swatch:"#E85D04"}],eg="blue",wy="lt.theme";let Sy=[];function cS(i){const t=new Set(_y.map(a=>a.id)),s=new Set;Sy=i.filter(a=>!(a!=null&&a.id)||t.has(a.id)||s.has(a.id)?!1:(s.add(a.id),!0))}function uS(){return[..._y,...Sy]}function Ey(){try{return localStorage.getItem(wy)||eg}catch{return eg}}function jy(i){document.documentElement.dataset.theme=i}function fS(i){try{localStorage.setItem(wy,i)}catch{}jy(i)}const Ay="lt:bookmarks";function hS(){try{const i=localStorage.getItem(Ay);if(!i)return[];const t=JSON.parse(i);return Array.isArray(t)?t:[]}catch{return[]}}function tg(i){try{localStorage.setItem(Ay,JSON.stringify(i))}catch{}}function dS({onToggleEventFeed:i,onToggleDocs:t,onToggleNav:s}){var ke,Se;const a=th(),{user:o,logout:f}=Vn(),{isBuilder:d,isOps:m,viewAs:g,realIsBuilder:y}=py(),{available:E,mine:_}=iS();gy();const{connected:O}=V_(),{data:R}=Mi(),M=Sn(),[z,F]=A.useState(!1),[ie,$]=A.useState(!1),[ce,ee]=A.useState(Ey),[T,Q]=A.useState(hS),le=A.useRef(null),I=(ke=R==null?void 0:R.branding)==null?void 0:ke.appName,V=(Se=R==null?void 0:R.branding)==null?void 0:Se.themes,W=A.useMemo(()=>(cS(V??[]),uS()),[V]),oe=q=>{fS(q),ee(q)},re=()=>{const q=window.prompt("Bookmark label:");if(!(q!=null&&q.trim()))return;const ne=M.pathname+M.search,se=[...T,{label:q.trim(),url:ne}].sort((ge,be)=>ge.label.localeCompare(be.label));Q(se),tg(se),F(!1)},Oe=q=>{const ne=T.filter(se=>!(se.label===q.label&&se.url===q.url));Q(ne),tg(ne)};return A.useEffect(()=>{if(!z)return;const q=ne=>{le.current&&!le.current.contains(ne.target)&&F(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[z]),h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:`h-14 shrink-0 border-b border-surface-border bg-surface-raised flex items-center justify-between pl-2 pr-5 relative ${z?"z-[100]":"z-30"}`,children:[h.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[s&&h.jsx("button",{onClick:s,className:"lg:hidden p-2 text-text-secondary hover:text-text-primary transition-colors","aria-label":"Open navigation",children:h.jsx(lv,{className:"w-5 h-5",strokeWidth:1.5})}),h.jsxs(Ni,{to:"/","aria-label":"Home",className:"shrink-0",onClick:q=>{(q.ctrlKey||q.metaKey)&&(q.preventDefault(),$(!0))},children:[h.jsx(Yo,{appName:I,className:"hidden lg:flex"}),h.jsx(Yo,{appName:I,variant:"comet",className:"flex lg:hidden"})]}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border mx-1"}),h.jsx("button",{onClick:()=>a(-1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go back",children:h.jsx(jg,{className:"w-5 h-5",strokeWidth:2})}),h.jsx("button",{onClick:()=>a(1),className:"p-2 text-accent/60 hover:text-accent transition-colors","aria-label":"Go forward",children:h.jsx(Nf,{className:"w-5 h-5",strokeWidth:2})})]}),h.jsxs("div",{className:"flex items-center gap-5",children:[h.jsxs(Ni,{to:"/escalations/available",className:`flex items-center gap-1.5 text-xs transition-colors ${E>0?"text-status-queued":"text-text-quaternary hover:text-text-secondary"}`,title:"All escalations",children:[h.jsx(Tf,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"all"}),E>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:E})]}),h.jsxs(Ni,{to:"/escalations/queue",className:`flex items-center gap-1.5 text-xs transition-colors ${_>0?"text-status-claimed":"text-text-quaternary hover:text-text-secondary"}`,title:"My escalation queue",children:[h.jsx(Tf,{className:"w-4 h-4",strokeWidth:1.5}),h.jsx("span",{className:"hidden lg:inline",children:"mine"}),_>0&&h.jsx("sup",{className:"tabular-nums font-medium text-[0.5em]",children:_})]}),(d||m)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),h.jsxs("button",{type:"button",onClick:()=>{O?i==null||i():window.location.reload()},className:`hidden lg:flex items-center gap-1.5 text-xs transition-colors ${O?"text-status-success hover:text-status-success/80":"text-text-quaternary hover:text-text-secondary"}`,title:O?"Live events — click to toggle feed":"Events disconnected — click to reconnect",children:[h.jsx(Ag,{className:"w-4 h-4",strokeWidth:1.5}),"events"]})]}),y&&h.jsx(h.Fragment,{children:h.jsxs("button",{onClick:t,className:"hidden lg:flex items-center gap-1.5 text-xs text-text-quaternary hover:text-text-secondary transition-colors",title:"Documentation",children:[h.jsx(Og,{className:"w-4 h-4",strokeWidth:1.5}),"docs"]})}),g&&h.jsx(h.Fragment,{children:h.jsxs("span",{className:"hidden lg:flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full bg-accent/10 border border-accent/25 text-2xs text-accent select-none",children:[h.jsxs("span",{className:"capitalize font-medium tracking-wide",children:[g," View"]}),h.jsx("button",{onClick:Wf,title:"Restore your real view",className:"ml-0.5 rounded-full p-0.5 hover:bg-accent/20 transition-colors",children:h.jsx(Yn,{className:"w-2.5 h-2.5"})})]})}),h.jsx("div",{className:"hidden lg:block w-px h-4 bg-surface-border"}),o&&h.jsxs("div",{className:"relative",ref:le,children:[h.jsxs("button",{onClick:()=>F(q=>!q),className:"btn-ghost flex items-center gap-1",children:[h.jsxs("span",{className:"relative",children:[h.jsx(ov,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),g&&h.jsx("span",{className:"lg:hidden absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-accent"})]}),h.jsx("span",{className:"hidden lg:inline whitespace-nowrap",children:o.displayName||o.username||o.userId}),h.jsx("svg",{className:"hidden lg:block w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),z&&h.jsxs("div",{className:"absolute right-0 top-full mt-1 w-52 bg-surface-raised border border-surface-border rounded-md shadow-lg py-1 z-[100]",children:[h.jsx(Ni,{to:"/credentials",onClick:()=>F(!1),className:"block px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Credentials"}),(d||m)&&h.jsx("button",{onClick:()=>{F(!1),O?i==null||i():window.location.reload()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:O?"Events":"Reconnect events"}),y&&h.jsx("button",{onClick:()=>{F(!1),t==null||t()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Docs"}),g&&h.jsxs("button",{onClick:()=>{F(!1),Wf()},className:"lg:hidden block w-full text-left px-3 py-2 text-xs text-accent hover:bg-surface-hover capitalize",children:["Exit ",g," view"]}),h.jsxs("div",{className:"px-3 py-2 border-t border-surface-border/60",children:[h.jsx("p",{className:"text-2xs font-medium uppercase tracking-widest text-text-tertiary mb-1.5",children:"Theme"}),h.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:W.map(q=>h.jsx("button",{type:"button",onClick:()=>oe(q.id),title:q.label,"aria-label":`${q.label} theme`,className:`w-4 h-4 rounded-full transition-transform hover:scale-110 ${ce===q.id?"ring-2 ring-offset-1 ring-surface-border":""}`,style:{backgroundColor:q.swatch}},q.id))})]}),h.jsx("button",{onClick:()=>{F(!1),f()},className:"block w-full text-left px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Sign Out"}),h.jsxs("div",{className:"border-t border-surface-border/60 pt-1",children:[T.map(q=>h.jsxs("div",{className:"flex items-center group px-3 py-1.5 hover:bg-surface-hover",children:[h.jsx(Ni,{to:q.url,onClick:()=>F(!1),title:q.url,className:"flex-1 min-w-0 text-xs text-text-secondary hover:text-text-primary truncate",children:q.label}),h.jsx("button",{type:"button",onClick:()=>Oe(q),title:`Remove "${q.label}"`,className:"opacity-0 group-hover:opacity-100 transition-opacity ml-1 p-0.5 shrink-0 text-text-quaternary hover:text-status-error",children:h.jsx(Yn,{className:"w-3 h-3"})})]},`${q.label}::${q.url}`)),h.jsx("hr",{className:"border-surface-border/60 mx-3 my-0.5"}),h.jsxs("button",{type:"button",onClick:re,className:"flex items-center gap-1.5 w-full px-3 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:[h.jsx(cv,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),"Add Bookmark"]})]})]})]})]})]}),ie&&h.jsx(oS,{onClose:()=>$(!1)})]})}function Eh({open:i,children:t}){const[s,a]=A.useState(i);return A.useEffect(()=>{i&&a(!0)},[i]),h.jsx("div",{className:`grid transition-[grid-template-rows] duration-300 ease-out ${i?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,onTransitionEnd:()=>{i||a(!1)},children:h.jsx("div",{className:"overflow-hidden",children:s?t:null})})}function eh(i){return({isActive:t})=>{const s="flex items-center rounded-md transition-colors duration-150",a="bg-surface-hover text-text-primary font-medium",o="text-text-secondary hover:text-text-primary hover:bg-surface-hover";return i?`${s} justify-center w-10 h-10 mx-auto ${t?a:o}`:`${s} gap-3 px-4 py-2 text-sm ${t?a:o}`}}function mS(){return({isActive:i})=>`flex items-center gap-3 pl-11 pr-4 py-1.5 text-xs rounded-md transition-colors duration-150 ${i?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary"}`}function pS({group:i,collapsed:t}){const{pathname:s}=Sn(),a=i.matchPaths.some(m=>s.startsWith(m)),[o,f]=A.useState(a),d=o||a;return t?h.jsx(h.Fragment,{children:i.items.map(m=>h.jsx(Tr,{to:m.to,className:eh(!0),title:m.label,children:m.icon&&h.jsx(m.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})},m.to))}):h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>f(m=>!m),className:"w-full flex items-center justify-between px-4 py-2 text-sm rounded-md transition-colors duration-150 text-text-secondary hover:text-text-primary hover:bg-surface-hover",children:[h.jsxs("span",{className:"flex items-center gap-3",children:[i.icon&&h.jsx(i.icon,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:i.label})]}),h.jsx("svg",{className:`w-3.5 h-3.5 text-text-tertiary transition-transform duration-150 ${d?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),h.jsx(Eh,{open:d,children:i.items.map(m=>h.jsxs(Tr,{to:m.to,end:m.end,className:mS(),children:[m.icon&&h.jsx(m.icon,{className:"w-4 h-4 shrink-0 text-accent/75",strokeWidth:1.5}),h.jsx("span",{children:m.label})]},m.to))})]})}function gS(i){return i.kind==="group"}function yS({entry:i,collapsed:t}){const{pathname:s,search:a}=Sn(),o=i.to.includes("?"),f=i.icon&&h.jsx(i.icon,{className:`w-5 h-5 shrink-0 text-accent/75 ${i.iconClassName??""}`,strokeWidth:1.5,...i.solid?{fill:"currentColor"}:{}});if(o){const[d,m]=i.to.split("?"),g=s===d&&a===`?${m}`,y=eh(t)({isActive:g});return h.jsxs(Tr,{to:i.to,className:y,title:t?i.label:void 0,children:[f,!t&&h.jsx("span",{children:i.label})]})}return h.jsxs(Tr,{to:i.to,end:i.end,className:eh(t),title:t?i.label:void 0,children:[f,!t&&h.jsx("span",{children:i.label})]})}function ki({heading:i,entries:t}){const{collapsed:s}=wh();return h.jsxs("div",{className:"space-y-1",children:[s?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:i}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-text-tertiary",children:i}),t.map(a=>gS(a)?h.jsx(pS,{group:a,collapsed:s},a.label):h.jsx(yS,{entry:a,collapsed:s},a.to))]})}function bS({aiEnabled:i=!1,isBuilder:t=!1,isOps:s=!1,viewAs:a=null,canSeePaceBoard:o=!1}){const f={to:"/operations",label:"Pace Board",icon:uv};if(!t&&(!s||a==="engineer"||a==="operator"))return null;if(!t)return h.jsx(ki,{heading:"Monitor",entries:o?[f]:[]});const d=[...o?[f]:[],{to:"/topics",label:"Event Topics",icon:Ag},{to:"/agents",label:i?"Agents":"Automations",icon:fv},{to:"/capabilities",label:"Capabilities",icon:hv}];return h.jsx(ki,{heading:"Monitor",entries:d})}function lA(){return ht({queryKey:["roles"],queryFn:()=>we("/roles")})}function oA(){return ht({queryKey:["roles","escalation-chains"],queryFn:()=>we("/roles/escalation-chains")})}function cA(i){return ht({queryKey:["roles",i,"escalation-targets"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/escalation-targets`),enabled:!!i})}function uA(){const i=bt();return Et({mutationFn:t=>we("/roles/escalation-chains",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function fA(){const i=bt();return Et({mutationFn:t=>we("/roles/escalation-chains",{method:"DELETE",body:JSON.stringify(t)}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function xS(i){return ht({queryKey:["roles","details"],queryFn:()=>we("/roles/details"),enabled:(i==null?void 0:i.enabled)??!0})}function hA(i,t,s=!0){return ht({queryKey:["roles",i,"schema",t??"latest"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function dA(i){return ht({queryKey:["roles",i,"schema-versions"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/schema/versions`),enabled:!!i})}function mA(i,t,s=!0){return ht({queryKey:["roles",i,"list-schema",t??"latest"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/list-schema${t!=null?`?version=${t}`:""}`),enabled:s&&!!i})}function pA(i){return ht({queryKey:["roles",i,"list-schema-versions"],queryFn:()=>we(`/roles/${encodeURIComponent(i)}/list-schema/versions`),enabled:!!i})}function gA(){const i=bt();return Et({mutationFn:t=>we("/roles",{method:"POST",body:JSON.stringify({role:t})}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function yA(){const i=bt();return Et({mutationFn:({role:t,...s})=>we(`/roles/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(s)}),onMutate:async({role:t,...s})=>{await i.cancelQueries({queryKey:["roles","details"]});const a=i.getQueryData(["roles","details"]);return a&&i.setQueryData(["roles","details"],{roles:a.roles.map(o=>o.role===t?{...o,...s}:o)}),{previous:a}},onError:(t,s,a)=>{a!=null&&a.previous&&i.setQueryData(["roles","details"],a.previous)},onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function bA(){const i=bt();return Et({mutationFn:t=>we(`/roles/${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>{i.invalidateQueries({queryKey:["roles"]})}})}function vS(){return ht({queryKey:["me","preferences"],queryFn:()=>we("/me/preferences"),staleTime:6e4})}function _S(){const i=bt();return Et({mutationFn:t=>we("/me/preferences",{method:"PATCH",body:JSON.stringify(t)}),onSuccess:t=>{i.setQueryData(["me","preferences"],t)}})}const vr=i=>{if(i)try{return JSON.parse(i)}catch{return}},Ai=i=>i==null||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0;function wS(i){const t={},s=vr(i.get("facets"));Ai(s)||(t.facets=s);const a=vr(i.get("block"));Ai(a)||(t.block=a);const o=vr(i.get("range"));Ai(o)||(t.range=o);const f=vr(i.get("exists"));Ai(f)||(t.exists=f);const d=vr(i.get("roles"));Ai(d)||(t.roles=d);const m=vr(i.get("orderBy"));Ai(m)||(t.orderBy=m),i.get("available")!=null&&(t.available=i.get("available")==="true");const g=i.get("jeopardy");return(g==="1"||g==="true")&&(t.jeopardy=!0),t}function xA(i,t){const s=(a,o)=>Ai(o)?i.delete(a):i.set(a,JSON.stringify(o));s("facets",t.facets),s("block",t.block),s("range",t.range),s("exists",t.exists),s("roles",t.roles),s("orderBy",t.orderBy),t.available==null?i.delete("available"):i.set("available",String(t.available)),t.jeopardy===!0?i.set("jeopardy","1"):i.delete("jeopardy")}function vA(i,t,s){const a=typeof t=="object"&&t!==null?JSON.stringify(t):t,o=encodeURIComponent(JSON.stringify({[i]:a}));return s?`/escalations/available?role=${encodeURIComponent(s)}&facets=${o}&status=all`:`/escalations/available?facets=${o}&status=all`}function _A(i){var t,s,a;return Object.keys(i.facets??{}).length+(((t=i.block)==null?void 0:t.length)??0)+(((s=i.range)==null?void 0:s.length)??0)+(((a=i.exists)==null?void 0:a.length)??0)+(i.available!=null?1:0)+(i.jeopardy===!0?1:0)}function SS(i,t){const s=(i==null?void 0:i.pinnedViews)??[],a=new Set((i==null?void 0:i.hiddenRolePins)??[]),o=new Set(s.map(m=>m.label)),f=[...s],d=new Set;for(const{role:m,pins:g}of t)for(const y of g)o.has(y.label)||a.has(y.label)||d.has(y.label)||(d.add(y.label),f.push({...y,id:`role:${m}:${y.label}`,fromRole:m}));return f}function ES(i){let t;try{t=new URL(i,"http://local")}catch{return null}if(t.pathname!=="/escalations/available"&&t.pathname!=="/escalations")return null;const s=t.searchParams,a=wS(s),o=s.get("status")||void 0,f=t.pathname==="/escalations/available"&&(o===void 0||o==="available");return{available:f,params:{...a,role:s.get("role")||void 0,type:s.get("type")||void 0,priority:s.get("priority")?parseInt(s.get("priority"),10):void 0,status:f||o==="all"?void 0:o,search:s.get("search")||void 0}}}function jS(){return`pin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function AS(){var ie;const{collapsed:i}=wh(),{user:t}=Vn(),s=vS(),a=_S(),o=A.useMemo(()=>new Set(((t==null?void 0:t.roles)??[]).map($=>$.role)),[t]),{data:f}=xS({enabled:o.size>0}),d=bt();Wg(`${Xg}.system.escalation.>`,()=>{d.invalidateQueries({queryKey:["escalations"]})});const m=(ie=s.data)==null?void 0:ie.preferences,g=A.useMemo(()=>((f==null?void 0:f.roles)??[]).filter($=>o.has($.role)&&Array.isArray($.default_pins)&&$.default_pins.length>0).map($=>({role:$.role,pins:$.default_pins})),[f,o]),y=A.useMemo(()=>SS(m,g),[m,g]),E=(m==null?void 0:m.pinnedViews)??[],_=A.useRef(null),O=$=>a.mutate({pinnedViews:$}),R=$=>O(E.filter(ce=>ce.id!==$)),M=$=>O([...E,{id:jS(),label:$.label,url:$.url,badge:$.badge}]),z=$=>a.mutate({hiddenRolePins:[...(m==null?void 0:m.hiddenRolePins)??[],$]}),F=($,ce)=>{if($===ce)return;const ee=[...E],[T]=ee.splice($,1);ee.splice(ce,0,T),O(ee)};return y.length===0?null:h.jsxs("div",{className:"space-y-1",children:[i?h.jsx("div",{className:"h-px bg-surface-border mx-3 my-2",title:"Pinned"}):h.jsx("p",{className:"px-4 pt-5 pb-2 text-xs font-semibold uppercase tracking-wider text-accent/80",children:"Pinned"}),y.map($=>{const ce=$.fromRole?-1:E.findIndex(ee=>ee.id===$.id);return h.jsx(OS,{pin:$,collapsed:i,draggable:ce!==-1,onDragStart:()=>{_.current=ce},onDropOn:()=>{_.current!==null&&ce!==-1&&F(_.current,ce),_.current=null},onRemove:$.fromRole?void 0:()=>R($.id),onPromote:$.fromRole?()=>M($):void 0,onHide:$.fromRole?()=>z($.label):void 0},$.id)})]})}function OS({pin:i,collapsed:t,draggable:s,onDragStart:a,onDropOn:o,onRemove:f,onPromote:d,onHide:m}){const{pathname:g,search:y}=Sn(),[E,_=""]=i.url.split("?"),O=g===E&&y===(_?`?${_}`:""),R="group flex items-center rounded-md transition-colors duration-150",M=O?"bg-surface-hover text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover";return t?h.jsx(Tr,{to:i.url,className:`${R} ${M} justify-center w-10 h-10 mx-auto`,title:i.label,children:h.jsx(d0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5})}):h.jsxs("div",{className:`${R} ${M}`,draggable:s,onDragStart:a,onDragOver:z=>z.preventDefault(),onDrop:o,children:[h.jsxs(Tr,{to:i.url,className:"flex items-center gap-3 pl-4 py-2 text-sm flex-1 min-w-0",children:[h.jsx(d0,{className:"w-5 h-5 shrink-0 text-accent/75",strokeWidth:1.5,...i.fromRole?{}:{fill:"currentColor",fillOpacity:.15}}),h.jsx("span",{className:"truncate",children:i.label}),i.badge&&h.jsx(NS,{url:i.url}),i.fromRole&&h.jsx("span",{className:"shrink-0 text-2xs uppercase tracking-wider text-text-quaternary",title:`Provided by the ${i.fromRole} role`,children:"role"})]}),h.jsxs("span",{className:"flex items-center pr-2 gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[d&&h.jsx("button",{onClick:d,title:"Make mine — copy into my pins",className:"p-1 text-text-quaternary hover:text-accent transition-colors",children:h.jsx(Ng,{className:"w-3 h-3"})}),m&&h.jsx("button",{onClick:m,title:"Hide this role pin",className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(dv,{className:"w-3 h-3"})}),f&&h.jsx("button",{onClick:f,title:`Remove "${i.label}"`,className:"p-1 text-text-quaternary hover:text-status-error transition-colors",children:h.jsx(Yn,{className:"w-3 h-3"})})]})]})}function NS({url:i}){var d;const t=A.useMemo(()=>ES(i),[i]),s={limit:1,staleTime:15e3},a=vy({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&t.available}),o=xy({...(t==null?void 0:t.params)??{},...s,enabled:!!t&&!t.available});if(!t)return null;const f=t.available?a:o;return f.isError||((d=f.data)==null?void 0:d.total)===void 0?null:h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-full bg-accent/10 text-accent text-2xs font-semibold tabular-nums",children:f.data.total})}function TS(){var f;const{data:i}=Mi(),t=(f=i==null?void 0:i.features)==null?void 0:f.graphWorkflows,s=t===!0||t!==!1&&my(),a=[{to:"/workflows/registry",label:"Registry",icon:m0},{to:"/workflows/durable/invoke",label:"Invoke",icon:p0},{to:"/workflows/executions",label:"Executions",icon:g0}],o=s?[{kind:"group",label:"Procedural",icon:mv,matchPaths:["/workflows/registry","/workflows/durable/invoke","/workflows/executions","/workflows/durable/executions","/workflows/start","/workflows/workers","/workflows/tasks"],items:a},{kind:"group",label:"Graph",icon:nh,matchPaths:["/mcp/workflows","/mcp/executions"],items:[{to:"/mcp/workflows",label:"Configure",icon:m0,end:!0},{to:"/mcp/workflows/invoke",label:"Invoke",icon:p0},{to:"/mcp/executions",label:"Executions",icon:g0}]}]:a;return h.jsx(ki,{heading:"Orchestrate",entries:o})}const kS=[{to:"/mcp/queries",label:"Designer",icon:pv},{to:"/mcp/servers",label:"Servers & Tools",icon:gv}];function CS(){return h.jsx(ki,{heading:"Design",entries:kS})}const MS=[{to:"/files",label:"Files",icon:yv},{to:"/knowledge",label:"Knowledge",icon:bv}];function RS(){return h.jsx(ki,{heading:"Storage",entries:MS})}function DS({isBuilder:i=!1,isOps:t=!1}){var d;const{data:s}=Mi(),a=((d=s==null?void 0:s.features)==null?void 0:d.dbMaintenance)!==!1,o=[{to:"/admin/users",label:"Accounts",icon:xv},...i||t?[{to:"/admin/roles",label:"Roles",icon:Tf}]:[]],f=[{to:"/admin/controlplane",label:"Routers",icon:vv},{to:"/admin/streams",label:"Messages",icon:_v},...a?[{to:"/admin/maintenance",label:"DB Maintenance",icon:wv}]:[]];return h.jsxs(h.Fragment,{children:[h.jsx(ki,{heading:"Identity & Access",entries:o}),i&&h.jsx(ki,{heading:"Infrastructure",entries:f})]})}function Oy({aiEnabled:i,isBuilder:t,isOps:s,viewAs:a,canSeePaceBoard:o}){return h.jsxs(h.Fragment,{children:[h.jsx(bS,{aiEnabled:i,isBuilder:t,isOps:s,viewAs:a,canSeePaceBoard:o}),h.jsx(AS,{}),t&&h.jsx(TS,{}),t&&i&&h.jsx(CS,{}),t&&h.jsx(RS,{}),(t||s)&&h.jsx(DS,{isBuilder:t,isOps:s})]})}function qS({open:i,onClose:t,...s}){const a=Sn();return A.useEffect(()=>{t()},[a.pathname]),h.jsxs("div",{className:`lg:hidden fixed inset-y-0 left-0 z-40 flex ${i?"":"pointer-events-none"}`,children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${i?"opacity-100":"opacity-0"}`,onClick:t,"aria-hidden":!0}),h.jsxs("div",{className:`relative w-72 max-w-[85vw] h-full bg-surface-raised border-r border-surface-border shadow-xl flex flex-col transition-transform duration-200 ease-out ${i?"translate-x-0":"-translate-x-full"}`,children:[h.jsx("div",{className:"flex items-center justify-end px-3 pt-3 shrink-0",children:h.jsx("button",{onClick:t,className:"p-1.5 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-hover transition-colors","aria-label":"Close navigation",children:h.jsx(Yn,{className:"w-4 h-4"})})}),h.jsx("nav",{className:"flex-1 px-3 pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(eS,{children:h.jsx(Oy,{...s})})})]})]})}const Ny="lt_event_feed_patterns";function zS(i){if(i.startsWith("/topics/")){const f=decodeURIComponent(i.replace("/topics/",""));if(f&&!f.includes("/"))return`lt.events.${f}`}const t=i.match(/^\/escalations\/detail\/(.+)/);if(t)return`lt.events.system.escalation.${t[1]}.>`;if(i.startsWith("/escalations"))return"lt.events.system.escalation.>";const s=i.match(/^\/workflows\/(?:durable\/)?executions\/(.+)/);if(s)return`lt.events.system.workflow.${s[1]}.>`;if(i.startsWith("/workflows"))return"lt.events.system.workflow.>";const a=i.match(/^\/agents\/([^/]+)$/);if(a&&a[1]!=="new")return`lt.events.system.agent.${a[1]}.>`;if(i.startsWith("/agents"))return"lt.events.system.agent.>";if(i.startsWith("/knowledge"))return"lt.events.system.knowledge.>";if(i.startsWith("/files"))return"lt.events.system.file.>";if(i==="/")return"lt.events.system.>";const o=i.match(/^\/mcp\/executions\/(.+)/);return o?`lt.events.system.*.${o[1]}.>`:(i.startsWith("/mcp"),"lt.events.system.>")}function US(){try{const i=localStorage.getItem(Ny);return i?JSON.parse(i):[]}catch{return[]}}function jf(i){try{localStorage.setItem(Ny,JSON.stringify(i))}catch{}}function BS(){const{pathname:i}=Sn(),[t,s]=A.useState(US),a=A.useMemo(()=>zS(i),[i]),o=A.useMemo(()=>{const g=new Set([a,...t]);return Array.from(g)},[a,t]),f=A.useCallback(g=>{const y=g.startsWith("lt.events.")?g:`lt.events.${g}`;s(E=>{if(E.includes(y))return E;const _=[...E,y];return jf(_),_})},[]),d=A.useCallback(g=>{s(y=>{const E=y.filter(_=>_!==g);return jf(E),E})},[]),m=A.useCallback(()=>{s([]),jf([])},[]);return{patterns:o,pagePattern:a,userPatterns:t,addPattern:f,removePattern:d,clearUserPatterns:m}}function LS({children:i,className:t=""}){return h.jsx("p",{className:`text-2xs font-semibold uppercase tracking-widest text-text-tertiary ${t}`,children:i})}const Af=280,ng="cubic-bezier(0.4, 0, 0.2, 1)",Oo=40;function PS(i){if(!i)return"scale(0.92)";const t=window.innerWidth,s=window.innerHeight,a=t-Oo*2,o=s-Oo*2,f=i.width/a,d=i.height/o,m=i.left+i.width/2-(Oo+a/2),g=i.top+i.height/2-(Oo+o/2);return`translate(${m}px, ${g}px) scale(${f}, ${d})`}function Ty({open:i,onClose:t,sourceRef:s,children:a}){const[o,f]=A.useState(null),d=A.useRef(null),m=A.useRef(!1);A.useEffect(()=>{var O,R;i&&!m.current?(d.current=((O=s==null?void 0:s.current)==null?void 0:O.getBoundingClientRect())??null,f("entering")):!i&&m.current&&o==="open"&&(d.current=((R=s==null?void 0:s.current)==null?void 0:R.getBoundingClientRect())??null,f("exiting")),m.current=i},[i,s,o]),A.useEffect(()=>{if(o!=="entering")return;const O=requestAnimationFrame(()=>{requestAnimationFrame(()=>f("open"))});return()=>cancelAnimationFrame(O)},[o]),A.useEffect(()=>{if(o)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[o]),A.useEffect(()=>{if(!o)return;const O=R=>{R.key==="Escape"&&t()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,t]);const g=A.useCallback(O=>{O.propertyName==="transform"&&o==="exiting"&&f(null)},[o]);if(A.useEffect(()=>{if(o!=="exiting")return;const O=setTimeout(()=>f(null),Af+50);return()=>clearTimeout(O)},[o]),!o)return null;const y=o==="entering"||o==="exiting",E=y?PS(d.current):"none",_=y?0:1;return Eg.createPortal(h.jsx("div",{className:"fixed inset-0 z-50 overflow-auto p-10",style:{transformOrigin:"center center",transition:`transform ${Af}ms ${ng}, opacity ${Af}ms ${ng}`,transform:E,opacity:_,backgroundColor:"rgb(var(--lt-surface))"},onTransitionEnd:g,children:a}),document.body)}function HS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h8M4 18h12"})})}function $S({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7l-5 5 5 5M16 7l5 5-5 5"})})}function YS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}function GS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}function VS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9L3.5 3.5M9 15v4.5M9 15H4.5M9 15l-5.5 5.5M15 9h4.5M15 9V4.5M15 9l5.5-5.5M15 15h4.5M15 15v4.5m0-4.5l5.5 5.5"})})}function IS({className:i}){return h.jsx("svg",{className:i,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5v-4m0 4h-4m4 0l-5-5"})})}function FS(i){const t=i.trim().split(`
|
|
54
54
|
`);if(t.length<2)return i;const s=m=>m.split("|").map(g=>g.trim()).filter(Boolean),a=s(t[0]),o=t.slice(2),f=a.map(m=>`<th class="px-3 py-1.5 text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary">${m}</th>`).join(""),d=o.map(m=>`<tr class="border-t border-surface-border">${s(m).map(E=>`<td class="px-3 py-1.5 text-xs text-text-secondary">${E}</td>`).join("")}</tr>`).join("");return`<table class="w-full my-3 text-xs"><thead><tr class="border-b border-surface-border">${f}</tr></thead><tbody>${d}</tbody></table>`}function No(i){return i.toLowerCase().replace(/<[^>]+>/g,"").replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").trim()}function JS(i){const t=[];let s=i.replace(/```(\w*)\n([\s\S]*?)```/g,(g,y,E)=>{const _=t.length;return t.push(`<pre class="bg-surface-sunken rounded p-3 my-2 overflow-x-auto text-2xs leading-relaxed"><code>${E}</code></pre>`),`\0CODE${_}\0`});const a=/^(\|.+\|)\n(\|[-| :]+\|)\n((?:\|.+\|\n?)+)/gm;s=s.replace(a,(g,y,E,_)=>FS(`${y}
|
|
55
55
|
${E}
|
|
56
56
|
${_.trimEnd()}`)),s=s.replace(/`([^`]+)`/g,'<code class="bg-surface-sunken px-1 py-0.5 rounded text-2xs">$1</code>'),s=s.replace(/^#### (.+)$/gm,(g,y)=>`<h4 id="${No(y)}" class="text-xs font-semibold text-text-primary mt-4 mb-1">${y}</h4>`).replace(/^### (.+)$/gm,(g,y)=>`<h3 id="${No(y)}" class="text-sm font-semibold text-text-primary mt-5 mb-1.5">${y}</h3>`).replace(/^## (.+)$/gm,(g,y)=>`<h2 id="${No(y)}" class="text-base font-semibold text-text-primary mt-6 mb-2 pb-1 border-b border-surface-border">${y}</h2>`).replace(/^# (.+)$/gm,(g,y)=>`<h1 id="${No(y)}" class="text-lg font-bold text-text-primary mb-3">${y}</h1>`),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(#([^)]+)\)/g,'<a data-anchor="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]*\.md(?:#[^)]*)?)\)/g,'<a data-doc-link="$2" class="text-accent hover:underline cursor-pointer">$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent hover:underline">$1</a>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^ - (.+)$/gm,'<li class="ml-8 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^- (.+)$/gm,'<li class="ml-4 list-disc text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^\d+\. (.+)$/gm,'<li class="ml-4 list-decimal text-xs -my-1" style="line-height:1.1">$1</li>').replace(/^---+$/gm,'<hr class="border-surface-border my-4" />').replace(/(?:^> (.+)$\n?)+/gm,g=>{const y=g.replace(/^> /gm,"").trim(),E=/⚠️|warning|caution/i.test(y),_=/note:|ℹ️|info/i.test(y);return`<div class="${E?"bg-status-warning/5":_?"bg-accent/5":"bg-surface-sunken/50"} ${E?"border-status-warning":_?"border-accent":"border-text-tertiary"} border-l-2 rounded-r-md px-3 py-2 my-3 text-xs text-text-secondary leading-relaxed">${y}</div>`}).replace(/\n\n/g,"\0PARA\0").replace(/\n/g,"<br/>");const o=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=g=>new RegExp(`(${o(g)}[\\s\\S]*?<\\/li>(?:<br\\/>)?)+`,"g");s=s.replace(f('<li class="ml-8 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-disc'),g=>`<ul class="mb-3">${g}</ul>`),s=s.replace(f('<li class="ml-4 list-decimal'),g=>`<ol class="list-decimal mb-3">${g}</ol>`),s=s.replace(/\x00CODE(\d+)\x00/g,(g,y)=>t[parseInt(y,10)]);const d="text-xs leading-relaxed text-text-secondary mb-2",m=/<\/(h[1-4]|pre|table|ul|ol|hr|div)>/;return s=s.split("\0PARA\0").map(g=>{const y=g.trim();if(!y)return"";const E=[];let _=y,O;for(;(O=m.exec(_))!==null;){const R=O.index+O[0].length;E.push(_.slice(0,R)),_=_.slice(R).replace(/^<br\/>/,"").trim(),m.lastIndex=0}return _&&E.push(_),E.map(R=>{const M=R.trim();return M?/^\s*<(h[1-4]|pre|table|ul|ol|hr|div)/.test(M)?M:`<p class="${d}">${M}</p>`:""}).join("")}).join(""),s}const QS=/(\*\*|^#{1,4}\s|^- |^\d+\.\s|```|^\|.*\|$|\[.+\]\(.+\))/m;function KS(i){return QS.test(i)}function jh({content:i,className:t,onClick:s}){const a=A.useMemo(()=>JS(i),[i]);return h.jsx("div",{className:t,onClick:s,dangerouslySetInnerHTML:{__html:a}})}function Go({data:i,depth:t=0,generation:s}){const o=s!==void 0&&s>0&&s%2===1?!1:t>0,[f,d]=A.useState(o),[m,g]=A.useState(s);if(s!==void 0&&s!==m&&(g(s),d(s%2===0&&t>0)),i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return h.jsxs("span",{className:"text-text-primary",children:['"',i,'"']});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary",children:"[]"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["[",i.length," items]"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"["}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:i.map((y,E)=>h.jsxs("div",{children:[h.jsx(Go,{data:y,depth:t+1,generation:s}),E<i.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"]"})]});if(typeof i=="object"){const y=Object.entries(i);return y.length===0?h.jsx("span",{className:"text-text-tertiary",children:"{}"}):f?h.jsxs("button",{onClick:()=>d(!1),className:"text-text-secondary hover:text-text-primary",children:["{","...","}"]}):h.jsxs("span",{children:[h.jsx("button",{onClick:()=>d(!0),className:"text-text-tertiary hover:text-text-primary",children:"{"}),h.jsx("div",{className:"pl-4 border-l border-surface-border ml-1",children:y.map(([E,_],O)=>h.jsxs("div",{children:[h.jsx("span",{className:"text-text-secondary",children:E}),h.jsx("span",{className:"text-text-tertiary",children:": "}),h.jsx(Go,{data:_,depth:t+1,generation:s}),O<y.length-1&&h.jsx("span",{className:"text-text-tertiary",children:","})]},E))}),h.jsx("span",{className:"text-text-tertiary",children:"}"})]})}return h.jsx("span",{children:String(i)})}function Ya({data:i,depth:t=0}){if(i==null)return h.jsx("span",{className:"text-text-tertiary italic",children:"null"});if(typeof i=="string")return i.length>40&&KS(i)?h.jsx(jh,{content:i}):h.jsx("span",{className:"text-text-primary",children:i});if(typeof i=="number"||typeof i=="boolean")return h.jsx("span",{className:"text-text-primary font-medium",children:String(i)});if(Array.isArray(i))return i.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty list"}):h.jsx("div",{className:"space-y-2",children:i.map((s,a)=>h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-text-tertiary text-2xs shrink-0",children:[a+1,"."]}),h.jsx("div",{className:"flex-1",children:h.jsx(Ya,{data:s,depth:t+1})})]},a))});if(typeof i=="object"){const s=Object.entries(i);return s.length===0?h.jsx("span",{className:"text-text-tertiary italic",children:"empty"}):h.jsx("div",{className:t>0?"pl-4 border-l border-surface-border space-y-3":"space-y-3",children:s.map(([a,o])=>{const f=o===null||typeof o!="object";return h.jsxs("div",{children:[h.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:a.replace(/[_-]/g," ")}),f?h.jsx("p",{className:"text-sm text-text-primary",children:h.jsx(Ya,{data:o,depth:t+1})}):h.jsx(Ya,{data:o,depth:t+1})]},a)})})}return h.jsx("span",{children:String(i)})}function sg({mode:i,setMode:t,isCollapsed:s,onToggleCollapse:a,onCopy:o,copied:f,onFullscreen:d,onClose:m,large:g}){const y=g?"w-5 h-5":"w-3.5 h-3.5",E=`${g?"p-2":"p-1.5"} rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150`;return h.jsxs("div",{className:"flex items-center gap-0.5 bg-surface-sunken/80 rounded-md backdrop-blur-sm",children:[i==="json"&&h.jsx("button",{onClick:a,className:E,title:s?"Expand all":"Collapse all",children:s?h.jsx(IS,{className:y}):h.jsx(VS,{className:y})}),h.jsx("button",{onClick:()=>t(i==="json"?"tree":"json"),className:E,title:i==="json"?"Outline view":"JSON view",children:i==="json"?h.jsx(HS,{className:y}):h.jsx($S,{className:y})}),h.jsx("button",{onClick:o,className:E,title:"Copy to clipboard",children:f?h.jsx(GS,{className:`${y} text-status-success`}):h.jsx(YS,{className:y})}),d&&h.jsx("button",{onClick:d,className:E,title:"Fullscreen",children:h.jsx(Tg,{className:y})}),m&&h.jsx("button",{onClick:m,className:E,title:"Close (Esc)",children:h.jsx(kg,{className:y})})]})}function XS({data:i,label:t,variant:s,defaultCollapsed:a=!1,defaultMode:o}){const f=A.useRef(null),[d,m]=A.useState(o??"json"),[g,y]=A.useState(!1),[E,_]=A.useState(!1),[O,R]=A.useState(a?0:1),[M,z]=A.useState(1),F=O%2===0,ie=M%2===0,$=A.useCallback(()=>R(W=>W+1),[]),ce=A.useCallback(()=>z(W=>W+1),[]);let ee=i;if(typeof i=="string")try{ee=JSON.parse(i)}catch{}const T=async()=>{const W=typeof i=="string"?i:JSON.stringify(ee,null,2);await navigator.clipboard.writeText(W),y(!0),setTimeout(()=>y(!1),2e3)},Q=A.useCallback(()=>{z(1),_(!0)},[]),le=s==="panel",I=le?"border border-accent-muted/40 rounded-lg p-3 bg-surface-hover/30":"",V=le?"font-mono text-xs leading-relaxed bg-surface-raised rounded-md p-4 overflow-x-auto break-all":"font-mono text-xs leading-relaxed bg-surface-sunken rounded-md p-4 overflow-x-auto break-all";return h.jsxs("div",{className:I,children:[t&&h.jsx(LS,{children:t}),h.jsxs("div",{ref:f,className:"relative",children:[h.jsx("div",{className:"absolute top-2 right-2 z-[5]",children:h.jsx(sg,{mode:d,setMode:m,isCollapsed:F,onToggleCollapse:$,onCopy:T,copied:g,onFullscreen:Q})}),h.jsx("div",{className:V,children:d==="json"?h.jsx(Go,{data:ee,generation:O}):h.jsx(Ya,{data:ee})})]}),h.jsxs(Ty,{open:E,onClose:()=>_(!1),sourceRef:f,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx(sg,{mode:d,setMode:m,isCollapsed:ie,onToggleCollapse:ce,onCopy:T,copied:g,onClose:()=>_(!1),large:!0})}),h.jsx("div",{className:"font-mono text-sm leading-relaxed",children:d==="json"?h.jsx(Go,{data:ee,generation:M}):h.jsx(Ya,{data:ee})})]})]})}const ZS=100,ig=500;let WS=0;const ky={"escalation.created":"text-status-active","escalation.claimed":"text-status-warning","escalation.released":"text-text-tertiary","escalation.resolved":"text-status-success","task.created":"text-accent","task.completed":"text-status-success","task.failed":"text-status-error","task.escalated":"text-status-warning","workflow.started":"text-accent","workflow.completed":"text-status-success","workflow.failed":"text-status-error","activity.started":"text-status-active","activity.completed":"text-status-success","activity.failed":"text-status-error","knowledge.stored":"text-accent","knowledge.deleted":"text-text-tertiary","agent.started":"text-accent","agent.completed":"text-status-success","agent.failed":"text-status-error","agent.status_changed":"text-status-active",milestone:"text-accent"};function Cy(i){const t=i.split(".");return t[0]==="system"&&t.length>=3?`${t[1]}.${t[t.length-1]}`:i}function rg({event:i,forceExpanded:t=!1}){var O,R;const[s,a]=A.useState(t),o=ky[Cy(i.type)]||"text-text-tertiary";A.useEffect(()=>{a(t)},[t]);const f=t,d=f?"text-xs":"text-2xs",m=f?"text-xs":"text-2xs",g=f?"text-xs":"text-2xs",y=f?"w-3.5 h-3.5":"w-2.5 h-2.5",E=f?"py-2 px-4":"py-1 px-3",_=f?"pb-4 px-4":"pb-2 px-3";return h.jsxs("div",{className:"border-b border-surface-border/30 last:border-b-0",children:[h.jsxs("button",{onClick:()=>a(!s),className:`flex items-center gap-2 ${E} w-full text-left hover:bg-surface-hover/50 transition-colors`,children:[h.jsx("span",{className:`${d} font-mono text-text-tertiary whitespace-nowrap tabular-nums shrink-0`,children:new Date(i.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),h.jsx("span",{className:`${m} font-medium px-1 py-0.5 rounded ${o} bg-surface-sunken whitespace-nowrap shrink-0`,children:i.type}),h.jsxs("span",{className:`${g} text-text-tertiary font-mono flex-1 min-w-0 truncate`,children:[(O=i.data)!=null&&O.workflowId?String(i.data.workflowId):"",(R=i.data)!=null&&R.escalationId?` esc:${String(i.data.escalationId).slice(0,12)}`:""]}),h.jsx("svg",{className:`${y} text-text-tertiary shrink-0 transition-transform duration-150 ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h.jsx(Eh,{open:s,children:h.jsx("div",{className:_,children:h.jsx(XS,{data:i.data})})})]})}function e2({open:i,onToggle:t,configOpen:s,onToggleConfig:a}){const[o,f]=A.useState([]),[d,m]=A.useState(!1),[g,y]=A.useState(""),E=A.useRef(null),_=A.useRef(new Map),{subscribe:O}=A.useContext(Xa),{patterns:R,pagePattern:M,userPatterns:z,addPattern:F,removePattern:ie}=BS(),$=A.useCallback(ee=>{const T=String(ee.type||"unknown");if(T.startsWith("mesh."))return;const Q=`${T}:${ee.timestamp||""}:${ee.escalationId||ee.workflowId||ee.taskId||""}`,le=Date.now(),I=_.current.get(Q);if(!(I&&le-I<ig)){if(_.current.set(Q,le),_.current.size>200)for(const[V,W]of _.current)le-W>ig*2&&_.current.delete(V);f(V=>[{id:++WS,type:T,timestamp:ee.timestamp||new Date().toISOString(),data:ee},...V].slice(0,ZS))}},[]),ce=A.useRef($);return ce.current=$,A.useEffect(()=>{const ee=R.map(T=>O(T,Q=>ce.current(Q)));return()=>ee.forEach(T=>T())},[O,R.join(",")]),A.useEffect(()=>{i&&E.current&&(E.current.scrollTop=0)},[o.length,i]),h.jsxs("div",{className:"shrink-0 border-t border-surface-border bg-surface-raised",children:[h.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full px-4 py-1.5 text-left hover:bg-surface-hover transition-colors",children:[i?h.jsx(Sv,{className:"w-3 h-3 text-text-tertiary"}):h.jsx(Ev,{className:"w-3 h-3 text-text-tertiary"}),h.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Event Stream"}),o.length>0&&h.jsxs("span",{className:"text-2xs text-text-tertiary",children:[o.length," events"]}),o.length>0&&!i&&h.jsx("span",{className:`text-2xs font-medium px-1 py-0.5 rounded ${ky[Cy(o[0].type)]||"text-text-tertiary"} bg-surface-sunken`,children:o[0].type}),h.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[h.jsx("span",{className:`p-0.5 cursor-pointer ${s?"text-accent":"text-text-tertiary hover:text-text-primary"}`,title:"Subscription config",onClick:ee=>{ee.stopPropagation(),a()},children:h.jsx(jv,{className:"w-3 h-3"})}),o.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Fullscreen",onClick:ee=>{ee.stopPropagation(),m(!0)},children:h.jsx(Tg,{className:"w-3 h-3"})}),h.jsx("span",{className:"text-text-tertiary hover:text-text-primary p-0.5 cursor-pointer",title:"Clear events",onClick:ee=>{ee.stopPropagation(),f([])},children:h.jsx(Av,{className:"w-3 h-3"})})]})]})]}),s&&h.jsxs("div",{className:"px-4 py-2 border-t border-surface-border/50 bg-surface-sunken/30",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-1.5",children:[h.jsx("span",{className:"text-2xs text-text-quaternary uppercase tracking-wider shrink-0",children:"Subscribed:"}),h.jsx("span",{className:"text-2xs font-mono text-accent px-1.5 py-0.5 bg-accent/10 rounded",children:M.replace("lt.events.","")}),z.map(ee=>h.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-mono text-text-secondary px-1.5 py-0.5 bg-surface-sunken rounded",children:[ee.replace("lt.events.",""),h.jsx("button",{onClick:()=>ie(ee),className:"text-text-quaternary hover:text-status-error",children:h.jsx(Yn,{className:"w-2 h-2"})})]},ee))]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",value:g,onChange:ee=>y(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&g.trim()&&(F(g.trim()),y(""))},placeholder:"task.> or file.stored",className:"input text-2xs font-mono flex-1 py-1"}),h.jsxs("button",{onClick:()=>{g.trim()&&(F(g.trim()),y(""))},className:"text-2xs text-accent hover:text-accent-hover flex items-center gap-0.5",children:[h.jsx(Ng,{className:"w-2.5 h-2.5"})," Add"]})]})]}),h.jsx(Eh,{open:i,children:h.jsx("div",{ref:E,className:"h-48 overflow-y-auto",children:o.length===0?h.jsx("p",{className:"text-2xs text-text-tertiary py-4 text-center",children:"Waiting for events..."}):o.map(ee=>h.jsx(rg,{event:ee},ee.id))})}),h.jsxs(Ty,{open:d,onClose:()=>m(!1),sourceRef:E,children:[h.jsx("div",{className:"sticky top-0 float-right z-10",children:h.jsx("button",{onClick:()=>m(!1),className:"p-2 rounded text-text-tertiary hover:text-text-primary hover:bg-surface-raised transition-colors duration-150 bg-surface-sunken/80 backdrop-blur-sm",title:"Close (Esc)",children:h.jsx(kg,{className:"w-5 h-5"})})}),o.length===0?h.jsx("p",{className:"text-sm text-text-tertiary py-8",children:"No events captured"}):o.map(ee=>h.jsx(rg,{event:ee,forceExpanded:!0},ee.id))]})]})}function t2(){return ht({queryKey:["docs"],queryFn:()=>we("/docs"),staleTime:5*6e4})}function n2(i){return ht({queryKey:["docs",i],queryFn:()=>we(`/docs/read?path=${encodeURIComponent(i)}`),enabled:!!i,staleTime:5*6e4})}function s2(){const[i,t]=A.useState([]),[s,a]=A.useState([]),[o,f]=A.useState(null),d=A.useRef(o),m=A.useRef(i),g=A.useRef(s);d.current=o,m.current=i,g.current=s;const y=A.useCallback((M,z)=>{var ie;const F=d.current;if(F){const $=((ie=z==null?void 0:z.current)==null?void 0:ie.scrollTop)??0;t([...m.current,{...F,scrollTop:$}])}a([]),f({path:M,scrollTop:0})},[]),E=A.useCallback(M=>{var $;const z=m.current;if(z.length===0)return;const F=z[z.length-1],ie=d.current;if(ie){const ce=(($=M==null?void 0:M.current)==null?void 0:$.scrollTop)??0;a([...g.current,{...ie,scrollTop:ce}])}t(z.slice(0,-1)),f(F),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=F.scrollTop)})},[]),_=A.useCallback(M=>{var $;const z=g.current;if(z.length===0)return;const F=z[z.length-1],ie=d.current;if(ie){const ce=(($=M==null?void 0:M.current)==null?void 0:$.scrollTop)??0;t([...m.current,{...ie,scrollTop:ce}])}a(z.slice(0,-1)),f(F),requestAnimationFrame(()=>{M!=null&&M.current&&(M.current.scrollTop=F.scrollTop)})},[]),O=A.useCallback(M=>{var ie,$;const z=d.current;if(!z)return;const F=((ie=M==null?void 0:M.current)==null?void 0:ie.scrollTop)??0;t([...m.current,{...z,scrollTop:F}]),a([]),f({...z,scrollTop:(($=M==null?void 0:M.current)==null?void 0:$.scrollTop)??0})},[]),R=A.useCallback(()=>{t([]),a([]),f(null)},[]);return{current:o,backStack:i,forwardStack:s,navigate:y,goBack:E,goForward:_,pushScrollPosition:O,reset:R}}function i2(i,t){const[s,a]=i.split("#");let o=s;if(o.startsWith("./")||o.startsWith("../")){const d=((t?t.replace(/[^/]+$/,""):"")+o).split("/"),m=[];for(const g of d)g===".."?m.pop():g&&g!=="."&&m.push(g);o=m.join("/")}return{path:o,anchor:a}}function r2(i){if(!i.startsWith("#docs"))return null;const t=i.slice(1).split(":"),s=t[1]||"README.md",a=t[2]||void 0;return{path:s,anchor:a}}function a2(i){return!i||i==="README.md"?"#docs":`#docs:${i}`}function l2({content:i,currentPath:t,onNavigate:s,onAnchorClick:a}){const o=f=>{var y;const d=f.target,m=d.closest("[data-anchor]");if(m){f.preventDefault(),a();const E=m.dataset.anchor,_=(y=m.closest(".docs-content"))==null?void 0:y.querySelector(`#${CSS.escape(E)}`);_==null||_.scrollIntoView({behavior:"smooth",block:"start"});return}const g=d.closest("[data-doc-link]");if(g){f.preventDefault();const{path:E,anchor:_}=i2(g.dataset.docLink,t);s(E,_);return}};return h.jsx(jh,{content:i,className:"docs-content",onClick:o})}function o2(i){const t=[],s=new Map;for(const a of i){const o=a.path.split("/");if(o.length===1){t.push(a);continue}let f=s;for(let d=0;d<o.length-1;d++){const m=o[d];f.has(m)||f.set(m,{label:m,children:[],subdirs:new Map});const g=f.get(m);d===o.length-2?g.children.push(a):f=g.subdirs}}return{topLevel:t,dirs:s}}function c2({docs:i,selected:t,onSelect:s}){const{topLevel:a,dirs:o}=o2(i),f=m=>`block w-full text-left px-3 py-1 text-xs rounded truncate transition-colors ${t===m?"bg-accent/10 text-accent":"text-text-secondary hover:bg-surface-hover"}`;function d(m,g){return h.jsxs("details",{open:!0,children:[h.jsxs("summary",{className:"flex items-center gap-1.5 px-3 py-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary cursor-pointer",children:[h.jsx(Ov,{className:"w-3 h-3",strokeWidth:1.5}),m.label]}),h.jsxs("div",{className:"pl-2 space-y-0.5",children:[[...m.subdirs.values()].map(y=>d(y)),m.children.map(y=>h.jsx("button",{className:f(y.path),onClick:()=>s(y.path),children:y.title},y.path))]})]},m.label)}return h.jsxs("div",{className:"space-y-0.5",children:[a.map(m=>h.jsx("button",{className:f(m.path),onClick:()=>s(m.path),children:m.title},m.path)),[...o.values()].map(m=>d(m))]})}function u2({open:i,onClose:t}){var le,I,V;const[s,a]=A.useState(!1),{data:o}=t2(),f=s2(),{data:d,isLoading:m}=n2(((le=f.current)==null?void 0:le.path)??null),g=A.useRef(null),[y,E]=A.useState(null);A.useEffect(()=>{y&&(d!=null&&d.content)&&g.current&&requestAnimationFrame(()=>{var oe;const W=(oe=g.current)==null?void 0:oe.querySelector(`#${CSS.escape(y)}`);W==null||W.scrollIntoView({behavior:"smooth",block:"start"}),E(null)})},[y,d]);const _=A.useCallback(()=>{var re;const W=r2(window.location.hash),oe=(W==null?void 0:W.path)??"README.md";((re=f.current)==null?void 0:re.path)!==oe&&f.navigate(oe,g),W!=null&&W.anchor&&E(W.anchor)},[f]),O=A.useRef(!0);A.useEffect(()=>{if(!i||!f.current)return;if(O.current){O.current=!1;return}const W=a2(f.current.path);window.location.hash!==W&&window.history.replaceState(null,"",window.location.pathname+window.location.search+W)},[i,(I=f.current)==null?void 0:I.path]),A.useEffect(()=>{if(!i)return;const W=()=>{window.location.hash.startsWith("#docs")&&_()};return window.addEventListener("hashchange",W),()=>window.removeEventListener("hashchange",W)},[i,_]);const R=A.useCallback((W,oe)=>{oe&&E(oe),f.navigate(W,g)},[f]),M=A.useCallback(W=>{f.navigate(W,g)},[f]),z=A.useCallback(()=>{f.goBack(g)},[f]),F=A.useCallback(()=>{f.goForward(g)},[f]),ie=A.useCallback(()=>{f.pushScrollPosition(g)},[f]);if(A.useEffect(()=>{if(i){O.current=!0,_();const W=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(W)}},[i]),!(i||s))return null;const ce=()=>{a(!1),setTimeout(()=>{t(),f.reset()},200)},ee=((V=f.current)==null?void 0:V.path)??null,T=f.backStack.length>0,Q=f.forwardStack.length>0;return h.jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex",children:[h.jsx("div",{className:`fixed inset-0 bg-black/20 transition-opacity duration-200 ${s&&i?"opacity-100":"opacity-0"}`,onClick:ce}),h.jsxs("div",{className:`relative ml-auto w-[40vw] min-w-[800px] max-w-[90vw] h-full bg-surface-raised border-l border-surface-border flex flex-col shadow-xl transition-transform duration-200 ease-out ${s&&i?"translate-x-0":"translate-x-full"}`,children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{onClick:z,disabled:!T,className:`p-0.5 transition-colors ${T?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Back",children:h.jsx(jg,{className:"w-4 h-4"})}),h.jsx("button",{onClick:F,disabled:!Q,className:`p-0.5 transition-colors ${Q?"text-text-tertiary hover:text-text-primary":"text-surface-border cursor-default"}`,title:"Forward",children:h.jsx(Nf,{className:"w-4 h-4"})}),h.jsx(Og,{className:"w-4 h-4 text-accent ml-1",strokeWidth:1.5}),h.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Documentation"})]}),h.jsx("button",{onClick:ce,className:"p-1 text-text-tertiary hover:text-text-primary",children:h.jsx(Yn,{className:"w-4 h-4"})})]}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsx("div",{className:"w-48 shrink-0 border-r border-surface-border overflow-y-auto py-2",children:o!=null&&o.docs?h.jsx(c2,{docs:o.docs,selected:ee,onSelect:M}):h.jsx("div",{className:"px-3 py-2 text-xs text-text-tertiary",children:"Loading..."})}),h.jsx("div",{ref:g,className:"flex-1 overflow-y-auto px-6 py-4",children:ee?m?h.jsxs("div",{className:"animate-pulse space-y-2",children:[h.jsx("div",{className:"h-6 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),h.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}):d!=null&&d.content?h.jsx(l2,{content:d.content,currentPath:ee,onNavigate:R,onAnchorClick:ie}):h.jsx("p",{className:"text-xs text-text-tertiary",children:"Document not found."}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary",children:[h.jsx(Nf,{className:"w-5 h-5 mb-2"}),h.jsx("p",{className:"text-xs",children:"Select a document"})]})})]})]})]})}function f2(i){if(i.includes("/escalations"))return["escalation","human-queue"]}const ag=2e3;function h2(i){const s=i.filter(o=>!o.pending).slice(-8);return s.length===0?"":`[Prior conversation]
|
|
@@ -59,5 +59,5 @@ ${s.map(o=>`${o.role==="user"?"User":"Assistant"}: ${o.content}`).join(`
|
|
|
59
59
|
[End prior conversation]
|
|
60
60
|
|
|
61
61
|
`}function d2(i){const t=i.summary,s=i.title;if(t){const a=t.search(/\n\s*\{[\s\S]*"title"\s*:/);return a>0?t.slice(0,a).trim():t}return s||(typeof i=="string"?i:"Query completed.")}const My=A.createContext(null);function m2({children:i}){const t=Sn(),[s,a]=A.useState(!1),[o,f]=A.useState([]),[d,m]=A.useState(null),[g,y]=A.useState({}),E=A.useRef(null),_={page:t.pathname.split("/").filter(Boolean).join("-")||"home",route:t.pathname,params:{},...g,suggestedTags:g.suggestedTags??f2(t.pathname)};A.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const O=A.useCallback(()=>a(ie=>!ie),[]),R=A.useCallback(ie=>{y(ie)},[]),M=A.useCallback(()=>{f([]),m(null)},[]),z=A.useCallback(async ie=>{var I;const $=new Date().toISOString(),ce={id:`user-${Date.now()}`,role:"user",content:ie,timestamp:$},ee={id:`pending-${Date.now()}`,role:"assistant",content:"",timestamp:$,pending:!0};f(V=>[...V,ce,ee]);const T={..._};(I=T.entities)!=null&&I.yamlContent&&T.entities.yamlContent.length>ag&&(T.entities={...T.entities,yamlContent:T.entities.yamlContent.slice(0,ag)+`
|
|
62
|
-
... (truncated)`});const le=`${h2(o.concat(ce))}${ie}`;try{const W=(await we("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:le,tags:T.suggestedTags,context:T,wait:!1,direct:!0})})).workflow_id;m(W),f(oe=>oe.map(re=>re.id===ee.id?{...re,workflowId:W}:re)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var oe;try{const re=await we(`/workflows/${W}/result`),Oe=(oe=re==null?void 0:re.result)==null?void 0:oe.data;if(Oe){E.current&&clearInterval(E.current),E.current=null,m(null);const ke=d2(Oe);let Se;try{Se=(await we(`/workflow-states/${W}/execution`)).duration_ms}catch{}f(q=>q.map(ne=>ne.id===ee.id?{...ne,content:ke,timestamp:new Date().toISOString(),pending:!1,durationMs:Se}:ne))}}catch{}},3e3)}catch{f(V=>V.map(W=>W.id===ee.id?{...W,content:"Failed to submit query. Please try again.",pending:!1}:W))}},[o,_]),F=A.useCallback(async ie=>{const $=o.find(T=>T.id===ie);if(!($!=null&&$.workflowId)||$.compilationStatus==="compiling"||$.compilationStatus==="done")return;const ce=o.indexOf($),ee=o.slice(0,ce).reverse().find(T=>T.role==="user");if(ee){f(T=>T.map(Q=>Q.id===ie?{...Q,compilationStatus:"compiling"}:Q));try{const T=await we("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ee.content,summary:$.content})}),Q=await we("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:$.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:T.tool_name,description:T.description,tags:T.tags,app_id:""})});await we(`/yaml-workflows/${Q.id}/deploy`,{method:"POST"}),f(le=>le.map(I=>I.id===ie?{...I,compilationStatus:"done"}:I))}catch(T){const Q=T instanceof Error?T.message:"Compilation failed";f(le=>le.map(I=>I.id===ie?{...I,compilationStatus:"error",compilationError:Q}:I))}}},[o]);return h.jsx(My.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:O,messages:o,sendMessage:z,pageContext:_,setPageContext:R,activeWorkflowId:d,clearMessages:M,compileMessage:F},children:i})}function Ry(){const i=A.useContext(My);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function p2(){const{helpOpen:i,toggleHelp:t}=Ry();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?h.jsx(Yn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Tt}/logo512.png)`}})})}const Dy=6048e5,g2=864e5,lg=6e4,og=525600,cg=43200,ug=1440,fg=Symbol.for("constructDateFrom");function gs(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&fg in i?i[fg](t):i instanceof Date?new i.constructor(t):new Date(t)}function ln(i,t){return gs(t||i,i)}let y2={};function Za(){return y2}function Ja(i,t){var m,g,y,E;const s=Za(),a=(t==null?void 0:t.weekStartsOn)??((g=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=ln(i,t==null?void 0:t.in),f=o.getDay(),d=(f<a?7:0)+f-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Vo(i,t){return Ja(i,{...t,weekStartsOn:1})}function qy(i,t){const s=ln(i,t==null?void 0:t.in),a=s.getFullYear(),o=gs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Vo(o),d=gs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=Vo(d);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Io(i){const t=ln(i),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+i-+s}function zy(i,...t){const s=gs.bind(null,i||t.find(a=>typeof a=="object"));return t.map(s)}function hg(i,t){const s=ln(i,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function b2(i,t,s){const[a,o]=zy(s==null?void 0:s.in,i,t),f=hg(a),d=hg(o),m=+f-Io(f),g=+d-Io(d);return Math.round((m-g)/g2)}function x2(i,t){const s=qy(i,t),a=gs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Vo(a)}function v2(i,t){const s=+ln(i)-+ln(t);return s<0?-1:s>0?1:s}function _2(i){return gs(i,Date.now())}function w2(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function S2(i){return!(!w2(i)&&typeof i!="number"||isNaN(+ln(i)))}function E2(i){return t=>{const a=(i?Math[i]:Math.trunc)(t);return a===0?0:a}}function j2(i,t){const s=ln(i,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const A2={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},O2=(i,t,s)=>{let a;const o=A2[i];return typeof o=="string"?a=o:t===1?a=o.one:a=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Of(i){return(t={})=>{const s=t.width?String(t.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const N2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},T2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},k2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},C2={date:Of({formats:N2,defaultWidth:"full"}),time:Of({formats:T2,defaultWidth:"full"}),dateTime:Of({formats:k2,defaultWidth:"full"})},M2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},R2=(i,t,s,a)=>M2[i];function Ra(i){return(t,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,m=s!=null&&s.width?String(s.width):d;o=i.formattingValues[m]||i.formattingValues[d]}else{const d=i.defaultWidth,m=s!=null&&s.width?String(s.width):i.defaultWidth;o=i.values[m]||i.values[d]}const f=i.argumentCallback?i.argumentCallback(t):t;return o[f]}}const D2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},q2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},z2={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},U2={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},B2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},L2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},P2=(i,t)=>{const s=Number(i),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},H2={ordinalNumber:P2,era:Ra({values:D2,defaultWidth:"wide"}),quarter:Ra({values:q2,defaultWidth:"wide",argumentCallback:i=>i-1}),month:Ra({values:z2,defaultWidth:"wide"}),day:Ra({values:U2,defaultWidth:"wide"}),dayPeriod:Ra({values:B2,defaultWidth:"wide",formattingValues:L2,defaultFormattingWidth:"wide"})};function Da(i){return(t,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],f=t.match(o);if(!f)return null;const d=f[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(m)?Y2(m,_=>_.test(d)):$2(m,_=>_.test(d));let y;y=i.valueCallback?i.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=t.slice(d.length);return{value:y,rest:E}}}function $2(i,t){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&t(i[s]))return s}function Y2(i,t){for(let s=0;s<i.length;s++)if(t(i[s]))return s}function G2(i){return(t,s={})=>{const a=t.match(i.matchPattern);if(!a)return null;const o=a[0],f=t.match(i.parsePattern);if(!f)return null;let d=i.valueCallback?i.valueCallback(f[0]):f[0];d=s.valueCallback?s.valueCallback(d):d;const m=t.slice(o.length);return{value:d,rest:m}}}const V2=/^(\d+)(th|st|nd|rd)?/i,I2=/\d+/i,F2={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},J2={any:[/^b/i,/^(a|c)/i]},Q2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},K2={any:[/1/i,/2/i,/3/i,/4/i]},X2={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Z2={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},W2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},eE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},tE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},nE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},sE={ordinalNumber:G2({matchPattern:V2,parsePattern:I2,valueCallback:i=>parseInt(i,10)}),era:Da({matchPatterns:F2,defaultMatchWidth:"wide",parsePatterns:J2,defaultParseWidth:"any"}),quarter:Da({matchPatterns:Q2,defaultMatchWidth:"wide",parsePatterns:K2,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Da({matchPatterns:X2,defaultMatchWidth:"wide",parsePatterns:Z2,defaultParseWidth:"any"}),day:Da({matchPatterns:W2,defaultMatchWidth:"wide",parsePatterns:eE,defaultParseWidth:"any"}),dayPeriod:Da({matchPatterns:tE,defaultMatchWidth:"any",parsePatterns:nE,defaultParseWidth:"any"})},Uy={code:"en-US",formatDistance:O2,formatLong:C2,formatRelative:R2,localize:H2,match:sE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function iE(i,t){const s=ln(i,t==null?void 0:t.in);return b2(s,j2(s))+1}function rE(i,t){const s=ln(i,t==null?void 0:t.in),a=+Vo(s)-+x2(s);return Math.round(a/Dy)+1}function By(i,t){var E,_,O,R;const s=ln(i,t==null?void 0:t.in),a=s.getFullYear(),o=Za(),f=(t==null?void 0:t.firstWeekContainsDate)??((_=(E=t==null?void 0:t.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??o.firstWeekContainsDate??((R=(O=o.locale)==null?void 0:O.options)==null?void 0:R.firstWeekContainsDate)??1,d=gs((t==null?void 0:t.in)||i,0);d.setFullYear(a+1,0,f),d.setHours(0,0,0,0);const m=Ja(d,t),g=gs((t==null?void 0:t.in)||i,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ja(g,t);return+s>=+m?a+1:+s>=+y?a:a-1}function aE(i,t){var m,g,y,E;const s=Za(),a=(t==null?void 0:t.firstWeekContainsDate)??((g=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=By(i,t),f=gs((t==null?void 0:t.in)||i,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ja(f,t)}function lE(i,t){const s=ln(i,t==null?void 0:t.in),a=+Ja(s,t)-+aE(s,t);return Math.round(a/Dy)+1}function Ve(i,t){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(t,"0");return s+a}const Js={y(i,t){const s=i.getFullYear(),a=s>0?s:1-s;return Ve(t==="yy"?a%100:a,t.length)},M(i,t){const s=i.getMonth();return t==="M"?String(s+1):Ve(s+1,2)},d(i,t){return Ve(i.getDate(),t.length)},a(i,t){const s=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(i,t){return Ve(i.getHours()%12||12,t.length)},H(i,t){return Ve(i.getHours(),t.length)},m(i,t){return Ve(i.getMinutes(),t.length)},s(i,t){return Ve(i.getSeconds(),t.length)},S(i,t){const s=t.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ve(o,t.length)}},_r={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},dg={G:function(i,t,s){const a=i.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(i,t,s){if(t==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Js.y(i,t)},Y:function(i,t,s,a){const o=By(i,a),f=o>0?o:1-o;if(t==="YY"){const d=f%100;return Ve(d,2)}return t==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ve(f,t.length)},R:function(i,t){const s=qy(i);return Ve(s,t.length)},u:function(i,t){const s=i.getFullYear();return Ve(s,t.length)},Q:function(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return Ve(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return Ve(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(i,t,s){const a=i.getMonth();switch(t){case"M":case"MM":return Js.M(i,t);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(i,t,s){const a=i.getMonth();switch(t){case"L":return String(a+1);case"LL":return Ve(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(i,t,s,a){const o=lE(i,a);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):Ve(o,t.length)},I:function(i,t,s){const a=rE(i);return t==="Io"?s.ordinalNumber(a,{unit:"week"}):Ve(a,t.length)},d:function(i,t,s){return t==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Js.d(i,t)},D:function(i,t,s){const a=iE(i);return t==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ve(a,t.length)},E:function(i,t,s){const a=i.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(i,t,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(f);case"ee":return Ve(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(i,t,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(f);case"cc":return Ve(f,t.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(i,t,s){const a=i.getDay(),o=a===0?7:a;switch(t){case"i":return String(o);case"ii":return Ve(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(i,t,s){const o=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(i,t,s){const a=i.getHours();let o;switch(a===12?o=_r.noon:a===0?o=_r.midnight:o=a/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(i,t,s){const a=i.getHours();let o;switch(a>=17?o=_r.evening:a>=12?o=_r.afternoon:a>=4?o=_r.morning:o=_r.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(i,t,s){if(t==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Js.h(i,t)},H:function(i,t,s){return t==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Js.H(i,t)},K:function(i,t,s){const a=i.getHours()%12;return t==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,t.length)},k:function(i,t,s){let a=i.getHours();return a===0&&(a=24),t==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,t.length)},m:function(i,t,s){return t==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Js.m(i,t)},s:function(i,t,s){return t==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Js.s(i,t)},S:function(i,t){return Js.S(i,t)},X:function(i,t,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return pg(a);case"XXXX":case"XX":return Oi(a);case"XXXXX":case"XXX":default:return Oi(a,":")}},x:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"x":return pg(a);case"xxxx":case"xx":return Oi(a);case"xxxxx":case"xxx":default:return Oi(a,":")}},O:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+mg(a,":");case"OOOO":default:return"GMT"+Oi(a,":")}},z:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+mg(a,":");case"zzzz":default:return"GMT"+Oi(a,":")}},t:function(i,t,s){const a=Math.trunc(+i/1e3);return Ve(a,t.length)},T:function(i,t,s){return Ve(+i,t.length)}};function mg(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+t+Ve(f,2)}function pg(i,t){return i%60===0?(i>0?"-":"+")+Ve(Math.abs(i)/60,2):Oi(i,t)}function Oi(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Ve(Math.trunc(a/60),2),f=Ve(a%60,2);return s+o+t+f}const gg=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Ly=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},oE=(i,t)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return gg(i,t);let f;switch(a){case"P":f=t.dateTime({width:"short"});break;case"PP":f=t.dateTime({width:"medium"});break;case"PPP":f=t.dateTime({width:"long"});break;case"PPPP":default:f=t.dateTime({width:"full"});break}return f.replace("{{date}}",gg(a,t)).replace("{{time}}",Ly(o,t))},cE={p:Ly,P:oE},uE=/^D+$/,fE=/^Y+$/,hE=["D","DD","YY","YYYY"];function dE(i){return uE.test(i)}function mE(i){return fE.test(i)}function pE(i,t,s){const a=gE(i,t,s);if(console.warn(a),hE.includes(i))throw new RangeError(a)}function gE(i,t,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xE=/^'([^]*?)'?$/,vE=/''/g,_E=/[a-zA-Z]/;function Py(i,t,s){var E,_,O,R;const a=Za(),o=a.locale??Uy,f=a.firstWeekContainsDate??((_=(E=a.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??1,d=a.weekStartsOn??((R=(O=a.locale)==null?void 0:O.options)==null?void 0:R.weekStartsOn)??0,m=ln(i,s==null?void 0:s.in);if(!S2(m))throw new RangeError("Invalid time value");let g=t.match(bE).map(M=>{const z=M[0];if(z==="p"||z==="P"){const F=cE[z];return F(M,o.formatLong)}return M}).join("").match(yE).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const z=M[0];if(z==="'")return{isToken:!1,value:wE(M)};if(dg[z])return{isToken:!0,value:M};if(z.match(_E))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:d,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const z=M.value;(mE(z)||dE(z))&&pE(z,t,String(i));const F=dg[z[0]];return F(m,z,o.localize,y)}).join("")}function wE(i){const t=i.match(xE);return t?t[1].replace(vE,"'"):i}function SE(i,t,s){const a=Za(),o=(s==null?void 0:s.locale)??a.locale??Uy,f=v2(i,t);if(isNaN(f))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=zy(s==null?void 0:s.in,...f>0?[t,i]:[i,t]),y=E2((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),_=E/lg,O=Io(g)-Io(m),R=(E-O)/lg,M=s==null?void 0:s.unit;let z;if(M?z=M:_<1?z="second":_<60?z="minute":_<ug?z="hour":R<cg?z="day":R<og?z="month":z="year",z==="second"){const F=y(E/1e3);return o.formatDistance("xSeconds",F,d)}else if(z==="minute"){const F=y(_);return o.formatDistance("xMinutes",F,d)}else if(z==="hour"){const F=y(_/60);return o.formatDistance("xHours",F,d)}else if(z==="day"){const F=y(R/ug);return o.formatDistance("xDays",F,d)}else if(z==="month"){const F=y(R/cg);return F===12&&M!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",F,d)}else{const F=y(R/og);return o.formatDistance("xYears",F,d)}}function EE(i,t){return SE(i,_2(i),t)}function wA(i){return i.toLocaleString()}function SA(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function jE(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":EE(t,{addSuffix:!0})}function EA(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const f=Math.floor(o/24);return f<7?`${f}d`:f<30?`${Math.floor(f/7)}w`:f<365?`${Math.floor(f/30)}mo`:`${Math.floor(f/365)}y`}function jA(i){return i<=0?"Expired":Ah(i)}function AE(i){return i==null?"--":Ah(i)}function Ah(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(i/1e3),s=Math.floor(t/86400),a=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),f=t%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function AA(i,t){const s=new Date(i).getTime(),a=t?new Date(t).getTime():Date.now();return Ah(a-s)}function Hy({options:i,children:t,className:s=""}){const[a,o]=A.useState(!1),[f,d]=A.useState(null),[m,g]=A.useState(null),y=A.useRef(null),E=A.useRef(void 0),_=A.useRef(void 0),O=220,R=A.useCallback(()=>{if(!y.current)return;const ie=y.current.getBoundingClientRect(),$=window.innerWidth-O-8,ce=Math.max(8,Math.min(ie.left,$));g({top:ie.bottom+4,left:ce})},[]),M=A.useCallback(async(ie,$)=>{try{await navigator.clipboard.writeText(ie),d($),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),z=A.useCallback(()=>{clearTimeout(_.current),R(),o(!0)},[R]),F=A.useCallback(()=>{_.current=setTimeout(()=>o(!1),150)},[]);return A.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(_.current)},[]),h.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:z,onMouseLeave:F,children:[t,a&&m&&Eg.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:m.top,left:m.left},onMouseEnter:z,onMouseLeave:F,children:i.map(ie=>h.jsxs("button",{onClick:$=>{$.stopPropagation(),M(ie.value,ie.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ie.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:f===ie.label?"✓":ie.value})]},ie.label))}),document.body)]})}function OE(i,t){const s=new Date(i);switch(t){case"relative":return jE(i);case"datetime":return Py(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function NE(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Py(t,"MMM d, yyyy h:mm:ss a")}]}function TE({date:i,format:t="relative",className:s=""}){const[,a]=A.useState(0);A.useEffect(()=>{if(t!=="relative")return;const f=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(f)},[t]);const o=A.useMemo(()=>NE(i),[i]);return h.jsx(Hy,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:OE(i,t)})})}function kE({ms:i,className:t=""}){const s=AE(i),a=A.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:s}],[i,s]);return i==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(Hy,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const CE=["sm","md","lg","full"],yg={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},bg={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function ME({which:i}){const t="stroke-current";switch(i){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function RE({msg:i}){const[t,s]=A.useState(0);A.useEffect(()=>{const d=new Date(i.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-d)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[i.timestamp]);const a=Math.floor(t/60),o=t%60,f=a>0?`${a}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),i.workflowId&&h.jsxs(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(nh,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function DE({msg:i,compileMessage:t}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(TE,{date:i.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),i.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(kE,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&h.jsx(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(nh,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(Nv,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function qE(){const{helpOpen:i,setHelpOpen:t,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:d,compileMessage:m}=Ry(),[g,y]=A.useState(""),[E,_]=A.useState("md"),[O,R]=A.useState(!0),M=A.useRef(null),z=A.useRef(null);if(A.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),A.useEffect(()=>{i&&z.current&&z.current.focus()},[i]),A.useEffect(()=>{if(!i)return;const T=Q=>{Q.key==="Escape"&&(E==="full"?_("lg"):E==="lg"?_("md"):E==="md"?_("sm"):t(!1))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i,E,t]),!i)return null;const F=()=>{const T=g.trim();!T||f||(a(T),y(""),z.current&&(z.current.style.height="auto"))},ie=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),F())},$=E==="full",ce=o.page.replace(/-/g," "),ee=$?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${$?yg.full:`right-6 ${yg[E]}`} ${O?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ee,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ce})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:CE.map(T=>h.jsx("button",{onClick:()=>_(T),className:`p-1 rounded transition-colors ${T===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":T===E,"aria-label":bg[T],title:bg[T],children:h.jsx(ME,{which:T})},T))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(Tv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Yn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(T=>h.jsxs("div",{className:`text-xs leading-relaxed ${T.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${T.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:T.pending?h.jsx(RE,{msg:T}):T.role==="assistant"?h.jsx(jh,{content:T.content}):T.content}),!T.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(DE,{msg:T,compileMessage:m})})]},T.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:z,value:g,onChange:T=>{y(T.target.value);const Q=T.target;Q.style.height="auto",Q.style.height=`${Math.min(Q.scrollHeight,120)}px`},onKeyDown:ie,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),h.jsx("button",{onClick:F,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(kv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function zE(){var ce;const{isBuilder:i,isOps:t,viewAs:s}=py(),{canSeePaceBoard:a}=gy(),{data:o}=Mi(),f=dy(),d=f!==null?f:!!((ce=o==null?void 0:o.ai)!=null&&ce.enabled),{collapsed:m,toggle:g}=wh(),[y,E]=A.useState(!1),[_,O]=A.useState(!1),[R,M]=A.useState(!1),[z,F]=A.useState(()=>window.location.hash.startsWith("#docs")),ie=Sn(),$=A.useRef(null);return A.useEffect(()=>{const ee=$.current;ee&&(ee.classList.remove("animate-page-in"),ee.offsetWidth,ee.classList.add("animate-page-in"))},[ie.pathname]),A.useEffect(()=>{const ee=()=>{window.location.hash.startsWith("#docs")&&F(!0)};return window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(dS,{onToggleEventFeed:()=>E(ee=>!ee),onToggleDocs:()=>F(ee=>!ee),onToggleNav:()=>O(ee=>!ee)}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsxs("aside",{className:`${m?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Oy,{aiEnabled:d,isBuilder:i,isOps:t,viewAs:s,canSeePaceBoard:a})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${m?"flex justify-center":"flex items-center px-7"}`,"aria-label":m?"Expand sidebar":"Collapse sidebar",children:m?h.jsx(Cv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Mv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!m&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:$,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(Sr,{})})}),h.jsx(UE,{})]}),h.jsx(qS,{open:_,onClose:()=>O(!1),aiEnabled:d,isBuilder:i,isOps:t,viewAs:s,canSeePaceBoard:a}),h.jsx(e2,{open:y,onToggle:()=>E(ee=>!ee),configOpen:R,onToggleConfig:()=>M(ee=>!ee)}),h.jsx(u2,{open:z,onClose:()=>{F(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(p2,{}),d&&h.jsx(qE,{})]})}function UE(){const{node:i,width:t,open:s}=nS();return h.jsx(sS,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function BE(){const{isAuthenticated:i}=Vn(),t=Sn();return i?h.jsx(Ww,{children:h.jsx(tS,{children:h.jsx(m2,{children:h.jsx(zE,{})})})}):h.jsx(Ln,{to:"/login",state:{from:t.pathname},replace:!0})}function $y({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function LE(){return we("/auth/oauth/providers")}async function PE(i,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return we(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function OA(){return ht({queryKey:["oauth-connections"],queryFn:()=>we("/auth/oauth/connections")})}function NA(){const i=bt();return Et({mutationFn:({provider:t,label:s})=>PE(t,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function HE(){var le;const{login:i,isAuthenticated:t}=Vn(),s=th(),a=Sn(),o=new URLSearchParams(a.search),f=o.get("token"),d=o.get("error"),m=((le=a.state)==null?void 0:le.from)??o.get("returnTo")??"/",g=A.useRef(!1);f&&!g.current&&(g.current=!0,i(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=A.useState(""),[_,O]=A.useState(""),[R,M]=A.useState(d||""),[z,F]=A.useState(!1),[ie,$]=A.useState(!!f),[ce,ee]=A.useState([]),T=A.useRef(!1);if(A.useEffect(()=>{f||T.current||(T.current=!0,(async()=>{var I,V,W,oe;try{const re=await fetch(`${Tt}/api/settings`);if(!re.ok)return;const Oe=await re.json();if(!((I=Oe.auth)!=null&&I.sso))return;const ke=await fetch(`${Tt}/api/auth/sso`,{method:"POST"});if(!ke.ok){M("Host authentication required — please log in to your organization first");return}const Se=await ke.json();Se.token&&((V=Oe.auth)!=null&&V.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",Oe.auth.ssoLogoutUrl),$(!0),i(Se.token,void 0,{displayName:(W=Se.user)==null?void 0:W.display_name,username:(oe=Se.user)==null?void 0:oe.external_id}))}catch{}})())},[]),A.useEffect(()=>{f||LE().then(ee).catch(()=>{})},[]),A.useEffect(()=>{if(!ie)return;const I=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(I)},[ie]),t&&!ie)return h.jsx(Ln,{to:m,replace:!0});const Q=async I=>{var V,W;if(I.preventDefault(),M(""),!y.trim()||!_){M("Username and password are required");return}F(!0);try{const oe=await fetch(`${Tt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:_})}),re=await oe.json();if(!oe.ok){M(re.error||"Login failed");return}$(!0),i(re.token,{username:y.trim(),password:_},{displayName:(V=re.user)==null?void 0:V.display_name,username:(W=re.user)==null?void 0:W.external_id})}catch{M("Unable to connect to server")}finally{F(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ie?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Yo,{size:"lg",hideLabel:ie})}),h.jsxs("form",{onSubmit:Q,className:`space-y-5 transition-opacity duration-300 ${ie?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:y,onChange:I=>E(I.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ie,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:_,onChange:I=>O(I.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),R&&h.jsx("p",{className:"text-sm text-status-error",children:R}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:z||ie,children:z?"Signing in...":"Sign In"}),ce.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:ce.filter(I=>I.provider!=="anthropic").map(I=>h.jsxs("a",{href:`${Tt}/api/auth/oauth/${I.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx($y,{provider:I.provider}),"Sign in with ",I.name]},I.provider))})]})]})]})})}function xg(){const{isAuthenticated:i}=Vn(),t=th(),s=Sn(),a=new URLSearchParams(s.search),o=a.get("state")||"";A.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[f,d]=A.useState(""),[m,g]=A.useState(a.get("label")||"default"),[y,E]=A.useState(""),[_,O]=A.useState(!1),R=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),z=F=>{F.preventDefault();const ie=f.trim();if(!ie){E("A token or API key is required");return}if(!ie.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}O(!0),E("");const $=`${Tt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ie)}&state=${encodeURIComponent(o)}`;window.location.href=$};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Yo,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx($y,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:z,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:f,onChange:F=>d(F.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),R&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:m,onChange:F=>g(F.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&h.jsx("p",{className:"text-sm text-status-error",children:y}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:_,children:_?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function qa({roleTypes:i,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Vn();return a?h.jsx(Sr,{}):i&&i.some(d=>f(d))?h.jsx(Sr,{}):t&&t.some(d=>o(d))?h.jsx(Sr,{}):h.jsx(Ln,{to:s,replace:!0})}function $E({redirectTo:i="/"}){var a;const{data:t,isLoading:s}=Mi();return s||!t?null:(a=t.ai)!=null&&a.enabled?h.jsx(Sr,{}):h.jsx(Ln,{to:i,replace:!0})}function YE({flag:i,redirectTo:t="/"}){var o;const{data:s,isLoading:a}=Mi();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx(Ln,{to:t,replace:!0}):h.jsx(Sr,{})}const GE=A.lazy(()=>_e(()=>import("./ProcessesListPage-GQMOo5Wo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),VE=A.lazy(()=>_e(()=>import("./ProcessDetailPage-CxJ5BSDk.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),IE=A.lazy(()=>_e(()=>import("./McpOverview-DMaRUXnA.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),FE=A.lazy(()=>_e(()=>import("./McpRunsPage-_UaoIwzX.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,14,32,15,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),JE=A.lazy(()=>_e(()=>import("./McpRunDetailPage-CJ9hDTNs.js"),__vite__mapDeps([34,1,26,20,15,14,35,6,36,37,13,38,39,16]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),QE=A.lazy(()=>_e(()=>import("./McpQueryPage-CNGNB59o.js"),__vite__mapDeps([40,1,15,14,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),KE=A.lazy(()=>_e(()=>import("./McpQueryDetailPage-D6YSD94n.js"),__vite__mapDeps([42,1,15,14,20,41,6,27,4,43,36,26,3,2,44,45,46,47,48,49,35,50,38,39]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),XE=A.lazy(()=>_e(()=>import("./EscalationsOverview-DFM-f7do.js"),__vite__mapDeps([51,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),ZE=A.lazy(()=>_e(()=>import("./AvailableEscalationsPage-rKbrcY8Y.js"),__vite__mapDeps([52,1,53,4,14,54,55,6,20,12,56,57,58,5,7,8,9,10,23,59,13,60,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),WE=A.lazy(()=>_e(()=>import("./OperatorDashboard-DMPJmgP_.js"),__vite__mapDeps([61,1,4,5,6,7,8,9,10,15,14,12,33,59,13,60,21,17,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),ej=A.lazy(()=>_e(()=>import("./index-Dh5Y3hq7.js"),__vite__mapDeps([62,1,54,55,6,20,12,56,14,57,15,16,3,4,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),tj=A.lazy(()=>_e(()=>import("./WorkflowsOverview-Bp2pxXJO.js"),__vite__mapDeps([63,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),nj=A.lazy(()=>_e(()=>import("./index-DcDEJ6b_.js"),__vite__mapDeps([64,1,3,15,14,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),sj=A.lazy(()=>_e(()=>import("./index-DcDEJ6b_.js"),__vite__mapDeps([64,1,3,15,14,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),ij=A.lazy(()=>_e(()=>import("./WorkflowsDashboard-DpVAH35I.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),rj=A.lazy(()=>_e(()=>import("./WorkflowsDashboard-DpVAH35I.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),aj=A.lazy(()=>_e(()=>import("./YamlWorkflowsPage-Dtt3x3_T.js"),__vite__mapDeps([67,1,27,5,6,15,14,13,10,49,65,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),lj=A.lazy(()=>_e(()=>import("./GraphInvokePage-B_P3pJeA.js"),__vite__mapDeps([68,1,27,15,14,44,46,47,48,45,6,49,65]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),oj=A.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-CL_kD0mX.js"),__vite__mapDeps([69,1,27,20,65,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),cj=A.lazy(()=>_e(()=>import("./TasksListPage-BIE7nrdE.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,60,50,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),uj=A.lazy(()=>_e(()=>import("./TaskDetailPage-ngdXRgQp.js"),__vite__mapDeps([71,1,2,20,60,15,14,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),vg=A.lazy(()=>_e(()=>import("./WorkflowExecutionPage-Bce8g08l.js"),__vite__mapDeps([72,1,3,4,37,13,14,38,20,6,39,2,15,36,16,35]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),fj=A.lazy(()=>_e(()=>import("./AdminDashboard-CYlm0_J0.js"),__vite__mapDeps([73,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),hj=A.lazy(()=>_e(()=>import("./index-BCIJE--_.js"),__vite__mapDeps([74,1,3,9,10,13,14,33,5,6,15,75,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),dj=A.lazy(()=>_e(()=>import("./index-DrPWIFSv.js"),__vite__mapDeps([76,1,3,13,14,77,55,6,21,17,15,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),_g=A.lazy(()=>_e(()=>import("./index-DrPWIFSv.js"),__vite__mapDeps([76,1,3,13,14,77,55,6,21,17,15,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),mj=A.lazy(()=>_e(()=>import("./index-CMv6YMJY.js"),__vite__mapDeps([78,1,25,10,77,55,6,15,14,13,12,5,79,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),wg=A.lazy(()=>_e(()=>import("./index-BqeQGQ4K.js"),__vite__mapDeps([80,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),pj=A.lazy(()=>_e(()=>import("./index-B0ktIiOY.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,14,77,55,33,15,21,48,50]),import.meta.url).then(i=>({default:i.UsersPage}))),gj=A.lazy(()=>_e(()=>import("./RolesPage-BIg3_Em6.js"),__vite__mapDeps([82,1,15,14,21,58,55,6]),import.meta.url).then(i=>({default:i.RolesPage}))),yj=A.lazy(()=>_e(()=>import("./RoleDetailPage-Bh5qdI0w.js"),__vite__mapDeps([83,1,77,55,6,23,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),bj=A.lazy(()=>_e(()=>import("./EscalationSchemaPage-CnlwGAIE.js"),__vite__mapDeps([84,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),xj=A.lazy(()=>_e(()=>import("./EscalationListSchemaPage-CkEJnFKd.js"),__vite__mapDeps([85,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),vj=A.lazy(()=>_e(()=>import("./index-DYCCUmSM.js"),__vite__mapDeps([86,1,15,14,55,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),_j=A.lazy(()=>_e(()=>import("./OperationsPage-CTfwuWXR.js").then(i=>i.O),__vite__mapDeps([87,1,4,15,14,58,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),wj=A.lazy(()=>_e(()=>import("./index-Cp1jJHm1.js"),__vite__mapDeps([88,1,19,14,13,5,6,31,28,55,36,75,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),Sj=A.lazy(()=>_e(()=>import("./index-DWDEa8jS.js"),__vite__mapDeps([89,1,39,14,5,6,31,28,8,9,10,12,13,15,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),Ej=A.lazy(()=>_e(()=>import("./CredentialsPage-D_2T6vSb.js"),__vite__mapDeps([90,1,15,14,50,77,55,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),jj=A.lazy(()=>_e(()=>import("./index-0SzWFShg.js"),__vite__mapDeps([91,1,6,15,14,13,16,8,10,92,50]),import.meta.url).then(i=>({default:i.FilesPage}))),Aj=A.lazy(()=>_e(()=>import("./index-ChHD9p_I.js"),__vite__mapDeps([93,1,15,14,13,16,12,10,92,50,94,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),Oj=A.lazy(()=>_e(()=>import("./HomePage-lu88PzQH.js"),__vite__mapDeps([95,1,3,26,28,4,21,14,17,16,87,15,58,6,53]),import.meta.url).then(i=>({default:i.HomePage}))),Nj=A.lazy(()=>_e(()=>import("./AgentsPage-AqGtEOL1.js"),__vite__mapDeps([96,1,97,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),Tj=A.lazy(()=>_e(()=>import("./AgentDetailPage-D9JdkWV8.js"),__vite__mapDeps([98,1,97,99,14,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),Sg=A.lazy(()=>_e(()=>import("./AgentConfigPage-BttOMcj_.js"),__vite__mapDeps([100,1,97,99,14,15,94,46,47,48,3,27,101,102,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),kj=A.lazy(()=>_e(()=>import("./CapabilitiesPage-DzLP5-ad.js"),__vite__mapDeps([103,1,101,79,25,46,47,48,14,49,6,45,15,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),Cj=A.lazy(()=>_e(()=>import("./TopicsPage-BwiEX0pU.js"),__vite__mapDeps([104,1,102,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),Mj=A.lazy(()=>_e(()=>import("./TopicDetailPage-vPtXb7gD.js"),__vite__mapDeps([105,1,102,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function Rj(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ve({children:i}){return h.jsx(A.Suspense,{fallback:h.jsx(Rj,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Yy=new ev({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Yy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(a)}`}});const Dj=sv([{path:"/login",element:h.jsx(HE,{})},{path:"/connect/anthropic",element:h.jsx(xg,{})},{path:"/connect/:provider",element:h.jsx(xg,{})},{path:"/",element:h.jsx(BE,{}),children:[{index:!0,element:h.jsx(ve,{children:h.jsx(Oj,{})})},{path:"processes/all",element:h.jsx(ve,{children:h.jsx(GE,{})})},{path:"processes/detail/:originId",element:h.jsx(ve,{children:h.jsx(VE,{})})},{path:"credentials",element:h.jsx(ve,{children:h.jsx(Ej,{})})},{path:"connections",element:h.jsx(Ln,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(ve,{children:h.jsx(XE,{})})},{path:"escalations/available",element:h.jsx(ve,{children:h.jsx(ZE,{})})},{path:"escalations/queue",element:h.jsx(ve,{children:h.jsx(WE,{})})},{path:"escalations/detail/:id",element:h.jsx(ve,{children:h.jsx(ej,{})})},{path:"capabilities",element:h.jsx(ve,{children:h.jsx(kj,{})})},{path:"agents",element:h.jsx(ve,{children:h.jsx(Nj,{})})},{path:"agents/new",element:h.jsx(ve,{children:h.jsx(Sg,{})})},{path:"agents/:id",element:h.jsx(ve,{children:h.jsx(Tj,{})})},{path:"agents/:id/edit",element:h.jsx(ve,{children:h.jsx(Sg,{})})},{path:"topics",element:h.jsx(ve,{children:h.jsx(Cj,{})})},{path:"topics/:topic",element:h.jsx(ve,{children:h.jsx(Mj,{})})},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(ve,{children:h.jsx(tj,{})})},{path:"workflows/executions",element:h.jsx(ve,{children:h.jsx(rj,{})})},{path:"workflows/durable/executions",element:h.jsx(ve,{children:h.jsx(ij,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(ve,{children:h.jsx(vg,{})})},{path:"workflows/tasks",element:h.jsx(ve,{children:h.jsx(cj,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(ve,{children:h.jsx(uj,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(ve,{children:h.jsx(vg,{})})},{path:"workflows/start",element:h.jsx(ve,{children:h.jsx(nj,{})})},{path:"workflows/durable/invoke",element:h.jsx(ve,{children:h.jsx(sj,{})})},{path:"workflows/cron",element:h.jsx(Ln,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(ve,{children:h.jsx(hj,{})})},{path:"workflows/registry",element:h.jsx(ve,{children:h.jsx(dj,{})})},{path:"workflows/registry/new",element:h.jsx(ve,{children:h.jsx(_g,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(ve,{children:h.jsx(_g,{})})}]},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(ve,{children:h.jsx(aj,{})})},{path:"mcp/workflows/invoke",element:h.jsx(ve,{children:h.jsx(lj,{})})},{path:"mcp/workflows/:id",element:h.jsx(ve,{children:h.jsx(oj,{})})},{path:"mcp/executions",element:h.jsx(ve,{children:h.jsx(FE,{})})},{path:"mcp/executions/:jobId",element:h.jsx(ve,{children:h.jsx(JE,{})})},{path:"files",element:h.jsx(ve,{children:h.jsx(jj,{})})},{path:"knowledge",element:h.jsx(ve,{children:h.jsx(Aj,{})})},{element:h.jsx($E,{}),children:[{path:"mcp",element:h.jsx(ve,{children:h.jsx(IE,{})})},{path:"mcp/queries",element:h.jsx(ve,{children:h.jsx(QE,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(ve,{children:h.jsx(KE,{})})},{path:"mcp/tools",element:h.jsx(Ln,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(ve,{children:h.jsx(mj,{})})},{path:"mcp/servers/new",element:h.jsx(ve,{children:h.jsx(wg,{})})},{path:"mcp/servers/:serverId",element:h.jsx(ve,{children:h.jsx(wg,{})})}]}]},{element:h.jsx(qa,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(ve,{children:h.jsx(_j,{})})}]},{element:h.jsx(qa,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(ve,{children:h.jsx(fj,{})})},{path:"admin/users",element:h.jsx(ve,{children:h.jsx(pj,{})})},{path:"admin/escalation-chains",element:h.jsx(Ln,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(ve,{children:h.jsx(gj,{})})},{path:"admin/roles/:role",element:h.jsx(ve,{children:h.jsx(yj,{})})},{path:"admin/roles/:role/schema",element:h.jsx(ve,{children:h.jsx(bj,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(ve,{children:h.jsx(xj,{})})}]},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Ln,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(YE,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(ve,{children:h.jsx(vj,{})})}]},{path:"admin/controlplane",element:h.jsx(ve,{children:h.jsx(wj,{})})},{path:"admin/streams",element:h.jsx(ve,{children:h.jsx(Sj,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function qj(){return h.jsx(tv,{client:Yy,children:h.jsx($v,{children:h.jsx(Gw,{children:h.jsx(iv,{router:Dj})})})})}jy(Ey());const Oh=document.createElement("link");Oh.rel="stylesheet";Oh.href=`${Tt}/api/settings/custom.css`;document.head.appendChild(Oh);Uv.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(qj,{})}));export{Hy as $,iA as A,aA as B,Eh as C,kE as D,lA as E,Ty as F,xS as G,Ij as H,vy as I,XS as J,xy as K,mA as L,Ah as M,Xg as N,Xj as O,EA as P,jh as Q,sS as R,LS as S,Yj as T,$j as U,Qj as V,Wj as W,rA as X,cA as Y,Pv as Z,Py as _,AA as a,jA as a0,gA as a1,oA as a2,yA as a3,bA as a4,uA as a5,fA as a6,dA as a7,hA as a8,pA as a9,wA as aa,Hj as ab,Tt as ac,Mg as ad,Gj as ae,OA as af,NA as ag,$y as ah,gy as ai,SA as aj,TE as b,Wg as c,we as d,Jj as e,AE as f,Kj as g,Zj as h,Vj as i,dy as j,Vn as k,Fj as l,vA as m,_A as n,nS as o,wS as p,vS as q,_S as r,jS as s,py as t,Mi as u,eA as v,xA as w,tA as x,nA as y,sA as z};
|
|
63
|
-
//# sourceMappingURL=index-
|
|
62
|
+
... (truncated)`});const le=`${h2(o.concat(ce))}${ie}`;try{const W=(await we("/insight/mcp-query",{method:"POST",body:JSON.stringify({prompt:le,tags:T.suggestedTags,context:T,wait:!1,direct:!0})})).workflow_id;m(W),f(oe=>oe.map(re=>re.id===ee.id?{...re,workflowId:W}:re)),E.current&&clearInterval(E.current),E.current=setInterval(async()=>{var oe;try{const re=await we(`/workflows/${W}/result`),Oe=(oe=re==null?void 0:re.result)==null?void 0:oe.data;if(Oe){E.current&&clearInterval(E.current),E.current=null,m(null);const ke=d2(Oe);let Se;try{Se=(await we(`/workflow-states/${W}/execution`)).duration_ms}catch{}f(q=>q.map(ne=>ne.id===ee.id?{...ne,content:ke,timestamp:new Date().toISOString(),pending:!1,durationMs:Se}:ne))}}catch{}},3e3)}catch{f(V=>V.map(W=>W.id===ee.id?{...W,content:"Failed to submit query. Please try again.",pending:!1}:W))}},[o,_]),F=A.useCallback(async ie=>{const $=o.find(T=>T.id===ie);if(!($!=null&&$.workflowId)||$.compilationStatus==="compiling"||$.compilationStatus==="done")return;const ce=o.indexOf($),ee=o.slice(0,ce).reverse().find(T=>T.role==="user");if(ee){f(T=>T.map(Q=>Q.id===ie?{...Q,compilationStatus:"compiling"}:Q));try{const T=await we("/insight/mcp-query/describe",{method:"POST",body:JSON.stringify({prompt:ee.content,summary:$.content})}),Q=await we("/yaml-workflows",{method:"POST",body:JSON.stringify({workflow_id:$.workflowId,task_queue:"long-tail-system",workflow_name:"mcpQuery",name:T.tool_name,description:T.description,tags:T.tags,app_id:""})});await we(`/yaml-workflows/${Q.id}/deploy`,{method:"POST"}),f(le=>le.map(I=>I.id===ie?{...I,compilationStatus:"done"}:I))}catch(T){const Q=T instanceof Error?T.message:"Compilation failed";f(le=>le.map(I=>I.id===ie?{...I,compilationStatus:"error",compilationError:Q}:I))}}},[o]);return h.jsx(My.Provider,{value:{helpOpen:s,setHelpOpen:a,toggleHelp:O,messages:o,sendMessage:z,pageContext:_,setPageContext:R,activeWorkflowId:d,clearMessages:M,compileMessage:F},children:i})}function Ry(){const i=A.useContext(My);if(!i)throw new Error("useHelpAssistant must be used within HelpAssistantProvider");return i}function p2(){const{helpOpen:i,toggleHelp:t}=Ry();return h.jsx("button",{onClick:t,className:"fixed right-3 z-[45] flex items-center justify-center w-10 h-10 rounded-full bg-surface-raised shadow-lg hover:scale-110 transition-transform duration-150 border border-accent/30",style:{bottom:"44px"},"aria-label":i?"Close help":"Ask for help",children:i?h.jsx(Yn,{className:"w-5 h-5 text-text-tertiary",strokeWidth:1.5}):h.jsx("span",{role:"img","aria-label":"Help",className:"logo-mark w-8 h-8 -rotate-[120deg]",style:{"--logo-url":`url(${Tt}/logo512.png)`}})})}const Dy=6048e5,g2=864e5,lg=6e4,og=525600,cg=43200,ug=1440,fg=Symbol.for("constructDateFrom");function gs(i,t){return typeof i=="function"?i(t):i&&typeof i=="object"&&fg in i?i[fg](t):i instanceof Date?new i.constructor(t):new Date(t)}function ln(i,t){return gs(t||i,i)}let y2={};function Za(){return y2}function Ja(i,t){var m,g,y,E;const s=Za(),a=(t==null?void 0:t.weekStartsOn)??((g=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??s.weekStartsOn??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.weekStartsOn)??0,o=ln(i,t==null?void 0:t.in),f=o.getDay(),d=(f<a?7:0)+f-a;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Vo(i,t){return Ja(i,{...t,weekStartsOn:1})}function qy(i,t){const s=ln(i,t==null?void 0:t.in),a=s.getFullYear(),o=gs(s,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const f=Vo(o),d=gs(s,0);d.setFullYear(a,0,4),d.setHours(0,0,0,0);const m=Vo(d);return s.getTime()>=f.getTime()?a+1:s.getTime()>=m.getTime()?a:a-1}function Io(i){const t=ln(i),s=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return s.setUTCFullYear(t.getFullYear()),+i-+s}function zy(i,...t){const s=gs.bind(null,i||t.find(a=>typeof a=="object"));return t.map(s)}function hg(i,t){const s=ln(i,t==null?void 0:t.in);return s.setHours(0,0,0,0),s}function b2(i,t,s){const[a,o]=zy(s==null?void 0:s.in,i,t),f=hg(a),d=hg(o),m=+f-Io(f),g=+d-Io(d);return Math.round((m-g)/g2)}function x2(i,t){const s=qy(i,t),a=gs(i,0);return a.setFullYear(s,0,4),a.setHours(0,0,0,0),Vo(a)}function v2(i,t){const s=+ln(i)-+ln(t);return s<0?-1:s>0?1:s}function _2(i){return gs(i,Date.now())}function w2(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function S2(i){return!(!w2(i)&&typeof i!="number"||isNaN(+ln(i)))}function E2(i){return t=>{const a=(i?Math[i]:Math.trunc)(t);return a===0?0:a}}function j2(i,t){const s=ln(i,t==null?void 0:t.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}const A2={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},O2=(i,t,s)=>{let a;const o=A2[i];return typeof o=="string"?a=o:t===1?a=o.one:a=o.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function Of(i){return(t={})=>{const s=t.width?String(t.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const N2={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},T2={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},k2={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},C2={date:Of({formats:N2,defaultWidth:"full"}),time:Of({formats:T2,defaultWidth:"full"}),dateTime:Of({formats:k2,defaultWidth:"full"})},M2={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},R2=(i,t,s,a)=>M2[i];function Ra(i){return(t,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let o;if(a==="formatting"&&i.formattingValues){const d=i.defaultFormattingWidth||i.defaultWidth,m=s!=null&&s.width?String(s.width):d;o=i.formattingValues[m]||i.formattingValues[d]}else{const d=i.defaultWidth,m=s!=null&&s.width?String(s.width):i.defaultWidth;o=i.values[m]||i.values[d]}const f=i.argumentCallback?i.argumentCallback(t):t;return o[f]}}const D2={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},q2={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},z2={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},U2={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},B2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},L2={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},P2=(i,t)=>{const s=Number(i),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},H2={ordinalNumber:P2,era:Ra({values:D2,defaultWidth:"wide"}),quarter:Ra({values:q2,defaultWidth:"wide",argumentCallback:i=>i-1}),month:Ra({values:z2,defaultWidth:"wide"}),day:Ra({values:U2,defaultWidth:"wide"}),dayPeriod:Ra({values:B2,defaultWidth:"wide",formattingValues:L2,defaultFormattingWidth:"wide"})};function Da(i){return(t,s={})=>{const a=s.width,o=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],f=t.match(o);if(!f)return null;const d=f[0],m=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],g=Array.isArray(m)?Y2(m,_=>_.test(d)):$2(m,_=>_.test(d));let y;y=i.valueCallback?i.valueCallback(g):g,y=s.valueCallback?s.valueCallback(y):y;const E=t.slice(d.length);return{value:y,rest:E}}}function $2(i,t){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&t(i[s]))return s}function Y2(i,t){for(let s=0;s<i.length;s++)if(t(i[s]))return s}function G2(i){return(t,s={})=>{const a=t.match(i.matchPattern);if(!a)return null;const o=a[0],f=t.match(i.parsePattern);if(!f)return null;let d=i.valueCallback?i.valueCallback(f[0]):f[0];d=s.valueCallback?s.valueCallback(d):d;const m=t.slice(o.length);return{value:d,rest:m}}}const V2=/^(\d+)(th|st|nd|rd)?/i,I2=/\d+/i,F2={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},J2={any:[/^b/i,/^(a|c)/i]},Q2={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},K2={any:[/1/i,/2/i,/3/i,/4/i]},X2={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Z2={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},W2={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},eE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},tE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},nE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},sE={ordinalNumber:G2({matchPattern:V2,parsePattern:I2,valueCallback:i=>parseInt(i,10)}),era:Da({matchPatterns:F2,defaultMatchWidth:"wide",parsePatterns:J2,defaultParseWidth:"any"}),quarter:Da({matchPatterns:Q2,defaultMatchWidth:"wide",parsePatterns:K2,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Da({matchPatterns:X2,defaultMatchWidth:"wide",parsePatterns:Z2,defaultParseWidth:"any"}),day:Da({matchPatterns:W2,defaultMatchWidth:"wide",parsePatterns:eE,defaultParseWidth:"any"}),dayPeriod:Da({matchPatterns:tE,defaultMatchWidth:"any",parsePatterns:nE,defaultParseWidth:"any"})},Uy={code:"en-US",formatDistance:O2,formatLong:C2,formatRelative:R2,localize:H2,match:sE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function iE(i,t){const s=ln(i,t==null?void 0:t.in);return b2(s,j2(s))+1}function rE(i,t){const s=ln(i,t==null?void 0:t.in),a=+Vo(s)-+x2(s);return Math.round(a/Dy)+1}function By(i,t){var E,_,O,R;const s=ln(i,t==null?void 0:t.in),a=s.getFullYear(),o=Za(),f=(t==null?void 0:t.firstWeekContainsDate)??((_=(E=t==null?void 0:t.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??o.firstWeekContainsDate??((R=(O=o.locale)==null?void 0:O.options)==null?void 0:R.firstWeekContainsDate)??1,d=gs((t==null?void 0:t.in)||i,0);d.setFullYear(a+1,0,f),d.setHours(0,0,0,0);const m=Ja(d,t),g=gs((t==null?void 0:t.in)||i,0);g.setFullYear(a,0,f),g.setHours(0,0,0,0);const y=Ja(g,t);return+s>=+m?a+1:+s>=+y?a:a-1}function aE(i,t){var m,g,y,E;const s=Za(),a=(t==null?void 0:t.firstWeekContainsDate)??((g=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??s.firstWeekContainsDate??((E=(y=s.locale)==null?void 0:y.options)==null?void 0:E.firstWeekContainsDate)??1,o=By(i,t),f=gs((t==null?void 0:t.in)||i,0);return f.setFullYear(o,0,a),f.setHours(0,0,0,0),Ja(f,t)}function lE(i,t){const s=ln(i,t==null?void 0:t.in),a=+Ja(s,t)-+aE(s,t);return Math.round(a/Dy)+1}function Ve(i,t){const s=i<0?"-":"",a=Math.abs(i).toString().padStart(t,"0");return s+a}const Js={y(i,t){const s=i.getFullYear(),a=s>0?s:1-s;return Ve(t==="yy"?a%100:a,t.length)},M(i,t){const s=i.getMonth();return t==="M"?String(s+1):Ve(s+1,2)},d(i,t){return Ve(i.getDate(),t.length)},a(i,t){const s=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(i,t){return Ve(i.getHours()%12||12,t.length)},H(i,t){return Ve(i.getHours(),t.length)},m(i,t){return Ve(i.getMinutes(),t.length)},s(i,t){return Ve(i.getSeconds(),t.length)},S(i,t){const s=t.length,a=i.getMilliseconds(),o=Math.trunc(a*Math.pow(10,s-3));return Ve(o,t.length)}},_r={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},dg={G:function(i,t,s){const a=i.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return s.era(a,{width:"abbreviated"});case"GGGGG":return s.era(a,{width:"narrow"});case"GGGG":default:return s.era(a,{width:"wide"})}},y:function(i,t,s){if(t==="yo"){const a=i.getFullYear(),o=a>0?a:1-a;return s.ordinalNumber(o,{unit:"year"})}return Js.y(i,t)},Y:function(i,t,s,a){const o=By(i,a),f=o>0?o:1-o;if(t==="YY"){const d=f%100;return Ve(d,2)}return t==="Yo"?s.ordinalNumber(f,{unit:"year"}):Ve(f,t.length)},R:function(i,t){const s=qy(i);return Ve(s,t.length)},u:function(i,t){const s=i.getFullYear();return Ve(s,t.length)},Q:function(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return Ve(a,2);case"Qo":return s.ordinalNumber(a,{unit:"quarter"});case"QQQ":return s.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(a,{width:"wide",context:"formatting"})}},q:function(i,t,s){const a=Math.ceil((i.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return Ve(a,2);case"qo":return s.ordinalNumber(a,{unit:"quarter"});case"qqq":return s.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(a,{width:"wide",context:"standalone"})}},M:function(i,t,s){const a=i.getMonth();switch(t){case"M":case"MM":return Js.M(i,t);case"Mo":return s.ordinalNumber(a+1,{unit:"month"});case"MMM":return s.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(a,{width:"wide",context:"formatting"})}},L:function(i,t,s){const a=i.getMonth();switch(t){case"L":return String(a+1);case"LL":return Ve(a+1,2);case"Lo":return s.ordinalNumber(a+1,{unit:"month"});case"LLL":return s.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(a,{width:"wide",context:"standalone"})}},w:function(i,t,s,a){const o=lE(i,a);return t==="wo"?s.ordinalNumber(o,{unit:"week"}):Ve(o,t.length)},I:function(i,t,s){const a=rE(i);return t==="Io"?s.ordinalNumber(a,{unit:"week"}):Ve(a,t.length)},d:function(i,t,s){return t==="do"?s.ordinalNumber(i.getDate(),{unit:"date"}):Js.d(i,t)},D:function(i,t,s){const a=iE(i);return t==="Do"?s.ordinalNumber(a,{unit:"dayOfYear"}):Ve(a,t.length)},E:function(i,t,s){const a=i.getDay();switch(t){case"E":case"EE":case"EEE":return s.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(a,{width:"short",context:"formatting"});case"EEEE":default:return s.day(a,{width:"wide",context:"formatting"})}},e:function(i,t,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(f);case"ee":return Ve(f,2);case"eo":return s.ordinalNumber(f,{unit:"day"});case"eee":return s.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(o,{width:"short",context:"formatting"});case"eeee":default:return s.day(o,{width:"wide",context:"formatting"})}},c:function(i,t,s,a){const o=i.getDay(),f=(o-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(f);case"cc":return Ve(f,t.length);case"co":return s.ordinalNumber(f,{unit:"day"});case"ccc":return s.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(o,{width:"narrow",context:"standalone"});case"cccccc":return s.day(o,{width:"short",context:"standalone"});case"cccc":default:return s.day(o,{width:"wide",context:"standalone"})}},i:function(i,t,s){const a=i.getDay(),o=a===0?7:a;switch(t){case"i":return String(o);case"ii":return Ve(o,t.length);case"io":return s.ordinalNumber(o,{unit:"day"});case"iii":return s.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(a,{width:"short",context:"formatting"});case"iiii":default:return s.day(a,{width:"wide",context:"formatting"})}},a:function(i,t,s){const o=i.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(i,t,s){const a=i.getHours();let o;switch(a===12?o=_r.noon:a===0?o=_r.midnight:o=a/12>=1?"pm":"am",t){case"b":case"bb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(i,t,s){const a=i.getHours();let o;switch(a>=17?o=_r.evening:a>=12?o=_r.afternoon:a>=4?o=_r.morning:o=_r.night,t){case"B":case"BB":case"BBB":return s.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(i,t,s){if(t==="ho"){let a=i.getHours()%12;return a===0&&(a=12),s.ordinalNumber(a,{unit:"hour"})}return Js.h(i,t)},H:function(i,t,s){return t==="Ho"?s.ordinalNumber(i.getHours(),{unit:"hour"}):Js.H(i,t)},K:function(i,t,s){const a=i.getHours()%12;return t==="Ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,t.length)},k:function(i,t,s){let a=i.getHours();return a===0&&(a=24),t==="ko"?s.ordinalNumber(a,{unit:"hour"}):Ve(a,t.length)},m:function(i,t,s){return t==="mo"?s.ordinalNumber(i.getMinutes(),{unit:"minute"}):Js.m(i,t)},s:function(i,t,s){return t==="so"?s.ordinalNumber(i.getSeconds(),{unit:"second"}):Js.s(i,t)},S:function(i,t){return Js.S(i,t)},X:function(i,t,s){const a=i.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return pg(a);case"XXXX":case"XX":return Oi(a);case"XXXXX":case"XXX":default:return Oi(a,":")}},x:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"x":return pg(a);case"xxxx":case"xx":return Oi(a);case"xxxxx":case"xxx":default:return Oi(a,":")}},O:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+mg(a,":");case"OOOO":default:return"GMT"+Oi(a,":")}},z:function(i,t,s){const a=i.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+mg(a,":");case"zzzz":default:return"GMT"+Oi(a,":")}},t:function(i,t,s){const a=Math.trunc(+i/1e3);return Ve(a,t.length)},T:function(i,t,s){return Ve(+i,t.length)}};function mg(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Math.trunc(a/60),f=a%60;return f===0?s+String(o):s+String(o)+t+Ve(f,2)}function pg(i,t){return i%60===0?(i>0?"-":"+")+Ve(Math.abs(i)/60,2):Oi(i,t)}function Oi(i,t=""){const s=i>0?"-":"+",a=Math.abs(i),o=Ve(Math.trunc(a/60),2),f=Ve(a%60,2);return s+o+t+f}const gg=(i,t)=>{switch(i){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Ly=(i,t)=>{switch(i){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},oE=(i,t)=>{const s=i.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return gg(i,t);let f;switch(a){case"P":f=t.dateTime({width:"short"});break;case"PP":f=t.dateTime({width:"medium"});break;case"PPP":f=t.dateTime({width:"long"});break;case"PPPP":default:f=t.dateTime({width:"full"});break}return f.replace("{{date}}",gg(a,t)).replace("{{time}}",Ly(o,t))},cE={p:Ly,P:oE},uE=/^D+$/,fE=/^Y+$/,hE=["D","DD","YY","YYYY"];function dE(i){return uE.test(i)}function mE(i){return fE.test(i)}function pE(i,t,s){const a=gE(i,t,s);if(console.warn(a),hE.includes(i))throw new RangeError(a)}function gE(i,t,s){const a=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${t}\`) for formatting ${a} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xE=/^'([^]*?)'?$/,vE=/''/g,_E=/[a-zA-Z]/;function Py(i,t,s){var E,_,O,R;const a=Za(),o=a.locale??Uy,f=a.firstWeekContainsDate??((_=(E=a.locale)==null?void 0:E.options)==null?void 0:_.firstWeekContainsDate)??1,d=a.weekStartsOn??((R=(O=a.locale)==null?void 0:O.options)==null?void 0:R.weekStartsOn)??0,m=ln(i,s==null?void 0:s.in);if(!S2(m))throw new RangeError("Invalid time value");let g=t.match(bE).map(M=>{const z=M[0];if(z==="p"||z==="P"){const F=cE[z];return F(M,o.formatLong)}return M}).join("").match(yE).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const z=M[0];if(z==="'")return{isToken:!1,value:wE(M)};if(dg[z])return{isToken:!0,value:M};if(z.match(_E))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");return{isToken:!1,value:M}});o.localize.preprocessor&&(g=o.localize.preprocessor(m,g));const y={firstWeekContainsDate:f,weekStartsOn:d,locale:o};return g.map(M=>{if(!M.isToken)return M.value;const z=M.value;(mE(z)||dE(z))&&pE(z,t,String(i));const F=dg[z[0]];return F(m,z,o.localize,y)}).join("")}function wE(i){const t=i.match(xE);return t?t[1].replace(vE,"'"):i}function SE(i,t,s){const a=Za(),o=(s==null?void 0:s.locale)??a.locale??Uy,f=v2(i,t);if(isNaN(f))throw new RangeError("Invalid time value");const d=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:f}),[m,g]=zy(s==null?void 0:s.in,...f>0?[t,i]:[i,t]),y=E2((s==null?void 0:s.roundingMethod)??"round"),E=g.getTime()-m.getTime(),_=E/lg,O=Io(g)-Io(m),R=(E-O)/lg,M=s==null?void 0:s.unit;let z;if(M?z=M:_<1?z="second":_<60?z="minute":_<ug?z="hour":R<cg?z="day":R<og?z="month":z="year",z==="second"){const F=y(E/1e3);return o.formatDistance("xSeconds",F,d)}else if(z==="minute"){const F=y(_);return o.formatDistance("xMinutes",F,d)}else if(z==="hour"){const F=y(_/60);return o.formatDistance("xHours",F,d)}else if(z==="day"){const F=y(R/ug);return o.formatDistance("xDays",F,d)}else if(z==="month"){const F=y(R/cg);return F===12&&M!=="month"?o.formatDistance("xYears",1,d):o.formatDistance("xMonths",F,d)}else{const F=y(R/og);return o.formatDistance("xYears",F,d)}}function EE(i,t){return SE(i,_2(i),t)}function wA(i){return i.toLocaleString()}function SA(i){return i>=1e9?`${(i/1e9).toFixed(1).replace(/\.0$/,"")}B`:i>=1e6?`${(i/1e6).toFixed(1).replace(/\.0$/,"")}M`:i>=1e4?`${(i/1e3).toFixed(1).replace(/\.0$/,"")}K`:i.toLocaleString()}function jE(i){const t=new Date(i);return t.getTime()>Date.now()?"just now":EE(t,{addSuffix:!0})}function EA(i){const t=Date.now()-new Date(i).getTime();if(t<0)return"now";const s=Math.floor(t/1e3);if(s<60)return`${s}s`;const a=Math.floor(s/60);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const f=Math.floor(o/24);return f<7?`${f}d`:f<30?`${Math.floor(f/7)}w`:f<365?`${Math.floor(f/30)}mo`:`${Math.floor(f/365)}y`}function jA(i){return i<=0?"Expired":Ah(i)}function AE(i){return i==null?"--":Ah(i)}function Ah(i){if(i<1e3)return`${Math.round(i)}ms`;if(i<6e4){const d=i/1e3;return Number.isInteger(d)?`${d}s`:`${d.toFixed(1)}s`}const t=Math.floor(i/1e3),s=Math.floor(t/86400),a=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),f=t%60;return s>0?a>0?`${s}d ${a}h`:`${s}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:f>0?`${o}m ${f}s`:`${o}m`}function AA(i,t){const s=new Date(i).getTime(),a=t?new Date(t).getTime():Date.now();return Ah(a-s)}function Hy({options:i,children:t,className:s=""}){const[a,o]=A.useState(!1),[f,d]=A.useState(null),[m,g]=A.useState(null),y=A.useRef(null),E=A.useRef(void 0),_=A.useRef(void 0),O=220,R=A.useCallback(()=>{if(!y.current)return;const ie=y.current.getBoundingClientRect(),$=window.innerWidth-O-8,ce=Math.max(8,Math.min(ie.left,$));g({top:ie.bottom+4,left:ce})},[]),M=A.useCallback(async(ie,$)=>{try{await navigator.clipboard.writeText(ie),d($),clearTimeout(E.current),E.current=setTimeout(()=>d(null),1200)}catch{}},[]),z=A.useCallback(()=>{clearTimeout(_.current),R(),o(!0)},[R]),F=A.useCallback(()=>{_.current=setTimeout(()=>o(!1),150)},[]);return A.useEffect(()=>()=>{clearTimeout(E.current),clearTimeout(_.current)},[]),h.jsxs("span",{ref:y,className:`inline-flex items-center cursor-default ${s}`,onMouseEnter:z,onMouseLeave:F,children:[t,a&&m&&Eg.createPortal(h.jsx("span",{className:"fixed z-[9999] bg-surface-raised border border-surface-border rounded shadow-lg py-1 min-w-[180px]",style:{top:m.top,left:m.left},onMouseEnter:z,onMouseLeave:F,children:i.map(ie=>h.jsxs("button",{onClick:$=>{$.stopPropagation(),M(ie.value,ie.label)},className:"flex items-center justify-between w-full px-2.5 py-1 text-left hover:bg-surface-hover transition-colors",children:[h.jsx("span",{className:"text-2xs font-medium uppercase tracking-wider text-text-tertiary w-10 shrink-0",children:ie.label}),h.jsx("span",{className:"text-2xs font-mono text-text-secondary truncate ml-2",children:f===ie.label?"✓":ie.value})]},ie.label))}),document.body)]})}function OE(i,t){const s=new Date(i);switch(t){case"relative":return jE(i);case"datetime":return Py(s,"MMM d, yyyy h:mm a");case"time":return s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function NE(i){const t=new Date(i);return[{label:"ms",value:String(t.getTime())},{label:"utc",value:t.toISOString()},{label:"local",value:Py(t,"MMM d, yyyy h:mm:ss a")}]}function TE({date:i,format:t="relative",className:s=""}){const[,a]=A.useState(0);A.useEffect(()=>{if(t!=="relative")return;const f=setInterval(()=>a(d=>d+1),3e4);return()=>clearInterval(f)},[t]);const o=A.useMemo(()=>NE(i),[i]);return h.jsx(Hy,{options:o,children:h.jsx("time",{dateTime:i,className:`text-xs text-text-tertiary ${s}`,children:OE(i,t)})})}function kE({ms:i,className:t=""}){const s=AE(i),a=A.useMemo(()=>i==null?[]:[{label:"ms",value:String(i)},{label:"sec",value:`${(i/1e3).toFixed(3)}s`},{label:"text",value:s}],[i,s]);return i==null?h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:"--"}):h.jsx(Hy,{options:a,children:h.jsx("span",{className:`text-xs text-text-tertiary ${t}`,children:s})})}const CE=["sm","md","lg","full"],yg={sm:"w-[28rem] max-h-[40vh]",md:"w-[36rem] max-h-[60vh]",lg:"w-[48rem] max-h-[80vh]",full:"inset-4 w-auto max-h-none"},bg={sm:"Small",md:"Medium",lg:"Large",full:"Fullscreen"};function ME({which:i}){const t="stroke-current";switch(i){case"sm":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1.5",className:t,strokeWidth:"1.5"})});case"md":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"3",y:"3",width:"9",height:"9",rx:"1.5",className:t,strokeWidth:"1.5"})});case"lg":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"1.5",y:"1.5",width:"11",height:"11",rx:"1.5",className:t,strokeWidth:"1.5"})});case"full":return h.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:h.jsx("rect",{x:"0.75",y:"0.75",width:"12.5",height:"12.5",rx:"1.5",className:t,strokeWidth:"1.5"})})}}function RE({msg:i}){const[t,s]=A.useState(0);A.useEffect(()=>{const d=new Date(i.timestamp).getTime(),m=()=>s(Math.floor((Date.now()-d)/1e3));m();const g=setInterval(m,1e3);return()=>clearInterval(g)},[i.timestamp]);const a=Math.floor(t/60),o=t%60,f=a>0?`${a}m ${o}s`:`${o}s`;return h.jsxs("span",{className:"inline-flex flex-col gap-1.5",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"text-text-tertiary",children:"Thinking"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:150ms]"}),h.jsx("span",{className:"inline-block w-1 h-1 rounded-full bg-text-tertiary animate-pulse [animation-delay:300ms]"}),h.jsx("span",{className:"text-text-muted ml-1 tabular-nums",children:f})]}),i.workflowId&&h.jsxs(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"inline-flex items-center gap-1 text-2xs text-accent/70 hover:text-accent transition-colors",children:[h.jsx(nh,{className:"w-2.5 h-2.5",strokeWidth:1.5}),"watch execution"]})]})}function DE({msg:i,compileMessage:t}){const s=i.role==="assistant";return h.jsxs("div",{className:`flex items-center gap-1.5 ${s?"justify-start":"justify-end"}`,children:[h.jsx(TE,{date:i.timestamp,format:"time",className:"!text-2xs text-text-muted/50"}),i.durationMs!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-muted/30 text-2xs",children:"·"}),h.jsx(kE,{ms:i.durationMs,className:"!text-2xs text-text-muted/50"})]}),i.workflowId&&h.jsx(Ni,{to:`/workflows/executions/${i.workflowId}`,className:"text-text-muted/40 hover:text-accent transition-colors",title:"View workflow execution",children:h.jsx(nh,{className:"w-2.5 h-2.5",strokeWidth:1.5})}),s&&i.workflowId&&!i.pending&&h.jsx("button",{onClick:()=>t(i.id),disabled:i.compilationStatus==="compiling"||i.compilationStatus==="done",className:"transition-colors",title:i.compilationStatus==="done"?"Compiled — future queries will match this pipeline":i.compilationStatus==="error"?i.compilationError??"Compilation failed":i.compilationStatus==="compiling"?"Compiling...":"Compile to fast pipeline",children:h.jsx(Nv,{className:`w-2.5 h-2.5 ${i.compilationStatus==="done"?"text-status-success":i.compilationStatus==="error"?"text-status-error":i.compilationStatus==="compiling"?"text-accent/40 animate-pulse":"text-text-muted/40 hover:text-accent"}`,strokeWidth:1.5})})]})}function qE(){const{helpOpen:i,setHelpOpen:t,messages:s,sendMessage:a,pageContext:o,activeWorkflowId:f,clearMessages:d,compileMessage:m}=Ry(),[g,y]=A.useState(""),[E,_]=A.useState("md"),[O,R]=A.useState(!0),M=A.useRef(null),z=A.useRef(null);if(A.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[s]),A.useEffect(()=>{i&&z.current&&z.current.focus()},[i]),A.useEffect(()=>{if(!i)return;const T=Q=>{Q.key==="Escape"&&(E==="full"?_("lg"):E==="lg"?_("md"):E==="md"?_("sm"):t(!1))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i,E,t]),!i)return null;const F=()=>{const T=g.trim();!T||f||(a(T),y(""),z.current&&(z.current.style.height="auto"))},ie=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),F())},$=E==="full",ce=o.page.replace(/-/g," "),ee=$?{}:{bottom:"108px"};return h.jsxs("div",{className:`fixed z-[45] flex flex-col border border-surface-border rounded-lg overflow-hidden transition-all duration-300 ${$?yg.full:`right-6 ${yg[E]}`} ${O?"bg-surface-raised shadow-xl":"bg-surface-raised/[0.03] shadow-lg shadow-black/5"}`,style:ee,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:[h.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 border-b border-surface-border shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-xs font-medium text-text-primary truncate",children:"Help Assistant"}),h.jsx("p",{className:"text-2xs text-text-tertiary truncate",children:ce})]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("div",{className:"flex items-center gap-0.5 border border-surface-border rounded p-0.5",role:"radiogroup","aria-label":"Panel size",children:CE.map(T=>h.jsx("button",{onClick:()=>_(T),className:`p-1 rounded transition-colors ${T===E?"bg-accent/15 text-accent":"text-text-muted hover:text-text-secondary hover:bg-surface-hover"}`,role:"radio","aria-checked":T===E,"aria-label":bg[T],title:bg[T],children:h.jsx(ME,{which:T})},T))}),s.length>0&&h.jsx("button",{onClick:d,className:"p-1 text-text-tertiary hover:text-text-secondary transition-colors","aria-label":"Clear conversation",title:"Clear conversation",children:h.jsx(Tv,{className:"w-3.5 h-3.5",strokeWidth:1.5})}),h.jsx("button",{onClick:()=>t(!1),className:"p-1 text-text-tertiary hover:text-text-primary transition-colors","aria-label":"Close",title:"Close",children:h.jsx(Yn,{className:"w-3.5 h-3.5",strokeWidth:1.5})})]})]}),h.jsxs("div",{ref:M,className:`flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[120px] transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[s.length===0&&h.jsx("p",{className:"text-xs text-text-tertiary text-center py-6",children:"Ask anything about what you're viewing."}),s.map(T=>h.jsxs("div",{className:`text-xs leading-relaxed ${T.role==="user"?"text-right":"text-left"}`,children:[h.jsx("div",{className:`inline-block max-w-[85%] px-3 py-2 rounded-md whitespace-pre-wrap ${T.role==="user"?"bg-accent/10 text-text-primary":"bg-surface-sunken text-text-secondary"}`,children:T.pending?h.jsx(RE,{msg:T}):T.role==="assistant"?h.jsx(jh,{content:T.content}):T.content}),!T.pending&&h.jsx("div",{className:"mt-0.5",children:h.jsx(DE,{msg:T,compileMessage:m})})]},T.id))]}),h.jsxs("div",{className:`border-t border-surface-border px-3 py-2.5 flex gap-2 shrink-0 transition-all duration-300 ${O?"opacity-100":"opacity-50 grayscale brightness-150"}`,children:[h.jsx("textarea",{ref:z,value:g,onChange:T=>{y(T.target.value);const Q=T.target;Q.style.height="auto",Q.style.height=`${Math.min(Q.scrollHeight,120)}px`},onKeyDown:ie,placeholder:"Ask a question...",rows:2,className:"flex-1 resize-none bg-surface text-xs text-text-primary placeholder:text-text-tertiary rounded px-2.5 py-1.5 border border-surface-border focus:outline-none focus:border-accent",style:{minHeight:"2.5rem"},disabled:!!f}),h.jsx("button",{onClick:F,disabled:!g.trim()||!!f,className:"px-2.5 py-1.5 text-accent hover:text-accent-hover disabled:text-text-muted transition-colors self-end","aria-label":"Send",children:h.jsx(kv,{className:"w-4 h-4",strokeWidth:1.5})})]})]})}function zE(){var ce;const{isBuilder:i,isOps:t,viewAs:s}=py(),{canSeePaceBoard:a}=gy(),{data:o}=Mi(),f=dy(),d=f!==null?f:!!((ce=o==null?void 0:o.ai)!=null&&ce.enabled),{collapsed:m,toggle:g}=wh(),[y,E]=A.useState(!1),[_,O]=A.useState(!1),[R,M]=A.useState(!1),[z,F]=A.useState(()=>window.location.hash.startsWith("#docs")),ie=Sn(),$=A.useRef(null);return A.useEffect(()=>{const ee=$.current;ee&&(ee.classList.remove("animate-page-in"),ee.offsetWidth,ee.classList.add("animate-page-in"))},[ie.pathname]),A.useEffect(()=>{const ee=()=>{window.location.hash.startsWith("#docs")&&F(!0)};return window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[]),h.jsxs("div",{className:"h-screen bg-surface flex flex-col",children:[h.jsx(dS,{onToggleEventFeed:()=>E(ee=>!ee),onToggleDocs:()=>F(ee=>!ee),onToggleNav:()=>O(ee=>!ee)}),h.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[h.jsxs("aside",{className:`${m?"w-16":"w-60"} shrink-0 bg-surface-raised border-r border-surface-border hidden lg:flex flex-col transition-[width] duration-200 ease-out overflow-hidden relative z-20`,children:[h.jsx("nav",{className:"flex-1 px-3 pt-[36px] pb-4 space-y-2 overflow-y-auto overflow-x-hidden",children:h.jsx(Oy,{aiEnabled:d,isBuilder:i,isOps:t,viewAs:s,canSeePaceBoard:a})}),h.jsx("button",{onClick:g,className:`shrink-0 py-3 text-text-tertiary hover:text-text-secondary transition-colors duration-150 ${m?"flex justify-center":"flex items-center px-7"}`,"aria-label":m?"Expand sidebar":"Collapse sidebar",children:m?h.jsx(Cv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5}):h.jsx(Mv,{className:"w-4 h-4 text-accent-muted",strokeWidth:1.5})}),!m&&(o==null?void 0:o.environment)&&h.jsxs("div",{className:"shrink-0 px-5 pb-3 text-2xs leading-tight text-text-tertiary whitespace-nowrap overflow-hidden text-ellipsis",title:`long-tail v${o.environment.longTailVersion} · HotMesh v${o.environment.hotmeshVersion} · Node ${o.environment.nodeVersion} · ${o.environment.nodeEnv}`,children:["long-tail v",o.environment.longTailVersion,h.jsx("span",{className:"mx-1 text-surface-border",children:"·"}),"HotMesh v",o.environment.hotmeshVersion]})]}),h.jsx("main",{className:"flex-1 min-w-0 overflow-y-auto",children:h.jsx("div",{ref:$,className:"w-full px-page-x py-8 pb-16 animate-page-in h-full flex flex-col @container",children:h.jsx(Sr,{})})}),h.jsx(UE,{})]}),h.jsx(qS,{open:_,onClose:()=>O(!1),aiEnabled:d,isBuilder:i,isOps:t,viewAs:s,canSeePaceBoard:a}),h.jsx(e2,{open:y,onToggle:()=>E(ee=>!ee),configOpen:R,onToggleConfig:()=>M(ee=>!ee)}),h.jsx(u2,{open:z,onClose:()=>{F(!1),history.replaceState(null,"",window.location.pathname+window.location.search)}}),d&&h.jsx(p2,{}),d&&h.jsx(qE,{})]})}function UE(){const{node:i,width:t,open:s}=nS();return h.jsx(sS,{open:s,width:t,className:"border-l border-surface-border bg-surface-raised",children:i})}function BE(){const{isAuthenticated:i}=Vn(),t=Sn();return i?h.jsx(Ww,{children:h.jsx(tS,{children:h.jsx(m2,{children:h.jsx(zE,{})})})}):h.jsx(Ln,{to:"/login",state:{from:t.pathname},replace:!0})}function $y({provider:i,className:t="w-5 h-5"}){switch(i){case"google":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),h.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),h.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),h.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]});case"github":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})});case"microsoft":return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:[h.jsx("path",{d:"M3 3h8.5v8.5H3z",fill:"#F25022"}),h.jsx("path",{d:"M12.5 3H21v8.5h-8.5z",fill:"#7FBA00"}),h.jsx("path",{d:"M3 12.5h8.5V21H3z",fill:"#00A4EF"}),h.jsx("path",{d:"M12.5 12.5H21V21h-8.5z",fill:"#FFB900"})]});case"anthropic":return h.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:h.jsx("path",{d:"M13.827 3.52h3.603L24 20.48h-3.603l-6.57-16.96zm-7.258 0h3.767L16.906 20.48h-3.674l-1.343-3.461H6.396l-1.34 3.461H1.5l5.07-16.96zm2.327 5.14l-2.065 5.326h4.108l-2.043-5.326z"})});default:return h.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("path",{d:"M12 8v4l3 3"})]})}}async function LE(){return we("/auth/oauth/providers")}async function PE(i,t){const s=t?`?label=${encodeURIComponent(t)}`:"";return we(`/auth/oauth/connections/${i}${s}`,{method:"DELETE"})}function OA(){return ht({queryKey:["oauth-connections"],queryFn:()=>we("/auth/oauth/connections")})}function NA(){const i=bt();return Et({mutationFn:({provider:t,label:s})=>PE(t,s),onSuccess:()=>{i.invalidateQueries({queryKey:["oauth-connections"]})}})}function HE(){var le;const{login:i,isAuthenticated:t}=Vn(),s=th(),a=Sn(),o=new URLSearchParams(a.search),f=o.get("token"),d=o.get("error"),m=((le=a.state)==null?void 0:le.from)??o.get("returnTo")??"/",g=A.useRef(!1);f&&!g.current&&(g.current=!0,i(f,void 0,{displayName:o.get("displayName"),username:o.get("username")}));const[y,E]=A.useState(""),[_,O]=A.useState(""),[R,M]=A.useState(d||""),[z,F]=A.useState(!1),[ie,$]=A.useState(!!f),[ce,ee]=A.useState([]),T=A.useRef(!1);if(A.useEffect(()=>{f||T.current||(T.current=!0,(async()=>{var I,V,W,oe;try{const re=await fetch(`${Tt}/api/settings`);if(!re.ok)return;const Oe=await re.json();if(!((I=Oe.auth)!=null&&I.sso))return;const ke=await fetch(`${Tt}/api/auth/sso`,{method:"POST"});if(!ke.ok){M("Host authentication required — please log in to your organization first");return}const Se=await ke.json();Se.token&&((V=Oe.auth)!=null&&V.ssoLogoutUrl&&sessionStorage.setItem("lt_sso_logout_url",Oe.auth.ssoLogoutUrl),$(!0),i(Se.token,void 0,{displayName:(W=Se.user)==null?void 0:W.display_name,username:(oe=Se.user)==null?void 0:oe.external_id}))}catch{}})())},[]),A.useEffect(()=>{f||LE().then(ee).catch(()=>{})},[]),A.useEffect(()=>{if(!ie)return;const I=setTimeout(()=>s(m,{replace:!0}),1500);return()=>clearTimeout(I)},[ie]),t&&!ie)return h.jsx(Ln,{to:m,replace:!0});const Q=async I=>{var V,W;if(I.preventDefault(),M(""),!y.trim()||!_){M("Username and password are required");return}F(!0);try{const oe=await fetch(`${Tt}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y.trim(),password:_})}),re=await oe.json();if(!oe.ok){M(re.error||"Login failed");return}$(!0),i(re.token,{username:y.trim(),password:_},{displayName:(V=re.user)==null?void 0:V.display_name,username:(W=re.user)==null?void 0:W.external_id})}catch{M("Unable to connect to server")}finally{F(!1)}};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center overflow-hidden",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:`mb-10 transition-all duration-[1500ms] ease-in ${ie?"translate-x-[120vw] -translate-y-[60vh] scale-[3] opacity-0":""}`,children:h.jsx(Yo,{size:"lg",hideLabel:ie})}),h.jsxs("form",{onSubmit:Q,className:`space-y-5 transition-opacity duration-300 ${ie?"opacity-0":""}`,children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-text-secondary mb-2",children:"Username"}),h.jsx("input",{id:"username",type:"text",value:y,onChange:I=>E(I.target.value),className:"input",placeholder:"Enter your username",autoFocus:!ie,autoComplete:"username"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-text-secondary mb-2",children:"Password"}),h.jsx("input",{id:"password",type:"password",value:_,onChange:I=>O(I.target.value),className:"input",placeholder:"Enter your password",autoComplete:"current-password"})]}),R&&h.jsx("p",{className:"text-sm text-status-error",children:R}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:z||ie,children:z?"Signing in...":"Sign In"}),ce.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-3 mt-6",children:[h.jsx("div",{className:"flex-1 h-px bg-border"}),h.jsx("span",{className:"text-xs text-text-tertiary",children:"or continue with"}),h.jsx("div",{className:"flex-1 h-px bg-border"})]}),h.jsx("div",{className:"space-y-2",children:ce.filter(I=>I.provider!=="anthropic").map(I=>h.jsxs("a",{href:`${Tt}/api/auth/oauth/${I.provider}?returnTo=${encodeURIComponent(m)}`,className:"btn-secondary w-full flex items-center justify-center gap-2",children:[h.jsx($y,{provider:I.provider}),"Sign in with ",I.name]},I.provider))})]})]})]})})}function xg(){const{isAuthenticated:i}=Vn(),t=th(),s=Sn(),a=new URLSearchParams(s.search),o=a.get("state")||"";A.useEffect(()=>{i||t(`/login?returnTo=${encodeURIComponent(s.pathname+s.search)}`)},[i]);const[f,d]=A.useState(""),[m,g]=A.useState(a.get("label")||"default"),[y,E]=A.useState(""),[_,O]=A.useState(!1),R=f.trim().startsWith("sk-ant-oat"),M=f.trim().startsWith("sk-ant-api"),z=F=>{F.preventDefault();const ie=f.trim();if(!ie){E("A token or API key is required");return}if(!ie.startsWith("sk-ant-")){E('Invalid format. Must start with "sk-ant-oat" (OAuth token) or "sk-ant-api" (API key)');return}O(!0),E("");const $=`${Tt}/api/auth/oauth/anthropic/callback?code=${encodeURIComponent(ie)}&state=${encodeURIComponent(o)}`;window.location.href=$};return h.jsx("div",{className:"min-h-screen bg-surface flex items-center justify-center",children:h.jsxs("div",{className:"w-full max-w-md p-10",children:[h.jsx("div",{className:"mb-10",children:h.jsx(Yo,{size:"lg"})}),h.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[h.jsx($y,{provider:"anthropic",className:"w-6 h-6"}),h.jsx("h2",{className:"heading-3",children:"Connect Anthropic"})]}),h.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Connect your Anthropic account so Claude Code tasks run under your credentials. Your token is encrypted at rest."}),h.jsxs("form",{onSubmit:z,className:"space-y-5",children:[h.jsxs("div",{children:[h.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-text-secondary mb-2",children:"OAuth Token or API Key"}),h.jsx("input",{id:"token",type:"password",value:f,onChange:F=>d(F.target.value),className:"input",placeholder:"sk-ant-oat01-... or sk-ant-api03-...",autoFocus:!0,autoComplete:"off"}),R&&h.jsx("p",{className:"text-xs text-status-success mt-1",children:"OAuth token detected — uses your Claude subscription (flat rate)"}),M&&h.jsx("p",{className:"text-xs text-status-warning mt-1",children:"API key detected — billed per-token from your Anthropic API account"})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"label",className:"block text-sm font-medium text-text-secondary mb-2",children:"Label"}),h.jsx("input",{id:"label",type:"text",value:m,onChange:F=>g(F.target.value.replace(/\s+/g,"-").toLowerCase()),className:"input",placeholder:"default",autoComplete:"off"}),h.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:'A name for this credential. Use different labels to store multiple credentials (e.g., "subscription", "api-batch").'})]}),y&&h.jsx("p",{className:"text-sm text-status-error",children:y}),h.jsx("button",{type:"submit",className:"btn-primary w-full",disabled:_,children:_?"Validating...":"Connect"}),h.jsx("a",{href:"/",className:"block text-center text-sm text-text-tertiary hover:text-text-secondary",children:"Cancel"})]}),h.jsxs("div",{className:"mt-6 space-y-3 text-xs text-text-tertiary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Recommended:"})," ","Run"," ",h.jsx("code",{className:"px-1 py-0.5 bg-surface-sunken rounded text-2xs",children:"claude setup-token"})," ","in your terminal to generate an OAuth token that uses your subscription."]}),h.jsxs("div",{children:[h.jsx("span",{className:"font-medium text-text-secondary",children:"Alternative:"})," ","Use an API key from"," ",h.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent-secondary hover:underline",children:"console.anthropic.com"})," ","(billed per-token)."]})]})]})})}function qa({roleTypes:i,roleNames:t,redirectTo:s="/"}){const{isSuperAdmin:a,hasRole:o,hasRoleType:f}=Vn();return a?h.jsx(Sr,{}):i&&i.some(d=>f(d))?h.jsx(Sr,{}):t&&t.some(d=>o(d))?h.jsx(Sr,{}):h.jsx(Ln,{to:s,replace:!0})}function $E({redirectTo:i="/"}){var a;const{data:t,isLoading:s}=Mi();return s||!t?null:(a=t.ai)!=null&&a.enabled?h.jsx(Sr,{}):h.jsx(Ln,{to:i,replace:!0})}function YE({flag:i,redirectTo:t="/"}){var o;const{data:s,isLoading:a}=Mi();return a||!s?null:((o=s.features)==null?void 0:o[i])===!1?h.jsx(Ln,{to:t,replace:!0}):h.jsx(Sr,{})}const GE=A.lazy(()=>_e(()=>import("./ProcessesListPage-DatKHVkd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url).then(i=>({default:i.ProcessesListPage}))),VE=A.lazy(()=>_e(()=>import("./ProcessDetailPage-ChGWcwSp.js"),__vite__mapDeps([18,1,2,4,19,14,20,17,11,6,21,22,23]),import.meta.url).then(i=>({default:i.ProcessDetailPage}))),IE=A.lazy(()=>_e(()=>import("./McpOverview-Cj8_UyWJ.js"),__vite__mapDeps([24,1,25,26,27,28,15,14,29,6]),import.meta.url).then(i=>({default:i.McpOverview}))),FE=A.lazy(()=>_e(()=>import("./McpRunsPage-CNXYU4iX.js"),__vite__mapDeps([30,1,26,27,5,6,31,28,8,9,10,17,14,32,15,13,12,16,33]),import.meta.url).then(i=>({default:i.McpRunsPage}))),JE=A.lazy(()=>_e(()=>import("./McpRunDetailPage-BqhRwkGk.js"),__vite__mapDeps([34,1,26,20,15,14,35,6,36,37,13,38,39,16]),import.meta.url).then(i=>({default:i.McpRunDetailPage}))),QE=A.lazy(()=>_e(()=>import("./McpQueryPage-CqFkBwBR.js"),__vite__mapDeps([40,1,15,14,9,10,13,12,16,8,11,32,17,33,5,6,4,41]),import.meta.url).then(i=>({default:i.McpQueryPage}))),KE=A.lazy(()=>_e(()=>import("./McpQueryDetailPage-Bqh8GChr.js"),__vite__mapDeps([42,1,15,14,20,41,6,27,4,43,36,26,3,2,44,45,46,47,48,49,35,50,38,39]),import.meta.url).then(i=>({default:i.McpQueryDetailPage}))),XE=A.lazy(()=>_e(()=>import("./EscalationsOverview-BzNFcA0i.js"),__vite__mapDeps([51,1,4,15,14,29,6]),import.meta.url).then(i=>({default:i.EscalationsOverview}))),ZE=A.lazy(()=>_e(()=>import("./AvailableEscalationsPage-Bk7fFV2e.js"),__vite__mapDeps([52,1,53,4,14,54,55,6,20,12,56,57,58,5,7,8,9,10,23,59,13,60,21,17,33,16]),import.meta.url).then(i=>({default:i.AvailableEscalationsPage}))),WE=A.lazy(()=>_e(()=>import("./OperatorDashboard-DwbPAPaf.js"),__vite__mapDeps([61,1,4,5,6,7,8,9,10,15,14,12,33,59,13,60,21,17,56,16]),import.meta.url).then(i=>({default:i.OperatorDashboard}))),ej=A.lazy(()=>_e(()=>import("./index-jkVeGCkD.js"),__vite__mapDeps([62,1,54,55,6,20,12,56,14,57,15,16,3,4,21,35,22,23]),import.meta.url).then(i=>({default:i.EscalationDetailPage}))),tj=A.lazy(()=>_e(()=>import("./WorkflowsOverview-ClSH1UwG.js"),__vite__mapDeps([63,1,3,4,15,14,29,6]),import.meta.url).then(i=>({default:i.WorkflowsOverview}))),nj=A.lazy(()=>_e(()=>import("./index-C-T1Wq0Z.js"),__vite__mapDeps([64,1,3,15,14,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.StartWorkflowPage}))),sj=A.lazy(()=>_e(()=>import("./index-C-T1Wq0Z.js"),__vite__mapDeps([64,1,3,15,14,13,17,65,47,48,6]),import.meta.url).then(i=>({default:i.DurableInvokePage}))),ij=A.lazy(()=>_e(()=>import("./WorkflowsDashboard-DC_9GrpY.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"durable"})}))),rj=A.lazy(()=>_e(()=>import("./WorkflowsDashboard-DC_9GrpY.js"),__vite__mapDeps([66,1,32,3,31,28,6,4,5,8,9,10,17,14,15,13,12,16,33]),import.meta.url).then(i=>({default:()=>i.WorkflowsDashboard({tier:"all"})}))),aj=A.lazy(()=>_e(()=>import("./YamlWorkflowsPage-Db_REA2f.js"),__vite__mapDeps([67,1,27,5,6,15,14,13,10,49,65,20]),import.meta.url).then(i=>({default:i.YamlWorkflowsPage}))),lj=A.lazy(()=>_e(()=>import("./GraphInvokePage-CBjXjOLX.js"),__vite__mapDeps([68,1,27,15,14,44,46,47,48,45,6,49,65]),import.meta.url).then(i=>({default:i.GraphInvokePage}))),oj=A.lazy(()=>_e(()=>import("./YamlWorkflowDetailPage-BkgoB7oD.js"),__vite__mapDeps([69,1,27,20,65,14,6]),import.meta.url).then(i=>({default:i.YamlWorkflowDetailPage}))),cj=A.lazy(()=>_e(()=>import("./TasksListPage-urJ4XiUi.js"),__vite__mapDeps([70,1,2,3,5,6,9,10,20,60,50,12,13,14,15,17]),import.meta.url).then(i=>({default:i.TasksListPage}))),uj=A.lazy(()=>_e(()=>import("./TaskDetailPage-B-E1dqUw.js"),__vite__mapDeps([71,1,2,20,60,15,14,6]),import.meta.url).then(i=>({default:i.TaskDetailPage}))),vg=A.lazy(()=>_e(()=>import("./WorkflowExecutionPage-mbnj6saI.js"),__vite__mapDeps([72,1,3,4,37,13,14,38,20,6,39,2,15,36,16,35]),import.meta.url).then(i=>({default:i.WorkflowExecutionPage}))),fj=A.lazy(()=>_e(()=>import("./AdminDashboard-D0HdEkT9.js"),__vite__mapDeps([73,1,2,4,25,19,14,6]),import.meta.url).then(i=>({default:i.AdminDashboard}))),hj=A.lazy(()=>_e(()=>import("./index-BW7-Q9Qf.js"),__vite__mapDeps([74,1,3,9,10,13,14,33,5,6,15,75,17]),import.meta.url).then(i=>({default:i.WorkersPage}))),dj=A.lazy(()=>_e(()=>import("./index-4zRmxPwA.js"),__vite__mapDeps([76,1,3,13,14,77,55,6,21,17,15,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigsPage}))),_g=A.lazy(()=>_e(()=>import("./index-4zRmxPwA.js"),__vite__mapDeps([76,1,3,13,14,77,55,6,21,17,15,47,48,65]),import.meta.url).then(i=>({default:i.WorkflowConfigDetailPage}))),mj=A.lazy(()=>_e(()=>import("./index-BzQIzZfd.js"),__vite__mapDeps([78,1,25,10,77,55,6,15,14,13,12,5,79,46,47,48,49,45,33,20]),import.meta.url).then(i=>({default:i.McpServersPage}))),wg=A.lazy(()=>_e(()=>import("./index-B5JgykZD.js"),__vite__mapDeps([80,1,25,15,14,43,6]),import.meta.url).then(i=>({default:i.McpServerDetailPage}))),pj=A.lazy(()=>_e(()=>import("./index-_Q1Wf2A8.js"),__vite__mapDeps([81,1,23,5,6,9,10,12,13,14,77,55,33,15,21,48,50]),import.meta.url).then(i=>({default:i.UsersPage}))),gj=A.lazy(()=>_e(()=>import("./RolesPage-CPKw336d.js"),__vite__mapDeps([82,1,15,14,21,58,55,6]),import.meta.url).then(i=>({default:i.RolesPage}))),yj=A.lazy(()=>_e(()=>import("./RoleDetailPage-GJ_coHsM.js"),__vite__mapDeps([83,1,77,55,6,23,14]),import.meta.url).then(i=>({default:i.RoleDetailPage}))),bj=A.lazy(()=>_e(()=>import("./EscalationSchemaPage-Cd9fR2EA.js"),__vite__mapDeps([84,1,14,6]),import.meta.url).then(i=>({default:i.EscalationSchemaPage}))),xj=A.lazy(()=>_e(()=>import("./EscalationListSchemaPage-BTBZ8OBY.js"),__vite__mapDeps([85,1,14,6]),import.meta.url).then(i=>({default:i.EscalationListSchemaPage}))),vj=A.lazy(()=>_e(()=>import("./index-BZbDwh_Y.js"),__vite__mapDeps([86,1,15,14,55,6,57]),import.meta.url).then(i=>({default:i.MaintenancePage}))),_j=A.lazy(()=>_e(()=>import("./OperationsPage-C7UB_d-X.js").then(i=>i.O),__vite__mapDeps([87,1,4,15,14,58,6]),import.meta.url).then(i=>({default:i.OperationsPage}))),wj=A.lazy(()=>_e(()=>import("./index-oHU-ramT.js"),__vite__mapDeps([88,1,19,14,13,5,6,31,28,55,36,75,9,10,33]),import.meta.url).then(i=>({default:i.ControlPlanePage}))),Sj=A.lazy(()=>_e(()=>import("./index-peRHL38z.js"),__vite__mapDeps([89,1,39,14,5,6,31,28,8,9,10,12,13,15,16]),import.meta.url).then(i=>({default:i.StreamMessagesPage}))),Ej=A.lazy(()=>_e(()=>import("./CredentialsPage-DR48hDES.js"),__vite__mapDeps([90,1,15,14,50,77,55,6]),import.meta.url).then(i=>({default:i.CredentialsPage}))),jj=A.lazy(()=>_e(()=>import("./index-CeM012DJ.js"),__vite__mapDeps([91,1,6,15,14,13,16,8,10,92,50]),import.meta.url).then(i=>({default:i.FilesPage}))),Aj=A.lazy(()=>_e(()=>import("./index-KkikDsJ2.js"),__vite__mapDeps([93,1,15,14,13,16,12,10,92,50,94,43,6]),import.meta.url).then(i=>({default:i.KnowledgePage}))),Oj=A.lazy(()=>_e(()=>import("./HomePage-NMLaXTvf.js"),__vite__mapDeps([95,1,3,26,28,4,21,14,17,16,87,15,58,6,53]),import.meta.url).then(i=>({default:i.HomePage}))),Nj=A.lazy(()=>_e(()=>import("./AgentsPage-DBequneI.js"),__vite__mapDeps([96,1,97,4,5,6,8,9,10,12,13,14,15,16]),import.meta.url).then(i=>({default:i.AgentsPage}))),Tj=A.lazy(()=>_e(()=>import("./AgentDetailPage-C5AnjpD9.js"),__vite__mapDeps([98,1,97,99,14,4,17,6]),import.meta.url).then(i=>({default:i.AgentDetailPage}))),Sg=A.lazy(()=>_e(()=>import("./AgentConfigPage-CtURUMOV.js"),__vite__mapDeps([100,1,97,99,14,15,94,46,47,48,3,27,101,102,17,6]),import.meta.url).then(i=>({default:i.AgentConfigPage}))),kj=A.lazy(()=>_e(()=>import("./CapabilitiesPage-w-D6xraE.js"),__vite__mapDeps([103,1,101,79,25,46,47,48,14,49,6,45,15,13]),import.meta.url).then(i=>({default:i.CapabilitiesPage}))),Cj=A.lazy(()=>_e(()=>import("./TopicsPage-C5THflVQ.js"),__vite__mapDeps([104,1,102,15,14,13,6]),import.meta.url).then(i=>({default:i.TopicsPage}))),Mj=A.lazy(()=>_e(()=>import("./TopicDetailPage-B10i4xV2.js"),__vite__mapDeps([105,1,102,16,14,6]),import.meta.url).then(i=>({default:i.TopicDetailPage})));function Rj(){return h.jsxs("div",{className:"animate-pulse space-y-4",children:[h.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),h.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]})}function ve({children:i}){return h.jsx(A.Suspense,{fallback:h.jsx(Rj,{}),children:h.jsx("div",{className:"animate-page-enter flex flex-col flex-1 min-h-0",children:i})})}const Yy=new ev({defaultOptions:{queries:{staleTime:1e4,retry:(i,t)=>t instanceof Error&&t.message==="Session expired"?!1:i<1}}});window.addEventListener("auth:unauthorized",()=>{Yy.clear(),sessionStorage.removeItem("lt_token"),sessionStorage.removeItem("lt_credentials"),sessionStorage.removeItem("lt_user_info");const i=window.__LT_BASE__||"",t=`${i}/login`;if(window.location.pathname!==t){const s=window.location.pathname+window.location.search,a=i&&s.startsWith(i)?s.slice(i.length)||"/":s;window.location.href=`${t}?returnTo=${encodeURIComponent(a)}`}});const Dj=sv([{path:"/login",element:h.jsx(HE,{})},{path:"/connect/anthropic",element:h.jsx(xg,{})},{path:"/connect/:provider",element:h.jsx(xg,{})},{path:"/",element:h.jsx(BE,{}),children:[{index:!0,element:h.jsx(ve,{children:h.jsx(Oj,{})})},{path:"processes/all",element:h.jsx(ve,{children:h.jsx(GE,{})})},{path:"processes/detail/:originId",element:h.jsx(ve,{children:h.jsx(VE,{})})},{path:"credentials",element:h.jsx(ve,{children:h.jsx(Ej,{})})},{path:"connections",element:h.jsx(Ln,{to:"/credentials",replace:!0})},{path:"escalations",element:h.jsx(ve,{children:h.jsx(XE,{})})},{path:"escalations/available",element:h.jsx(ve,{children:h.jsx(ZE,{})})},{path:"escalations/queue",element:h.jsx(ve,{children:h.jsx(WE,{})})},{path:"escalations/detail/:id",element:h.jsx(ve,{children:h.jsx(ej,{})})},{path:"capabilities",element:h.jsx(ve,{children:h.jsx(kj,{})})},{path:"agents",element:h.jsx(ve,{children:h.jsx(Nj,{})})},{path:"agents/new",element:h.jsx(ve,{children:h.jsx(Sg,{})})},{path:"agents/:id",element:h.jsx(ve,{children:h.jsx(Tj,{})})},{path:"agents/:id/edit",element:h.jsx(ve,{children:h.jsx(Sg,{})})},{path:"topics",element:h.jsx(ve,{children:h.jsx(Cj,{})})},{path:"topics/:topic",element:h.jsx(ve,{children:h.jsx(Mj,{})})},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"workflows",element:h.jsx(ve,{children:h.jsx(tj,{})})},{path:"workflows/executions",element:h.jsx(ve,{children:h.jsx(rj,{})})},{path:"workflows/durable/executions",element:h.jsx(ve,{children:h.jsx(ij,{})})},{path:"workflows/durable/executions/:workflowId",element:h.jsx(ve,{children:h.jsx(vg,{})})},{path:"workflows/tasks",element:h.jsx(ve,{children:h.jsx(cj,{})})},{path:"workflows/tasks/detail/:id",element:h.jsx(ve,{children:h.jsx(uj,{})})},{path:"workflows/executions/:workflowId",element:h.jsx(ve,{children:h.jsx(vg,{})})},{path:"workflows/start",element:h.jsx(ve,{children:h.jsx(nj,{})})},{path:"workflows/durable/invoke",element:h.jsx(ve,{children:h.jsx(sj,{})})},{path:"workflows/cron",element:h.jsx(Ln,{to:"/workflows/start?mode=schedule",replace:!0})},{path:"workflows/workers",element:h.jsx(ve,{children:h.jsx(hj,{})})},{path:"workflows/registry",element:h.jsx(ve,{children:h.jsx(dj,{})})},{path:"workflows/registry/new",element:h.jsx(ve,{children:h.jsx(_g,{})})},{path:"workflows/registry/:workflowType",element:h.jsx(ve,{children:h.jsx(_g,{})})}]},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"mcp/workflows",element:h.jsx(ve,{children:h.jsx(aj,{})})},{path:"mcp/workflows/invoke",element:h.jsx(ve,{children:h.jsx(lj,{})})},{path:"mcp/workflows/:id",element:h.jsx(ve,{children:h.jsx(oj,{})})},{path:"mcp/executions",element:h.jsx(ve,{children:h.jsx(FE,{})})},{path:"mcp/executions/:jobId",element:h.jsx(ve,{children:h.jsx(JE,{})})},{path:"files",element:h.jsx(ve,{children:h.jsx(jj,{})})},{path:"knowledge",element:h.jsx(ve,{children:h.jsx(Aj,{})})},{element:h.jsx($E,{}),children:[{path:"mcp",element:h.jsx(ve,{children:h.jsx(IE,{})})},{path:"mcp/queries",element:h.jsx(ve,{children:h.jsx(QE,{})})},{path:"mcp/queries/:workflowId",element:h.jsx(ve,{children:h.jsx(KE,{})})},{path:"mcp/tools",element:h.jsx(Ln,{to:"/mcp/servers",replace:!0})},{path:"mcp/servers",element:h.jsx(ve,{children:h.jsx(mj,{})})},{path:"mcp/servers/new",element:h.jsx(ve,{children:h.jsx(wg,{})})},{path:"mcp/servers/:serverId",element:h.jsx(ve,{children:h.jsx(wg,{})})}]}]},{element:h.jsx(qa,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"operations",element:h.jsx(ve,{children:h.jsx(_j,{})})}]},{element:h.jsx(qa,{roleTypes:["admin","superadmin"],roleNames:["engineer"]}),children:[{path:"admin",element:h.jsx(ve,{children:h.jsx(fj,{})})},{path:"admin/users",element:h.jsx(ve,{children:h.jsx(pj,{})})},{path:"admin/escalation-chains",element:h.jsx(Ln,{to:"/admin/roles",replace:!0})},{path:"admin/roles",element:h.jsx(ve,{children:h.jsx(gj,{})})},{path:"admin/roles/:role",element:h.jsx(ve,{children:h.jsx(yj,{})})},{path:"admin/roles/:role/schema",element:h.jsx(ve,{children:h.jsx(bj,{})})},{path:"admin/roles/:role/list-schema",element:h.jsx(ve,{children:h.jsx(xj,{})})}]},{element:h.jsx(qa,{roleTypes:["superadmin"],roleNames:["engineer"]}),children:[{path:"admin/bots",element:h.jsx(Ln,{to:"/admin/users?tab=service-accounts",replace:!0})},{element:h.jsx(YE,{flag:"dbMaintenance"}),children:[{path:"admin/maintenance",element:h.jsx(ve,{children:h.jsx(vj,{})})}]},{path:"admin/controlplane",element:h.jsx(ve,{children:h.jsx(wj,{})})},{path:"admin/streams",element:h.jsx(ve,{children:h.jsx(Sj,{})})}]}]}],{basename:window.__LT_BASE__||"/"});function qj(){return h.jsx(tv,{client:Yy,children:h.jsx($v,{children:h.jsx(Gw,{children:h.jsx(iv,{router:Dj})})})})}jy(Ey());const Oh=document.createElement("link");Oh.rel="stylesheet";Oh.href=`${Tt}/api/settings/custom.css`;document.head.appendChild(Oh);Uv.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(qj,{})}));export{Hy as $,iA as A,aA as B,Eh as C,kE as D,lA as E,Ty as F,xS as G,Ij as H,vy as I,XS as J,xy as K,mA as L,Ah as M,Xg as N,Xj as O,EA as P,jh as Q,sS as R,LS as S,Yj as T,$j as U,Qj as V,Wj as W,rA as X,cA as Y,Pv as Z,Py as _,AA as a,jA as a0,gA as a1,oA as a2,yA as a3,bA as a4,uA as a5,fA as a6,dA as a7,hA as a8,pA as a9,wA as aa,Hj as ab,Tt as ac,Mg as ad,Gj as ae,OA as af,NA as ag,$y as ah,gy as ai,SA as aj,TE as b,Wg as c,we as d,Jj as e,AE as f,Kj as g,Zj as h,Vj as i,dy as j,Vn as k,Fj as l,vA as m,_A as n,nS as o,wS as p,vS as q,_S as r,jS as s,py as t,Mi as u,eA as v,xA as w,tA as x,nA as y,sA as z};
|
|
63
|
+
//# sourceMappingURL=index-CKxFjMtw.js.map
|