@hotmeshio/long-tail 0.16.1 → 0.16.2

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 (181) hide show
  1. package/build/shared/form-validation/field-validator.d.ts +12 -0
  2. package/build/shared/form-validation/field-validator.js +27 -0
  3. package/dashboard/dist/assets/{AdminDashboard-Dnj4asuh.js → AdminDashboard-BrOvvDHF.js} +2 -2
  4. package/dashboard/dist/assets/{AdminDashboard-Dnj4asuh.js.map → AdminDashboard-BrOvvDHF.js.map} +1 -1
  5. package/dashboard/dist/assets/{AgentConfigPage-CS0CezLt.js → AgentConfigPage-CtVq8J0L.js} +2 -2
  6. package/dashboard/dist/assets/{AgentConfigPage-CS0CezLt.js.map → AgentConfigPage-CtVq8J0L.js.map} +1 -1
  7. package/dashboard/dist/assets/{AgentDetailPage-CG0HO-MG.js → AgentDetailPage-DTfTQDug.js} +2 -2
  8. package/dashboard/dist/assets/{AgentDetailPage-CG0HO-MG.js.map → AgentDetailPage-DTfTQDug.js.map} +1 -1
  9. package/dashboard/dist/assets/{AgentsPage-cLZPda64.js → AgentsPage-vCTc3Qvj.js} +2 -2
  10. package/dashboard/dist/assets/{AgentsPage-cLZPda64.js.map → AgentsPage-vCTc3Qvj.js.map} +1 -1
  11. package/dashboard/dist/assets/{AvailableEscalationsPage-Dv5GE_NU.js → AvailableEscalationsPage-DJODShd7.js} +2 -2
  12. package/dashboard/dist/assets/{AvailableEscalationsPage-Dv5GE_NU.js.map → AvailableEscalationsPage-DJODShd7.js.map} +1 -1
  13. package/dashboard/dist/assets/{BotPicker-BgXaJfUZ.js → BotPicker-GU44inXA.js} +2 -2
  14. package/dashboard/dist/assets/{BotPicker-BgXaJfUZ.js.map → BotPicker-GU44inXA.js.map} +1 -1
  15. package/dashboard/dist/assets/{BulkAssignModal-BUfV9aba.js → BulkAssignModal-ChqzG6FY.js} +2 -2
  16. package/dashboard/dist/assets/{BulkAssignModal-BUfV9aba.js.map → BulkAssignModal-ChqzG6FY.js.map} +1 -1
  17. package/dashboard/dist/assets/{CapabilitiesPage-CaiDhtmq.js → CapabilitiesPage-Y2hycdPY.js} +2 -2
  18. package/dashboard/dist/assets/{CapabilitiesPage-CaiDhtmq.js.map → CapabilitiesPage-Y2hycdPY.js.map} +1 -1
  19. package/dashboard/dist/assets/{CollapsibleSection-C6R7Lhao.js → CollapsibleSection-CmCwt_Rs.js} +2 -2
  20. package/dashboard/dist/assets/{CollapsibleSection-C6R7Lhao.js.map → CollapsibleSection-CmCwt_Rs.js.map} +1 -1
  21. package/dashboard/dist/assets/{CountdownTimer-CFR2pPT9.js → CountdownTimer-Bx2XXJOd.js} +2 -2
  22. package/dashboard/dist/assets/{CountdownTimer-CFR2pPT9.js.map → CountdownTimer-Bx2XXJOd.js.map} +1 -1
  23. package/dashboard/dist/assets/{CredentialsPage-9d2xZhfU.js → CredentialsPage-CoX_PNBe.js} +2 -2
  24. package/dashboard/dist/assets/{CredentialsPage-9d2xZhfU.js.map → CredentialsPage-CoX_PNBe.js.map} +1 -1
  25. package/dashboard/dist/assets/{CronLabel-BfIYBjTD.js → CronLabel-CVYKRipP.js} +2 -2
  26. package/dashboard/dist/assets/{CronLabel-BfIYBjTD.js.map → CronLabel-CVYKRipP.js.map} +1 -1
  27. package/dashboard/dist/assets/{ElapsedCell-DV-35FDF.js → ElapsedCell-jRURiCRW.js} +2 -2
  28. package/dashboard/dist/assets/{ElapsedCell-DV-35FDF.js.map → ElapsedCell-jRURiCRW.js.map} +1 -1
  29. package/dashboard/dist/assets/{EntityTimelinePanel-mHaN_i7a.js → EntityTimelinePanel-G6nzvgpl.js} +2 -2
  30. package/dashboard/dist/assets/{EntityTimelinePanel-mHaN_i7a.js.map → EntityTimelinePanel-G6nzvgpl.js.map} +1 -1
  31. package/dashboard/dist/assets/{EscalationListSchemaPage-Km5jnrIW.js → EscalationListSchemaPage-D-rVTQ1m.js} +2 -2
  32. package/dashboard/dist/assets/{EscalationListSchemaPage-Km5jnrIW.js.map → EscalationListSchemaPage-D-rVTQ1m.js.map} +1 -1
  33. package/dashboard/dist/assets/{EscalationSchemaPage-CAJGIBv2.js → EscalationSchemaPage-CV0R_xY9.js} +2 -2
  34. package/dashboard/dist/assets/{EscalationSchemaPage-CAJGIBv2.js.map → EscalationSchemaPage-CV0R_xY9.js.map} +1 -1
  35. package/dashboard/dist/assets/{EscalationsOverview-nk9FXKmv.js → EscalationsOverview-DMdx15CQ.js} +2 -2
  36. package/dashboard/dist/assets/{EscalationsOverview-nk9FXKmv.js.map → EscalationsOverview-DMdx15CQ.js.map} +1 -1
  37. package/dashboard/dist/assets/{EventTable-DNRaYzTn.js → EventTable-CIvsdt-q.js} +2 -2
  38. package/dashboard/dist/assets/{EventTable-DNRaYzTn.js.map → EventTable-CIvsdt-q.js.map} +1 -1
  39. package/dashboard/dist/assets/{FilterBar-CmRA_E6x.js → FilterBar-DWYGkVRH.js} +2 -2
  40. package/dashboard/dist/assets/{FilterBar-CmRA_E6x.js.map → FilterBar-DWYGkVRH.js.map} +1 -1
  41. package/dashboard/dist/assets/{GraphInvokePage-HJfa82kv.js → GraphInvokePage-BGHlXh4r.js} +2 -2
  42. package/dashboard/dist/assets/{GraphInvokePage-HJfa82kv.js.map → GraphInvokePage-BGHlXh4r.js.map} +1 -1
  43. package/dashboard/dist/assets/{HomePage-B2JDwmmh.js → HomePage-BHOnp8SK.js} +2 -2
  44. package/dashboard/dist/assets/{HomePage-B2JDwmmh.js.map → HomePage-BHOnp8SK.js.map} +1 -1
  45. package/dashboard/dist/assets/{ListToolbar-CKuJ7HUH.js → ListToolbar-iOgn_db5.js} +2 -2
  46. package/dashboard/dist/assets/{ListToolbar-CKuJ7HUH.js.map → ListToolbar-iOgn_db5.js.map} +1 -1
  47. package/dashboard/dist/assets/{McpOverview-CZCzbiRs.js → McpOverview-Be9sMKCA.js} +2 -2
  48. package/dashboard/dist/assets/{McpOverview-CZCzbiRs.js.map → McpOverview-Be9sMKCA.js.map} +1 -1
  49. package/dashboard/dist/assets/{McpQueryDetailPage-C081BBcH.js → McpQueryDetailPage-BIgpmGJN.js} +2 -2
  50. package/dashboard/dist/assets/{McpQueryDetailPage-C081BBcH.js.map → McpQueryDetailPage-BIgpmGJN.js.map} +1 -1
  51. package/dashboard/dist/assets/{McpQueryPage-841V8CXb.js → McpQueryPage-Okcxw_Um.js} +2 -2
  52. package/dashboard/dist/assets/{McpQueryPage-841V8CXb.js.map → McpQueryPage-Okcxw_Um.js.map} +1 -1
  53. package/dashboard/dist/assets/{McpRunDetailPage-DZjlgp5W.js → McpRunDetailPage-DT8kOfih.js} +2 -2
  54. package/dashboard/dist/assets/{McpRunDetailPage-DZjlgp5W.js.map → McpRunDetailPage-DT8kOfih.js.map} +1 -1
  55. package/dashboard/dist/assets/{McpRunsPage-DW0VVd46.js → McpRunsPage-BXhoP77D.js} +2 -2
  56. package/dashboard/dist/assets/{McpRunsPage-DW0VVd46.js.map → McpRunsPage-BXhoP77D.js.map} +1 -1
  57. package/dashboard/dist/assets/{OperationsPage-DAw7z_Sh.js → OperationsPage-rVhC8JPv.js} +2 -2
  58. package/dashboard/dist/assets/{OperationsPage-DAw7z_Sh.js.map → OperationsPage-rVhC8JPv.js.map} +1 -1
  59. package/dashboard/dist/assets/{OperatorDashboard-BAnQNuD6.js → OperatorDashboard-CIt061hu.js} +2 -2
  60. package/dashboard/dist/assets/{OperatorDashboard-BAnQNuD6.js.map → OperatorDashboard-CIt061hu.js.map} +1 -1
  61. package/dashboard/dist/assets/{PersonaDetailPage-XENbpbSr.js → PersonaDetailPage-r46uNF4E.js} +2 -2
  62. package/dashboard/dist/assets/{PersonaDetailPage-XENbpbSr.js.map → PersonaDetailPage-r46uNF4E.js.map} +1 -1
  63. package/dashboard/dist/assets/{PersonasPage-CoWH5Fj8.js → PersonasPage-CayYv9-j.js} +2 -2
  64. package/dashboard/dist/assets/{PersonasPage-CoWH5Fj8.js.map → PersonasPage-CayYv9-j.js.map} +1 -1
  65. package/dashboard/dist/assets/{ProcessDetailPage-BDxOt-9L.js → ProcessDetailPage-dn7lkM4c.js} +2 -2
  66. package/dashboard/dist/assets/{ProcessDetailPage-BDxOt-9L.js.map → ProcessDetailPage-dn7lkM4c.js.map} +1 -1
  67. package/dashboard/dist/assets/{ProcessesListPage-BuNOmgig.js → ProcessesListPage-DOp5J6Be.js} +2 -2
  68. package/dashboard/dist/assets/{ProcessesListPage-BuNOmgig.js.map → ProcessesListPage-DOp5J6Be.js.map} +1 -1
  69. package/dashboard/dist/assets/{RoleDetailPage-DAzkfZ4T.js → RoleDetailPage-DOlNoiAK.js} +2 -2
  70. package/dashboard/dist/assets/{RoleDetailPage-DAzkfZ4T.js.map → RoleDetailPage-DOlNoiAK.js.map} +1 -1
  71. package/dashboard/dist/assets/{RolesPage-C9jZL4aM.js → RolesPage-DPppT6Zl.js} +2 -2
  72. package/dashboard/dist/assets/{RolesPage-C9jZL4aM.js.map → RolesPage-DPppT6Zl.js.map} +1 -1
  73. package/dashboard/dist/assets/{RunAsSelector-DswUl2-8.js → RunAsSelector-BgntKfSA.js} +2 -2
  74. package/dashboard/dist/assets/{RunAsSelector-DswUl2-8.js.map → RunAsSelector-BgntKfSA.js.map} +1 -1
  75. package/dashboard/dist/assets/{ScanCodesPage-D_FDxJgT.js → ScanCodesPage-DPm1lG79.js} +2 -2
  76. package/dashboard/dist/assets/{ScanCodesPage-D_FDxJgT.js.map → ScanCodesPage-DPm1lG79.js.map} +1 -1
  77. package/dashboard/dist/assets/{ScanSchemeDetailPage-Cbkpob5g.js → ScanSchemeDetailPage-CuoG89q1.js} +2 -2
  78. package/dashboard/dist/assets/{ScanSchemeDetailPage-Cbkpob5g.js.map → ScanSchemeDetailPage-CuoG89q1.js.map} +1 -1
  79. package/dashboard/dist/assets/{ScanStationPage-BI_cDWVp.js → ScanStationPage-2SLXqqs0.js} +2 -2
  80. package/dashboard/dist/assets/{ScanStationPage-BI_cDWVp.js.map → ScanStationPage-2SLXqqs0.js.map} +1 -1
  81. package/dashboard/dist/assets/{StickyPagination-CfTEnlh5.js → StickyPagination-Bc_Mzu_R.js} +2 -2
  82. package/dashboard/dist/assets/{StickyPagination-CfTEnlh5.js.map → StickyPagination-Bc_Mzu_R.js.map} +1 -1
  83. package/dashboard/dist/assets/{StreamMessageDetail-oa7Bx0lB.js → StreamMessageDetail-S1cnLGkf.js} +2 -2
  84. package/dashboard/dist/assets/{StreamMessageDetail-oa7Bx0lB.js.map → StreamMessageDetail-S1cnLGkf.js.map} +1 -1
  85. package/dashboard/dist/assets/{SwimlaneTimeline-CO96ep4N.js → SwimlaneTimeline-BUu2sPmY.js} +2 -2
  86. package/dashboard/dist/assets/{SwimlaneTimeline-CO96ep4N.js.map → SwimlaneTimeline-BUu2sPmY.js.map} +1 -1
  87. package/dashboard/dist/assets/{TaskDetailPage-BiO2eFQ0.js → TaskDetailPage-BMfNNtbN.js} +2 -2
  88. package/dashboard/dist/assets/{TaskDetailPage-BiO2eFQ0.js.map → TaskDetailPage-BMfNNtbN.js.map} +1 -1
  89. package/dashboard/dist/assets/{TasksListPage-DQ4WJfJo.js → TasksListPage-BmNnopOU.js} +2 -2
  90. package/dashboard/dist/assets/{TasksListPage-DQ4WJfJo.js.map → TasksListPage-BmNnopOU.js.map} +1 -1
  91. package/dashboard/dist/assets/{TimeAgo-ZwSSU_EG.js → TimeAgo-Dip7gQQx.js} +2 -2
  92. package/dashboard/dist/assets/{TimeAgo-ZwSSU_EG.js.map → TimeAgo-Dip7gQQx.js.map} +1 -1
  93. package/dashboard/dist/assets/{TimestampCell-BHmJ7das.js → TimestampCell-DRAYnIrx.js} +2 -2
  94. package/dashboard/dist/assets/{TimestampCell-BHmJ7das.js.map → TimestampCell-DRAYnIrx.js.map} +1 -1
  95. package/dashboard/dist/assets/{ToolTestPanel-DARNx6e0.js → ToolTestPanel-CQVYC3Ba.js} +2 -2
  96. package/dashboard/dist/assets/{ToolTestPanel-DARNx6e0.js.map → ToolTestPanel-CQVYC3Ba.js.map} +1 -1
  97. package/dashboard/dist/assets/{TopicDetailPage-BYcF0lO8.js → TopicDetailPage-Bmtwuksg.js} +2 -2
  98. package/dashboard/dist/assets/{TopicDetailPage-BYcF0lO8.js.map → TopicDetailPage-Bmtwuksg.js.map} +1 -1
  99. package/dashboard/dist/assets/{TopicsPage-CG-IZfpq.js → TopicsPage-DIgF7-mJ.js} +2 -2
  100. package/dashboard/dist/assets/{TopicsPage-CG-IZfpq.js.map → TopicsPage-DIgF7-mJ.js.map} +1 -1
  101. package/dashboard/dist/assets/{UserName-BGn4sSx1.js → UserName-DNKFz7X9.js} +2 -2
  102. package/dashboard/dist/assets/{UserName-BGn4sSx1.js.map → UserName-DNKFz7X9.js.map} +1 -1
  103. package/dashboard/dist/assets/{WorkflowExecutionPage-Dt_lskas.js → WorkflowExecutionPage-DraIBNpl.js} +2 -2
  104. package/dashboard/dist/assets/{WorkflowExecutionPage-Dt_lskas.js.map → WorkflowExecutionPage-DraIBNpl.js.map} +1 -1
  105. package/dashboard/dist/assets/{WorkflowsDashboard-Dl3carpF.js → WorkflowsDashboard-BH7kmFjM.js} +2 -2
  106. package/dashboard/dist/assets/{WorkflowsDashboard-Dl3carpF.js.map → WorkflowsDashboard-BH7kmFjM.js.map} +1 -1
  107. package/dashboard/dist/assets/{WorkflowsOverview-6CplKLvQ.js → WorkflowsOverview-C98pCjQX.js} +2 -2
  108. package/dashboard/dist/assets/{WorkflowsOverview-6CplKLvQ.js.map → WorkflowsOverview-C98pCjQX.js.map} +1 -1
  109. package/dashboard/dist/assets/{YamlWorkflowDetailPage-CZf6zZ4Q.js → YamlWorkflowDetailPage-BWQjXenZ.js} +2 -2
  110. package/dashboard/dist/assets/{YamlWorkflowDetailPage-CZf6zZ4Q.js.map → YamlWorkflowDetailPage-BWQjXenZ.js.map} +1 -1
  111. package/dashboard/dist/assets/{YamlWorkflowsPage-DRQ_3CZG.js → YamlWorkflowsPage-BGTI_sdP.js} +2 -2
  112. package/dashboard/dist/assets/{YamlWorkflowsPage-DRQ_3CZG.js.map → YamlWorkflowsPage-BGTI_sdP.js.map} +1 -1
  113. package/dashboard/dist/assets/{agents-BvtecCN5.js → agents-DfMrlw54.js} +2 -2
  114. package/dashboard/dist/assets/{agents-BvtecCN5.js.map → agents-DfMrlw54.js.map} +1 -1
  115. package/dashboard/dist/assets/{bots-CSmIqXtL.js → bots-B9zS0z7D.js} +2 -2
  116. package/dashboard/dist/assets/{bots-CSmIqXtL.js.map → bots-B9zS0z7D.js.map} +1 -1
  117. package/dashboard/dist/assets/{capabilities-xMqvjbWI.js → capabilities-DkLM1xgH.js} +2 -2
  118. package/dashboard/dist/assets/{capabilities-xMqvjbWI.js.map → capabilities-DkLM1xgH.js.map} +1 -1
  119. package/dashboard/dist/assets/{controlplane-Bi-tz-Gr.js → controlplane-SJK1yvbm.js} +2 -2
  120. package/dashboard/dist/assets/{controlplane-Bi-tz-Gr.js.map → controlplane-SJK1yvbm.js.map} +1 -1
  121. package/dashboard/dist/assets/{escalation-columns-DSalfPHI.js → escalation-columns-BvAylNM1.js} +2 -2
  122. package/dashboard/dist/assets/{escalation-columns-DSalfPHI.js.map → escalation-columns-BvAylNM1.js.map} +1 -1
  123. package/dashboard/dist/assets/{index-gHDAcM64.js → index-CLxuBb17.js} +2 -2
  124. package/dashboard/dist/assets/{index-gHDAcM64.js.map → index-CLxuBb17.js.map} +1 -1
  125. package/dashboard/dist/assets/{index-uqT6ovVQ.js → index-CXe2d5kg.js} +2 -2
  126. package/dashboard/dist/assets/{index-uqT6ovVQ.js.map → index-CXe2d5kg.js.map} +1 -1
  127. package/dashboard/dist/assets/{index-BjxQVsbg.js → index-ClVNU3G3.js} +2 -2
  128. package/dashboard/dist/assets/{index-BjxQVsbg.js.map → index-ClVNU3G3.js.map} +1 -1
  129. package/dashboard/dist/assets/{index-cX2H_U7R.js → index-Cw-V0VhS.js} +2 -2
  130. package/dashboard/dist/assets/{index-cX2H_U7R.js.map → index-Cw-V0VhS.js.map} +1 -1
  131. package/dashboard/dist/assets/{index-BWyPrDYG.js → index-D2IRxjSf.js} +2 -2
  132. package/dashboard/dist/assets/{index-BWyPrDYG.js.map → index-D2IRxjSf.js.map} +1 -1
  133. package/dashboard/dist/assets/{index-BIK4b7Ei.js → index-DKXOIcO3.js} +2 -2
  134. package/dashboard/dist/assets/{index-BIK4b7Ei.js.map → index-DKXOIcO3.js.map} +1 -1
  135. package/dashboard/dist/assets/{index-C8pPqnJb.js → index-DSfY8oDp.js} +2 -2
  136. package/dashboard/dist/assets/{index-C8pPqnJb.js.map → index-DSfY8oDp.js.map} +1 -1
  137. package/dashboard/dist/assets/index-DTZxHZJO.js +3 -0
  138. package/dashboard/dist/assets/index-DTZxHZJO.js.map +1 -0
  139. package/dashboard/dist/assets/{index-CEsGT3c9.js → index-DamcWcqG.js} +2 -2
  140. package/dashboard/dist/assets/{index-CEsGT3c9.js.map → index-DamcWcqG.js.map} +1 -1
  141. package/dashboard/dist/assets/{index-DATqc8Gv.js → index-DazfFRUx.js} +2 -2
  142. package/dashboard/dist/assets/{index-DATqc8Gv.js.map → index-DazfFRUx.js.map} +1 -1
  143. package/dashboard/dist/assets/{index-shnwALdy.js → index-DvmyIGeZ.js} +2 -2
  144. package/dashboard/dist/assets/{index-shnwALdy.js.map → index-DvmyIGeZ.js.map} +1 -1
  145. package/dashboard/dist/assets/{index-BYukuL1u.js → index-PjiXOVdw.js} +2 -2
  146. package/dashboard/dist/assets/{index-BYukuL1u.js.map → index-PjiXOVdw.js.map} +1 -1
  147. package/dashboard/dist/assets/{index-sbfCx2CF.js → index-zrTQcPjB.js} +3 -3
  148. package/dashboard/dist/assets/{index-sbfCx2CF.js.map → index-zrTQcPjB.js.map} +1 -1
  149. package/dashboard/dist/assets/{knowledge-DbDvUbq7.js → knowledge-BNp6MH-4.js} +2 -2
  150. package/dashboard/dist/assets/{knowledge-DbDvUbq7.js.map → knowledge-BNp6MH-4.js.map} +1 -1
  151. package/dashboard/dist/assets/{mcp-I2OmwD8P.js → mcp-Bb1k5rv-.js} +2 -2
  152. package/dashboard/dist/assets/{mcp-I2OmwD8P.js.map → mcp-Bb1k5rv-.js.map} +1 -1
  153. package/dashboard/dist/assets/{mcp-query-DwTp77HP.js → mcp-query-QVakMQnS.js} +2 -2
  154. package/dashboard/dist/assets/{mcp-query-DwTp77HP.js.map → mcp-query-QVakMQnS.js.map} +1 -1
  155. package/dashboard/dist/assets/{personas-DDr8gQGC.js → personas-DV2JUjVj.js} +2 -2
  156. package/dashboard/dist/assets/{personas-DDr8gQGC.js.map → personas-DV2JUjVj.js.map} +1 -1
  157. package/dashboard/dist/assets/{pipelines-uptnM5Qj.js → pipelines-BkVB7Q0p.js} +2 -2
  158. package/dashboard/dist/assets/{pipelines-uptnM5Qj.js.map → pipelines-BkVB7Q0p.js.map} +1 -1
  159. package/dashboard/dist/assets/{tasks-Em0f5Rsk.js → tasks-DvYWcASM.js} +2 -2
  160. package/dashboard/dist/assets/{tasks-Em0f5Rsk.js.map → tasks-DvYWcASM.js.map} +1 -1
  161. package/dashboard/dist/assets/{topics-B81zAt9U.js → topics-B9zXFuVG.js} +2 -2
  162. package/dashboard/dist/assets/{topics-B81zAt9U.js.map → topics-B9zXFuVG.js.map} +1 -1
  163. package/dashboard/dist/assets/{useEventHooks-B_Bqqzlo.js → useEventHooks-JDpifqGZ.js} +2 -2
  164. package/dashboard/dist/assets/{useEventHooks-B_Bqqzlo.js.map → useEventHooks-JDpifqGZ.js.map} +1 -1
  165. package/dashboard/dist/assets/{useNamespace-CZfue_oE.js → useNamespace-Bqr-LdWx.js} +2 -2
  166. package/dashboard/dist/assets/{useNamespace-CZfue_oE.js.map → useNamespace-Bqr-LdWx.js.map} +1 -1
  167. package/dashboard/dist/assets/{useYamlActivityEvents-DjQ7rsOC.js → useYamlActivityEvents-n3naCEbw.js} +2 -2
  168. package/dashboard/dist/assets/{useYamlActivityEvents-DjQ7rsOC.js.map → useYamlActivityEvents-n3naCEbw.js.map} +1 -1
  169. package/dashboard/dist/assets/{users-CwUL9YJT.js → users-BNXLRVTS.js} +2 -2
  170. package/dashboard/dist/assets/{users-CwUL9YJT.js.map → users-BNXLRVTS.js.map} +1 -1
  171. package/dashboard/dist/assets/{workflows-gSjgU0KB.js → workflows-D8uMBPvQ.js} +2 -2
  172. package/dashboard/dist/assets/{workflows-gSjgU0KB.js.map → workflows-D8uMBPvQ.js.map} +1 -1
  173. package/dashboard/dist/assets/{yaml-workflows-a_7IO_a6.js → yaml-workflows-DVDOQM3Y.js} +2 -2
  174. package/dashboard/dist/assets/{yaml-workflows-a_7IO_a6.js.map → yaml-workflows-DVDOQM3Y.js.map} +1 -1
  175. package/dashboard/dist/index.html +1 -1
  176. package/docs/hitl/lookups.md +2 -0
  177. package/docs/hitl/x-lt-widget.md +8 -1
  178. package/docs/hitl-guide.md +1 -0
  179. package/package.json +1 -1
  180. package/dashboard/dist/assets/index-Bf9cfGX_.js +0 -3
  181. package/dashboard/dist/assets/index-Bf9cfGX_.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"users-CwUL9YJT.js","sources":["../../src/api/users.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTUserRecord, LTRoleType, LTReadScope, LTWriteScope } from './types';\n\ninterface UserListResponse {\n users: LTUserRecord[];\n total: number;\n}\n\ninterface UserFilters {\n role?: string;\n roleType?: string;\n status?: string;\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useUsers(filters: UserFilters = {}) {\n const params = new URLSearchParams();\n if (filters.role) params.set('role', filters.role);\n if (filters.roleType) params.set('roleType', filters.roleType);\n if (filters.status) params.set('status', filters.status);\n if (filters.search) params.set('search', filters.search);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<UserListResponse>({\n queryKey: ['users', filters],\n queryFn: () => apiFetch(`/users?${params}`),\n });\n}\n\nexport function useUser(id: string) {\n return useQuery<LTUserRecord>({\n queryKey: ['users', id],\n queryFn: () => apiFetch(`/users/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n external_id: string;\n email?: string;\n display_name?: string;\n password?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/users', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useUpdateUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n email?: string;\n display_name?: string;\n status?: string;\n }) =>\n apiFetch(`/users/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useDeleteUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/users/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useAddUserRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n userId,\n role,\n type,\n read_scope,\n write_scope,\n }: {\n userId: string;\n role: string;\n type: LTRoleType;\n read_scope?: LTReadScope;\n write_scope?: LTWriteScope;\n }) =>\n apiFetch(`/users/${userId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type, read_scope, write_scope }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useRemoveUserRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ userId, role }: { userId: string; role: string }) =>\n apiFetch(`/users/${userId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n"],"names":["useUsers","filters","params","useQuery","apiFetch","useUser","id","useCreateUser","queryClient","useQueryClient","useMutation","data","useUpdateUser","useDeleteUser","useAddUserRole","userId","role","type","read_scope","write_scope","useRemoveUserRole"],"mappings":"qGAkBO,SAASA,EAASC,EAAuB,GAAI,CAClD,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,MAAMC,EAAO,IAAI,OAAQD,EAAQ,IAAI,EAC7CA,EAAQ,UAAUC,EAAO,IAAI,WAAYD,EAAQ,QAAQ,EACzDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAA2B,CAChC,SAAU,CAAC,QAASF,CAAO,EAC3B,QAAS,IAAMG,EAAS,UAAUF,CAAM,EAAE,CAAA,CAC3C,CACH,CAEO,SAASG,EAAQC,EAAY,CAClC,OAAOH,EAAuB,CAC5B,SAAU,CAAC,QAASG,CAAE,EACtB,QAAS,IAAMF,EAAS,UAAUE,CAAE,EAAE,EACtC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAgB,CAC9B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAOXP,EAAS,SAAU,CACjB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASI,GAAgB,CAC9B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,GAAAJ,EACA,GAAGK,CAAA,IAOHP,EAAS,UAAUE,CAAE,GAAI,CACvB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASK,GAAgB,CAC9B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXF,EAAS,UAAUE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAC/C,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASM,GAAiB,CAC/B,MAAMN,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,OAAAK,EACA,KAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,CAAA,IAQAf,EAAS,UAAUW,CAAM,SAAU,CACjC,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,CAAA,CAC7D,EACH,UAAW,IAAM,CACfX,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASY,GAAoB,CAClC,MAAMZ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,OAAAK,EAAQ,KAAAC,CAAA,IACrBZ,EAAS,UAAUW,CAAM,UAAU,mBAAmBC,CAAI,CAAC,GAAI,CAC7D,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACfR,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH"}
1
+ {"version":3,"file":"users-BNXLRVTS.js","sources":["../../src/api/users.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTUserRecord, LTRoleType, LTReadScope, LTWriteScope } from './types';\n\ninterface UserListResponse {\n users: LTUserRecord[];\n total: number;\n}\n\ninterface UserFilters {\n role?: string;\n roleType?: string;\n status?: string;\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useUsers(filters: UserFilters = {}) {\n const params = new URLSearchParams();\n if (filters.role) params.set('role', filters.role);\n if (filters.roleType) params.set('roleType', filters.roleType);\n if (filters.status) params.set('status', filters.status);\n if (filters.search) params.set('search', filters.search);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<UserListResponse>({\n queryKey: ['users', filters],\n queryFn: () => apiFetch(`/users?${params}`),\n });\n}\n\nexport function useUser(id: string) {\n return useQuery<LTUserRecord>({\n queryKey: ['users', id],\n queryFn: () => apiFetch(`/users/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n external_id: string;\n email?: string;\n display_name?: string;\n password?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/users', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useUpdateUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n email?: string;\n display_name?: string;\n status?: string;\n }) =>\n apiFetch(`/users/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useDeleteUser() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/users/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useAddUserRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n userId,\n role,\n type,\n read_scope,\n write_scope,\n }: {\n userId: string;\n role: string;\n type: LTRoleType;\n read_scope?: LTReadScope;\n write_scope?: LTWriteScope;\n }) =>\n apiFetch(`/users/${userId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type, read_scope, write_scope }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n\nexport function useRemoveUserRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ userId, role }: { userId: string; role: string }) =>\n apiFetch(`/users/${userId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['users'] });\n },\n });\n}\n"],"names":["useUsers","filters","params","useQuery","apiFetch","useUser","id","useCreateUser","queryClient","useQueryClient","useMutation","data","useUpdateUser","useDeleteUser","useAddUserRole","userId","role","type","read_scope","write_scope","useRemoveUserRole"],"mappings":"qGAkBO,SAASA,EAASC,EAAuB,GAAI,CAClD,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,MAAMC,EAAO,IAAI,OAAQD,EAAQ,IAAI,EAC7CA,EAAQ,UAAUC,EAAO,IAAI,WAAYD,EAAQ,QAAQ,EACzDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAA2B,CAChC,SAAU,CAAC,QAASF,CAAO,EAC3B,QAAS,IAAMG,EAAS,UAAUF,CAAM,EAAE,CAAA,CAC3C,CACH,CAEO,SAASG,EAAQC,EAAY,CAClC,OAAOH,EAAuB,CAC5B,SAAU,CAAC,QAASG,CAAE,EACtB,QAAS,IAAMF,EAAS,UAAUE,CAAE,EAAE,EACtC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAgB,CAC9B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAOXP,EAAS,SAAU,CACjB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASI,GAAgB,CAC9B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,GAAAJ,EACA,GAAGK,CAAA,IAOHP,EAAS,UAAUE,CAAE,GAAI,CACvB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASK,GAAgB,CAC9B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXF,EAAS,UAAUE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAC/C,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASM,GAAiB,CAC/B,MAAMN,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,OAAAK,EACA,KAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,CAAA,IAQAf,EAAS,UAAUW,CAAM,SAAU,CACjC,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,CAAA,CAC7D,EACH,UAAW,IAAM,CACfX,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH,CAEO,SAASY,GAAoB,CAClC,MAAMZ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,OAAAK,EAAQ,KAAAC,CAAA,IACrBZ,EAAS,UAAUW,CAAM,UAAU,mBAAmBC,CAAI,CAAC,GAAI,CAC7D,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACfR,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,CACvD,CAAA,CACD,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as n,b as t,c as u}from"./vendor-query-RUZdMvN6.js";import{g as s}from"./index-sbfCx2CF.js";function f(){return n({queryKey:["activeWorkers"],queryFn:async()=>(await s("/workflows/workers")).workers})}function w(){return n({queryKey:["discoveredWorkflows"],queryFn:async()=>(await s("/workflows/discovered")).workflows})}function l(){return n({queryKey:["workflowConfigs"],queryFn:async()=>(await s("/workflows/config")).workflows})}function d(){return n({queryKey:["cronStatus"],queryFn:async()=>(await s("/workflows/cron/status")).schedules})}function k(e){return n({queryKey:["workflowExecution",e],queryFn:()=>s(`/workflow-states/${e}/execution`),enabled:!!e})}function m(e,o){const r=new URLSearchParams;return e.limit&&r.set("limit",String(e.limit)),e.offset!==void 0&&r.set("offset",String(e.offset)),e.entity&&r.set("entity",e.entity),e.search&&r.set("search",e.search),e.status&&r.set("status",e.status),e.sort_by&&r.set("sort_by",e.sort_by),e.order&&r.set("order",e.order),e.registered&&r.set("registered",e.registered),e.namespace&&r.set("namespace",e.namespace),n({queryKey:["jobs",e],queryFn:()=>s(`/workflow-states/jobs?${r}`),enabled:(o==null?void 0:o.enabled)??!0})}function q(){const e=t();return u({mutationFn:o=>s(`/workflows/${o}/terminate`,{method:"POST"}),onSuccess:(o,r)=>{e.invalidateQueries({queryKey:["workflowExecution",r],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function g(){const e=t();return u({mutationFn:({workflow_type:o,...r})=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function h(){const e=t();return u({mutationFn:o=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function b(){const e=t();return u({mutationFn:({workflowType:o,data:r,metadata:i,execute_as:a})=>s(`/workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:r,metadata:i,...a?{execute_as:a}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}export{k as a,m as b,b as c,w as d,d as e,q as f,f as g,h,g as i,l as u};
2
- //# sourceMappingURL=workflows-gSjgU0KB.js.map
1
+ import{u as n,b as t,c as u}from"./vendor-query-RUZdMvN6.js";import{g as s}from"./index-zrTQcPjB.js";function f(){return n({queryKey:["activeWorkers"],queryFn:async()=>(await s("/workflows/workers")).workers})}function w(){return n({queryKey:["discoveredWorkflows"],queryFn:async()=>(await s("/workflows/discovered")).workflows})}function l(){return n({queryKey:["workflowConfigs"],queryFn:async()=>(await s("/workflows/config")).workflows})}function d(){return n({queryKey:["cronStatus"],queryFn:async()=>(await s("/workflows/cron/status")).schedules})}function k(e){return n({queryKey:["workflowExecution",e],queryFn:()=>s(`/workflow-states/${e}/execution`),enabled:!!e})}function m(e,o){const r=new URLSearchParams;return e.limit&&r.set("limit",String(e.limit)),e.offset!==void 0&&r.set("offset",String(e.offset)),e.entity&&r.set("entity",e.entity),e.search&&r.set("search",e.search),e.status&&r.set("status",e.status),e.sort_by&&r.set("sort_by",e.sort_by),e.order&&r.set("order",e.order),e.registered&&r.set("registered",e.registered),e.namespace&&r.set("namespace",e.namespace),n({queryKey:["jobs",e],queryFn:()=>s(`/workflow-states/jobs?${r}`),enabled:(o==null?void 0:o.enabled)??!0})}function q(){const e=t();return u({mutationFn:o=>s(`/workflows/${o}/terminate`,{method:"POST"}),onSuccess:(o,r)=>{e.invalidateQueries({queryKey:["workflowExecution",r],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function g(){const e=t();return u({mutationFn:({workflow_type:o,...r})=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function h(){const e=t();return u({mutationFn:o=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function b(){const e=t();return u({mutationFn:({workflowType:o,data:r,metadata:i,execute_as:a})=>s(`/workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:r,metadata:i,...a?{execute_as:a}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}export{k as a,m as b,b as c,w as d,d as e,q as f,f as g,h,g as i,l as u};
2
+ //# sourceMappingURL=workflows-D8uMBPvQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflows-gSjgU0KB.js","sources":["../../src/api/workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { ActiveWorker, CronScheduleEntry, DiscoveredWorkflow, LTJob, LTWorkflowConfig, WorkflowExecution } from './types';\n\nexport function useActiveWorkers() {\n return useQuery<ActiveWorker[]>({\n queryKey: ['activeWorkers'],\n queryFn: async () => {\n const res = await apiFetch<{ workers: ActiveWorker[] }>('/workflows/workers');\n return res.workers;\n },\n });\n}\n\nexport function useDiscoveredWorkflows() {\n return useQuery<DiscoveredWorkflow[]>({\n queryKey: ['discoveredWorkflows'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: DiscoveredWorkflow[] }>('/workflows/discovered');\n return res.workflows;\n },\n });\n}\n\nexport function useWorkflowConfigs() {\n return useQuery<LTWorkflowConfig[]>({\n queryKey: ['workflowConfigs'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: LTWorkflowConfig[] }>('/workflows/config');\n return res.workflows;\n },\n });\n}\n\nexport function useCronStatus() {\n return useQuery<CronScheduleEntry[]>({\n queryKey: ['cronStatus'],\n queryFn: async () => {\n const res = await apiFetch<{ schedules: CronScheduleEntry[] }>('/workflows/cron/status');\n return res.schedules;\n },\n });\n}\n\nexport function useWorkflowExecution(workflowId: string) {\n return useQuery<WorkflowExecution>({\n queryKey: ['workflowExecution', workflowId],\n queryFn: () =>\n apiFetch(`/workflow-states/${workflowId}/execution`),\n enabled: !!workflowId,\n });\n}\n\nexport function useWorkflowState(workflowId: string) {\n return useQuery<{ workflow_id: string; state: Record<string, unknown> }>({\n queryKey: ['workflowState', workflowId],\n queryFn: () => apiFetch(`/workflow-states/${workflowId}/state`),\n enabled: !!workflowId,\n });\n}\n\nexport function useJobs(filters: {\n limit?: number;\n offset?: number;\n entity?: string;\n search?: string;\n status?: string;\n sort_by?: string;\n order?: string;\n registered?: string;\n namespace?: string;\n}, options?: { enabled?: boolean }) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n if (filters.entity) params.set('entity', filters.entity);\n if (filters.search) params.set('search', filters.search);\n if (filters.status) params.set('status', filters.status);\n if (filters.sort_by) params.set('sort_by', filters.sort_by);\n if (filters.order) params.set('order', filters.order);\n if (filters.registered) params.set('registered', filters.registered);\n if (filters.namespace) params.set('namespace', filters.namespace);\n\n return useQuery<{ jobs: LTJob[]; total: number }>({\n queryKey: ['jobs', filters],\n queryFn: () => apiFetch(`/workflow-states/jobs?${params}`),\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useTerminateWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (workflowId: string) =>\n apiFetch(`/workflows/${workflowId}/terminate`, { method: 'POST' }),\n onSuccess: (_data, workflowId) => {\n queryClient.invalidateQueries({ queryKey: ['workflowExecution', workflowId], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpsertWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n {\n workflow_type: string;\n description?: string | null;\n\n invocable?: boolean;\n certified?: boolean;\n task_queue?: string | null;\n default_role?: string;\n roles?: string[];\n invocation_roles?: string[];\n consumes?: string[];\n envelope_schema?: Record<string, unknown> | null;\n resolver_schema?: Record<string, unknown> | null;\n cron_schedule?: string | null;\n execute_as?: string | null;\n }\n >({\n mutationFn: ({ workflow_type, ...body }) =>\n apiFetch(`/workflows/${encodeURIComponent(workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean; workflow_type: string }, Error, string>({\n mutationFn: (workflowType) =>\n apiFetch(`/workflows/${encodeURIComponent(workflowType)}/config`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useSetCronSchedule() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n { config: LTWorkflowConfig; cron_schedule: string | null; envelope_schema?: Record<string, unknown> | null }\n >({\n mutationFn: ({ config, cron_schedule, envelope_schema }) =>\n apiFetch(`/workflows/${encodeURIComponent(config.workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify({\n ...config,\n cron_schedule,\n ...(envelope_schema !== undefined ? { envelope_schema } : {}),\n }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['cronStatus'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeWorkflow() {\n const queryClient = useQueryClient();\n return useMutation<\n { workflowId: string; message: string },\n Error,\n { workflowType: string; data: Record<string, unknown>; metadata?: Record<string, unknown>; execute_as?: string }\n >({\n mutationFn: ({ workflowType, data, metadata, execute_as }) =>\n apiFetch(`/workflows/${workflowType}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, metadata, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['tasks'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n"],"names":["useActiveWorkers","useQuery","apiFetch","useDiscoveredWorkflows","useWorkflowConfigs","useCronStatus","useWorkflowExecution","workflowId","useJobs","filters","options","params","useTerminateWorkflow","queryClient","useQueryClient","useMutation","_data","useUpsertWorkflowConfig","workflow_type","body","useDeleteWorkflowConfig","workflowType","useInvokeWorkflow","data","metadata","execute_as"],"mappings":"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"}
1
+ {"version":3,"file":"workflows-D8uMBPvQ.js","sources":["../../src/api/workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { ActiveWorker, CronScheduleEntry, DiscoveredWorkflow, LTJob, LTWorkflowConfig, WorkflowExecution } from './types';\n\nexport function useActiveWorkers() {\n return useQuery<ActiveWorker[]>({\n queryKey: ['activeWorkers'],\n queryFn: async () => {\n const res = await apiFetch<{ workers: ActiveWorker[] }>('/workflows/workers');\n return res.workers;\n },\n });\n}\n\nexport function useDiscoveredWorkflows() {\n return useQuery<DiscoveredWorkflow[]>({\n queryKey: ['discoveredWorkflows'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: DiscoveredWorkflow[] }>('/workflows/discovered');\n return res.workflows;\n },\n });\n}\n\nexport function useWorkflowConfigs() {\n return useQuery<LTWorkflowConfig[]>({\n queryKey: ['workflowConfigs'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: LTWorkflowConfig[] }>('/workflows/config');\n return res.workflows;\n },\n });\n}\n\nexport function useCronStatus() {\n return useQuery<CronScheduleEntry[]>({\n queryKey: ['cronStatus'],\n queryFn: async () => {\n const res = await apiFetch<{ schedules: CronScheduleEntry[] }>('/workflows/cron/status');\n return res.schedules;\n },\n });\n}\n\nexport function useWorkflowExecution(workflowId: string) {\n return useQuery<WorkflowExecution>({\n queryKey: ['workflowExecution', workflowId],\n queryFn: () =>\n apiFetch(`/workflow-states/${workflowId}/execution`),\n enabled: !!workflowId,\n });\n}\n\nexport function useWorkflowState(workflowId: string) {\n return useQuery<{ workflow_id: string; state: Record<string, unknown> }>({\n queryKey: ['workflowState', workflowId],\n queryFn: () => apiFetch(`/workflow-states/${workflowId}/state`),\n enabled: !!workflowId,\n });\n}\n\nexport function useJobs(filters: {\n limit?: number;\n offset?: number;\n entity?: string;\n search?: string;\n status?: string;\n sort_by?: string;\n order?: string;\n registered?: string;\n namespace?: string;\n}, options?: { enabled?: boolean }) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n if (filters.entity) params.set('entity', filters.entity);\n if (filters.search) params.set('search', filters.search);\n if (filters.status) params.set('status', filters.status);\n if (filters.sort_by) params.set('sort_by', filters.sort_by);\n if (filters.order) params.set('order', filters.order);\n if (filters.registered) params.set('registered', filters.registered);\n if (filters.namespace) params.set('namespace', filters.namespace);\n\n return useQuery<{ jobs: LTJob[]; total: number }>({\n queryKey: ['jobs', filters],\n queryFn: () => apiFetch(`/workflow-states/jobs?${params}`),\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useTerminateWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (workflowId: string) =>\n apiFetch(`/workflows/${workflowId}/terminate`, { method: 'POST' }),\n onSuccess: (_data, workflowId) => {\n queryClient.invalidateQueries({ queryKey: ['workflowExecution', workflowId], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpsertWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n {\n workflow_type: string;\n description?: string | null;\n\n invocable?: boolean;\n certified?: boolean;\n task_queue?: string | null;\n default_role?: string;\n roles?: string[];\n invocation_roles?: string[];\n consumes?: string[];\n envelope_schema?: Record<string, unknown> | null;\n resolver_schema?: Record<string, unknown> | null;\n cron_schedule?: string | null;\n execute_as?: string | null;\n }\n >({\n mutationFn: ({ workflow_type, ...body }) =>\n apiFetch(`/workflows/${encodeURIComponent(workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean; workflow_type: string }, Error, string>({\n mutationFn: (workflowType) =>\n apiFetch(`/workflows/${encodeURIComponent(workflowType)}/config`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useSetCronSchedule() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n { config: LTWorkflowConfig; cron_schedule: string | null; envelope_schema?: Record<string, unknown> | null }\n >({\n mutationFn: ({ config, cron_schedule, envelope_schema }) =>\n apiFetch(`/workflows/${encodeURIComponent(config.workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify({\n ...config,\n cron_schedule,\n ...(envelope_schema !== undefined ? { envelope_schema } : {}),\n }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['cronStatus'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeWorkflow() {\n const queryClient = useQueryClient();\n return useMutation<\n { workflowId: string; message: string },\n Error,\n { workflowType: string; data: Record<string, unknown>; metadata?: Record<string, unknown>; execute_as?: string }\n >({\n mutationFn: ({ workflowType, data, metadata, execute_as }) =>\n apiFetch(`/workflows/${workflowType}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, metadata, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['tasks'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n"],"names":["useActiveWorkers","useQuery","apiFetch","useDiscoveredWorkflows","useWorkflowConfigs","useCronStatus","useWorkflowExecution","workflowId","useJobs","filters","options","params","useTerminateWorkflow","queryClient","useQueryClient","useMutation","_data","useUpsertWorkflowConfig","workflow_type","body","useDeleteWorkflowConfig","workflowType","useInvokeWorkflow","data","metadata","execute_as"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{u as l,b as a,c as s}from"./vendor-query-RUZdMvN6.js";import{g as r}from"./index-sbfCx2CF.js";function f(e={}){const o=new URLSearchParams;return e.status&&o.set("status",e.status),e.graph_topic&&o.set("graph_topic",e.graph_topic),e.app_id&&o.set("app_id",e.app_id),e.search&&o.set("search",e.search),e.set_id&&o.set("set_id",e.set_id),e.limit&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows?${o}`)})}function m(){return l({queryKey:["yamlWorkflowAppIds"],queryFn:()=>r("/yaml-workflows/app-ids")})}function c(e){return l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows/${e}`),enabled:!!e})}function w(){const e=a();return s({mutationFn:o=>r("/yaml-workflows",{method:"POST",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function k(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/deploy`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function p(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/activate`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function d(){const e=a();return s({mutationFn:({id:o,data:t,sync:n,execute_as:u})=>r(`/yaml-workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:t,sync:n,...u?{execute_as:u}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function h(){const e=a();return s({mutationFn:({id:o,task_queue:t,compilation_feedback:n})=>r(`/yaml-workflows/${o}/regenerate`,{method:"POST",body:JSON.stringify({task_queue:t,compilation_feedback:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function q(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/archive`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function W(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/restore`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"}),e.invalidateQueries({queryKey:["yamlWorkflow"],refetchType:"all"})}})}function S(){const e=a();return s({mutationFn:({id:o,...t})=>r(`/yaml-workflows/${o}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function v(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function T(e){return l({queryKey:["yamlWorkflows",e,"versions"],queryFn:()=>r(`/yaml-workflows/${e}/versions`),enabled:!!e})}function F(e,o){return l({queryKey:["yamlWorkflows",e,"versions",o],queryFn:()=>r(`/yaml-workflows/${e}/versions/${o}`),enabled:!!e&&o!==null})}export{m as a,S as b,c,T as d,k as e,p as f,q as g,W as h,v as i,h as j,F as k,d as l,w as m,f as u};
2
- //# sourceMappingURL=yaml-workflows-a_7IO_a6.js.map
1
+ import{u as l,b as a,c as s}from"./vendor-query-RUZdMvN6.js";import{g as r}from"./index-zrTQcPjB.js";function f(e={}){const o=new URLSearchParams;return e.status&&o.set("status",e.status),e.graph_topic&&o.set("graph_topic",e.graph_topic),e.app_id&&o.set("app_id",e.app_id),e.search&&o.set("search",e.search),e.set_id&&o.set("set_id",e.set_id),e.limit&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows?${o}`)})}function m(){return l({queryKey:["yamlWorkflowAppIds"],queryFn:()=>r("/yaml-workflows/app-ids")})}function c(e){return l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows/${e}`),enabled:!!e})}function w(){const e=a();return s({mutationFn:o=>r("/yaml-workflows",{method:"POST",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function k(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/deploy`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function p(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/activate`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function d(){const e=a();return s({mutationFn:({id:o,data:t,sync:n,execute_as:u})=>r(`/yaml-workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:t,sync:n,...u?{execute_as:u}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function h(){const e=a();return s({mutationFn:({id:o,task_queue:t,compilation_feedback:n})=>r(`/yaml-workflows/${o}/regenerate`,{method:"POST",body:JSON.stringify({task_queue:t,compilation_feedback:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function q(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/archive`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function W(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/restore`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"}),e.invalidateQueries({queryKey:["yamlWorkflow"],refetchType:"all"})}})}function S(){const e=a();return s({mutationFn:({id:o,...t})=>r(`/yaml-workflows/${o}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function v(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function T(e){return l({queryKey:["yamlWorkflows",e,"versions"],queryFn:()=>r(`/yaml-workflows/${e}/versions`),enabled:!!e})}function F(e,o){return l({queryKey:["yamlWorkflows",e,"versions",o],queryFn:()=>r(`/yaml-workflows/${e}/versions/${o}`),enabled:!!e&&o!==null})}export{m as a,S as b,c,T as d,k as e,p as f,q as g,W as h,v as i,h as j,F as k,d as l,w as m,f as u};
2
+ //# sourceMappingURL=yaml-workflows-DVDOQM3Y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-workflows-a_7IO_a6.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"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"}
1
+ {"version":3,"file":"yaml-workflows-DVDOQM3Y.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"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"}
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com" />
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
11
- <script type="module" crossorigin src="./assets/index-sbfCx2CF.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-zrTQcPjB.js"></script>
12
12
  <link rel="modulepreload" crossorigin href="./assets/vendor-query-RUZdMvN6.js">
13
13
  <link rel="modulepreload" crossorigin href="./assets/vendor-react-CdqEC2zv.js">
14
14
  <link rel="modulepreload" crossorigin href="./assets/vendor-icons-h-jlRSb9.js">
@@ -126,6 +126,8 @@ With a `catalog/geo` entry shaped as:
126
126
 
127
127
  Interpolation works in `x-lt-source` the same way, so checklist item sets can follow an answer too.
128
128
 
129
+ A lookup-sourced checklist can declare `"x-lt-default-checked": true` to start every item checked (uncheck the exceptions). The widget applies the default when the edition resolves, so a pure escalation-minting step never needs to enumerate the item ids — see [x-lt-widget.md](x-lt-widget.md#first-load-default-x-lt-default-checked).
130
+
129
131
  ## Efficiency
130
132
 
131
133
  - **Refs, not content, ride the rows.** Thousands of escalations sharing one list each store a three-field ref; the list lives once per edition.
@@ -142,11 +142,18 @@ The field type must be `"object"`. The submitted value is `Record<string, boolea
142
142
  }
143
143
  ```
144
144
 
145
- `x-lt-source` uses the `"domain.path"` convention (same as `x-lt-showIf` and `x-lt-help` tokens). The renderer expects an array of `{ id: string; label: string; required?: boolean }` objects at that path.
145
+ `x-lt-source` uses the `"domain.path"` convention (same as `x-lt-showIf` and `x-lt-help` tokens), and may embed `{{domain.path}}` interpolation segments. The renderer expects an array of `{ id: string; label: string; required?: boolean }` objects at that path.
146
146
 
147
147
  - `"envelope"` — for item definitions that are render data only (no query cost). The workflow puts them in `conditional`'s `envelope` parameter.
148
+ - `"lookup"` — for item sets shared by many rows: a version-pinned knowledge edition (see [lookups.md](lookups.md)).
148
149
  - `"metadata"` — only when items need to be GIN-indexed and searchable as facets. Adds index cost.
149
150
 
151
+ ### First-load default (`x-lt-default-checked`)
152
+
153
+ `"x-lt-default-checked": true` initializes an unanswered checklist to every item **checked** — the affirm-then-exception flow: the submitter unchecks what failed instead of confirming what passed. The default applies once, the moment the source resolves; a record that already carries an answer map for the field (a re-opened draft, an edited state) renders that saved state untouched. Without the flag, items start unchecked.
154
+
155
+ The flag lives on the widget because the item set is runtime-sourced: a workflow's escalation-minting step cannot enumerate a lookup edition's ids to seed `formDefaults`, and re-embedding the ids per row would defeat the shared list. Membership and completion guards are unaffected — the default is a subset of the resolved items by construction.
156
+
150
157
  ### Geometry (`x-lt-variant`)
151
158
 
152
159
  Item length and selection mode decide the checklist's shape:
@@ -106,6 +106,7 @@ Ordered as a learning path — each file adds one capability to the same form:
106
106
  | `x-lt-widget` | field | Rich control: `file-upload`, `code-editor`, `signature`, `rich-text`, `markdown`, `checklist`, `attachment` (alias `image`) |
107
107
  | `x-lt-source` | field | Data path for context-driven widgets: `"domain.path"`; may embed `{{domain.path}}` interpolation segments |
108
108
  | `x-lt-require-all` | field | Checklist completion guard — every item must be checked, except items declared `required: false` |
109
+ | `x-lt-default-checked` | field | Checklist first-load default — an unanswered field initializes to every item checked (affirm-then-exception); saved answers are never clobbered |
109
110
  | `x-lt-require-any` | schema | At-least-one guard — each `string[]` group needs a value in one visible member; `0`/`false` count as answers |
110
111
  | `x-lt-require-sum` | schema | Quantity-group guard — the numeric values of `{ fields, minimum? }` must total at least `minimum` (default 1) |
111
112
  | `x-lt-language` | field | Syntax hint for the `code-editor` widget |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,3 +0,0 @@
1
- import{b as Xe,a as m,j as t}from"./vendor-query-RUZdMvN6.js";import{Z as Fs,_ as ht,g as yt,U as Yt,$ as Vt,J as Ot,c as Ws,d as qs,P as at,b as Zt,m as Me,a0 as Kt,a1 as Ge,X as le,L as ce,T as Qe,j as Ye,a2 as Us,a3 as Vs,a4 as Js,i as Hs,a5 as Bs,a6 as zs,A as Xs,B as Gs,u as Qs,v as Ys,l as Zs,a7 as Ks}from"./index-sbfCx2CF.js";import{u as Ze,C as Ke,r as tn,B as en,a as sn}from"./BulkAssignModal-BUfV9aba.js";import{M as ts}from"./Modal-BU7No9NH.js";import{a as es,u as de,L as jt,b as nn,e as rn}from"./vendor-react-CdqEC2zv.js";import{P as an}from"./PageHeader-CFVw67M6.js";import{L as on}from"./ListToolbar-CKuJ7HUH.js";import{i as qt,b as ln,d as cn,C as Jt,g as Ht,H as dn,m as un,c as it,r as ue,s as xn,e as ss}from"./CountdownTimer-CFR2pPT9.js";import{u as pn}from"./workflows-gSjgU0KB.js";import{g as mn}from"./useEventHooks-B_Bqqzlo.js";import{S as ns}from"./StatusBadge-BDeUwPtb.js";import{R as fn}from"./RolePill-Di_5hfvw.js";import{C as dt}from"./CopyableId-4Lqlc5cU.js";import{U as xe}from"./UserName-BGn4sSx1.js";import{d as gn}from"./metadata-display-DHjqWkLG.js";import{a2 as rs,J as hn,S as bn,au as yn,_ as jn,n as Nn,af as as,U as vn,ai as wn,aj as kn,ak as _n,a8 as Cn,av as En,aw as An,ax as ae,ay as Tn,az as Ie,aA as Rn,K as De,O as $e,aB as On,X as Sn}from"./vendor-icons-h-jlRSb9.js";import"./users-CwUL9YJT.js";import"./constants-BHkpVaqx.js";import"./useDebouncedValue-C4P2jQuh.js";import"./DataTable-DFPMeqyQ.js";import"./EmptyState-lpUFYfun.js";import"./StickyPagination-CfTEnlh5.js";const Mn={SCHEMA_VALIDATION:"schema_validation"};function In(e){return typeof e=="object"&&e!==null&&e.code===Mn.SCHEMA_VALIDATION&&Array.isArray(e.violations)}function Dn({escalationId:e}){var b;const s=es(),r=de(),n=Xe(),a=(b=s.state)==null?void 0:b[Fs],[o,d]=m.useState(!1),[c,u]=m.useState(null),[p,l]=m.useState(!1);if(!a||a.escalationId!==e||p)return null;const i=()=>{l(!0),r(s.pathname,{replace:!0,state:null})},x=async()=>{var v,y,g;d(!0),u(null);try{switch(a.verb){case ht.CANCEL:await yt(`/escalations/${e}/cancel`,{method:"POST"});break;case ht.CLAIM:case ht.CLAIM_SHOW_DETAIL:await yt(`/escalations/${e}/claim`,{method:"POST",body:JSON.stringify({durationMinutes:((v=a.params)==null?void 0:v.durationMinutes)??30})});break;case ht.RELEASE:await yt(`/escalations/${e}/release`,{method:"POST"});break;case ht.RESOLVE:await yt(`/escalations/${e}/resolve`,{method:"POST",body:JSON.stringify({resolverPayload:((y=a.params)==null?void 0:y.resolverPayload)??{}})});break;case ht.ESCALATE:await yt(`/escalations/${e}/escalate`,{method:"PATCH",body:JSON.stringify({targetRole:(g=a.params)==null?void 0:g.targetRole})});break;default:throw new Error(`Unsupported confirm verb "${a.verb}"`)}n.resetQueries({queryKey:["escalations"]}),n.resetQueries({queryKey:["escalationStats"]}),i()}catch(j){u(j.message)}finally{d(!1)}};return t.jsx(ts,{open:!0,onClose:i,title:"Confirm scan action",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-sm text-text-secondary",children:a.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:i,disabled:o,className:"btn-secondary text-xs",children:"No, go back"}),t.jsx("button",{onClick:x,disabled:o,className:"btn-primary text-xs",children:o?"Working…":"Yes, continue"})]})]})})}const Wt={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))"},te=4;function Le({pct:e,place:s,label:r,title:n,emphasis:a}){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] ${a?"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 $n({esc:e,className:s=""}){const r=new Date(e.created_at).getTime(),n=e.claimed_at?new Date(e.claimed_at).getTime():null,a=e.status==="resolved",o=e.status==="cancelled"||e.status==="expired",d=a||o,c=qt(e),u=!!n&&(c||d),p=a&&e.resolved_at?new Date(e.resolved_at).getTime():o?new Date(e.updated_at).getTime():Date.now(),l=Math.max(p-r,1),i=u&&n?Math.max(n-r,0):l,x=u&&n?Math.max(p-n,0):0,b=Math.min(100,Math.max(0,i/l*100)),v=u?Math.max(0,100-b):0,y=a?Wt.resolved:o?Wt.cancelled:Wt.claimed,g=a?"Resolved after":o?"Cancelled after":"In progress",j=Yt(i),k=Yt(l),h=a?`Resolved in ${k} total`:o?`Cancelled after ${k}`:`Open ${k} so far`,T=`Lifecycle bar: blue = time waiting to be claimed, ${a?"green":o?"red":"orange"} = ${g.toLowerCase()} the claim.`;return t.jsxs("div",{className:s,title:T,children:[t.jsx("div",{className:"relative h-2.5 font-mono",children:u&&t.jsx(Le,{pct:b,place:"above",label:j,title:`Time to claim: ${j}`})}),t.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:te,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:T,children:[t.jsx("div",{style:{width:`${b}%`,minWidth:te,backgroundColor:Wt.pending,opacity:.75},title:`Waiting ${j} — created → claimed`}),u&&v>0&&t.jsx("div",{style:{width:`${v}%`,minWidth:te,backgroundColor:y,opacity:.75},title:`${g} ${Yt(x)}`})]}),t.jsx("div",{className:"relative h-2.5 font-mono",children:t.jsx(Le,{pct:100,place:"below",emphasis:!0,label:k,title:h})})]})}function Ln({triage:e,payload:s}){const r=e.confidence??0,n=r>=.8?"text-status-success":r>=.5?"text-status-pending":"text-status-error",a=Pn(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}),a.length>0&&t.jsx("div",{className:"space-y-4 pt-2",children:a.map(o=>t.jsx(Fn,{diff:o},o.key))})]})}function Pn(e,s){if(!e)return[];const r=[];for(const n of Object.keys(e)){if(n.startsWith("_"))continue;const a=e[n],o=s[n];o!==void 0&&JSON.stringify(a)!==JSON.stringify(o)&&r.push({key:n,label:n.replace(/[_-]/g," "),original:a,corrected:o})}return r}function Fn({diff:e}){const s=Pe(e.original),r=Pe(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 Pe(e){return e==null?"null":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):null}function Y(e,s){const r=s==null?void 0:s.title;if(typeof r=="string"&&r.trim().length>0)return r.trim();const n=e.split(/[_-]+/).filter(Boolean);return n.length<=1?e:n.map(a=>Wn(a)?a:a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function Wn(e){return e.length>1&&e===e.toUpperCase()&&/[A-Z]/.test(e)}const z={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},is="lt:escalation:panel:view";function qn(e){try{const s=localStorage.getItem(is);if(s&&e.includes(s))return s}catch{}return z.HELP}function Un({metadata:e,role:s}){const r=gn(e);return r.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):t.jsx("dl",{className:"space-y-3.5",children:r.map(([n,a])=>{const o=typeof a=="object"&&a!==null?JSON.stringify(a):String(a),d=Me(n,a,s),c=Me(n,a);return t.jsxs("div",{className:"group relative",children:[t.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:Y(n)}),t.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-text-primary font-mono break-all flex-1",children:o}),t.jsx(jt,{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(wn,{className:"w-3 h-3"})}),t.jsx(jt,{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(kn,{className:"w-3 h-3"})})]})]},n)})})}function Vn({esc:e,claimed:s,isTerminal:r,isBuilder:n,traceUrl:a}){return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("dl",{className:"space-y-3.5",children:[t.jsx(at,{label:"Status",children:t.jsx(ns,{status:e.status})}),t.jsx(at,{label:"Assigned to Role",children:t.jsx(fn,{role:e.role,size:"md"})}),t.jsxs(at,{label:"Priority",children:["P",e.priority]}),(s||r)&&e.assigned_to&&t.jsx(at,{label:"Claimed By",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[t.jsx(vn,{className:"w-3 h-3 shrink-0 text-accent/75"}),t.jsx(xe,{userId:e.assigned_to})]})}),t.jsx(at,{label:"Created",children:t.jsx(Zt,{date:e.created_at})}),(s||r)&&e.claimed_at&&t.jsx(at,{label:"Claimed",children:t.jsx(Zt,{date:e.claimed_at})}),s&&!r&&e.assigned_until&&t.jsx(at,{label:"Time Remaining",children:t.jsx(Jt,{until:e.assigned_until})}),e.resolved_at&&t.jsx(at,{label:"Completed",children:t.jsx("span",{className:"text-status-success",children:t.jsx(Zt,{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(dt,{label:"Escalation ID",value:e.id}),e.task_id&&t.jsx(dt,{label:"Task ID",value:e.task_id,href:`/workflows/tasks/detail/${e.task_id}`}),e.workflow_type&&t.jsx(dt,{label:"Workflow Name",value:e.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(e.workflow_type)}`}),e.workflow_id&&t.jsx(dt,{label:"Workflow ID",value:e.workflow_id,href:`/workflows/executions/${e.workflow_id}`}),e.task_queue&&t.jsx(dt,{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(dt,{label:"Origin",value:e.origin_id,href:`/processes/detail/${e.origin_id}`}),e.trace_id&&t.jsx(dt,{label:"Trace",value:e.trace_id,href:a?a.replace("{traceId}",e.trace_id):void 0,external:!0})]})]})]})}function Jn({errors:e,schema:s}){const r=n=>{const a=document.querySelector(`[data-field-key="${n}"]`);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.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:a})=>{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(as,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-2xs font-semibold text-text-primary leading-snug",children:Y(n,(o=s==null?void 0:s.properties)==null?void 0:o[n])}),t.jsx("p",{className:"text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:a})]})]},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 Hn({esc:e,schema:s,envelope:r,payload:n,resolver:a,triage:o,hasAI:d,claimed:c,claimedByMe:u,isTerminal:p,isBuilder:l,traceUrl:i,open:x,noGutter:b,formErrors:v,activePanel:y,onPanelChange:g}){const j=de(),k=Object.values(z),[h,T]=m.useState(()=>qn(k)),M=y??h,I=m.useCallback(A=>{try{localStorage.setItem(is,A)}catch{}T(A),g==null||g(A)},[g]);m.useEffect(()=>{y&&y!==h&&T(y)},[y]);const $=m.useMemo(()=>ln(s,{escalation:e,metadata:e.metadata??null,envelope:r,payload:n,resolver:a})??cn({isTerminal:p,status:e.status,claimed:c,claimedByMe:u}),[s,e,r,n,a,p,c,u]),W=m.useCallback(A=>{const R=A.target.closest("a"),O=R==null?void 0:R.getAttribute("href");O!=null&&O.startsWith("/")&&(A.preventDefault(),j(O))},[j]),E=[{id:z.HELP,icon:rs,label:"Instructions",content:t.jsx(Vt,{content:$,onClick:W})},{id:z.DETAILS,icon:hn,label:"Details",content:t.jsx(Vn,{esc:e,claimed:c,isTerminal:p,isBuilder:l,traceUrl:i})},...d&&o?[{id:z.TRIAGE,icon:bn,label:"AI Analysis",content:t.jsx(Ln,{triage:o,payload:n??{}})}]:[],{id:z.METADATA,icon:yn,label:"Metadata",content:t.jsx(Un,{metadata:e.metadata,role:e.role})},{id:z.CONTEXT,icon:jn,label:"Context",content:t.jsxs("div",{className:"space-y-5",children:[r!=null&&t.jsx(Ot,{data:r,label:"Input Envelope"}),n!=null&&t.jsx(Ot,{data:n,label:"Escalation Context"}),a!=null&&t.jsx(Ot,{data:a,label:"Resolver Payload"}),r==null&&n==null&&a==null&&t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...l?[{id:z.RECORD,icon:Nn,label:"Record",content:t.jsx(Ot,{data:e,label:"Escalation Record"})}]:[],...v&&v.length>0?[{id:z.ERRORS,icon:(({className:A})=>t.jsx(as,{className:`${A??""} text-status-error`})),label:"Errors",content:t.jsx(Jn,{errors:v,schema:s})}]:[]];return t.jsx(Ws,{open:x,width:384,className:"h-full",children:t.jsx("div",{className:`h-full${b?"":" pl-6"}`,children:t.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[t.jsx("div",{className:"shrink-0 pt-2 pb-0 flex justify-center",children:t.jsx($n,{esc:e,className:"w-[80%]"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(qs,{views:E,activeId:M,onViewChange:I,stickyClassName:"h-full min-h-0"})})]})})})}const Bn=/\{\{\s*([^{}]+?)\s*\}\}/g;function os(e){return typeof e=="string"&&/\{\{[^{}]+\}\}/.test(e)}function pe(e,s){if(!s)return;const r=e.indexOf("."),n=s[r===-1?e:e.slice(0,r)];if(r===-1)return n;if(!(n===null||typeof n!="object"))return Ht(n,e.slice(r+1))}function ls(e,s){let r=!1;const n=e.replace(Bn,(a,o)=>{const d=pe(o,s);return typeof d=="string"&&d.trim().length>0?d:typeof d=="number"&&Number.isFinite(d)?String(d):(r=!0,"")});return r?null:n}const zn="x-lt-options";function Fe(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function Xn(e){if(Fe(e))return{value:e,label:String(e)};if(e&&typeof e=="object"&&!Array.isArray(e)){const s=e,r=s.value!==void 0?s.value:s.id;if(Fe(r)&&typeof s.label=="string"&&s.label.length>0)return{value:r,label:s.label}}return null}function cs(e,s){if(!e)return;const r=e.enum;if(Array.isArray(r)&&r.length>0)return r.map(p=>({value:p,label:String(p)}));const n=e[zn];if(typeof n!="string")return;const a=os(n),o=a?[]:void 0;let d=n;if(a){const p=ls(n,s);if(p===null)return o;d=p}const c=pe(d,s);if(!Array.isArray(c))return o;const u=c.map(Xn).filter(p=>p!==null);return u.length>0?u:o}function Gn(e,s){if(typeof e!="string"||!s)return[];let r=e;if(os(e)){const a=ls(e,s);if(a===null)return[];r=a}const n=pe(r,s);return Array.isArray(n)?n:[]}function Qn(e,s,r){if((s==null?void 0:s["x-lt-widget"])!=="checklist"||s["x-lt-require-all"]!==!0)return;const a=Gn(s["x-lt-source"],r).filter(c=>c.required!==!1);if(a.length===0)return;const o=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},d=a.filter(c=>!o[c.id]).length;if(d!==0)return`${d} of ${a.length} checks incomplete`}function Yn(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 Zn(e,s,r){if(!s)return;const n=cs(s,r);if(n!==void 0&&e!==void 0&&e!==null&&e!==""){if(n.length===0)return"No valid options for this selection";if(!n.some(a=>a.value===e))return`Must be one of: ${n.map(a=>String(a.value)).join(", ")}`}if(typeof e=="string"){const a=e.trim();if(a==="")return;const o=bt(s.minLength,s["x-lt-min-length"],r);if(o!==void 0&&a.length<o)return`Minimum ${o} character${o===1?"":"s"}`;const d=bt(s.maxLength,s["x-lt-max-length"],r);if(d!==void 0&&a.length>d)return`Maximum ${d} characters (${a.length} entered)`;const c=s.pattern;if(c)try{if(!new RegExp(c).test(a))return s["x-lt-pattern-error"]??"Invalid format"}catch{}const u=s.format;if(u==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))return"Enter a valid email address";if(u==="uri"&&!/^https?:\/\/.+/.test(a))return"Enter a valid URL"}if(typeof e=="number"){const a=bt(s.minimum,s["x-lt-minimum"],r),o=bt(s.exclusiveMinimum,void 0,r),d=bt(s.maximum,s["x-lt-maximum"],r),c=bt(s.exclusiveMaximum,void 0,r);if(a!==void 0&&e<a)return`Minimum value is ${a}`;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 bt(e,s,r){if(typeof e=="number")return e;if(typeof s=="string"&&r){const n=s.indexOf(".");if(n!==-1){const a=s.slice(0,n),o=s.slice(n+1),d=r[a];if(d&&typeof d=="object"){const c=o.split(".");let u=d;for(const p of c)if(u=u[p],u===void 0)break;if(typeof u=="number")return u;if(typeof u=="string"){const p=Number(u);if(!Number.isNaN(p))return p}}}}}function ds(e,s,r,n,a){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(u=>!u))return"Required"}}const o=Yn(e,s);if(o)return o;const d=Qn(e,s,a);return d||Zn(e,s,a)}function We(e){return e!=null&&e!==""&&e!==!1&&e!==0}function Kn(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function qe(e,s){const r=e.indexOf("."),n=r===-1?e:e.slice(0,r);if(!dn.includes(n))return{known:!1,value:void 0};const a=s[n];if(r===-1)return{known:!0,value:a};try{return{known:!0,value:Ht(a,e.slice(r+1))}}catch{return{known:!0,value:void 0}}}function Ut(e,s){if(typeof e!="string"||e.length===0||!s)return!0;const r=e.startsWith("!"),n=r?e.slice(1):e,a=n.indexOf("!="),o=n.indexOf("=");if(a!==-1||o!==-1&&o!==a+1){const u=a!==-1&&(o===-1||a<o),p=u?a:o,l=n.slice(0,p).trim(),i=n.slice(p+(u?2:1)).trim(),{known:x,value:b}=qe(l,s);if(!x)return!0;const v=Kn(b)===i,y=u?!v:v;return r?!y:y}const{known:d,value:c}=qe(n,s);return d?r?!We(c):We(c):!0}const tr="x-lt-require-any";function er(e){const s=e==null?void 0:e[tr];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 sr(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}const nr="x-lt-require-sum";function rr(e){const s=e==null?void 0:e[nr];if(!Array.isArray(s))return[];const r=[];for(const n of s){if(!n||typeof n!="object"||Array.isArray(n))continue;const{fields:a,minimum:o}=n;if(!Array.isArray(a))continue;const d=a.filter(c=>typeof c=="string"&&c.length>0);d.length!==0&&(o!==void 0&&typeof o!="number"||r.push({fields:d,minimum:typeof o=="number"?o:1}))}return r}function ar(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){const s=Number(e);if(!Number.isNaN(s))return s}return 0}function us(e,s,r){if(!e)return[];const n=e.properties??{},a=new Set(e.required??[]),o={...r??{},resolver:s},d=[];for(const[c,u]of Object.entries(n)){if(!Ut(u["x-lt-showIf"],o))continue;const p=ds(s[c],u,a.has(c),!0,o);p&&d.push({field:c,message:p})}for(const c of er(e)){const u=c.filter(l=>n[l]&&Ut(n[l]["x-lt-showIf"],o));if(u.length===0||u.some(l=>sr(s[l])))continue;const p=u.map(l=>n[l].title??l);d.push({field:u[0],message:`Enter a value for at least one of: ${p.join(", ")}`})}for(const c of rr(e)){const u=c.fields.filter(i=>n[i]&&Ut(n[i]["x-lt-showIf"],o));if(u.length===0||u.reduce((i,x)=>i+ar(s[x]),0)>=c.minimum)continue;const l=u.map(i=>n[i].title??i);d.push({field:u[0],message:`Combined value of ${l.join(", ")} must be at least ${c.minimum}`})}return d}function ie(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=us(n,r,s);if(d.length>0)return{payload:null,errors:d,parseError:null}}const{_form_schema:a,...o}=r;return{payload:un(o,n),errors:[],parseError:null}}function ir(e){const{mode:s,activeView:r,onActiveViewChange:n,onClaim:a,claimPending:o,claimNudge:d,workflowType:c,json:u,onResolve:p,resolvePending:l,resolveError:i,requestTriage:x,triageNotes:b,onRelease:v,releasePending:y,onCancel:g,assignedTo:j,assignedUntil:k,onSubmitAttempt:h,onValidationErrors:T,escalationContext:M,labels:I={},submitBlocked:$,submitBlockedMessage:W,actingName:E,badgePrompt:A,canManage:R,onReassign:O,onUnassign:S,unassignPending:H}=e,q=Ze(),[Z,V]=m.useState("30"),[K,L]=m.useState(0),[w,_]=m.useState(""),N=Z==="custom",P=m.useCallback(D=>L(D),[]),J=!!$&&!x;if(s==="terminal")return null;const ot=()=>{const D=N?K:parseInt(Z);!D||D<=0||a(D)},Nt=()=>{if(_(""),x){const pt={_lt:{needsTriage:!0}};b.trim()&&(pt.notes=b.trim()),p(pt);return}const D=ie(u,M);if(D.parseError){_(D.parseError);return}if(D.errors.length>0){h==null||h(),T==null||T(D.errors);return}p(D.payload)},G=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:[q.map(D=>t.jsx("button",{onClick:()=>{V(D.value),L(0)},className:G(!N&&Z===D.value),children:D.label},D.value)),t.jsx("button",{onClick:()=>V("custom"),className:G(N),children:"Other"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[I.cancel!==!1&&t.jsx("button",{onClick:g,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:I.cancel??"Cancel escalation"}),t.jsx("div",{className:"flex-1"}),N&&t.jsx(Ke,{onChange:P,compact:!0,autoFocus:!0}),t.jsx("button",{onClick:ot,disabled:o||N&&K<=0,className:`btn-primary text-xs ${d?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:o?"Claiming...":I.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:j?t.jsx(xe,{userId:j}):"unknown"})]}),k&&t.jsx(Jt,{until:k}),i&&t.jsx("span",{className:"text-xs text-status-error",children:i.message}),A&&t.jsx("p",{className:"text-xs text-text-tertiary","data-testid":"badge-prompt",children:"If this is your claim, scan your badge."}),R&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:O,className:"text-xs text-text-tertiary hover:text-accent transition-colors","data-testid":"admin-reassign",children:"Reassign…"}),t.jsx("button",{onClick:S,disabled:H,className:"text-xs text-text-tertiary hover:text-status-error transition-colors disabled:opacity-50","data-testid":"admin-unassign",children:H?"Returning…":"Return to queue"})]})]}),s==="claimed_by_me"&&t.jsxs("div",{"data-testid":"action-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[t.jsx("button",{onClick:()=>n("resolve"),className:G(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:I.release??"Release"}),I.cancel!==!1&&t.jsx("button",{onClick:g,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:I.cancel??"Cancel"})]}),r==="resolve"&&t.jsxs("div",{className:"flex items-center gap-4",children:[E&&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:["(",E,")"]})]}),E&&k&&t.jsx(Jt,{until:k}),t.jsx("div",{className:"flex-1"}),w&&t.jsx("span",{className:"text-xs text-status-error",children:w}),i&&t.jsx("span",{className:"text-xs text-status-error",children:i.message}),J&&W&&t.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:W}),t.jsx("button",{onClick:Nt,disabled:l||J,className:"btn-primary text-xs",children:l?c?"Submitting...":"Acknowledging...":x?"Send to Triage":I.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:v,disabled:y,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:y?"Releasing...":"Yes, Release"})]})]})]})}function ee({children:e}){return t.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:e})}function or({payload:e,isTerminal:s,resolverPayload:r,onRetryTriage:n,isRetrying:a}){const o=e.title,d=e.summary,c=e.diagnosis,u=e.tool_calls_made,p=e.result,l=r==null?void 0:r._lt,i=(l==null?void 0:l.triaged)===!0,x=l==null?void 0:l.triageWorkflowId,b=s&&i,[v,y]=m.useState(!1);return b?t.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),t.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),c&&t.jsxs("div",{children:[t.jsx(ee,{children:"Triage diagnosis"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Kt,{content:c})})]}),t.jsx("div",{className:"flex items-center gap-3",children:x&&t.jsx(jt,{to:`/workflows/executions/${x}`,className:"text-2xs text-accent hover:underline",children:"View triage execution"})})]})]}):t.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),t.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof u=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[u," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[o&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:o}),d&&t.jsxs("div",{children:[t.jsx(ee,{children:"What happened"}),t.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.jsx(Kt,{content:d})})]}),c&&t.jsxs("div",{children:[t.jsx(ee,{children:"What went wrong"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Kt,{content:c})})]}),p!=null&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>y(!v),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 ${v?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:t.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),v&&t.jsx("div",{className:"mt-2",children:t.jsx(Ot,{data:p,defaultMode:"tree"})})]}),n&&!s&&t.jsx("div",{className:"pt-2",children:t.jsxs("button",{onClick:n,disabled:a,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"})}),a?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function Ue(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function xs({src:e,escalation:s,schema:r,onResolve:n,onEscalate:a,submitAttempted:o,fill:d}){const c=m.useRef(null),u=m.useRef("");m.useEffect(()=>{try{const l=new URL(e);u.current=l.origin}catch{u.current=""}},[e]);const p=m.useCallback(()=>{const l=c.current;if(!(l!=null&&l.contentWindow)||!u.current)return;const x={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:Ue(s.envelope),metadata:s.metadata??null,escalation_payload:Ue(s.escalation_payload)},schema:r};l.contentWindow.postMessage(x,u.current)},[s,r]);return m.useEffect(()=>{const l=i=>{if(i.origin!==u.current)return;const x=i.data;if(!(!x||typeof x!="object"||typeof x.type!="string"))switch(x.type){case"lt:ready":p();break;case"lt:submit":x.payload&&typeof x.payload=="object"&&n(x.payload);break;case"lt:escalate":typeof x.target=="string"&&x.target&&a(x.target);break;case"lt:resize":{const b=c.current;b&&typeof x.height=="number"&&x.height>0&&(b.style.height=`${Math.min(x.height,2e3)}px`);break}}};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[p,n,a]),m.useEffect(()=>{if(!o)return;const l=c.current;l!=null&&l.contentWindow&&u.current&&l.contentWindow.postMessage({type:"lt:validate"},u.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:p})}):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:p})})}const lr=2600;function cr({hint:e,onLockedClick:s,children:r}){const[n,a]=m.useState(null);m.useEffect(()=>{if(!n)return;const d=setTimeout(()=>a(null),lr);return()=>clearTimeout(d)},[n]);const o=d=>{if(s==null||s(),e){const c=Math.min(Math.max(d.clientX,96),window.innerWidth-96);a(u=>({x:c,y:d.clientY,n:((u==null?void 0:u.n)??0)+1}))}};return t.jsxs("div",{className:"pb-8 max-w-form",onClick:o,"data-testid":"locked-form-frame",children:[r,e&&n&&t.jsxs("div",{role:"status",className:"fixed z-[60] pointer-events-none flex items-center gap-2 px-3 py-1.5 rounded-md bg-surface-raised border border-surface-border shadow-lg text-xs font-medium text-text-primary whitespace-nowrap animate-[click-hint_2.6s_ease-in-out_both]",style:{left:n.x,top:n.y-12},onAnimationEnd:()=>a(null),"data-testid":"locked-form-hint",children:[t.jsx(_n,{className:"w-3.5 h-3.5 text-accent shrink-0",strokeWidth:1.5}),e]},n.n)]})}function F({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 ut({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 At(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 dr(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 ur({fieldKey:e,value:s,onChange:r,schema:n,isRequired:a}){const o=m.useRef(null),d=(n==null?void 0:n.accept)??void 0,c=Y(e,n),u=n==null?void 0:n.description,p=m.useCallback(i=>{var v;const x=(v=i.target.files)==null?void 0:v[0];if(!x)return;const b=new FileReader;b.onload=()=>{typeof b.result=="string"&&r(b.result)},b.readAsDataURL(x)},[r]),l=s.startsWith("data:");return t.jsxs("div",{children:[t.jsx(F,{isRequired:a,children:c}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),t.jsxs("div",{className:"mt-1",children:[t.jsx("input",{ref:o,type:"file",accept:d,onChange:p,className:"hidden"}),t.jsx("button",{type:"button",onClick:()=>{var i;return(i=o.current)==null?void 0:i.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 xr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:a}){const o=Y(e,n),d=n==null?void 0:n.description,c=(n==null?void 0:n["x-lt-language"])??"",u=m.useCallback(p=>{if(p.key==="Tab"){p.preventDefault();const l=p.currentTarget,i=l.selectionStart,x=l.selectionEnd,b=s.substring(0,i)+" "+s.substring(x);r(b),requestAnimationFrame(()=>{l.selectionStart=l.selectionEnd=i+2})}},[s,r]);return t.jsxs("div",{children:[t.jsxs(F,{isRequired:a,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:p=>r(p.target.value),onKeyDown:u,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function pr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:a}){const o=m.useRef(null),[d,c]=m.useState(!1),u=Y(e,n),p=n==null?void 0:n.description;m.useEffect(()=>{const y=o.current;if(!y)return;const g=y.getContext("2d");if(g&&(g.lineWidth=2,g.lineCap="round",g.strokeStyle="#1E1535",s&&s.startsWith("data:"))){const j=new Image;j.onload=()=>g.drawImage(j,0,0),j.src=s}},[]);const l=m.useCallback(y=>{const g=o.current,j=g.getBoundingClientRect(),k=j.width>0?g.width/j.width:1,h=j.height>0?g.height/j.height:1;return"touches"in y?{x:(y.touches[0].clientX-j.left)*k,y:(y.touches[0].clientY-j.top)*h}:{x:(y.clientX-j.left)*k,y:(y.clientY-j.top)*h}},[]),i=m.useCallback(y=>{var k;c(!0);const g=(k=o.current)==null?void 0:k.getContext("2d");if(!g)return;const j=l(y);g.beginPath(),g.moveTo(j.x,j.y)},[l]),x=m.useCallback(y=>{var k;if(!d)return;const g=(k=o.current)==null?void 0:k.getContext("2d");if(!g)return;const j=l(y);g.lineTo(j.x,j.y),g.stroke()},[d,l]),b=m.useCallback(()=>{c(!1);const y=o.current;y&&r(y.toDataURL("image/png"))},[r]),v=m.useCallback(()=>{const y=o.current;if(!y)return;const g=y.getContext("2d");g&&(g.clearRect(0,0,y.width,y.height),r(""))},[r]);return t.jsxs("div",{children:[t.jsx(F,{isRequired:a,children:u}),p&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:p}),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:i,onMouseMove:x,onMouseUp:b,onMouseLeave:b,onTouchStart:i,onTouchMove:x,onTouchEnd:b})}),t.jsx("button",{type:"button",onClick:v,className:"mt-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function mr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:a}){const o=Y(e,n),d=n==null?void 0:n.description;return t.jsxs("div",{children:[t.jsx(F,{isRequired:a,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 fr({fieldKey:e,value:s,onChange:r,schema:n,isRequired:a}){const[o,d]=m.useState("write"),c=Y(e,n),u=n==null?void 0:n.description;return(n==null?void 0:n.readOnly)===!0?t.jsx(Vt,{content:s,className:"my-1"}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(F,{isRequired:a,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))})]}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),o==="write"?t.jsx("textarea",{value:s,onChange:l=>r(l.target.value),className:"input w-full mt-1 text-sm font-mono leading-relaxed",rows:10,placeholder:"Write markdown — headings, lists, tables, code blocks, and links all render."}):t.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:s.trim()?t.jsx(Vt,{content:s}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}const gr=28;function hr({fieldKey:e,value:s,onChange:r,schema:n,escalationContext:a,isRequired:o,submitAttempted:d,error:c}){const u=n==null?void 0:n["x-lt-source"],p=(n==null?void 0:n["x-lt-require-all"])===!0,l=[];if(u&&a){const h=u.indexOf(".");if(h!==-1){const T=u.slice(0,h),M=u.slice(h+1);try{const I=Ht(a[T],M);Array.isArray(I)&&l.push(...I)}catch{}}}let i={};try{s&&(i=JSON.parse(s))}catch{}const x=h=>r(JSON.stringify({...i,[h]:!i[h]})),b=Y(e,n),v=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 y=n==null?void 0:n["x-lt-variant"],g=y==="chips"||y==="rows"?y:p||l.some(h=>h.label.length>gr)?"rows":"chips",j=l.filter(h=>i[h.id]).length,k=(l.find(h=>!i[h.id]&&h.required!==!1)??l[0]).id;return t.jsxs("div",{role:"group","aria-label":b,"aria-required":o||void 0,"aria-invalid":c?!0:void 0,children:[t.jsx(F,{isRequired:o,children:b}),v&&t.jsx(X,{children:v}),g==="chips"?t.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:l.map(h=>{const T=i[h.id]??!1,M=!T&&!!d&&j===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)] ${T?"bg-accent border-accent text-text-inverse":M?"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:T,onChange:()=>x(h.id),className:"sr-only","data-testid":`checklist-item-${h.id}`,...h.id===k?{"data-field-key":e}:{}}),T&&t.jsx(Cn,{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 T=i[h.id]??!1,M=!T&&!!d&&(p?h.required!==!1:j===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 ${M?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[t.jsx("input",{type:"checkbox",checked:T,onChange:()=>x(h.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${M?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${h.id}`,...h.id===k?{"data-field-key":e}:{}}),t.jsxs("span",{className:`text-sm leading-snug transition-colors ${M?"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 ${M?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},h.id)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-3 tabular-nums",children:g==="chips"?t.jsxs(t.Fragment,{children:[j," selected",o&&j===0&&!!d&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(check at least one)"})]}):t.jsxs(t.Fragment,{children:[j," / ",l.length," confirmed",p?t.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",l.some(h=>h.required===!1)?" except optional":"",")"]}):o&&j===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 br=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function yr(e){var n,a,o,d;const s=e.trim();if(!s)return{kind:"none"};const r=(a=(n=/^data:([^;,]+)[;,]/.exec(s))==null?void 0:n[1])==null?void 0:a.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(br.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 Ve({fieldKey:e,value:s,schema:r}){const[n,a]=m.useState(!1),o=yr(s??""),d=e.replace(/[_-]/g," "),c=r==null?void 0:r.description,u=t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:d}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c})]});return o.kind==="none"?t.jsxs("div",{children:[u,t.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):o.kind==="image"?t.jsxs("div",{children:[u,t.jsxs("div",{className:"mt-1",children:[t.jsx("button",{type:"button",onClick:()=>a(!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:()=>a(!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:[u,t.jsx("div",{className:"mt-1",children:t.jsxs("a",{href:o.href,...o.isData?{download:`${e}.${o.label==="PDF"?"pdf":"bin"}`}:{target:"_blank",rel:"noopener noreferrer"},className:"inline-flex items-center gap-1.5 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`attachment-link-${e}`,children:[t.jsx(En,{className:"w-3.5 h-3.5",strokeWidth:1.5}),o.isData?`Download ${o.label}`:`Open ${o.label}`,o.isData?t.jsx(An,{className:"w-3 h-3",strokeWidth:1.5}):t.jsx(ae,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}function jr({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-href"])??"",a=n&&r?it(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=a.startsWith("/"),u=!a.trim();return t.jsxs("div",{"data-field-key":e,children:[t.jsx(F,{children:o}),d&&t.jsx(X,{children:d}),t.jsx("div",{className:"mt-1",children:u?t.jsx("span",{className:"text-xs text-text-quaternary italic",children:"No link configured"}):c?t.jsxs(jt,{to:a,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(ae,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}):t.jsxs("a",{href:a,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(ae,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]})})]})}function ps({to:e,className:s=""}){return t.jsxs(jt,{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(Tn,{className:"w-3.5 h-3.5",strokeWidth:2}),t.jsx("span",{className:"sr-only",children:"View details"})]})}const Je="—";function Nr(e,s){if(!e||!s)return"";const r=e.indexOf(".");if(r===-1)return"";const n=e.slice(0,r),a=e.slice(r+1);try{const o=Ht(s[n],a);return typeof o=="string"?o:""}catch{return""}}function vr(e,s){if(!e||e===Je)return Je;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:le(e)}return e}function wr({fieldKey:e,schema:s,escalationContext:r}){const n=s==null?void 0:s["x-lt-source"],a=(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=Nr(n,r),{data:u,isLoading:p,isError:l}=Ge(c);return t.jsxs("div",{"data-field-key":e,children:[t.jsx(F,{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"}):p?t.jsx(_r,{}):u?t.jsx(kr,{esc:u,fields:a,fieldKey:e}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"No linked record"})})]})}function kr({esc:e,fields:s,fieldKey:r}){if(!e)return null;const n=ue(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(ns,{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(a=>{const o=it(a.value,n),d=vr(o,a.format);return t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-2xs text-text-tertiary whitespace-nowrap",children:a.label}),t.jsx("dd",{className:"text-2xs text-text-primary",children:d})]},a.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," · ",le(e.created_at)]}),t.jsx(ps,{to:`/escalations/detail/${e.id}`})]})]})}function _r(){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 Cr(e,s){if(!e)return{};const r={};for(const[n,a]of Object.entries(e))r[n]=typeof a=="string"?it(a,s):a;return r}function ms(e,s,r){const n=Cr(e.facets,s),a={role:e.role,status:e.status??"pending",facets:n,limit:e.limit,enabled:!!(e.role||Object.keys(n).length)};return e.assigned==="me"?{...a,assigned_to:r,available:!1,enabled:a.enabled&&!!r}:e.assigned==="any"?a:{...a,available:e.available??!0}}const Er=[{label:"Description",value:"{{escalation.description}}"},{label:"Role",value:"{{escalation.role}}"},{label:"Age",value:"{{escalation.created_at}}",format:"age"}],He="—";function Ar(e,s){if(!e||e===He)return He;if(s==="age"){const r=new Date(e);return Number.isNaN(r.getTime())?e:le(e)}return e}function oe(e,s){return typeof e=="string"?it(e,s):Array.isArray(e)?e.map(r=>oe(r,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,oe(n,s)])):e}function Tr({fieldKey:e,schema:s,escalationContext:r}){const n=(s==null?void 0:s["x-lt-query"])??{},a=(s==null?void 0:s["x-lt-columns"])??Er,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,u=r??{},{user:p}=ce(),l=ms(n,u,p==null?void 0:p.userId),{data:i,isLoading:x}=Qe({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:xn({columns:a,actions:o})?"envelope":void 0}),b=(i==null?void 0:i.escalations)??[],v=Ye(),[y,g]=m.useState({}),[j,k]=m.useState(null),h=async(T,M)=>{const I=ue(T);if(!(M.confirm&&!window.confirm(it(M.confirm,I)))){k(T.id),g($=>({...$,[T.id]:""}));try{await v.mutateAsync({id:T.id,resolverPayload:oe(M.resolverPayload,I)})}catch($){g(W=>({...W,[T.id]:$.message}))}finally{k(null)}}};return t.jsxs("div",{"data-field-key":e,children:[t.jsx(F,{children:d}),c&&t.jsx(X,{children:c}),t.jsx("div",{className:"mt-1","data-testid":`escalation-list-widget-${e}`,children:x?t.jsx(Or,{columns:a.length}):t.jsx(Rr,{escalations:b,columns:a,fieldKey:e,actions:o,onAction:h,pendingRow:j,rowErrors:y})})]})}function Rr({escalations:e,columns:s,fieldKey:r,actions:n,onAction:a,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 u=ue(c),p=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 i=it(l.value,u),x=Ar(i,l.format);return t.jsx("td",{className:"py-1 pr-3 last:pr-0 text-text-primary align-top",children:x},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:()=>a(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)),p&&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:p})]}),t.jsx("td",{className:"py-1 pl-2 align-top",children:t.jsx(ps,{to:`/escalations/detail/${c.id}`})})]},c.id)})})]})}function Or({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 se={"file-upload":ur,"code-editor":xr,signature:pr,"rich-text":mr,markdown:fr,checklist:hr,attachment:Ve,image:Ve,link:jr,escalation:wr,"escalation-list":Tr};function fs({fieldKey:e,value:s,onChange:r,onBlur:n,schema:a,isRequired:o,isReadOnly:d,error:c,escalationContext:u,submitAttempted:p}){var W;const l=(W=a==null?void 0:a.properties)==null?void 0:W[e],i=Y(e,l),x=l==null?void 0:l["x-lt-widget"],b=`lt-field-${e}`,v=`${b}-error`,y=`${b}-help`,g=typeof(l==null?void 0:l.description)=="string"&&l.description.length>0?l.description:void 0,h={id:b,"aria-required":o||void 0,"aria-invalid":c?!0:void 0,"aria-describedby":c?v:g!==void 0?y:void 0},T=x==="markdown"&&typeof s=="string",M=(x==="attachment"||x==="image")&&typeof s=="string",I=!!(x&&x in se);if(d&&!T&&!M&&!I){const E=s===null?"null":typeof s=="object"?JSON.stringify(s,null,2):String(s);return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,children:i}),t.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:E})]})}if(x&&x in se){const E=se[x],A=o||(l==null?void 0:l["x-lt-require-all"])===!0,R={fieldKey:e,schema:l,escalationContext:u,isRequired:A,submitAttempted:p,error:c};if((l==null?void 0:l.type)==="object"){const O=typeof s=="string"?s:typeof s=="object"&&s!==null&&!Array.isArray(s)?JSON.stringify(s):"";return t.jsx(E,{...R,value:O,onChange:S=>{try{r(JSON.parse(S))}catch{r(S)}}})}if(typeof s=="string")return t.jsx(E,{...R,value:s,onChange:O=>r(O)});if(typeof s=="object"&&s!==null&&!Array.isArray(s))return t.jsx(E,{...R,value:JSON.stringify(s),onChange:O=>{try{r(JSON.parse(O))}catch{r(O)}}})}const $=cs(l,u);if($&&(s===null||typeof s=="string"||typeof s=="number")){const E=s===null?"":String(s),A=$.some(R=>String(R.value)===E);return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsxs("select",{value:A?E:"",disabled:$.length===0,onChange:R=>{const O=$.find(S=>String(S.value)===R.target.value);r(O?O.value:R.target.value)},onBlur:n,"data-field-key":e,className:dr(!!c),...h,children:[!A&&t.jsx("option",{value:"",disabled:!0,children:"Choose…"}),$.map(R=>t.jsx("option",{value:String(R.value),children:R.label},String(R.value)))]}),t.jsx(ut,{error:c,id:v})]})}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:E=>{r(E.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:[i,o&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),g&&t.jsx(X,{id:y,children:g}),t.jsx(ut,{error:c,id:v})]});if(typeof s=="number")return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsx("input",{type:"number",value:s,onChange:E=>r(parseFloat(E.target.value)||0),onBlur:n,step:"any","data-field-key":e,className:`${At(!!c)} max-w-48`,...h}),t.jsx(ut,{error:c,id:v})]});if(typeof s=="string"){if((l==null?void 0:l.format)==="password")return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsx("input",{type:"password",value:s,onChange:S=>r(S.target.value),onBlur:n,"data-field-key":e,className:At(!!c),autoComplete:"off",...h}),t.jsx(ut,{error:c,id:v})]});const A=l==null?void 0:l.format,R={date:"date","date-time":"datetime-local",email:"email",uri:"url"},O={date:"max-w-48","date-time":"max-w-64"};if(A&&A in R)return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsx("input",{type:R[A],value:s,onChange:S=>r(S.target.value),onBlur:n,"data-field-key":e,className:`${At(!!c)} ${O[A]??""}`,...h}),t.jsx(ut,{error:c,id:v})]});if(A==="textarea"||s.length>80){const S=l==null?void 0:l.maxLength,H=l==null?void 0:l["x-lt-max-length"];let q=S;if(q===void 0&&H&&u){const V=H.indexOf(".");if(V!==-1){const K=H.slice(0,V),L=H.slice(V+1),w=u[K];if(w&&typeof w=="object"){let _=w;for(const N of L.split("."))if(_=_[N],_===void 0)break;if(typeof _=="number")q=_;else if(typeof _=="string"){const N=Number(_);Number.isNaN(N)||(q=N)}}}}const Z=q!==void 0&&s.length>q;return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsx("textarea",{value:s,onChange:V=>{r(V.target.value),n==null||n()},onBlur:n,"data-field-key":e,className:`${At(!!c)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(s.length/60))),...h}),q!==void 0&&t.jsxs("p",{className:`text-2xs mt-0.5 text-right tabular-nums ${Z?"text-status-error font-medium":"text-text-quaternary"}`,children:[s.length," / ",q]}),t.jsx(ut,{error:c,id:v})]})}return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,htmlFor:b,children:i}),g&&t.jsx(X,{id:y,children:g}),t.jsx("input",{type:"text",value:s,onChange:S=>r(S.target.value),onBlur:n,"data-field-key":e,className:At(!!c),...h}),t.jsx(ut,{error:c,id:v})]})}if(s===null)return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,children:i}),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(F,{isRequired:o,children:i}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.map((E,A)=>t.jsx("span",{className:"px-2 py-0.5 text-2xs font-mono bg-surface-sunken rounded text-text-secondary",children:String(E)},A))})]});if(typeof s=="object"){const E=Object.entries(s);return t.jsxs("div",{children:[t.jsx(F,{isRequired:o,children:i}),t.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:E.map(([A,R])=>t.jsx(fs,{fieldKey:A,value:R,onChange:O=>r({...s,[A]:O})},A))})]})}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:a,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:a}),t.jsx("dd",{className:"text-sm text-text-primary break-words min-w-0","data-field-key":n,children:Mr(o)})]},n))})})}function Mr(e){return e==null||e===""?"—":typeof e=="boolean"?e?"Yes":"No":typeof e=="object"?JSON.stringify(e):String(e)}const ne="dictionary",Ir=new Set(["markdown","attachment","image"]);function gs(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 Dr(e,s,r){var c,u;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 a=n==null?void 0:n["x-lt-widget"];if(typeof a=="string"&&Ir.has(a))return!1;const o=n==null?void 0:n["x-lt-display"];if(typeof o=="string")return o===ne;const d=(u=gs(e,s))==null?void 0:u.display;return typeof d=="string"?d===ne:(e==null?void 0:e["x-lt-display"])===ne}function $r(e,s,r,n){var o;const a=[];for(const d of e){const[c]=d,u=a[a.length-1];if(Dr(s,r,c)){(u==null?void 0:u.kind)==="dictionary"?u.entries.push(d):a.push({kind:"dictionary",entries:[d]});continue}const p=(o=s==null?void 0:s.properties)==null?void 0:o[c],l=p==null?void 0:p["x-lt-column-group"];if(n==="two-column"&&typeof l=="string"&&l.trim()){(u==null?void 0:u.kind)==="column-group"&&u.name===l?u.entries.push(d):a.push({kind:"column-group",name:l,entries:[d]});continue}a.push({kind:"field",entry:d})}return a}function Lr({name:e,entries:s,formSchema:r,layout:n,renderField:a}){const o=$r(s,r,e,n),d=gs(r,e),c=(d==null?void 0:d.columns)??(n==="two-column"?2:1),u=l=>l.map(([i,x])=>{var b;return{key:i,label:Y(i,(b=r==null?void 0:r.properties)==null?void 0:b[i]),value:x}}),p=()=>o.map((l,i)=>l.kind==="dictionary"?t.jsx("div",{className:n==="two-column"?"col-span-full":"",children:t.jsx(Sr,{items:u(l.entries),columns:c})},`dict-${i}`):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(x=>a(x))})},`group-${l.name}-${i}`):a(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:p()})}):t.jsx("div",{className:"space-y-5",children:p()})]})}function hs({value:e,onChange:s,disabled:r,submitAttempted:n,escalationContext:a,onOpenHelp:o,onDisabledClick:d,disabledHint:c}){var K,L;const[u,p]=m.useState({}),[l,i]=m.useState({}),[x,b]=m.useState(null),[v,y]=m.useState(!1),[g,j]=m.useState(new Set);m.useEffect(()=>{try{const w=JSON.parse(e);if(typeof w=="object"&&w!==null&&!Array.isArray(w)){const _={},N={};for(const[P,J]of Object.entries(w))P.startsWith("_")?N[P]=J:_[P]=J;p(_),i(N),b(N._form_schema&&typeof N._form_schema=="object"?N._form_schema:null),y(!1)}}catch{y(!0)}},[e]);const k=m.useCallback(w=>{p(w),s(JSON.stringify({...w,...l},null,2))},[l,s]),h=m.useCallback((w,_)=>{k({...u,[w]:_})},[u,k]),T=m.useCallback(w=>{j(_=>{if(_.has(w))return _;const N=new Set(_);return N.add(w),N})},[]);if(v)return t.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const M=Object.entries(u);if(M.length===0)return t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const I=x==null?void 0:x["x-lt-order"],$=I?[...M].sort((w,_)=>{const N=I.indexOf(w[0]),P=I.indexOf(_[0]);return(N===-1?1/0:N)-(P===-1?1/0:P)}):M,W={...a??{},resolver:u},E=$.filter(([w,_])=>{var P;const N=(P=x==null?void 0:x.properties)==null?void 0:P[w];return!(!Ut(N==null?void 0:N["x-lt-showIf"],W)||(N==null?void 0:N["x-lt-hide-if-empty"])===!0&&(_==null||_===""||_===!1||_===0))}),A=new Set((x==null?void 0:x.required)??[]),R=x==null?void 0:x["x-lt-layout"],O=x==null?void 0:x.title,S=x==null?void 0:x.description,H=typeof(x==null?void 0:x["x-lt-help"])=="string"||typeof(x==null?void 0:x["x-lt-context"])=="string",q=[];for(const w of E){const[_]=w,N=(K=x==null?void 0:x.properties)==null?void 0:K[_],P=((L=N==null?void 0:N["x-lt-section"])==null?void 0:L.trim())||null,J=q[q.length-1];!J||J.name!==P?q.push({name:P,entries:[w]}):J.entries.push(w)}const Z=([w,_])=>{var D;const N=(D=x==null?void 0:x.properties)==null?void 0:D[w],P=(N==null?void 0:N.readOnly)===!0,J=(N==null?void 0:N["x-lt-span"])??1,ot=A.has(w),Nt=g.has(w)||!!n,G=ds(_,N,ot,Nt,W);return t.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${R==="two-column"&&J>=2?"col-span-full":""}`,children:t.jsx(fs,{fieldKey:w,value:_,onChange:pt=>h(w,pt),onBlur:()=>T(w),schema:x,isRequired:ot,isReadOnly:P,error:G,escalationContext:W,submitAttempted:!!n})},w)},V=t.jsxs("div",{className:r?"pointer-events-none":void 0,inert:r||void 0,"aria-disabled":r||void 0,children:[O&&t.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.jsx("h3",{className:"heading-3",children:O}),H&&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(rs,{className:"w-4 h-4",strokeWidth:1.5})})]}),S&&t.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:S}),t.jsx("div",{className:"space-y-8",children:q.map((w,_)=>t.jsx(Lr,{name:w.name,entries:w.entries,formSchema:x,layout:R,renderField:Z},w.name??`__s${_}`))})]});return r?t.jsx(cr,{hint:c,onLockedClick:d,children:V}):t.jsx("div",{className:"pb-8 max-w-form",children:V})}function Pr({json:e,onJsonChange:s,requestTriage:r,onRequestTriageChange:n,triageNotes:a,onTriageNotesChange:o,disabled:d=!1,submitAttempted:c=!1,showTriage:u=!1,escalationContext:p,onOpenHelp:l,onDisabledClick:i,disabledHint:x}){return t.jsxs(t.Fragment,{children:[u&&t.jsx("div",{className:"flex items-center justify-between mb-3",children:r?t.jsxs("button",{onClick:()=>n(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[t.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),t.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):t.jsxs("button",{onClick:()=>n(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[t.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),t.jsxs("span",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),t.jsxs("div",{className:"relative min-h-[200px]",children:[t.jsx("div",{className:r?"pointer-events-none select-none":"",children:t.jsx(hs,{value:e,onChange:s,disabled:d,submitAttempted:c,escalationContext:p,onOpenHelp:l,onDisabledClick:i,disabledHint:x})}),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:a,onChange:b=>o(b.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function bs(e,s){if(!e.includes("{"))return e;try{const r=a=>{if(!a)return{};try{return JSON.parse(a)}catch{return{}}},n={...s.metadata??{},...r(s.envelope),...r(s.escalation_payload)};return e.replace(/\{([^}]+)\}/g,(a,o)=>Object.prototype.hasOwnProperty.call(n,o)?String(n[o]):`{${o}}`)}catch{return e}}function Be(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function xt(e,s){return{escalation:e,metadata:e.metadata??null,envelope:Be(e.envelope),payload:Be(e.escalation_payload),resolver:null,...s?{lookup:s}:{}}}function Fr({isRoundsExhausted:e,payloadObj:s,isTerminal:r,resolverPayload:n,onRetryTriage:a,isRetrying:o}){return t.jsxs(t.Fragment,{children:[e&&s&&t.jsx("div",{className:"mt-8",children:t.jsx(or,{payload:s,isTerminal:r,resolverPayload:n,onRetryTriage:a,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(Ie,{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(jt,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[t.jsx(Ie,{size:12}),"Go to Credentials"]})]})]})]})}function Wr({esc:e,resolverPayload:s,isTerminal:r,claimedByMe:n,activeView:a,metadataFormSchema:o,effectiveSchema:d,lookup:c,json:u,onJsonChange:p,requestTriage:l,onRequestTriageChange:i,triageNotes:x,onTriageNotesChange:b,onResolve:v,onEscalate:y,onClaim:g,submitAttempted:j,isCertified:k,hasAI:h,onOpenHelp:T,onDisabledClick:M,disabledHint:I}){const $=d,W=xt(e,c);if(r){if(s==null)return null;const O=typeof s=="object"&&s!==null?s:{},S=d??o,H=S!=null&&S.properties?{...ss(O,S),_form_schema:S}:O;return t.jsx("div",{className:"mt-3",children:t.jsx(hs,{value:JSON.stringify(H,null,2),onChange:()=>{},disabled:!0,escalationContext:W,disabledHint:I})})}if(a!=="resolve"||!(e.workflow_type||d))return null;const E=$==null?void 0:$["x-lt-viewport"],A=(E==null?void 0:E.type)==="iframe"&&!!E.src&&v&&y;if(A&&!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(Rn,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),t.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const R=A?bs(E.src,e):"";return t.jsx("div",{className:"mt-3",children:A?t.jsx(xs,{src:R,escalation:e,schema:$,onResolve:v,onEscalate:y,submitAttempted:j}):t.jsx(Pr,{json:u,onJsonChange:p,requestTriage:l,onRequestTriageChange:i,triageNotes:x,onTriageNotesChange:b,disabled:!n,submitAttempted:j,showTriage:!!k&&!!h,escalationContext:W,onOpenHelp:T,onDisabledClick:M,disabledHint:I})})}function qr({open:e,assignedUntil:s,onClose:r,onExtend:n,isPending:a}){const o=Ze(),[d,c]=m.useState("30"),[u,p]=m.useState(0),l=d==="custom",i=l?u:parseInt(d),x=m.useCallback(b=>p(b),[]);return t.jsx(ts,{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(Jt,{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:b=>{c(b.target.value),p(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[o.map(b=>t.jsx("option",{value:b.value,children:b.label},b.value)),t.jsx("option",{value:"custom",children:"Other..."})]}),l&&t.jsx(Ke,{onChange:x,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(i),className:"btn-primary text-xs",disabled:a||!i||i<=0,children:a?"Extending...":"Extend Claim"})]})]})})}const Ur=9e4;function Vr(e,s=Ur){const[,r]=m.useState(0);if(m.useEffect(()=>{if(!e)return;const a=new Date(e).getTime()-Date.now();if(a<=0)return;const o=()=>r(u=>u+1),d=[],c=a-s;return c>0&&d.push(window.setTimeout(o,c)),d.push(window.setTimeout(o,a)),()=>d.forEach(u=>window.clearTimeout(u))},[e,s]),!e)return{expired:!1,expiringSoon:!1,msRemaining:0};const n=Math.max(0,new Date(e).getTime()-Date.now());return{expired:n<=0,expiringSoon:n>0&&n<=s,msRemaining:n}}const Jr="lt:escalation:draft:";function me(e){return`${Jr}${e}`}function Hr(e){try{return localStorage.getItem(me(e))}catch{return null}}function Br(e,s){try{localStorage.setItem(me(e),s)}catch{}}function re(e){try{localStorage.removeItem(me(e))}catch{}}const zr="x-lt-transition",Xr="x-lt-transition-message",Gr="x-lt-transition-max-wait-seconds",Qr="x-lt-transition-done",Yr="Submitted. Preparing your next step…",Zr=30,Kr=5,ta=300;function ea(e){const s=typeof e=="number"?e:Number(e);return!Number.isFinite(s)||s<=0?Zr:Math.min(ta,Math.max(Kr,Math.round(s)))}function ze(e){if(!e||!e[zr])return null;const s=e[Xr];return{message:typeof s=="string"&&s.trim().length>0?s:Yr,maxWaitSeconds:ea(e[Gr])}}function sa(e){const s=e==null?void 0:e[Qr];return typeof s=="string"&&s.trim().length>0?s:null}const na="x-lt-submit-on-claim";function ra(e){return!!(e!=null&&e[na])}const aa="x-lt-submit-guard",ia="{{count}} related items are still pending";function oa(e){const s=e==null?void 0:e[aa];if(!s||typeof s!="object"||Array.isArray(s))return;const r=s;if(!(!r.query||typeof r.query!="object"))return r}function la(e,s){const{user:r}=ce(),n=ms((e==null?void 0:e.query)??{},s??{},r==null?void 0:r.userId),{data:a,isSuccess:o}=Qe({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=(a==null?void 0:a.total)??0,u=d&&o&&c===0,p=d&&!u;let l="";if(p)if(c>0){const i=(e==null?void 0:e.message)??ia;l=it(i.replace(/\{\{count\}\}/g,String(c)),s??{})}else l="Checking related items…";return{blocked:p,count:c,message:l,confirmedEmpty:u}}function ca({open:e,message:s}){return e?nn.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(Vt,{content:s})})]})]}),document.body):null}const ys="lt:escalation:panel:open";function da(){try{const e=localStorage.getItem(ys);return e===null?!0:e==="true"}catch{return!0}}function Tt(e){try{localStorage.setItem(ys,String(e))}catch{}}function Rt(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function Da(){const{id:e}=rn();return t.jsx(ua,{id:e},e)}function ua({id:e}){var _e,Ce,Ee,Ae,Te;const{user:s,isSuperAdmin:r,hasRoleType:n}=ce(),a=r||n("admin"),{identity:o}=Us(),d=Vs(),c=(o==null?void 0:o.actorId)??(s==null?void 0:s.userId),u=de(),p=es(),l=Xe(),{data:i,isLoading:x,refetch:b,isFetching:v}=Ge(e);mn(e);const y=m.useMemo(()=>{if(!(i!=null&&i.envelope))return!1;try{const f=JSON.parse(i.envelope);return Array.isArray(f==null?void 0:f.lookups)&&f.lookups.length>0}catch{return!1}},[i==null?void 0:i.envelope]),{data:g}=Js(e,y),j=m.useMemo(()=>{var f;return(f=g==null?void 0:g.lookups)!=null&&f.length?Object.fromEntries(g.lookups.filter(C=>!C.missing).map(C=>[C.as??C.key,C.data])):null},[g]),k=Hs(),h=Ye(),T=Bs(),M=zs(),I=Xs(),$=Gs(),[W,E]=m.useState(!1),[A,R]=m.useState(!1),{data:O}=pn(),{data:S}=Qs(),{isBuilder:H}=Ys(),q=O==null?void 0:O.find(f=>f.workflow_type===(i==null?void 0:i.workflow_type)),Z=((_e=S==null?void 0:S.telemetry)==null?void 0:_e.traceUrl)??null,[V,K]=m.useState("resolve"),[L,w]=m.useState("{}"),[_,N]=m.useState(da),[P,J]=m.useState(!1),[ot,Nt]=m.useState(""),[G,D]=m.useState(!1),[pt,vt]=m.useState([]),[js,Ns]=m.useState(0),[vs,wt]=m.useState(void 0),[tt,Bt]=m.useState(null),[ws,fe]=m.useState(!1),ge=m.useRef(!1),St=m.useRef(null),he=m.useRef(!1),Mt=m.useRef(null),ks=Vr(i==null?void 0:i.assigned_until),[_s,Cs]=m.useState(null);m.useEffect(()=>{if(!(!G||!i))try{const f=JSON.parse(L),C=f._form_schema;if(!C){vt([]);return}vt(us(C,f,xt(i,j)))}catch{}},[L,G,i]);const It=((Ce=i==null?void 0:i.metadata)==null?void 0:Ce.form_schema)??null,mt=(i==null?void 0:i.form_schema)??(q==null?void 0:q.resolver_schema)??null,U=It??mt,be=ra(U),et=tn(U),kt=oa(U),_t=la(kt,i?xt(i,j):void 0),Dt=m.useRef(!1),$t=m.useRef(null);m.useEffect(()=>{if(Dt.current)return;const f=It??(mt!=null&&mt.properties?mt:null);if(f!=null&&f.properties){Dt.current=!0;const C=Rt(i==null?void 0:i.envelope),B=C==null?void 0:C.formDefaults,Q={...(i==null?void 0:i.metadata)??{},...typeof B=="object"&&B!==null?B:{}},ct=ss(Q,f),rt={_form_schema:f};for(const[Oe,Ls]of Object.entries(f.properties)){const Se=Ls,Ps=Se.type==="object"?{}:"";rt[Oe]=ct[Oe]??Se.default??Ps}$t.current=JSON.stringify(rt,null,2);const Re=!((i==null?void 0:i.status)==="resolved"||(i==null?void 0:i.status)==="cancelled")&&(i!=null&&i.id)?Hr(i.id):null,Ft=Re?Rt(Re):null;Ft&&typeof Ft=="object"&&!Array.isArray(Ft)?w(JSON.stringify({...Ft,_form_schema:f},null,2)):w($t.current)}else U&&(Dt.current=!0,w(JSON.stringify(U,null,2)))},[U,It,mt,i==null?void 0:i.envelope,i==null?void 0:i.metadata,i==null?void 0:i.id,i==null?void 0:i.status]),m.useEffect(()=>{if(!Dt.current||$t.current===null||!(i!=null&&i.id)||i.status!=="pending")return;const f=i.id,C=window.setTimeout(()=>{L===$t.current?re(f):Br(f,L)},400);return()=>window.clearTimeout(C)},[L,i==null?void 0:i.id,i==null?void 0:i.status]),m.useEffect(()=>{if(!tt)return;const f=window.setTimeout(async()=>{var B;try{const Q=new URLSearchParams({parent_id:e,assigned_to:c??"",status:"pending",limit:"1"}),ct=await yt(`/escalations?${Q}`),rt=(B=ct==null?void 0:ct.escalations)==null?void 0:B[0];if(rt!=null&&rt.id&&rt.parent_id===e){Bt(null),u(`/escalations/detail/${rt.id}`);return}}catch{}Bt(null),l.resetQueries({queryKey:["escalations"]}),l.resetQueries({queryKey:["escalationStats"]});const C=tt.doneDest;C?C.startsWith("/")?u(C):window.location.assign(C):u(-1)},tt.maxWaitSeconds*1e3);return()=>window.clearTimeout(f)},[tt,e,c,u,l]),m.useEffect(()=>{var f,C;ge.current||(f=p.state)!=null&&f.autoStart&&(!i||i.status!=="pending"||qt(i)||L!=="{}"&&(ge.current=!0,(C=St.current)==null||C.call(St)))},[i,L,p.state]),m.useEffect(()=>{var f;he.current||!(kt!=null&&kt.autoResolveWhenEmpty)||!_t.confirmedEmpty||!i||i.status!=="pending"||!qt(i)||i.assigned_to===c&&L!=="{}"&&(he.current=!0,(f=Mt.current)==null||f.call(Mt))},[_t.confirmedEmpty,kt,i,L,c]);const Es=(i==null?void 0:i.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(!i)return t.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const zt=qt(i),st=zt&&i.assigned_to===c,ye=zt&&!st,ft=i.status==="resolved"||i.status==="cancelled",lt=U==null?void 0:U["x-lt-viewport"],Xt=(lt==null?void 0:lt.type)==="iframe"&&!!(lt!=null&&lt.src)&&st&&!ft,Lt=Rt(i.escalation_payload),gt=Rt(i.resolver_payload),Pt=Rt(i.envelope),As=!!((Ee=Pt==null?void 0:Pt.metadata)!=null&&Ee.certified),je=Zs(),Ne=je!==null?je:!!((Ae=S==null?void 0:S.ai)!=null&&Ae.enabled),nt=typeof Lt=="object"&&Lt!==null&&!Array.isArray(Lt)?Lt:null,Ts=nt==null?void 0:nt._triage,Rs=typeof gt=="object"&&gt!==null&&!Array.isArray(gt)?gt:null,Gt=ft?"terminal":st?"claimed_by_me":ye?"claimed_by_other":"available",Os=Gt==="available"?`${typeof et.claim=="string"?et.claim:"Claim"} this escalation to edit the form`:Gt==="claimed_by_other"?t.jsxs(t.Fragment,{children:["Claimed by ",i.assigned_to?t.jsx(xe,{userId:i.assigned_to}):"another user"]}):i.status==="cancelled"?"This escalation is cancelled":i.status==="resolved"?"This escalation is resolved — the submitted values are shown":null,Qt=f=>{k.mutate({id:e,durationMinutes:f})},Ct=()=>{l.resetQueries({queryKey:["escalations"]}),l.resetQueries({queryKey:["escalationStats"]}),u(-1)},Ss=()=>{const f=sa(U);return f&&it(f,xt(i,j))||null},Ms=f=>{l.resetQueries({queryKey:["escalations"]}),l.resetQueries({queryKey:["escalationStats"]}),f.startsWith("/")?u(f):window.location.assign(f)},Et=async f=>{try{await h.mutateAsync({id:e,resolverPayload:f})}catch(Q){if(Q instanceof Ks&&In(Q.body)){D(!0),vt(Q.body.violations),wt(z.ERRORS);return}throw Q}re(e);const C=ze(U),B=Ss();if(C){Bt({...C,doneDest:B});return}if(B){Ms(B);return}Ct()},ve=async f=>{try{await k.mutateAsync({id:e,durationMinutes:f})}catch{return}if(_t.blocked)return;const C=ie(L,xt(i,j));if(!C.parseError){if(C.errors.length>0){D(!0),vt(C.errors),N(!0),Tt(!0),wt(z.ERRORS);return}await Et(C.payload)}};St.current=async()=>{var C;const f=(C=p.state)==null?void 0:C.durationMinutes;fe(!0),await ve(typeof f=="number"&&f>0?f:30),fe(!1)},Mt.current=()=>{const f=ie(L,xt(i,j));f.parseError||f.errors.length>0||Et(f.payload)};const we=async f=>{f&&(await T.mutateAsync({id:e,targetRole:f}),Ct())},Is=async()=>{st||await k.mutateAsync({id:e,durationMinutes:30});const f=(nt==null?void 0:nt.diagnosis)||i.description||"";await h.mutateAsync({id:e,resolverPayload:{_lt:{needsTriage:!0},notes:f}}),Ct()},ke=async()=>{await k.mutateAsync({id:e,durationMinutes:0}),Ct()},Ds=async()=>{await M.mutateAsync(e),re(e),E(!1),Ct()},$s=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(on,{onRefresh:()=>b(),isFetching:v,apiPath:`/escalations/${i.id}`,standalone:!0}),t.jsx("button",{onClick:()=>N(f=>(Tt(!f),!f)),className:"ml-2 text-accent/60 hover:text-accent transition-colors",title:_?"Hide side panel":"Show side panel",children:_?t.jsx(De,{className:"w-5 h-5",strokeWidth:1.5}):t.jsx($e,{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:[Xt?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:ke,disabled:k.isPending,label:et.release??"Release",hoverClass:"hover:text-accent",icon:t.jsx(On,{className:"w-4 h-4",strokeWidth:1.5})},...et.cancel===!1?[]:[{onClick:()=>E(!0),disabled:!1,label:et.cancel??"Cancel",hoverClass:"hover:text-status-error",icon:t.jsx(Sn,{className:"w-4 h-4",strokeWidth:1.5})}],{onClick:()=>N(f=>(Tt(!f),!f)),disabled:!1,label:_?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:_?t.jsx(De,{className:"w-4 h-4",strokeWidth:1.5}):t.jsx($e,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:f,disabled:C,label:B,hoverClass:Q,icon:ct})=>t.jsxs("div",{className:"relative group/tip",children:[t.jsx("button",{onClick:f,disabled:C,className:`text-text-tertiary ${Q} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:ct}),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:B})]},B))}),t.jsx(xs,{src:bs(lt.src,i),escalation:i,schema:U,onResolve:Et,onEscalate:we,submitAttempted:G,fill:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:t.jsx(an,{title:i.description||"Escalation",actions:$s})}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[t.jsx(Fr,{isRoundsExhausted:Es,payloadObj:nt,isTerminal:ft,resolverPayload:gt,onRetryTriage:Is,isRetrying:k.isPending||h.isPending}),t.jsx(Wr,{esc:i,resolverPayload:gt,isTerminal:ft,claimedByMe:st,activeView:V,lookup:j,metadataFormSchema:It,effectiveSchema:U,json:L,onJsonChange:w,requestTriage:P,onRequestTriageChange:J,triageNotes:ot,onTriageNotesChange:Nt,onResolve:Et,onEscalate:we,onClaim:()=>Qt(30),submitAttempted:G,isCertified:As,hasAI:Ne,onOpenHelp:()=>{N(!0),Tt(!0),wt(z.HELP)},onDisabledClick:()=>Ns(f=>f+1),disabledHint:Os}),t.jsx("div",{className:"h-10"})]})]}),!Xt&&t.jsx(ir,{escalationContext:xt(i,j),mode:Gt,activeView:V,onActiveViewChange:K,onClaim:be?ve:Qt,claimPending:k.isPending||be&&h.isPending,claimNudge:js,workflowType:i.workflow_type,json:L,onResolve:Et,resolvePending:h.isPending||h.isSuccess,resolveError:h.error,requestTriage:P,triageNotes:ot,onRelease:ke,releasePending:k.isPending,onCancel:()=>E(!0),assignedTo:i.assigned_to,assignedUntil:i.assigned_until,actingName:o&&st?o.displayName:null,badgePrompt:d&&!o&&ye,onSubmitAttempt:()=>D(!0),onValidationErrors:f=>{vt(f),N(!0),Tt(!0),wt(z.ERRORS)},labels:et,submitBlocked:_t.blocked,submitBlockedMessage:_t.message,canManage:a,onReassign:()=>R(!0),onUnassign:()=>$.mutate({ids:[e]}),unassignPending:$.isPending})]}),t.jsx(Hn,{esc:i,schema:U,envelope:Pt,payload:nt,resolver:Rs,triage:Ts??null,hasAI:Ne,claimed:zt,claimedByMe:st,isTerminal:ft,isBuilder:H,traceUrl:Z,open:_,noGutter:Xt,formErrors:pt,activePanel:vs,onPanelChange:wt}),t.jsx(en,{open:A,onClose:()=>R(!1),selectedCount:1,selectedRoles:i?[i.role]:[],onSubmit:(f,C)=>I.mutate({ids:[e],targetUserId:f,durationMinutes:C,reassign:!0},{onSuccess:()=>R(!1)}),isPending:I.isPending}),t.jsx(sn,{open:W,onClose:()=>E(!1),onConfirm:Ds,isPending:M.isPending,error:M.error,actionLabel:typeof et.cancel=="string"?et.cancel:void 0}),t.jsx(Dn,{escalationId:e}),t.jsx(ca,{open:!!tt||ws,message:(tt==null?void 0:tt.message)??((Te=ze(U))==null?void 0:Te.message)??"Starting…"}),st&&!ft&&i.assigned_until&&t.jsx(qr,{open:ks.expiringSoon&&i.assigned_until!==_s,assignedUntil:i.assigned_until,onClose:()=>Cs(i.assigned_until??null),onExtend:Qt,isPending:k.isPending})]})}export{Da as EscalationDetailPage};
3
- //# sourceMappingURL=index-Bf9cfGX_.js.map