@straiffi/archon 1.8.7 → 1.8.9

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 (180) hide show
  1. package/dist/client/assets/{ActivityView-D4Qh96zr.js → ActivityView-gBeoYQdD.js} +1 -1
  2. package/dist/client/assets/{GitHubActionsDialog-Bg03OmVv.js → GitHubActionsDialog-fc1Vwafm.js} +1 -1
  3. package/dist/client/assets/RepositoryGraphDialog-DCOjwUR3.js +1 -0
  4. package/dist/client/assets/VerificationDialog-CIObj1Rw.js +4 -0
  5. package/dist/client/assets/{architectureDiagram-3BPJPVTR-2lxabjSl.js → architectureDiagram-3BPJPVTR-B1tJZe1S.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-GPEHLZMM-C80HvJmb.js → blockDiagram-GPEHLZMM-D_90AQ2Z.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-AAUBKEIU-BM3k_lKz.js → c4Diagram-AAUBKEIU-DSyJfqly.js} +1 -1
  8. package/dist/client/assets/channel-DFw1f2Rh.js +1 -0
  9. package/dist/client/assets/{chunk-2J33WTMH-BTk3lX07.js → chunk-2J33WTMH-B9RStQGj.js} +1 -1
  10. package/dist/client/assets/{chunk-3OPIFGDE-DAxdBZ_4.js → chunk-3OPIFGDE-CHKuJYq0.js} +1 -1
  11. package/dist/client/assets/{chunk-5ZQYHXKU-BYm9s62a.js → chunk-5ZQYHXKU-Cznw7LTJ.js} +1 -1
  12. package/dist/client/assets/{chunk-727SXJPM-iVUM8xuV.js → chunk-727SXJPM-ix6OeZwJ.js} +1 -1
  13. package/dist/client/assets/{chunk-AQP2D5EJ-DVM7riMJ.js → chunk-AQP2D5EJ-DrPJIcE7.js} +1 -1
  14. package/dist/client/assets/{chunk-CSCIHK7Q-_D1FzP9B.js → chunk-CSCIHK7Q-BSEHTnBR.js} +1 -1
  15. package/dist/client/assets/{chunk-KSCS5N6A-D3XouAHf.js → chunk-KSCS5N6A-MdDdaLn8.js} +1 -1
  16. package/dist/client/assets/{chunk-L5ZTLDWV-B7NYWgT4.js → chunk-L5ZTLDWV-D_5xeDG1.js} +1 -1
  17. package/dist/client/assets/{chunk-LZXEDZCA-Dgkkbb6A.js → chunk-LZXEDZCA-Bz8_Fyt2.js} +2 -2
  18. package/dist/client/assets/{chunk-ND2GUHAM-CzO1oVCi.js → chunk-ND2GUHAM-DCINKlk8.js} +1 -1
  19. package/dist/client/assets/{chunk-NZK2D7GU-re0VVZne.js → chunk-NZK2D7GU-rGPgryKx.js} +1 -1
  20. package/dist/client/assets/{chunk-O5CBEL6O-BwsS59iy.js → chunk-O5CBEL6O-BHB8UIYA.js} +1 -1
  21. package/dist/client/assets/{chunk-WU5MYG2G-CLyh-xCA.js → chunk-WU5MYG2G-Bz5BJWjF.js} +1 -1
  22. package/dist/client/assets/classDiagram-4FO5ZUOK-Dt0kmMzQ.js +1 -0
  23. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BuxhA4Gw.js +1 -0
  24. package/dist/client/assets/{dagre-BM42HDAG-x71fYlqQ.js → dagre-BM42HDAG-B4TXLkOG.js} +1 -1
  25. package/dist/client/assets/{diagram-2AECGRRQ-CMdwzuYj.js → diagram-2AECGRRQ-CxMup1wq.js} +1 -1
  26. package/dist/client/assets/{diagram-5GNKFQAL-B3l6I4qJ.js → diagram-5GNKFQAL-CTfP_wnS.js} +1 -1
  27. package/dist/client/assets/{diagram-KO2AKTUF-BNhypLBW.js → diagram-KO2AKTUF-31NKNt4r.js} +1 -1
  28. package/dist/client/assets/{diagram-LMA3HP47-CmrhbiDt.js → diagram-LMA3HP47-Cxo7yvjc.js} +1 -1
  29. package/dist/client/assets/{diagram-OG6HWLK6-CRobDMLl.js → diagram-OG6HWLK6-ChgSAMLv.js} +1 -1
  30. package/dist/client/assets/{erDiagram-TEJ5UH35-CqO7K0TS.js → erDiagram-TEJ5UH35-u6msywL_.js} +1 -1
  31. package/dist/client/assets/{flowDiagram-I6XJVG4X-CuLTJZU0.js → flowDiagram-I6XJVG4X-CimeXkDN.js} +1 -1
  32. package/dist/client/assets/{ganttDiagram-6RSMTGT7-Bm7v1eRG.js → ganttDiagram-6RSMTGT7-DOu5sDUI.js} +1 -1
  33. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CNHZr-5i.js → gitGraphDiagram-PVQCEYII-zIToibUf.js} +1 -1
  34. package/dist/client/assets/index-C-VHd0Pr.js +274 -0
  35. package/dist/client/assets/index-D3xlEyeM.css +2 -0
  36. package/dist/client/assets/{infoDiagram-5YYISTIA-z27pUr2X.js → infoDiagram-5YYISTIA-CAtWGGJI.js} +1 -1
  37. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-CDocZ0jf.js → ishikawaDiagram-YF4QCWOH-7N-C7DEt.js} +1 -1
  38. package/dist/client/assets/{journeyDiagram-JHISSGLW-CgP31lsU.js → journeyDiagram-JHISSGLW-D7VUypFG.js} +1 -1
  39. package/dist/client/assets/{kanban-definition-UN3LZRKU-DxTm1_fc.js → kanban-definition-UN3LZRKU-AmbDmzSD.js} +1 -1
  40. package/dist/client/assets/{line-hrZ7m44_.js → line-qf4UZ8vh.js} +1 -1
  41. package/dist/client/assets/{mermaid-parser.core-BThJAIK-.js → mermaid-parser.core-BssCd1kF.js} +1 -1
  42. package/dist/client/assets/{mermaid.core-CfVyP_kK.js → mermaid.core-DzeMqg9Y.js} +3 -3
  43. package/dist/client/assets/{mindmap-definition-RKZ34NQL-CuISnLgW.js → mindmap-definition-RKZ34NQL-dEnNQcDm.js} +1 -1
  44. package/dist/client/assets/{pieDiagram-4H26LBE5-DnWAdd44.js → pieDiagram-4H26LBE5-VjMue0a-.js} +1 -1
  45. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Cb-RVl5A.js → quadrantDiagram-W4KKPZXB-DQFdm-0f.js} +1 -1
  46. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DrXg_gCS.js → requirementDiagram-4Y6WPE33-CHIaXlsy.js} +1 -1
  47. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DzZjp_ZP.js → sankeyDiagram-5OEKKPKP-D-kzGaKb.js} +1 -1
  48. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-CQJ3PhQD.js → sequenceDiagram-3UESZ5HK-CiDmlD8k.js} +1 -1
  49. package/dist/client/assets/{stateDiagram-AJRCARHV-B16j9pg1.js → stateDiagram-AJRCARHV-BKlnnFdT.js} +1 -1
  50. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DhJxc4em.js +1 -0
  51. package/dist/client/assets/{timeline-definition-PNZ67QCA-bUG3mZQt.js → timeline-definition-PNZ67QCA-D-BK07Un.js} +1 -1
  52. package/dist/client/assets/{vennDiagram-CIIHVFJN-DALCJcZD.js → vennDiagram-CIIHVFJN-CB9_GqSx.js} +1 -1
  53. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DPQd3l9A.js → wardleyDiagram-YWT4CUSO-BEuNfyLT.js} +1 -1
  54. package/dist/client/assets/{xychartDiagram-2RQKCTM6-BIv1FqXG.js → xychartDiagram-2RQKCTM6-CSS5WMrZ.js} +1 -1
  55. package/dist/client/index.html +2 -2
  56. package/dist/server/db.js +481 -27
  57. package/dist/server/db.js.map +1 -1
  58. package/dist/server/index.js +113 -54
  59. package/dist/server/index.js.map +1 -1
  60. package/dist/server/lib/activeAutomationChild.js +1 -0
  61. package/dist/server/lib/activeAutomationChild.js.map +1 -1
  62. package/dist/server/lib/agent.js +127 -15
  63. package/dist/server/lib/agent.js.map +1 -1
  64. package/dist/server/lib/agentRuns.js +12 -0
  65. package/dist/server/lib/agentRuns.js.map +1 -1
  66. package/dist/server/lib/agentSpawnPermits.js +37 -0
  67. package/dist/server/lib/agentSpawnPermits.js.map +1 -0
  68. package/dist/server/lib/automationCheckGate.js +9 -1
  69. package/dist/server/lib/automationCheckGate.js.map +1 -1
  70. package/dist/server/lib/automationProgression.js +19 -5
  71. package/dist/server/lib/automationProgression.js.map +1 -1
  72. package/dist/server/lib/automationReviewGate.js +1 -0
  73. package/dist/server/lib/automationReviewGate.js.map +1 -1
  74. package/dist/server/lib/buildCompletionContinuation.js +144 -4
  75. package/dist/server/lib/buildCompletionContinuation.js.map +1 -1
  76. package/dist/server/lib/buildSequences.js +13 -1
  77. package/dist/server/lib/buildSequences.js.map +1 -1
  78. package/dist/server/lib/bundleActivity.js +19 -0
  79. package/dist/server/lib/bundleActivity.js.map +1 -1
  80. package/dist/server/lib/chatOperations.js +81 -2
  81. package/dist/server/lib/chatOperations.js.map +1 -1
  82. package/dist/server/lib/checkAutoFix.js +604 -0
  83. package/dist/server/lib/checkAutoFix.js.map +1 -0
  84. package/dist/server/lib/checkAutoFixDetails.js +83 -0
  85. package/dist/server/lib/checkAutoFixDetails.js.map +1 -0
  86. package/dist/server/lib/checkAutoFixPolicy.js +59 -0
  87. package/dist/server/lib/checkAutoFixPolicy.js.map +1 -0
  88. package/dist/server/lib/checkRepair.js +149 -54
  89. package/dist/server/lib/checkRepair.js.map +1 -1
  90. package/dist/server/lib/checkRepairDispatch.js +91 -0
  91. package/dist/server/lib/checkRepairDispatch.js.map +1 -0
  92. package/dist/server/lib/checkRepairEvidence.js +84 -0
  93. package/dist/server/lib/checkRepairEvidence.js.map +1 -0
  94. package/dist/server/lib/checkRepairParent.js +21 -0
  95. package/dist/server/lib/checkRepairParent.js.map +1 -0
  96. package/dist/server/lib/checkRepairReconciliation.js +14 -5
  97. package/dist/server/lib/checkRepairReconciliation.js.map +1 -1
  98. package/dist/server/lib/checkRunner.js +27 -8
  99. package/dist/server/lib/checkRunner.js.map +1 -1
  100. package/dist/server/lib/checkRuns.js +63 -4
  101. package/dist/server/lib/checkRuns.js.map +1 -1
  102. package/dist/server/lib/executionReconciliation.js +387 -8
  103. package/dist/server/lib/executionReconciliation.js.map +1 -1
  104. package/dist/server/lib/executionRuns.js +24 -1
  105. package/dist/server/lib/executionRuns.js.map +1 -1
  106. package/dist/server/lib/git.js +302 -11
  107. package/dist/server/lib/git.js.map +1 -1
  108. package/dist/server/lib/integrations/github.js +138 -65
  109. package/dist/server/lib/integrations/github.js.map +1 -1
  110. package/dist/server/lib/integrations/importedIssueImages.js +10 -15
  111. package/dist/server/lib/integrations/importedIssueImages.js.map +1 -1
  112. package/dist/server/lib/postBuildCheckRuns.js +200 -5
  113. package/dist/server/lib/postBuildCheckRuns.js.map +1 -1
  114. package/dist/server/lib/postBuildChecks.js +83 -13
  115. package/dist/server/lib/postBuildChecks.js.map +1 -1
  116. package/dist/server/lib/projects.js +25 -1
  117. package/dist/server/lib/projects.js.map +1 -1
  118. package/dist/server/lib/queue.js +9 -3
  119. package/dist/server/lib/queue.js.map +1 -1
  120. package/dist/server/lib/repositoryGraphQueries.js +5 -3
  121. package/dist/server/lib/repositoryGraphQueries.js.map +1 -1
  122. package/dist/server/lib/repositoryGraphScan.js +13 -2
  123. package/dist/server/lib/repositoryGraphScan.js.map +1 -1
  124. package/dist/server/lib/repositoryGraphStore.js +61 -1
  125. package/dist/server/lib/repositoryGraphStore.js.map +1 -1
  126. package/dist/server/lib/specArtifact.js +10 -1
  127. package/dist/server/lib/specArtifact.js.map +1 -1
  128. package/dist/server/lib/specDraft.js +10 -2
  129. package/dist/server/lib/specDraft.js.map +1 -1
  130. package/dist/server/lib/specExport.js +70 -6
  131. package/dist/server/lib/specExport.js.map +1 -1
  132. package/dist/server/lib/specFormatting.js +3 -2
  133. package/dist/server/lib/specFormatting.js.map +1 -1
  134. package/dist/server/lib/specRepositoryEvidenceFormatting.js +75 -0
  135. package/dist/server/lib/specRepositoryEvidenceFormatting.js.map +1 -0
  136. package/dist/server/lib/specRepositoryImpact.js +447 -0
  137. package/dist/server/lib/specRepositoryImpact.js.map +1 -0
  138. package/dist/server/lib/specRepositoryImpactLimits.js +6 -0
  139. package/dist/server/lib/specRepositoryImpactLimits.js.map +1 -0
  140. package/dist/server/lib/specReviewContext.js +15 -5
  141. package/dist/server/lib/specReviewContext.js.map +1 -1
  142. package/dist/server/lib/specReviewValidation.js +1 -1
  143. package/dist/server/lib/specReviewValidation.js.map +1 -1
  144. package/dist/server/lib/specSections.js +28 -3
  145. package/dist/server/lib/specSections.js.map +1 -1
  146. package/dist/server/lib/specSnapshotEvidence.js +162 -0
  147. package/dist/server/lib/specSnapshotEvidence.js.map +1 -0
  148. package/dist/server/lib/specSnapshotEvidenceSerialization.js +202 -0
  149. package/dist/server/lib/specSnapshotEvidenceSerialization.js.map +1 -0
  150. package/dist/server/lib/specs.js +31 -5
  151. package/dist/server/lib/specs.js.map +1 -1
  152. package/dist/server/lib/ticketAutomationCommit.js +3 -1
  153. package/dist/server/lib/ticketAutomationCommit.js.map +1 -1
  154. package/dist/server/lib/ticketFollowUpOperations.js +16 -12
  155. package/dist/server/lib/ticketFollowUpOperations.js.map +1 -1
  156. package/dist/server/lib/ticketRunOperations.js +13 -1
  157. package/dist/server/lib/ticketRunOperations.js.map +1 -1
  158. package/dist/server/lib/ticketWorkflowOperations.js +5 -2
  159. package/dist/server/lib/ticketWorkflowOperations.js.map +1 -1
  160. package/dist/server/lib/types.js +1 -0
  161. package/dist/server/lib/types.js.map +1 -1
  162. package/dist/server/workers/build.js +46 -148
  163. package/dist/server/workers/build.js.map +1 -1
  164. package/dist/server/workers/chat.js +141 -31
  165. package/dist/server/workers/chat.js.map +1 -1
  166. package/dist/server/workers/followUp.js +210 -48
  167. package/dist/server/workers/followUp.js.map +1 -1
  168. package/dist/server/workers/specReview.js +17 -4
  169. package/dist/server/workers/specReview.js.map +1 -1
  170. package/dist/server/workers/specSession.js +127 -22
  171. package/dist/server/workers/specSession.js.map +1 -1
  172. package/package.json +1 -1
  173. package/dist/client/assets/RepositoryGraphDialog-CS_hOqPw.js +0 -1
  174. package/dist/client/assets/VerificationDialog-BYH-Ek8n.js +0 -4
  175. package/dist/client/assets/channel-HjENOCZ0.js +0 -1
  176. package/dist/client/assets/classDiagram-4FO5ZUOK-DnhdaVrK.js +0 -1
  177. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-C-BjeSGJ.js +0 -1
  178. package/dist/client/assets/index-Bs5SQZhz.css +0 -2
  179. package/dist/client/assets/index-LGNsdNYM.js +0 -274
  180. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-vNiFfHwm.js +0 -1
@@ -1 +1 @@
1
- import{i as e,pt as t}from"./index-LGNsdNYM.js";var n=t(),r=({projectId:t,onClose:r,onNavigateToLifecycleSource:i,initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c})=>t?(0,n.jsx)(e,{projectId:t,scope:{type:`project`},initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c,onClose:r,onNavigateToLifecycleSource:i}):null;export{r as ActivityView};
1
+ import{i as e,pt as t}from"./index-C-VHd0Pr.js";var n=t(),r=({projectId:t,onClose:r,onNavigateToLifecycleSource:i,initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c})=>t?(0,n.jsx)(e,{projectId:t,scope:{type:`project`},initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c,onClose:r,onNavigateToLifecycleSource:i}):null;export{r as ActivityView};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{C as t,D as n,E as r,F as i,G as a,H as o,I as s,K as c,N as l,S as u,T as d,U as f,V as p,W as m,X as h,Y as g,Z as _,bt as v,d as y,dt as ee,ft as te,gt as b,lt as ne,mt as x,pt as S,ut as re,w as C,x as w}from"./index-LGNsdNYM.js";var T=e(v(),1),E=S(),D=`https://docs.github.com/en/actions`,ie=5e3,O=(e,t)=>u.t(`common:githubActions.${e}`,t),k=e=>O(`status.${e}`),A=e=>e?O(`conclusion.${e}`):null,j=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`||e.conclusion===`timed_out`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e.conclusion===`cancelled`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e.status===`queued`?`border-violet-400/40 bg-violet-500/10 text-violet-200`:`border-border/70 bg-background/60 text-muted-foreground`,M=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`?`border-rose-400/30 bg-rose-500/10 text-rose-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border/70 bg-background/60 text-muted-foreground`,N=e=>{let t=e.run_started_at??e.created_at,n=e.updated_at;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=i-r;if(a<1e3)return`${a} ms`;let o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return s>0?`${s}h ${c}m ${l}s`:c>0?`${c}m ${l}s`:`${(a/1e3).toFixed(a>=1e4?0:1)} s`},P=e=>e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status),F=e=>{let t={};for(let n of e){if(n.type===`boolean`){t[n.name]=n.default===!0;continue}typeof n.default==`string`&&n.default!==``&&(t[n.name]=n.default)}return t},ae=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let a=e.state===`active`,o=t?.dispatchable??!0,c=a&&o&&!t?.isLoading,l=e.path.split(`/`).pop();return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-3 rounded-2xl border px-4 py-3 transition-colors`,n?`border-sky-400/45 bg-sky-500/10`:`border-border/60 bg-background/20 hover:bg-accent/20`),children:[(0,E.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,E.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:l}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,a?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:O(a?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,E.jsxs)(h,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!c,"aria-label":O(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?O(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:O(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:n,refValue:r,onRefChange:a,values:c,onValueChange:l,isDispatching:u,onDispatch:d,onCancel:f})=>{let m=n.inputs.filter(e=>e.required&&!L(c[e.name],e)),g=n.dispatchable&&!n.isLoading&&!n.error&&r.trim()!==``&&m.length===0&&!u;return(0,E.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`inputs.title`)}),(0,E.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":O(`actions.cancel`),onClick:f,children:(0,E.jsx)(t,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(p,{htmlFor:`github-actions-ref`,children:O(`inputs.refLabel`)}),(0,E.jsx)(o,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{a(e.target.value)},placeholder:O(`inputs.refPlaceholder`),"aria-label":O(`inputs.refAriaLabel`)})]}),n.isLoading&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`inputs.loading`)})]}),n.error&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:n.error}),!n.dispatchable&&!n.isLoading&&!n.error&&(0,E.jsx)(`p`,{className:`text-xs text-amber-200`,children:O(`inputs.notDispatchable`)}),n.inputs.map(e=>(0,E.jsx)(R,{input:e,value:c[e.name],onChange:t=>{l(e.name,t)}},e.name)),m.length>0&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:O(`inputs.requiredValidationError`)}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(h,{type:`button`,variant:`ghost`,onClick:f,disabled:u,children:O(`actions.cancel`)}),(0,E.jsxs)(h,{type:`button`,variant:`success`,onClick:d,disabled:!g,children:[u?(0,E.jsx)(s,{className:`h-4 w-4 animate-spin`}):(0,E.jsx)(i,{className:`h-4 w-4`}),(0,E.jsx)(`span`,{children:O(`actions.dispatch`)})]})]})]})},L=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,R=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(p,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{children:e.name}),e.required&&(0,E.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:O(`inputs.requiredLabel`)})]}),e.description&&(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),z(e,r,t,n)]})},z=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(y,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(i?`inputs.booleanYes`:`inputs.booleanNo`)})]})}if(e.type===`choice`){let i=e.options??[],a=typeof n==`string`?n:typeof e.default==`string`?e.default:``;return(0,E.jsxs)(`select`,{id:t,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 px-3 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,value:a,onChange:e=>{r(e.target.value)},children:[a===``&&(0,E.jsx)(`option`,{value:``,children:O(`inputs.selectPlaceholder`)}),i.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]})}return(0,E.jsx)(o,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},B=({job:e})=>e.steps.length===0?null:(0,E.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(t)),children:t.status===`completed`?A(t.conclusion)??O(`status.completed`):k(t.status)}),(0,E.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=N(e),n=P(e);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,j(e)),children:n})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,E.jsxs)(`a`,{href:e.html_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-sky-200 hover:text-sky-100`,children:[O(`actions.openOnGithub`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,E.jsxs)(`div`,{className:`mt-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(e)),children:e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status)}),(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,E.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??O(`runs.trackingState.${e.state}`);return(0,E.jsxs)(`div`,{className:_(`flex items-start gap-2 rounded-2xl border px-4 py-3`,t?`border-border/60 bg-background/20`:`border-red-400/25 bg-red-500/8`),children:[t&&(0,E.jsx)(s,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:_(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,E.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??O(`runs.unknownRef`)})]})]})},U=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||(e.updated_at??``)>=(t.updated_at??``))&&n.set(e.id,e)}return[...n.values()]},W=(e,t)=>{let n=new Map(e.map(e=>[e.execution_run_id,e]));for(let e of t){let t=n.get(e.execution_run_id),r=t&&![`queued`,`waiting`,`running`].includes(t.execution_status),i=[`queued`,`waiting`,`running`].includes(e.execution_status);(!r||!i)&&n.set(e.execution_run_id,e)}return[...n.values()]},oe=(e,t,n)=>{let r=t.filter(e=>e.run===null),i=new Set(r.map(e=>e.tracking_key));return W(e.filter(e=>i.has(e.tracking_key)||n.get(e.tracking_key)?.run===null),r.filter(e=>!n.has(e.tracking_key)))},se=e=>({ref:e??`main`}),G=({projectId:e,defaultBranch:i,onClose:o})=>{let[u,p]=(0,T.useState)([]),[_,v]=(0,T.useState)(!0),[y,S]=(0,T.useState)(null),[w,k]=(0,T.useState)([]),[A,j]=(0,T.useState)([]),[M,N]=(0,T.useState)({}),[P,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B]=(0,T.useState)(()=>se(i)),W=(0,T.useRef)({}),G=(0,T.useRef)({}),K=(0,T.useRef)(null),q=(0,T.useRef)(!1),J=(0,T.useRef)(0),Y=(0,T.useRef)(new Map),X=(0,T.useCallback)(async t=>{N(e=>{let n=e[t.id];return n?.isLoading?e:{...e,[t.id]:{inputs:n?.inputs??[],dispatchable:n?.dispatchable??!0,isLoading:!0,error:null}}});try{let n=await re(e,t.id,t.path);return N(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return N(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof x?e.message:O(`workflows.loadError`)}})),null}},[e]),Z=(0,T.useCallback)(async()=>{v(!0),S(null);try{let t=await te(e);p(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){S(e instanceof x?e.message:O(`workflows.loadError`))}finally{v(!1)}},[X,e]),Q=(0,T.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await ee(e,t);k(e=>U(e,r.runs)),j(e=>{let t=new Map([...Y.current.entries()].filter(([,e])=>e.revision>n).map(([e,t])=>[e,t.event]));return oe(e,r.tracked_runs??[],t)})}catch(e){b(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,T.useEffect)(()=>{Z()},[Z]),(0,T.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,ie),i=r(t);return()=>{e.abort(),window.clearInterval(n),i()}},[Q]);let ce=(0,T.useCallback)(async e=>{if(P?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=M[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:F(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:F(n.inputs)})},[B.ref,M,X,P]),le=(0,T.useCallback)(async()=>{if(!P)return;let t=M[P.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=P.values[e.name];e.type===`boolean`?n[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?n[e.name]=t:typeof e.default==`string`&&e.default!==``&&(n[e.name]=e.default)}try{await ne(e,P.workflow.id,{ref:P.ref,workflowName:P.workflow.name,workflowUrl:P.workflow.url,inputs:n}),l.success(O(`messages.dispatched`)),L(null),Q()}catch(e){l.error(e instanceof x?e.message:O(`messages.dispatchError`))}finally{z(!1)}},[M,Q,e,P]);(0,T.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),j(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&k(e=>U(e,[t.run])))};return d.on(`github-actions:updated`,t),()=>{d.off(`github-actions:updated`,t)}},[e]),(0,T.useEffect)(()=>{let e=P?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[P?.workflow.id]);let $=(0,T.useMemo)(()=>[...w].sort((e,t)=>{let n=e.updated_at?Date.parse(e.updated_at):0;return(t.updated_at?Date.parse(t.updated_at):0)-n}),[w]);return(0,E.jsx)(f,{open:!0,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(a,{showCloseButton:!1,overlayClassName:`bg-black/70`,className:`flex h-[calc(100vh-2rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl border border-[#2a2a38] bg-[#16161f] p-0 shadow-2xl sm:max-w-5xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,E.jsx)(g,{className:`sr-only`,children:O(`dialog.srTitle`)}),(0,E.jsx)(c,{className:`sr-only`,children:O(`dialog.srDescription`)}),(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-violet-200`,children:(0,E.jsx)(n,{className:`h-5 w-5`})}),(0,E.jsx)(`div`,{children:(0,E.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:O(`dialog.title`)})})]}),(0,E.jsx)(m,{asChild:!0,children:(0,E.jsx)(h,{type:`button`,"aria-label":O(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(t,{className:`h-4 w-4`})})})]}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,E.jsxs)(`aside`,{"aria-label":O(`workflows.ariaLabel`),className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`workflows.title`)}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:O(`actions.refresh`)})]}),_&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`workflows.loading`)})]}),y&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:y}),!_&&u.length===0&&!y&&(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:[(0,E.jsx)(`p`,{children:O(`workflows.empty`)}),(0,E.jsx)(`p`,{className:`mt-1`,children:O(`workflows.emptyHint`)}),(0,E.jsxs)(`a`,{href:D,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[O(`workflows.docsLink`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]}),(0,E.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=P?.workflow.id===e.id;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,E.jsx)(ae,{workflow:e,inputsState:M[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&P&&(0,E.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,E.jsx)(I,{workflow:e,inputsState:M[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:P.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:P.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`runs.title`)}),A.map(e=>(0,E.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,E.jsx)(V,{run:e},e.id)),$.length===0&&A.length===0&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:O(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{C as t,D as n,E as r,F as i,G as a,H as o,I as s,K as c,N as l,S as u,T as d,U as f,V as p,W as m,X as h,Y as g,Z as _,bt as v,d as y,dt as ee,ft as te,gt as b,lt as ne,mt as x,pt as S,ut as re,w as C,x as w}from"./index-C-VHd0Pr.js";var T=e(v(),1),E=S(),D=`https://docs.github.com/en/actions`,ie=5e3,O=(e,t)=>u.t(`common:githubActions.${e}`,t),k=e=>O(`status.${e}`),A=e=>e?O(`conclusion.${e}`):null,j=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`||e.conclusion===`timed_out`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e.conclusion===`cancelled`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e.status===`queued`?`border-violet-400/40 bg-violet-500/10 text-violet-200`:`border-border/70 bg-background/60 text-muted-foreground`,M=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`?`border-rose-400/30 bg-rose-500/10 text-rose-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border/70 bg-background/60 text-muted-foreground`,N=e=>{let t=e.run_started_at??e.created_at,n=e.updated_at;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=i-r;if(a<1e3)return`${a} ms`;let o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return s>0?`${s}h ${c}m ${l}s`:c>0?`${c}m ${l}s`:`${(a/1e3).toFixed(a>=1e4?0:1)} s`},P=e=>e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status),F=e=>{let t={};for(let n of e){if(n.type===`boolean`){t[n.name]=n.default===!0;continue}typeof n.default==`string`&&n.default!==``&&(t[n.name]=n.default)}return t},ae=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let a=e.state===`active`,o=t?.dispatchable??!0,c=a&&o&&!t?.isLoading,l=e.path.split(`/`).pop();return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-3 rounded-2xl border px-4 py-3 transition-colors`,n?`border-sky-400/45 bg-sky-500/10`:`border-border/60 bg-background/20 hover:bg-accent/20`),children:[(0,E.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,E.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:l}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,a?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:O(a?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,E.jsxs)(h,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!c,"aria-label":O(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?O(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:O(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:n,refValue:r,onRefChange:a,values:c,onValueChange:l,isDispatching:u,onDispatch:d,onCancel:f})=>{let m=n.inputs.filter(e=>e.required&&!L(c[e.name],e)),g=n.dispatchable&&!n.isLoading&&!n.error&&r.trim()!==``&&m.length===0&&!u;return(0,E.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`inputs.title`)}),(0,E.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":O(`actions.cancel`),onClick:f,children:(0,E.jsx)(t,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(p,{htmlFor:`github-actions-ref`,children:O(`inputs.refLabel`)}),(0,E.jsx)(o,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{a(e.target.value)},placeholder:O(`inputs.refPlaceholder`),"aria-label":O(`inputs.refAriaLabel`)})]}),n.isLoading&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`inputs.loading`)})]}),n.error&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:n.error}),!n.dispatchable&&!n.isLoading&&!n.error&&(0,E.jsx)(`p`,{className:`text-xs text-amber-200`,children:O(`inputs.notDispatchable`)}),n.inputs.map(e=>(0,E.jsx)(R,{input:e,value:c[e.name],onChange:t=>{l(e.name,t)}},e.name)),m.length>0&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:O(`inputs.requiredValidationError`)}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(h,{type:`button`,variant:`ghost`,onClick:f,disabled:u,children:O(`actions.cancel`)}),(0,E.jsxs)(h,{type:`button`,variant:`success`,onClick:d,disabled:!g,children:[u?(0,E.jsx)(s,{className:`h-4 w-4 animate-spin`}):(0,E.jsx)(i,{className:`h-4 w-4`}),(0,E.jsx)(`span`,{children:O(`actions.dispatch`)})]})]})]})},L=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,R=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(p,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{children:e.name}),e.required&&(0,E.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:O(`inputs.requiredLabel`)})]}),e.description&&(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),z(e,r,t,n)]})},z=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(y,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(i?`inputs.booleanYes`:`inputs.booleanNo`)})]})}if(e.type===`choice`){let i=e.options??[],a=typeof n==`string`?n:typeof e.default==`string`?e.default:``;return(0,E.jsxs)(`select`,{id:t,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 px-3 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,value:a,onChange:e=>{r(e.target.value)},children:[a===``&&(0,E.jsx)(`option`,{value:``,children:O(`inputs.selectPlaceholder`)}),i.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]})}return(0,E.jsx)(o,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},B=({job:e})=>e.steps.length===0?null:(0,E.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(t)),children:t.status===`completed`?A(t.conclusion)??O(`status.completed`):k(t.status)}),(0,E.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=N(e),n=P(e);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,j(e)),children:n})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,E.jsxs)(`a`,{href:e.html_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-sky-200 hover:text-sky-100`,children:[O(`actions.openOnGithub`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,E.jsxs)(`div`,{className:`mt-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(e)),children:e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status)}),(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,E.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??O(`runs.trackingState.${e.state}`);return(0,E.jsxs)(`div`,{className:_(`flex items-start gap-2 rounded-2xl border px-4 py-3`,t?`border-border/60 bg-background/20`:`border-red-400/25 bg-red-500/8`),children:[t&&(0,E.jsx)(s,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:_(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,E.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??O(`runs.unknownRef`)})]})]})},U=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||(e.updated_at??``)>=(t.updated_at??``))&&n.set(e.id,e)}return[...n.values()]},W=(e,t)=>{let n=new Map(e.map(e=>[e.execution_run_id,e]));for(let e of t){let t=n.get(e.execution_run_id),r=t&&![`queued`,`waiting`,`running`].includes(t.execution_status),i=[`queued`,`waiting`,`running`].includes(e.execution_status);(!r||!i)&&n.set(e.execution_run_id,e)}return[...n.values()]},oe=(e,t,n)=>{let r=t.filter(e=>e.run===null),i=new Set(r.map(e=>e.tracking_key));return W(e.filter(e=>i.has(e.tracking_key)||n.get(e.tracking_key)?.run===null),r.filter(e=>!n.has(e.tracking_key)))},se=e=>({ref:e??`main`}),G=({projectId:e,defaultBranch:i,onClose:o})=>{let[u,p]=(0,T.useState)([]),[_,v]=(0,T.useState)(!0),[y,S]=(0,T.useState)(null),[w,k]=(0,T.useState)([]),[A,j]=(0,T.useState)([]),[M,N]=(0,T.useState)({}),[P,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B]=(0,T.useState)(()=>se(i)),W=(0,T.useRef)({}),G=(0,T.useRef)({}),K=(0,T.useRef)(null),q=(0,T.useRef)(!1),J=(0,T.useRef)(0),Y=(0,T.useRef)(new Map),X=(0,T.useCallback)(async t=>{N(e=>{let n=e[t.id];return n?.isLoading?e:{...e,[t.id]:{inputs:n?.inputs??[],dispatchable:n?.dispatchable??!0,isLoading:!0,error:null}}});try{let n=await re(e,t.id,t.path);return N(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return N(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof x?e.message:O(`workflows.loadError`)}})),null}},[e]),Z=(0,T.useCallback)(async()=>{v(!0),S(null);try{let t=await te(e);p(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){S(e instanceof x?e.message:O(`workflows.loadError`))}finally{v(!1)}},[X,e]),Q=(0,T.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await ee(e,t);k(e=>U(e,r.runs)),j(e=>{let t=new Map([...Y.current.entries()].filter(([,e])=>e.revision>n).map(([e,t])=>[e,t.event]));return oe(e,r.tracked_runs??[],t)})}catch(e){b(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,T.useEffect)(()=>{Z()},[Z]),(0,T.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,ie),i=r(t);return()=>{e.abort(),window.clearInterval(n),i()}},[Q]);let ce=(0,T.useCallback)(async e=>{if(P?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=M[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:F(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:F(n.inputs)})},[B.ref,M,X,P]),le=(0,T.useCallback)(async()=>{if(!P)return;let t=M[P.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=P.values[e.name];e.type===`boolean`?n[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?n[e.name]=t:typeof e.default==`string`&&e.default!==``&&(n[e.name]=e.default)}try{await ne(e,P.workflow.id,{ref:P.ref,workflowName:P.workflow.name,workflowUrl:P.workflow.url,inputs:n}),l.success(O(`messages.dispatched`)),L(null),Q()}catch(e){l.error(e instanceof x?e.message:O(`messages.dispatchError`))}finally{z(!1)}},[M,Q,e,P]);(0,T.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),j(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&k(e=>U(e,[t.run])))};return d.on(`github-actions:updated`,t),()=>{d.off(`github-actions:updated`,t)}},[e]),(0,T.useEffect)(()=>{let e=P?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[P?.workflow.id]);let $=(0,T.useMemo)(()=>[...w].sort((e,t)=>{let n=e.updated_at?Date.parse(e.updated_at):0;return(t.updated_at?Date.parse(t.updated_at):0)-n}),[w]);return(0,E.jsx)(f,{open:!0,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(a,{showCloseButton:!1,overlayClassName:`bg-black/70`,className:`flex h-[calc(100vh-2rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl border border-[#2a2a38] bg-[#16161f] p-0 shadow-2xl sm:max-w-5xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,E.jsx)(g,{className:`sr-only`,children:O(`dialog.srTitle`)}),(0,E.jsx)(c,{className:`sr-only`,children:O(`dialog.srDescription`)}),(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-violet-200`,children:(0,E.jsx)(n,{className:`h-5 w-5`})}),(0,E.jsx)(`div`,{children:(0,E.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:O(`dialog.title`)})})]}),(0,E.jsx)(m,{asChild:!0,children:(0,E.jsx)(h,{type:`button`,"aria-label":O(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(t,{className:`h-4 w-4`})})})]}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,E.jsxs)(`aside`,{"aria-label":O(`workflows.ariaLabel`),className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`workflows.title`)}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:O(`actions.refresh`)})]}),_&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`workflows.loading`)})]}),y&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:y}),!_&&u.length===0&&!y&&(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:[(0,E.jsx)(`p`,{children:O(`workflows.empty`)}),(0,E.jsx)(`p`,{className:`mt-1`,children:O(`workflows.emptyHint`)}),(0,E.jsxs)(`a`,{href:D,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[O(`workflows.docsLink`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]}),(0,E.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=P?.workflow.id===e.id;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,E.jsx)(ae,{workflow:e,inputsState:M[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&P&&(0,E.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,E.jsx)(I,{workflow:e,inputsState:M[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:P.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:P.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`runs.title`)}),A.map(e=>(0,E.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,E.jsx)(V,{run:e},e.id)),$.length===0&&A.length===0&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:O(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,G as n,H as r,I as i,J as a,K as ee,U as te,V as ne,X as o,Y as re,bt as ie,gt as s,ht as c,l as ae,mt as l,pt as u,q as oe,r as se,vt as d,yt as ce}from"./index-C-VHd0Pr.js";var f=e(ie(),1),p=e=>({target_kind:e.kind,...e.kind===`bundle`?{bundle_id:e.bundle_id}:{}}),m=(e,t)=>{let n=new URL(c(e));return n.searchParams.set(`target_kind`,t.kind),t.kind===`bundle`&&t.bundle_id&&n.searchParams.set(`bundle_id`,t.bundle_id),n},le=(e,t,n={})=>d(m(`/projects/${encodeURIComponent(e)}/repository-graph/status`,t).toString(),{signal:n.signal}),ue=(e,t,n={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans`),{method:`POST`,body:p(t),signal:n.signal}),de=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/cancel`),{method:`POST`,body:p(t),signal:r.signal}),fe=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/retry`),{method:`POST`,body:p(t),signal:r.signal}),pe=(e,t,n,r,i)=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/path-impact`,t);return a.searchParams.set(`scan_id`,n),a.searchParams.set(`path`,r),a.searchParams.set(`direction`,i.direction),a.searchParams.set(`depth`,`1`),a.searchParams.set(`limit`,String(i.limit??50)),d(a.toString(),{signal:i.signal})},me=(e,t,n,r,i={})=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/edges/${encodeURIComponent(r)}/explanation`,t);return a.searchParams.set(`scan_id`,n),d(a.toString(),{signal:i.signal})},h=u(),g=new Set([`pending`,`running`]),he=new Set([`failed`,`cancelled`,`interrupted`]),ge=e=>!(e instanceof l)||typeof e.data!=`object`||e.data===null||!(`reason`in e.data)?null:typeof e.data.reason==`string`?e.data.reason:null,_e=e=>e===`deterministic`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-500/30 bg-amber-500/10 text-amber-200`:`border-violet-500/30 bg-violet-500/10 text-violet-200`,ve=2e3,ye=600,_=12,be=e=>({kind:e.kind,bundle_id:e.kind===`bundle`?e.bundle_id:null,ticket_id:null}),xe=(e,n)=>{let r=n.trim();return!e||!r?[]:e.entries.filter(e=>e.status!==`deleted`).map(e=>({entry:e,score:t(r,[e.path])})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||e.entry.path.localeCompare(t.entry.path)).slice(0,_).map(e=>e.entry)},v=({projectId:e,target:t,targetLabel:ie,canRunOperations:c=!0,onClose:l})=>{let{t:u}=ce(`common`,{keyPrefix:`repositoryGraphDialog`}),d=ae(),[p,m]=(0,f.useState)(null),[_,v]=(0,f.useState)(!1),[Se,y]=(0,f.useState)(!0),[b,x]=(0,f.useState)(null),[S,Ce]=(0,f.useState)(!1),[C,we]=(0,f.useState)(``),[Te,w]=(0,f.useState)(null),[T,Ee]=(0,f.useState)(`combined`),[E,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[je,M]=(0,f.useState)(0),[N,P]=(0,f.useState)({}),F=(0,f.useRef)(null),I=(0,f.useRef)(0),L=(0,f.useRef)(null),R=(0,f.useRef)(null),z=(0,f.useRef)(0),B=(0,f.useRef)(null),V=(0,f.useRef)(0),H=(0,f.useRef)(new Map),U=(0,f.useCallback)(e=>{m(t=>t&&t.scan.scan_sequence>e.scan.scan_sequence?t:e),v(!1)},[]),W=(0,f.useCallback)(async()=>{let n=I.current+1;I.current=n,F.current?.abort();let r=new AbortController;F.current=r,y(!0),x(null);try{let i=await le(e,t,{signal:r.signal});I.current===n&&!r.signal.aborted&&U(i)}catch(e){if(s(e)||r.signal.aborted||I.current!==n)return;ge(e)===`scan_not_found`?(m(null),v(!0)):(v(!1),x(u(`errors.status`)))}finally{I.current===n&&!r.signal.aborted&&y(!1)}},[U,e,u,t]);(0,f.useEffect)(()=>{W()},[W]);let G=p?.scan??null;(0,f.useEffect)(()=>{if(!G||!g.has(G.status))return;let e=window.setInterval(()=>void W(),ve);return()=>window.clearInterval(e)},[W,G]),(0,f.useEffect)(()=>{let n=n=>n.project_id===e&&n.target_kind===t.kind&&(t.kind!==`bundle`||n.target_bundle_id===t.bundle_id),r=e=>{n(e)&&W()},i=()=>{W()};return d.on(`repository-graph-scan:updated`,r),d.on(`connect`,i),()=>{d.off(`repository-graph-scan:updated`,r),d.off(`connect`,i)}},[W,e,d,t.bundle_id,t.kind]),(0,f.useEffect)(()=>()=>{F.current?.abort(),L.current?.abort(),R.current?.abort(),B.current?.abort(),H.current.forEach(e=>e.abort()),H.current.clear()},[]);let K=async e=>{L.current?.abort(),F.current?.abort();let t=I.current+1;I.current=t;let n=new AbortController;L.current=n,Ce(!0),x(null);try{let r=await e(n.signal);!n.signal.aborted&&I.current===t&&(U(r),y(!1))}catch(e){!s(e)&&!n.signal.aborted&&x(u(`errors.operation`))}finally{n.signal.aborted||Ce(!1)}},q=G?.id??null,J=G?.status===`completed`,Y=C.trim(),X=(0,f.useDeferredValue)(C),Z=(0,f.useMemo)(()=>xe(O,X),[X,O]),Me=O?.entries.find(e=>e.status!==`deleted`&&e.path===Y)?.path??null,Ne=Y.includes(`/`)||/(^|\/)[^/]+\.[^/]+$/.test(Y),Q=Te??Me??(Ne?Y:``),$=Z.length===0?0:Math.min(je,Z.length-1);(0,f.useEffect)(()=>{B.current?.abort();let n=V.current+1;if(V.current=n,k(null),j(!1),!q||!J)return;let r=new AbortController;return B.current=r,j(!0),se(e,be(t),r.signal).then(e=>{!r.signal.aborted&&V.current===n&&k(e)}).catch(e=>{s(e)||r.signal.aborted||V.current!==n||k(null)}).finally(()=>{!r.signal.aborted&&V.current===n&&j(!1)}),()=>r.abort()},[J,e,q,t,t.bundle_id,t.kind]),(0,f.useEffect)(()=>{R.current?.abort();let n=z.current+1;if(z.current=n,H.current.forEach(e=>e.abort()),H.current.clear(),De(null),ke(null),P({}),!q||!J||!Q){D(!1);return}let r=new AbortController;R.current=r,D(!0);let i=window.setTimeout(()=>{pe(e,t,q,Q,{direction:T,limit:50,signal:r.signal}).then(e=>{!r.signal.aborted&&z.current===n&&De(e)}).catch(e=>{s(e)||r.signal.aborted||z.current!==n||ke(ge(e)===`path_not_found`?u(`errors.pathNotFound`):u(`errors.impact`))}).finally(()=>{!r.signal.aborted&&z.current===n&&D(!1)})},ye);return()=>{window.clearTimeout(i),r.abort()}},[J,T,Q,e,q,u,t]);let Pe=e=>{we(e),w(e),M(0)},Fe=e=>{if(e.key===`ArrowDown`&&Z.length>0){e.preventDefault(),M(e=>Math.min(e+1,Z.length-1));return}if(e.key===`ArrowUp`&&Z.length>0){e.preventDefault(),M(e=>Math.max(e-1,0));return}if(e.key===`Enter`){let t=Z[$];if(t){e.preventDefault(),Pe(t.path);return}Y&&(Ne||!O)&&(e.preventDefault(),w(Y))}},Ie=(n,r)=>{if(!r.currentTarget.open||N[n]?.state===`loading`||N[n]?.state===`loaded`||!q)return;let i=new AbortController,a=z.current;H.current.set(n,i),P(e=>({...e,[n]:{state:`loading`}})),me(e,t,q,n,{signal:i.signal}).then(e=>{!i.signal.aborted&&z.current===a&&P(t=>({...t,[n]:{state:`loaded`,response:e}}))}).catch(e=>{!s(e)&&!i.signal.aborted&&z.current===a&&P(e=>({...e,[n]:{state:`error`}}))}).finally(()=>{H.current.get(n)===i&&H.current.delete(n)})},Le=G?G.status===`pending`?`queued`:G.status===`completed`&&p?.freshness.state===`stale`?`stale`:G.status===`completed`&&p?.freshness.state===`unavailable`?`completeUnverified`:G.status===`completed`&&p?.freshness.is_current||G.status===`completed`?`complete`:G.status:_?`neverScanned`:`unknown`,Re=u(G?`refreshScan`:`startScan`),ze=!!G||_,Be=E?.paths.filter(e=>e.depth>0)??[];return(0,h.jsx)(te,{open:!0,onOpenChange:e=>{e||l()},children:(0,h.jsxs)(n,{showCloseButton:!1,overlayClassName:`z-[80]`,className:`z-[80] h-[calc(100vh-2rem)] max-h-[720px] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-4xl`,children:[(0,h.jsx)(a,{className:`border-b border-border/70 px-5 py-4 pr-6 sm:px-6`,children:(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(re,{children:u(`title`)}),(0,h.jsx)(ee,{className:`mt-1 break-words`,children:u(`target`,{target:ie})})]}),(0,h.jsxs)(o,{type:`button`,disabled:!c||!ze||Se||S||!!b||!!(G&&g.has(G.status)),onClick:()=>{K(n=>ue(e,t,{signal:n}))},children:[S&&(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),Re]})]})}),(0,h.jsxs)(`div`,{"data-testid":`repository-graph-scroll-region`,className:`min-h-0 space-y-6 overflow-y-auto px-5 py-5 sm:px-6`,children:[(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-status-title`,className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{id:`repository-graph-status-title`,className:`font-heading text-sm font-semibold`,children:u(`status.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,"aria-live":`polite`,children:u(Se?`status.loading`:`status.${Le}`)})]}),G&&g.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>de(e,t,G.id,{signal:n}))},children:u(`cancelScan`)}),G&&G.execution_run_id&&he.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>fe(e,t,G.id,{signal:n}))},children:u(`retryScan`)})]}),b&&(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-sm text-destructive`,role:`alert`,children:[(0,h.jsx)(`span`,{children:b}),(0,h.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void W(),children:u(`retryLoad`)})]}),G&&(0,h.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.files`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.admitted_file_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.relationships`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.edge_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.diagnostics`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.diagnostic_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.analyzer`)}),(0,h.jsxs)(`dd`,{className:`mt-1 font-mono text-sm`,children:[`v`,p?.analyzer_version]})]})]}),p?.truncation.scan&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`truncatedScan`)}),p?.freshness.state===`unavailable`&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`freshnessUnavailable`)}),p&&p.diagnostic_summary.total_count>0&&(0,h.jsxs)(`details`,{className:`mt-4 rounded-lg border border-border/60 p-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:u(`diagnostics.show`,{count:p.diagnostic_summary.total_count})}),(0,h.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.diagnostic_summary.diagnostics.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-xs leading-5 text-muted-foreground`,children:[(0,h.jsx)(`span`,{className:`font-medium text-foreground`,children:e.code}),e.path&&(0,h.jsxs)(`span`,{children:[` · `,e.path]}),(0,h.jsx)(`p`,{className:`break-words`,children:e.message})]},`${e.code}-${e.path??``}-${t}`))}),p.diagnostic_summary.truncated&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`diagnostics.truncated`)})]})]}),(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-relationship-title`,children:[(0,h.jsx)(`h3`,{id:`repository-graph-relationship-title`,className:`font-heading text-sm font-semibold`,children:u(`relationships.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u(`relationships.description`)}),(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(ne,{htmlFor:`repository-graph-path`,children:u(`relationships.pathLabel`)}),(0,h.jsxs)(`div`,{className:`relative mt-2`,children:[(0,h.jsx)(r,{id:`repository-graph-path`,type:`search`,value:C,disabled:!J,onChange:e=>{we(e.target.value),w(null),M(0)},onKeyDown:Fe,placeholder:u(`relationships.pathPlaceholder`),"aria-autocomplete":`list`,"aria-controls":`repository-graph-path-suggestions`,"aria-activedescendant":Z.length>0?`repository-graph-path-suggestion-${$}`:void 0}),J&&X.trim()&&Te!==Y&&(A||O)&&(0,h.jsxs)(`div`,{id:`repository-graph-path-suggestions`,role:`listbox`,className:`absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-lg`,children:[A&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.suggestionsLoading`)}),!A&&O&&Z.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.noSuggestions`)}),Z.map((e,t)=>(0,h.jsx)(`button`,{id:`repository-graph-path-suggestion-${t}`,type:`button`,role:`option`,"aria-selected":t===$,className:`block w-full rounded-md px-3 py-2 text-left font-mono text-xs ${t===$?`bg-accent text-accent-foreground`:`text-foreground hover:bg-muted`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>Pe(e.path),children:e.path},e.path))]})]})]}),(0,h.jsxs)(`fieldset`,{className:`mt-4`,disabled:!J,children:[(0,h.jsx)(`legend`,{className:`text-sm font-medium`,children:u(`relationships.direction`)}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-4`,children:[`combined`,`incoming`,`outgoing`].map(e=>(0,h.jsxs)(ne,{className:`flex items-center gap-2 text-sm`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`repository-graph-direction`,checked:T===e,onChange:()=>Ee(e)}),u(`relationships.directions.${e}`)]},e))})]}),!J&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.unavailable`)}),Ae&&(0,h.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),u(`relationships.loading`)]}),Oe&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-destructive`,role:`alert`,children:Oe}),E?.truncation.query&&(0,h.jsx)(`p`,{className:`mt-4 text-xs text-amber-200`,children:u(`relationships.truncated`)}),E&&Be.length===0&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.empty`)}),Be.length>0&&(0,h.jsx)(`ul`,{className:`mt-4 space-y-3`,children:Be.map(e=>{let t=e.edge_ids[e.edge_ids.length-1],n=t?N[t]:void 0,r=n?.state===`loaded`?n.response.edge:null,i=r?.evidence_class??e.evidence_classes[e.evidence_classes.length-1]??`deterministic`;return(0,h.jsxs)(`li`,{className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsx)(`p`,{className:`break-words text-sm font-medium`,children:r?u(`relationships.kinds.${r.kind}`,{path:e.path}):e.path}),(0,h.jsx)(`span`,{className:`mt-2 inline-flex rounded-full border px-2 py-1 text-xs font-medium ${_e(i)}`,children:u(`evidence.${i}.label`)}),t&&(0,h.jsxs)(`details`,{className:`mt-3`,onToggle:e=>Ie(t,e),children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground`,children:u(`relationships.showEvidence`)}),(0,h.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:[n?.state===`loading`&&(0,h.jsx)(`p`,{children:u(`relationships.loadingEvidence`)}),n?.state===`error`&&(0,h.jsx)(`p`,{className:`text-destructive`,children:u(`errors.explanation`)}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:u(`evidence.${r.evidence_class}.description`)}),(0,h.jsx)(`p`,{className:`mt-1`,children:u(`relationships.explanations.${r.kind}`)}),r.detail?.type===`relationship_value`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.value`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.value})]}),r.detail?.type===`co_changes`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2 gap-y-1`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.changeCount`)}),(0,h.jsx)(`dd`,{children:r.detail.change_count.toLocaleString()}),r.detail.sampled_commit_ids.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.sampledCommits`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.sampled_commit_ids.join(`, `)})]}),r.detail.samples_truncated&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`sr-only`,children:u(`relationships.evidenceDetail.coverage`)}),(0,h.jsx)(`dd`,{className:`col-span-2 text-amber-200`,children:u(`relationships.evidenceDetail.samplesTruncated`)})]})]})]})]})]})]},`${e.node.id}-${t??``}`)})})]})]}),(0,h.jsx)(oe,{className:`border-t border-border/70 px-5 py-4 sm:px-6`,children:(0,h.jsx)(o,{type:`button`,variant:`outline`,onClick:l,children:u(`close`)})})]})})};export{v as RepositoryGraphDialog};
@@ -0,0 +1,4 @@
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,X as y,Y as ee,Z as b,_ as te,_t as x,a as S,at as C,b as w,bt as T,c as ne,ct as re,et as ie,f as ae,g as E,gt as oe,h as D,ht as O,it as k,j as se,k as ce,l as le,m as ue,mt as de,n as fe,nt as pe,o as me,ot as he,p as A,pt as ge,q as _e,rt as ve,s as ye,st as be,t as j,tt as xe,v as M,vt as N,x as P,y as F,yt as I,z as Se}from"./index-C-VHd0Pr.js";var L=e(T(),1),R=ge(),Ce=({title:e,children:t,defaultOpen:n=!1})=>(0,R.jsxs)(M,{defaultOpen:n,className:`mt-5 rounded-2xl border border-border/70 bg-background/25`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"aria-label":e,className:`group flex w-full items-center gap-2 rounded-2xl px-4 py-3 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e}),(0,R.jsx)(Se,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,R.jsx)(F,{className:`border-t border-border/60 px-4 py-3`,children:t})]}),z=e=>{if(!e.file_path)return null;if(!e.start_line)return e.file_path;let t=`${e.start_line}${e.start_column?`:${e.start_column}`:``}`,n=e.end_line?`-${e.end_line}${e.end_column?`:${e.end_column}`:``}`:``;return`${e.file_path}:${t}${n}`},B=[`error`,`warning`,`info`,`unknown`],V=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},H=({counts:e,totalCount:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=B.filter(t=>e[t]>0);return(0,R.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,R.jsx)(`span`,{className:`rounded-full border border-border/70 bg-background/45 px-2 py-1 text-[11px] text-muted-foreground`,children:n(`severityCount`,{count:e[t],severity:n(`severity.${t}`)})},t)),t>0&&t!==r.reduce((t,n)=>t+e[n],0)&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},we=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:i,onSelectedTicketChange:a})=>{let{t:o}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),s=e.currency??`unavailable`;return(0,R.jsxs)(M,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"aria-label":o(`technicalDetails`),className:`group flex w-full items-center gap-2 rounded-xl px-3 py-2.5 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:o(`technicalDetails`)}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:o(`technicalDetailsHint`)}),(0,R.jsx)(Se,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,R.jsxs)(F,{className:`border-t border-border/60 px-3 py-3`,children:[(0,R.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`parser.${t.parser_kind}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserStateLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`state.${t.status}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserRetentionLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${t.retention_state}`)})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`outputRetentionLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${e.output_retention_state}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`applicabilityLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`applicability`,{state:o(`applicabilityState.${s}`)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`sourceLabel`)}),(0,R.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`destinationTitle`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`destination.${n.destination}`)}),(0,R.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:o(`destinationHint`)})]})]}),r&&n&&(0,R.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[o(`ticketLabel`),(0,R.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:`mt-1 h-10 w-full rounded-xl border border-border bg-card px-3 text-sm text-foreground`,children:[(0,R.jsx)(`option`,{value:``,children:o(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},U=({attempt:e,diagnostics:t,repair:n,selectedDiagnosticIds:r,selectedRawOutputAttemptRunIds:i,selectedAttemptRunIds:a,selectedTicketId:o,pending:s,activeRepair:c,autoFix:l,onSelectedTicketChange:u,onToggleDiagnostic:d,onToggleRawOutput:f,onStartRepair:p,onStopRepair:m})=>{let{t:h}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),{t:g}=I(`common`,{keyPrefix:`checksDialog`});if(e.execution_status!==`failed`)return null;let _=t?.parser??null,v=t?.diagnostics??[],ee=V(v),b=!!(l&&!l.terminal_reason),te=l?.attempts[l.attempts.length-1]??null,x=c?.terminal_result===null||b,S=!!(n?.eligibility.eligible&&n.eligible_attempt_run_ids.includes(e.execution_run_id)&&_?.status===`complete`&&_.retention_state===`retained`),C=!!(n?.eligibility.eligible&&n.eligible_raw_output_attempt_run_ids.includes(e.execution_run_id)&&e.output_retention_state===`retained`&&e.retained_output),w=i.has(e.execution_run_id),T=r.size,ne=T>=32,re=a.size>=8&&!a.has(e.execution_run_id),ie=ne?h(`diagnosticLimit`,{count:32}):re?h(`attemptLimit`,{count:8}):null,ae=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),E=T+i.size,oe=E>0&&(!ae||o!==``),D=n&&!n.eligibility.eligible?h(`disabled.${n.eligibility.reason}`):null,O=_&&t&&(_.status===`interrupted`||v.length===0&&[`unsupported`,`malformed`].includes(_.status))?_.status:null,k=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count===0),se=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count>0),ce=_?.diagnostic_count??v.length;return(0,R.jsxs)(`section`,{"aria-labelledby":`diagnostics-${e.execution_run_id}`,className:`mt-5 rounded-2xl border border-border/70 bg-background/25 p-4`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:h(`title`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:_&&_.status===`pending`?h(`loading`):_&&ce>0?se||_.retention_state===`expired`?h(`totalAvailable`,{count:ce}):h(`availableCount`,{count:ce}):h(t?`noneAvailable`:`loading`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:h(`failureOutcome`,{outcome:e.outcome?g(`outcomeValue.${e.outcome}`):g(`status.${e.execution_status}`)})}),t&&v.length>0&&(0,R.jsx)(H,{counts:ee,totalCount:ce})]})}),_?.retention_state===`expired`&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`expired`)}),_?.truncated&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`truncated`)}),O&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`fallback.${O}`)}),k&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`noStructuredDiagnostics`)}),se&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`structuredDetailsUnavailable`)}),C&&(0,R.jsxs)(`label`,{className:`mt-4 flex items-start gap-3 rounded-xl border border-amber-400/25 bg-amber-500/5 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":h(`rawOutputSelect`),checked:w,disabled:x||!w&&re,onChange:e=>f(e.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:h(`rawOutputSelect`)}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(`rawOutputHint`)}),e.retained_start_offset>0&&(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:h(`rawOutputTruncated`)})]})]}),t&&v.length>0&&(0,R.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,R.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:h(`selectLegend`)}),(0,R.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>{let t=z(e),n=r.has(e.id);return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!S||x||!n&&ie!==null,onChange:t=>d(e.id,t.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:h(`severity.${e.severity}`)}),e.code&&(0,R.jsx)(`code`,{children:e.code})]}),(0,R.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,R.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),D&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),ie&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:ie}),c&&(0,R.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,R.jsx)(`p`,{className:`font-medium text-sky-100`,children:h(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),l&&(0,R.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,role:`status`,children:[(0,R.jsx)(`p`,{className:`font-medium text-sky-100`,children:l.terminal_reason?h(`autoFix.terminal.${l.terminal_reason}`):te?.fallback_used?h(`autoFix.phase.fallback`,{owner:h(`autoFix.owner.${l.owner_type}`),current:l.attempt_count,total:l.max_attempts}):h(`autoFix.phase.${l.phase}`,{owner:h(`autoFix.owner.${l.owner_type}`),current:l.attempt_count,total:l.max_attempts})}),!l.terminal_reason&&l.attempt_count>0&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:h(`autoFix.attempt`,{current:l.attempt_count,total:l.max_attempts})})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h(`selectedEvidence`,{count:E})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(y,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!oe||s||x,title:D??void 0,onClick:p,children:s?h(`starting`):h(`repairSelectedEvidence`,{count:E})}),x&&(0,R.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:s||l?.phase===`stopping`,onClick:m,children:h(b?`autoFix.stop`:`stopRepair`)})]})]}),(0,R.jsx)(we,{attempt:e,parser:_,repair:n,ticketRequired:ae,selectedTicketId:o,onSelectedTicketChange:u})]})},W=({attempt:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?S(e.retained_output):``;return(0,R.jsxs)(Ce,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,R.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputExpired`)}),e.output_retention_state===`retained`&&!n&&(0,R.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputEmpty`)}),e.output_retention_state===`retained`&&n&&(0,R.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-xl border border-border bg-[#090b12] p-4 font-mono text-xs text-slate-200`,children:n}),e.retained_start_offset>0&&(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},G=({definition:e,policy:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog`});return(0,R.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,R.jsx)(`p`,{className:`mt-4 rounded-xl border border-dashed border-border px-3 py-2 text-sm text-muted-foreground`,children:n(`notRunDescription`)}),(0,R.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,R.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,R.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},Te=({attempt:e,definition:t,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h,policy:g})=>{let{t:_}=I(`common`,{keyPrefix:`checksDialog`}),{t:v}=I(`common`,{keyPrefix:`activityView`});return e?(0,R.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`status.${e.execution_status}`)})]}),e.outcome&&(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:_(`outcomeValue.${e.outcome}`)})]}),(0,R.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`command`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`directory`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??_(`targetRoot`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`outcome`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?_(`outcomeValue.${e.outcome}`):_(`status.${e.execution_status}`)})]}),e.currency&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`currencyLabel`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:v(`currency.${e.currency}`)})]}),g&&(0,R.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`policyLabel`)}),(0,R.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[_(g.required?`required`:`optional`),` · `,_(g.preReview?`preReview`:`finalOnly`)]})]})]}),e.execution_status===`failed`&&(0,R.jsx)(U,{attempt:e,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h}),(0,R.jsx)(W,{attempt:e},e.execution_run_id)]}):t?(0,R.jsx)(G,{definition:t,policy:g}):(0,R.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,R.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:_(`selectAttemptTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`selectAttemptDescription`)})]})},K={current:`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`,stale:`border-amber-400/30 bg-amber-500/10 text-amber-200`,failed:`border-red-400/30 bg-red-500/10 text-red-200`,missing:`border-border bg-muted/40 text-muted-foreground`,interrupted:`border-orange-400/30 bg-orange-500/10 text-orange-200`,blocked:`border-amber-400/30 bg-amber-500/10 text-amber-200`},Ee=(e,t)=>e.presentApplicability.appliesToCurrentState===!1?`stale`:t?t.execution_status===`interrupted`||t.execution_status===`cancelled`?`interrupted`:t.execution_status===`failed`?`failed`:t.currency===`stale`?`stale`:t.outcome&&t.outcome!==`passed`?`failed`:t.outcome===`passed`&&t.currency===`current`?`current`:e.decision===`blocked`?`blocked`:`current`:`missing`,De=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,Oe=({evaluation:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.presentApplicability.appliesToCurrentState===!1?`gateStale`:e.presentApplicability.appliesToCurrentState===null?`gateUnverifiable`:e.decision===`passed`?`gatePassed`:`gateBlocked`,r=e.reasonCodes[0],i=r?t(`gateReasonSummary`,{reason:t(`reason.${r}`)}):e.decision===`passed`?t(`gatePassedSummary`):t(`gateBlockedSummary`);return(0,R.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?K.current:K.blocked),children:t(n)})]}),(0,R.jsx)(Ce,{title:t(`gateDetails`),children:(0,R.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:t(`gateScope`)}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,R.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,R.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,R.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,R.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,R.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(De(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,R.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,R.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,R.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Ee(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,R.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-1 text-xs`,K[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,R.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},ke=e=>e.execution_status===`completed`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.execution_status===`failed`||e.execution_status===`interrupted`?`border-red-400/30 bg-red-500/10 text-red-200`:e.execution_status===`running`||e.execution_status===`queued`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border bg-muted/40 text-muted-foreground`,Ae=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,je=(e,t,n,r)=>((t?.attempts.find(t=>t.attempt_run_id===e.execution_run_id))?.diagnostics.filter(e=>n.has(e.id)).length??0)+ +!!r.has(e.execution_run_id),Me=({definitions:e,attempts:t,requiredDefinitionIds:n,preReviewDefinitionIds:r,selectedDefinitionIds:i,selectedCheckId:a,diagnostics:o,selectedDiagnosticIds:s,selectedRawOutputAttemptRunIds:c,onToggleDefinition:l,onSelectCheck:u})=>{let{t:d}=I(`common`,{keyPrefix:`checksDialog`}),f=new Set(n),p=new Set(r),m=new Set(e.map(e=>e.id)),h=[...e.map(e=>({definition:e,attempt:t.find(t=>t.definition_id===e.id),historical:!1})),...t.filter(e=>!m.has(e.definition_id)).map(e=>({definition:e.command_snapshot,attempt:e,historical:!0}))];return(0,R.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,R.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,R.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,R.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5 md:max-h-none md:py-5 max-md:max-h-[min(35vh,18rem)]`,children:(0,R.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:h.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?je(t,o,s,c):0,h=f.has(e.id),g=p.has(e.id),_=`${d(`category.${e.category}`)} · ${d(h?`required`:`optional`)} · ${d(g?`preReview`:`finalOnly`)}`;return(0,R.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 shrink-0 accent-primary`,checked:i.has(e.id),"aria-label":d(`selectForRun`,{name:e.name}),onChange:t=>l(e.id,t.target.checked)}),t?(0,R.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(Ae(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,ke(t)),children:d(Ae(t))})]}),(0,R.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_}),m>0&&(0,R.jsx)(`span`,{"data-evidence-selected":`true`,className:`mt-1.5 inline-flex rounded-full border border-amber-400/30 bg-amber-500/10 px-2 py-0.5 text-[11px] text-amber-200`,children:d(`evidenceSelected`,{count:m})})]}):(0,R.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(`status.notRun`)}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,R.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,R.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_})]})]})},t?.execution_run_id??e.id)})})})]})},Ne=(e,t)=>{let n=new Set(t?.attempts.filter(e=>e.parser.status===`complete`&&e.parser.retention_state===`retained`&&e.diagnostics.length>0).map(e=>e.attempt_run_id)??[]);return e.find(e=>e.execution_status===`failed`&&n.has(e.execution_run_id))??e.find(e=>e.execution_status===`failed`)??e.find(e=>e.execution_status===`running`)??e[0]??null},Pe=new Set([`queued`,`running`,`waiting`]),Fe=75,Ie=32,Le=64,Re=3,ze=32,Be=8,q=(e,t)=>e instanceof de?e.message:t,Ve=e=>{let t=new Set(e.repair.eligibility.eligible?e.repair.eligible_attempt_run_ids:[]);return new Set(e.attempts.filter(e=>t.has(e.attempt_run_id)).flatMap(e=>e.diagnostics.map(e=>e.id)))},He=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),Ue=({projectId:e,targetKind:n,targetBundleId:r,definitions:i,requiredDefinitionIds:a=[],preReviewDefinitionIds:o=[],gateEvaluationId:s=null,directBatchRunId:c=null,directAttemptRunId:l=null,onSelectionChange:u,onUnavailable:d,onStatusChange:f})=>{let{t:p}=I(`common`,{keyPrefix:`checksDialog`}),m=le(),[h,g]=(0,L.useState)(()=>new Set(i.map(e=>e.id))),[_,v]=(0,L.useState)(null),[ee,b]=(0,L.useState)(null),[te,x]=(0,L.useState)(null),[S,w]=(0,L.useState)(null),[T,ae]=(0,L.useState)(!0),[E,D]=(0,L.useState)(null),[O,se]=(0,L.useState)(null),[ce,ue]=(0,L.useState)(new Set),[fe,A]=(0,L.useState)(new Set),[ge,_e]=(0,L.useState)(``),[j,M]=(0,L.useState)(null),[N,P]=(0,L.useState)(!1),[F,Se]=(0,L.useState)(0),[Ce,z]=(0,L.useState)(null),B=(0,L.useRef)(_),V=(0,L.useRef)(null),H=(0,L.useRef)(new Set),we=(0,L.useRef)(new Map),U=(0,L.useRef)(0),W=(0,L.useRef)(0),G=(0,L.useRef)(null),K=(0,L.useRef)(!1),Ee=(0,L.useRef)(!0),De=(0,L.useRef)(null),ke=(0,L.useRef)(`automatic`),Ae=(0,L.useRef)(null),je=(0,L.useRef)(async()=>void 0),Ue=(0,L.useRef)(async()=>void 0),We=(0,L.useRef)(()=>void 0),Ge=(0,L.useRef)(0),Ke=(0,L.useRef)(O);B.current=_,Ke.current=O,Ee.current=T||E!==null;let J=(0,L.useCallback)((e,t)=>{De.current=e,ke.current=t,x(e)},[]),qe=(0,L.useCallback)(e=>{se(e),M(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),ue(t=>{let n=Ve(e);return new Set([...t].filter(e=>n.has(e)))}),A(t=>{let n=He(e);return new Set([...t].filter(e=>n.has(e)))}),_e(t=>e.repair.candidate_tickets.some(e=>e.id===t)?t:e.repair.candidate_tickets.length===1&&e.repair.accepts_ticket_id?e.repair.candidate_tickets[0].id:``);let t=B.current;ke.current===`automatic`&&t?.batch.execution_run_id===e.batch_run_id&&J(Ne(t.attempts,e)?.execution_run_id??null,`automatic`)},[J]),Je=(0,L.useCallback)(e=>{let t=we.current;if(!t.has(e.attempt_run_id)&&t.size>=Ie){let e=t.keys().next().value;e&&(t.delete(e),H.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(Le-1)),e])},[]),Ye=(0,L.useCallback)((e,t,n=`route`)=>{let r=B.current?.batch.execution_run_id===e.batch.execution_run_id?B.current:null,i=!1,a=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of we.current.keys())a.has(e)||(we.current.delete(e),H.current.delete(e));let o=e.attempts.map(e=>{let t=!1,n=r?.attempts.find(t=>t.execution_run_id===e.execution_run_id),a=n&&n.output_revision>e.output_revision?n:e,o=we.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=ye(me(a),e);if(n.status===`refetch`){t=!0,i=!0;continue}n.status===`applied`&&(a={...a,output_revision:n.snapshot.revision,retained_start_offset:n.snapshot.retainedStartOffset,retained_end_offset:n.snapshot.totalByteCount,total_persisted_bytes:n.snapshot.totalByteCount,retained_output:n.snapshot.retainedText})}return t?H.current.add(e.execution_run_id):(H.current.delete(e.execution_run_id),we.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};G.current=e.batch.execution_run_id,B.current=s,v(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,l=De.current,f=ke.current,m=!!(l&&s.attempts.some(e=>e.execution_run_id===l)),h=Ne(s.attempts,Ke.current?.batch_run_id===s.batch.execution_run_id?Ke.current:null),g=Ae.current,_=!!(g&&g.batchRunId===s.batch.execution_run_id&&g.attemptRunId===t),y=!!(g&&g.previousBatchRunId===s.batch.execution_run_id&&g.previousAttemptRunId===t);if(n===`reset`)J(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(_)J(c.execution_run_id,`manual`);else if(y&&f===`manual`)J(m?l:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=f!==`external`||l!==c.execution_run_id;J(c.execution_run_id,`external`),e&&u?.(s.batch.execution_run_id,c.execution_run_id)}else _||y?f===`manual`&&m?J(l,`manual`):J(h?.execution_run_id??null,`automatic`):(J(t,`external`),d?.());else n===`preserve`?f===`external`&&l?m?J(l,`external`):(J(l,`external`),d?.()):f===`manual`&&m?J(l,`manual`):J(f===`automatic`&&m?l:h?.execution_run_id??null,`automatic`):f===`manual`&&m?J(l,`manual`):J(h?.execution_run_id??null,`automatic`);i?We.current(e.batch.execution_run_id):Ge.current=0,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ue.current().catch(e=>z(q(e,p(`errors.load`))))},Fe))},[u,d,p,J]),Y=(0,L.useCallback)(async(n,r)=>{let i=++U.current,a=await t(e,n,r);if(i!==U.current||a.batch.execution_run_id!==n||G.current!==null&&G.current!==n){a.batch.execution_run_id!==n&&d?.();return}Ye(a,n===c?l:null)},[l,c,Ye,d,e]);je.current=Y,We.current=(0,L.useCallback)(e=>{if(V.current)return;if(Ge.current>=Re){Ge.current=0,H.current.clear(),we.current.clear();return}let t=Fe*2**Ge.current;V.current=setTimeout(()=>{V.current=null,Ge.current+=1,je.current(e).catch(t=>{z(q(t,p(`errors.load`))),H.current.size>0&&We.current(e)})},t)},[p]);let X=(0,L.useCallback)(async t=>{let i=++U.current,a=null;do{let o=await ve(e,{limit:50,cursor:a,signal:t});if(i!==U.current)return;let s=o.items.find(e=>e.check_batch?.details?.target_kind===n&&e.check_batch.details.target_bundle_id===(n===`bundle`?r:null));if(s){G.current=s.run.id,await Y(s.run.id,t);return}a=o.next_cursor}while(a);!t?.aborted&&i===U.current&&(G.current=null,B.current=null,v(null),J(null,`automatic`))},[Y,e,r,n,J]),Xe=(0,L.useCallback)(async()=>{if(s||c){let e=G.current;e&&await Y(e);return}await X()},[c,s,Y,X]);Ue.current=Xe;let Ze=(0,L.useCallback)(e=>{V.current||=setTimeout(()=>{V.current=null,Y(e).catch(e=>z(q(e,p(`errors.load`))))},Fe)},[Y,p]);(0,L.useEffect)(()=>{let t=new AbortController;return ae(!0),z(null),(async()=>{if(c){if(b(null),l){let n=await ne(e,l,t.signal);if(n.run.kind!==`check_attempt`||n.details.kind!==`check_attempt`||!n.details.available||!n.details.attempt||n.details.attempt.batch_run_id!==c){d?.();return}}G.current=c,await Y(c,t.signal);return}if(!s){b(null),await X(t.signal);return}let n=await xe(e,s,t.signal);if(b(n),n.sourceBatchRunId){G.current=n.sourceBatchRunId,await Y(n.sourceBatchRunId,t.signal);return}G.current=null,B.current=null,v(null),J(null,`automatic`)})().catch(e=>{oe(e)||(e instanceof de&&e.status===404&&d?.(),z(q(e,p(`errors.load`))))}).finally(()=>{t.signal.aborted||(ae(!1),Ee.current=!1,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ue.current().catch(e=>z(q(e,p(`errors.load`))))},Fe)))}),()=>t.abort()},[l,c,s,Y,X,d,e,p,J]),(0,L.useEffect)(()=>{let t=_?.batch.execution_run_id;if(!t){W.current+=1,se(null),ue(new Set),A(new Set),_e(``),M(null);return}Ke.current?.batch_run_id!==t&&(se(null),ue(new Set),A(new Set),_e(``),M(null));let n=++W.current,r=new AbortController;return ie(e,t,r.signal).then(e=>{n===W.current&&e.batch_run_id===t&&G.current===t&&qe(e)}).catch(e=>{oe(e)||z(q(e,p(`errors.diagnostics`)))}),()=>r.abort()},[_?.batch.execution_run_id,F,qe,e,p]),(0,L.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=G.current;if(n!==null&&t.batch_run_id!==n)return;let r=B.current;if(!r||H.current.has(t.attempt_run_id)){Je(t),r&&H.current.has(t.attempt_run_id)&&We.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){Je(t),Ze(r.batch.execution_run_id);return}let a=r.attempts[i],o=ye(me(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){H.current.add(t.attempt_run_id),Je(t),We.current(r.batch.execution_run_id);return}let s=[...r.attempts];s[i]={...a,output_revision:o.snapshot.revision,retained_start_offset:o.snapshot.retainedStartOffset,retained_end_offset:o.snapshot.totalByteCount,total_persisted_bytes:o.snapshot.totalByteCount,retained_output:o.snapshot.retainedText};let c={...r,attempts:s};B.current=c,v(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(Ee.current){K.current=!0;return}let n=B.current,r=t.execution_run_id??t.id;if(Se(e=>e+1),j&&r===j.execution_run_id&&j.source_batch_run_id===G.current&&pe(e,j.execution_run_id).then(M).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){U.current+=1,Ze(n.batch.execution_run_id);return}K.current=!0,!Ee.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ue.current().catch(e=>z(q(e,p(`errors.load`))))},Fe))},r=()=>{Se(e=>e+1),Xe().catch(e=>z(q(e,p(`errors.load`))))};return m.on(`check-attempt:output`,t),m.on(`execution-run:updated`,n),m.on(`lifecycle-event:created`,n),m.on(`connect`,r),()=>{m.off(`check-attempt:output`,t),m.off(`execution-run:updated`,n),m.off(`lifecycle-event:created`,n),m.off(`connect`,r)}},[j,Je,e,Xe,Ze,m,p]),(0,L.useEffect)(()=>()=>{V.current&&clearTimeout(V.current),H.current.clear(),we.current.clear()},[]);let Qe=(e,t)=>{U.current+=1,G.current=e.batch.execution_run_id,Ye(e,null,t)},$e=async(e,t)=>{U.current+=1,Ee.current=!0,D(e),z(null);try{let n=await t();e!==`stop`&&(Ae.current=null),Qe(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&u?.(n.batch.execution_run_id,void 0)}catch(t){z(q(t,p(`errors.${e}`))),t instanceof de&&t.status===409&&await Xe().catch(()=>void 0)}finally{D(null),Ee.current=T,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ue.current().catch(e=>z(q(e,p(`errors.load`))))},Fe))}},et=_?Pe.has(_.batch.execution_status):!1,tt=_?et?`running`:_.batch.execution_status===`completed`?`finished`:_.batch.execution_status===`cancelled`||_.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,nt=_?.batch.execution_run_id??null,Z=O?.batch_run_id===nt?O:null,rt=j?.source_batch_run_id===nt?j:null,Q=Z?.auto_fix??null,it=!!(Q&&!Q.terminal_reason),at=Z?Ve(Z):new Set,ot=Z?He(Z):new Set,st=new Set([...ce].filter(e=>at.has(e))),ct=new Set([...fe].filter(e=>ot.has(e))),lt=[...h],ut=_?.attempts.filter(e=>e.execution_status!==`completed`).length??0,dt=async()=>{let t=[...st],n=[...ct];if(!(!Z||!nt||G.current!==nt||Z.repair.eligibility.eligible!==!0||rt?.terminal_result===null||Q&&!Q.terminal_reason||t.length===0&&n.length===0)){P(!0),z(null);try{let r=await he(e,t,n,Z.repair.accepts_ticket_id?Z.repair.candidate_tickets.some(e=>e.id===ge)?ge:Z.repair.candidate_tickets[0]?.id||null:null);M(r.source_batch_run_id===nt?r:null)}catch(t){if(z(q(t,p(`errors.repair`))),t instanceof de&&t.status===409&&_){let t=_.batch.execution_run_id,n=++W.current;ie(e,t).then(e=>{n===W.current&&e.batch_run_id===t&&G.current===t&&qe(e)}).catch(()=>void 0)}}finally{P(!1)}}},ft=async()=>{let t=Q&&!Q.terminal_reason?Q.execution_run_id:rt?.execution_run_id;if(t){P(!0),z(null);try{let n=await re(e,t);`source_batch_run_id`in n&&M(n),Se(e=>e+1)}catch(e){z(q(e,p(`errors.repairStop`)))}finally{P(!1)}}},pt=new Set([...Z?.attempts.filter(e=>e.diagnostics.some(e=>st.has(e.id))).map(e=>e.attempt_run_id)??[],...ct]),mt=(e,t,n)=>{ue(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=ze||!Z||!at.has(t))return r;let a=new Set(Z.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=Be?r:(i.add(t),i)})},ht=(e,t)=>{A(n=>{let r=new Set(n);return t?!pt.has(e)&&pt.size>=Be||!ot.has(e)?n:(r.add(e),r):(r.delete(e),r)})},gt=(e,t)=>{g(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},_t=e=>{_&&(w(null),Ae.current={batchRunId:_.batch.execution_run_id,attemptRunId:e,previousBatchRunId:c===_.batch.execution_run_id?c:null,previousAttemptRunId:c===_.batch.execution_run_id?l:null},J(e,`manual`),u?.(_.batch.execution_run_id,e))},vt=e=>{let t=_?.attempts.find(t=>t.definition_id===e);if(t){_t(t.execution_run_id);return}w(e)},$=S?_?.attempts.find(e=>e.definition_id===S)??null:_?.attempts.find(e=>e.execution_run_id===te)??null,yt=$?.command_snapshot??i.find(e=>e.id===S)??null,bt=S??$?.definition_id??null,xt=yt?{required:a.includes(yt.id),preReview:o.includes(yt.id)}:null;return(0,L.useEffect)(()=>{f?.(tt)},[tt,f]),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Ce&&(0,R.jsx)(`p`,{role:`alert`,className:`mx-4 mt-3 rounded-xl border border-red-400/25 bg-red-500/10 px-3 py-2 text-sm text-red-200 sm:mx-6`,children:Ce}),(0,R.jsxs)(`div`,{role:`toolbar`,"aria-label":p(`runActions`),className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-y border-border/70 bg-background/30 px-4 py-3 sm:px-6`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:p(`runActions`)})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(y,{type:`button`,size:`sm`,disabled:lt.length===0||et||it||E!==null,onClick:()=>void $e(`run`,()=>C(e,{targetKind:n,targetBundleId:r,definitionIds:lt})),children:p(E===`run`?`starting`:`runSelected`)}),_&&et&&(0,R.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null||N,onClick:()=>void(it?ft():$e(`stop`,()=>be(e,_.batch.execution_run_id))),children:p(E===`stop`||N?`stopping`:`stop`)}),_&&!et&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:it||E!==null,onClick:()=>void $e(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`all`})),children:p(`rerunAll`)}),(0,R.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:it||E!==null||ut===0,onClick:()=>void $e(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`failed_only`})),children:p(`rerunFailed`)})]})]})]}),(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,auto)_minmax(0,1fr)] overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)] md:grid-rows-1`,children:[(0,R.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,R.jsx)(Me,{definitions:i,attempts:_?.attempts??[],requiredDefinitionIds:a,preReviewDefinitionIds:o,selectedDefinitionIds:h,selectedCheckId:bt,diagnostics:Z,selectedDiagnosticIds:st,selectedRawOutputAttemptRunIds:ct,onToggleDefinition:gt,onSelectCheck:vt})}),(0,R.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[s&&!ee&&T&&(0,R.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:p(`gateLoading`)}),ee&&(0,R.jsx)(Oe,{evaluation:ee}),T&&(0,R.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:p(`loading`)}),!T&&!_&&!yt&&(0,R.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,R.jsx)(`h2`,{className:`font-medium text-foreground`,children:p(`emptyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:p(`emptyDescription`)})]}),_&&(0,R.jsx)(R.Fragment,{children:(0,R.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:p(`status.${_.batch.execution_status}`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:p(`summary`,{passed:_.batch.passed_count,failed:_.batch.failed_count,running:_.batch.running_count,queued:_.batch.queued_count})}),_.batch.stop_requested&&(0,R.jsx)(`span`,{className:`text-xs text-amber-200`,children:p(`stopRequested`)})]})}),(_||yt)&&(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Te,{attempt:$,definition:yt,diagnostics:Z?.attempts.find(e=>e.attempt_run_id===$?.execution_run_id)??null,repair:Z?.repair??null,selectedDiagnosticIds:st,selectedRawOutputAttemptRunIds:ct,selectedAttemptRunIds:pt,selectedTicketId:ge,pending:N,activeRepair:rt,autoFix:Q,policy:xt,onSelectedTicketChange:_e,onToggleDiagnostic:(e,t)=>$&&mt($.execution_run_id,e,t),onToggleRawOutput:e=>$&&ht($.execution_run_id,e),onStartRepair:()=>void dt(),onStopRepair:()=>void ft()})})]})]})]})},We=(e,t)=>N(O(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),Ge=(e,t)=>N(O(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Ke=(e,t={})=>N(O(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),J=(e,t)=>N(O(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),qe=e=>N(O(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),Je=e=>x(O(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),Ye=256*1024,Y=24,X=(e,t)=>g.t(`common:testsDialog.${e}`,t),Xe=(e,t)=>{let n=`${e}${t}`;return n.length<=Ye?n:n.slice(-Ye)},Ze=(e,t)=>e?e.run_id&&t.run_id&&e.run_id!==t.run_id?e.status===`running`||t.status!==`running`?e:t:e.status!==`idle`&&e.status!==`running`&&t.status===`running`?e:e.run_id===t.run_id&&e.output.length>t.output.length?{...t,output:e.output,output_truncated:e.output_truncated||t.output_truncated}:t:t,Qe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=Y,$e=e=>{e.scrollTop=e.scrollHeight},et=(e,t=!1)=>{$e(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{$e(e),t&&(r=window.requestAnimationFrame(()=>{$e(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},tt=e=>e===`running`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e===`passed`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e===`failed`||e===`error`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e===`stopped`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`,nt=e=>{if(e==null)return null;if(e<1e3)return`${e} ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`},Z=e=>{let t=e.split(`/`);return t[t.length-1]||e},rt=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),Q=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),it=(e,t)=>{let n=rt(t);return n.length===0?e:e.flatMap(e=>{let t=Z(e.path);if(Q(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>Q(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},at=e=>X(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ot=e=>e?.selection?e.selection.kind===`all`?X(`selection.allTests`):e.selection.kind===`case`?e.selection.name:Z(e.selection.path):X(`selection.noRunYet`),st=e=>/(^|\s)(?:FAIL|✗)(\s|$)|\b(?:failed|error|stderr|Expected:|Received:)\b/i.test(e)?`failure`:/(^|\s)(?:PASS|✓)(\s|$)|\bpassed\b/i.test(e)?`success`:/\b(?:WARN|warning|skipped|todo|pending)\b/i.test(e)?`warning`:`default`,ct=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,lt=(e,t)=>e===t?!0:e.length===t.length?e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.name===r.name&&e.command===r.command&&e.cwd===r.cwd&&e.runner===r.runner}):!1,ut=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,dt=({line:e,tone:t})=>(0,R.jsx)(`div`,{"data-tone":t,className:b(`whitespace-pre-wrap break-words`,ct(t)),children:e===``?` `:e}),ft=(0,L.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,R.jsxs)(`button`,{type:`button`,"aria-label":X(`caseRow.runAriaLabel`,{name:r}),title:r,className:b(`flex w-full min-w-0 items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,e?`cursor-pointer hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,n&&`bg-sky-500/10`),disabled:!e,onClick:()=>{i(t,r)},children:[(0,R.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,R.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));ft.displayName=`TestCaseRow`;var pt=(0,L.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let l=e===`file`&&n===i.path,d=e===`case`&&n===i.path;return(0,R.jsx)(M,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(w,{asChild:!0,children:(0,R.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":X(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(Se,{className:b(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,R.jsx)(`button`,{type:`button`,"aria-label":X(`fileRow.runAriaLabel`,{path:i.path}),className:b(`min-w-0 flex-1 rounded-xl border border-border/60 bg-background/20 px-2.5 py-2 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,r?`cursor-pointer hover:border-sky-400/35 hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,(l||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-sky-200`,children:(0,R.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:Z(i.path)}),(0,R.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:X(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,R.jsx)(F,{children:(0,R.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,R.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:X(`fileRow.noNamedTests`)}):(0,R.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,R.jsx)(ft,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});pt.displayName=`DiscoveryFileRow`;var mt=(0,L.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,availableCommands:a,canRunGranular:c,discovery:l,expandedFiles:u,fullSuiteOnlyNotice:f,isLoading:p,selectedCommandId:m,selectedCommandName:h,sessionError:g,sessionStatus:_,shouldShowCommandSelector:v,onRunCase:ee,onRunFile:te,onSelectCommand:x,onToggleFile:S})=>{let[C,w]=(0,L.useState)(``),T=(0,L.useMemo)(()=>it(l,C),[l,C]),ne=(0,L.useMemo)(()=>T.reduce((e,t)=>e+t.cases.length,0),[T]),re=rt(C).length>0;return(0,R.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[v&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:X(`scope.label`)}),(0,R.jsxs)(ce,{children:[(0,R.jsx)(d,{asChild:!0,children:(0,R.jsxs)(y,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":X(`scope.selectedCommandAriaLabel`),disabled:a.length===0||_===`running`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:h??X(`scope.selectTestScope`)}),(0,R.jsx)(Se,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,R.jsx)(n,{align:`start`,className:`w-72`,children:a.map(e=>(0,R.jsx)(se,{className:b(m===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{x(e.id)},children:(0,R.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),f&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:f}),(l.length>0||C.length>0)&&(0,R.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,R.jsx)(o,{type:`search`,value:C,onChange:e=>{w(e.target.value)},placeholder:X(`filter.placeholder`),"aria-label":X(`filter.ariaLabel`),className:`pr-10`}),C.length>0&&(0,R.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":X(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{w(``)},children:(0,R.jsx)(r,{className:`size-4`})})]}),!a.length&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:X(`discovery.noCommands`)}),g&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:g}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[X(`discovery.fileCount`,{count:T.length}),`, `,X(`discovery.caseCount`,{count:ne})]})}),p&&(0,R.jsx)(s,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:l.length===0&&!p?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:X(`discovery.noFilesDetected`)}):T.length===0?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:X(`discovery.noFilterMatches`)}):T.map(n=>(0,R.jsx)(pt,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,canRunGranular:c,file:n,isExpanded:re||(u[n.path]??!1),onRunCase:ee,onRunFile:te,onToggleFile:S},n.path))})]})]})})});mt.displayName=`DiscoveryPane`;var ht=(0,L.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,L.useMemo)(()=>t?S(t).replace(/\r\n/g,`
2
+ `).replace(/\r/g,`
3
+ `).split(`
4
+ `).map(e=>({line:e,tone:st(e)})):[],[t]);return(0,R.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,R.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,R.jsx)(P,{variant:`outline`,className:b(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,tt(i)),children:at(i)}),a&&(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,R.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,R.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:nt(e)}),n&&(0,R.jsx)(P,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:X(`output.trimmed`)})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,R.jsx)(`div`,{ref:o,"aria-label":X(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,R.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,R.jsx)(dt,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,R.jsx)(`div`,{className:`text-slate-200`,children:X(`output.empty`)})})})})]})})});ht.displayName=`OutputPane`;var gt=(0,L.forwardRef)(({testCommands:e,onStatusChange:t,onTargetLabelChange:n,onClose:r,...o},s)=>{let u=o.scope,d=o.projectId,f=o.scope===`ticket`?o.ticketId:null,h=o.scope===`project`?o.targetKind:null,g=o.scope===`project`?o.targetBundleId:null,[b,te]=(0,L.useState)(e),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)([]),[T,ne]=(0,L.useState)(``),[re,ie]=(0,L.useState)({}),[E,oe]=(0,L.useState)(!0),[D,O]=(0,L.useState)(!1),[k,se]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(null),[ue,pe]=(0,L.useState)(!1),[me,he]=(0,L.useState)(!1),A=(0,L.useRef)(null),ge=(0,L.useRef)(!1),ve=(0,L.useRef)(null),ye=(0,L.useRef)(!0),be=(0,L.useRef)(null),j=(0,L.useRef)(null),xe=x?.selection?.kind??null,M=x?.selection?.kind===`all`?null:x?.selection?.path??null,N=x?.selection?.kind===`case`?x.selection.name:null,P=x?.id??null,F=x?.status??null,I=(0,L.useMemo)(()=>b.find(e=>e.id===T)??null,[b,T]),Se=(0,L.useMemo)(()=>{if(x?.summary?.failed_count==null&&x?.summary?.passed_count==null&&x?.summary?.failed_file_count==null&&x?.summary?.passed_file_count==null)return null;let e=x?.summary?.failed_count==null&&x?.summary?.passed_count==null;return{failed:F===`failed`&&x?.summary?.failed_count==null&&x?.summary?.failed_file_count!=null||e?{count:x?.summary?.failed_file_count??0,label:X(`summaryCounts.filesFailed`)}:{count:x?.summary?.failed_count??0,label:X(`summaryCounts.failed`)},passed:e?{count:x?.summary?.passed_file_count??0,label:X(`summaryCounts.filesPassed`)}:{count:x?.summary?.passed_count??x?.summary?.passed_file_count??0,label:X(`summaryCounts.passed`)}}},[x?.summary?.failed_count,x?.summary?.passed_count,x?.summary?.failed_file_count,x?.summary?.passed_file_count,F]),Ce=I?.runner===`unknown`?X(`scope.fullSuiteOnlyNotice`):null,z=!!(I&&x?.status!==`running`&&!D&&!k),B=z,V=z&&me,H=b.length>1,{runs:we}=fe(d),U=x?.run_id?we.find(e=>e.id===x.run_id)??null:null;(0,L.useEffect)(()=>{T||b.length===0||ne(b[0]?.id??``)},[b,T]),(0,L.useEffect)(()=>{e.length>0&&te(t=>lt(t,e)?t:e)},[e]),(0,L.useEffect)(()=>{if(b.length>0||!d)return;let e=new AbortController;return m(e.signal).then(e=>{let t=e.find(e=>e.id===d);t&&te(e=>{let n=ae(t);return lt(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[b.length,d]),(0,L.useEffect)(()=>{let e=e=>{!e||e.id!==A.current||S(t=>Ze(t,e))},t=e=>{!e||e.session_id!==A.current||S(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Xe(t.output,e.chunk),output_truncated:e.output_truncated})};return _.on(`test-session:updated`,e),_.on(`test-session:output`,t),()=>{_.off(`test-session:updated`,e),_.off(`test-session:output`,t)}},[]),(0,L.useEffect)(()=>{let e=ve.current;if(!e){be.current=x?.output??null,j.current=x?.status??null;return}let t=be.current!==(x?.output??null),n=j.current!==`running`&&x?.status===`running`,r=j.current===`running`&&x?.status!==`running`;if(n&&(ye.current=!0),n||t&&x?.status===`running`&&ye.current||r&&ye.current){let t=et(e,r);return be.current=x?.output??null,j.current=x?.status??null,t}be.current=x?.output??null,j.current=x?.status??null},[x?.output,x?.status]),(0,L.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!d)return;t=await We(d,{target_kind:h??`repo_root`,target_bundle_id:g??null})}else t=await Ge(f??``,d);if(e){Je(t.id).catch(()=>{});return}A.current=t.id,S(t)}catch(t){e||le(t instanceof de?t.message:X(`messages.loadRunnerError`))}finally{!e&&A.current==null&&oe(!1)}})(),()=>{e=!0}},[d,u,g,h,f]),(0,L.useEffect)(()=>{U&&S(e=>{if(!e||e.run_id!==U.id)return e;let t=U.status===`completed`?`passed`:U.status===`failed`?`failed`:U.status===`cancelled`||U.status===`interrupted`?`stopped`:`running`;return e.status===t&&e.error===(U.failure?.message??e.error)?e:{...e,status:t,error:U.failure?.message??e.error,started_at:U.started_at??e.started_at,completed_at:U.completed_at??e.completed_at}})},[U]),(0,L.useEffect)(()=>{if(!x?.id){he(!1);return}if(b.length>0&&!T){he(!1);return}let e=new AbortController,t=!1;return oe(!0),he(!1),Ke(x.id,{commandId:T||null,signal:e.signal}).then(e=>{t||(w(e.files),he(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||le(n instanceof de?n.message:X(`messages.discoverError`))}).finally(()=>{t||oe(!1)}),()=>{t=!0,e.abort()}},[b.length,T,x?.id]),(0,L.useEffect)(()=>()=>{let e=A.current;!e||ge.current||(ge.current=!0,Je(e).catch(()=>{}))},[]);let W=(0,L.useCallback)(async e=>{if(!(!P||F===`running`||!I||D||k)){le(null),O(!0);try{let t=await J(P,{command_id:I.id,selection:e});S(e=>Ze(e,t))}catch(e){le(e instanceof de?e.message:X(`messages.startError`))}finally{O(!1)}}},[D,k,I,P,F]),G=(0,L.useCallback)(async()=>{if(!(!P||F!==`running`||k)){le(null),se(!0);try{let e=await qe(P);S(t=>Ze(t,e))}catch(e){le(e instanceof de?e.message:X(`messages.stopError`))}finally{se(!1)}}},[k,P,F]),Te=(0,L.useCallback)(()=>{let e=A.current;if(!e||ge.current){r();return}ge.current=!0,r(),Je(e).catch(()=>{})},[r]),K=(0,L.useCallback)(()=>{if(F===`running`){pe(!0);return}Te()},[Te,F]);(0,L.useImperativeHandle)(s,()=>({requestClose:K}),[K]),(0,L.useEffect)(()=>{t?.(F===`running`?`running`:F===`passed`?`finished`:F===`failed`||F===`error`?`error`:F===`stopped`?`interrupted`:`inactive`)},[t,F]),(0,L.useEffect)(()=>{x?.target_label&&n?.(x.target_label)},[n,x?.target_label]);let Ee=(0,L.useCallback)(()=>{let e=ve.current;e&&(ye.current=Qe(e))},[]),De=(0,L.useCallback)(e=>{ne(e)},[]),Oe=(0,L.useCallback)((e,t)=>{ie(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),ke=(0,L.useCallback)(e=>{W({kind:`file`,path:e})},[W]),Ae=(0,L.useCallback)((e,t)=>{W({kind:`case`,path:e,name:t})},[W]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-0 lg:grid-cols-[22rem_minmax(0,1fr)] lg:grid-rows-1`,children:[(0,R.jsx)(mt,{activeSelectionKind:xe,activeSelectionName:N,activeSelectionPath:M,availableCommands:b,canRunGranular:V,discovery:C,expandedFiles:re,fullSuiteOnlyNotice:Ce,isLoading:E,selectedCommandId:T,selectedCommandName:I?.name??null,sessionError:ce,sessionStatus:F,shouldShowCommandSelector:H,onRunCase:Ae,onRunFile:ke,onSelectCommand:De,onToggleFile:Oe}),(0,R.jsx)(ht,{durationMs:x?.duration_ms??null,output:x?.output??``,outputTruncated:x?.output_truncated??!1,selectionLabel:ot(x),status:F,summaryCounts:Se,viewportRef:ve,onScroll:Ee})]}),(0,R.jsx)(_e,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,R.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:x?.status===`running`?(0,R.jsxs)(y,{type:`button`,variant:`destructive`,className:ut,onClick:()=>{G()},disabled:k,children:[(0,R.jsx)(p,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:X(`actions.stop`)})]}):(0,R.jsxs)(y,{type:`button`,variant:`success`,className:ut,disabled:!B,onClick:()=>{W({kind:`all`})},children:[(0,R.jsx)(i,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:X(`actions.run`)})]})})})]}),(0,R.jsx)(v,{open:ue,onOpenChange:pe,children:(0,R.jsxs)(a,{showCloseButton:!1,overlayClassName:`z-[60] bg-black/60`,className:`z-[60] max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,R.jsxs)(c,{children:[(0,R.jsx)(ee,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:X(`closeConfirmation.title`)}),(0,R.jsx)(l,{className:`text-sm text-foreground whitespace-pre-line`,children:X(`closeConfirmation.description`)})]}),(0,R.jsxs)(_e,{className:`sm:flex-row sm:justify-end`,children:[(0,R.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>pe(!1),children:X(`closeConfirmation.keepRunning`)}),(0,R.jsx)(y,{type:`button`,variant:`destructive`,onClick:()=>{pe(!1),Te()},children:X(`closeConfirmation.stopAndClose`)})]})]})})]})});gt.displayName=`TestsPanel`;var _t=`archon.verification-tab`,vt=()=>{try{let e=window.localStorage.getItem(_t);return e===`checks`||e===`tests`?e:null}catch{return null}},$=e=>{try{window.localStorage.setItem(_t,e)}catch{}},yt=({targetLabel:e,definitions:t,requiredDefinitionIds:n=[],preReviewDefinitionIds:i=[],checksTarget:o,testsTarget:s,onClose:c,onOpenActivity:u,requestedInitialTab:d,directBatchRunId:p,directAttemptRunId:m,onCheckSelectionChange:g,onUnavailable:_})=>{let{t:b}=I(`common`,{keyPrefix:`verificationDialog`}),x=A(t),S=o!==null&&(t.length>0||!!o.gateEvaluationId||!!p),C=s!==null&&x.length>0,[w,T]=(0,L.useState)(()=>{if(d===`checks`&&S||d===`tests`&&C)return d;let e=vt();return e===`checks`&&S||e===`tests`&&C?e:S?`checks`:`tests`}),[ne,re]=(0,L.useState)(`inactive`),[ie,ae]=(0,L.useState)(`inactive`),oe=(0,L.useRef)(null),O=(0,L.useRef)(null);(0,L.useEffect)(()=>{(w===`checks`&&!S||w===`tests`&&!C)&&T(S?`checks`:`tests`)},[w,S,C]);let k=e=>{if(O.current=e??null,s){let e=oe.current;if(e){e.requestClose();return}}(e??c)()},se=()=>{let e=O.current??c;O.current=null,e()};return(0,R.jsx)(v,{open:!0,onOpenChange:e=>{e||k()},children:(0,R.jsxs)(a,{showCloseButton:!1,className:`flex h-[calc(100vh-1rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:h-[calc(100vh-2rem)] sm:max-w-7xl`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.stopPropagation(),children:[(0,R.jsx)(ee,{className:`sr-only`,children:b(`title`)}),(0,R.jsx)(l,{className:`sr-only`,children:b(`description`)}),(0,R.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-border/70 px-4 py-4 sm:px-6`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,R.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border bg-background/60 text-sky-200`,children:(0,R.jsx)(h,{className:`size-5`})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:b(`title`)}),(0,R.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,R.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>k(u),children:b(`openActivity`)}),(0,R.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b(`close`),onClick:()=>k(),children:(0,R.jsx)(r,{className:`size-4`})})]})]}),(0,R.jsxs)(ue,{value:w,onValueChange:e=>{e!==`checks`&&e!==`tests`||(T(e),$(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,R.jsxs)(E,{"aria-label":b(`tabsAriaLabel`),children:[S&&(0,R.jsxs)(te,{value:`checks`,className:`gap-2`,children:[(0,R.jsx)(h,{className:`size-4`}),(0,R.jsx)(`span`,{children:b(`tabs.checks.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.checks.${ne}`),children:(0,R.jsx)(f,{state:ne})})]}),C&&(0,R.jsxs)(te,{value:`tests`,className:`gap-2`,children:[(0,R.jsx)(j,{className:`size-4`}),(0,R.jsx)(`span`,{children:b(`tabs.tests.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.tests.${ie}`),children:(0,R.jsx)(f,{state:ie})})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:b(`tabs.${w}.description`)})]}),S&&o&&(0,R.jsx)(D,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(Ue,{...o,definitions:t,requiredDefinitionIds:n,preReviewDefinitionIds:i,directBatchRunId:p,directAttemptRunId:m,onSelectionChange:w===`checks`?g:void 0,onUnavailable:_,onStatusChange:re})}),s&&x.length>0&&(0,R.jsx)(D,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(gt,{ref:oe,...s,testCommands:x,onStatusChange:ae,onClose:se})})]})]})})};export{yt as VerificationDialog};