@hotmeshio/long-tail 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/escalations/claim.d.ts +4 -1
- package/build/api/escalations/claim.js +6 -2
- package/build/index.js +4 -0
- package/build/routes/escalations/single.js +3 -1
- package/build/sdk/index.d.ts +1 -0
- package/build/services/escalation/crud.d.ts +10 -2
- package/build/services/escalation/crud.js +20 -12
- package/dashboard/dist/assets/{AdminDashboard-DeZsR4pA.js → AdminDashboard-C4h1R-lz.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-DeZsR4pA.js.map → AdminDashboard-C4h1R-lz.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-Bi5ZAsjf.js → AgentConfigPage-EWC8VQ7R.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-Bi5ZAsjf.js.map → AgentConfigPage-EWC8VQ7R.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-CIbKor5E.js → AgentDetailPage-DaLfa80d.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-CIbKor5E.js.map → AgentDetailPage-DaLfa80d.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-CRFZ6KDu.js → AgentsPage-islj_zrh.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-CRFZ6KDu.js.map → AgentsPage-islj_zrh.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-DDsmXjpi.js → AvailableEscalationsPage-B8NjwwKQ.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-DDsmXjpi.js.map → AvailableEscalationsPage-B8NjwwKQ.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-dUpw1wW6.js → BotPicker-CnX8xfka.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-dUpw1wW6.js.map → BotPicker-CnX8xfka.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-Ca2jEln-.js → CapabilitiesPage-DK7wGMFt.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-Ca2jEln-.js.map → CapabilitiesPage-DK7wGMFt.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BXlR5QmW.js → CollapsibleSection-WqEpMTyx.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BXlR5QmW.js.map → CollapsibleSection-WqEpMTyx.js.map} +1 -1
- package/dashboard/dist/assets/{CountdownTimer-rnoWmFqx.js → CountdownTimer-BvQw_3WJ.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-rnoWmFqx.js.map → CountdownTimer-BvQw_3WJ.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CGyCCzGh.js → CredentialsPage-CfT60FiU.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CGyCCzGh.js.map → CredentialsPage-CfT60FiU.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CAu2hmQf.js → CronLabel-ds7dLz6S.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CAu2hmQf.js.map → CronLabel-ds7dLz6S.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-hlnadaFt.js → CustomDurationPicker-D-iY1f4n.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-hlnadaFt.js.map → CustomDurationPicker-D-iY1f4n.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-B1eoCzEw.js → ElapsedCell-DRQhFky_.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-B1eoCzEw.js.map → ElapsedCell-DRQhFky_.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-CIOyjwjM.js → EntityTimelinePanel-nCgWdmpK.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-CIOyjwjM.js.map → EntityTimelinePanel-nCgWdmpK.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-DQNQ7o_4.js → EscalationListSchemaPage-DBCnPMG9.js} +2 -2
- package/dashboard/dist/assets/{EscalationListSchemaPage-DQNQ7o_4.js.map → EscalationListSchemaPage-DBCnPMG9.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-DFgDn4R3.js → EscalationSchemaPage-DfzRTqhV.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-DFgDn4R3.js.map → EscalationSchemaPage-DfzRTqhV.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-DfbKtXVZ.js → EscalationsOverview-CWd2Ivso.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-DfbKtXVZ.js.map → EscalationsOverview-CWd2Ivso.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CZPkvhao.js → EventTable-Dm9Fbab1.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CZPkvhao.js.map → EventTable-Dm9Fbab1.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CYjKK9Cp.js → FilterBar-DR4cJvTB.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CYjKK9Cp.js.map → FilterBar-DR4cJvTB.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-DY9u42vt.js → GraphInvokePage-DQt64Ru0.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-DY9u42vt.js.map → GraphInvokePage-DQt64Ru0.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-p_CYlGnh.js → HomePage-D7qNiqtw.js} +2 -2
- package/dashboard/dist/assets/{HomePage-p_CYlGnh.js.map → HomePage-D7qNiqtw.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-Dz-1RXSH.js → ListToolbar-BdZkpRMo.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-Dz-1RXSH.js.map → ListToolbar-BdZkpRMo.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-BUI9sVTk.js → McpOverview-DHAEYY1b.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-BUI9sVTk.js.map → McpOverview-DHAEYY1b.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-CVN_UAB3.js → McpQueryDetailPage-BfGhRO_c.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-CVN_UAB3.js.map → McpQueryDetailPage-BfGhRO_c.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-DRTKSPDR.js → McpQueryPage-3EXLX1Eq.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-DRTKSPDR.js.map → McpQueryPage-3EXLX1Eq.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CTb1AxR3.js → McpRunDetailPage-DHI0F65P.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CTb1AxR3.js.map → McpRunDetailPage-DHI0F65P.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BWLwjVd0.js → McpRunsPage-C6-KpYCY.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BWLwjVd0.js.map → McpRunsPage-C6-KpYCY.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BSl_oUAJ.js → OperationsPage-BNW7uris.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-BSl_oUAJ.js.map → OperationsPage-BNW7uris.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-DGs9kPOZ.js → OperatorDashboard-DLp9gCTA.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-DGs9kPOZ.js.map → OperatorDashboard-DLp9gCTA.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-C33MgXUY.js → PersonaDetailPage-DFv4Zwmq.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-C33MgXUY.js.map → PersonaDetailPage-DFv4Zwmq.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-BbLOHq5X.js → PersonasPage-C52o87Zv.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-BbLOHq5X.js.map → PersonasPage-C52o87Zv.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-zwd0HCJl.js → ProcessDetailPage-CKCxXogl.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-zwd0HCJl.js.map → ProcessDetailPage-CKCxXogl.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-DnfmK6jf.js → ProcessesListPage-D1bxIy7-.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-DnfmK6jf.js.map → ProcessesListPage-D1bxIy7-.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-axZtFPC_.js → RoleDetailPage-_MrbOGW_.js} +2 -2
- package/dashboard/dist/assets/{RoleDetailPage-axZtFPC_.js.map → RoleDetailPage-_MrbOGW_.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-DN6yqH7-.js → RolesPage-ZVCkB4iF.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-DN6yqH7-.js.map → RolesPage-ZVCkB4iF.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DrGsUhL8.js → RunAsSelector-BAqa1Tya.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DrGsUhL8.js.map → RunAsSelector-BAqa1Tya.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-BmQjEyWZ.js → ScanCodesPage-b7WkFiy-.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-BmQjEyWZ.js.map → ScanCodesPage-b7WkFiy-.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-VODehqGs.js → ScanSchemeDetailPage-BCsEgS-s.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-VODehqGs.js.map → ScanSchemeDetailPage-BCsEgS-s.js.map} +1 -1
- package/dashboard/dist/assets/ScanStationPage-CPC9CdCR.js +2 -0
- package/dashboard/dist/assets/ScanStationPage-CPC9CdCR.js.map +1 -0
- package/dashboard/dist/assets/{StickyPagination-9VkHiOsT.js → StickyPagination-CgSzarlP.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-9VkHiOsT.js.map → StickyPagination-CgSzarlP.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-C37J6Qyz.js → StreamMessageDetail-B4E3S5RB.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-C37J6Qyz.js.map → StreamMessageDetail-B4E3S5RB.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-NVGsBIX-.js → SwimlaneTimeline-BkcjucMZ.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-NVGsBIX-.js.map → SwimlaneTimeline-BkcjucMZ.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-5sbMHi5U.js → TaskDetailPage-D7e8x2gX.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-5sbMHi5U.js.map → TaskDetailPage-D7e8x2gX.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-C9AN7IBb.js → TasksListPage-B4mxP9Ey.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-C9AN7IBb.js.map → TasksListPage-B4mxP9Ey.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-CsbQGlSd.js → TimeAgo-D6sbYsUO.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-CsbQGlSd.js.map → TimeAgo-D6sbYsUO.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-DlbIkV-G.js → TimestampCell-DFDf3NAT.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-DlbIkV-G.js.map → TimestampCell-DFDf3NAT.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BKbLocvr.js → ToolTestPanel-DbWw0-Le.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BKbLocvr.js.map → ToolTestPanel-DbWw0-Le.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-fOnTfDso.js → TopicDetailPage-C6CPcvuO.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-fOnTfDso.js.map → TopicDetailPage-C6CPcvuO.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-BoVkp7DM.js → TopicsPage-C8_XpeT2.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-BoVkp7DM.js.map → TopicsPage-C8_XpeT2.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-0gjVPU_U.js → UserName-CIoJvf_e.js} +2 -2
- package/dashboard/dist/assets/{UserName-0gjVPU_U.js.map → UserName-CIoJvf_e.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-B28OxTS_.js → WorkflowExecutionPage-Bq3kSkRr.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-B28OxTS_.js.map → WorkflowExecutionPage-Bq3kSkRr.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-Bzvz6tTY.js → WorkflowsDashboard-y2L_zwnf.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-Bzvz6tTY.js.map → WorkflowsDashboard-y2L_zwnf.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-BkcRU4Ej.js → WorkflowsOverview-ChE1Mm3P.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-BkcRU4Ej.js.map → WorkflowsOverview-ChE1Mm3P.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmM78sYi.js → YamlWorkflowDetailPage-D0aY_inb.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmM78sYi.js.map → YamlWorkflowDetailPage-D0aY_inb.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-Dp6vG1au.js → YamlWorkflowsPage-DJ0JitPs.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-Dp6vG1au.js.map → YamlWorkflowsPage-DJ0JitPs.js.map} +1 -1
- package/dashboard/dist/assets/{agents-MeqzOPD6.js → agents-Bu5Ly_ER.js} +2 -2
- package/dashboard/dist/assets/{agents-MeqzOPD6.js.map → agents-Bu5Ly_ER.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DTGXnvX_.js → bots-Cb14wZ1Y.js} +2 -2
- package/dashboard/dist/assets/{bots-DTGXnvX_.js.map → bots-Cb14wZ1Y.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-BjlARR7F.js → capabilities-DeHLk9JJ.js} +2 -2
- package/dashboard/dist/assets/{capabilities-BjlARR7F.js.map → capabilities-DeHLk9JJ.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-DMYI0OaL.js → controlplane-YBZ3SbA6.js} +2 -2
- package/dashboard/dist/assets/{controlplane-DMYI0OaL.js.map → controlplane-YBZ3SbA6.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-BMO_H3cb.js → escalation-columns-CA9DQlhA.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-BMO_H3cb.js.map → escalation-columns-CA9DQlhA.js.map} +1 -1
- package/dashboard/dist/assets/{index-Ch-OS1pk.js → index-B0qNe7Ux.js} +2 -2
- package/dashboard/dist/assets/{index-Ch-OS1pk.js.map → index-B0qNe7Ux.js.map} +1 -1
- package/dashboard/dist/assets/{index-CGCD5hTX.js → index-B4Nea96C.js} +2 -2
- package/dashboard/dist/assets/{index-CGCD5hTX.js.map → index-B4Nea96C.js.map} +1 -1
- package/dashboard/dist/assets/{index-B3FzpDEG.js → index-B7fE-rND.js} +2 -2
- package/dashboard/dist/assets/{index-B3FzpDEG.js.map → index-B7fE-rND.js.map} +1 -1
- package/dashboard/dist/assets/{index-DuhqzYwC.js → index-BAKroiNw.js} +2 -2
- package/dashboard/dist/assets/{index-DuhqzYwC.js.map → index-BAKroiNw.js.map} +1 -1
- package/dashboard/dist/assets/{index-k5vcLICm.js → index-BRmgxeZM.js} +2 -2
- package/dashboard/dist/assets/{index-k5vcLICm.js.map → index-BRmgxeZM.js.map} +1 -1
- package/dashboard/dist/assets/{index-3QEnMBNG.js → index-BaDimDGQ.js} +2 -2
- package/dashboard/dist/assets/{index-3QEnMBNG.js.map → index-BaDimDGQ.js.map} +1 -1
- package/dashboard/dist/assets/{index-DuyzcDuV.js → index-BhurEB5s.js} +2 -2
- package/dashboard/dist/assets/{index-DuyzcDuV.js.map → index-BhurEB5s.js.map} +1 -1
- package/dashboard/dist/assets/{index-D3iDAWK2.js → index-CQriisJy.js} +2 -2
- package/dashboard/dist/assets/{index-D3iDAWK2.js.map → index-CQriisJy.js.map} +1 -1
- package/dashboard/dist/assets/{index-CkkOh8y9.js → index-D5MSJsiW.js} +2 -2
- package/dashboard/dist/assets/{index-CkkOh8y9.js.map → index-D5MSJsiW.js.map} +1 -1
- package/dashboard/dist/assets/{index-BU4oujVO.js → index-Ntul2ZC1.js} +3 -3
- package/dashboard/dist/assets/{index-BU4oujVO.js.map → index-Ntul2ZC1.js.map} +1 -1
- package/dashboard/dist/assets/{index-D6kXz3H8.js → index-YUv7aNb4.js} +2 -2
- package/dashboard/dist/assets/{index-D6kXz3H8.js.map → index-YUv7aNb4.js.map} +1 -1
- package/dashboard/dist/assets/{index-Dsgqxdyh.js → index-chMUPSOd.js} +2 -2
- package/dashboard/dist/assets/{index-Dsgqxdyh.js.map → index-chMUPSOd.js.map} +1 -1
- package/dashboard/dist/assets/index-uWUJXqGS.js +3 -0
- package/dashboard/dist/assets/index-uWUJXqGS.js.map +1 -0
- package/dashboard/dist/assets/{knowledge-DAV1Jy7b.js → knowledge-B1HqYuB2.js} +2 -2
- package/dashboard/dist/assets/{knowledge-DAV1Jy7b.js.map → knowledge-B1HqYuB2.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CivbxL1P.js → mcp-dhihqJpH.js} +2 -2
- package/dashboard/dist/assets/{mcp-CivbxL1P.js.map → mcp-dhihqJpH.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CGvWNrgo.js → mcp-query-B_gkB7JK.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CGvWNrgo.js.map → mcp-query-B_gkB7JK.js.map} +1 -1
- package/dashboard/dist/assets/metadata-display-DHjqWkLG.js +2 -0
- package/dashboard/dist/assets/metadata-display-DHjqWkLG.js.map +1 -0
- package/dashboard/dist/assets/{personas-lI3aUr6t.js → personas-Bw_OlfI6.js} +2 -2
- package/dashboard/dist/assets/{personas-lI3aUr6t.js.map → personas-Bw_OlfI6.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DjPfnTmx.js → pipelines-BYwn0LXY.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DjPfnTmx.js.map → pipelines-BYwn0LXY.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-Co_S55BO.js → tasks-t6bPmJ7P.js} +2 -2
- package/dashboard/dist/assets/{tasks-Co_S55BO.js.map → tasks-t6bPmJ7P.js.map} +1 -1
- package/dashboard/dist/assets/{topics-2IGhZXBi.js → topics-Bgo9xw80.js} +2 -2
- package/dashboard/dist/assets/{topics-2IGhZXBi.js.map → topics-Bgo9xw80.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-D0C5yke4.js → useEventHooks-BJbMbg_h.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-D0C5yke4.js.map → useEventHooks-BJbMbg_h.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-LG52DTT-.js → useNamespace-CaXJuSFG.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-LG52DTT-.js.map → useNamespace-CaXJuSFG.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-1IZGVpWC.js → useYamlActivityEvents-B47LQrDk.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-1IZGVpWC.js.map → useYamlActivityEvents-B47LQrDk.js.map} +1 -1
- package/dashboard/dist/assets/{users-C-eHT1i6.js → users-D0jvzUqW.js} +2 -2
- package/dashboard/dist/assets/{users-C-eHT1i6.js.map → users-D0jvzUqW.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-C16CeY4e.js → workflows-DRoZRrMH.js} +2 -2
- package/dashboard/dist/assets/{workflows-C16CeY4e.js.map → workflows-DRoZRrMH.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-BBenayT9.js → yaml-workflows-BdhYyIef.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-BBenayT9.js.map → yaml-workflows-BdhYyIef.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/docs/api/http/escalations.md +5 -1
- package/docs/hitl/iframe.md +56 -6
- package/package.json +1 -1
- package/dashboard/dist/assets/ScanStationPage-Y-9Gs7t5.js +0 -2
- package/dashboard/dist/assets/ScanStationPage-Y-9Gs7t5.js.map +0 -1
- package/dashboard/dist/assets/index-LF1gEc6w.js +0 -3
- package/dashboard/dist/assets/index-LF1gEc6w.js.map +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{b as Pe,a as m,j as t}from"./vendor-query-RUZdMvN6.js";import{X as ws,Y as mt,g as ht,R as Vt,Z as $t,J as _t,c as ks,d as _s,P as st,b as Jt,n as ke,_ as Ut,$ as We,V as te,m as ee,Q as Fe,j as qe,a0 as Cs,a1 as Es,i as As,a2 as Ts,a3 as Rs,u as Os,x as Is,l as Ms,a4 as Ds}from"./index-BU4oujVO.js";import{u as Ve,C as Je,a as Ss}from"./CustomDurationPicker-hlnadaFt.js";import{M as Ue}from"./Modal-BU7No9NH.js";import{a as He,u as se,L as gt,b as $s,e as Ls}from"./vendor-react-CdqEC2zv.js";import{P as Ps}from"./PageHeader-BpeBHqyc.js";import{L as Ws}from"./ListToolbar-Dz-1RXSH.js";import{i as St,b as Fs,d as qs,C as Lt,H as Vs,g as ne,m as Js,c as nt,r as re,s as Us,e as ze}from"./CountdownTimer-rnoWmFqx.js";import{u as Hs}from"./workflows-C16CeY4e.js";import{g as zs}from"./useEventHooks-D0C5yke4.js";import{S as Be}from"./StatusBadge-DkgllZHv.js";import{R as Bs}from"./RolePill-EocCXZh0.js";import{C as it}from"./CopyableId-4Lqlc5cU.js";import{U as Xe}from"./UserName-0gjVPU_U.js";import{a2 as Ge,J as Xs,S as Gs,at as Qs,_ as Ys,o as Zs,af as Qe,U as Ks,ai as tn,aj as en,a8 as sn,au as nn,av as rn,aw as Qt,ax as an,ay as _e,az as on,K as Ce,O as Ee,aA as ln,X as cn}from"./vendor-icons-BPsNpK3Y.js";import"./constants-BHkpVaqx.js";import"./DataTable-Bir0Xs1p.js";import"./EmptyState-lpUFYfun.js";import"./StickyPagination-9VkHiOsT.js";import"./users-C-eHT1i6.js";const dn={SCHEMA_VALIDATION:"schema_validation"};function un(e){return typeof e=="object"&&e!==null&&e.code===dn.SCHEMA_VALIDATION&&Array.isArray(e.violations)}function xn({escalationId:e}){var f;const s=He(),r=se(),n=Pe(),i=(f=s.state)==null?void 0:f[ws],[o,d]=m.useState(!1),[c,a]=m.useState(null),[x,l]=m.useState(!1);if(!i||i.escalationId!==e||x)return null;const u=()=>{l(!0),r(s.pathname,{replace:!0,state:null})},p=async()=>{var N,g,b;d(!0),a(null);try{switch(i.verb){case mt.CANCEL:await ht(`/escalations/${e}/cancel`,{method:"POST"});break;case mt.CLAIM:case mt.CLAIM_SHOW_DETAIL:await ht(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:((N=i.params)==null?void 0:N.durationMinutes)??30})});break;case mt.RELEASE:await ht(`/escalations/${e}/release`,{method:"POST"});break;case mt.RESOLVE:await ht(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:((g=i.params)==null?void 0:g.resolverPayload)??{}})});break;case mt.ESCALATE:await ht(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:(b=i.params)==null?void 0:b.targetRole})});break;default:throw new Error(`Unsupported confirm verb "${i.verb}"`)}n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),u()}catch(y){a(y.message)}finally{d(!1)}};return t.jsx(Ue,{open:!0,onClose:u,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}),c&&t.jsx("p",{className:"text-xs text-status-error",children:c}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:u,disabled:o,className:"btn-secondary text-xs",children:"No, go back"}),t.jsx("button",{onClick:p,disabled:o,className:"btn-primary text-xs",children:o?"Working…":"Yes, continue"})]})]})})}const Dt={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))"},Ht=4;function Ae({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}),d=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:[d,o]}):t.jsxs(t.Fragment,{children:[o,d]})})}function pn({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",d=i||o,c=St(e),a=!!n&&(c||d),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),u=a&&n?Math.max(n-r,0):l,p=a&&n?Math.max(x-n,0):0,f=Math.min(100,Math.max(0,u/l*100)),N=a?Math.max(0,100-f):0,g=i?Dt.resolved:o?Dt.cancelled:Dt.claimed,b=i?"Resolved after":o?"Cancelled after":"In progress",y=Vt(u),_=Vt(l),h=i?`Resolved in ${_} total`:o?`Cancelled after ${_}`:`Open ${_} so far`,C=`Lifecycle bar: blue = time waiting to be claimed, ${i?"green":o?"red":"orange"} = ${b.toLowerCase()} the claim.`;return t.jsxs("div",{className:s,title:C,children:[t.jsx("div",{className:"relative h-2.5 font-mono",children:a&&t.jsx(Ae,{pct:f,place:"above",label:y,title:`Time to claim: ${y}`})}),t.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:Ht,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:C,children:[t.jsx("div",{style:{width:`${f}%`,minWidth:Ht,backgroundColor:Dt.pending,opacity:.75},title:`Waiting ${y} — created → claimed`}),a&&N>0&&t.jsx("div",{style:{width:`${N}%`,minWidth:Ht,backgroundColor:g,opacity:.75},title:`${b} ${Vt(p)}`})]}),t.jsx("div",{className:"relative h-2.5 font-mono",children:t.jsx(Ae,{pct:100,place:"below",emphasis:!0,label:_,title:h})})]})}function mn({triage:e,payload:s}){const r=e.confidence??0,n=r>=.8?"text-status-success":r>=.5?"text-status-pending":"text-status-error",i=fn(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,d)=>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]},d))}),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(hn,{diff:o},o.key))})]})}function fn(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 hn({diff:e}){const s=Te(e.original),r=Te(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 Te(e){return e==null?"null":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):null}function Q(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=>gn(i)?i:i.charAt(0).toUpperCase()+i.slice(1)).join(" ")}function gn(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"},Ye="lt:escalation:panel:view";function bn(e){try{const s=localStorage.getItem(Ye);if(s&&e.includes(s))return s}catch{}return B.HELP}const jn=new Set(["form_schema"]);function yn({metadata:e,role:s}){const r=Object.entries(e??{}).filter(([n])=>!n.startsWith("_")&&!jn.has(n));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),d=ke(n,i,s),c=ke(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:Q(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(gt,{to:d,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(tn,{className:"w-3 h-3"})}),t.jsx(gt,{to:c,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(en,{className:"w-3 h-3"})})]})]},n)})})}function Nn({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(st,{label:"Status",children:t.jsx(Be,{status:e.status})}),t.jsx(st,{label:"Assigned to Role",children:t.jsx(Bs,{role:e.role,size:"md"})}),t.jsxs(st,{label:"Priority",children:["P",e.priority]}),(s||r)&&e.assigned_to&&t.jsx(st,{label:"Claimed By",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[t.jsx(Ks,{className:"w-3 h-3 shrink-0 text-accent/75"}),t.jsx(Xe,{userId:e.assigned_to})]})}),t.jsx(st,{label:"Created",children:t.jsx(Jt,{date:e.created_at})}),(s||r)&&e.claimed_at&&t.jsx(st,{label:"Claimed",children:t.jsx(Jt,{date:e.claimed_at})}),s&&!r&&e.assigned_until&&t.jsx(st,{label:"Time Remaining",children:t.jsx(Lt,{until:e.assigned_until})}),e.resolved_at&&t.jsx(st,{label:"Completed",children:t.jsx("span",{className:"text-status-success",children:t.jsx(Jt,{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(it,{label:"Escalation ID",value:e.id}),e.task_id&&t.jsx(it,{label:"Task ID",value:e.task_id,href:`/workflows/tasks/detail/${e.task_id}`}),e.workflow_type&&t.jsx(it,{label:"Workflow Name",value:e.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(e.workflow_type)}`}),e.workflow_id&&t.jsx(it,{label:"Workflow ID",value:e.workflow_id,href:`/workflows/executions/${e.workflow_id}`}),e.task_queue&&t.jsx(it,{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(it,{label:"Origin",value:e.origin_id,href:`/processes/detail/${e.origin_id}`}),e.trace_id&&t.jsx(it,{label:"Trace",value:e.trace_id,href:i?i.replace("{traceId}",e.trace_id):void 0,external:!0})]})]})]})}function vn({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(Qe,{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:Q(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 wn({esc:e,schema:s,envelope:r,payload:n,resolver:i,triage:o,hasAI:d,claimed:c,claimedByMe:a,isTerminal:x,isBuilder:l,traceUrl:u,open:p,noGutter:f,formErrors:N,activePanel:g,onPanelChange:b}){const y=se(),_=Object.values(B),[h,C]=m.useState(()=>bn(_)),T=g??h,S=m.useCallback(E=>{try{localStorage.setItem(Ye,E)}catch{}C(E),b==null||b(E)},[b]);m.useEffect(()=>{g&&g!==h&&C(g)},[g]);const L=m.useMemo(()=>Fs(s,{escalation:e,metadata:e.metadata??null,envelope:r,payload:n,resolver:i})??qs({isTerminal:x,status:e.status,claimed:c,claimedByMe:a}),[s,e,r,n,i,x,c,a]),R=m.useCallback(E=>{const A=E.target.closest("a"),$=A==null?void 0:A.getAttribute("href");$!=null&&$.startsWith("/")&&(E.preventDefault(),y($))},[y]),k=[{id:B.HELP,icon:Ge,label:"Instructions",content:t.jsx($t,{content:L,onClick:R})},{id:B.DETAILS,icon:Xs,label:"Details",content:t.jsx(Nn,{esc:e,claimed:c,isTerminal:x,isBuilder:l,traceUrl:u})},...d&&o?[{id:B.TRIAGE,icon:Gs,label:"AI Analysis",content:t.jsx(mn,{triage:o,payload:n??{}})}]:[],{id:B.METADATA,icon:Qs,label:"Metadata",content:t.jsx(yn,{metadata:e.metadata,role:e.role})},{id:B.CONTEXT,icon:Ys,label:"Context",content:t.jsxs("div",{className:"space-y-5",children:[r!=null&&t.jsx(_t,{data:r,label:"Input Envelope"}),n!=null&&t.jsx(_t,{data:n,label:"Escalation Context"}),i!=null&&t.jsx(_t,{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:Zs,label:"Record",content:t.jsx(_t,{data:e,label:"Escalation Record"})}]:[],...N&&N.length>0?[{id:B.ERRORS,icon:(({className:E})=>t.jsx(Qe,{className:`${E??""} text-status-error`})),label:"Errors",content:t.jsx(vn,{errors:N,schema:s})}]:[]];return t.jsx(ks,{open:p,width:384,className:"h-full",children:t.jsx("div",{className:`h-full${f?"":" 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(pn,{esc:e,className:"w-[80%]"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(_s,{views:k,activeId:T,onViewChange:S,stickyClassName:"h-full min-h-0"})})]})})})}function kn(e,s){if(typeof e!="string"||!s)return[];const r=e.indexOf(".");if(r===-1)return[];const n=s[e.slice(0,r)];if(!n||typeof n!="object")return[];let i=n;for(const o of e.slice(r+1).split("."))if(i=i[o],i===void 0)return[];return Array.isArray(i)?i:[]}function _n(e,s,r){if((s==null?void 0:s["x-lt-widget"])!=="checklist"||s["x-lt-require-all"]!==!0)return;const i=kn(s["x-lt-source"],r).filter(c=>c.required!==!1);if(i.length===0)return;const o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},d=i.filter(c=>!o[c.id]).length;if(d!==0)return`${d} of ${i.length} checks incomplete`}function Cn(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 En(e,s,r){if(!s)return;const n=s.enum;if(Array.isArray(n)&&n.length>0&&e!==void 0&&e!==null&&e!==""&&!n.includes(e))return`Must be one of: ${n.map(i=>String(i)).join(", ")}`;if(typeof e=="string"){const i=e.trim();if(i==="")return;const o=ft(s.minLength,s["x-lt-min-length"],r);if(o!==void 0&&i.length<o)return`Minimum ${o} character${o===1?"":"s"}`;const d=ft(s.maxLength,s["x-lt-max-length"],r);if(d!==void 0&&i.length>d)return`Maximum ${d} characters (${i.length} entered)`;const c=s.pattern;if(c)try{if(!new RegExp(c).test(i))return s["x-lt-pattern-error"]??"Invalid format"}catch{}const a=s.format;if(a==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i))return"Enter a valid email address";if(a==="uri"&&!/^https?:\/\/.+/.test(i))return"Enter a valid URL"}if(typeof e=="number"){const i=ft(s.minimum,s["x-lt-minimum"],r),o=ft(s.exclusiveMinimum,void 0,r),d=ft(s.maximum,s["x-lt-maximum"],r),c=ft(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(d!==void 0&&e>d)return`Maximum value is ${d}`;if(c!==void 0&&e>=c)return`Must be less than ${c}`}}function ft(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),d=r[i];if(d&&typeof d=="object"){const c=o.split(".");let a=d;for(const x of c)if(a=a[x],a===void 0)break;if(typeof a=="number")return a;if(typeof a=="string"){const x=Number(a);if(!Number.isNaN(x))return x}}}}}function Ze(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 c=Object.values(e);if(c.length===0||c.every(a=>!a))return"Required"}}const o=Cn(e,s);if(o)return o;const d=_n(e,s,i);return d||En(e,s,i)}function Re(e){return e!=null&&e!==""&&e!==!1&&e!==0}function An(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function Oe(e,s){const r=e.indexOf("."),n=r===-1?e:e.slice(0,r);if(!Vs.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:ne(i,e.slice(r+1))}}catch{return{known:!0,value:void 0}}}function Yt(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 a=i!==-1&&(o===-1||i<o),x=a?i:o,l=n.slice(0,x).trim(),u=n.slice(x+(a?2:1)).trim(),{known:p,value:f}=Oe(l,s);if(!p)return!0;const N=An(f)===u,g=a?!N:N;return r?!g:g}const{known:d,value:c}=Oe(n,s);return d?r?!Re(c):Re(c):!0}const Tn="x-lt-require-any";function Rn(e){const s=e==null?void 0:e[Tn];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 On(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}function Ke(e,s,r){if(!e)return[];const n=e.properties??{},i=new Set(e.required??[]),o={...r??{},resolver:s},d=[];for(const[c,a]of Object.entries(n)){if(!Yt(a["x-lt-showIf"],o))continue;const x=Ze(s[c],a,i.has(c),!0,o);x&&d.push({field:c,message:x})}for(const c of Rn(e)){const a=c.filter(l=>n[l]&&Yt(n[l]["x-lt-showIf"],o));if(a.length===0||a.some(l=>On(s[l])))continue;const x=a.map(l=>n[l].title??l);d.push({field:a[0],message:`Enter a value for at least one of: ${x.join(", ")}`})}return d}function Zt(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 d=Ke(n,r,s);if(d.length>0)return{payload:null,errors:d,parseError:null}}const{_form_schema:i,...o}=r;return{payload:Js(o,n),errors:[],parseError:null}}function In(e){const{mode:s,activeView:r,onActiveViewChange:n,onClaim:i,claimPending:o,claimNudge:d,workflowType:c,json:a,onResolve:x,resolvePending:l,resolveError:u,requestTriage:p,triageNotes:f,onRelease:N,releasePending:g,onCancel:b,assignedTo:y,assignedUntil:_,onSubmitAttempt:h,onValidationErrors:C,escalationContext:T,labels:S={},submitBlocked:L,submitBlockedMessage:R,actingName:k,badgePrompt:E}=e,A=Ve(),[$,q]=m.useState("30"),[P,J]=m.useState(0),[Y,V]=m.useState(""),v=$==="custom",O=m.useCallback(D=>J(D),[]),w=!!L&&!p;if(s==="terminal")return null;const M=()=>{const D=v?P:parseInt($);!D||D<=0||i(D)},F=()=>{if(V(""),p){const H={_lt:{needsTriage:!0}};f.trim()&&(H.notes=f.trim()),x(H);return}const D=Zt(a,T);if(D.parseError){V(D.parseError);return}if(D.errors.length>0){h==null||h(),C==null||C(D.errors);return}x(D.payload)},Z=D=>`text-xs transition-colors ${D?"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:[A.map(D=>t.jsx("button",{onClick:()=>{q(D.value),J(0)},className:Z(!v&&$===D.value),children:D.label},D.value)),t.jsx("button",{onClick:()=>q("custom"),className:Z(v),children:"Other"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[S.cancel!==!1&&t.jsx("button",{onClick:b,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:S.cancel??"Cancel escalation"}),t.jsx("div",{className:"flex-1"}),v&&t.jsx(Je,{onChange:O,compact:!0,autoFocus:!0}),t.jsx("button",{onClick:M,disabled:o||v&&P<=0,className:`btn-primary text-xs ${d?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:o?"Claiming...":S.claim??"Claim"},d)]})]}),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:y?t.jsx(Xe,{userId:y}):"unknown"})]}),_&&t.jsx(Lt,{until:_}),u&&t.jsx("span",{className:"text-xs text-status-error",children:u.message}),E&&t.jsx("p",{className:"text-xs text-text-tertiary","data-testid":"badge-prompt",children:"If this is your claim, scan your badge."})]}),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:Z(r==="resolve"),children:c?"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:S.release??"Release"}),S.cancel!==!1&&t.jsx("button",{onClick:b,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:S.cancel??"Cancel"})]}),r==="resolve"&&t.jsxs("div",{className:"flex items-center gap-4",children:[k&&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:["(",k,")"]})]}),k&&_&&t.jsx(Lt,{until:_}),t.jsx("div",{className:"flex-1"}),Y&&t.jsx("span",{className:"text-xs text-status-error",children:Y}),u&&t.jsx("span",{className:"text-xs text-status-error",children:u.message}),w&&R&&t.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:R}),t.jsx("button",{onClick:F,disabled:l||w,className:"btn-primary text-xs",children:l?c?"Submitting...":"Acknowledging...":p?"Send to Triage":S.submit??(c?"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:N,disabled:g,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:g?"Releasing...":"Yes, Release"})]})]})]})}function zt({children:e}){return t.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:e})}function Mn({payload:e,isTerminal:s,resolverPayload:r,onRetryTriage:n,isRetrying:i}){const o=e.title,d=e.summary,c=e.diagnosis,a=e.tool_calls_made,x=e.result,l=r==null?void 0:r._lt,u=(l==null?void 0:l.triaged)===!0,p=l==null?void 0:l.triageWorkflowId,f=s&&u,[N,g]=m.useState(!1);return f?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 a=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[a," 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(zt,{children:"Triage diagnosis"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Ut,{content:c})})]}),t.jsx("div",{className:"flex items-center gap-3",children:p&&t.jsx(gt,{to:`/workflows/executions/${p}`,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 a=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[a," 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(zt,{children:"What happened"}),t.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.jsx(Ut,{content:d})})]}),c&&t.jsxs("div",{children:[t.jsx(zt,{children:"What went wrong"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Ut,{content:c})})]}),x!=null&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>g(!N),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 ${N?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:t.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),N&&t.jsx("div",{className:"mt-2",children:t.jsx(_t,{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 Ie(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ts({src:e,escalation:s,schema:r,onResolve:n,onEscalate:i,submitAttempted:o,fill:d}){const c=m.useRef(null),a=m.useRef("");m.useEffect(()=>{try{const l=new URL(e);a.current=l.origin}catch{a.current=""}},[e]);const x=m.useCallback(()=>{const l=c.current;if(!(l!=null&&l.contentWindow)||!a.current)return;const p={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:Ie(s.envelope),metadata:s.metadata??null,escalation_payload:Ie(s.escalation_payload)},schema:r};l.contentWindow.postMessage(p,a.current)},[s,r]);return m.useEffect(()=>{const l=u=>{if(u.origin!==a.current)return;const p=u.data;if(!(!p||typeof p!="object"||typeof p.type!="string"))switch(p.type){case"lt:ready":x();break;case"lt:submit":p.payload&&typeof p.payload=="object"&&n(p.payload);break;case"lt:escalate":typeof p.target=="string"&&p.target&&i(p.target);break;case"lt:resize":{const f=c.current;f&&typeof p.height=="number"&&p.height>0&&(f.style.height=`${Math.min(p.height,2e3)}px`);break}}};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[x,n,i]),m.useEffect(()=>{if(!o)return;const l=c.current;l!=null&&l.contentWindow&&a.current&&l.contentWindow.postMessage({type:"lt:validate"},a.current)},[o]),d?t.jsx("div",{className:"absolute inset-0 overflow-hidden",children:t.jsx("iframe",{ref:c,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:c,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})})}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 ot({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 vt(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 Dn(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 Sn({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=m.useRef(null),d=(n==null?void 0:n.accept)??void 0,c=Q(e,n),a=n==null?void 0:n.description,x=m.useCallback(u=>{var N;const p=(N=u.target.files)==null?void 0:N[0];if(!p)return;const f=new FileReader;f.onload=()=>{typeof f.result=="string"&&r(f.result)},f.readAsDataURL(p)},[r]),l=s.startsWith("data:");return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:c}),a&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:a}),t.jsxs("div",{className:"mt-1",children:[t.jsx("input",{ref:o,type:"file",accept:d,onChange:x,className:"hidden"}),t.jsx("button",{type:"button",onClick:()=>{var u;return(u=o.current)==null?void 0:u.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 $n({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Q(e,n),d=n==null?void 0:n.description,c=(n==null?void 0:n["x-lt-language"])??"",a=m.useCallback(x=>{if(x.key==="Tab"){x.preventDefault();const l=x.currentTarget,u=l.selectionStart,p=l.selectionEnd,f=s.substring(0,u)+" "+s.substring(p);r(f),requestAnimationFrame(()=>{l.selectionStart=l.selectionEnd=u+2})}},[s,r]);return t.jsxs("div",{children:[t.jsxs(W,{isRequired:i,children:[o,c&&t.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:c})]}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d}),t.jsx("textarea",{value:s,onChange:x=>r(x.target.value),onKeyDown:a,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function Ln({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=m.useRef(null),[d,c]=m.useState(!1),a=Q(e,n),x=n==null?void 0:n.description;m.useEffect(()=>{const g=o.current;if(!g)return;const b=g.getContext("2d");if(b&&(b.lineWidth=2,b.lineCap="round",b.strokeStyle="#1E1535",s&&s.startsWith("data:"))){const y=new Image;y.onload=()=>b.drawImage(y,0,0),y.src=s}},[]);const l=m.useCallback(g=>{const b=o.current,y=b.getBoundingClientRect(),_=y.width>0?b.width/y.width:1,h=y.height>0?b.height/y.height:1;return"touches"in g?{x:(g.touches[0].clientX-y.left)*_,y:(g.touches[0].clientY-y.top)*h}:{x:(g.clientX-y.left)*_,y:(g.clientY-y.top)*h}},[]),u=m.useCallback(g=>{var _;c(!0);const b=(_=o.current)==null?void 0:_.getContext("2d");if(!b)return;const y=l(g);b.beginPath(),b.moveTo(y.x,y.y)},[l]),p=m.useCallback(g=>{var _;if(!d)return;const b=(_=o.current)==null?void 0:_.getContext("2d");if(!b)return;const y=l(g);b.lineTo(y.x,y.y),b.stroke()},[d,l]),f=m.useCallback(()=>{c(!1);const g=o.current;g&&r(g.toDataURL("image/png"))},[r]),N=m.useCallback(()=>{const g=o.current;if(!g)return;const b=g.getContext("2d");b&&(b.clearRect(0,0,g.width,g.height),r(""))},[r]);return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:a}),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:u,onMouseMove:p,onMouseUp:f,onMouseLeave:f,onTouchStart:u,onTouchMove:p,onTouchEnd:f})}),t.jsx("button",{type:"button",onClick:N,className:"mt-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Pn({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const o=Q(e,n),d=n==null?void 0:n.description;return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:o}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d}),t.jsx("textarea",{value:s,onChange:c=>r(c.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}function Wn({fieldKey:e,value:s,onChange:r,schema:n,isRequired:i}){const[o,d]=m.useState("write"),c=Q(e,n),a=n==null?void 0:n.description;return(n==null?void 0:n.readOnly)===!0?t.jsx($t,{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:c}),t.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(l=>t.jsx("button",{type:"button",onClick:()=>d(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))})]}),a&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:a}),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($t,{content:s}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}const Fn=28;function qn({fieldKey:e,value:s,onChange:r,schema:n,escalationContext:i,isRequired:o,submitAttempted:d,error:c}){const a=n==null?void 0:n["x-lt-source"],x=(n==null?void 0:n["x-lt-require-all"])===!0,l=[];if(a&&i){const h=a.indexOf(".");if(h!==-1){const C=a.slice(0,h),T=a.slice(h+1);try{const S=ne(i[C],T);Array.isArray(S)&&l.push(...S)}catch{}}}let u={};try{s&&(u=JSON.parse(s))}catch{}const p=h=>r(JSON.stringify({...u,[h]:!u[h]})),f=Q(e,n),N=n==null?void 0:n.description;if(l.length===0)return t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. Provide checklist_items in the escalation envelope or metadata."}),c&&t.jsx("p",{className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:c})]});const g=n==null?void 0:n["x-lt-variant"],b=g==="chips"||g==="rows"?g:x||l.some(h=>h.label.length>Fn)?"rows":"chips",y=l.filter(h=>u[h.id]).length,_=(l.find(h=>!u[h.id]&&h.required!==!1)??l[0]).id;return t.jsxs("div",{role:"group","aria-label":f,"aria-required":o||void 0,"aria-invalid":c?!0:void 0,children:[t.jsx(W,{isRequired:o,children:f}),N&&t.jsx(X,{children:N}),b==="chips"?t.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:l.map(h=>{const C=u[h.id]??!1,T=!C&&!!d&&y===0&&(h.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)] ${C?"bg-accent border-accent text-text-inverse":T?"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:C,onChange:()=>p(h.id),className:"sr-only","data-testid":`checklist-item-${h.id}`,...h.id===_?{"data-field-key":e}:{}}),C&&t.jsx(sn,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:2.5}),h.label]},h.id)})}):t.jsx("div",{className:"space-y-2.5 mt-2",children:l.map(h=>{const C=u[h.id]??!1,T=!C&&!!d&&(x?h.required!==!1:y===0&&(h.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 ${T?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[t.jsx("input",{type:"checkbox",checked:C,onChange:()=>p(h.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${T?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${h.id}`,...h.id===_?{"data-field-key":e}:{}}),t.jsxs("span",{className:`text-sm leading-snug transition-colors ${T?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[h.label,h.required&&t.jsx("span",{className:`ml-0.5 text-2xs ${T?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},h.id)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-3 tabular-nums",children:b==="chips"?t.jsxs(t.Fragment,{children:[y," selected",o&&y===0&&!!d&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(check at least one)"})]}):t.jsxs(t.Fragment,{children:[y," / ",l.length," confirmed",x?t.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",l.some(h=>h.required===!1)?" except optional":"",")"]}):o&&y===0&&!!d&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]})}),c&&t.jsx("p",{role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:c})]})}const Vn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function Jn(e){var n,i,o,d;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(Vn.test(s))return{kind:"image",src:s};const c=(d=(o=/\.([a-z0-9]{2,5})(\?.*)?$/i.exec(s))==null?void 0:o[1])==null?void 0:d.toUpperCase();return{kind:"file",href:s,label:c??"attachment",isData:!1}}return{kind:"none"}}function Me({fieldKey:e,value:s,schema:r}){const[n,i]=m.useState(!1),o=Jn(s??""),d=e.replace(/[_-]/g," "),c=r==null?void 0:r.description,a=t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:d}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c})]});return o.kind==="none"?t.jsxs("div",{children:[a,t.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):o.kind==="image"?t.jsxs("div",{children:[a,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":`${d} — full size`,children:t.jsx("img",{src:o.src,alt:d,className:"max-h-[90vh] max-w-[90vw] object-contain"})})]})]}):t.jsxs("div",{children:[a,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(nn,{className:"w-3.5 h-3.5",strokeWidth:1.5}),o.isData?`Download ${o.label}`:`Open ${o.label}`,o.isData?t.jsx(rn,{className:"w-3 h-3",strokeWidth:1.5}):t.jsx(Qt,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}function Un({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-href"])??"",i=n&&r?nt(n,r):n,o=(s==null?void 0:s.title)??(s==null?void 0:s.description)??"Open",d=s==null?void 0:s.description,c=i.startsWith("/"),a=!i.trim();return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),d&&t.jsx(X,{children:d}),t.jsx("div",{className:"mt-1",children:a?t.jsx("span",{className:"text-xs text-text-quaternary italic",children:"No link configured"}):c?t.jsxs(gt,{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(Qt,{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(Qt,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]})})]})}function es({to:e,className:s=""}){return t.jsxs(gt,{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(an,{className:"w-3.5 h-3.5",strokeWidth:2}),t.jsx("span",{className:"sr-only",children:"View details"})]})}const De="—";function Hn(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=ne(s[n],i);return typeof o=="string"?o:""}catch{return""}}function zn(e,s){if(!e||e===De)return De;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:te(e)}return e}function Bn({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",d=s==null?void 0:s.description,c=Hn(n,r),{data:a,isLoading:x,isError:l}=We(c);return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:o}),d&&t.jsx(X,{children:d}),t.jsx("div",{className:"mt-1",children:!c||l?t.jsx("p",{className:"text-xs text-text-quaternary italic","data-testid":`escalation-widget-empty-${e}`,children:"No linked record"}):x?t.jsx(Gn,{}):a?t.jsx(Xn,{esc:a,fields:i,fieldKey:e}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"No linked record"})})]})}function Xn({esc:e,fields:s,fieldKey:r}){if(!e)return null;const n=re(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(Be,{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=nt(i.value,n),d=zn(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:d})]},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," · ",te(e.created_at)]}),t.jsx(es,{to:`/escalations/detail/${e.id}`})]})]})}function Gn(){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 Qn(e,s){if(!e)return{};const r={};for(const[n,i]of Object.entries(e))r[n]=typeof i=="string"?nt(i,s):i;return r}function ss(e,s,r){const n=Qn(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 Yn=[{label:"Description",value:"{{escalation.description}}"},{label:"Role",value:"{{escalation.role}}"},{label:"Age",value:"{{escalation.created_at}}",format:"age"}],Se="—";function Zn(e,s){if(!e||e===Se)return Se;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:te(e)}return e}function Kt(e,s){return typeof e=="string"?nt(e,s):Array.isArray(e)?e.map(r=>Kt(r,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Kt(n,s)])):e}function Kn({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"])??Yn,o=(s==null?void 0:s["x-lt-actions"])??[],d=(s==null?void 0:s.title)??"Related items",c=s==null?void 0:s.description,a=r??{},{user:x}=ee(),l=ss(n,a,x==null?void 0:x.userId),{data:u,isLoading:p}=Fe({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:Us({columns:i,actions:o})?"envelope":void 0}),f=(u==null?void 0:u.escalations)??[],N=qe(),[g,b]=m.useState({}),[y,_]=m.useState(null),h=async(C,T)=>{const S=re(C);if(!(T.confirm&&!window.confirm(nt(T.confirm,S)))){_(C.id),b(L=>({...L,[C.id]:""}));try{await N.mutateAsync({id:C.id,resolverPayload:Kt(T.resolverPayload,S)})}catch(L){b(R=>({...R,[C.id]:L.message}))}finally{_(null)}}};return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:d}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1","data-testid":`escalation-list-widget-${e}`,children:p?t.jsx(er,{columns:i.length}):t.jsx(tr,{escalations:f,columns:i,fieldKey:e,actions:o,onAction:h,pendingRow:y,rowErrors:g})})]})}function tr({escalations:e,columns:s,fieldKey:r,actions:n,onAction:i,pendingRow:o,rowErrors:d}){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(c=>t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary pb-1 pr-3 last:pr-0",children:c.label},c.label)),n.length>0&&t.jsx("th",{className:"w-px"}),t.jsx("th",{className:"w-8"})]})}),t.jsx("tbody",{children:e.map(c=>{const a=re(c),x=d[c.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 u=nt(l.value,a),p=Zn(u,l.format);return t.jsx("td",{className:"py-1 pr-3 last:pr-0 text-text-primary align-top",children:p},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(c,l),disabled:o===c.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-${c.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-${c.id}`,children:x})]}),t.jsx("td",{className:"py-1 pl-2 align-top",children:t.jsx(es,{to:`/escalations/detail/${c.id}`})})]},c.id)})})]})}function er({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 Bt={"file-upload":Sn,"code-editor":$n,signature:Ln,"rich-text":Pn,markdown:Wn,checklist:qn,attachment:Me,image:Me,link:Un,escalation:Bn,"escalation-list":Kn};function ns({fieldKey:e,value:s,onChange:r,onBlur:n,schema:i,isRequired:o,isReadOnly:d,error:c,escalationContext:a,submitAttempted:x}){var L;const l=(L=i==null?void 0:i.properties)==null?void 0:L[e],u=Q(e,l),p=l==null?void 0:l["x-lt-widget"],f=`lt-field-${e}`,N=`${f}-error`,g=`${f}-help`,b=typeof(l==null?void 0:l.description)=="string"&&l.description.length>0?l.description:void 0,h={id:f,"aria-required":o||void 0,"aria-invalid":c?!0:void 0,"aria-describedby":c?N:b!==void 0?g:void 0},C=p==="markdown"&&typeof s=="string",T=(p==="attachment"||p==="image")&&typeof s=="string",S=!!(p&&p in Bt);if(d&&!C&&!T&&!S){const R=s===null?"null":typeof s=="object"?JSON.stringify(s,null,2):String(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:u}),t.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:R})]})}if(p&&p in Bt){const R=Bt[p],k=o||(l==null?void 0:l["x-lt-require-all"])===!0,E={fieldKey:e,schema:l,escalationContext:a,isRequired:k,submitAttempted:x,error:c};if((l==null?void 0:l.type)==="object"){const A=typeof s=="string"?s:typeof s=="object"&&s!==null&&!Array.isArray(s)?JSON.stringify(s):"";return t.jsx(R,{...E,value:A,onChange:$=>{try{r(JSON.parse($))}catch{r($)}}})}if(typeof s=="string")return t.jsx(R,{...E,value:s,onChange:A=>r(A)});if(typeof s=="object"&&s!==null&&!Array.isArray(s))return t.jsx(R,{...E,value:JSON.stringify(s),onChange:A=>{try{r(JSON.parse(A))}catch{r(A)}}})}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:R=>{r(R.target.checked),n==null||n()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":e,...h}),t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[u,o&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),b&&t.jsx(X,{id:g,children:b}),t.jsx(ot,{error:c,id:N})]});if(typeof s=="number")return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsx("input",{type:"number",value:s,onChange:R=>r(parseFloat(R.target.value)||0),onBlur:n,step:"any","data-field-key":e,className:`${vt(!!c)} max-w-48`,...h}),t.jsx(ot,{error:c,id:N})]});if(typeof s=="string"){const R=(l==null?void 0:l.format)==="password",k=l==null?void 0:l.enum;if(k!=null&&k.length){const q=s===""&&!k.includes("");return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsxs("select",{value:s,onChange:P=>r(P.target.value),onBlur:n,"data-field-key":e,className:Dn(!!c),...h,children:[q&&t.jsx("option",{value:"",disabled:!0,children:"Choose…"}),k.map(P=>t.jsx("option",{value:P,children:P},P))]}),t.jsx(ot,{error:c,id:N})]})}if(R)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsx("input",{type:"password",value:s,onChange:q=>r(q.target.value),onBlur:n,"data-field-key":e,className:vt(!!c),autoComplete:"off",...h}),t.jsx(ot,{error:c,id:N})]});const E=l==null?void 0:l.format,A={date:"date","date-time":"datetime-local",email:"email",uri:"url"},$={date:"max-w-48","date-time":"max-w-64"};if(E&&E in A)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsx("input",{type:A[E],value:s,onChange:q=>r(q.target.value),onBlur:n,"data-field-key":e,className:`${vt(!!c)} ${$[E]??""}`,...h}),t.jsx(ot,{error:c,id:N})]});if(E==="textarea"||s.length>80){const q=l==null?void 0:l.maxLength,P=l==null?void 0:l["x-lt-max-length"];let J=q;if(J===void 0&&P&&a){const V=P.indexOf(".");if(V!==-1){const v=P.slice(0,V),O=P.slice(V+1),w=a[v];if(w&&typeof w=="object"){let M=w;for(const F of O.split("."))if(M=M[F],M===void 0)break;if(typeof M=="number")J=M;else if(typeof M=="string"){const F=Number(M);Number.isNaN(F)||(J=F)}}}}const Y=J!==void 0&&s.length>J;return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsx("textarea",{value:s,onChange:V=>{r(V.target.value),n==null||n()},onBlur:n,"data-field-key":e,className:`${vt(!!c)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(s.length/60))),...h}),J!==void 0&&t.jsxs("p",{className:`text-2xs mt-0.5 text-right tabular-nums ${Y?"text-status-error font-medium":"text-text-quaternary"}`,children:[s.length," / ",J]}),t.jsx(ot,{error:c,id:N})]})}return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,htmlFor:f,children:u}),b&&t.jsx(X,{id:g,children:b}),t.jsx("input",{type:"text",value:s,onChange:q=>r(q.target.value),onBlur:n,"data-field-key":e,className:vt(!!c),...h}),t.jsx(ot,{error:c,id:N})]})}if(s===null)return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:u}),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:u}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.map((R,k)=>t.jsx("span",{className:"px-2 py-0.5 text-2xs font-mono bg-surface-sunken rounded text-text-secondary",children:String(R)},k))})]});if(typeof s=="object"){const R=Object.entries(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:o,children:u}),t.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:R.map(([k,E])=>t.jsx(ns,{fieldKey:k,value:E,onChange:A=>r({...s,[k]:A})},k))})]})}return null}function sr({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(m.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:nr(o)})]},n))})})}function nr(e){return e==null||e===""?"—":typeof e=="boolean"?e?"Yes":"No":typeof e=="object"?JSON.stringify(e):String(e)}const Xt="dictionary",rr=new Set(["markdown","attachment","image"]);function rs(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 ar(e,s,r){var c,a;const n=(c=e==null?void 0:e.properties)==null?void 0:c[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"&&rr.has(i))return!1;const o=n==null?void 0:n["x-lt-display"];if(typeof o=="string")return o===Xt;const d=(a=rs(e,s))==null?void 0:a.display;return typeof d=="string"?d===Xt:(e==null?void 0:e["x-lt-display"])===Xt}function ir(e,s,r,n){var o;const i=[];for(const d of e){const[c]=d,a=i[i.length-1];if(ar(s,r,c)){(a==null?void 0:a.kind)==="dictionary"?a.entries.push(d):i.push({kind:"dictionary",entries:[d]});continue}const x=(o=s==null?void 0:s.properties)==null?void 0:o[c],l=x==null?void 0:x["x-lt-column-group"];if(n==="two-column"&&typeof l=="string"&&l.trim()){(a==null?void 0:a.kind)==="column-group"&&a.name===l?a.entries.push(d):i.push({kind:"column-group",name:l,entries:[d]});continue}i.push({kind:"field",entry:d})}return i}function or({name:e,entries:s,formSchema:r,layout:n,renderField:i}){const o=ir(s,r,e,n),d=rs(r,e),c=(d==null?void 0:d.columns)??(n==="two-column"?2:1),a=l=>l.map(([u,p])=>{var f;return{key:u,label:Q(u,(f=r==null?void 0:r.properties)==null?void 0:f[u]),value:p}}),x=()=>o.map((l,u)=>l.kind==="dictionary"?t.jsx("div",{className:n==="two-column"?"col-span-full":"",children:t.jsx(sr,{items:a(l.entries),columns:c})},`dict-${u}`):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(p=>i(p))})},`group-${l.name}-${u}`):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 as({value:e,onChange:s,disabled:r,submitAttempted:n,escalationContext:i,onOpenHelp:o,onDisabledClick:d}){var Y,V;const[c,a]=m.useState({}),[x,l]=m.useState({}),[u,p]=m.useState(null),[f,N]=m.useState(!1),[g,b]=m.useState(new Set);m.useEffect(()=>{try{const v=JSON.parse(e);if(typeof v=="object"&&v!==null&&!Array.isArray(v)){const O={},w={};for(const[M,F]of Object.entries(v))M.startsWith("_")?w[M]=F:O[M]=F;a(O),l(w),p(w._form_schema&&typeof w._form_schema=="object"?w._form_schema:null),N(!1)}}catch{N(!0)}},[e]);const y=m.useCallback(v=>{a(v),s(JSON.stringify({...v,...x},null,2))},[x,s]),_=m.useCallback((v,O)=>{y({...c,[v]:O})},[c,y]),h=m.useCallback(v=>{b(O=>{if(O.has(v))return O;const w=new Set(O);return w.add(v),w})},[]);if(f)return t.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const C=Object.entries(c);if(C.length===0)return t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const T=u==null?void 0:u["x-lt-order"],S=T?[...C].sort((v,O)=>{const w=T.indexOf(v[0]),M=T.indexOf(O[0]);return(w===-1?1/0:w)-(M===-1?1/0:M)}):C,L={...i??{},resolver:c},R=S.filter(([v,O])=>{var M;const w=(M=u==null?void 0:u.properties)==null?void 0:M[v];return!(!Yt(w==null?void 0:w["x-lt-showIf"],L)||(w==null?void 0:w["x-lt-hide-if-empty"])===!0&&(O==null||O===""||O===!1||O===0))}),k=new Set((u==null?void 0:u.required)??[]),E=u==null?void 0:u["x-lt-layout"],A=u==null?void 0:u.title,$=u==null?void 0:u.description,q=typeof(u==null?void 0:u["x-lt-help"])=="string"||typeof(u==null?void 0:u["x-lt-context"])=="string",P=[];for(const v of R){const[O]=v,w=(Y=u==null?void 0:u.properties)==null?void 0:Y[O],M=((V=w==null?void 0:w["x-lt-section"])==null?void 0:V.trim())||null,F=P[P.length-1];!F||F.name!==M?P.push({name:M,entries:[v]}):F.entries.push(v)}const J=([v,O])=>{var ct;const w=(ct=u==null?void 0:u.properties)==null?void 0:ct[v],M=(w==null?void 0:w.readOnly)===!0,F=(w==null?void 0:w["x-lt-span"])??1,Z=k.has(v),D=g.has(v)||!!n,H=Ze(O,w,Z,D,L);return t.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${E==="two-column"&&F>=2?"col-span-full":""}`,children:t.jsx(ns,{fieldKey:v,value:O,onChange:Pt=>_(v,Pt),onBlur:()=>h(v),schema:u,isRequired:Z,isReadOnly:M,error:H,escalationContext:L,submitAttempted:!!n})},v)};return t.jsx("div",{className:"pb-8 max-w-form",onClick:r?d:void 0,children:t.jsxs("div",{className:r?"pointer-events-none":void 0,inert:r||void 0,"aria-disabled":r||void 0,children:[A&&t.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.jsx("h3",{className:"heading-3",children:A}),q&&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(Ge,{className:"w-4 h-4",strokeWidth:1.5})})]}),$&&t.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:$}),t.jsx("div",{className:"space-y-8",children:P.map((v,O)=>t.jsx(or,{name:v.name,entries:v.entries,formSchema:u,layout:E,renderField:J},v.name??`__s${O}`))})]})})}function lr({json:e,onJsonChange:s,requestTriage:r,onRequestTriageChange:n,triageNotes:i,onTriageNotesChange:o,disabled:d=!1,submitAttempted:c=!1,showTriage:a=!1,escalationContext:x,onOpenHelp:l,onDisabledClick:u}){return t.jsxs(t.Fragment,{children:[a&&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(as,{value:e,onChange:s,disabled:d,submitAttempted:c,escalationContext:x,onOpenHelp:l,onDisabledClick:u})}),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:p=>o(p.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 is(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 $e(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function lt(e){return{escalation:e,metadata:e.metadata??null,envelope:$e(e.envelope),payload:$e(e.escalation_payload),resolver:null}}function cr({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(Mn,{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(_e,{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(gt,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[t.jsx(_e,{size:12}),"Go to Credentials"]})]})]})]})}function dr({esc:e,resolverPayload:s,isTerminal:r,claimedByMe:n,activeView:i,metadataFormSchema:o,effectiveSchema:d,json:c,onJsonChange:a,requestTriage:x,onRequestTriageChange:l,triageNotes:u,onTriageNotesChange:p,onResolve:f,onEscalate:N,onClaim:g,submitAttempted:b,isCertified:y,hasAI:_,onOpenHelp:h,onDisabledClick:C}){const T=d,S=lt(e);if(r){if(s==null)return null;const E=typeof s=="object"&&s!==null?s:{},A=d??o,$=A!=null&&A.properties?{...ze(E,A),_form_schema:A}:E;return t.jsx("div",{className:"mt-3",children:t.jsx(as,{value:JSON.stringify($,null,2),onChange:()=>{},disabled:!0,escalationContext:S})})}if(i!=="resolve"||!(e.workflow_type||d))return null;const L=T==null?void 0:T["x-lt-viewport"],R=(L==null?void 0:L.type)==="iframe"&&!!L.src&&f&&N;if(R&&!n)return t.jsxs("button",{onClick:()=>g==null?void 0:g(),disabled:!g,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(on,{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 k=R?is(L.src,e):"";return t.jsx("div",{className:"mt-3",children:R?t.jsx(ts,{src:k,escalation:e,schema:T,onResolve:f,onEscalate:N,submitAttempted:b}):t.jsx(lr,{json:c,onJsonChange:a,requestTriage:x,onRequestTriageChange:l,triageNotes:u,onTriageNotesChange:p,disabled:!n,submitAttempted:b,showTriage:!!y&&!!_,escalationContext:S,onOpenHelp:h,onDisabledClick:C})})}function ur({open:e,assignedUntil:s,onClose:r,onExtend:n,isPending:i}){const o=Ve(),[d,c]=m.useState("30"),[a,x]=m.useState(0),l=d==="custom",u=l?a:parseInt(d),p=m.useCallback(f=>x(f),[]);return t.jsx(Ue,{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(Lt,{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:d,onChange:f=>{c(f.target.value),x(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[o.map(f=>t.jsx("option",{value:f.value,children:f.label},f.value)),t.jsx("option",{value:"custom",children:"Other..."})]}),l&&t.jsx(Je,{onChange:p,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(u),className:"btn-primary text-xs",disabled:i||!u||u<=0,children:i?"Extending...":"Extend Claim"})]})]})})}const xr=9e4;function pr(e,s=xr){const[,r]=m.useState(0);if(m.useEffect(()=>{if(!e)return;const i=new Date(e).getTime()-Date.now();if(i<=0)return;const o=()=>r(a=>a+1),d=[],c=i-s;return c>0&&d.push(window.setTimeout(o,c)),d.push(window.setTimeout(o,i)),()=>d.forEach(a=>window.clearTimeout(a))},[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 mr="lt:escalation:draft:";function ae(e){return`${mr}${e}`}function fr(e){try{return localStorage.getItem(ae(e))}catch{return null}}function hr(e,s){try{localStorage.setItem(ae(e),s)}catch{}}function Gt(e){try{localStorage.removeItem(ae(e))}catch{}}const gr="x-lt-transition",br="x-lt-transition-message",jr="x-lt-transition-max-wait-seconds",yr="x-lt-transition-done",Nr="Submitted. Preparing your next step…",vr=30,wr=5,kr=300;function _r(e){const s=typeof e=="number"?e:Number(e);return!Number.isFinite(s)||s<=0?vr:Math.min(kr,Math.max(wr,Math.round(s)))}function Le(e){if(!e||!e[gr])return null;const s=e[br];return{message:typeof s=="string"&&s.trim().length>0?s:Nr,maxWaitSeconds:_r(e[jr])}}function Cr(e){const s=e==null?void 0:e[yr];return typeof s=="string"&&s.trim().length>0?s:null}const Er="x-lt-submit-on-claim";function Ar(e){return!!(e!=null&&e[Er])}const Tr="x-lt-labels",Rr=["claim","cancel","submit","escalate","release"];function Or(e){const s=e==null?void 0:e[Tr];if(!s||typeof s!="object"||Array.isArray(s))return{};const r=s,n={};r.cancel===!1&&(n.cancel=!1);for(const i of Rr){const o=r[i];typeof o=="string"&&o.trim().length>0&&(n[i]=o.trim())}return n}const Ir="x-lt-submit-guard",Mr="{{count}} related items are still pending";function Dr(e){const s=e==null?void 0:e[Ir];if(!s||typeof s!="object"||Array.isArray(s))return;const r=s;if(!(!r.query||typeof r.query!="object"))return r}function Sr(e,s){const{user:r}=ee(),n=ss((e==null?void 0:e.query)??{},s??{},r==null?void 0:r.userId),{data:i,isSuccess:o}=Fe({role:n.role,status:n.status,facets:n.facets,assigned_to:n.assigned_to,available:n.available,limit:1,enabled:!!e&&n.enabled}),d=!!e&&e.mustBeEmpty!==!1&&n.enabled,c=(i==null?void 0:i.total)??0,a=d&&o&&c===0,x=d&&!a;let l="";if(x)if(c>0){const u=(e==null?void 0:e.message)??Mr;l=nt(u.replace(/\{\{count\}\}/g,String(c)),s??{})}else l="Checking related items…";return{blocked:x,count:c,message:l,confirmedEmpty:a}}function $r({open:e,message:s}){return e?$s.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($t,{content:s})})]})]}),document.body):null}const os="lt:escalation:panel:open";function Lr(){try{const e=localStorage.getItem(os);return e===null?!0:e==="true"}catch{return!0}}function wt(e){try{localStorage.setItem(os,String(e))}catch{}}function kt(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function ia(){const{id:e}=Ls();return t.jsx(Pr,{id:e},e)}function Pr({id:e}){var he,ge,be,je,ye;const{user:s}=ee(),{identity:r}=Cs(),n=Es(),i=(r==null?void 0:r.actorId)??(s==null?void 0:s.userId),o=se(),d=He(),c=Pe(),{data:a,isLoading:x,refetch:l,isFetching:u}=We(e);zs(e);const p=As(),f=qe(),N=Ts(),g=Rs(),[b,y]=m.useState(!1),{data:_}=Hs(),{data:h}=Os(),{isBuilder:C}=Is(),T=_==null?void 0:_.find(j=>j.workflow_type===(a==null?void 0:a.workflow_type)),S=((he=h==null?void 0:h.telemetry)==null?void 0:he.traceUrl)??null,[L,R]=m.useState("resolve"),[k,E]=m.useState("{}"),[A,$]=m.useState(Lr),[q,P]=m.useState(!1),[J,Y]=m.useState(""),[V,v]=m.useState(!1),[O,w]=m.useState([]),[M,F]=m.useState(0),[Z,D]=m.useState(void 0),[H,ct]=m.useState(null),[Pt,ie]=m.useState(!1),oe=m.useRef(!1),Ct=m.useRef(null),le=m.useRef(!1),Et=m.useRef(null),ls=pr(a==null?void 0:a.assigned_until),[cs,ds]=m.useState(null);m.useEffect(()=>{if(!(!V||!a))try{const j=JSON.parse(k),I=j._form_schema;if(!I){w([]);return}w(Ke(I,j,lt(a)))}catch{}},[k,V,a]);const At=((ge=a==null?void 0:a.metadata)==null?void 0:ge.form_schema)??null,dt=(a==null?void 0:a.form_schema)??(T==null?void 0:T.resolver_schema)??null,U=At??dt,ce=Ar(U),ut=Or(U),bt=Dr(U),jt=Sr(bt,a?lt(a):void 0),Tt=m.useRef(!1),Rt=m.useRef(null);m.useEffect(()=>{if(Tt.current)return;const j=At??(dt!=null&&dt.properties?dt:null);if(j!=null&&j.properties){Tt.current=!0;const I=kt(a==null?void 0:a.envelope),z=I==null?void 0:I.formDefaults,G={...(a==null?void 0:a.metadata)??{},...typeof z=="object"&&z!==null?z:{}},at=ze(G,j),et={_form_schema:j};for(const[ve,Ns]of Object.entries(j.properties)){const we=Ns,vs=we.type==="object"?{}:"";et[ve]=at[ve]??we.default??vs}Rt.current=JSON.stringify(et,null,2);const Ne=!((a==null?void 0:a.status)==="resolved"||(a==null?void 0:a.status)==="cancelled")&&(a!=null&&a.id)?fr(a.id):null,Mt=Ne?kt(Ne):null;Mt&&typeof Mt=="object"&&!Array.isArray(Mt)?E(JSON.stringify({...Mt,_form_schema:j},null,2)):E(Rt.current)}else U&&(Tt.current=!0,E(JSON.stringify(U,null,2)))},[U,At,dt,a==null?void 0:a.envelope,a==null?void 0:a.metadata,a==null?void 0:a.id,a==null?void 0:a.status]),m.useEffect(()=>{if(!Tt.current||Rt.current===null||!(a!=null&&a.id)||a.status!=="pending")return;const j=a.id,I=window.setTimeout(()=>{k===Rt.current?Gt(j):hr(j,k)},400);return()=>window.clearTimeout(I)},[k,a==null?void 0:a.id,a==null?void 0:a.status]),m.useEffect(()=>{if(!H)return;const j=window.setTimeout(async()=>{var z;try{const G=new URLSearchParams({parent_id:e,assigned_to:i??"",status:"pending",limit:"1"}),at=await ht(`/escalations?${G}`),et=(z=at==null?void 0:at.escalations)==null?void 0:z[0];if(et!=null&&et.id&&et.parent_id===e){ct(null),o(`/escalations/detail/${et.id}`);return}}catch{}ct(null),c.resetQueries({queryKey:["escalations"]}),c.resetQueries({queryKey:["escalationStats"]});const I=H.doneDest;I?I.startsWith("/")?o(I):window.location.assign(I):o(-1)},H.maxWaitSeconds*1e3);return()=>window.clearTimeout(j)},[H,e,i,o,c]),m.useEffect(()=>{var j,I;oe.current||(j=d.state)!=null&&j.autoStart&&(!a||a.status!=="pending"||St(a)||k!=="{}"&&(oe.current=!0,(I=Ct.current)==null||I.call(Ct)))},[a,k,d.state]),m.useEffect(()=>{var j;le.current||!(bt!=null&&bt.autoResolveWhenEmpty)||!jt.confirmedEmpty||!a||a.status!=="pending"||!St(a)||a.assigned_to===i&&k!=="{}"&&(le.current=!0,(j=Et.current)==null||j.call(Et))},[jt.confirmedEmpty,bt,a,k,i]);const us=(a==null?void 0:a.subtype)==="rounds_exhausted";if(x)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=St(a),K=Wt&&a.assigned_to===i,de=Wt&&!K,xt=a.status==="resolved"||a.status==="cancelled",rt=U==null?void 0:U["x-lt-viewport"],Ft=(rt==null?void 0:rt.type)==="iframe"&&!!(rt!=null&&rt.src)&&K&&!xt,Ot=kt(a.escalation_payload),pt=kt(a.resolver_payload),It=kt(a.envelope),xs=!!((be=It==null?void 0:It.metadata)!=null&&be.certified),ue=Ms(),xe=ue!==null?ue:!!((je=h==null?void 0:h.ai)!=null&&je.enabled),tt=typeof Ot=="object"&&Ot!==null&&!Array.isArray(Ot)?Ot:null,ps=tt==null?void 0:tt._triage,ms=typeof pt=="object"&&pt!==null&&!Array.isArray(pt)?pt:null,fs=xt?"terminal":K?"claimed_by_me":de?"claimed_by_other":"available",qt=j=>{p.mutate({id:e,durationMinutes:j})},yt=()=>{c.resetQueries({queryKey:["escalations"]}),c.resetQueries({queryKey:["escalationStats"]}),o(-1)},hs=()=>{const j=Cr(U);return j&&nt(j,lt(a))||null},gs=j=>{c.resetQueries({queryKey:["escalations"]}),c.resetQueries({queryKey:["escalationStats"]}),j.startsWith("/")?o(j):window.location.assign(j)},Nt=async j=>{try{await f.mutateAsync({id:e,resolverPayload:j})}catch(G){if(G instanceof Ds&&un(G.body)){v(!0),w(G.body.violations),D(B.ERRORS);return}throw G}Gt(e);const I=Le(U),z=hs();if(I){ct({...I,doneDest:z});return}if(z){gs(z);return}yt()},pe=async j=>{try{await p.mutateAsync({id:e,durationMinutes:j})}catch{return}if(jt.blocked)return;const I=Zt(k,lt(a));if(!I.parseError){if(I.errors.length>0){v(!0),w(I.errors),$(!0),wt(!0),D(B.ERRORS);return}await Nt(I.payload)}};Ct.current=async()=>{var I;const j=(I=d.state)==null?void 0:I.durationMinutes;ie(!0),await pe(typeof j=="number"&&j>0?j:30),ie(!1)},Et.current=()=>{const j=Zt(k,lt(a));j.parseError||j.errors.length>0||Nt(j.payload)};const me=async j=>{j&&(await N.mutateAsync({id:e,targetRole:j}),yt())},bs=async()=>{K||await p.mutateAsync({id:e,durationMinutes:30});const j=(tt==null?void 0:tt.diagnosis)||a.description||"";await f.mutateAsync({id:e,resolverPayload:{_lt:{needsTriage:!0},notes:j}}),yt()},fe=async()=>{await p.mutateAsync({id:e,durationMinutes:0}),yt()},js=async()=>{await g.mutateAsync(e),Gt(e),y(!1),yt()},ys=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ws,{onRefresh:()=>l(),isFetching:u,apiPath:`/escalations/${a.id}`,standalone:!0}),t.jsx("button",{onClick:()=>$(j=>(wt(!j),!j)),className:"ml-2 text-accent/60 hover:text-accent transition-colors",title:A?"Hide side panel":"Show side panel",children:A?t.jsx(Ce,{className:"w-5 h-5",strokeWidth:1.5}):t.jsx(Ee,{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:[Ft?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:fe,disabled:p.isPending,label:ut.release??"Release",hoverClass:"hover:text-accent",icon:t.jsx(ln,{className:"w-4 h-4",strokeWidth:1.5})},...ut.cancel===!1?[]:[{onClick:()=>y(!0),disabled:!1,label:ut.cancel??"Cancel",hoverClass:"hover:text-status-error",icon:t.jsx(cn,{className:"w-4 h-4",strokeWidth:1.5})}],{onClick:()=>$(j=>(wt(!j),!j)),disabled:!1,label:A?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:A?t.jsx(Ce,{className:"w-4 h-4",strokeWidth:1.5}):t.jsx(Ee,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:j,disabled:I,label:z,hoverClass:G,icon:at})=>t.jsxs("div",{className:"relative group/tip",children:[t.jsx("button",{onClick:j,disabled:I,className:`text-text-tertiary ${G} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:at}),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:z})]},z))}),t.jsx(ts,{src:is(rt.src,a),escalation:a,schema:U,onResolve:Nt,onEscalate:me,submitAttempted:V,fill:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:t.jsx(Ps,{title:a.description||"Escalation",actions:ys})}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[t.jsx(cr,{isRoundsExhausted:us,payloadObj:tt,isTerminal:xt,resolverPayload:pt,onRetryTriage:bs,isRetrying:p.isPending||f.isPending}),t.jsx(dr,{esc:a,resolverPayload:pt,isTerminal:xt,claimedByMe:K,activeView:L,metadataFormSchema:At,effectiveSchema:U,json:k,onJsonChange:E,requestTriage:q,onRequestTriageChange:P,triageNotes:J,onTriageNotesChange:Y,onResolve:Nt,onEscalate:me,onClaim:()=>qt(30),submitAttempted:V,isCertified:xs,hasAI:xe,onOpenHelp:()=>{$(!0),wt(!0),D(B.HELP)},onDisabledClick:()=>F(j=>j+1)}),t.jsx("div",{className:"h-10"})]})]}),!Ft&&t.jsx(In,{escalationContext:lt(a),mode:fs,activeView:L,onActiveViewChange:R,onClaim:ce?pe:qt,claimPending:p.isPending||ce&&f.isPending,claimNudge:M,workflowType:a.workflow_type,json:k,onResolve:Nt,resolvePending:f.isPending||f.isSuccess,resolveError:f.error,requestTriage:q,triageNotes:J,onRelease:fe,releasePending:p.isPending,onCancel:()=>y(!0),assignedTo:a.assigned_to,assignedUntil:a.assigned_until,actingName:r&&K?r.displayName:null,badgePrompt:n&&!r&&de,onSubmitAttempt:()=>v(!0),onValidationErrors:j=>{w(j),$(!0),wt(!0),D(B.ERRORS)},labels:ut,submitBlocked:jt.blocked,submitBlockedMessage:jt.message})]}),t.jsx(wn,{esc:a,schema:U,envelope:It,payload:tt,resolver:ms,triage:ps??null,hasAI:xe,claimed:Wt,claimedByMe:K,isTerminal:xt,isBuilder:C,traceUrl:S,open:A,noGutter:Ft,formErrors:O,activePanel:Z,onPanelChange:D}),t.jsx(Ss,{open:b,onClose:()=>y(!1),onConfirm:js,isPending:g.isPending,error:g.error,actionLabel:typeof ut.cancel=="string"?ut.cancel:void 0}),t.jsx(xn,{escalationId:e}),t.jsx($r,{open:!!H||Pt,message:(H==null?void 0:H.message)??((ye=Le(U))==null?void 0:ye.message)??"Starting…"}),K&&!xt&&a.assigned_until&&t.jsx(ur,{open:ls.expiringSoon&&a.assigned_until!==cs,assignedUntil:a.assigned_until,onClose:()=>ds(a.assigned_until??null),onExtend:qt,isPending:p.isPending})]})}export{ia as EscalationDetailPage};
|
|
3
|
-
//# sourceMappingURL=index-LF1gEc6w.js.map
|