@hotmeshio/long-tail 0.14.0 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/build/api/escalations/bulk.d.ts +18 -0
  2. package/build/api/escalations/bulk.js +49 -1
  3. package/build/api/escalations/claim.d.ts +4 -1
  4. package/build/api/escalations/claim.js +6 -2
  5. package/build/api/escalations/helpers.d.ts +11 -1
  6. package/build/api/escalations/helpers.js +30 -3
  7. package/build/api/escalations/index.d.ts +1 -1
  8. package/build/api/escalations/index.js +2 -1
  9. package/build/index.js +4 -0
  10. package/build/routes/escalations/bulk.js +6 -0
  11. package/build/routes/escalations/single.js +3 -1
  12. package/build/sdk/index.d.ts +5 -0
  13. package/build/sdk/index.js +1 -0
  14. package/build/services/escalation/bulk.d.ts +27 -0
  15. package/build/services/escalation/bulk.js +39 -0
  16. package/build/services/escalation/crud.d.ts +10 -2
  17. package/build/services/escalation/crud.js +20 -12
  18. package/build/services/escalation/sql.d.ts +17 -0
  19. package/build/services/escalation/sql.js +44 -1
  20. package/build/system/mcp-servers/admin/escalations.js +13 -1
  21. package/build/system/mcp-servers/admin/schemas.d.ts +10 -0
  22. package/build/system/mcp-servers/admin/schemas.js +6 -2
  23. package/build/system/seed/tool-manifests-admin.d.ts +88 -0
  24. package/build/system/seed/tool-manifests-admin.js +2 -1
  25. package/dashboard/dist/assets/{AdminDashboard-DeZsR4pA.js → AdminDashboard-BS3wd7Zg.js} +2 -2
  26. package/dashboard/dist/assets/{AdminDashboard-DeZsR4pA.js.map → AdminDashboard-BS3wd7Zg.js.map} +1 -1
  27. package/dashboard/dist/assets/{AgentConfigPage-Bi5ZAsjf.js → AgentConfigPage-4C9aU0dj.js} +6 -6
  28. package/dashboard/dist/assets/{AgentConfigPage-Bi5ZAsjf.js.map → AgentConfigPage-4C9aU0dj.js.map} +1 -1
  29. package/dashboard/dist/assets/{AgentDetailPage-CIbKor5E.js → AgentDetailPage-B6uvDnMF.js} +3 -3
  30. package/dashboard/dist/assets/{AgentDetailPage-CIbKor5E.js.map → AgentDetailPage-B6uvDnMF.js.map} +1 -1
  31. package/dashboard/dist/assets/{AgentsPage-CRFZ6KDu.js → AgentsPage-vtxdvdrQ.js} +2 -2
  32. package/dashboard/dist/assets/{AgentsPage-CRFZ6KDu.js.map → AgentsPage-vtxdvdrQ.js.map} +1 -1
  33. package/dashboard/dist/assets/AvailableEscalationsPage-C9VKPhD6.js +2 -0
  34. package/dashboard/dist/assets/AvailableEscalationsPage-C9VKPhD6.js.map +1 -0
  35. package/dashboard/dist/assets/BotPicker-CkY9u7nD.js +2 -0
  36. package/dashboard/dist/assets/{BotPicker-dUpw1wW6.js.map → BotPicker-CkY9u7nD.js.map} +1 -1
  37. package/dashboard/dist/assets/BulkAssignModal-OIbUDYlC.js +2 -0
  38. package/dashboard/dist/assets/BulkAssignModal-OIbUDYlC.js.map +1 -0
  39. package/dashboard/dist/assets/CapabilitiesPage-Bkbq_GO6.js +2 -0
  40. package/dashboard/dist/assets/{CapabilitiesPage-Ca2jEln-.js.map → CapabilitiesPage-Bkbq_GO6.js.map} +1 -1
  41. package/dashboard/dist/assets/{CollapsibleSection-BXlR5QmW.js → CollapsibleSection-Zuz9HkFL.js} +2 -2
  42. package/dashboard/dist/assets/{CollapsibleSection-BXlR5QmW.js.map → CollapsibleSection-Zuz9HkFL.js.map} +1 -1
  43. package/dashboard/dist/assets/CountdownTimer-CGnk4Bw_.js +2 -0
  44. package/dashboard/dist/assets/CountdownTimer-CGnk4Bw_.js.map +1 -0
  45. package/dashboard/dist/assets/{CredentialsPage-CGyCCzGh.js → CredentialsPage-CAmDMnzV.js} +2 -2
  46. package/dashboard/dist/assets/{CredentialsPage-CGyCCzGh.js.map → CredentialsPage-CAmDMnzV.js.map} +1 -1
  47. package/dashboard/dist/assets/{CronLabel-CAu2hmQf.js → CronLabel-DX2woCPZ.js} +2 -2
  48. package/dashboard/dist/assets/{CronLabel-CAu2hmQf.js.map → CronLabel-DX2woCPZ.js.map} +1 -1
  49. package/dashboard/dist/assets/{DataTable-Bir0Xs1p.js → DataTable-DFPMeqyQ.js} +2 -2
  50. package/dashboard/dist/assets/DataTable-DFPMeqyQ.js.map +1 -0
  51. package/dashboard/dist/assets/{DropZone-DovkhN2p.js → DropZone-7UoXQ4qL.js} +2 -2
  52. package/dashboard/dist/assets/{DropZone-DovkhN2p.js.map → DropZone-7UoXQ4qL.js.map} +1 -1
  53. package/dashboard/dist/assets/{ElapsedCell-B1eoCzEw.js → ElapsedCell-D2old1NF.js} +2 -2
  54. package/dashboard/dist/assets/{ElapsedCell-B1eoCzEw.js.map → ElapsedCell-D2old1NF.js.map} +1 -1
  55. package/dashboard/dist/assets/{EntityTimelinePanel-CIOyjwjM.js → EntityTimelinePanel-m9baDiW0.js} +2 -2
  56. package/dashboard/dist/assets/{EntityTimelinePanel-CIOyjwjM.js.map → EntityTimelinePanel-m9baDiW0.js.map} +1 -1
  57. package/dashboard/dist/assets/{EscalationListSchemaPage-DQNQ7o_4.js → EscalationListSchemaPage-BPr7Ou8c.js} +3 -3
  58. package/dashboard/dist/assets/{EscalationListSchemaPage-DQNQ7o_4.js.map → EscalationListSchemaPage-BPr7Ou8c.js.map} +1 -1
  59. package/dashboard/dist/assets/{EscalationSchemaPage-DFgDn4R3.js → EscalationSchemaPage-83n5JyAh.js} +3 -3
  60. package/dashboard/dist/assets/{EscalationSchemaPage-DFgDn4R3.js.map → EscalationSchemaPage-83n5JyAh.js.map} +1 -1
  61. package/dashboard/dist/assets/{EscalationsOverview-DfbKtXVZ.js → EscalationsOverview-CDJ5wRlq.js} +2 -2
  62. package/dashboard/dist/assets/{EscalationsOverview-DfbKtXVZ.js.map → EscalationsOverview-CDJ5wRlq.js.map} +1 -1
  63. package/dashboard/dist/assets/{EventTable-CZPkvhao.js → EventTable-DRUHkKtv.js} +2 -2
  64. package/dashboard/dist/assets/{EventTable-CZPkvhao.js.map → EventTable-DRUHkKtv.js.map} +1 -1
  65. package/dashboard/dist/assets/{FilterBar-CYjKK9Cp.js → FilterBar-C06DK5Oa.js} +2 -2
  66. package/dashboard/dist/assets/{FilterBar-CYjKK9Cp.js.map → FilterBar-C06DK5Oa.js.map} +1 -1
  67. package/dashboard/dist/assets/{GraphInvokePage-DY9u42vt.js → GraphInvokePage-DSlyTmyq.js} +2 -2
  68. package/dashboard/dist/assets/{GraphInvokePage-DY9u42vt.js.map → GraphInvokePage-DSlyTmyq.js.map} +1 -1
  69. package/dashboard/dist/assets/{HomePage-p_CYlGnh.js → HomePage-DXzDBkQV.js} +2 -2
  70. package/dashboard/dist/assets/{HomePage-p_CYlGnh.js.map → HomePage-DXzDBkQV.js.map} +1 -1
  71. package/dashboard/dist/assets/{ListToolbar-Dz-1RXSH.js → ListToolbar-BvpGFFYp.js} +2 -2
  72. package/dashboard/dist/assets/{ListToolbar-Dz-1RXSH.js.map → ListToolbar-BvpGFFYp.js.map} +1 -1
  73. package/dashboard/dist/assets/{McpOverview-BUI9sVTk.js → McpOverview-C2atR_B6.js} +2 -2
  74. package/dashboard/dist/assets/{McpOverview-BUI9sVTk.js.map → McpOverview-C2atR_B6.js.map} +1 -1
  75. package/dashboard/dist/assets/{McpQueryDetailPage-CVN_UAB3.js → McpQueryDetailPage-BUxPspjB.js} +3 -3
  76. package/dashboard/dist/assets/{McpQueryDetailPage-CVN_UAB3.js.map → McpQueryDetailPage-BUxPspjB.js.map} +1 -1
  77. package/dashboard/dist/assets/McpQueryPage-CM_Fgl9G.js +2 -0
  78. package/dashboard/dist/assets/{McpQueryPage-DRTKSPDR.js.map → McpQueryPage-CM_Fgl9G.js.map} +1 -1
  79. package/dashboard/dist/assets/{McpRunDetailPage-CTb1AxR3.js → McpRunDetailPage-Bo9vXQBA.js} +2 -2
  80. package/dashboard/dist/assets/{McpRunDetailPage-CTb1AxR3.js.map → McpRunDetailPage-Bo9vXQBA.js.map} +1 -1
  81. package/dashboard/dist/assets/{McpRunsPage-BWLwjVd0.js → McpRunsPage-BwsgvGtg.js} +2 -2
  82. package/dashboard/dist/assets/{McpRunsPage-BWLwjVd0.js.map → McpRunsPage-BwsgvGtg.js.map} +1 -1
  83. package/dashboard/dist/assets/{NamespacePill-BeifzjUm.js → NamespacePill-CKp_9EaI.js} +2 -2
  84. package/dashboard/dist/assets/{NamespacePill-BeifzjUm.js.map → NamespacePill-CKp_9EaI.js.map} +1 -1
  85. package/dashboard/dist/assets/OperationsPage-BftWAJ9m.js +3 -0
  86. package/dashboard/dist/assets/OperationsPage-BftWAJ9m.js.map +1 -0
  87. package/dashboard/dist/assets/{OperatorDashboard-DGs9kPOZ.js → OperatorDashboard-CKjrYYFi.js} +2 -2
  88. package/dashboard/dist/assets/{OperatorDashboard-DGs9kPOZ.js.map → OperatorDashboard-CKjrYYFi.js.map} +1 -1
  89. package/dashboard/dist/assets/{PageHeader-BpeBHqyc.js → PageHeader-CDDpHpdv.js} +2 -2
  90. package/dashboard/dist/assets/{PageHeader-BpeBHqyc.js.map → PageHeader-CDDpHpdv.js.map} +1 -1
  91. package/dashboard/dist/assets/{PageHeaderWithStats-JXeUFa_g.js → PageHeaderWithStats-DIWH6fRv.js} +2 -2
  92. package/dashboard/dist/assets/{PageHeaderWithStats-JXeUFa_g.js.map → PageHeaderWithStats-DIWH6fRv.js.map} +1 -1
  93. package/dashboard/dist/assets/{PersonaDetailPage-C33MgXUY.js → PersonaDetailPage-BsIPtBxZ.js} +2 -2
  94. package/dashboard/dist/assets/{PersonaDetailPage-C33MgXUY.js.map → PersonaDetailPage-BsIPtBxZ.js.map} +1 -1
  95. package/dashboard/dist/assets/{PersonasPage-BbLOHq5X.js → PersonasPage-62hANmNf.js} +2 -2
  96. package/dashboard/dist/assets/{PersonasPage-BbLOHq5X.js.map → PersonasPage-62hANmNf.js.map} +1 -1
  97. package/dashboard/dist/assets/{ProcessDetailPage-zwd0HCJl.js → ProcessDetailPage-DS_t9DcR.js} +2 -2
  98. package/dashboard/dist/assets/{ProcessDetailPage-zwd0HCJl.js.map → ProcessDetailPage-DS_t9DcR.js.map} +1 -1
  99. package/dashboard/dist/assets/{ProcessesListPage-DnfmK6jf.js → ProcessesListPage-Ch2tSICc.js} +2 -2
  100. package/dashboard/dist/assets/{ProcessesListPage-DnfmK6jf.js.map → ProcessesListPage-Ch2tSICc.js.map} +1 -1
  101. package/dashboard/dist/assets/{RoleDetailPage-axZtFPC_.js → RoleDetailPage-DVbtnTvn.js} +3 -3
  102. package/dashboard/dist/assets/{RoleDetailPage-axZtFPC_.js.map → RoleDetailPage-DVbtnTvn.js.map} +1 -1
  103. package/dashboard/dist/assets/{RolePill-EocCXZh0.js → RolePill-C0hExOmI.js} +2 -2
  104. package/dashboard/dist/assets/{RolePill-EocCXZh0.js.map → RolePill-C0hExOmI.js.map} +1 -1
  105. package/dashboard/dist/assets/{RolesPage-DN6yqH7-.js → RolesPage-CK6FjD5P.js} +2 -2
  106. package/dashboard/dist/assets/{RolesPage-DN6yqH7-.js.map → RolesPage-CK6FjD5P.js.map} +1 -1
  107. package/dashboard/dist/assets/RunAsSelector-ImueSaJ4.js +2 -0
  108. package/dashboard/dist/assets/{RunAsSelector-DrGsUhL8.js.map → RunAsSelector-ImueSaJ4.js.map} +1 -1
  109. package/dashboard/dist/assets/{ScanCodesPage-BmQjEyWZ.js → ScanCodesPage-CDqLJuCq.js} +2 -2
  110. package/dashboard/dist/assets/{ScanCodesPage-BmQjEyWZ.js.map → ScanCodesPage-CDqLJuCq.js.map} +1 -1
  111. package/dashboard/dist/assets/ScanSchemeDetailPage-DO6qtJdM.js +2 -0
  112. package/dashboard/dist/assets/ScanSchemeDetailPage-DO6qtJdM.js.map +1 -0
  113. package/dashboard/dist/assets/ScanStationPage-ID3xMhds.js +2 -0
  114. package/dashboard/dist/assets/ScanStationPage-ID3xMhds.js.map +1 -0
  115. package/dashboard/dist/assets/{ScopeBadge-H5dEqeHi.js → ScopeBadge-BBQvz4pj.js} +2 -2
  116. package/dashboard/dist/assets/{ScopeBadge-H5dEqeHi.js.map → ScopeBadge-BBQvz4pj.js.map} +1 -1
  117. package/dashboard/dist/assets/StatusBadge-BDeUwPtb.js +2 -0
  118. package/dashboard/dist/assets/StatusBadge-BDeUwPtb.js.map +1 -0
  119. package/dashboard/dist/assets/{StickyPagination-9VkHiOsT.js → StickyPagination-XA1krmz5.js} +2 -2
  120. package/dashboard/dist/assets/{StickyPagination-9VkHiOsT.js.map → StickyPagination-XA1krmz5.js.map} +1 -1
  121. package/dashboard/dist/assets/{StreamMessageDetail-C37J6Qyz.js → StreamMessageDetail-DziA1g1e.js} +2 -2
  122. package/dashboard/dist/assets/{StreamMessageDetail-C37J6Qyz.js.map → StreamMessageDetail-DziA1g1e.js.map} +1 -1
  123. package/dashboard/dist/assets/{SwimlaneTimeline-NVGsBIX-.js → SwimlaneTimeline-DTNEnHiF.js} +2 -2
  124. package/dashboard/dist/assets/{SwimlaneTimeline-NVGsBIX-.js.map → SwimlaneTimeline-DTNEnHiF.js.map} +1 -1
  125. package/dashboard/dist/assets/{TagInput-Ch5u6iPH.js → TagInput-BXxXs1JD.js} +2 -2
  126. package/dashboard/dist/assets/{TagInput-Ch5u6iPH.js.map → TagInput-BXxXs1JD.js.map} +1 -1
  127. package/dashboard/dist/assets/{TaskDetailPage-5sbMHi5U.js → TaskDetailPage-U19sJHAI.js} +2 -2
  128. package/dashboard/dist/assets/{TaskDetailPage-5sbMHi5U.js.map → TaskDetailPage-U19sJHAI.js.map} +1 -1
  129. package/dashboard/dist/assets/{TaskQueuePill-Bz146p-P.js → TaskQueuePill-BKGJBVZG.js} +2 -2
  130. package/dashboard/dist/assets/{TaskQueuePill-Bz146p-P.js.map → TaskQueuePill-BKGJBVZG.js.map} +1 -1
  131. package/dashboard/dist/assets/{TasksListPage-C9AN7IBb.js → TasksListPage-jc4Xk7kI.js} +2 -2
  132. package/dashboard/dist/assets/{TasksListPage-C9AN7IBb.js.map → TasksListPage-jc4Xk7kI.js.map} +1 -1
  133. package/dashboard/dist/assets/{TimeAgo-CsbQGlSd.js → TimeAgo-GWgJ0LVq.js} +2 -2
  134. package/dashboard/dist/assets/{TimeAgo-CsbQGlSd.js.map → TimeAgo-GWgJ0LVq.js.map} +1 -1
  135. package/dashboard/dist/assets/{TimestampCell-DlbIkV-G.js → TimestampCell-Dk1TVsFV.js} +2 -2
  136. package/dashboard/dist/assets/{TimestampCell-DlbIkV-G.js.map → TimestampCell-Dk1TVsFV.js.map} +1 -1
  137. package/dashboard/dist/assets/{ToolPill-sj8OkBB0.js → ToolPill-BY6zLSfA.js} +2 -2
  138. package/dashboard/dist/assets/{ToolPill-sj8OkBB0.js.map → ToolPill-BY6zLSfA.js.map} +1 -1
  139. package/dashboard/dist/assets/{ToolTestPanel-BKbLocvr.js → ToolTestPanel-BKcqnR68.js} +2 -2
  140. package/dashboard/dist/assets/{ToolTestPanel-BKbLocvr.js.map → ToolTestPanel-BKcqnR68.js.map} +1 -1
  141. package/dashboard/dist/assets/{TopicDetailPage-fOnTfDso.js → TopicDetailPage-D8GcDu_0.js} +4 -4
  142. package/dashboard/dist/assets/{TopicDetailPage-fOnTfDso.js.map → TopicDetailPage-D8GcDu_0.js.map} +1 -1
  143. package/dashboard/dist/assets/{TopicsPage-BoVkp7DM.js → TopicsPage-BT9LV3yH.js} +2 -2
  144. package/dashboard/dist/assets/{TopicsPage-BoVkp7DM.js.map → TopicsPage-BT9LV3yH.js.map} +1 -1
  145. package/dashboard/dist/assets/UserName-BrwZnLjU.js +2 -0
  146. package/dashboard/dist/assets/{UserName-0gjVPU_U.js.map → UserName-BrwZnLjU.js.map} +1 -1
  147. package/dashboard/dist/assets/WorkflowExecutionPage-CldfHwky.js +2 -0
  148. package/dashboard/dist/assets/WorkflowExecutionPage-CldfHwky.js.map +1 -0
  149. package/dashboard/dist/assets/{WorkflowPill-BcA7S3gI.js → WorkflowPill-qp5UF3-y.js} +2 -2
  150. package/dashboard/dist/assets/{WorkflowPill-BcA7S3gI.js.map → WorkflowPill-qp5UF3-y.js.map} +1 -1
  151. package/dashboard/dist/assets/{WorkflowsDashboard-Bzvz6tTY.js → WorkflowsDashboard-DkyGkxW1.js} +2 -2
  152. package/dashboard/dist/assets/{WorkflowsDashboard-Bzvz6tTY.js.map → WorkflowsDashboard-DkyGkxW1.js.map} +1 -1
  153. package/dashboard/dist/assets/{WorkflowsOverview-BkcRU4Ej.js → WorkflowsOverview-DACADuUE.js} +2 -2
  154. package/dashboard/dist/assets/{WorkflowsOverview-BkcRU4Ej.js.map → WorkflowsOverview-DACADuUE.js.map} +1 -1
  155. package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmM78sYi.js → YamlWorkflowDetailPage-DSAjzido.js} +2 -2
  156. package/dashboard/dist/assets/{YamlWorkflowDetailPage-CmM78sYi.js.map → YamlWorkflowDetailPage-DSAjzido.js.map} +1 -1
  157. package/dashboard/dist/assets/{YamlWorkflowsPage-Dp6vG1au.js → YamlWorkflowsPage-CqoSFz5B.js} +2 -2
  158. package/dashboard/dist/assets/{YamlWorkflowsPage-Dp6vG1au.js.map → YamlWorkflowsPage-CqoSFz5B.js.map} +1 -1
  159. package/dashboard/dist/assets/{agents-MeqzOPD6.js → agents-Cg_e-aaf.js} +2 -2
  160. package/dashboard/dist/assets/{agents-MeqzOPD6.js.map → agents-Cg_e-aaf.js.map} +1 -1
  161. package/dashboard/dist/assets/{bots-DTGXnvX_.js → bots-B047yNJ0.js} +2 -2
  162. package/dashboard/dist/assets/{bots-DTGXnvX_.js.map → bots-B047yNJ0.js.map} +1 -1
  163. package/dashboard/dist/assets/{capabilities-BjlARR7F.js → capabilities-CI1dbCDk.js} +2 -2
  164. package/dashboard/dist/assets/{capabilities-BjlARR7F.js.map → capabilities-CI1dbCDk.js.map} +1 -1
  165. package/dashboard/dist/assets/{controlplane-DMYI0OaL.js → controlplane-Cy7snw7f.js} +2 -2
  166. package/dashboard/dist/assets/{controlplane-DMYI0OaL.js.map → controlplane-Cy7snw7f.js.map} +1 -1
  167. package/dashboard/dist/assets/{escalation-columns-BMO_H3cb.js → escalation-columns-BNrONMYj.js} +2 -2
  168. package/dashboard/dist/assets/{escalation-columns-BMO_H3cb.js.map → escalation-columns-BNrONMYj.js.map} +1 -1
  169. package/dashboard/dist/assets/index-B6Grf1WQ.js +6 -0
  170. package/dashboard/dist/assets/index-B6Grf1WQ.js.map +1 -0
  171. package/dashboard/dist/assets/{index-D3iDAWK2.js → index-Bf3hVGXZ.js} +2 -2
  172. package/dashboard/dist/assets/{index-D3iDAWK2.js.map → index-Bf3hVGXZ.js.map} +1 -1
  173. package/dashboard/dist/assets/{index-D6kXz3H8.js → index-Bxd2sXqz.js} +2 -2
  174. package/dashboard/dist/assets/{index-D6kXz3H8.js.map → index-Bxd2sXqz.js.map} +1 -1
  175. package/dashboard/dist/assets/index-CJV2pWNH.css +1 -0
  176. package/dashboard/dist/assets/{index-CGCD5hTX.js → index-COKZW8Xx.js} +2 -2
  177. package/dashboard/dist/assets/{index-CGCD5hTX.js.map → index-COKZW8Xx.js.map} +1 -1
  178. package/dashboard/dist/assets/{index-k5vcLICm.js → index-C_y0lQ_o.js} +3 -3
  179. package/dashboard/dist/assets/{index-k5vcLICm.js.map → index-C_y0lQ_o.js.map} +1 -1
  180. package/dashboard/dist/assets/{index-3QEnMBNG.js → index-DAUV3eJ-.js} +2 -2
  181. package/dashboard/dist/assets/{index-3QEnMBNG.js.map → index-DAUV3eJ-.js.map} +1 -1
  182. package/dashboard/dist/assets/{index-DuhqzYwC.js → index-DVtIMrTb.js} +2 -2
  183. package/dashboard/dist/assets/{index-DuhqzYwC.js.map → index-DVtIMrTb.js.map} +1 -1
  184. package/dashboard/dist/assets/index-Ds5rGe-i.js +3 -0
  185. package/dashboard/dist/assets/index-Ds5rGe-i.js.map +1 -0
  186. package/dashboard/dist/assets/{index-B3FzpDEG.js → index-DyTb77Jb.js} +2 -2
  187. package/dashboard/dist/assets/{index-B3FzpDEG.js.map → index-DyTb77Jb.js.map} +1 -1
  188. package/dashboard/dist/assets/{index-Ch-OS1pk.js → index-Uk6N1qiH.js} +2 -2
  189. package/dashboard/dist/assets/{index-Ch-OS1pk.js.map → index-Uk6N1qiH.js.map} +1 -1
  190. package/dashboard/dist/assets/index-X3_AxcUk.js +2 -0
  191. package/dashboard/dist/assets/{index-Dsgqxdyh.js.map → index-X3_AxcUk.js.map} +1 -1
  192. package/dashboard/dist/assets/{index-BU4oujVO.js → index-lGfBW1PB.js} +29 -28
  193. package/dashboard/dist/assets/index-lGfBW1PB.js.map +1 -0
  194. package/dashboard/dist/assets/{index-CkkOh8y9.js → index-nUmEwQrg.js} +2 -2
  195. package/dashboard/dist/assets/{index-CkkOh8y9.js.map → index-nUmEwQrg.js.map} +1 -1
  196. package/dashboard/dist/assets/{knowledge-DAV1Jy7b.js → knowledge-DsIUzscY.js} +2 -2
  197. package/dashboard/dist/assets/{knowledge-DAV1Jy7b.js.map → knowledge-DsIUzscY.js.map} +1 -1
  198. package/dashboard/dist/assets/{mcp-CivbxL1P.js → mcp-D889kZ-c.js} +2 -2
  199. package/dashboard/dist/assets/{mcp-CivbxL1P.js.map → mcp-D889kZ-c.js.map} +1 -1
  200. package/dashboard/dist/assets/{mcp-query-CGvWNrgo.js → mcp-query-Cs9J2pVT.js} +2 -2
  201. package/dashboard/dist/assets/{mcp-query-CGvWNrgo.js.map → mcp-query-Cs9J2pVT.js.map} +1 -1
  202. package/dashboard/dist/assets/metadata-display-DHjqWkLG.js +2 -0
  203. package/dashboard/dist/assets/metadata-display-DHjqWkLG.js.map +1 -0
  204. package/dashboard/dist/assets/{personas-lI3aUr6t.js → personas-xHB16O-Q.js} +2 -2
  205. package/dashboard/dist/assets/{personas-lI3aUr6t.js.map → personas-xHB16O-Q.js.map} +1 -1
  206. package/dashboard/dist/assets/{pipelines-DjPfnTmx.js → pipelines-DnTPjw1v.js} +2 -2
  207. package/dashboard/dist/assets/{pipelines-DjPfnTmx.js.map → pipelines-DnTPjw1v.js.map} +1 -1
  208. package/dashboard/dist/assets/{tasks-Co_S55BO.js → tasks-BcDvp6dL.js} +2 -2
  209. package/dashboard/dist/assets/{tasks-Co_S55BO.js.map → tasks-BcDvp6dL.js.map} +1 -1
  210. package/dashboard/dist/assets/{topics-2IGhZXBi.js → topics-DXw6BNy5.js} +2 -2
  211. package/dashboard/dist/assets/{topics-2IGhZXBi.js.map → topics-DXw6BNy5.js.map} +1 -1
  212. package/dashboard/dist/assets/{useEventHooks-D0C5yke4.js → useEventHooks-C-bsD8zP.js} +2 -2
  213. package/dashboard/dist/assets/{useEventHooks-D0C5yke4.js.map → useEventHooks-C-bsD8zP.js.map} +1 -1
  214. package/dashboard/dist/assets/{useNamespace-LG52DTT-.js → useNamespace-wZCsEF6O.js} +2 -2
  215. package/dashboard/dist/assets/{useNamespace-LG52DTT-.js.map → useNamespace-wZCsEF6O.js.map} +1 -1
  216. package/dashboard/dist/assets/{useYamlActivityEvents-1IZGVpWC.js → useYamlActivityEvents-Cu_o4-ow.js} +2 -2
  217. package/dashboard/dist/assets/{useYamlActivityEvents-1IZGVpWC.js.map → useYamlActivityEvents-Cu_o4-ow.js.map} +1 -1
  218. package/dashboard/dist/assets/{users-C-eHT1i6.js → users-XpCq_umD.js} +2 -2
  219. package/dashboard/dist/assets/{users-C-eHT1i6.js.map → users-XpCq_umD.js.map} +1 -1
  220. package/dashboard/dist/assets/{vendor-icons-BPsNpK3Y.js → vendor-icons-BgsXTN4h.js} +145 -140
  221. package/dashboard/dist/assets/vendor-icons-BgsXTN4h.js.map +1 -0
  222. package/dashboard/dist/assets/{workflows-C16CeY4e.js → workflows-CMxHVqQ8.js} +2 -2
  223. package/dashboard/dist/assets/{workflows-C16CeY4e.js.map → workflows-CMxHVqQ8.js.map} +1 -1
  224. package/dashboard/dist/assets/{yaml-workflows-BBenayT9.js → yaml-workflows-kxOF5yEC.js} +2 -2
  225. package/dashboard/dist/assets/{yaml-workflows-BBenayT9.js.map → yaml-workflows-kxOF5yEC.js.map} +1 -1
  226. package/dashboard/dist/index.html +3 -3
  227. package/docs/api/http/escalations.md +34 -1
  228. package/docs/dashboard.md +2 -0
  229. package/docs/events.md +1 -1
  230. package/docs/hitl/iframe.md +56 -6
  231. package/docs/hitl/x-lt-footer.md +6 -0
  232. package/docs/hitl/x-lt-list-schema.md +4 -2
  233. package/package.json +1 -1
  234. package/dashboard/dist/assets/AvailableEscalationsPage-DDsmXjpi.js +0 -2
  235. package/dashboard/dist/assets/AvailableEscalationsPage-DDsmXjpi.js.map +0 -1
  236. package/dashboard/dist/assets/BotPicker-dUpw1wW6.js +0 -2
  237. package/dashboard/dist/assets/CapabilitiesPage-Ca2jEln-.js +0 -2
  238. package/dashboard/dist/assets/CountdownTimer-rnoWmFqx.js +0 -2
  239. package/dashboard/dist/assets/CountdownTimer-rnoWmFqx.js.map +0 -1
  240. package/dashboard/dist/assets/CustomDurationPicker-hlnadaFt.js +0 -2
  241. package/dashboard/dist/assets/CustomDurationPicker-hlnadaFt.js.map +0 -1
  242. package/dashboard/dist/assets/DataTable-Bir0Xs1p.js.map +0 -1
  243. package/dashboard/dist/assets/McpQueryPage-DRTKSPDR.js +0 -2
  244. package/dashboard/dist/assets/OperationsPage-BSl_oUAJ.js +0 -3
  245. package/dashboard/dist/assets/OperationsPage-BSl_oUAJ.js.map +0 -1
  246. package/dashboard/dist/assets/RunAsSelector-DrGsUhL8.js +0 -2
  247. package/dashboard/dist/assets/ScanSchemeDetailPage-VODehqGs.js +0 -2
  248. package/dashboard/dist/assets/ScanSchemeDetailPage-VODehqGs.js.map +0 -1
  249. package/dashboard/dist/assets/ScanStationPage-Y-9Gs7t5.js +0 -2
  250. package/dashboard/dist/assets/ScanStationPage-Y-9Gs7t5.js.map +0 -1
  251. package/dashboard/dist/assets/StatusBadge-DkgllZHv.js +0 -2
  252. package/dashboard/dist/assets/StatusBadge-DkgllZHv.js.map +0 -1
  253. package/dashboard/dist/assets/UserName-0gjVPU_U.js +0 -2
  254. package/dashboard/dist/assets/WorkflowExecutionPage-B28OxTS_.js +0 -2
  255. package/dashboard/dist/assets/WorkflowExecutionPage-B28OxTS_.js.map +0 -1
  256. package/dashboard/dist/assets/index-B5jxf81r.css +0 -1
  257. package/dashboard/dist/assets/index-BU4oujVO.js.map +0 -1
  258. package/dashboard/dist/assets/index-Dsgqxdyh.js +0 -2
  259. package/dashboard/dist/assets/index-DuyzcDuV.js +0 -6
  260. package/dashboard/dist/assets/index-DuyzcDuV.js.map +0 -1
  261. package/dashboard/dist/assets/index-LF1gEc6w.js +0 -3
  262. package/dashboard/dist/assets/index-LF1gEc6w.js.map +0 -1
  263. package/dashboard/dist/assets/vendor-icons-BPsNpK3Y.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{a as d,j as s}from"./vendor-query-RUZdMvN6.js";import{c as F,d as C,b as u}from"./index-BU4oujVO.js";import{u as M,a as T,b as $,S as O,c as A,d as D,e as R}from"./StreamMessageDetail-C37J6Qyz.js";import{u as z}from"./useFilterParams-crmlBw_l.js";import{u as E}from"./useNamespace-LG52DTT-.js";import{b as L}from"./api-path-u2Jf9QXS.js";import{D as I}from"./DataTable-Bir0Xs1p.js";import{S as U}from"./StickyPagination-9VkHiOsT.js";import{F as q,b as x,a as _}from"./FilterBar-CYjKK9Cp.js";import{P as B}from"./PageHeader-BpeBHqyc.js";import{L as V}from"./ListToolbar-Dz-1RXSH.js";import{X as H,$ as J}from"./vendor-icons-BPsNpK3Y.js";import"./vendor-react-CdqEC2zv.js";import"./controlplane-DMYI0OaL.js";import"./EmptyState-lpUFYfun.js";function W(l,n){if(l.length<=n)return l;const a=Math.floor((n-1)/2);return`${l.slice(0,a)}…${l.slice(-a)}`}function ce(){const{namespace:l,available:n}=E("namespace"),{filters:a,setFilter:t,pagination:r,sort:c,setSort:h}=z({filters:{namespace:"",source:"worker",status:"",stream_name:"",msg_type:"",topic:"",workflow_name:"",jid:"",aid:""}}),[m,g]=d.useState(null),v=d.useMemo(()=>n.map(e=>({value:e,label:e})),[n]),{data:i,isLoading:b,refetch:j,isFetching:w}=M({namespace:a.namespace||l,source:a.source||"worker",limit:r.pageSize,offset:r.offset,sort_by:c.sort_by||"created_at",order:c.order||"desc",status:a.status||void 0,stream_name:a.stream_name||void 0,msg_type:a.msg_type||void 0,topic:a.topic||void 0,workflow_name:a.workflow_name||void 0,jid:a.jid||void 0,aid:a.aid||void 0}),p=(i==null?void 0:i.messages)??[],f=(i==null?void 0:i.total)??0,o=d.useMemo(()=>m?p.find(e=>e.id===m.id&&e.source===m.source)??m:null,[p,m]),S=!!o,[k,N]=d.useState(null);d.useEffect(()=>{o&&N(o)},[o]);const y=o??k,P=[{key:"stream_name",label:"Stream",sortable:!0,render:e=>s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${D[e.status]}`,title:A[e.status]}),s.jsx("span",{className:"font-mono text-xs text-text-secondary truncate",title:e.stream_name,children:e.stream_name})]})},{key:"source",label:"Source",render:e=>s.jsx("span",{className:R,children:e.source}),className:"w-24"},{key:"created_at",label:"Created",sortable:!0,render:e=>s.jsx(u,{date:e.created_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}),className:"w-32"},{key:"reserved_at",label:"Reserved",render:e=>e.reserved_at?s.jsx(u,{date:e.reserved_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}):s.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-32"},{key:"expired_at",label:"Processed",render:e=>e.expired_at?s.jsx(u,{date:e.expired_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}):s.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-32"},{key:"priority",label:"Pri",sortable:!0,render:e=>s.jsx("span",{className:"text-xs text-text-secondary",children:e.priority}),className:"w-14 text-right"},{key:"retry_attempt",label:"Retries",render:e=>s.jsxs("span",{className:"text-xs text-text-secondary whitespace-nowrap",children:[e.retry_attempt,"/",e.max_retry_attempts]}),className:"w-20"}];return s.jsxs("div",{className:"flex items-stretch min-w-0 -mt-10 -mr-10 -mb-16",children:[s.jsxs("div",{className:"flex-1 min-w-0 pt-10 pr-10",children:[s.jsx(B,{title:"Messages",docsHash:"#docs:dashboard.md:messages"}),s.jsxs(q,{actions:s.jsx(V,{onRefresh:()=>j(),isFetching:w,apiPath:L("/controlplane/stream-messages",{namespace:a.namespace||l,source:a.source||"worker",limit:r.pageSize,offset:r.offset,sort_by:c.sort_by||"created_at",order:c.order||"desc",status:a.status||void 0,stream_name:a.stream_name||void 0,msg_type:a.msg_type||void 0,topic:a.topic||void 0,workflow_name:a.workflow_name||void 0,jid:a.jid||void 0,aid:a.aid||void 0})}),children:[s.jsx(x,{label:"Namespace",value:a.namespace,onChange:e=>t("namespace",e),options:v,required:!0}),s.jsx(x,{label:"Source",value:a.source,onChange:e=>t("source",e),options:T,required:!0}),s.jsx(x,{label:"Status",value:a.status,onChange:e=>t("status",e),options:$}),s.jsx(_,{label:"Stream",value:a.stream_name,onChange:e=>t("stream_name",e),placeholder:"Filter by stream name…"}),s.jsx(_,{label:"Job ID",value:a.jid,onChange:e=>t("jid",e),placeholder:"Filter by jid…"}),[{key:"topic",label:"Topic",value:a.topic},{key:"workflow_name",label:"Workflow",value:a.workflow_name},{key:"aid",label:"Activity",value:a.aid},{key:"msg_type",label:"Type",value:a.msg_type}].filter(e=>e.value).map(e=>s.jsxs("button",{onClick:()=>t(e.key,""),className:"inline-flex items-center gap-1 px-2 py-0.5 text-2xs font-mono rounded-full bg-accent/15 text-accent hover:bg-accent/25 transition-colors",title:`Clear ${e.label} filter: ${e.value}`,children:[e.label,": ",W(e.value,12),s.jsx(H,{className:"w-2.5 h-2.5"})]},e.key))]}),s.jsx(I,{columns:P,data:p,keyFn:e=>`${e.source}:${e.id}`,isLoading:b,emptyMessage:"No stream messages found",onRowClick:e=>g(e),activeRowKey:o?`${o.source}:${o.id}`:null,sort:c,onSort:h,layout:"fixed"}),s.jsx(U,{page:r.page,totalPages:r.totalPages(f),onPageChange:r.setPage,total:f,pageSize:r.pageSize,onPageSizeChange:r.setPageSize})]}),s.jsx(F,{open:S,width:416,className:"self-stretch",children:s.jsx("div",{className:"h-full pl-4",children:s.jsx(C,{views:[{id:"detail",icon:J,label:"Message Detail",content:y?s.jsx(O,{message:y,filters:{onFilterStatus:e=>t("status",e),onFilterStreamName:e=>t("stream_name",e),onFilterMsgType:e=>t("msg_type",e),onFilterTopic:e=>t("topic",e),onFilterWorkflow:e=>t("workflow_name",e),onFilterJid:e=>t("jid",e),onFilterAid:e=>t("aid",e)}}):null}],activeId:"detail",onViewChange:()=>{},onClose:()=>g(null),stickyClassName:"sticky top-0 z-10 h-[calc(100vh-5.25rem)] pt-9"})})})]})}export{ce as StreamMessagesPage};
2
- //# sourceMappingURL=index-Dsgqxdyh.js.map
@@ -1,6 +0,0 @@
1
- import{a as o,j as e}from"./vendor-query-RUZdMvN6.js";import{c as q,u as B,d as Q,e as K}from"./workflows-C16CeY4e.js";import{P as $}from"./PageHeader-BpeBHqyc.js";import{F as z,b as H,a as U}from"./FilterBar-CYjKK9Cp.js";import{m as T,_ as V,W as X}from"./index-BU4oujVO.js";import{W as Y}from"./WorkflowPill-BcA7S3gI.js";import{N as G}from"./NamespacePill-BeifzjUm.js";import{A as Z,aB as ee,d as D,ap as te,h as se,aC as ae,aD as re,X as ne}from"./vendor-icons-BPsNpK3Y.js";import{B as oe}from"./BotPicker-dUpw1wW6.js";import{L as le,u as ce,f as ie}from"./vendor-react-CdqEC2zv.js";import"./bots-DTGXnvX_.js";function J(t){return[...new Set(t.map(a=>a.task_queue).filter(Boolean))].sort()}function de({configs:t,selectedType:a,onSelect:m,tierMap:y,activeTypes:i,search:g,activeQueue:f}){const u=o.useMemo(()=>J(t),[t]),x=o.useMemo(()=>{const v=g.toLowerCase().trim(),l=n=>{var h;return!v||n.workflow_type.toLowerCase().includes(v)||((h=n.description)==null?void 0:h.toLowerCase().includes(v))},p=(f?[f]:u).map(n=>({queue:n,workflows:t.filter(h=>h.task_queue===n&&l(h))})).filter(n=>n.workflows.length>0);if(!f){const n=t.filter(h=>!h.task_queue&&l(h));n.length>0&&p.push({queue:"",workflows:n})}return p},[t,u,g,f]);return e.jsx("div",{children:x.length===0?e.jsx("p",{className:"text-sm text-text-tertiary py-8 text-center",children:"No workflows match your filter."}):e.jsx("div",{className:"space-y-10",children:x.map(({queue:v,workflows:l})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[v?e.jsx(Z,{className:"w-3 h-3 text-accent",strokeWidth:1.5}):e.jsx(ee,{className:"w-3 h-3 text-text-quaternary",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:v||"No Queue"}),e.jsx("span",{className:"text-xs text-text-quaternary",children:l.length})]}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:l.map(c=>e.jsx(ue,{config:c,isSelected:a===c.workflow_type,tier:y.get(c.workflow_type)??"durable",cronActive:(i==null?void 0:i.has(c.workflow_type))??!1,onSelect:m},c.workflow_type))})]},v||"__none__"))})})}function ue({config:t,isSelected:a,tier:m,cronActive:y,onSelect:i}){const g=m==="certified"?"certified":m==="registered"?"registered":"durable";return e.jsxs("button",{onClick:()=>i(t),className:"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150",children:[a&&e.jsx("span",{className:"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{type:t.workflow_type,size:"md",variant:g}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description}),e.jsxs("span",{className:"ml-auto flex items-center gap-2 shrink-0",children:[t.execute_as&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded",children:[e.jsx(D,{className:"w-2.5 h-2.5"}),t.execute_as]}),y&&e.jsx("span",{title:"Cron schedule active",children:e.jsx(te,{className:"w-3 h-3 text-status-success/70 shrink-0"})}),e.jsx(G,{namespace:"durable"}),e.jsx("span",{title:"Configure & invoke",children:e.jsx(se,{className:`w-3 h-3 transition-opacity ${a?"text-accent opacity-100":"text-accent opacity-0 group-hover:opacity-100"}`,strokeWidth:1.5})})]})]})]})}const L=`{
2
- "data": {},
3
- "metadata": {}
4
- }`;function xe(t){return typeof t=="boolean"?"boolean":typeof t=="number"?"number":Array.isArray(t)?"array":t!==null&&typeof t=="object"?"object":"string"}function R(t){if(!t)return[];const a=t.data;return!a||typeof a!="object"?[]:Object.entries(a).map(([m,y])=>({key:m,type:xe(y),defaultValue:y}))}function I(t){return{...t}}function A(t,a){return JSON.stringify({data:t,metadata:a},null,2)}function me({config:t,overrideBot:a,onOverrideChange:m,showOverride:y}){const{user:i}=T(),g=a||t.execute_as;return e.jsxs("div",{className:"bg-surface-sunken rounded-lg px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium",children:"Running as"}),g&&!a&&e.jsx("span",{className:"text-2xs text-text-tertiary",children:"configured default"}),a&&e.jsx("span",{className:"text-2xs text-accent",children:"admin override"})]}),e.jsx("div",{className:"field flex items-center gap-1.5",children:g?e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"w-3.5 h-3.5 text-accent/70 shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary font-mono",children:g})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary",children:(i==null?void 0:i.displayName)||(i==null?void 0:i.username)||"you"})]})})]}),y&&m&&e.jsxs("div",{children:[e.jsx("label",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block",children:"Override identity"}),e.jsx(oe,{selected:a??"",onChange:m,placeholder:t.execute_as?`Default: ${t.execute_as}`:"Invoking user (default)"})]})]})}function pe({selectedConfig:t,isJsonMode:a,hasFormView:m,jsonInput:y,formFields:i,dataFields:g,onJsonChange:f,onToggleMode:u,onUpdateFormField:x,onSetFormFields:v}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[e.jsx("label",{className:"block text-xs text-text-secondary",children:"Envelope"}),e.jsxs("div",{className:"flex items-center gap-3",children:[m&&e.jsx("button",{type:"button",onClick:u,className:"text-2xs text-accent hover:underline",children:a?"Form view":"JSON view"}),t.envelope_schema?e.jsx("span",{className:"text-2xs text-accent",children:"Pre-filled from workflow config"}):e.jsx("span",{className:"text-2xs text-status-warning",children:"No template"})]})]}),!t.envelope_schema&&e.jsx("div",{className:"bg-surface-sunken border border-surface-border rounded px-4 py-3 mb-3",children:e.jsxs("p",{className:"text-xs text-text-secondary leading-relaxed",children:["This workflow has no input template. Edit the JSON directly below, or ",e.jsx(le,{to:"/workflows/registry/new",className:"text-status-success hover:underline",children:"register it"})," in the Workflow Registry with an envelope schema for pre-filled fields and form-based input."]})}),a||!m?e.jsx("textarea",{value:y,onChange:l=>f(l.target.value),className:"input-json",rows:12,spellCheck:!1}):e.jsx("div",{className:"space-y-3",children:g.map(({key:l,type:c})=>{var w,k;const p=i[l],n=typeof p=="string"?p:JSON.stringify(p??(c==="array"?[]:{}),null,2),h=Math.min(20,Math.max(4,((k=(w=n==null?void 0:n.split)==null?void 0:w.call(n,`
5
- `))==null?void 0:k.length)??4));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[l,e.jsx("span",{className:"ml-2 font-normal normal-case",children:c})]}),c==="boolean"?e.jsxs("select",{value:String(p??!1),onChange:b=>x(l,b.target.value,c),className:"select text-xs w-full",children:[e.jsx("option",{value:"true",children:"true"}),e.jsx("option",{value:"false",children:"false"})]}):c==="object"||c==="array"?e.jsx("textarea",{value:n,onChange:b=>{try{x(l,JSON.parse(b.target.value),c)}catch{v({...i,[l]:b.target.value})}},className:"input-json w-full",rows:h,spellCheck:!1}):e.jsx("input",{type:c==="number"?"number":"text",value:String(p??""),onChange:b=>x(l,b.target.value,c),className:"input text-xs w-full"})]},l)})}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-1.5",children:["The envelope wraps your workflow input. ",e.jsx("code",{className:"text-accent/80",children:"data"})," holds workflow-specific fields; ",e.jsx("code",{className:"text-accent/80",children:"metadata"})," is optional context."]})]})}function fe({selected:t,executionsPath:a}){const m=ce(),{isSuperAdmin:y,hasRoleType:i}=T(),g=y||i("admin"),f=q(),[u,x]=o.useState(L),[v,l]=o.useState(""),[c,p]=o.useState({}),[n,h]=o.useState(!1),[w,k]=o.useState(""),b=t.certified,[E,C]=o.useState(b),_=o.useMemo(()=>R(t.envelope_schema??null),[t.envelope_schema]),M=_.length>0,S=o.useMemo(()=>{if(!t.envelope_schema)return{};const r=t.envelope_schema.metadata;return r&&typeof r=="object"?r:{}},[t.envelope_schema]);o.useEffect(()=>{var N;l(""),f.reset();const r=sessionStorage.getItem("lt:invoke:prefill");if(r){sessionStorage.removeItem("lt:invoke:prefill"),x(r);try{const d=JSON.parse(r),P=(d==null?void 0:d.data)??d;P&&typeof P=="object"&&p(I(P))}catch{}h(!0),k("");return}const j=t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):L;x(j),(N=t.envelope_schema)!=null&&N.data&&typeof t.envelope_schema.data=="object"?p(I(t.envelope_schema.data)):p({}),h(!R(t.envelope_schema??null).length),k(""),C(b)},[t.workflow_type]);const O=()=>{if(n)try{const r=JSON.parse(u);r.data&&typeof r.data=="object"&&p(I(r.data))}catch{}else x(A(c,S));h(!n)},W=(r,j,N)=>{let d=j;N==="number"?d=j===""?0:Number(j):N==="boolean"&&(d=j==="true"||j===!0);const P={...c,[r]:d};p(P),x(A(P,S))},s=async()=>{l("");let r;try{r=JSON.parse(u)}catch{l("Invalid JSON");return}const{data:j,metadata:N}=r;if(!j||typeof j!="object"){l('Envelope must include a "data" object');return}try{const d={...N??{}};E&&(d.certified=!0),await f.mutateAsync({workflowType:t.workflow_type,data:j,metadata:d,...w?{execute_as:w}:{}}),m(a)}catch{}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-mono font-medium text-text-primary",children:t.workflow_type}),t.description&&e.jsx("div",{className:"text-xs text-text-secondary mt-1 leading-relaxed",children:e.jsx(V,{content:t.description,compact:!0})})]}),e.jsx(me,{config:t,overrideBot:w,onOverrideChange:k,showOverride:g}),b&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:E,onChange:r=>C(r.target.checked),className:"rounded border-surface-border text-accent focus:ring-accent/30"}),e.jsx(re,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Enable task tracking and escalation routing"})]}),e.jsx(pe,{selectedConfig:t,isJsonMode:n,hasFormView:M,jsonInput:u,formFields:c,dataFields:_,onJsonChange:r=>{x(r),l("")},onToggleMode:O,onUpdateFormField:W,onSetFormFields:p}),v&&e.jsx("p",{className:"text-xs text-status-error",children:v}),f.error&&e.jsx("p",{className:"text-xs text-status-error",children:f.error.message}),f.isSuccess&&e.jsx("p",{className:"text-xs text-status-success",children:"Workflow started"}),e.jsx("button",{onClick:s,disabled:f.isPending,className:"btn-primary",children:f.isPending?"Starting...":"Start Workflow"})]})}const F="invoke-run";function he({config:t,executionsPath:a,onClose:m}){return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 pt-4 pb-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Invoke"}),e.jsx("button",{onClick:m,className:"icon-link",title:"Close","aria-label":"Close",children:e.jsx(ne,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-6 pt-1",children:e.jsx(fe,{selected:t,executionsPath:a})})]})}function we(){const[t,a]=ie(),{data:m,isLoading:y}=B(),{data:i,isLoading:g}=Q(),{data:f}=K(),u=X(),x=t.get("type")??"",[v,l]=o.useState(""),[c,p]=o.useState(null),n=m??[],h=o.useMemo(()=>{const s=new Map;for(const r of i??[])s.set(r.workflow_type,r.tier??"durable");return s},[i]),w=o.useMemo(()=>{const s=n.filter(d=>d.invocable),r=new Set(n.map(d=>d.workflow_type)),N=(i??[]).filter(d=>d.active&&!r.has(d.workflow_type)).map(d=>({workflow_type:d.workflow_type,task_queue:d.task_queue??"",invocable:!0,certified:!1,description:null,default_role:"reviewer",roles:[],invocation_roles:[],consumes:[],envelope_schema:null,resolver_schema:null,cron_schedule:null,execute_as:null}));return[...s,...N]},[n,i]),k=w.find(s=>s.workflow_type===x),b=new Set((f??[]).filter(s=>s.active).map(s=>s.workflow_type)),E="/workflows/executions",C=o.useCallback(s=>{a(r=>{const j=new URLSearchParams(r);return s?j.set("type",s):j.delete("type"),j},{replace:!0})},[a]),_=o.useCallback(()=>C(null),[C]);o.useEffect(()=>{w.length===1&&!t.get("type")&&a({type:w[0].workflow_type},{replace:!0})},[w.length]);const M=o.useRef(null),S=o.useRef(!1);o.useEffect(()=>{if(!u)return;const s=k?x:null;s!==M.current&&(M.current=s,s&&k?u.setPanel(e.jsx(he,{config:k,executionsPath:E,onClose:_}),{key:F,width:420}):(S.current=!1,u.closePanel(F)))},[x,k,u,_,E]),o.useEffect(()=>{if(!(!u||!x)){if(u.open&&u.ownerKey===F){S.current=!0;return}S.current&&(S.current=!1,_())}},[u,x,_]);const O=o.useRef(u);O.current=u,o.useEffect(()=>()=>{var s;M.current&&((s=O.current)==null||s.closePanel(F))},[]);const W=s=>{C(s.workflow_type)};return y||g?e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]}):e.jsxs("div",{children:[e.jsx($,{title:"Invoke",docsHash:"#docs:dashboard.md:invoke-workflow"}),w.length===0?e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:"No invocable workflows"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:"Mark workflows as invocable in the registry, or start the server with examples enabled."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(z,{children:[J(w).length>1&&e.jsx(H,{label:"Queue",value:c??"",onChange:s=>p(s||null),options:J(w).map(s=>({value:s,label:s}))}),e.jsx(U,{label:"Search",value:v,onChange:l,placeholder:`${w.length} workflows…`})]}),e.jsx(de,{configs:w,selectedType:x,onSelect:W,tierMap:h,activeTypes:b,search:v,activeQueue:c})]})]})}function Ee(){return e.jsx(we,{})}export{Ee as DurableInvokePage,we as StartWorkflowPage};
6
- //# sourceMappingURL=index-DuyzcDuV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DuyzcDuV.js","sources":["../../src/pages/workflows/start/WorkflowSelector.tsx","../../src/pages/workflows/start/helpers.ts","../../src/pages/workflows/start/IdentitySummary.tsx","../../src/pages/workflows/start/EnvelopeEditor.tsx","../../src/pages/workflows/start/StartNowPanel.tsx","../../src/pages/workflows/start/StartWorkflowPage.tsx","../../src/pages/workflows/start/DurableInvokePage.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Bot, Clock, Play, Server, Wrench } from 'lucide-react';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\n\n/** The queue set a page-level filter bar offers — shared with the grouping below. */\nexport function workflowQueues(configs: LTWorkflowConfig[]): string[] {\n return [...new Set(configs.map((c) => c.task_queue).filter(Boolean))].sort() as string[];\n}\n\nexport function WorkflowSelector({\n configs,\n selectedType,\n onSelect,\n tierMap,\n activeTypes,\n search,\n activeQueue,\n}: {\n configs: LTWorkflowConfig[];\n selectedType: string;\n onSelect: (config: LTWorkflowConfig) => void;\n tierMap: Map<string, WorkflowTier>;\n activeTypes?: Set<string>;\n /** Owned by the page — the standard full-width FilterBar renders there. */\n search: string;\n activeQueue: string | null;\n}) {\n const queues = useMemo(() => workflowQueues(configs), [configs]);\n\n // Group by task queue; workflows without a queue collect under a trailing section\n const grouped = useMemo(() => {\n const q = search.toLowerCase().trim();\n const matches = (c: LTWorkflowConfig) =>\n !q ||\n c.workflow_type.toLowerCase().includes(q) ||\n c.description?.toLowerCase().includes(q);\n\n const targetQueues = activeQueue ? [activeQueue] : queues;\n const sections = targetQueues\n .map((queue) => ({\n queue,\n workflows: configs.filter((c) => c.task_queue === queue && matches(c)),\n }))\n .filter((g) => g.workflows.length > 0);\n\n if (!activeQueue) {\n const noQueue = configs.filter((c) => !c.task_queue && matches(c));\n if (noQueue.length > 0) sections.push({ queue: '', workflows: noQueue });\n }\n return sections;\n }, [configs, queues, search, activeQueue]);\n\n return (\n <div>\n {grouped.length === 0 ? (\n <p className=\"text-sm text-text-tertiary py-8 text-center\">No workflows match your filter.</p>\n ) : (\n <div className=\"space-y-10\">\n {grouped.map(({ queue, workflows }) => (\n <div key={queue || '__none__'}>\n <div className=\"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border\">\n {queue ? (\n <Server className=\"w-3 h-3 text-accent\" strokeWidth={1.5} />\n ) : (\n <Wrench className=\"w-3 h-3 text-text-quaternary\" strokeWidth={1.5} />\n )}\n <h2 className=\"section-h2\">{queue || 'No Queue'}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <div className=\"divide-y divide-surface-border/30\">\n {workflows.map((config) => (\n <WorkflowRow\n key={config.workflow_type}\n config={config}\n isSelected={selectedType === config.workflow_type}\n tier={tierMap.get(config.workflow_type) ?? 'durable'}\n cronActive={activeTypes?.has(config.workflow_type) ?? false}\n onSelect={onSelect}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction WorkflowRow({\n config,\n isSelected,\n tier,\n cronActive,\n onSelect,\n}: {\n config: LTWorkflowConfig;\n isSelected: boolean;\n tier: WorkflowTier;\n cronActive: boolean;\n onSelect: (config: LTWorkflowConfig) => void;\n}) {\n const variant =\n tier === 'certified' ? 'certified' : tier === 'registered' ? 'registered' : 'durable';\n return (\n <button\n onClick={() => onSelect(config)}\n className=\"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150\"\n >\n {isSelected && (\n <span className=\"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full\" />\n )}\n <div className=\"flex items-center gap-3\">\n <WorkflowPill type={config.workflow_type} size=\"md\" variant={variant} />\n {config.description && (\n <p className=\"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {config.description}\n </p>\n )}\n <span className=\"ml-auto flex items-center gap-2 shrink-0\">\n {config.execute_as && (\n <span className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded\">\n <Bot className=\"w-2.5 h-2.5\" />\n {config.execute_as}\n </span>\n )}\n {cronActive && (\n <span title=\"Cron schedule active\">\n <Clock className=\"w-3 h-3 text-status-success/70 shrink-0\" />\n </span>\n )}\n <NamespacePill namespace=\"durable\" />\n {/* Trailing action icon — quiet until row hover, visible on the\n selected row. Selecting opens the invoke form in the shell panel. */}\n <span title=\"Configure & invoke\">\n <Play\n className={`w-3 h-3 transition-opacity ${\n isSelected ? 'text-accent opacity-100' : 'text-accent opacity-0 group-hover:opacity-100'\n }`}\n strokeWidth={1.5}\n />\n </span>\n </span>\n </div>\n </button>\n );\n}\n","export const DEFAULT_ENVELOPE = '{\\n \"data\": {},\\n \"metadata\": {}\\n}';\n\n/** Infer a simple field type from a value. */\nexport function inferTypeFromValue(value: unknown): string {\n if (typeof value === 'boolean') return 'boolean';\n if (typeof value === 'number') return 'number';\n if (Array.isArray(value)) return 'array';\n if (value !== null && typeof value === 'object') return 'object';\n return 'string';\n}\n\n/** Extract the data keys from an envelope_schema and their inferred types. */\nexport function extractDataFields(\n schema: Record<string, unknown> | null,\n): { key: string; type: string; defaultValue: unknown }[] {\n if (!schema) return [];\n const data = schema.data;\n if (!data || typeof data !== 'object') return [];\n return Object.entries(data as Record<string, unknown>).map(([key, value]) => ({\n key,\n type: inferTypeFromValue(value),\n defaultValue: value,\n }));\n}\n\n/** Build form field values from data object. */\nexport function dataToFields(data: Record<string, unknown>): Record<string, unknown> {\n return { ...data };\n}\n\n/** Build full envelope JSON string from form fields + metadata. */\nexport function fieldsToJson(\n fields: Record<string, unknown>,\n metadata: Record<string, unknown>,\n): string {\n return JSON.stringify({ data: fields, metadata }, null, 2);\n}\n","import { Bot, UserCircle } from 'lucide-react';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\nexport function IdentitySummary({\n config,\n overrideBot,\n onOverrideChange,\n showOverride,\n}: {\n config: LTWorkflowConfig;\n overrideBot?: string;\n onOverrideChange?: (botExternalId: string) => void;\n showOverride?: boolean;\n}) {\n const { user } = useAuth();\n const effectiveBot = overrideBot || config.execute_as;\n\n return (\n <div className=\"bg-surface-sunken rounded-lg px-4 py-3 space-y-3\">\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <span className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium\">Running as</span>\n {effectiveBot && !overrideBot && (\n <span className=\"text-2xs text-text-tertiary\">configured default</span>\n )}\n {overrideBot && (\n <span className=\"text-2xs text-accent\">admin override</span>\n )}\n </div>\n {/* Read-only identity, styled as a field so it reads consistently with\n the Override control below and pops off the sunken band. */}\n <div className=\"field flex items-center gap-1.5\">\n {effectiveBot ? (\n <>\n <Bot className=\"w-3.5 h-3.5 text-accent/70 shrink-0\" />\n <span className=\"text-xs text-text-primary font-mono\">{effectiveBot}</span>\n </>\n ) : (\n <>\n <UserCircle className=\"w-3.5 h-3.5 text-text-tertiary shrink-0\" />\n <span className=\"text-xs text-text-primary\">\n {user?.displayName || user?.username || 'you'}\n </span>\n </>\n )}\n </div>\n </div>\n {showOverride && onOverrideChange && (\n <div>\n <label className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block\">Override identity</label>\n <BotPicker\n selected={overrideBot ?? ''}\n onChange={onOverrideChange}\n placeholder={config.execute_as ? `Default: ${config.execute_as}` : 'Invoking user (default)'}\n />\n </div>\n )}\n </div>\n );\n}\n","import { Link } from 'react-router-dom';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\ninterface DataField {\n key: string;\n type: string;\n defaultValue: unknown;\n}\n\nexport function EnvelopeEditor({\n selectedConfig,\n isJsonMode,\n hasFormView,\n jsonInput,\n formFields,\n dataFields,\n onJsonChange,\n onToggleMode,\n onUpdateFormField,\n onSetFormFields,\n}: {\n selectedConfig: LTWorkflowConfig;\n isJsonMode: boolean;\n hasFormView: boolean;\n jsonInput: string;\n formFields: Record<string, unknown>;\n dataFields: DataField[];\n onJsonChange: (value: string) => void;\n onToggleMode: () => void;\n onUpdateFormField: (key: string, value: unknown, type: string) => void;\n onSetFormFields: (fields: Record<string, unknown>) => void;\n}) {\n return (\n <div>\n <div className=\"flex items-baseline justify-between mb-2\">\n <label className=\"block text-xs text-text-secondary\">\n Envelope\n </label>\n <div className=\"flex items-center gap-3\">\n {hasFormView && (\n <button\n type=\"button\"\n onClick={onToggleMode}\n className=\"text-2xs text-accent hover:underline\"\n >\n {isJsonMode ? 'Form view' : 'JSON view'}\n </button>\n )}\n {selectedConfig.envelope_schema ? (\n <span className=\"text-2xs text-accent\">\n Pre-filled from workflow config\n </span>\n ) : (\n <span className=\"text-2xs text-status-warning\">\n No template\n </span>\n )}\n </div>\n </div>\n\n {!selectedConfig.envelope_schema && (\n <div className=\"bg-surface-sunken border border-surface-border rounded px-4 py-3 mb-3\">\n <p className=\"text-xs text-text-secondary leading-relaxed\">\n This workflow has no input template. Edit the JSON directly below, or <Link to=\"/workflows/registry/new\" className=\"text-status-success hover:underline\">register it</Link> in the Workflow Registry with an envelope schema for pre-filled fields and form-based input.\n </p>\n </div>\n )}\n\n {isJsonMode || !hasFormView ? (\n /* JSON view */\n <textarea\n value={jsonInput}\n onChange={(e) => onJsonChange(e.target.value)}\n className=\"input-json\"\n rows={12}\n spellCheck={false}\n />\n ) : (\n /* Form view */\n <div className=\"space-y-3\">\n {dataFields.map(({ key, type }) => {\n const value = formFields[key];\n const jsonValue =\n typeof value === 'string'\n ? value\n : JSON.stringify(\n value ?? (type === 'array' ? [] : {}),\n null,\n 2,\n );\n const textareaRows = Math.min(\n 20,\n Math.max(4, (jsonValue?.split?.('\\n')?.length ?? 4)),\n );\n return (\n <div key={key}>\n <label className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n {key}\n <span className=\"ml-2 font-normal normal-case\">\n {type}\n </span>\n </label>\n {type === 'boolean' ? (\n <select\n value={String(value ?? false)}\n onChange={(e) =>\n onUpdateFormField(key, e.target.value, type)\n }\n className=\"select text-xs w-full\"\n >\n <option value=\"true\">true</option>\n <option value=\"false\">false</option>\n </select>\n ) : type === 'object' || type === 'array' ? (\n <textarea\n value={jsonValue}\n onChange={(e) => {\n try {\n onUpdateFormField(\n key,\n JSON.parse(e.target.value),\n type,\n );\n } catch {\n // Keep raw text without syncing to JSON\n onSetFormFields({\n ...formFields,\n [key]: e.target.value,\n });\n }\n }}\n className=\"input-json w-full\"\n rows={textareaRows}\n spellCheck={false}\n />\n ) : (\n <input\n type={type === 'number' ? 'number' : 'text'}\n value={String(value ?? '')}\n onChange={(e) =>\n onUpdateFormField(key, e.target.value, type)\n }\n className=\"input text-xs w-full\"\n />\n )}\n </div>\n );\n })}\n </div>\n )}\n <p className=\"text-2xs text-text-tertiary mt-1.5\">\n The envelope wraps your workflow input. <code className=\"text-accent/80\">data</code> holds workflow-specific fields; <code className=\"text-accent/80\">metadata</code> is optional context.\n </p>\n </div>\n );\n}\n","import { useState, useEffect, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ShieldCheck } from 'lucide-react';\nimport { useInvokeWorkflow } from '../../../api/workflows';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\nimport {\n DEFAULT_ENVELOPE,\n extractDataFields,\n dataToFields,\n fieldsToJson,\n} from './helpers';\nimport { IdentitySummary } from './IdentitySummary';\nimport { EnvelopeEditor } from './EnvelopeEditor';\nimport { SimpleMarkdown } from '../../../components/common/display/SimpleMarkdown';\n\nexport function StartNowPanel({ selected, executionsPath }: { selected: LTWorkflowConfig; executionsPath: string }) {\n const navigate = useNavigate();\n const { isSuperAdmin, hasRoleType } = useAuth();\n const isAdmin = isSuperAdmin || hasRoleType('admin');\n const invokeMutation = useInvokeWorkflow();\n const [jsonInput, setJsonInput] = useState(DEFAULT_ENVELOPE);\n const [parseError, setParseError] = useState('');\n const [formFields, setFormFields] = useState<Record<string, unknown>>({});\n const [isJsonMode, setIsJsonMode] = useState(false);\n const [overrideBot, setOverrideBot] = useState('');\n // Per-run interceptor opt-out: offered when the workflow's registration is\n // certified. metadata.certified=false bypasses config lookup for this run.\n const isCertifiable = selected.certified;\n const [certified, setCertified] = useState(isCertifiable);\n\n const dataFields = useMemo(\n () => extractDataFields(selected.envelope_schema ?? null),\n [selected.envelope_schema],\n );\n const hasFormView = dataFields.length > 0;\n\n const schemaMetadata = useMemo(() => {\n if (!selected.envelope_schema) return {};\n const md = selected.envelope_schema.metadata;\n return md && typeof md === 'object' ? (md as Record<string, unknown>) : {};\n }, [selected.envelope_schema]);\n\n useEffect(() => {\n setParseError('');\n invokeMutation.reset();\n\n const prefill = sessionStorage.getItem('lt:invoke:prefill');\n if (prefill) {\n sessionStorage.removeItem('lt:invoke:prefill');\n setJsonInput(prefill);\n try {\n const parsed = JSON.parse(prefill);\n const data = parsed?.data ?? parsed;\n if (data && typeof data === 'object') setFormFields(dataToFields(data));\n } catch { /* use as-is */ }\n setIsJsonMode(true);\n setOverrideBot('');\n return;\n }\n\n const json = selected.envelope_schema\n ? JSON.stringify(selected.envelope_schema, null, 2)\n : DEFAULT_ENVELOPE;\n setJsonInput(json);\n if (selected.envelope_schema?.data && typeof selected.envelope_schema.data === 'object') {\n setFormFields(dataToFields(selected.envelope_schema.data as Record<string, unknown>));\n } else {\n setFormFields({});\n }\n setIsJsonMode(!extractDataFields(selected.envelope_schema ?? null).length);\n setOverrideBot('');\n setCertified(isCertifiable);\n }, [selected.workflow_type]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleToggleMode = () => {\n if (isJsonMode) {\n try {\n const parsed = JSON.parse(jsonInput);\n if (parsed.data && typeof parsed.data === 'object') setFormFields(dataToFields(parsed.data));\n } catch { /* keep existing */ }\n } else {\n setJsonInput(fieldsToJson(formFields, schemaMetadata));\n }\n setIsJsonMode(!isJsonMode);\n };\n\n const updateFormField = (key: string, value: unknown, type: string) => {\n let parsed = value;\n if (type === 'number') parsed = value === '' ? 0 : Number(value);\n else if (type === 'boolean') parsed = value === 'true' || value === true;\n const updated = { ...formFields, [key]: parsed };\n setFormFields(updated);\n setJsonInput(fieldsToJson(updated, schemaMetadata));\n };\n\n const handleInvoke = async () => {\n setParseError('');\n let envelope: Record<string, unknown>;\n try {\n envelope = JSON.parse(jsonInput);\n } catch {\n setParseError('Invalid JSON');\n return;\n }\n const { data, metadata } = envelope;\n if (!data || typeof data !== 'object') {\n setParseError('Envelope must include a \"data\" object');\n return;\n }\n try {\n const resolvedMetadata = { ...((metadata as Record<string, unknown>) ?? {}) };\n if (certified) resolvedMetadata.certified = true;\n await invokeMutation.mutateAsync({\n workflowType: selected.workflow_type,\n data: data as Record<string, unknown>,\n metadata: resolvedMetadata,\n ...(overrideBot ? { execute_as: overrideBot } : {}),\n });\n navigate(executionsPath);\n } catch { /* error via mutation */ }\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h2 className=\"text-lg font-mono font-medium text-text-primary\">{selected.workflow_type}</h2>\n {selected.description && (\n <div className=\"text-xs text-text-secondary mt-1 leading-relaxed\">\n <SimpleMarkdown content={selected.description} compact />\n </div>\n )}\n </div>\n\n <IdentitySummary\n config={selected}\n overrideBot={overrideBot}\n onOverrideChange={setOverrideBot}\n showOverride={isAdmin}\n />\n\n {isCertifiable && (\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={certified}\n onChange={(e) => setCertified(e.target.checked)}\n className=\"rounded border-surface-border text-accent focus:ring-accent/30\"\n />\n <ShieldCheck className=\"w-3.5 h-3.5 text-text-tertiary\" />\n <span className=\"text-xs text-text-secondary\">Enable task tracking and escalation routing</span>\n </label>\n )}\n\n <EnvelopeEditor\n selectedConfig={selected}\n isJsonMode={isJsonMode}\n hasFormView={hasFormView}\n jsonInput={jsonInput}\n formFields={formFields}\n dataFields={dataFields}\n onJsonChange={(v) => { setJsonInput(v); setParseError(''); }}\n onToggleMode={handleToggleMode}\n onUpdateFormField={updateFormField}\n onSetFormFields={setFormFields}\n />\n\n {parseError && <p className=\"text-xs text-status-error\">{parseError}</p>}\n {invokeMutation.error && <p className=\"text-xs text-status-error\">{invokeMutation.error.message}</p>}\n {invokeMutation.isSuccess && <p className=\"text-xs text-status-success\">Workflow started</p>}\n\n <button onClick={handleInvoke} disabled={invokeMutation.isPending} className=\"btn-primary\">\n {invokeMutation.isPending ? 'Starting...' : 'Start Workflow'}\n </button>\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { X } from 'lucide-react';\nimport { useWorkflowConfigs, useDiscoveredWorkflows, useCronStatus } from '../../../api/workflows';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { useShellPanelOptional } from '../../../hooks/useShellPanel';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\nimport { WorkflowSelector, workflowQueues } from './WorkflowSelector';\nimport { StartNowPanel } from './StartNowPanel';\n\n// Shell-panel ownership key — the invoke form claims/releases this slot.\nconst INVOKE_PANEL_KEY = 'invoke-run';\n\n/** The invoke form framed for the shell panel: small header with a close X. */\nfunction InvokeRunPanel({\n config,\n executionsPath,\n onClose,\n}: {\n config: LTWorkflowConfig;\n executionsPath: string;\n onClose: () => void;\n}) {\n return (\n <div className=\"h-full flex flex-col\">\n <div className=\"flex items-center justify-between px-5 pt-4 pb-2\">\n <p className=\"text-2xs font-semibold uppercase tracking-widest text-text-tertiary\">Invoke</p>\n <button onClick={onClose} className=\"icon-link\" title=\"Close\" aria-label=\"Close\">\n <X className=\"w-4 h-4\" />\n </button>\n </div>\n <div className=\"flex-1 overflow-y-auto px-5 pb-6 pt-1\">\n <StartNowPanel selected={config} executionsPath={executionsPath} />\n </div>\n </div>\n );\n}\n\nexport function StartWorkflowPage() {\n const [searchParams, setSearchParams] = useSearchParams();\n const { data: configsData, isLoading } = useWorkflowConfigs();\n const { data: discoveredData, isLoading: discoveredLoading } = useDiscoveredWorkflows();\n const { data: cronEntries } = useCronStatus();\n const shell = useShellPanelOptional();\n\n const selectedType = searchParams.get('type') ?? '';\n // The list filters live at page level so the FilterBar spans the page —\n // the standard master-list geometry.\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n\n const configs: LTWorkflowConfig[] = configsData ?? [];\n\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const dw of discoveredData ?? []) {\n map.set(dw.workflow_type, dw.tier ?? 'durable');\n }\n return map;\n }, [discoveredData]);\n\n const invocableConfigs = useMemo(() => {\n const invocable = configs.filter((c) => c.invocable);\n const registeredTypes = new Set(configs.map((c) => c.workflow_type));\n const discovered = discoveredData ?? [];\n const durable = discovered\n .filter((dw) => dw.active && !registeredTypes.has(dw.workflow_type))\n .map((dw) => ({\n workflow_type: dw.workflow_type,\n task_queue: dw.task_queue ?? '',\n invocable: true,\n certified: false,\n description: null,\n default_role: 'reviewer',\n roles: [],\n invocation_roles: [],\n consumes: [],\n envelope_schema: null,\n resolver_schema: null,\n cron_schedule: null,\n execute_as: null,\n } satisfies LTWorkflowConfig));\n return [...invocable, ...durable];\n }, [configs, discoveredData]);\n\n const selectedConfig = invocableConfigs.find((c) => c.workflow_type === selectedType);\n\n const activeTypes = new Set(\n (cronEntries ?? []).filter((e) => e.active).map((e) => e.workflow_type),\n );\n\n const executionsPath = '/workflows/executions';\n\n const setType = useCallback(\n (value: string | null) => {\n setSearchParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (value) next.set('type', value);\n else next.delete('type');\n return next;\n },\n { replace: true },\n );\n },\n [setSearchParams],\n );\n const clearSelection = useCallback(() => setType(null), [setType]);\n\n useEffect(() => {\n if (invocableConfigs.length === 1 && !searchParams.get('type')) {\n setSearchParams({ type: invocableConfigs[0].workflow_type }, { replace: true });\n }\n }, [invocableConfigs.length]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // ── ?type= ↔ shell panel sync ──────────────────────────────────────────────\n // The param is the source of truth: a change (row click, deep link,\n // back/forward) opens/closes the run panel in the shell's right slot; an\n // external close (the panel's X, slot takeover) clears the param. Refs\n // guard both directions against loops — the same pattern as EntityLensView.\n const appliedType = useRef<string | null>(null);\n const panelWasOpen = useRef(false);\n useEffect(() => {\n if (!shell) return;\n const type = selectedConfig ? selectedType : null;\n if (type === appliedType.current) return;\n appliedType.current = type;\n if (type && selectedConfig) {\n shell.setPanel(\n <InvokeRunPanel config={selectedConfig} executionsPath={executionsPath} onClose={clearSelection} />,\n { key: INVOKE_PANEL_KEY, width: 420 },\n );\n } else {\n panelWasOpen.current = false;\n shell.closePanel(INVOKE_PANEL_KEY);\n }\n }, [selectedType, selectedConfig, shell, clearSelection, executionsPath]);\n useEffect(() => {\n if (!shell || !selectedType) return;\n if (shell.open && shell.ownerKey === INVOKE_PANEL_KEY) {\n panelWasOpen.current = true;\n return;\n }\n if (panelWasOpen.current) {\n panelWasOpen.current = false;\n clearSelection();\n }\n }, [shell, selectedType, clearSelection]);\n // Unmount with the panel open releases the slot (keyed — never yanks\n // another claimant's panel).\n const shellRef = useRef(shell);\n shellRef.current = shell;\n useEffect(\n () => () => {\n if (appliedType.current) shellRef.current?.closePanel(INVOKE_PANEL_KEY);\n },\n [],\n );\n\n const handleSelect = (config: LTWorkflowConfig) => {\n setType(config.workflow_type);\n };\n\n if (isLoading || discoveredLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-48\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader title=\"Invoke\" docsHash=\"#docs:dashboard.md:invoke-workflow\" />\n\n {invocableConfigs.length === 0 ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-sm text-text-primary mb-1\">No invocable workflows</p>\n <p className=\"text-xs text-text-tertiary\">Mark workflows as invocable in the registry, or start the server with examples enabled.</p>\n </div>\n ) : (\n <>\n {/* The standard full-width sticky filter band — above the list. */}\n <FilterBar>\n {workflowQueues(invocableConfigs).length > 1 && (\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={workflowQueues(invocableConfigs).map((q) => ({ value: q, label: q }))}\n />\n )}\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${invocableConfigs.length} workflows…`}\n />\n </FilterBar>\n\n {/* The list IS the page — selecting a row opens the invoke form in\n the shell's right panel. */}\n <WorkflowSelector\n configs={invocableConfigs}\n selectedType={selectedType}\n onSelect={handleSelect}\n tierMap={tierMap}\n activeTypes={activeTypes}\n search={search}\n activeQueue={activeQueue}\n />\n </>\n )}\n </div>\n );\n}\n","import { StartWorkflowPage } from './StartWorkflowPage';\n\nexport function DurableInvokePage() {\n return <StartWorkflowPage />;\n}\n"],"names":["workflowQueues","configs","c","WorkflowSelector","selectedType","onSelect","tierMap","activeTypes","search","activeQueue","queues","useMemo","grouped","q","matches","_a","sections","queue","g","noQueue","jsx","workflows","jsxs","Server","Wrench","config","WorkflowRow","isSelected","tier","cronActive","variant","WorkflowPill","Bot","Clock","NamespacePill","Play","DEFAULT_ENVELOPE","inferTypeFromValue","value","extractDataFields","schema","data","key","dataToFields","fieldsToJson","fields","metadata","IdentitySummary","overrideBot","onOverrideChange","showOverride","user","useAuth","effectiveBot","Fragment","UserCircle","BotPicker","EnvelopeEditor","selectedConfig","isJsonMode","hasFormView","jsonInput","formFields","dataFields","onJsonChange","onToggleMode","onUpdateFormField","onSetFormFields","Link","e","type","jsonValue","textareaRows","_b","StartNowPanel","selected","executionsPath","navigate","useNavigate","isSuperAdmin","hasRoleType","isAdmin","invokeMutation","useInvokeWorkflow","setJsonInput","useState","parseError","setParseError","setFormFields","setIsJsonMode","setOverrideBot","isCertifiable","certified","setCertified","schemaMetadata","md","useEffect","prefill","parsed","json","handleToggleMode","updateFormField","updated","handleInvoke","envelope","resolvedMetadata","SimpleMarkdown","ShieldCheck","v","INVOKE_PANEL_KEY","InvokeRunPanel","onClose","X","StartWorkflowPage","searchParams","setSearchParams","useSearchParams","configsData","isLoading","useWorkflowConfigs","discoveredData","discoveredLoading","useDiscoveredWorkflows","cronEntries","useCronStatus","shell","useShellPanelOptional","setSearch","setActiveQueue","map","dw","invocableConfigs","invocable","registeredTypes","durable","setType","useCallback","prev","next","clearSelection","appliedType","useRef","panelWasOpen","shellRef","handleSelect","PageHeader","FilterBar","FilterSelect","FilterInput","DurableInvokePage"],"mappings":"qmBAOO,SAASA,EAAeC,EAAuC,CACpE,MAAO,CAAC,GAAG,IAAI,IAAIA,EAAQ,IAAKC,GAAMA,EAAE,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAA,CACxE,CAEO,SAASC,GAAiB,CAC/B,QAAAF,EACA,aAAAG,EACA,SAAAC,EACA,QAAAC,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,CACF,EASG,CACD,MAAMC,EAASC,EAAAA,QAAQ,IAAMX,EAAeC,CAAO,EAAG,CAACA,CAAO,CAAC,EAGz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oCAAA,CAAqC,EACpDA,EAAAA,IAAC,MAAA,CAAI,UAAU,gCAAA,CAAiC,CAAA,EAClD,SAKD,MAAA,CACC,SAAA,CAAAA,EAAAA,IAAC6H,EAAA,CAAW,MAAM,SAAS,SAAS,qCAAqC,EAExEd,EAAiB,SAAW,EAC3B7G,EAAAA,KAAC,MAAA,CAAI,UAAU,oBACb,SAAA,CAAAF,EAAAA,IAAC,IAAA,CAAE,UAAU,iCAAiC,SAAA,yBAAsB,EACpEA,EAAAA,IAAC,IAAA,CAAE,UAAU,6BAA6B,SAAA,yFAAA,CAAuF,CAAA,CAAA,CACnI,EAEAE,EAAAA,KAAAgC,EAAAA,SAAA,CAEE,SAAA,CAAAhC,OAAC4H,EAAA,CACE,SAAA,CAAAlJ,EAAemI,CAAgB,EAAE,OAAS,GACzC/G,EAAAA,IAAC+H,EAAA,CACC,MAAM,QACN,MAAO1I,GAAe,GACtB,SAAWmG,GAAMoB,EAAepB,GAAK,IAAI,EACzC,QAAS5G,EAAemI,CAAgB,EAAE,IAAKtH,IAAO,CAAE,MAAOA,EAAG,MAAOA,CAAA,EAAI,CAAA,CAAA,EAGjFO,EAAAA,IAACgI,EAAA,CACC,MAAM,SACN,MAAO5I,EACP,SAAUuH,EACV,YAAa,GAAGI,EAAiB,MAAM,aAAA,CAAA,CACzC,EACF,EAIA/G,EAAAA,IAACjB,GAAA,CACC,QAASgI,EACT,aAAA/H,EACA,SAAU4I,EACV,QAAA1I,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EAEJ,CAEJ,CCvNO,SAAS4I,IAAoB,CAClC,aAAQpC,GAAA,EAAkB,CAC5B"}
@@ -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