@hotmeshio/long-tail 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/escalations/index.d.ts +1 -1
- package/build/api/escalations/index.js +2 -1
- package/build/api/escalations/list.d.ts +11 -0
- package/build/api/escalations/list.js +31 -2
- package/build/api/settings.js +2 -0
- package/build/api/users.d.ts +11 -0
- package/build/api/users.js +19 -0
- package/build/index.js +6 -0
- package/build/lib/uuid.d.ts +11 -0
- package/build/lib/uuid.js +20 -0
- package/build/modules/search.d.ts +21 -0
- package/build/modules/search.js +55 -0
- package/build/routes/escalations/list.js +10 -1
- package/build/routes/users.js +9 -0
- package/build/scripts/ortho-populate.d.ts +3 -1
- package/build/scripts/ortho-populate.js +15 -5
- package/build/sdk/index.d.ts +1 -0
- package/build/services/escalation/batch.js +3 -0
- package/build/services/escalation/bulk.js +8 -0
- package/build/services/escalation/crud.js +26 -0
- package/build/services/escalation/queries.d.ts +14 -1
- package/build/services/escalation/queries.js +49 -7
- package/build/services/escalation/sql.d.ts +4 -2
- package/build/services/escalation/sql.js +4 -0
- package/build/services/role/types.d.ts +18 -0
- package/build/services/role/types.js +6 -0
- package/build/services/user/auth.js +2 -2
- package/build/services/user/crud.d.ts +13 -0
- package/build/services/user/crud.js +26 -3
- package/build/services/user/index.d.ts +1 -1
- package/build/services/user/index.js +2 -1
- package/build/services/user/sql.d.ts +11 -5
- package/build/services/user/sql.js +18 -6
- package/build/start/adapters.js +2 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/startup.d.ts +12 -1
- package/dashboard/dist/assets/{AdminDashboard-mULAQuHV.js → AdminDashboard-DPkWtPc1.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-mULAQuHV.js.map → AdminDashboard-DPkWtPc1.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DHdzgXcr.js → AgentConfigPage-DRfnLiQS.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-DHdzgXcr.js.map → AgentConfigPage-DRfnLiQS.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-Du_33U2u.js → AgentDetailPage-CufRZXnT.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-Du_33U2u.js.map → AgentDetailPage-CufRZXnT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-4KkQO2Hl.js → AgentsPage-CoCWGhUd.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-4KkQO2Hl.js.map → AgentsPage-CoCWGhUd.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-BSqOctep.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-BSqOctep.js.map +1 -0
- package/dashboard/dist/assets/{BotPicker-BaFiLa-H.js → BotPicker-DMojDLlV.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-BaFiLa-H.js.map → BotPicker-DMojDLlV.js.map} +1 -1
- package/dashboard/dist/assets/BulkAssignModal-DYbM_6Or.js +2 -0
- package/dashboard/dist/assets/BulkAssignModal-DYbM_6Or.js.map +1 -0
- package/dashboard/dist/assets/CapabilitiesPage-CDQ5JHNP.js +2 -0
- package/dashboard/dist/assets/{CapabilitiesPage-Cewd6Uku.js.map → CapabilitiesPage-CDQ5JHNP.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-D1WIbyDa.js → CollapsibleSection-D4VlCEbD.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-D1WIbyDa.js.map → CollapsibleSection-D4VlCEbD.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-CQsJUzEa.js → ConfirmDeleteModal-DnNHjJtD.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-CQsJUzEa.js.map → ConfirmDeleteModal-DnNHjJtD.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-DPHMBmgz.js.map +1 -0
- package/dashboard/dist/assets/CredentialsPage-CSYZw-rL.js +2 -0
- package/dashboard/dist/assets/{CredentialsPage-CwtkQUG3.js.map → CredentialsPage-CSYZw-rL.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CRC_uNuC.js → CronLabel-CpmqDrlJ.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CRC_uNuC.js.map → CronLabel-CpmqDrlJ.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-Pv-v5RAs.js → DropZone-BbXlQnYB.js} +2 -2
- package/dashboard/dist/assets/{DropZone-Pv-v5RAs.js.map → DropZone-BbXlQnYB.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CxAi0zN0.js → ElapsedCell-Cul22qBS.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CxAi0zN0.js.map → ElapsedCell-Cul22qBS.js.map} +1 -1
- package/dashboard/dist/assets/EntityTimelinePanel-CtzpJ-j2.js +2 -0
- package/dashboard/dist/assets/EntityTimelinePanel-CtzpJ-j2.js.map +1 -0
- package/dashboard/dist/assets/{EscalationListSchemaPage--yZfsE8s.js → EscalationListSchemaPage-BZQ8Y_UH.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage--yZfsE8s.js.map → EscalationListSchemaPage-BZQ8Y_UH.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-CmoVqaS7.js → EscalationSchemaPage-CydTtq_A.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-CmoVqaS7.js.map → EscalationSchemaPage-CydTtq_A.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DDQTW6Jo.js → EscalationsOverview-DSYC0nI7.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DDQTW6Jo.js.map → EscalationsOverview-DSYC0nI7.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-C5jN7XT7.js → EventTable-s48cTXIw.js} +2 -2
- package/dashboard/dist/assets/{EventTable-C5jN7XT7.js.map → EventTable-s48cTXIw.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CcIgQH9h.js → FilterBar-B61qKmFD.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CcIgQH9h.js.map → FilterBar-B61qKmFD.js.map} +1 -1
- package/dashboard/dist/assets/GraphInvokePage-DxZv_KC2.js +2 -0
- package/dashboard/dist/assets/{GraphInvokePage-LACIxaiH.js.map → GraphInvokePage-DxZv_KC2.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-zK3VP_9g.js +2 -0
- package/dashboard/dist/assets/HomePage-zK3VP_9g.js.map +1 -0
- package/dashboard/dist/assets/{ListToolbar-CLwSkmUH.js → ListToolbar-DaxloPQc.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-CLwSkmUH.js.map → ListToolbar-DaxloPQc.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-C2U1XfQw.js → McpOverview-Ciq8r6-p.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-C2U1XfQw.js.map → McpOverview-Ciq8r6-p.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DYOK8A4D.js → McpQueryDetailPage-DIC0FEEb.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-DYOK8A4D.js.map → McpQueryDetailPage-DIC0FEEb.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-BBy0NSNg.js +2 -0
- package/dashboard/dist/assets/{McpQueryPage-Ck75ikSd.js.map → McpQueryPage-BBy0NSNg.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CA9gWQ4L.js → McpRunDetailPage-BqKNmIyW.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CA9gWQ4L.js.map → McpRunDetailPage-BqKNmIyW.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BhPshset.js → McpRunsPage-D0RlOpzR.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BhPshset.js.map → McpRunsPage-D0RlOpzR.js.map} +1 -1
- package/dashboard/dist/assets/NamespacePill-Dbtm9R2T.js +2 -0
- package/dashboard/dist/assets/{NamespacePill-DONj6eUU.js.map → NamespacePill-Dbtm9R2T.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-BX0SFizr.js +3 -0
- package/dashboard/dist/assets/OperationsPage-BX0SFizr.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-vXG0TjAQ.js +2 -0
- package/dashboard/dist/assets/{OperatorDashboard-DZOfHRE7.js.map → OperatorDashboard-vXG0TjAQ.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-CFVw67M6.js → PageHeader-xB92ELs3.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-CFVw67M6.js.map → PageHeader-xB92ELs3.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-D9tQxILm.js → PageHeaderWithStats-DVo_qqn1.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-D9tQxILm.js.map → PageHeaderWithStats-DVo_qqn1.js.map} +1 -1
- package/dashboard/dist/assets/PersonaDetailPage-w5TXcn4Q.js +2 -0
- package/dashboard/dist/assets/{PersonaDetailPage-eyHDupL0.js.map → PersonaDetailPage-w5TXcn4Q.js.map} +1 -1
- package/dashboard/dist/assets/PersonasPage-Dzcinl1L.js +2 -0
- package/dashboard/dist/assets/PersonasPage-Dzcinl1L.js.map +1 -0
- package/dashboard/dist/assets/{ProcessDetailPage-CKiAlpOc.js → ProcessDetailPage-BVXieFX1.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-CKiAlpOc.js.map → ProcessDetailPage-BVXieFX1.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-C4ueZJxU.js → ProcessesListPage-CKKNpk4z.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-C4ueZJxU.js.map → ProcessesListPage-CKKNpk4z.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-BytSo-YE.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-BytSo-YE.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-Di_5hfvw.js → RolePill-CYpL3a2d.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Di_5hfvw.js.map → RolePill-CYpL3a2d.js.map} +1 -1
- package/dashboard/dist/assets/RolesPage-eayR9H4f.js +2 -0
- package/dashboard/dist/assets/{RolesPage-B3-9Ek0F.js.map → RolesPage-eayR9H4f.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-1k1J1_cv.js → RunAsSelector-D7RPwaAl.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-1k1J1_cv.js.map → RunAsSelector-D7RPwaAl.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-CeuVKnpu.js → ScanCodesPage-C8-ZBXF5.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-CeuVKnpu.js.map → ScanCodesPage-C8-ZBXF5.js.map} +1 -1
- package/dashboard/dist/assets/ScanSchemeDetailPage-tQhEgFKf.js +2 -0
- package/dashboard/dist/assets/{ScanSchemeDetailPage-BnivPUJY.js.map → ScanSchemeDetailPage-tQhEgFKf.js.map} +1 -1
- package/dashboard/dist/assets/ScanStationPage-CuhqsBKo.js +2 -0
- package/dashboard/dist/assets/{ScanStationPage-DCSA7pcV.js.map → ScanStationPage-CuhqsBKo.js.map} +1 -1
- package/dashboard/dist/assets/{ScopeBadge-CqIIeWjK.js → ScopeBadge-BmNzZlSj.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-CqIIeWjK.js.map → ScopeBadge-BmNzZlSj.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-BWuKz8uB.js → StickyPagination-BIVTAMnP.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-BWuKz8uB.js.map → StickyPagination-BIVTAMnP.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Cq6AGhgJ.js → StreamMessageDetail-CYSC2cO1.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Cq6AGhgJ.js.map → StreamMessageDetail-CYSC2cO1.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-DM88avgt.js → SwimlaneTimeline-BMZAs_2K.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-DM88avgt.js.map → SwimlaneTimeline-BMZAs_2K.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-BLwxTNsI.js → TagInput-D1uszNd2.js} +2 -2
- package/dashboard/dist/assets/{TagInput-BLwxTNsI.js.map → TagInput-D1uszNd2.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-Caqe3fG8.js → TaskDetailPage-CVUDUU5Q.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-Caqe3fG8.js.map → TaskDetailPage-CVUDUU5Q.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-DVgcqd-h.js → TaskQueuePill-C2H8oRfn.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-DVgcqd-h.js.map → TaskQueuePill-C2H8oRfn.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DlQwpXOL.js → TasksListPage-DEQymbXC.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DlQwpXOL.js.map → TasksListPage-DEQymbXC.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-BinTjiVC.js → TimeAgo-CCxP67Rb.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-BinTjiVC.js.map → TimeAgo-CCxP67Rb.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DDcfSVeQ.js → TimestampCell-CE5ZUYhV.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DDcfSVeQ.js.map → TimestampCell-CE5ZUYhV.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-C6hkOqPx.js → ToolPill-D-h8AoB8.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-C6hkOqPx.js.map → ToolPill-D-h8AoB8.js.map} +1 -1
- package/dashboard/dist/assets/ToolTestPanel-BHuQTyBY.js +2 -0
- package/dashboard/dist/assets/{ToolTestPanel-CZvegH_w.js.map → ToolTestPanel-BHuQTyBY.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-CShiCwz8.js → TopicDetailPage-SFuiludx.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-CShiCwz8.js.map → TopicDetailPage-SFuiludx.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-CAYxRRbI.js → TopicsPage-DO8pUmng.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-CAYxRRbI.js.map → TopicsPage-DO8pUmng.js.map} +1 -1
- package/dashboard/dist/assets/UserName-CsLnT75E.js +2 -0
- package/dashboard/dist/assets/UserName-CsLnT75E.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowExecutionPage-DNdXEFcB.js → WorkflowExecutionPage-BttnEvOd.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DNdXEFcB.js.map → WorkflowExecutionPage-BttnEvOd.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-CN-952iI.js → WorkflowPill-CZvBbkn4.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-CN-952iI.js.map → WorkflowPill-CZvBbkn4.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-D7DPDeuQ.js → WorkflowsDashboard-BRboBhlK.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-D7DPDeuQ.js.map → WorkflowsDashboard-BRboBhlK.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-C7Z0SpDH.js → WorkflowsOverview-CDFTYeQo.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-C7Z0SpDH.js.map → WorkflowsOverview-CDFTYeQo.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Bxklswko.js → YamlWorkflowDetailPage-CmnZFevp.js} +11 -11
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-Bxklswko.js.map → YamlWorkflowDetailPage-CmnZFevp.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkArsPbi.js → YamlWorkflowsPage-Qq1jfcrH.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-CkArsPbi.js.map → YamlWorkflowsPage-Qq1jfcrH.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Ca0hOp2Y.js → agents-C7vUIO7e.js} +2 -2
- package/dashboard/dist/assets/{agents-Ca0hOp2Y.js.map → agents-C7vUIO7e.js.map} +1 -1
- package/dashboard/dist/assets/{bots-9GtbGtH9.js → bots-BaOblnW4.js} +2 -2
- package/dashboard/dist/assets/{bots-9GtbGtH9.js.map → bots-BaOblnW4.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-C0RpEvyY.js → capabilities-RZpmDWoy.js} +2 -2
- package/dashboard/dist/assets/{capabilities-C0RpEvyY.js.map → capabilities-RZpmDWoy.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-ClQiKGyQ.js → controlplane-BwGdcwXR.js} +2 -2
- package/dashboard/dist/assets/{controlplane-ClQiKGyQ.js.map → controlplane-BwGdcwXR.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-B4DG_5v8.js +2 -0
- package/dashboard/dist/assets/escalation-columns-B4DG_5v8.js.map +1 -0
- package/dashboard/dist/assets/index-8LIpvj2e.js +3 -0
- package/dashboard/dist/assets/index-8LIpvj2e.js.map +1 -0
- package/dashboard/dist/assets/index-BICLHYJJ.js +2 -0
- package/dashboard/dist/assets/{index-BLLK2mzy.js.map → index-BICLHYJJ.js.map} +1 -1
- package/dashboard/dist/assets/{index-BLCFN3YR.js → index-BQPUlmmz.js} +2 -2
- package/dashboard/dist/assets/{index-BLCFN3YR.js.map → index-BQPUlmmz.js.map} +1 -1
- package/dashboard/dist/assets/index-BaC3sbJH.js +67 -0
- package/dashboard/dist/assets/index-BaC3sbJH.js.map +1 -0
- package/dashboard/dist/assets/index-BuqpU6ow.js +2 -0
- package/dashboard/dist/assets/{index-DEr9QjVv.js.map → index-BuqpU6ow.js.map} +1 -1
- package/dashboard/dist/assets/index-CD6jtND1.css +1 -0
- package/dashboard/dist/assets/{index-Ba3UsZzz.js → index-CsIw-ZLk.js} +4 -4
- package/dashboard/dist/assets/{index-Ba3UsZzz.js.map → index-CsIw-ZLk.js.map} +1 -1
- package/dashboard/dist/assets/index-CtJkvX9e.js +5 -0
- package/dashboard/dist/assets/{index-Ct_8Tpec.js.map → index-CtJkvX9e.js.map} +1 -1
- package/dashboard/dist/assets/index-D9NtDRtp.js +2 -0
- package/dashboard/dist/assets/{index-BoQirCxt.js.map → index-D9NtDRtp.js.map} +1 -1
- package/dashboard/dist/assets/{index-CeHOGQM4.js → index-DU9-flEo.js} +2 -2
- package/dashboard/dist/assets/{index-CeHOGQM4.js.map → index-DU9-flEo.js.map} +1 -1
- package/dashboard/dist/assets/{index-P1g8r09L.js → index-G3NmdMjt.js} +2 -2
- package/dashboard/dist/assets/{index-P1g8r09L.js.map → index-G3NmdMjt.js.map} +1 -1
- package/dashboard/dist/assets/index-IWufkcH9.js +2 -0
- package/dashboard/dist/assets/{index-DlzW75L4.js.map → index-IWufkcH9.js.map} +1 -1
- package/dashboard/dist/assets/index-iegzyfMv.js +2 -0
- package/dashboard/dist/assets/{index-B-Qpr29t.js.map → index-iegzyfMv.js.map} +1 -1
- package/dashboard/dist/assets/index-xNFTmmsv.js +2 -0
- package/dashboard/dist/assets/{index-CG8oLNHo.js.map → index-xNFTmmsv.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-DzueDGkw.js → knowledge-CjwCbm3E.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DzueDGkw.js.map → knowledge-CjwCbm3E.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CCOzN8dH.js → mcp-C-DMktCT.js} +2 -2
- package/dashboard/dist/assets/{mcp-CCOzN8dH.js.map → mcp-C-DMktCT.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-UeMDiM6I.js → mcp-query-KBeBNHb4.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-UeMDiM6I.js.map → mcp-query-KBeBNHb4.js.map} +1 -1
- package/dashboard/dist/assets/{personas-CKcrzaQX.js → personas-B32sSCxm.js} +2 -2
- package/dashboard/dist/assets/{personas-CKcrzaQX.js.map → personas-B32sSCxm.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-orE-1gpj.js → pipelines-DNLwDumm.js} +2 -2
- package/dashboard/dist/assets/{pipelines-orE-1gpj.js.map → pipelines-DNLwDumm.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-ZOmzxynB.js → tasks-DrWSrjmj.js} +2 -2
- package/dashboard/dist/assets/{tasks-ZOmzxynB.js.map → tasks-DrWSrjmj.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CdYaOCi_.js → topics-DgzGU-vR.js} +2 -2
- package/dashboard/dist/assets/{topics-CdYaOCi_.js.map → topics-DgzGU-vR.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-D-uGnSj5.js → useDebouncedValue-DG5JOj1F.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-D-uGnSj5.js.map → useDebouncedValue-DG5JOj1F.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-DMrjlrJJ.js → useNamespace-CdgF7Jxo.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-DMrjlrJJ.js.map → useNamespace-CdgF7Jxo.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-ByyQgu8S.js → useYamlActivityEvents-BEaOtgSZ.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-ByyQgu8S.js.map → useYamlActivityEvents-BEaOtgSZ.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-h-jlRSb9.js → vendor-icons-BCWsItQ7.js} +138 -133
- package/dashboard/dist/assets/{vendor-icons-h-jlRSb9.js.map → vendor-icons-BCWsItQ7.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-CLn05FRV.js → workflows-CX_oarls.js} +2 -2
- package/dashboard/dist/assets/{workflows-CLn05FRV.js.map → workflows-CX_oarls.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DFD_HO__.js → yaml-workflows-YASUDPo0.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DFD_HO__.js.map → yaml-workflows-YASUDPo0.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/dashboard.md +164 -69
- package/docs/faceted-routing.md +38 -0
- package/docs/hitl/x-lt-list-schema.md +3 -0
- package/docs/operations.md +61 -60
- package/docs/scan-codes.md +18 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CjcAIm-d.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-CjcAIm-d.js.map +0 -1
- package/dashboard/dist/assets/BulkAssignModal-DNmji4l-.js +0 -2
- package/dashboard/dist/assets/BulkAssignModal-DNmji4l-.js.map +0 -1
- package/dashboard/dist/assets/CapabilitiesPage-Cewd6Uku.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BKMmFie6.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BKMmFie6.js.map +0 -1
- package/dashboard/dist/assets/CredentialsPage-CwtkQUG3.js +0 -2
- package/dashboard/dist/assets/EntityTimelinePanel-DzMuV7ZX.js +0 -2
- package/dashboard/dist/assets/EntityTimelinePanel-DzMuV7ZX.js.map +0 -1
- package/dashboard/dist/assets/GraphInvokePage-LACIxaiH.js +0 -2
- package/dashboard/dist/assets/HomePage-DP9Q-x4a.js +0 -2
- package/dashboard/dist/assets/HomePage-DP9Q-x4a.js.map +0 -1
- package/dashboard/dist/assets/McpQueryPage-Ck75ikSd.js +0 -2
- package/dashboard/dist/assets/Modal-BU7No9NH.js +0 -2
- package/dashboard/dist/assets/Modal-BU7No9NH.js.map +0 -1
- package/dashboard/dist/assets/NamespacePill-DONj6eUU.js +0 -2
- package/dashboard/dist/assets/OperationsPage-MlMzl0Bf.js +0 -3
- package/dashboard/dist/assets/OperationsPage-MlMzl0Bf.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-DZOfHRE7.js +0 -2
- package/dashboard/dist/assets/PersonaDetailPage-eyHDupL0.js +0 -2
- package/dashboard/dist/assets/PersonasPage-CCtRkWiP.js +0 -2
- package/dashboard/dist/assets/PersonasPage-CCtRkWiP.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-BOccQCkx.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-BOccQCkx.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-B3-9Ek0F.js +0 -2
- package/dashboard/dist/assets/ScanSchemeDetailPage-BnivPUJY.js +0 -2
- package/dashboard/dist/assets/ScanStationPage-DCSA7pcV.js +0 -2
- package/dashboard/dist/assets/ToolTestPanel-CZvegH_w.js +0 -2
- package/dashboard/dist/assets/UserName-BovQxdSY.js +0 -2
- package/dashboard/dist/assets/UserName-BovQxdSY.js.map +0 -1
- package/dashboard/dist/assets/escalation-columns-CZ12_oQF.js +0 -2
- package/dashboard/dist/assets/escalation-columns-CZ12_oQF.js.map +0 -1
- package/dashboard/dist/assets/index-B-Qpr29t.js +0 -2
- package/dashboard/dist/assets/index-BLLK2mzy.js +0 -2
- package/dashboard/dist/assets/index-BoQirCxt.js +0 -2
- package/dashboard/dist/assets/index-C1oOLjdF.js +0 -3
- package/dashboard/dist/assets/index-C1oOLjdF.js.map +0 -1
- package/dashboard/dist/assets/index-CG8oLNHo.js +0 -2
- package/dashboard/dist/assets/index-CdavRyaX.js +0 -67
- package/dashboard/dist/assets/index-CdavRyaX.js.map +0 -1
- package/dashboard/dist/assets/index-Ct_8Tpec.js +0 -5
- package/dashboard/dist/assets/index-DEr9QjVv.js +0 -2
- package/dashboard/dist/assets/index-DlzW75L4.js +0 -2
- package/dashboard/dist/assets/index-fUqvRHOe.css +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as ss,a as p,j as t}from"./vendor-query-RUZdMvN6.js";import{a9 as Gs,M as me,aa as yt,l as Nt,a4 as ee,ab as zt,J as It,g as Qs,h as Ys,P as rt,e as se,x as qe,ac as ne,ad as ns,a7 as pe,_ as fe,a3 as rs,q as as,ae as Zs,af as Ks,ag as tn,ah as en,p as sn,ai as nn,aj as rn,T as an,U as on,b as ln,L as cn,w as dn,ak as un}from"./index-BaC3sbJH.js";import{u as is,C as os,r as xn,B as mn,a as pn}from"./BulkAssignModal-DYbM_6Or.js";import{a as ls,u as ge,L as vt,b as fn,e as gn}from"./vendor-react-CdqEC2zv.js";import{P as hn}from"./PageHeader-xB92ELs3.js";import{L as bn}from"./ListToolbar-DaxloPQc.js";import{i as Ht,b as yn,d as jn,C as Xt,g as he,H as Nn,m as vn,c as at,r as be,s as wn,e as cs}from"./CountdownTimer-DPHMBmgz.js";import{u as kn}from"./workflows-CX_oarls.js";import{S as ds}from"./StatusBadge-BDeUwPtb.js";import{R as _n}from"./RolePill-CYpL3a2d.js";import{C as xt}from"./CopyableId-4Lqlc5cU.js";import{U as St}from"./UserName-CsLnT75E.js";import{d as Cn}from"./metadata-display--TzK0REC.js";import{a4 as us,O as En,S as An,av as Tn,a0 as Rn,m as On,ah as xs,U as In,ak as Sn,b as Mn,aw as ms,al as Dn,aa as $n,ax as Ln,ay as Pn,az as ce,aA as Wn,aB as Ue,aC as Fn,a as qn,Q as Je,V as Ve,aD as Un,X as Jn}from"./vendor-icons-BCWsItQ7.js";import"./constants-BHkpVaqx.js";import"./useDebouncedValue-DG5JOj1F.js";import"./DataTable-DFPMeqyQ.js";import"./EmptyState-lpUFYfun.js";import"./StickyPagination-BIVTAMnP.js";const Vn={SCHEMA_VALIDATION:"schema_validation"};function Hn(e){return typeof e=="object"&&e!==null&&e.code===Vn.SCHEMA_VALIDATION&&Array.isArray(e.violations)}function Bn({escalationId:e}){var b;const s=ls(),r=ge(),n=ss(),i=(b=s.state)==null?void 0:b[Gs],[o,c]=p.useState(!1),[d,u]=p.useState(null),[x,l]=p.useState(!1);if(!i||i.escalationId!==e||x)return null;const m=()=>{l(!0),r(s.pathname,{replace:!0,state:null})},a=async()=>{var w,y,h;c(!0),u(null);try{switch(i.verb){case yt.CANCEL:await Nt(`/escalations/${e}/cancel`,{method:"POST"});break;case yt.CLAIM:case yt.CLAIM_SHOW_DETAIL:await Nt(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:((w=i.params)==null?void 0:w.durationMinutes)??30})});break;case yt.RELEASE:await Nt(`/escalations/${e}/release`,{method:"POST"});break;case yt.RESOLVE:await Nt(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:((y=i.params)==null?void 0:y.resolverPayload)??{}})});break;case yt.ESCALATE:await Nt(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:(h=i.params)==null?void 0:h.targetRole})});break;default:throw new Error(`Unsupported confirm verb "${i.verb}"`)}n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),m()}catch(j){u(j.message)}finally{c(!1)}};return t.jsx(me,{open:!0,onClose:m,title:"Confirm scan action",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-sm text-text-secondary",children:i.prompt}),d&&t.jsx("p",{className:"text-xs text-status-error",children:d}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:m,disabled:o,className:"btn-secondary text-xs",children:"No, go back"}),t.jsx("button",{onClick:a,disabled:o,className:"btn-primary text-xs",children:o?"Working…":"Yes, continue"})]})]})})}const Vt={pending:"rgb(var(--lt-status-queued-graphic))",claimed:"rgb(var(--lt-status-claimed-graphic))",resolved:"rgb(var(--lt-status-success-graphic))",cancelled:"rgb(var(--lt-status-error))"},re=4;function He({pct:e,place:s,label:r,title:n,emphasis:i}){const o=t.jsx("span",{className:"w-px h-1 bg-text-quaternary/70","aria-hidden":!0}),c=t.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums text-[10px] ${i?"text-text-tertiary":"text-text-quaternary"}`,children:r});return t.jsx("div",{title:n,className:`absolute ${s==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${e}%`},children:s==="above"?t.jsxs(t.Fragment,{children:[c,o]}):t.jsxs(t.Fragment,{children:[o,c]})})}function zn({esc:e,className:s=""}){const r=new Date(e.created_at).getTime(),n=e.claimed_at?new Date(e.claimed_at).getTime():null,i=e.status==="resolved",o=e.status==="cancelled"||e.status==="expired",c=i||o,d=Ht(e),u=!!n&&(d||c),x=i&&e.resolved_at?new Date(e.resolved_at).getTime():o?new Date(e.updated_at).getTime():Date.now(),l=Math.max(x-r,1),m=u&&n?Math.max(n-r,0):l,a=u&&n?Math.max(x-n,0):0,b=Math.min(100,Math.max(0,m/l*100)),w=u?Math.max(0,100-b):0,y=i?Vt.resolved:o?Vt.cancelled:Vt.claimed,h=i?"Resolved after":o?"Cancelled after":"In progress",j=ee(m),k=ee(l),g=i?`Resolved in ${k} total`:o?`Cancelled after ${k}`:`Open ${k} so far`,A=`Lifecycle bar: blue = time waiting to be claimed, ${i?"green":o?"red":"orange"} = ${h.toLowerCase()} the claim.`;return t.jsxs("div",{className:s,title:A,children:[t.jsx("div",{className:"relative h-2.5 font-mono",children:u&&t.jsx(He,{pct:b,place:"above",label:j,title:`Time to claim: ${j}`})}),t.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:re,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:A,children:[t.jsx("div",{style:{width:`${b}%`,minWidth:re,backgroundColor:Vt.pending,opacity:.75},title:`Waiting ${j} — created → claimed`}),u&&w>0&&t.jsx("div",{style:{width:`${w}%`,minWidth:re,backgroundColor:y,opacity:.75},title:`${h} ${ee(a)}`})]}),t.jsx("div",{className:"relative h-2.5 font-mono",children:t.jsx(He,{pct:100,place:"below",emphasis:!0,label:k,title:g})})]})}function Xn({triage:e,payload:s}){const r=e.confidence??0,n=r>=.8?"text-status-success":r>=.5?"text-status-pending":"text-status-error",i=Gn(e.originalData,s);return t.jsxs("div",{className:"space-y-5",children:[e.diagnosis&&t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e.diagnosis}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[e.tool_calls_made!=null&&t.jsxs("span",{children:[e.tool_calls_made," tool call",e.tool_calls_made!==1?"s":""]}),e.tool_calls_made!=null&&t.jsx("span",{className:"text-text-quaternary",children:"·"}),t.jsxs("span",{className:`font-medium ${n}`,children:[Math.round(r*100),"% confidence"]})]}),e.actions_taken&&e.actions_taken.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.actions_taken.map((o,c)=>t.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-2xs
|
|
2
|
+
text-text-secondary`,children:[t.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),o]},c))}),e.recommendation&&t.jsx("p",{className:"text-2xs text-text-tertiary italic",children:e.recommendation}),i.length>0&&t.jsx("div",{className:"space-y-4 pt-2",children:i.map(o=>t.jsx(Qn,{diff:o},o.key))})]})}function Gn(e,s){if(!e)return[];const r=[];for(const n of Object.keys(e)){if(n.startsWith("_"))continue;const i=e[n],o=s[n];o!==void 0&&JSON.stringify(i)!==JSON.stringify(o)&&r.push({key:n,label:n.replace(/[_-]/g," "),original:i,corrected:o})}return r}function Qn({diff:e}){const s=Be(e.original),r=Be(e.corrected);return s!==null&&r!==null?t.jsx("div",{className:"@container",children:t.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-8 gap-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:s})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:r})]})]})}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.original=="object"?JSON.stringify(e.original,null,2):String(e.original)})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.corrected=="object"?JSON.stringify(e.corrected,null,2):String(e.corrected)})]})]})}function Be(e){return e==null?"null":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):null}function Y(e,s){const r=s==null?void 0:s.title;if(typeof r=="string"&&r.trim().length>0)return r.trim();const n=e.split(/[_-]+/).filter(Boolean);return n.length<=1?e:n.map(i=>Yn(i)?i:i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function Yn(e){return e.length>1&&e===e.toUpperCase()&&/[A-Z]/.test(e)}const B={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},ps="lt:escalation:panel:view";function Zn(e){try{const s=localStorage.getItem(ps);if(s&&e.includes(s))return s}catch{}return B.HELP}function Kn({metadata:e,role:s}){const r=Cn(e);return r.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):t.jsx("dl",{className:"space-y-3.5",children:r.map(([n,i])=>{const o=typeof i=="object"&&i!==null?JSON.stringify(i):String(i),c=qe(n,i,s),d=qe(n,i);return t.jsxs("div",{className:"group relative",children:[t.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:Y(n)}),t.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-text-primary font-mono break-all flex-1",children:o}),t.jsx(vt,{to:c,title:`Filter this queue: ${n} = ${o}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(Sn,{className:"w-3 h-3"})}),t.jsx(vt,{to:d,title:`Search all queues: ${n} = ${o}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(Mn,{className:"w-3 h-3"})})]})]},n)})})}function tr({esc:e,claimed:s,isTerminal:r,isBuilder:n,traceUrl:i}){return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("dl",{className:"space-y-3.5",children:[t.jsx(rt,{label:"Status",children:t.jsx(ds,{status:e.status})}),t.jsx(rt,{label:"Assigned to Role",children:t.jsx(_n,{role:e.role,size:"md"})}),t.jsxs(rt,{label:"Priority",children:["P",e.priority]}),(s||r)&&e.assigned_to&&t.jsx(rt,{label:"Claimed By",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[t.jsx(In,{className:"w-3 h-3 shrink-0 text-accent/75"}),t.jsx(St,{userId:e.assigned_to})]})}),t.jsx(rt,{label:"Created",children:t.jsx(se,{date:e.created_at})}),(s||r)&&e.claimed_at&&t.jsx(rt,{label:"Claimed",children:t.jsx(se,{date:e.claimed_at})}),s&&!r&&e.assigned_until&&t.jsx(rt,{label:"Time Remaining",children:t.jsx(Xt,{until:e.assigned_until})}),e.resolved_at&&t.jsx(rt,{label:"Completed",children:t.jsx("span",{className:"text-status-success",children:t.jsx(se,{date:e.resolved_at})})})]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("hr",{className:"border-surface-border/60"}),t.jsxs("div",{className:"space-y-3.5",children:[t.jsx(xt,{label:"Escalation ID",value:e.id}),e.task_id&&t.jsx(xt,{label:"Task ID",value:e.task_id,href:`/workflows/tasks/detail/${e.task_id}`}),e.workflow_type&&t.jsx(xt,{label:"Workflow Name",value:e.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(e.workflow_type)}`}),e.workflow_id&&t.jsx(xt,{label:"Workflow ID",value:e.workflow_id,href:`/workflows/executions/${e.workflow_id}`}),e.task_queue&&t.jsx(xt,{label:"Task Queue",value:e.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(e.task_queue)}`}),e.origin_id&&e.origin_id!==e.workflow_id&&t.jsx(xt,{label:"Origin",value:e.origin_id,href:`/processes/detail/${e.origin_id}`}),e.trace_id&&t.jsx(xt,{label:"Trace",value:e.trace_id,href:i?i.replace("{traceId}",e.trace_id):void 0,external:!0})]})]})]})}function er({errors:e,schema:s}){const r=n=>{const i=document.querySelector(`[data-field-key="${n}"]`);i&&(i.scrollIntoView({behavior:"smooth",block:"center"}),i.focus({preventScroll:!0}))};return e.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No errors to display."}):t.jsxs("div",{className:"space-y-1",role:"alert","aria-live":"polite",children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-wider text-status-error mb-4",children:[e.length," ",e.length===1?"issue":"issues"," to resolve"]}),t.jsx("div",{className:"space-y-1.5",children:e.map(({field:n,message:i})=>{var o;return t.jsxs("button",{onClick:()=>r(n),className:"w-full text-left flex items-start gap-3 px-3 py-2.5 rounded hover:bg-status-error/5 transition-colors group",children:[t.jsx(xs,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-2xs font-semibold text-text-primary leading-snug",children:Y(n,(o=s==null?void 0:s.properties)==null?void 0:o[n])}),t.jsx("p",{className:"text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:i})]})]},n)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-4 px-3",children:"Click an issue to scroll to and focus the field."})]})}function sr({esc:e,schema:s,envelope:r,payload:n,resolver:i,triage:o,hasAI:c,claimed:d,claimedByMe:u,isTerminal:x,isBuilder:l,traceUrl:m,open:a,noGutter:b,formErrors:w,activePanel:y,onPanelChange:h}){const j=ge(),k=Object.values(B),[g,A]=p.useState(()=>Zn(k)),D=y??g,M=p.useCallback(_=>{try{localStorage.setItem(ps,_)}catch{}A(_),h==null||h(_)},[h]);p.useEffect(()=>{y&&y!==g&&A(y)},[y]);const $=p.useMemo(()=>yn(s,{escalation:e,metadata:e.metadata??null,envelope:r,payload:n,resolver:i})??jn({isTerminal:x,status:e.status,claimed:d,claimedByMe:u}),[s,e,r,n,i,x,d,u]),P=p.useCallback(_=>{const R=_.target.closest("a"),O=R==null?void 0:R.getAttribute("href");O!=null&&O.startsWith("/")&&(_.preventDefault(),j(O))},[j]),T=[{id:B.HELP,icon:us,label:"Instructions",content:t.jsx(zt,{content:$,onClick:P})},{id:B.DETAILS,icon:En,label:"Details",content:t.jsx(tr,{esc:e,claimed:d,isTerminal:x,isBuilder:l,traceUrl:m})},...c&&o?[{id:B.TRIAGE,icon:An,label:"AI Analysis",content:t.jsx(Xn,{triage:o,payload:n??{}})}]:[],{id:B.METADATA,icon:Tn,label:"Metadata",content:t.jsx(Kn,{metadata:e.metadata,role:e.role})},{id:B.CONTEXT,icon:Rn,label:"Context",content:t.jsxs("div",{className:"space-y-5",children:[r!=null&&t.jsx(It,{data:r,label:"Input Envelope"}),n!=null&&t.jsx(It,{data:n,label:"Escalation Context"}),i!=null&&t.jsx(It,{data:i,label:"Resolver Payload"}),r==null&&n==null&&i==null&&t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...l?[{id:B.RECORD,icon:On,label:"Record",content:t.jsx(It,{data:e,label:"Escalation Record"})}]:[],...w&&w.length>0?[{id:B.ERRORS,icon:(({className:_})=>t.jsx(xs,{className:`${_??""} text-status-error`})),label:"Errors",content:t.jsx(er,{errors:w,schema:s})}]:[]];return t.jsx(Qs,{open:a,width:384,className:"h-full",children:t.jsx("div",{className:`h-full${b?"":" pl-6"}`,children:t.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[t.jsx("div",{className:"shrink-0 pt-2 pb-0 flex justify-center",children:t.jsx(zn,{esc:e,className:"w-[80%]"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(Ys,{views:T,activeId:D,onViewChange:M,stickyClassName:"h-full min-h-0"})})]})})})}const nr=/\{\{\s*([^{}]+?)\s*\}\}/g;function de(e){return typeof e=="string"&&/\{\{[^{}]+\}\}/.test(e)}function ye(e,s){if(!s)return;const r=e.indexOf("."),n=s[r===-1?e:e.slice(0,r)];if(r===-1)return n;if(!(n===null||typeof n!="object"))return he(n,e.slice(r+1))}function fs(e,s){let r=!1;const n=e.replace(nr,(i,o)=>{const c=ye(o,s);return typeof c=="string"&&c.trim().length>0?c:typeof c=="number"&&Number.isFinite(c)?String(c):(r=!0,"")});return r?null:n}const rr="x-lt-options";function ze(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function ar(e){if(ze(e))return{value:e,label:String(e)};if(e&&typeof e=="object"&&!Array.isArray(e)){const s=e,r=s.value!==void 0?s.value:s.id;if(ze(r)&&typeof s.label=="string"&&s.label.length>0)return{value:r,label:s.label}}return null}function gs(e,s){if(!e)return;const r=e.enum;if(Array.isArray(r)&&r.length>0)return r.map(c=>({value:c,label:String(c)}));const n=e[rr],i=(typeof n=="string"?[n]:Array.isArray(n)?n:[]).filter(c=>typeof c=="string"&&c.length>0);if(i.length===0)return;const o=i.some(de)?[]:void 0;for(const c of i){let d=c;if(de(c)){const l=fs(c,s);if(l===null)continue;d=l}const u=ye(d,s);if(!Array.isArray(u))continue;const x=u.map(ar).filter(l=>l!==null);if(x.length>0)return x}return o}function je(e,s){const r=(typeof e=="string"?[e]:Array.isArray(e)?e:[]).filter(n=>typeof n=="string"&&n.length>0);if(r.length===0||!s)return[];for(const n of r){let i=n;if(de(n)){const c=fs(n,s);if(c===null)continue;i=c}const o=ye(i,s);if(Array.isArray(o)&&o.length>0)return o}return[]}const ir="x-lt-default-checked";function or(e,s,r){if((e==null?void 0:e["x-lt-widget"])!=="checklist"||e[ir]!==!0||s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return null;const n=je(e["x-lt-source"],r);return n.length===0?null:Object.fromEntries(n.map(i=>[i.id,!0]))}function lr(e,s,r){if((s==null?void 0:s["x-lt-widget"])!=="checklist"||s["x-lt-require-all"]!==!0)return;const i=je(s["x-lt-source"],r).filter(d=>d.required!==!1);if(i.length===0)return;const o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},c=i.filter(d=>!o[d.id]).length;if(c!==0)return`${c} of ${i.length} checks incomplete`}function cr(e,s){const r=s==null?void 0:s.type;if(typeof r=="string"&&!(e==null||e===""))switch(r){case"string":return typeof e=="string"?void 0:"Expected text";case"number":return typeof e=="number"&&Number.isFinite(e)?void 0:"Expected a number";case"integer":return typeof e=="number"&&Number.isInteger(e)?void 0:"Expected a whole number";case"boolean":return typeof e=="boolean"?void 0:"Expected true or false";case"array":return Array.isArray(e)?void 0:"Expected a list";case"object":return typeof e=="object"&&!Array.isArray(e)?void 0:"Expected an object";default:return}}function dr(e,s,r){if(!s)return;const n=gs(s,r);if(n!==void 0&&e!==void 0&&e!==null&&e!==""){if(n.length===0)return"No valid options for this selection";if(!n.some(i=>i.value===e))return`Must be one of: ${n.map(i=>String(i.value)).join(", ")}`}if(typeof e=="string"){const i=e.trim();if(i==="")return;const o=jt(s.minLength,s["x-lt-min-length"],r);if(o!==void 0&&i.length<o)return`Minimum ${o} character${o===1?"":"s"}`;const c=jt(s.maxLength,s["x-lt-max-length"],r);if(c!==void 0&&i.length>c)return`Maximum ${c} characters (${i.length} entered)`;const d=s.pattern;if(d)try{if(!new RegExp(d).test(i))return s["x-lt-pattern-error"]??"Invalid format"}catch{}const u=s.format;if(u==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i))return"Enter a valid email address";if(u==="uri"&&!/^https?:\/\/.+/.test(i))return"Enter a valid URL"}if(typeof e=="number"){const i=jt(s.minimum,s["x-lt-minimum"],r),o=jt(s.exclusiveMinimum,void 0,r),c=jt(s.maximum,s["x-lt-maximum"],r),d=jt(s.exclusiveMaximum,void 0,r);if(i!==void 0&&e<i)return`Minimum value is ${i}`;if(o!==void 0&&e<=o)return`Must be greater than ${o}`;if(c!==void 0&&e>c)return`Maximum value is ${c}`;if(d!==void 0&&e>=d)return`Must be less than ${d}`}}function jt(e,s,r){if(typeof e=="number")return e;if(typeof s=="string"&&r){const n=s.indexOf(".");if(n!==-1){const i=s.slice(0,n),o=s.slice(n+1),c=r[i];if(c&&typeof c=="object"){const d=o.split(".");let u=c;for(const x of d)if(u=u[x],u===void 0)break;if(typeof u=="number")return u;if(typeof u=="string"){const x=Number(u);if(!Number.isNaN(x))return x}}}}}function hs(e,s,r,n,i){if(!n)return;if(r){if(e==null||typeof e=="boolean"&&!e||typeof e=="string"&&e.trim()==="")return"Required";if(typeof e=="object"&&!Array.isArray(e)&&e!==null){const d=Object.values(e);if(d.length===0||d.every(u=>!u))return"Required"}}const o=cr(e,s);if(o)return o;const c=lr(e,s,i);return c||dr(e,s,i)}function Xe(e){return e!=null&&e!==""&&e!==!1&&e!==0}function ur(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function Ge(e,s){const r=e.indexOf("."),n=r===-1?e:e.slice(0,r);if(!Nn.includes(n))return{known:!1,value:void 0};const i=s[n];if(r===-1)return{known:!0,value:i};try{return{known:!0,value:he(i,e.slice(r+1))}}catch{return{known:!0,value:void 0}}}function Bt(e,s){if(typeof e!="string"||e.length===0||!s)return!0;const r=e.startsWith("!"),n=r?e.slice(1):e,i=n.indexOf("!="),o=n.indexOf("=");if(i!==-1||o!==-1&&o!==i+1){const u=i!==-1&&(o===-1||i<o),x=u?i:o,l=n.slice(0,x).trim(),m=n.slice(x+(u?2:1)).trim(),{known:a,value:b}=Ge(l,s);if(!a)return!0;const w=ur(b)===m,y=u?!w:w;return r?!y:y}const{known:c,value:d}=Ge(n,s);return c?r?!Xe(d):Xe(d):!0}const xr="x-lt-require-any";function mr(e){const s=e==null?void 0:e[xr];return Array.isArray(s)?s.filter(r=>Array.isArray(r)).map(r=>r.filter(n=>typeof n=="string"&&n.length>0)).filter(r=>r.length>0):[]}function pr(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}const fr="x-lt-require-sum";function gr(e){const s=e==null?void 0:e[fr];if(!Array.isArray(s))return[];const r=[];for(const n of s){if(!n||typeof n!="object"||Array.isArray(n))continue;const{fields:i,minimum:o}=n;if(!Array.isArray(i))continue;const c=i.filter(d=>typeof d=="string"&&d.length>0);c.length!==0&&(o!==void 0&&typeof o!="number"||r.push({fields:c,minimum:typeof o=="number"?o:1}))}return r}function hr(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){const s=Number(e);if(!Number.isNaN(s))return s}return 0}function bs(e,s,r){if(!e)return[];const n=e.properties??{},i=new Set(e.required??[]),o={...r??{},resolver:s},c=[];for(const[d,u]of Object.entries(n)){if(!Bt(u["x-lt-showIf"],o))continue;const x=hs(s[d],u,i.has(d),!0,o);x&&c.push({field:d,message:x})}for(const d of mr(e)){const u=d.filter(l=>n[l]&&Bt(n[l]["x-lt-showIf"],o));if(u.length===0||u.some(l=>pr(s[l])))continue;const x=u.map(l=>n[l].title??l);c.push({field:u[0],message:`Enter a value for at least one of: ${x.join(", ")}`})}for(const d of gr(e)){const u=d.fields.filter(m=>n[m]&&Bt(n[m]["x-lt-showIf"],o));if(u.length===0||u.reduce((m,a)=>m+hr(s[a]),0)>=d.minimum)continue;const l=u.map(m=>n[m].title??m);c.push({field:u[0],message:`Combined value of ${l.join(", ")} must be at least ${d.minimum}`})}return c}function ue(e,s){let r;try{r=JSON.parse(e)}catch{return{payload:null,errors:[],parseError:"Invalid JSON"}}const n=r._form_schema;if(n){const c=bs(n,r,s);if(c.length>0)return{payload:null,errors:c,parseError:null}}const{_form_schema:i,...o}=r;return{payload:vn(o,n),errors:[],parseError:null}}function br(e){const{mode:s,activeView:r,onActiveViewChange:n,onClaim:i,claimPending:o,claimNudge:c,workflowType:d,json:u,onResolve:x,resolvePending:l,resolveError:m,requestTriage:a,triageNotes:b,onRelease:w,releasePending:y,onCancel:h,assignedTo:j,assignedUntil:k,onSubmitAttempt:g,onValidationErrors:A,escalationContext:D,labels:M={},submitBlocked:$,submitBlockedMessage:P,actingName:T,submitNeedsBadge:_,canManage:R,onReassign:O,onUnassign:I,unassignPending:F}=e,q=is(),[z,V]=p.useState("30"),[G,Z]=p.useState(0),[N,E]=p.useState(""),v=z==="custom",L=p.useCallback(S=>Z(S),[]),U=!!$&&!a;if(s==="terminal")return null;const ft=()=>{const S=v?G:parseInt(z);!S||S<=0||i(S)},gt=()=>{if(E(""),a){const K={_lt:{needsTriage:!0}};b.trim()&&(K.notes=b.trim()),x(K);return}const S=ue(u,D);if(S.parseError){E(S.parseError);return}if(S.errors.length>0){g==null||g(),A==null||A(S.errors);return}x(S.payload)},it=S=>`text-xs transition-colors ${S?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return t.jsxs("div",{className:"shrink-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -ml-10 pl-10 pr-10 pt-3 pb-5","data-testid":"escalation-action-bar",children:[s==="available"&&t.jsxs("div",{"data-testid":"claim-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[q.map(S=>t.jsx("button",{onClick:()=>{V(S.value),Z(0)},className:it(!v&&z===S.value),children:S.label},S.value)),t.jsx("button",{onClick:()=>V("custom"),className:it(v),children:"Other"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[M.cancel!==!1&&t.jsx("button",{onClick:h,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:M.cancel??"Cancel escalation"}),t.jsx("div",{className:"flex-1"}),v&&t.jsx(os,{onChange:L,compact:!0,autoFocus:!0}),t.jsx("button",{onClick:ft,disabled:o||v&&G<=0,className:`btn-primary text-xs ${c?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:o?"Claiming...":M.claim??"Claim"},c)]})]}),s==="claimed_by_other"&&t.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",t.jsx("span",{className:"font-medium text-text-primary",children:j?t.jsx(St,{userId:j}):"unknown"})]}),k&&t.jsx(Xt,{until:k}),m&&t.jsx("span",{className:"text-xs text-status-error",children:m.message}),R&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:O,className:"text-xs text-text-tertiary hover:text-accent transition-colors","data-testid":"admin-reassign",children:"Reassign…"}),t.jsx("button",{onClick:I,disabled:F,className:"text-xs text-text-tertiary hover:text-status-error transition-colors disabled:opacity-50","data-testid":"admin-unassign",children:F?"Returning…":"Return to queue"})]})]}),s==="claimed_by_me"&&t.jsxs("div",{"data-testid":"action-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[t.jsx("button",{onClick:()=>n("resolve"),className:it(r==="resolve"),children:d?"Resolve":"Acknowledge"}),t.jsx("button",{onClick:()=>n("release"),className:`text-xs transition-colors ${r==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:M.release??"Release"}),M.cancel!==!1&&t.jsx("button",{onClick:h,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:M.cancel??"Cancel"})]}),r==="resolve"&&t.jsxs("div",{className:"flex items-center gap-4",children:[_?t.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-text-secondary","data-testid":"submit-badge-warning",children:[t.jsx(ms,{className:"w-4 h-4 text-accent-muted shrink-0",strokeWidth:1.5}),"When you submit, you'll scan your badge to confirm you're"," ",t.jsx("span",{className:"font-medium text-text-primary",children:j?t.jsx(St,{userId:j}):"the claimant"}),"."]}):T&&t.jsxs("p",{className:"text-sm text-text-secondary","data-testid":"acting-claim-note",children:["Claimed by you ",t.jsxs("span",{className:"font-medium text-text-primary",children:["(",T,")"]})]}),!_&&T&&k&&t.jsx(Xt,{until:k}),t.jsx("div",{className:"flex-1"}),N&&t.jsx("span",{className:"text-xs text-status-error",children:N}),m&&t.jsx("span",{className:"text-xs text-status-error",children:m.message}),U&&P&&t.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:P}),t.jsx("button",{onClick:gt,disabled:l||U,className:"btn-primary text-xs",children:l?d?"Submitting...":"Acknowledging...":a?"Send to Triage":M.submit??(d?"Submit":"Acknowledge")})]}),r==="release"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:()=>n("resolve"),className:"btn-secondary text-xs",children:"Back"}),t.jsx("button",{onClick:w,disabled:y,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:y?"Releasing...":"Yes, Release"})]})]})]})}function ae({children:e}){return t.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:e})}function yr({payload:e,isTerminal:s,resolverPayload:r,onRetryTriage:n,isRetrying:i}){const o=e.title,c=e.summary,d=e.diagnosis,u=e.tool_calls_made,x=e.result,l=r==null?void 0:r._lt,m=(l==null?void 0:l.triaged)===!0,a=l==null?void 0:l.triageWorkflowId,b=s&&m,[w,y]=p.useState(!1);return b?t.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),t.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),d&&t.jsxs("div",{children:[t.jsx(ae,{children:"Triage diagnosis"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(ne,{content:d})})]}),t.jsx("div",{className:"flex items-center gap-3",children:a&&t.jsx(vt,{to:`/workflows/executions/${a}`,className:"text-2xs text-accent hover:underline",children:"View triage execution"})})]})]}):t.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),t.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),c&&t.jsxs("div",{children:[t.jsx(ae,{children:"What happened"}),t.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.jsx(ne,{content:c})})]}),d&&t.jsxs("div",{children:[t.jsx(ae,{children:"What went wrong"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(ne,{content:d})})]}),x!=null&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>y(!w),className:"flex items-center gap-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[t.jsx("svg",{className:`w-3 h-3 transition-transform ${w?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:t.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),w&&t.jsx("div",{className:"mt-2",children:t.jsx(It,{data:x,defaultMode:"tree"})})]}),n&&!s&&t.jsx("div",{className:"pt-2",children:t.jsxs("button",{onClick:n,disabled:i,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[t.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:t.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),i?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function Qe(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ys({src:e,escalation:s,schema:r,onResolve:n,onEscalate:i,submitAttempted:o,fill:c}){const d=p.useRef(null),u=p.useRef("");p.useEffect(()=>{try{const l=new URL(e);u.current=l.origin}catch{u.current=""}},[e]);const x=p.useCallback(()=>{const l=d.current;if(!(l!=null&&l.contentWindow)||!u.current)return;const a={type:"lt:init",escalation:{id:s.id,type:s.type,subtype:s.subtype,description:s.description,status:s.status,priority:s.priority,role:s.role,workflow_type:s.workflow_type,envelope:Qe(s.envelope),metadata:s.metadata??null,escalation_payload:Qe(s.escalation_payload)},schema:r};l.contentWindow.postMessage(a,u.current)},[s,r]);return p.useEffect(()=>{const l=m=>{if(m.origin!==u.current)return;const a=m.data;if(!(!a||typeof a!="object"||typeof a.type!="string"))switch(a.type){case"lt:ready":x();break;case"lt:submit":a.payload&&typeof a.payload=="object"&&n(a.payload);break;case"lt:escalate":typeof a.target=="string"&&a.target&&i(a.target);break;case"lt:resize":{const b=d.current;b&&typeof a.height=="number"&&a.height>0&&(b.style.height=`${Math.min(a.height,2e3)}px`);break}}};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[x,n,i]),p.useEffect(()=>{if(!o)return;const l=d.current;l!=null&&l.contentWindow&&u.current&&l.contentWindow.postMessage({type:"lt:validate"},u.current)},[o]),c?t.jsx("div",{className:"absolute inset-0 overflow-hidden",children:t.jsx("iframe",{ref:d,src:e,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full h-full border-0 block",title:"HITL Viewport",onLoad:x})}):t.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:t.jsx("iframe",{ref:d,src:e,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full border-0",style:{minHeight:"600px"},title:"HITL Viewport",onLoad:x})})}const jr=2600;function Nr({hint:e,onLockedClick:s,children:r}){const[n,i]=p.useState(null);p.useEffect(()=>{if(!n)return;const c=setTimeout(()=>i(null),jr);return()=>clearTimeout(c)},[n]);const o=c=>{if(s==null||s(),e){const d=Math.min(Math.max(c.clientX,96),window.innerWidth-96);i(u=>({x:d,y:c.clientY,n:((u==null?void 0:u.n)??0)+1}))}};return t.jsxs("div",{className:"pb-8 max-w-form",onClick:o,"data-testid":"locked-form-frame",children:[r,e&&n&&t.jsxs("div",{role:"status",className:"fixed z-[60] pointer-events-none flex items-center gap-2 px-3 py-1.5 rounded-md bg-surface-raised border border-surface-border shadow-lg text-xs font-medium text-text-primary whitespace-nowrap animate-[click-hint_2.6s_ease-in-out_both]",style:{left:n.x,top:n.y-12},onAnimationEnd:()=>i(null),"data-testid":"locked-form-hint",children:[t.jsx(Dn,{className:"w-3.5 h-3.5 text-accent shrink-0",strokeWidth:1.5}),e]},n.n)]})}function W({children:e,isRequired:s,htmlFor:r}){return t.jsxs("label",{htmlFor:r,className:"block text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e,s&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function X({id:e,children:s}){return t.jsx("p",{id:e,className:"text-2xs text-text-tertiary mt-0.5 leading-snug",children:s})}function mt({error:e,id:s}){return e?t.jsx("p",{id:s,role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:e}):null}function Tt(e){return e?"input text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"input text-sm w-full mt-1"}function vr(e){return e?"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full"}function wr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=p.useRef(null),c=(n==null?void 0:n.accept)??void 0,d=Y(e,n),u=n==null?void 0:n.description,x=p.useCallback(m=>{var w;const a=(w=m.target.files)==null?void 0:w[0];if(!a)return;const b=new FileReader;b.onload=()=>{typeof b.result=="string"&&r(b.result)},b.readAsDataURL(a)},[r]),l=s.startsWith("data:");return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:d}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),t.jsxs("div",{className:"mt-1",children:[t.jsx("input",{ref:o,type:"file",accept:c,onChange:x,className:"hidden"}),t.jsx("button",{type:"button",onClick:()=>{var m;return(m=o.current)==null?void 0:m.click()},className:"btn-secondary text-xs px-3 py-1.5",children:l?"Replace file":"Choose file"}),l&&t.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function kr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Y(e,n),c=n==null?void 0:n.description,d=(n==null?void 0:n["x-lt-language"])??"",u=p.useCallback(x=>{if(x.key==="Tab"){x.preventDefault();const l=x.currentTarget,m=l.selectionStart,a=l.selectionEnd,b=s.substring(0,m)+" "+s.substring(a);r(b),requestAnimationFrame(()=>{l.selectionStart=l.selectionEnd=m+2})}},[s,r]);return t.jsxs("div",{children:[t.jsxs(W,{isRequired:i,children:[o,d&&t.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:d})]}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),t.jsx("textarea",{value:s,onChange:x=>r(x.target.value),onKeyDown:u,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function _r({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=p.useRef(null),[c,d]=p.useState(!1),u=Y(e,n),x=n==null?void 0:n.description;p.useEffect(()=>{const y=o.current;if(!y)return;const h=y.getContext("2d");if(h&&(h.lineWidth=2,h.lineCap="round",h.strokeStyle="#1E1535",s&&s.startsWith("data:"))){const j=new Image;j.onload=()=>h.drawImage(j,0,0),j.src=s}},[]);const l=p.useCallback(y=>{const h=o.current,j=h.getBoundingClientRect(),k=j.width>0?h.width/j.width:1,g=j.height>0?h.height/j.height:1;return"touches"in y?{x:(y.touches[0].clientX-j.left)*k,y:(y.touches[0].clientY-j.top)*g}:{x:(y.clientX-j.left)*k,y:(y.clientY-j.top)*g}},[]),m=p.useCallback(y=>{var k;d(!0);const h=(k=o.current)==null?void 0:k.getContext("2d");if(!h)return;const j=l(y);h.beginPath(),h.moveTo(j.x,j.y)},[l]),a=p.useCallback(y=>{var k;if(!c)return;const h=(k=o.current)==null?void 0:k.getContext("2d");if(!h)return;const j=l(y);h.lineTo(j.x,j.y),h.stroke()},[c,l]),b=p.useCallback(()=>{d(!1);const y=o.current;y&&r(y.toDataURL("image/png"))},[r]),w=p.useCallback(()=>{const y=o.current;if(!y)return;const h=y.getContext("2d");h&&(h.clearRect(0,0,y.width,y.height),r(""))},[r]);return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:u}),x&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:x}),t.jsx("div",{className:"mt-1 max-w-[25rem] border border-surface-border rounded-md overflow-hidden bg-white",children:t.jsx("canvas",{ref:o,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:m,onMouseMove:a,onMouseUp:b,onMouseLeave:b,onTouchStart:m,onTouchMove:a,onTouchEnd:b})}),t.jsx("button",{type:"button",onClick:w,className:"mt-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Cr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Y(e,n),c=n==null?void 0:n.description;return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:o}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),t.jsx("textarea",{value:s,onChange:d=>r(d.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}function Er({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const[o,c]=p.useState("write"),d=Y(e,n),u=n==null?void 0:n.description;return(n==null?void 0:n.readOnly)===!0?t.jsx(zt,{content:s,className:"my-1"}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(W,{isRequired:i,children:d}),t.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(l=>t.jsx("button",{type:"button",onClick:()=>c(l),className:`px-2 py-0.5 text-2xs rounded transition-colors ${o===l?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:l==="write"?"Write":"Preview"},l))})]}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),o==="write"?t.jsx("textarea",{value:s,onChange:l=>r(l.target.value),className:"input w-full mt-1 text-sm font-mono leading-relaxed",rows:10,placeholder:"Write markdown — headings, lists, tables, code blocks, and links all render."}):t.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:s.trim()?t.jsx(zt,{content:s}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}const Ar=28;function Tr({fieldKey:e,value:s,onChange:r,schema:n,escalationContext:i,isRequired:o,submitAttempted:c,error:d}){const u=(n==null?void 0:n["x-lt-require-all"])===!0,x=je(n==null?void 0:n["x-lt-source"],i);let l={};try{s&&(l=JSON.parse(s))}catch{}const m=(()=>{const g=or(n,l,i);return g?JSON.stringify(g):null})();p.useEffect(()=>{m&&r(m)},[m]);const a=g=>r(JSON.stringify({...l,[g]:!l[g]})),b=Y(e,n),w=n==null?void 0:n.description;if(x.length===0)return t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. None of the field's x-lt-source paths resolved on this escalation."}),d&&t.jsx("p",{className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]});const y=n==null?void 0:n["x-lt-variant"],h=y==="chips"||y==="rows"?y:u||x.some(g=>g.label.length>Ar)?"rows":"chips",j=x.filter(g=>l[g.id]).length,k=(x.find(g=>!l[g.id]&&g.required!==!1)??x[0]).id;return t.jsxs("div",{role:"group","aria-label":b,"aria-required":o||void 0,"aria-invalid":d?!0:void 0,children:[t.jsx(W,{isRequired:o,children:b}),w&&t.jsx(X,{children:w}),h==="chips"?t.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x.map(g=>{const A=l[g.id]??!1,D=!A&&!!c&&j===0&&(g.required||o);return t.jsxs("label",{className:`inline-flex items-center gap-1.5 cursor-pointer select-none px-3.5 py-2 text-sm border transition-colors rounded-[var(--lt-radius-field)] ${A?"bg-accent border-accent text-text-inverse":D?"bg-surface-field border-status-error/60 text-status-error":"bg-surface-field border-surface-field-border text-text-secondary hover:border-accent hover:text-text-primary"}`,children:[t.jsx("input",{type:"checkbox",checked:A,onChange:()=>a(g.id),className:"sr-only","data-testid":`checklist-item-${g.id}`,...g.id===k?{"data-field-key":e}:{}}),A&&t.jsx($n,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:2.5}),g.label]},g.id)})}):t.jsx("div",{className:"space-y-2.5 mt-2",children:x.map(g=>{const A=l[g.id]??!1,D=!A&&!!c&&(u?g.required!==!1:j===0&&(g.required||o));return t.jsxs("label",{className:`flex items-start gap-3 cursor-pointer group select-none rounded px-2 py-1 -mx-2 transition-colors ${D?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[t.jsx("input",{type:"checkbox",checked:A,onChange:()=>a(g.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${D?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${g.id}`,...g.id===k?{"data-field-key":e}:{}}),t.jsxs("span",{className:`text-sm leading-snug transition-colors ${D?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[g.label,g.required&&t.jsx("span",{className:`ml-0.5 text-2xs ${D?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},g.id)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-3 tabular-nums",children:h==="chips"?t.jsxs(t.Fragment,{children:[j," selected",o&&j===0&&!!c&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(check at least one)"})]}):t.jsxs(t.Fragment,{children:[j," / ",x.length," confirmed",u?t.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",x.some(g=>g.required===!1)?" except optional":"",")"]}):o&&j===0&&!!c&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]})}),d&&t.jsx("p",{role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:d})]})}const Rr=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function Or(e){var n,i,o,c;const s=e.trim();if(!s)return{kind:"none"};const r=(i=(n=/^data:([^;,]+)[;,]/.exec(s))==null?void 0:n[1])==null?void 0:i.toLowerCase();if(r)return r.startsWith("image/")?{kind:"image",src:s}:{kind:"file",href:s,label:r==="application/pdf"?"PDF":r,isData:!0};if(/^https?:\/\//i.test(s)){if(Rr.test(s))return{kind:"image",src:s};const d=(c=(o=/\.([a-z0-9]{2,5})(\?.*)?$/i.exec(s))==null?void 0:o[1])==null?void 0:c.toUpperCase();return{kind:"file",href:s,label:d??"attachment",isData:!1}}return{kind:"none"}}function Ye({fieldKey:e,value:s,schema:r}){const[n,i]=p.useState(!1),o=Or(s??""),c=e.replace(/[_-]/g," "),d=r==null?void 0:r.description,u=t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:c}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d})]});return o.kind==="none"?t.jsxs("div",{children:[u,t.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):o.kind==="image"?t.jsxs("div",{children:[u,t.jsxs("div",{className:"mt-1",children:[t.jsx("button",{type:"button",onClick:()=>i(!0),className:"block rounded-[0.125em] border border-surface-border overflow-hidden hover:border-accent transition-colors",title:"View full size",children:t.jsx("img",{src:o.src,alt:e.replace(/[_-]/g," "),className:"max-h-48 max-w-full object-contain","data-testid":`attachment-image-${e}`})}),n&&t.jsx("div",{className:"fixed inset-0 z-[100] bg-text-primary/60 backdrop-blur-sm flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>i(!1),role:"dialog","aria-modal":"true","aria-label":`${c} — full size`,children:t.jsx("img",{src:o.src,alt:c,className:"max-h-[90vh] max-w-[90vw] object-contain"})})]})]}):t.jsxs("div",{children:[u,t.jsx("div",{className:"mt-1",children:t.jsxs("a",{href:o.href,...o.isData?{download:`${e}.${o.label==="PDF"?"pdf":"bin"}`}:{target:"_blank",rel:"noopener noreferrer"},className:"inline-flex items-center gap-1.5 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`attachment-link-${e}`,children:[t.jsx(Ln,{className:"w-3.5 h-3.5",strokeWidth:1.5}),o.isData?`Download ${o.label}`:`Open ${o.label}`,o.isData?t.jsx(Pn,{className:"w-3 h-3",strokeWidth:1.5}):t.jsx(ce,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}function Ir({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-href"])??"",i=n&&r?at(n,r):n,o=(s==null?void 0:s.title)??(s==null?void 0:s.description)??"Open",c=s==null?void 0:s.description,d=i.startsWith("/"),u=!i.trim();return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1",children:u?t.jsx("span",{className:"text-xs text-text-quaternary italic",children:"No link configured"}):d?t.jsxs(vt,{to:i,className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[o,t.jsx(ce,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}):t.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[o,t.jsx(ce,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]})})]})}function js({to:e,className:s=""}){return t.jsxs(vt,{to:e,title:"View details",tabIndex:-1,className:`inline-flex items-center justify-center w-6 h-6 shrink-0 rounded border border-surface-border text-accent/70 hover:text-accent hover:border-accent/60 hover:bg-accent/5 transition-colors ${s}`,children:[t.jsx(Wn,{className:"w-3.5 h-3.5",strokeWidth:2}),t.jsx("span",{className:"sr-only",children:"View details"})]})}const Ze="—";function Sr(e,s){if(!e||!s)return"";const r=e.indexOf(".");if(r===-1)return"";const n=e.slice(0,r),i=e.slice(r+1);try{const o=he(s[n],i);return typeof o=="string"?o:""}catch{return""}}function Mr(e,s){if(!e||e===Ze)return Ze;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:pe(e)}return e}function Dr({fieldKey:e,schema:s,escalationContext:r}){const n=s==null?void 0:s["x-lt-source"],i=(s==null?void 0:s["x-lt-fields"])??[],o=(s==null?void 0:s.title)??"Linked escalation",c=s==null?void 0:s.description,d=Sr(n,r),{data:u,isLoading:x,isError:l}=ns(d);return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1",children:!d||l?t.jsx("p",{className:"text-xs text-text-quaternary italic","data-testid":`escalation-widget-empty-${e}`,children:"No linked record"}):x?t.jsx(Lr,{}):u?t.jsx($r,{esc:u,fields:i,fieldKey:e}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"No linked record"})})]})}function $r({esc:e,fields:s,fieldKey:r}){if(!e)return null;const n=be(e);return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2","data-testid":`escalation-widget-card-${r}`,children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e.type,e.subtype&&e.subtype!==e.type?` · ${e.subtype}`:""]}),t.jsx(ds,{status:e.status})]}),e.description&&t.jsx("p",{className:"text-xs text-text-primary leading-snug",children:e.description}),s.length>0&&t.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-0.5",children:s.map(i=>{const o=at(i.value,n),c=Mr(o,i.format);return t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-2xs text-text-tertiary whitespace-nowrap",children:i.label}),t.jsx("dd",{className:"text-2xs text-text-primary",children:c})]},i.label)})}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("span",{className:"text-2xs text-text-quaternary",children:[e.role," · ",pe(e.created_at)]}),t.jsx(js,{to:`/escalations/detail/${e.id}`})]})]})}function Lr(){return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2 animate-pulse",children:[t.jsx("div",{className:"h-3 w-32 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-48 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-24 bg-surface-sunken rounded"})]})}function Pr(e,s){if(!e)return{};const r={};for(const[n,i]of Object.entries(e))r[n]=typeof i=="string"?at(i,s):i;return r}function Ns(e,s,r){const n=Pr(e.facets,s),i={role:e.role,status:e.status??"pending",facets:n,limit:e.limit,enabled:!!(e.role||Object.keys(n).length)};return e.assigned==="me"?{...i,assigned_to:r,available:!1,enabled:i.enabled&&!!r}:e.assigned==="any"?i:{...i,available:e.available??!0}}const Wr=[{label:"Description",value:"{{escalation.description}}"},{label:"Role",value:"{{escalation.role}}"},{label:"Age",value:"{{escalation.created_at}}",format:"age"}],Ke="—";function Fr(e,s){if(!e||e===Ke)return Ke;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:pe(e)}return e}function xe(e,s){return typeof e=="string"?at(e,s):Array.isArray(e)?e.map(r=>xe(r,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,xe(n,s)])):e}function qr({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-query"])??{},i=(s==null?void 0:s["x-lt-columns"])??Wr,o=(s==null?void 0:s["x-lt-actions"])??[],c=(s==null?void 0:s.title)??"Related items",d=s==null?void 0:s.description,u=r??{},{user:x}=fe(),l=Ns(n,u,x==null?void 0:x.userId),{data:m,isLoading:a}=rs({role:l.role,status:l.status,facets:l.facets,assigned_to:l.assigned_to,available:l.available,limit:l.limit??5,enabled:l.enabled,include:wn({columns:i,actions:o})?"envelope":void 0}),b=(m==null?void 0:m.escalations)??[],w=as(),[y,h]=p.useState({}),[j,k]=p.useState(null),g=async(A,D)=>{const M=be(A);if(!(D.confirm&&!window.confirm(at(D.confirm,M)))){k(A.id),h($=>({...$,[A.id]:""}));try{await w.mutateAsync({id:A.id,resolverPayload:xe(D.resolverPayload,M)})}catch($){h(P=>({...P,[A.id]:$.message}))}finally{k(null)}}};return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:c}),d&&t.jsx(X,{children:d}),t.jsx("div",{className:"mt-1","data-testid":`escalation-list-widget-${e}`,children:a?t.jsx(Jr,{columns:i.length}):t.jsx(Ur,{escalations:b,columns:i,fieldKey:e,actions:o,onAction:g,pendingRow:j,rowErrors:y})})]})}function Ur({escalations:e,columns:s,fieldKey:r,actions:n,onAction:i,pendingRow:o,rowErrors:c}){return e.length===0?t.jsx("p",{className:"text-xs text-text-quaternary italic py-1","data-testid":`escalation-list-empty-${r}`,children:"No items found"}):t.jsxs("table",{className:"w-full text-xs border-collapse","data-testid":`escalation-list-table-${r}`,children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-surface-border",children:[s.map(d=>t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary pb-1 pr-3 last:pr-0",children:d.label},d.label)),n.length>0&&t.jsx("th",{className:"w-px"}),t.jsx("th",{className:"w-8"})]})}),t.jsx("tbody",{children:e.map(d=>{const u=be(d),x=c[d.id];return t.jsxs("tr",{className:"border-b border-surface-border/50 last:border-0 hover:bg-surface-sunken/50 transition-colors",children:[s.map(l=>{const m=at(l.value,u),a=Fr(m,l.format);return t.jsx("td",{className:"py-1 pr-3 last:pr-0 text-text-primary align-top",children:a},l.label)}),n.length>0&&t.jsxs("td",{className:"py-1 pr-2 align-top whitespace-nowrap",children:[n.map(l=>t.jsx("button",{type:"button",onClick:()=>i(d,l),disabled:o===d.id,className:"px-2 py-0.5 text-2xs font-medium text-accent border border-accent/40 rounded hover:bg-accent/10 disabled:opacity-40 disabled:cursor-default transition-colors ml-1 first:ml-0","data-testid":`escalation-list-action-${d.id}`,children:l.label},l.label)),x&&t.jsx("p",{className:"text-2xs text-status-error mt-0.5 whitespace-normal max-w-[16rem]","data-testid":`escalation-list-action-error-${d.id}`,children:x})]}),t.jsx("td",{className:"py-1 pl-2 align-top",children:t.jsx(js,{to:`/escalations/detail/${d.id}`})})]},d.id)})})]})}function Jr({columns:e}){return t.jsx("div",{className:"space-y-1.5 animate-pulse",children:[0,1,2].map(s=>t.jsx("div",{className:"flex gap-4",children:Array.from({length:e},(r,n)=>t.jsx("div",{className:"h-3 bg-surface-sunken rounded flex-1"},n))},s))})}const ie={"file-upload":wr,"code-editor":kr,signature:_r,"rich-text":Cr,markdown:Er,checklist:Tr,attachment:Ye,image:Ye,link:Ir,escalation:Dr,"escalation-list":qr};function vs({fieldKey:e,value:s,onChange:r,onBlur:n,schema:i,isRequired:o,isReadOnly:c,error:d,escalationContext:u,submitAttempted:x}){var P;const l=(P=i==null?void 0:i.properties)==null?void 0:P[e],m=Y(e,l),a=l==null?void 0:l["x-lt-widget"],b=`lt-field-${e}`,w=`${b}-error`,y=`${b}-help`,h=typeof(l==null?void 0:l.description)=="string"&&l.description.length>0?l.description:void 0,g={id:b,"aria-required":o||void 0,"aria-invalid":d?!0:void 0,"aria-describedby":d?w:h!==void 0?y:void 0},A=a==="markdown"&&typeof s=="string",D=(a==="attachment"||a==="image")&&typeof s=="string",M=!!(a&&a in ie);if(c&&!A&&!D&&!M){const T=s===null?"null":typeof s=="object"?JSON.stringify(s,null,2):String(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:T})]})}if(a&&a in ie){const T=ie[a],_=o||(l==null?void 0:l["x-lt-require-all"])===!0,R={fieldKey:e,schema:l,escalationContext:u,isRequired:_,submitAttempted:x,error:d};if((l==null?void 0:l.type)==="object"){const O=typeof s=="string"?s:typeof s=="object"&&s!==null&&!Array.isArray(s)?JSON.stringify(s):"";return t.jsx(T,{...R,value:O,onChange:I=>{try{r(JSON.parse(I))}catch{r(I)}}})}if(typeof s=="string")return t.jsx(T,{...R,value:s,onChange:O=>r(O)});if(typeof s=="object"&&s!==null&&!Array.isArray(s))return t.jsx(T,{...R,value:JSON.stringify(s),onChange:O=>{try{r(JSON.parse(O))}catch{r(O)}}})}const $=gs(l,u);if($&&(s===null||typeof s=="string"||typeof s=="number")){const T=s===null?"":String(s),_=$.some(R=>String(R.value)===T);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsxs("select",{value:_?T:"",disabled:$.length===0,onChange:R=>{const O=$.find(I=>String(I.value)===R.target.value);r(O?O.value:R.target.value)},onBlur:n,"data-field-key":e,className:vr(!!d),...g,children:[!_&&t.jsx("option",{value:"",disabled:!0,children:"Choose…"}),$.map(R=>t.jsx("option",{value:String(R.value),children:R.label},String(R.value)))]}),t.jsx(mt,{error:d,id:w})]})}if(typeof s=="boolean")return t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:T=>{r(T.target.checked),n==null||n()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":e,...g}),t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[m,o&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),h&&t.jsx(X,{id:y,children:h}),t.jsx(mt,{error:d,id:w})]});if(typeof s=="number")return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"number",value:s,onChange:T=>r(parseFloat(T.target.value)||0),onBlur:n,step:"any","data-field-key":e,className:`${Tt(!!d)} max-w-48`,...g}),t.jsx(mt,{error:d,id:w})]});if(typeof s=="string"){if((l==null?void 0:l.format)==="password")return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"password",value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:Tt(!!d),autoComplete:"off",...g}),t.jsx(mt,{error:d,id:w})]});const _=l==null?void 0:l.format,R={date:"date","date-time":"datetime-local",email:"email",uri:"url"},O={date:"max-w-48","date-time":"max-w-64"};if(_&&_ in R)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:R[_],value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:`${Tt(!!d)} ${O[_]??""}`,...g}),t.jsx(mt,{error:d,id:w})]});if(_==="textarea"||s.length>80){const I=l==null?void 0:l.maxLength,F=l==null?void 0:l["x-lt-max-length"];let q=I;if(q===void 0&&F&&u){const V=F.indexOf(".");if(V!==-1){const G=F.slice(0,V),Z=F.slice(V+1),N=u[G];if(N&&typeof N=="object"){let E=N;for(const v of Z.split("."))if(E=E[v],E===void 0)break;if(typeof E=="number")q=E;else if(typeof E=="string"){const v=Number(E);Number.isNaN(v)||(q=v)}}}}const z=q!==void 0&&s.length>q;return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("textarea",{value:s,onChange:V=>{r(V.target.value),n==null||n()},onBlur:n,"data-field-key":e,className:`${Tt(!!d)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(s.length/60))),...g}),q!==void 0&&t.jsxs("p",{className:`text-2xs mt-0.5 text-right tabular-nums ${z?"text-status-error font-medium":"text-text-quaternary"}`,children:[s.length," / ",q]}),t.jsx(mt,{error:d,id:w})]})}return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:b,children:m}),h&&t.jsx(X,{id:y,children:h}),t.jsx("input",{type:"text",value:s,onChange:I=>r(I.target.value),onBlur:n,"data-field-key":e,className:Tt(!!d),...g}),t.jsx(mt,{error:d,id:w})]})}if(s===null)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(s))return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.map((T,_)=>t.jsx("span",{className:"px-2 py-0.5 text-2xs font-mono bg-surface-sunken rounded text-text-secondary",children:String(T)},_))})]});if(typeof s=="object"){const T=Object.entries(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:m}),t.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:T.map(([_,R])=>t.jsx(vs,{fieldKey:_,value:R,onChange:O=>r({...s,[_]:O})},_))})]})}return null}function Vr({items:e,columns:s=1}){if(e.length===0)return null;const r=s>=2&&e.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return t.jsx("div",{className:"@container",children:t.jsx("dl",{className:`grid ${r} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:e.map(({key:n,label:i,value:o})=>t.jsxs(p.Fragment,{children:[t.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:i}),t.jsx("dd",{className:"text-sm text-text-primary break-words min-w-0","data-field-key":n,children:Hr(o)})]},n))})})}function Hr(e){return e==null||e===""?"—":typeof e=="boolean"?e?"Yes":"No":typeof e=="object"?JSON.stringify(e):String(e)}const oe="dictionary",Br=new Set(["markdown","attachment","image"]);function ws(e,s){if(!s)return;const r=e==null?void 0:e["x-lt-section-options"],n=r==null?void 0:r[s];return n&&typeof n=="object"?n:void 0}function zr(e,s,r){var d,u;const n=(d=e==null?void 0:e.properties)==null?void 0:d[r];if((n==null?void 0:n.readOnly)!==!0)return!1;const i=n==null?void 0:n["x-lt-widget"];if(typeof i=="string"&&Br.has(i))return!1;const o=n==null?void 0:n["x-lt-display"];if(typeof o=="string")return o===oe;const c=(u=ws(e,s))==null?void 0:u.display;return typeof c=="string"?c===oe:(e==null?void 0:e["x-lt-display"])===oe}function Xr(e,s,r,n){var o;const i=[];for(const c of e){const[d]=c,u=i[i.length-1];if(zr(s,r,d)){(u==null?void 0:u.kind)==="dictionary"?u.entries.push(c):i.push({kind:"dictionary",entries:[c]});continue}const x=(o=s==null?void 0:s.properties)==null?void 0:o[d],l=x==null?void 0:x["x-lt-column-group"];if(n==="two-column"&&typeof l=="string"&&l.trim()){(u==null?void 0:u.kind)==="column-group"&&u.name===l?u.entries.push(c):i.push({kind:"column-group",name:l,entries:[c]});continue}i.push({kind:"field",entry:c})}return i}function Gr({name:e,entries:s,formSchema:r,layout:n,renderField:i}){const o=Xr(s,r,e,n),c=ws(r,e),d=(c==null?void 0:c.columns)??(n==="two-column"?2:1),u=l=>l.map(([m,a])=>{var b;return{key:m,label:Y(m,(b=r==null?void 0:r.properties)==null?void 0:b[m]),value:a}}),x=()=>o.map((l,m)=>l.kind==="dictionary"?t.jsx("div",{className:n==="two-column"?"col-span-full":"",children:t.jsx(Vr,{items:u(l.entries),columns:d})},`dict-${m}`):l.kind==="column-group"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @grp-cols:grid-cols-2 gap-x-4 gap-y-5",children:l.entries.map(a=>i(a))})},`group-${l.name}-${m}`):i(l.entry));return t.jsxs("div",{className:e?"border border-surface-border bg-surface-sunken rounded-[var(--lt-radius-section)] p-4 animate-[section-enter_0.25s_ease-out]":"",children:[e&&t.jsx("p",{className:"mb-4 text-[1.40625rem] font-semibold tracking-wider text-heading [font-variant-caps:small-caps]",children:e}),n==="two-column"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-col-gap gap-y-5",children:x()})}):t.jsx("div",{className:"space-y-5",children:x()})]})}function ks({value:e,onChange:s,disabled:r,submitAttempted:n,escalationContext:i,onOpenHelp:o,onDisabledClick:c,disabledHint:d}){var G,Z;const[u,x]=p.useState({}),[l,m]=p.useState({}),[a,b]=p.useState(null),[w,y]=p.useState(!1),[h,j]=p.useState(new Set);p.useEffect(()=>{try{const N=JSON.parse(e);if(typeof N=="object"&&N!==null&&!Array.isArray(N)){const E={},v={};for(const[L,U]of Object.entries(N))L.startsWith("_")?v[L]=U:E[L]=U;x(E),m(v),b(v._form_schema&&typeof v._form_schema=="object"?v._form_schema:null),y(!1)}}catch{y(!0)}},[e]);const k=p.useCallback(N=>{x(N),s(JSON.stringify({...N,...l},null,2))},[l,s]),g=p.useCallback((N,E)=>{k({...u,[N]:E})},[u,k]),A=p.useCallback(N=>{j(E=>{if(E.has(N))return E;const v=new Set(E);return v.add(N),v})},[]);if(w)return t.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const D=Object.entries(u);if(D.length===0)return t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const M=a==null?void 0:a["x-lt-order"],$=M?[...D].sort((N,E)=>{const v=M.indexOf(N[0]),L=M.indexOf(E[0]);return(v===-1?1/0:v)-(L===-1?1/0:L)}):D,P={...i??{},resolver:u},T=$.filter(([N,E])=>{var L;const v=(L=a==null?void 0:a.properties)==null?void 0:L[N];return!(!Bt(v==null?void 0:v["x-lt-showIf"],P)||(v==null?void 0:v["x-lt-hide-if-empty"])===!0&&(E==null||E===""||E===!1||E===0))}),_=new Set((a==null?void 0:a.required)??[]),R=a==null?void 0:a["x-lt-layout"],O=a==null?void 0:a.title,I=a==null?void 0:a.description,F=typeof(a==null?void 0:a["x-lt-help"])=="string"||typeof(a==null?void 0:a["x-lt-context"])=="string",q=[];for(const N of T){const[E]=N,v=(G=a==null?void 0:a.properties)==null?void 0:G[E],L=((Z=v==null?void 0:v["x-lt-section"])==null?void 0:Z.trim())||null,U=q[q.length-1];!U||U.name!==L?q.push({name:L,entries:[N]}):U.entries.push(N)}const z=([N,E])=>{var S;const v=(S=a==null?void 0:a.properties)==null?void 0:S[N],L=(v==null?void 0:v.readOnly)===!0,U=(v==null?void 0:v["x-lt-span"])??1,ft=_.has(N),gt=h.has(N)||!!n,it=hs(E,v,ft,gt,P);return t.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${R==="two-column"&&U>=2?"col-span-full":""}`,children:t.jsx(vs,{fieldKey:N,value:E,onChange:K=>g(N,K),onBlur:()=>A(N),schema:a,isRequired:ft,isReadOnly:L,error:it,escalationContext:P,submitAttempted:!!n})},N)},V=t.jsxs("div",{className:r?"pointer-events-none":void 0,inert:r||void 0,"aria-disabled":r||void 0,children:[O&&t.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.jsx("h3",{className:"heading-3",children:O}),F&&o&&t.jsx("button",{type:"button",onClick:o,title:"Open instructions","aria-label":"Open instructions",className:"p-1 rounded-md text-text-tertiary hover:text-accent hover:bg-surface-hover transition-colors",children:t.jsx(us,{className:"w-4 h-4",strokeWidth:1.5})})]}),I&&t.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:I}),t.jsx("div",{className:"space-y-8",children:q.map((N,E)=>t.jsx(Gr,{name:N.name,entries:N.entries,formSchema:a,layout:R,renderField:z},N.name??`__s${E}`))})]});return r?t.jsx(Nr,{hint:d,onLockedClick:c,children:V}):t.jsx("div",{className:"pb-8 max-w-form",children:V})}function Qr({json:e,onJsonChange:s,requestTriage:r,onRequestTriageChange:n,triageNotes:i,onTriageNotesChange:o,disabled:c=!1,submitAttempted:d=!1,showTriage:u=!1,escalationContext:x,onOpenHelp:l,onDisabledClick:m,disabledHint:a}){return t.jsxs(t.Fragment,{children:[u&&t.jsx("div",{className:"flex items-center justify-between mb-3",children:r?t.jsxs("button",{onClick:()=>n(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[t.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),t.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):t.jsxs("button",{onClick:()=>n(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[t.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),t.jsxs("span",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),t.jsxs("div",{className:"relative min-h-[200px]",children:[t.jsx("div",{className:r?"pointer-events-none select-none":"",children:t.jsx(ks,{value:e,onChange:s,disabled:c,submitAttempted:d,escalationContext:x,onOpenHelp:l,onDisabledClick:m,disabledHint:a})}),r&&t.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[t.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),t.jsx("textarea",{value:i,onChange:b=>o(b.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function _s(e,s){if(!e.includes("{"))return e;try{const r=i=>{if(!i)return{};try{return JSON.parse(i)}catch{return{}}},n={...s.metadata??{},...r(s.envelope),...r(s.escalation_payload)};return e.replace(/\{([^}]+)\}/g,(i,o)=>Object.prototype.hasOwnProperty.call(n,o)?String(n[o]):`{${o}}`)}catch{return e}}function ts(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function pt(e,s){return{escalation:e,metadata:e.metadata??null,envelope:ts(e.envelope),payload:ts(e.escalation_payload),resolver:null,...s?{lookup:s}:{}}}function Yr({isRoundsExhausted:e,payloadObj:s,isTerminal:r,resolverPayload:n,onRetryTriage:i,isRetrying:o}){return t.jsxs(t.Fragment,{children:[e&&s&&t.jsx("div",{className:"mt-8",children:t.jsx(yr,{payload:s,isTerminal:r,resolverPayload:n,onRetryTriage:i,isRetrying:o})}),(s==null?void 0:s.category)==="missing_credential"&&t.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[t.jsx(Ue,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),t.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",t.jsx("span",{className:"font-medium capitalize",children:String(s.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),t.jsxs(vt,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[t.jsx(Ue,{size:12}),"Go to Credentials"]})]})]})]})}function Zr({esc:e,resolverPayload:s,isTerminal:r,editable:n,activeView:i,metadataFormSchema:o,effectiveSchema:c,lookup:d,json:u,onJsonChange:x,requestTriage:l,onRequestTriageChange:m,triageNotes:a,onTriageNotesChange:b,onResolve:w,onEscalate:y,onClaim:h,submitAttempted:j,isCertified:k,hasAI:g,onOpenHelp:A,onDisabledClick:D,disabledHint:M}){const $=c,P=pt(e,d);if(r){if(s==null)return null;const O=typeof s=="object"&&s!==null?s:{},I=c??o,F=I!=null&&I.properties?{...cs(O,I),_form_schema:I}:O;return t.jsx("div",{className:"mt-3",children:t.jsx(ks,{value:JSON.stringify(F,null,2),onChange:()=>{},disabled:!0,escalationContext:P,disabledHint:M})})}if(i!=="resolve"||!(e.workflow_type||c))return null;const T=$==null?void 0:$["x-lt-viewport"],_=(T==null?void 0:T.type)==="iframe"&&!!T.src&&w&&y;if(_&&!n)return t.jsxs("button",{onClick:()=>h==null?void 0:h(),disabled:!h,className:"flex flex-col items-center justify-center min-h-[55vh] w-full gap-3 text-center group disabled:opacity-50 disabled:cursor-default",children:[t.jsx(Fn,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),t.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const R=_?_s(T.src,e):"";return t.jsx("div",{className:"mt-3",children:_?t.jsx(ys,{src:R,escalation:e,schema:$,onResolve:w,onEscalate:y,submitAttempted:j}):t.jsx(Qr,{json:u,onJsonChange:x,requestTriage:l,onRequestTriageChange:m,triageNotes:a,onTriageNotesChange:b,disabled:!n,submitAttempted:j,showTriage:!!k&&!!g,escalationContext:P,onOpenHelp:A,onDisabledClick:D,disabledHint:M})})}function Kr({open:e,assignedUntil:s,onClose:r,onExtend:n,isPending:i}){const o=is(),[c,d]=p.useState("30"),[u,x]=p.useState(0),l=c==="custom",m=l?u:parseInt(c),a=p.useCallback(b=>x(b),[]);return t.jsx(me,{open:e,onClose:r,title:"Claim Expiring",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",t.jsx(Xt,{until:s}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),t.jsxs("select",{value:c,onChange:b=>{d(b.target.value),x(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[o.map(b=>t.jsx("option",{value:b.value,children:b.label},b.value)),t.jsx("option",{value:"custom",children:"Other..."})]}),l&&t.jsx(os,{onChange:a,autoFocus:!0}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Dismiss"}),t.jsx("button",{onClick:()=>n(m),className:"btn-primary text-xs",disabled:i||!m||m<=0,children:i?"Extending...":"Extend Claim"})]})]})})}const ta=9e4;function ea(e,s=ta){const[,r]=p.useState(0);if(p.useEffect(()=>{if(!e)return;const i=new Date(e).getTime()-Date.now();if(i<=0)return;const o=()=>r(u=>u+1),c=[],d=i-s;return d>0&&c.push(window.setTimeout(o,d)),c.push(window.setTimeout(o,i)),()=>c.forEach(u=>window.clearTimeout(u))},[e,s]),!e)return{expired:!1,expiringSoon:!1,msRemaining:0};const n=Math.max(0,new Date(e).getTime()-Date.now());return{expired:n<=0,expiringSoon:n>0&&n<=s,msRemaining:n}}const sa="lt:escalation:draft:";function Ne(e){return`${sa}${e}`}function na(e){try{return localStorage.getItem(Ne(e))}catch{return null}}function ra(e,s){try{localStorage.setItem(Ne(e),s)}catch{}}function le(e){try{localStorage.removeItem(Ne(e))}catch{}}const aa="x-lt-transition",ia="x-lt-transition-message",oa="x-lt-transition-max-wait-seconds",la="x-lt-transition-done",ca="Submitted. Preparing your next step…",da=30,ua=5,xa=300;function ma(e){const s=typeof e=="number"?e:Number(e);return!Number.isFinite(s)||s<=0?da:Math.min(xa,Math.max(ua,Math.round(s)))}function es(e){if(!e||!e[aa])return null;const s=e[ia];return{message:typeof s=="string"&&s.trim().length>0?s:ca,maxWaitSeconds:ma(e[oa])}}function pa(e){const s=e==null?void 0:e[la];return typeof s=="string"&&s.trim().length>0?s:null}const fa="x-lt-submit-on-claim";function ga(e){return!!(e!=null&&e[fa])}const ha="x-lt-submit-guard",ba="{{count}} related items are still pending";function ya(e){const s=e==null?void 0:e[ha];if(!s||typeof s!="object"||Array.isArray(s))return;const r=s;if(!(!r.query||typeof r.query!="object"))return r}function ja(e,s){const{user:r}=fe(),n=Ns((e==null?void 0:e.query)??{},s??{},r==null?void 0:r.userId),{data:i,isSuccess:o}=rs({role:n.role,status:n.status,facets:n.facets,assigned_to:n.assigned_to,available:n.available,limit:1,enabled:!!e&&n.enabled}),c=!!e&&e.mustBeEmpty!==!1&&n.enabled,d=(i==null?void 0:i.total)??0,u=c&&o&&d===0,x=c&&!u;let l="";if(x)if(d>0){const m=(e==null?void 0:e.message)??ba;l=at(m.replace(/\{\{count\}\}/g,String(d)),s??{})}else l="Checking related items…";return{blocked:x,count:d,message:l,confirmedEmpty:u}}function Na({open:e,message:s}){return e?fn.createPortal(t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4",children:[t.jsx("div",{className:"absolute inset-0 bg-text-primary/40 backdrop-blur-sm"}),t.jsxs("div",{role:"status","aria-live":"polite",className:"relative w-full max-w-sm bg-surface-raised border border-surface-border rounded-lg shadow-xl px-6 py-7 text-center",children:[t.jsx("div",{className:"flex justify-center mb-4","aria-hidden":"true",children:t.jsx("span",{className:"inline-block w-7 h-7 rounded-full border-2 border-surface-border border-t-accent animate-spin"})}),t.jsx("div",{className:"text-sm text-text-secondary [&_p]:m-0 [&_p+p]:mt-2",children:t.jsx(zt,{content:s})})]})]}),document.body):null}function va({open:e,verb:s="submit",claimantId:r,wrongBadgeName:n,onCancel:i}){return e?t.jsx(me,{open:!0,onClose:i,title:`Scan your badge to ${s}`,children:t.jsxs("div",{className:"flex flex-col items-center text-center py-6","data-testid":"station-write-challenge",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[t.jsx(qn,{className:"w-7 h-7 text-text-quaternary",strokeWidth:1}),t.jsx(ms,{className:"w-9 h-9 text-accent-muted",strokeWidth:1})]}),t.jsxs("p",{className:"text-lg text-text-secondary",children:["Scan your badge to ",s," as"," ",t.jsx("span",{className:"font-medium text-text-primary",children:r?t.jsx(St,{userId:r}):"the claimant"}),"."]}),n&&t.jsxs("p",{className:"text-sm text-status-error mt-3","data-testid":"wrong-badge",children:["That badge is ",n,"'s — scan the claimant's badge to ",s,"."]}),t.jsx("div",{className:"w-16 border-t border-surface-border my-6"}),t.jsx("button",{type:"button",onClick:i,className:"text-sm text-text-tertiary hover:text-text-secondary hover:underline",children:"Cancel"})]})}):null}const Cs="lt:escalation:panel:open";function wa(){try{const e=localStorage.getItem(Cs);return e===null?!0:e==="true"}catch{return!0}}function Rt(e){try{localStorage.setItem(Cs,String(e))}catch{}}function Ot(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function Ha(){const{id:e}=gn();return t.jsx(ka,{id:e},e)}function ka({id:e}){var Se,Me,De,$e,Le;const{user:s,isSuperAdmin:r,hasRoleType:n}=fe(),i=r||n("admin"),{identity:o,clear:c}=Zs(),d=Ks(),u=(o==null?void 0:o.actorId)??(s==null?void 0:s.userId),x=ge(),l=ls(),m=ss(),{data:a,isLoading:b,refetch:w,isFetching:y}=ns(e);tn(e);const h=p.useMemo(()=>{if(!(a!=null&&a.envelope))return!1;try{const f=JSON.parse(a.envelope);return Array.isArray(f==null?void 0:f.lookups)&&f.lookups.length>0}catch{return!1}},[a==null?void 0:a.envelope]),{data:j}=en(e,h),k=p.useMemo(()=>{var f;return(f=j==null?void 0:j.lookups)!=null&&f.length?Object.fromEntries(j.lookups.filter(C=>!C.missing).map(C=>[C.as??C.key,C.data])):null},[j]),g=sn(),A=as(),D=nn(),M=rn(),$=an(),P=on(),[T,_]=p.useState(!1),[R,O]=p.useState(!1),{data:I}=kn(),{data:F}=ln(),{isBuilder:q}=cn(),z=I==null?void 0:I.find(f=>f.workflow_type===(a==null?void 0:a.workflow_type)),V=((Se=F==null?void 0:F.telemetry)==null?void 0:Se.traceUrl)??null,[G,Z]=p.useState("resolve"),[N,E]=p.useState("{}"),[v,L]=p.useState(wa),[U,ft]=p.useState(!1),[gt,it]=p.useState(""),[S,K]=p.useState(!1),[Es,wt]=p.useState([]),[As,Ts]=p.useState(0),[Rs,kt]=p.useState(void 0),[tt,Gt]=p.useState(null),[Os,ve]=p.useState(!1),we=p.useRef(!1),Mt=p.useRef(null),ke=p.useRef(!1),Dt=p.useRef(null),[ot,Qt]=p.useState(null),Is=ea(a==null?void 0:a.assigned_until),[Ss,Ms]=p.useState(null);p.useEffect(()=>{if(!(!S||!a))try{const f=JSON.parse(N),C=f._form_schema;if(!C){wt([]);return}wt(bs(C,f,pt(a,k)))}catch{}},[N,S,a]);const $t=((Me=a==null?void 0:a.metadata)==null?void 0:Me.form_schema)??null,ht=(a==null?void 0:a.form_schema)??(z==null?void 0:z.resolver_schema)??null,J=$t??ht,_e=ga(J),et=xn(J),_t=ya(J),Ct=ja(_t,a?pt(a,k):void 0),Lt=p.useRef(!1),Pt=p.useRef(null);p.useEffect(()=>{if(Lt.current)return;const f=$t??(ht!=null&&ht.properties?ht:null);if(f!=null&&f.properties){Lt.current=!0;const C=Ot(a==null?void 0:a.envelope),H=C==null?void 0:C.formDefaults,Q={...(a==null?void 0:a.metadata)??{},...typeof H=="object"&&H!==null?H:{}},ut=cs(Q,f),nt={_form_schema:f};for(const[We,zs]of Object.entries(f.properties)){const Fe=zs,Xs=Fe.type==="object"?{}:"";nt[We]=ut[We]??Fe.default??Xs}Pt.current=JSON.stringify(nt,null,2);const Pe=!((a==null?void 0:a.status)==="resolved"||(a==null?void 0:a.status)==="cancelled")&&(a!=null&&a.id)?na(a.id):null,Jt=Pe?Ot(Pe):null;Jt&&typeof Jt=="object"&&!Array.isArray(Jt)?E(JSON.stringify({...Jt,_form_schema:f},null,2)):E(Pt.current)}else J&&(Lt.current=!0,E(JSON.stringify(J,null,2)))},[J,$t,ht,a==null?void 0:a.envelope,a==null?void 0:a.metadata,a==null?void 0:a.id,a==null?void 0:a.status]),p.useEffect(()=>{if(!Lt.current||Pt.current===null||!(a!=null&&a.id)||a.status!=="pending")return;const f=a.id,C=window.setTimeout(()=>{N===Pt.current?le(f):ra(f,N)},400);return()=>window.clearTimeout(C)},[N,a==null?void 0:a.id,a==null?void 0:a.status]),p.useEffect(()=>{if(!tt)return;const f=window.setTimeout(async()=>{var H;try{const Q=new URLSearchParams({parent_id:e,assigned_to:u??"",status:"pending",limit:"1"}),ut=await Nt(`/escalations?${Q}`),nt=(H=ut==null?void 0:ut.escalations)==null?void 0:H[0];if(nt!=null&&nt.id&&nt.parent_id===e){Gt(null),x(`/escalations/detail/${nt.id}`);return}}catch{}Gt(null),m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]});const C=tt.doneDest;C?C.startsWith("/")?x(C):window.location.assign(C):x(-1)},tt.maxWaitSeconds*1e3);return()=>window.clearTimeout(f)},[tt,e,u,x,m]),p.useEffect(()=>{var f,C;we.current||(f=l.state)!=null&&f.autoStart&&(!a||a.status!=="pending"||Ht(a)||N!=="{}"&&(we.current=!0,(C=Mt.current)==null||C.call(Mt)))},[a,N,l.state]),p.useEffect(()=>{var f;ke.current||!(_t!=null&&_t.autoResolveWhenEmpty)||!Ct.confirmedEmpty||!a||a.status!=="pending"||!Ht(a)||a.assigned_to===u&&N!=="{}"&&(ke.current=!0,(f=Dt.current)==null||f.call(Dt))},[Ct.confirmedEmpty,_t,a,N,u]),p.useEffect(()=>{if(!(!ot||!a)&&o&&o.actorId===a.assigned_to){const{run:f}=ot;Qt(null),f()}},[o,ot,a==null?void 0:a.assigned_to]);const Ds=(a==null?void 0:a.subtype)==="rounds_exhausted";if(b)return t.jsxs("div",{className:"animate-pulse space-y-8",children:[t.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),t.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!a)return t.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const Wt=Ht(a),lt=Wt&&a.assigned_to===u,$s=Wt&&!lt,ct=a.status==="resolved"||a.status==="cancelled",Yt=d&&Wt&&!ct,Ce=lt||Yt,Ee=Yt&&a.assigned_to!==(s==null?void 0:s.userId),dt=J==null?void 0:J["x-lt-viewport"],Zt=(dt==null?void 0:dt.type)==="iframe"&&!!(dt!=null&&dt.src)&&Ce&&!ct,Ft=Ot(a.escalation_payload),bt=Ot(a.resolver_payload),qt=Ot(a.envelope),Ls=!!((De=qt==null?void 0:qt.metadata)!=null&&De.certified),Ae=dn(),Te=Ae!==null?Ae:!!(($e=F==null?void 0:F.ai)!=null&&$e.enabled),st=typeof Ft=="object"&&Ft!==null&&!Array.isArray(Ft)?Ft:null,Ps=st==null?void 0:st._triage,Ws=typeof bt=="object"&&bt!==null&&!Array.isArray(bt)?bt:null,Kt=ct?"terminal":lt||Yt?"claimed_by_me":$s?"claimed_by_other":"available",Fs=Kt==="available"?`${typeof et.claim=="string"?et.claim:"Claim"} this escalation to edit the form`:Kt==="claimed_by_other"?t.jsxs(t.Fragment,{children:["Claimed by ",a.assigned_to?t.jsx(St,{userId:a.assigned_to}):"another user"]}):a.status==="cancelled"?"This escalation is cancelled":a.status==="resolved"?"This escalation is resolved — the submitted values are shown":null,te=f=>{g.mutate({id:e,durationMinutes:f})},Et=()=>{m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]}),x(-1)},qs=()=>{const f=pa(J);return f&&at(f,pt(a,k))||null},Us=f=>{m.resetQueries({queryKey:["escalations"]}),m.resetQueries({queryKey:["escalationStats"]}),f.startsWith("/")?x(f):window.location.assign(f)},Js=async f=>{try{await A.mutateAsync({id:e,resolverPayload:f})}catch(Q){if(Q instanceof un&&Hn(Q.body)){K(!0),wt(Q.body.violations),kt(B.ERRORS);return}throw Q}le(e);const C=es(J),H=qs();if(C){Gt({...C,doneDest:H});return}if(H){Us(H);return}Et()},Ut=(f,C)=>{if(Ee){c(),Qt({verb:f,run:C});return}C()},At=async f=>{Ut("submit",()=>Js(f))},Re=async f=>{try{await g.mutateAsync({id:e,durationMinutes:f})}catch{return}if(Ct.blocked)return;const C=ue(N,pt(a,k));if(!C.parseError){if(C.errors.length>0){K(!0),wt(C.errors),L(!0),Rt(!0),kt(B.ERRORS);return}await At(C.payload)}};Mt.current=async()=>{var C;const f=(C=l.state)==null?void 0:C.durationMinutes;ve(!0),await Re(typeof f=="number"&&f>0?f:30),ve(!1)},Dt.current=()=>{const f=ue(N,pt(a,k));f.parseError||f.errors.length>0||At(f.payload)};const Oe=f=>{f&&Ut("escalate",async()=>{await D.mutateAsync({id:e,targetRole:f}),Et()})},Vs=async()=>{lt||await g.mutateAsync({id:e,durationMinutes:30});const f=(st==null?void 0:st.diagnosis)||a.description||"";await A.mutateAsync({id:e,resolverPayload:{_lt:{needsTriage:!0},notes:f}}),Et()},Ie=()=>{Ut("release",async()=>{await g.mutateAsync({id:e,durationMinutes:0}),Et()})},Hs=()=>{_(!1),Ut("cancel",async()=>{await M.mutateAsync(e),le(e),Et()})},Bs=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(bn,{onRefresh:()=>w(),isFetching:y,apiPath:`/escalations/${a.id}`,standalone:!0}),t.jsx("button",{onClick:()=>L(f=>(Rt(!f),!f)),className:"ml-2 text-accent/60 hover:text-accent transition-colors",title:v?"Hide side panel":"Show side panel",children:v?t.jsx(Je,{className:"w-5 h-5",strokeWidth:1.5}):t.jsx(Ve,{className:"w-5 h-5",strokeWidth:1.5})})]});return t.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[Zt?t.jsxs("div",{className:"relative flex-1 min-h-0 -ml-page-x",children:[t.jsx("div",{className:"absolute top-3 right-3 z-50 flex items-center gap-0.5 bg-surface/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-surface-border/40",children:[{onClick:Ie,disabled:g.isPending,label:et.release??"Release",hoverClass:"hover:text-accent",icon:t.jsx(Un,{className:"w-4 h-4",strokeWidth:1.5})},...et.cancel===!1?[]:[{onClick:()=>_(!0),disabled:!1,label:et.cancel??"Cancel",hoverClass:"hover:text-status-error",icon:t.jsx(Jn,{className:"w-4 h-4",strokeWidth:1.5})}],{onClick:()=>L(f=>(Rt(!f),!f)),disabled:!1,label:v?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:v?t.jsx(Je,{className:"w-4 h-4",strokeWidth:1.5}):t.jsx(Ve,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:f,disabled:C,label:H,hoverClass:Q,icon:ut})=>t.jsxs("div",{className:"relative group/tip",children:[t.jsx("button",{onClick:f,disabled:C,className:`text-text-tertiary ${Q} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:ut}),t.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-0.5 rounded text-2xs bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:H})]},H))}),t.jsx(ys,{src:_s(dt.src,a),escalation:a,schema:J,onResolve:At,onEscalate:Oe,submitAttempted:S,fill:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:t.jsx(hn,{title:a.description||"Escalation",actions:Bs})}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[t.jsx(Yr,{isRoundsExhausted:Ds,payloadObj:st,isTerminal:ct,resolverPayload:bt,onRetryTriage:Vs,isRetrying:g.isPending||A.isPending}),t.jsx(Zr,{esc:a,resolverPayload:bt,isTerminal:ct,editable:Ce,activeView:G,lookup:k,metadataFormSchema:$t,effectiveSchema:J,json:N,onJsonChange:E,requestTriage:U,onRequestTriageChange:ft,triageNotes:gt,onTriageNotesChange:it,onResolve:At,onEscalate:Oe,onClaim:()=>te(30),submitAttempted:S,isCertified:Ls,hasAI:Te,onOpenHelp:()=>{L(!0),Rt(!0),kt(B.HELP)},onDisabledClick:()=>Ts(f=>f+1),disabledHint:Fs}),t.jsx("div",{className:"h-10"})]})]}),!Zt&&t.jsx(br,{escalationContext:pt(a,k),mode:Kt,activeView:G,onActiveViewChange:Z,onClaim:_e?Re:te,claimPending:g.isPending||_e&&A.isPending,claimNudge:As,workflowType:a.workflow_type,json:N,onResolve:At,resolvePending:A.isPending||A.isSuccess,resolveError:A.error,requestTriage:U,triageNotes:gt,onRelease:Ie,releasePending:g.isPending,onCancel:()=>_(!0),assignedTo:a.assigned_to,assignedUntil:a.assigned_until,actingName:o&<?o.displayName:null,submitNeedsBadge:Ee,onSubmitAttempt:()=>K(!0),onValidationErrors:f=>{wt(f),L(!0),Rt(!0),kt(B.ERRORS)},labels:et,submitBlocked:Ct.blocked,submitBlockedMessage:Ct.message,canManage:i,onReassign:()=>O(!0),onUnassign:()=>P.mutate({ids:[e]}),unassignPending:P.isPending})]}),t.jsx(sr,{esc:a,schema:J,envelope:qt,payload:st,resolver:Ws,triage:Ps??null,hasAI:Te,claimed:Wt,claimedByMe:lt,isTerminal:ct,isBuilder:q,traceUrl:V,open:v,noGutter:Zt,formErrors:Es,activePanel:Rs,onPanelChange:kt}),t.jsx(mn,{open:R,onClose:()=>O(!1),selectedCount:1,selectedRoles:a?[a.role]:[],onSubmit:(f,C)=>$.mutate({ids:[e],targetUserId:f,durationMinutes:C,reassign:!0},{onSuccess:()=>O(!1)}),isPending:$.isPending}),t.jsx(pn,{open:T,onClose:()=>_(!1),onConfirm:Hs,isPending:M.isPending,error:M.error,actionLabel:typeof et.cancel=="string"?et.cancel:void 0}),t.jsx(Bn,{escalationId:e}),t.jsx(va,{open:!!ot,verb:(ot==null?void 0:ot.verb)??"submit",claimantId:a.assigned_to,wrongBadgeName:o&&o.actorId!==a.assigned_to?o.displayName:null,onCancel:()=>Qt(null)}),t.jsx(Na,{open:!!tt||Os,message:(tt==null?void 0:tt.message)??((Le=es(J))==null?void 0:Le.message)??"Starting…"}),lt&&!ct&&a.assigned_until&&t.jsx(Kr,{open:Is.expiringSoon&&a.assigned_until!==Ss,assignedUntil:a.assigned_until,onClose:()=>Ms(a.assigned_until??null),onExtend:te,isPending:g.isPending})]})}export{Ha as EscalationDetailPage};
|
|
3
|
+
//# sourceMappingURL=index-8LIpvj2e.js.map
|