@straiffi/archon 1.11.5 → 1.11.7

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 (175) hide show
  1. package/README.md +8 -0
  2. package/dist/client/assets/{ActivityView-Dw7Bl18C.js → ActivityView-gwq90xuC.js} +1 -1
  3. package/dist/client/assets/{GitHubActionsDialog-9w5XtP5x.js → GitHubActionsDialog-CddU5mmQ.js} +1 -1
  4. package/dist/client/assets/{VerificationDialog-dOSv05QS.js → VerificationDialog-DZXmgf-Q.js} +1 -1
  5. package/dist/client/assets/{architectureDiagram-3BPJPVTR-BU-dnVWz.js → architectureDiagram-3BPJPVTR-B7h4gUId.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-GPEHLZMM-D1fhZ9K3.js → blockDiagram-GPEHLZMM-CKcqgkiW.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-AAUBKEIU-C5cs67FJ.js → c4Diagram-AAUBKEIU-b0N8QAOw.js} +1 -1
  8. package/dist/client/assets/channel-DFqGOc-J.js +1 -0
  9. package/dist/client/assets/{chunk-2J33WTMH-BuofkrUv.js → chunk-2J33WTMH-DuMyezuW.js} +1 -1
  10. package/dist/client/assets/{chunk-3OPIFGDE-BSLbHStu.js → chunk-3OPIFGDE-Dgtz4ReD.js} +1 -1
  11. package/dist/client/assets/{chunk-5ZQYHXKU-CV_reqn5.js → chunk-5ZQYHXKU-By3w6rbd.js} +1 -1
  12. package/dist/client/assets/{chunk-727SXJPM-DuL4OL6p.js → chunk-727SXJPM-BHTPfHY2.js} +1 -1
  13. package/dist/client/assets/{chunk-AQP2D5EJ-B7ebIXsD.js → chunk-AQP2D5EJ-W2Rgle6H.js} +1 -1
  14. package/dist/client/assets/{chunk-CSCIHK7Q-CfvfKS81.js → chunk-CSCIHK7Q-C0zW-M44.js} +1 -1
  15. package/dist/client/assets/{chunk-KSCS5N6A-B8yAPh8_.js → chunk-KSCS5N6A-NLszOClX.js} +1 -1
  16. package/dist/client/assets/{chunk-L5ZTLDWV-CLAA9PrV.js → chunk-L5ZTLDWV-Djdu-TFq.js} +1 -1
  17. package/dist/client/assets/{chunk-LZXEDZCA-BWDUNHyY.js → chunk-LZXEDZCA-BBMjUaM6.js} +2 -2
  18. package/dist/client/assets/{chunk-ND2GUHAM-DDtkY0aA.js → chunk-ND2GUHAM-BMGxL6oq.js} +1 -1
  19. package/dist/client/assets/{chunk-NZK2D7GU-Cqw_WclD.js → chunk-NZK2D7GU-BmBtYVzv.js} +1 -1
  20. package/dist/client/assets/{chunk-O5CBEL6O-yk76d2Ne.js → chunk-O5CBEL6O-fNzTMe1t.js} +1 -1
  21. package/dist/client/assets/{chunk-WU5MYG2G-C9RL4ic0.js → chunk-WU5MYG2G-DtWDtH9D.js} +1 -1
  22. package/dist/client/assets/classDiagram-4FO5ZUOK-zJrDS8pp.js +1 -0
  23. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Bk6pmr_F.js +1 -0
  24. package/dist/client/assets/{dagre-BM42HDAG-D1R8Uoz3.js → dagre-BM42HDAG-zpl4bunJ.js} +1 -1
  25. package/dist/client/assets/{diagram-2AECGRRQ-CUwS3hk7.js → diagram-2AECGRRQ-XiIQ6yDZ.js} +1 -1
  26. package/dist/client/assets/{diagram-5GNKFQAL-BQGwWZ5M.js → diagram-5GNKFQAL-EwX79EhM.js} +1 -1
  27. package/dist/client/assets/{diagram-KO2AKTUF-C7ErzACC.js → diagram-KO2AKTUF-pTTl20VK.js} +1 -1
  28. package/dist/client/assets/{diagram-LMA3HP47-z4blMZQD.js → diagram-LMA3HP47-CAADMP3T.js} +1 -1
  29. package/dist/client/assets/{diagram-OG6HWLK6-DTdMXNXF.js → diagram-OG6HWLK6-DSw-z9AU.js} +1 -1
  30. package/dist/client/assets/{erDiagram-TEJ5UH35-Dzq40m7g.js → erDiagram-TEJ5UH35-CYVpzKnx.js} +1 -1
  31. package/dist/client/assets/{flowDiagram-I6XJVG4X-DZee4-lQ.js → flowDiagram-I6XJVG4X-YfUgs6Y9.js} +1 -1
  32. package/dist/client/assets/{ganttDiagram-6RSMTGT7-BrvahLDI.js → ganttDiagram-6RSMTGT7-CBZcM6fa.js} +1 -1
  33. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DFl7NFyp.js → gitGraphDiagram-PVQCEYII-B-cnyCdP.js} +1 -1
  34. package/dist/client/assets/index-CbYT3N3U.css +2 -0
  35. package/dist/client/assets/index-DXJSLf4W.js +287 -0
  36. package/dist/client/assets/{infoDiagram-5YYISTIA-DcbIRnzw.js → infoDiagram-5YYISTIA-hg-hixwz.js} +1 -1
  37. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-CCLSDPWU.js → ishikawaDiagram-YF4QCWOH-CP30YmvW.js} +1 -1
  38. package/dist/client/assets/{journeyDiagram-JHISSGLW-DBybnxZb.js → journeyDiagram-JHISSGLW-MPwOtkOb.js} +1 -1
  39. package/dist/client/assets/{kanban-definition-UN3LZRKU-0vXnDc2p.js → kanban-definition-UN3LZRKU-dzx8hATQ.js} +1 -1
  40. package/dist/client/assets/{line-CmuG_mnn.js → line-C2wfs9Qd.js} +1 -1
  41. package/dist/client/assets/{mermaid-parser.core-2bcA4BZv.js → mermaid-parser.core-j3pT6MDr.js} +1 -1
  42. package/dist/client/assets/{mermaid.core-BtCKaSS-.js → mermaid.core-BwkWqkNy.js} +3 -3
  43. package/dist/client/assets/{mindmap-definition-RKZ34NQL-BS3GYH1w.js → mindmap-definition-RKZ34NQL-CZ3iES81.js} +1 -1
  44. package/dist/client/assets/{pieDiagram-4H26LBE5-DnSf3dLi.js → pieDiagram-4H26LBE5-DCY6gx4q.js} +1 -1
  45. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CvU26PT6.js → quadrantDiagram-W4KKPZXB-Bs-SuHD0.js} +1 -1
  46. package/dist/client/assets/{requirementDiagram-4Y6WPE33-9BKyfU_D.js → requirementDiagram-4Y6WPE33-DaHZPYWb.js} +1 -1
  47. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-9EYmPhr5.js → sankeyDiagram-5OEKKPKP-CAABGeQw.js} +1 -1
  48. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BcBk_wZZ.js → sequenceDiagram-3UESZ5HK-BiFFDmHd.js} +1 -1
  49. package/dist/client/assets/{stateDiagram-AJRCARHV-2m55Kpig.js → stateDiagram-AJRCARHV-DKXUKIex.js} +1 -1
  50. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DyEfP-lL.js +1 -0
  51. package/dist/client/assets/{timeline-definition-PNZ67QCA-J3NEOuRz.js → timeline-definition-PNZ67QCA-CNWuUe9M.js} +1 -1
  52. package/dist/client/assets/{vennDiagram-CIIHVFJN-D_3D_Pp4.js → vennDiagram-CIIHVFJN-Melay8l5.js} +1 -1
  53. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-Wln2PbKU.js → wardleyDiagram-YWT4CUSO-pWa26XVf.js} +1 -1
  54. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DfvF03Zn.js → xychartDiagram-2RQKCTM6-BaAwLxVv.js} +1 -1
  55. package/dist/client/index.html +2 -2
  56. package/dist/server/db.js +71 -4
  57. package/dist/server/db.js.map +1 -1
  58. package/dist/server/index.js +29 -5
  59. package/dist/server/index.js.map +1 -1
  60. package/dist/server/lib/agent.js +277 -299
  61. package/dist/server/lib/agent.js.map +1 -1
  62. package/dist/server/lib/agentOutputLanguage.js +11 -0
  63. package/dist/server/lib/agentOutputLanguage.js.map +1 -0
  64. package/dist/server/lib/agentProvider.js.map +1 -1
  65. package/dist/server/lib/agentRuns.js +68 -4
  66. package/dist/server/lib/agentRuns.js.map +1 -1
  67. package/dist/server/lib/appLocale.js +19 -0
  68. package/dist/server/lib/appLocale.js.map +1 -0
  69. package/dist/server/lib/buildExecutionEnvironment.js +92 -1
  70. package/dist/server/lib/buildExecutionEnvironment.js.map +1 -1
  71. package/dist/server/lib/chatDraftTargets.js +81 -0
  72. package/dist/server/lib/chatDraftTargets.js.map +1 -0
  73. package/dist/server/lib/chatOperations.js +26 -3
  74. package/dist/server/lib/chatOperations.js.map +1 -1
  75. package/dist/server/lib/chatTargets.js +57 -2
  76. package/dist/server/lib/chatTargets.js.map +1 -1
  77. package/dist/server/lib/chats.js +10 -6
  78. package/dist/server/lib/chats.js.map +1 -1
  79. package/dist/server/lib/conversationResume.js +56 -3
  80. package/dist/server/lib/conversationResume.js.map +1 -1
  81. package/dist/server/lib/dockerSandboxOpencodeSessionOperations.js +81 -25
  82. package/dist/server/lib/dockerSandboxOpencodeSessionOperations.js.map +1 -1
  83. package/dist/server/lib/dockerSandboxReleaseProfiles.js +36 -7
  84. package/dist/server/lib/dockerSandboxReleaseProfiles.js.map +1 -1
  85. package/dist/server/lib/executionEnvironmentRoutes.js +71 -4
  86. package/dist/server/lib/executionEnvironmentRoutes.js.map +1 -1
  87. package/dist/server/lib/executionEnvironmentValidation.js +199 -19
  88. package/dist/server/lib/executionEnvironmentValidation.js.map +1 -1
  89. package/dist/server/lib/executionEnvironmentValidationEvidence.js +140 -0
  90. package/dist/server/lib/executionEnvironmentValidationEvidence.js.map +1 -0
  91. package/dist/server/lib/executionEnvironmentValidationOperations.js +13 -0
  92. package/dist/server/lib/executionEnvironmentValidationOperations.js.map +1 -1
  93. package/dist/server/lib/executionRetry.js.map +1 -1
  94. package/dist/server/lib/executionRetryContext.js +55 -11
  95. package/dist/server/lib/executionRetryContext.js.map +1 -1
  96. package/dist/server/lib/executionTargets.js +5 -2
  97. package/dist/server/lib/executionTargets.js.map +1 -1
  98. package/dist/server/lib/hostExecutionEnvironment.js +14 -2
  99. package/dist/server/lib/hostExecutionEnvironment.js.map +1 -1
  100. package/dist/server/lib/i18n/index.js +3 -2
  101. package/dist/server/lib/i18n/index.js.map +1 -1
  102. package/dist/server/lib/i18n/resources.js +0 -1
  103. package/dist/server/lib/i18n/resources.js.map +1 -1
  104. package/dist/server/lib/lightweightPrompt.js +4 -0
  105. package/dist/server/lib/lightweightPrompt.js.map +1 -1
  106. package/dist/server/lib/models.js +58 -18
  107. package/dist/server/lib/models.js.map +1 -1
  108. package/dist/server/lib/opencodeAgentProvider.js +54 -48
  109. package/dist/server/lib/opencodeAgentProvider.js.map +1 -1
  110. package/dist/server/lib/opencodeCli.js +244 -0
  111. package/dist/server/lib/opencodeCli.js.map +1 -0
  112. package/dist/server/lib/opencodePromptOutput.js +11 -65
  113. package/dist/server/lib/opencodePromptOutput.js.map +1 -1
  114. package/dist/server/lib/opencodeSessionOperations.js +44 -28
  115. package/dist/server/lib/opencodeSessionOperations.js.map +1 -1
  116. package/dist/server/lib/opencodeSessionProvenance.js +23 -0
  117. package/dist/server/lib/opencodeSessionProvenance.js.map +1 -0
  118. package/dist/server/lib/opencodeStream.js +263 -0
  119. package/dist/server/lib/opencodeStream.js.map +1 -0
  120. package/dist/server/lib/opencodeTaskSessions.js +3 -4
  121. package/dist/server/lib/opencodeTaskSessions.js.map +1 -1
  122. package/dist/server/lib/opencodeV2SessionOperations.js +453 -0
  123. package/dist/server/lib/opencodeV2SessionOperations.js.map +1 -0
  124. package/dist/server/lib/postBuildChecks.js +1 -1
  125. package/dist/server/lib/postBuildChecks.js.map +1 -1
  126. package/dist/server/lib/run.js +32 -41
  127. package/dist/server/lib/run.js.map +1 -1
  128. package/dist/server/lib/runProcessIdentity.js +10 -2
  129. package/dist/server/lib/runProcessIdentity.js.map +1 -1
  130. package/dist/server/lib/runProcesses.js +52 -19
  131. package/dist/server/lib/runProcesses.js.map +1 -1
  132. package/dist/server/lib/runServiceStop.js +62 -0
  133. package/dist/server/lib/runServiceStop.js.map +1 -0
  134. package/dist/server/lib/runServices.js +63 -4
  135. package/dist/server/lib/runServices.js.map +1 -1
  136. package/dist/server/lib/runSessionLifecycle.js +25 -0
  137. package/dist/server/lib/runSessionLifecycle.js.map +1 -1
  138. package/dist/server/lib/runtimePaths.js +7 -4
  139. package/dist/server/lib/runtimePaths.js.map +1 -1
  140. package/dist/server/lib/serviceRunLogs.js +180 -0
  141. package/dist/server/lib/serviceRunLogs.js.map +1 -0
  142. package/dist/server/lib/sessionTargets.js +35 -2
  143. package/dist/server/lib/sessionTargets.js.map +1 -1
  144. package/dist/server/lib/specOperations.js +7 -2
  145. package/dist/server/lib/specOperations.js.map +1 -1
  146. package/dist/server/lib/specReviewContext.js +3 -2
  147. package/dist/server/lib/specReviewContext.js.map +1 -1
  148. package/dist/server/lib/toolUpgrade.js +54 -5
  149. package/dist/server/lib/toolUpgrade.js.map +1 -1
  150. package/dist/server/lib/types.js.map +1 -1
  151. package/dist/server/workers/build.js +47 -9
  152. package/dist/server/workers/build.js.map +1 -1
  153. package/dist/server/workers/chat.js +89 -21
  154. package/dist/server/workers/chat.js.map +1 -1
  155. package/dist/server/workers/followUp.js +59 -22
  156. package/dist/server/workers/followUp.js.map +1 -1
  157. package/dist/server/workers/plan.js +109 -169
  158. package/dist/server/workers/plan.js.map +1 -1
  159. package/dist/server/workers/planFollowUp.js +27 -7
  160. package/dist/server/workers/planFollowUp.js.map +1 -1
  161. package/dist/server/workers/review.js +43 -10
  162. package/dist/server/workers/review.js.map +1 -1
  163. package/dist/server/workers/specReview.js +1 -0
  164. package/dist/server/workers/specReview.js.map +1 -1
  165. package/dist/server/workers/specSession.js +42 -5
  166. package/dist/server/workers/specSession.js.map +1 -1
  167. package/dist/shared/i18n/locales.js +12 -0
  168. package/dist/shared/i18n/locales.js.map +1 -0
  169. package/package.json +1 -1
  170. package/dist/client/assets/channel-DUX4Nl-Q.js +0 -1
  171. package/dist/client/assets/classDiagram-4FO5ZUOK-_vWY0Wm5.js +0 -1
  172. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Boom-t3w.js +0 -1
  173. package/dist/client/assets/index-D8_nS8Kw.js +0 -287
  174. package/dist/client/assets/index-RM0FaS4q.css +0 -2
  175. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DuYuP5AB.js +0 -1
package/README.md CHANGED
@@ -64,6 +64,14 @@ Archon runs `codex app-server --listen stdio://` and discovers the models, reaso
64
64
 
65
65
  Host and Docker Sandbox authentication and catalogs are separate. A host-discovered model is only a selection hint for a sandbox: exact sandbox validation and the selected-model destination probe are authoritative before execution. See the [Codex agent qualification guide](https://github.com/Straiffi/Archon/blob/main/docs/codex-agent.md).
66
66
 
67
+ ### OpenCode and Docker Sandbox
68
+
69
+ Host OpenCode and Docker Sandbox OpenCode are qualified independently. Archon understands the OpenCode v2 runtime and session API on supported host installations, but a sandbox may use v2 only when its Docker Sandbox-compatible template is pinned by immutable OCI index and Linux amd64 manifest digests and passes the complete runtime workflow matrix.
70
+
71
+ Docker Sandbox execution of OpenCode v2 is intentionally disabled until an official, compatible v2 template is published and qualified. New Docker Sandbox OpenCode environments therefore continue to use the qualified v1 template, and runtime validation rejects v2 before running provider checks. Existing environments pinned to `docker.io/docker/sandbox-templates@sha256:88a078fc021d0a2b4c3315f21a6f05dfdda5a6b30369a53d185b5b6544465efc` remain resolvable; Archon does not automatically perform cross-major upgrades, convert OpenCode data, or import/export sessions. A cross-major continuation starts a fresh provider session and uses persisted conversation context for the handoff.
72
+
73
+ The upstream OpenCode 2.0.7 container is recorded only as build provenance and is not itself a Docker Sandbox agent template. Upstream arm64 publication does not imply arm64 support: Docker Sandbox remains qualified only on Linux x64. See [Docker Sandbox CLI qualification](docs/docker-sandbox-qualification.md) for the fixed release tuple, provenance digests, validation contracts, and outstanding qualification matrix.
74
+
67
75
  ## How It Works
68
76
 
69
77
  Archon has three main workspaces:
@@ -1 +1 @@
1
- import{ht as e,r as t}from"./index-D8_nS8Kw.js";var n=e(),r=({projectId:e,onClose:r,onDetailsClose:i,onNavigateToLifecycleSource:a,initialRunId:o,initialEventId:s,hasActivityParent:c,onRunSelectionChange:l,onRelatedReferenceSelection:u,onUnavailable:d})=>e?(0,n.jsx)(t,{projectId:e,scope:{type:`project`},initialRunId:o,initialEventId:s,hasActivityParent:c,onRunSelectionChange:l,onRelatedReferenceSelection:u,onUnavailable:d,onClose:r,onDetailsClose:i,onNavigateToLifecycleSource:a}):null;export{r as ActivityView};
1
+ import{ht as e,r as t}from"./index-DXJSLf4W.js";var n=e(),r=({projectId:e,onClose:r,onDetailsClose:i,onNavigateToLifecycleSource:a,initialRunId:o,initialEventId:s,hasActivityParent:c,onRunSelectionChange:l,onRelatedReferenceSelection:u,onUnavailable:d})=>e?(0,n.jsx)(t,{projectId:e,scope:{type:`project`},initialRunId:o,initialEventId:s,hasActivityParent:c,onRunSelectionChange:l,onRelatedReferenceSelection:u,onUnavailable:d,onClose:r,onDetailsClose:i,onNavigateToLifecycleSource:a}):null;export{r as ActivityView};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{D as t,E as n,F as r,G as i,H as a,K as o,L as s,O as c,Q as l,R as u,St as d,T as f,U as p,W as m,X as h,Z as g,dt as _,et as v,ft as ee,gt as y,ht as b,k as te,m as x,mt as ne,pt as re,q as ie,vt as S,w as C}from"./index-D8_nS8Kw.js";var w=e(d(),1),T=b(),ae=`https://docs.github.com/en/actions`,E=5e3,D=(e,t)=>c.t(`common:githubActions.${e}`,t),O=e=>D(`status.${e}`),k=e=>e?D(`conclusion.${e}`):null,A=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`,j=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`,M=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`},N=e=>e.status===`completed`?k(e.conclusion)??D(`status.completed`):O(e.status),P=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},F=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,a=t?.dispatchable??!0,o=i&&a&&!t?.isLoading,c=e.path.split(`/`).pop();return(0,T.jsxs)(`div`,{className:l(`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,T.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,T.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:c}),(0,T.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,i?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:D(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,T.jsxs)(g,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!o,"aria-label":D(`workflows.runAriaLabel`,{name:e.name}),title:!a&&t?D(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}):(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),(0,T.jsx)(`span`,{children:D(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:t,refValue:n,onRefChange:i,values:o,onValueChange:c,isDispatching:l,onDispatch:d,onCancel:f})=>{let m=t.inputs.filter(e=>e.required&&!L(o[e.name],e)),h=t.dispatchable&&!t.isLoading&&!t.error&&n.trim()!==``&&m.length===0&&!l;return(0,T.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`inputs.title`)}),(0,T.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,T.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":D(`actions.cancel`),onClick:f,children:(0,T.jsx)(r,{className:`h-4 w-4`})})]}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(a,{htmlFor:`github-actions-ref`,children:D(`inputs.refLabel`)}),(0,T.jsx)(p,{id:`github-actions-ref`,type:`text`,value:n,onChange:e=>{i(e.target.value)},placeholder:D(`inputs.refPlaceholder`),"aria-label":D(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,T.jsx)(`span`,{children:D(`inputs.loading`)})]}),t.error&&(0,T.jsx)(`p`,{className:`text-xs text-rose-200`,children:t.error}),!t.dispatchable&&!t.isLoading&&!t.error&&(0,T.jsx)(`p`,{className:`text-xs text-amber-200`,children:D(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,T.jsx)(R,{input:e,value:o[e.name],onChange:t=>{c(e.name,t)}},e.name)),m.length>0&&(0,T.jsx)(`p`,{className:`text-xs text-rose-200`,children:D(`inputs.requiredValidationError`)}),(0,T.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,T.jsx)(g,{type:`button`,variant:`ghost`,onClick:f,disabled:l,children:D(`actions.cancel`)}),(0,T.jsxs)(g,{type:`button`,variant:`success`,onClick:d,disabled:!h,children:[l?(0,T.jsx)(u,{className:`h-4 w-4 animate-spin`}):(0,T.jsx)(s,{className:`h-4 w-4`}),(0,T.jsx)(`span`,{children:D(`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,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(a,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:e.name}),e.required&&(0,T.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:D(`inputs.requiredLabel`)})]}),e.description&&(0,T.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,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(x,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(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,T.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,T.jsx)(`option`,{value:``,children:D(`inputs.selectPlaceholder`)}),i.map(e=>(0,T.jsx)(`option`,{value:e,children:e},e))]})}return(0,T.jsx)(p,{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,T.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(t)),children:t.status===`completed`?k(t.conclusion)??D(`status.completed`):O(t.status)}),(0,T.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=M(e),n=N(e);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,A(e)),children:n})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,T.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,T.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:[D(`actions.openOnGithub`),(0,T.jsx)(f,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,T.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,T.jsxs)(`div`,{className:`mt-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,A(e)),children:e.status===`completed`?k(e.conclusion)??D(`status.completed`):O(e.status)}),(0,T.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,T.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??D(`runs.trackingState.${e.state}`);return(0,T.jsxs)(`div`,{className:l(`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,T.jsx)(u,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`span`,{className:l(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,T.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??D(`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:a,onClose:s})=>{let[c,l]=(0,w.useState)([]),[d,p]=(0,w.useState)(!0),[b,x]=(0,w.useState)(null),[C,O]=(0,w.useState)([]),[k,A]=(0,w.useState)([]),[j,M]=(0,w.useState)({}),[N,L]=(0,w.useState)(null),[R,z]=(0,w.useState)(!1),[B]=(0,w.useState)(()=>se(a)),W=(0,w.useRef)({}),G=(0,w.useRef)({}),K=(0,w.useRef)(null),q=(0,w.useRef)(!1),J=(0,w.useRef)(0),Y=(0,w.useRef)(new Map),X=(0,w.useCallback)(async t=>{M(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 ee(e,t.id,t.path);return M(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return M(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof y?e.message:D(`workflows.loadError`)}})),null}},[e]),Z=(0,w.useCallback)(async()=>{p(!0),x(null);try{let t=await ne(e);l(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){x(e instanceof y?e.message:D(`workflows.loadError`))}finally{p(!1)}},[X,e]),Q=(0,w.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await re(e,t);O(e=>U(e,r.runs)),A(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){S(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,w.useEffect)(()=>{Z()},[Z]),(0,w.useEffect)(()=>{let e=new AbortController,n=()=>{document.visibilityState===`visible`&&Q(e.signal)};n();let r=window.setInterval(n,E),i=t(n);return()=>{e.abort(),window.clearInterval(r),i()}},[Q]);let ce=(0,w.useCallback)(async e=>{if(N?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=j[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:P(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:P(n.inputs)})},[B.ref,j,X,N]),le=(0,w.useCallback)(async()=>{if(!N)return;let t=j[N.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=N.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 _(e,N.workflow.id,{ref:N.ref,workflowName:N.workflow.name,workflowUrl:N.workflow.url,inputs:n}),v.success(D(`messages.dispatched`)),L(null),Q()}catch(e){v.error(e instanceof y?e.message:D(`messages.dispatchError`))}finally{z(!1)}},[j,Q,e,N]);(0,w.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),A(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&O(e=>U(e,[t.run])))};return n.on(`github-actions:updated`,t),()=>{n.off(`github-actions:updated`,t)}},[e]),(0,w.useEffect)(()=>{let e=N?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[N?.workflow.id]);let $=(0,w.useMemo)(()=>[...C].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}),[C]);return(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||s()},children:(0,T.jsxs)(o,{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,T.jsx)(h,{className:`sr-only`,children:D(`dialog.srTitle`)}),(0,T.jsx)(ie,{className:`sr-only`,children:D(`dialog.srDescription`)}),(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.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,T.jsx)(te,{className:`h-5 w-5`})}),(0,T.jsx)(`div`,{children:(0,T.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:D(`dialog.title`)})})]}),(0,T.jsx)(i,{asChild:!0,children:(0,T.jsx)(g,{type:`button`,"aria-label":D(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,T.jsx)(r,{className:`h-4 w-4`})})})]}),(0,T.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,T.jsxs)(`aside`,{"aria-label":D(`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,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`workflows.title`)}),(0,T.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:D(`actions.refresh`)})]}),d&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,T.jsx)(`span`,{children:D(`workflows.loading`)})]}),b&&(0,T.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:b}),!d&&c.length===0&&!b&&(0,T.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,T.jsx)(`p`,{children:D(`workflows.empty`)}),(0,T.jsx)(`p`,{className:`mt-1`,children:D(`workflows.emptyHint`)}),(0,T.jsxs)(`a`,{href:ae,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[D(`workflows.docsLink`),(0,T.jsx)(f,{className:`h-3 w-3`})]})]}),(0,T.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>{let t=N?.workflow.id===e.id;return(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,T.jsx)(F,{workflow:e,inputsState:j[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&N&&(0,T.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,T.jsx)(I,{workflow:e,inputsState:j[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:N.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:N.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`runs.title`)}),k.map(e=>(0,T.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,T.jsx)(V,{run:e},e.id)),$.length===0&&k.length===0&&(0,T.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:D(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{D as t,E as n,F as r,G as i,H as a,K as o,L as s,O as c,Q as l,R as u,St as d,T as f,U as p,W as m,X as h,Z as g,dt as _,et as v,ft as ee,gt as y,ht as b,k as te,m as x,mt as ne,pt as re,q as ie,vt as S,w as C}from"./index-DXJSLf4W.js";var w=e(d(),1),T=b(),ae=`https://docs.github.com/en/actions`,E=5e3,D=(e,t)=>c.t(`common:githubActions.${e}`,t),O=e=>D(`status.${e}`),k=e=>e?D(`conclusion.${e}`):null,A=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`,j=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`,M=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`},N=e=>e.status===`completed`?k(e.conclusion)??D(`status.completed`):O(e.status),P=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},F=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,a=t?.dispatchable??!0,o=i&&a&&!t?.isLoading,c=e.path.split(`/`).pop();return(0,T.jsxs)(`div`,{className:l(`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,T.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,T.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:c}),(0,T.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,i?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:D(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,T.jsxs)(g,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!o,"aria-label":D(`workflows.runAriaLabel`,{name:e.name}),title:!a&&t?D(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}):(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),(0,T.jsx)(`span`,{children:D(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:t,refValue:n,onRefChange:i,values:o,onValueChange:c,isDispatching:l,onDispatch:d,onCancel:f})=>{let m=t.inputs.filter(e=>e.required&&!L(o[e.name],e)),h=t.dispatchable&&!t.isLoading&&!t.error&&n.trim()!==``&&m.length===0&&!l;return(0,T.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`inputs.title`)}),(0,T.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,T.jsx)(g,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":D(`actions.cancel`),onClick:f,children:(0,T.jsx)(r,{className:`h-4 w-4`})})]}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(a,{htmlFor:`github-actions-ref`,children:D(`inputs.refLabel`)}),(0,T.jsx)(p,{id:`github-actions-ref`,type:`text`,value:n,onChange:e=>{i(e.target.value)},placeholder:D(`inputs.refPlaceholder`),"aria-label":D(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,T.jsx)(`span`,{children:D(`inputs.loading`)})]}),t.error&&(0,T.jsx)(`p`,{className:`text-xs text-rose-200`,children:t.error}),!t.dispatchable&&!t.isLoading&&!t.error&&(0,T.jsx)(`p`,{className:`text-xs text-amber-200`,children:D(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,T.jsx)(R,{input:e,value:o[e.name],onChange:t=>{c(e.name,t)}},e.name)),m.length>0&&(0,T.jsx)(`p`,{className:`text-xs text-rose-200`,children:D(`inputs.requiredValidationError`)}),(0,T.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,T.jsx)(g,{type:`button`,variant:`ghost`,onClick:f,disabled:l,children:D(`actions.cancel`)}),(0,T.jsxs)(g,{type:`button`,variant:`success`,onClick:d,disabled:!h,children:[l?(0,T.jsx)(u,{className:`h-4 w-4 animate-spin`}):(0,T.jsx)(s,{className:`h-4 w-4`}),(0,T.jsx)(`span`,{children:D(`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,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(a,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:e.name}),e.required&&(0,T.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:D(`inputs.requiredLabel`)})]}),e.description&&(0,T.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,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(x,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(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,T.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,T.jsx)(`option`,{value:``,children:D(`inputs.selectPlaceholder`)}),i.map(e=>(0,T.jsx)(`option`,{value:e,children:e},e))]})}return(0,T.jsx)(p,{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,T.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(t)),children:t.status===`completed`?k(t.conclusion)??D(`status.completed`):O(t.status)}),(0,T.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=M(e),n=N(e);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,A(e)),children:n})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,T.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,T.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:[D(`actions.openOnGithub`),(0,T.jsx)(f,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,T.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,T.jsxs)(`div`,{className:`mt-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(C,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,A(e)),children:e.status===`completed`?k(e.conclusion)??D(`status.completed`):O(e.status)}),(0,T.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,T.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??D(`runs.trackingState.${e.state}`);return(0,T.jsxs)(`div`,{className:l(`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,T.jsx)(u,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`span`,{className:l(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,T.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??D(`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:a,onClose:s})=>{let[c,l]=(0,w.useState)([]),[d,p]=(0,w.useState)(!0),[b,x]=(0,w.useState)(null),[C,O]=(0,w.useState)([]),[k,A]=(0,w.useState)([]),[j,M]=(0,w.useState)({}),[N,L]=(0,w.useState)(null),[R,z]=(0,w.useState)(!1),[B]=(0,w.useState)(()=>se(a)),W=(0,w.useRef)({}),G=(0,w.useRef)({}),K=(0,w.useRef)(null),q=(0,w.useRef)(!1),J=(0,w.useRef)(0),Y=(0,w.useRef)(new Map),X=(0,w.useCallback)(async t=>{M(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 ee(e,t.id,t.path);return M(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return M(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof y?e.message:D(`workflows.loadError`)}})),null}},[e]),Z=(0,w.useCallback)(async()=>{p(!0),x(null);try{let t=await ne(e);l(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){x(e instanceof y?e.message:D(`workflows.loadError`))}finally{p(!1)}},[X,e]),Q=(0,w.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await re(e,t);O(e=>U(e,r.runs)),A(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){S(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,w.useEffect)(()=>{Z()},[Z]),(0,w.useEffect)(()=>{let e=new AbortController,n=()=>{document.visibilityState===`visible`&&Q(e.signal)};n();let r=window.setInterval(n,E),i=t(n);return()=>{e.abort(),window.clearInterval(r),i()}},[Q]);let ce=(0,w.useCallback)(async e=>{if(N?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=j[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:P(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:P(n.inputs)})},[B.ref,j,X,N]),le=(0,w.useCallback)(async()=>{if(!N)return;let t=j[N.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=N.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 _(e,N.workflow.id,{ref:N.ref,workflowName:N.workflow.name,workflowUrl:N.workflow.url,inputs:n}),v.success(D(`messages.dispatched`)),L(null),Q()}catch(e){v.error(e instanceof y?e.message:D(`messages.dispatchError`))}finally{z(!1)}},[j,Q,e,N]);(0,w.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),A(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&O(e=>U(e,[t.run])))};return n.on(`github-actions:updated`,t),()=>{n.off(`github-actions:updated`,t)}},[e]),(0,w.useEffect)(()=>{let e=N?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[N?.workflow.id]);let $=(0,w.useMemo)(()=>[...C].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}),[C]);return(0,T.jsx)(m,{open:!0,onOpenChange:e=>{e||s()},children:(0,T.jsxs)(o,{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,T.jsx)(h,{className:`sr-only`,children:D(`dialog.srTitle`)}),(0,T.jsx)(ie,{className:`sr-only`,children:D(`dialog.srDescription`)}),(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.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,T.jsx)(te,{className:`h-5 w-5`})}),(0,T.jsx)(`div`,{children:(0,T.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:D(`dialog.title`)})})]}),(0,T.jsx)(i,{asChild:!0,children:(0,T.jsx)(g,{type:`button`,"aria-label":D(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,T.jsx)(r,{className:`h-4 w-4`})})})]}),(0,T.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,T.jsxs)(`aside`,{"aria-label":D(`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,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`workflows.title`)}),(0,T.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:D(`actions.refresh`)})]}),d&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),(0,T.jsx)(`span`,{children:D(`workflows.loading`)})]}),b&&(0,T.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:b}),!d&&c.length===0&&!b&&(0,T.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,T.jsx)(`p`,{children:D(`workflows.empty`)}),(0,T.jsx)(`p`,{className:`mt-1`,children:D(`workflows.emptyHint`)}),(0,T.jsxs)(`a`,{href:ae,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[D(`workflows.docsLink`),(0,T.jsx)(f,{className:`h-3 w-3`})]})]}),(0,T.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>{let t=N?.workflow.id===e.id;return(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,T.jsx)(F,{workflow:e,inputsState:j[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&N&&(0,T.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,T.jsx)(I,{workflow:e,inputsState:j[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:N.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:N.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,T.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:D(`runs.title`)}),k.map(e=>(0,T.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,T.jsx)(V,{run:e},e.id)),$.length===0&&k.length===0&&(0,T.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:D(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,B as r,C as i,E as a,F as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,St as v,U as y,V as b,W as ee,X as x,Y as S,Z as C,_ as te,_t as w,a as T,at as ne,b as E,bt as D,c as re,ct as ie,d as ae,f as O,g as k,gt as A,h as oe,ht as j,i as se,it as ce,j as le,l as ue,lt as de,n as fe,nt as pe,o as me,ot as he,p as ge,q as _e,rt as ve,s as M,st as ye,t as be,tt as xe,ut as Se,v as N,vt as P,w as F,x as Ce,xt as I,y as we,yt as Te,z as L}from"./index-D8_nS8Kw.js";var R=e(v(),1),z=j(),B=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}`},V=[`error`,`warning`,`info`,`unknown`],H=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},U=({counts:e,totalCount:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=V.filter(t=>e[t]>0);return(0,z.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,z.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,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},W=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:a,onSelectedTicketChange:o})=>{let{t:s}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),c=e.currency??`unavailable`;return(0,z.jsxs)(Ce,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,z.jsx)(i,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":s(`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,z.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:s(`technicalDetails`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:s(`technicalDetailsHint`)}),(0,z.jsx)(b,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsxs)(_,{className:`border-t border-border/60 px-3 py-3`,children:[(0,z.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`parser.${t.parser_kind}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserStateLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`state.${t.status}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`retentionState.${t.retention_state}`)})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`outputRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`retentionState.${e.output_retention_state}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`applicabilityLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`applicability`,{state:s(`applicabilityState.${c}`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`sourceLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`destinationTitle`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`destination.${n.destination}`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:s(`destinationHint`)})]})]}),r&&n&&(0,z.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[s(`ticketLabel`),(0,z.jsxs)(`select`,{value:a,onChange:e=>o(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,z.jsx)(`option`,{value:``,children:s(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},Ee=({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??[],y=H(v),b=!!(l&&!l.terminal_reason),ee=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`),te=!!(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,E=a.size>=8&&!a.has(e.execution_run_id),D=ne?h(`diagnosticLimit`,{count:32}):E?h(`attemptLimit`,{count:8}):null,re=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),ie=T+i.size,ae=ie>0&&(!re||o!==``),O=n&&!n.eligibility.eligible?h(`disabled.${n.eligibility.reason}`):null,k=_&&t&&(_.status===`interrupted`||v.length===0&&[`unsupported`,`malformed`].includes(_.status))?_.status:null,A=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count===0),oe=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count>0),j=_?.diagnostic_count??v.length;return(0,z.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,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:h(`title`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:_&&_.status===`pending`?h(`loading`):_&&j>0?oe||_.retention_state===`expired`?h(`totalAvailable`,{count:j}):h(`availableCount`,{count:j}):h(t?`noneAvailable`:`loading`)}),(0,z.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,z.jsx)(U,{counts:y,totalCount:j})]})}),_?.retention_state===`expired`&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`expired`)}),_?.truncated&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`truncated`)}),k&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`fallback.${k}`)}),A&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`noStructuredDiagnostics`)}),oe&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`structuredDetailsUnavailable`)}),te&&(0,z.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,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":h(`rawOutputSelect`),checked:w,disabled:x||!w&&E,onChange:e=>f(e.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:h(`rawOutputSelect`)}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(`rawOutputHint`)}),e.retained_start_offset>0&&(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:h(`rawOutputTruncated`)})]})]}),t&&v.length>0&&(0,z.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,z.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:h(`selectLegend`)}),(0,z.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>{let t=B(e),n=r.has(e.id);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!S||x||!n&&D!==null,onChange:t=>d(e.id,t.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:h(`severity.${e.severity}`)}),e.code&&(0,z.jsx)(`code`,{children:e.code})]}),(0,z.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,z.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),O&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:O}),D&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),c&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:h(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),l&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,role:`status`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:l.terminal_reason?h(`autoFix.terminal.${l.terminal_reason}`):ee?.fallback_used?h(`autoFix.phase.fallback`):h(`autoFix.phase.${l.phase}`)}),!l.terminal_reason&&l.attempt_count>0&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:h(`autoFix.attempt`,{current:l.attempt_count,total:l.max_attempts})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h(`selectedEvidence`,{count:ie})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(C,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!ae||s||x,title:O??void 0,onClick:p,children:s?h(`starting`):h(`repairSelectedEvidence`,{count:ie})}),x&&(0,z.jsx)(C,{type:`button`,variant:`destructive`,size:`sm`,disabled:s||l?.phase===`stopping`,onClick:m,children:h(b?`autoFix.stop`:`stopRepair`)})]})]}),(0,z.jsx)(W,{attempt:e,parser:_,repair:n,ticketRequired:re,selectedTicketId:o,onSelectedTicketChange:u})]})},G=({attempt:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?se(e.retained_output):``;return(0,z.jsxs)(ge,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,z.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,z.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,z.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,z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},K=({definition:e,policy:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog`});return(0,z.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,z.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,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},De=({attempt:e,batch:t,definition:n,diagnostics:r,repair:i,selectedDiagnosticIds:a,selectedRawOutputAttemptRunIds:o,selectedAttemptRunIds:s,selectedTicketId:c,pending:l,activeRepair:u,autoFix:d,onSelectedTicketChange:f,onToggleDiagnostic:p,onToggleRawOutput:m,onStartRepair:h,onStopRepair:g,policy:_,projectId:v})=>{let{t:y}=I(`common`,{keyPrefix:`checksDialog`}),{t:b}=I(`common`,{keyPrefix:`activityView`}),ee=t?ae(t,e):null;return e?(0,z.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:y(`status.${e.execution_status}`)})]}),e.outcome&&(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:y(`outcomeValue.${e.outcome}`)})]}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??y(`targetRoot`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`outcome`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?y(`outcomeValue.${e.outcome}`):y(`status.${e.execution_status}`)})]}),e.currency&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`currencyLabel`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:b(`currency.${e.currency}`)})]}),_&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[y(_.required?`required`:`optional`),` · `,y(_.preReview?`preReview`:`finalOnly`)]})]})]}),ee&&(0,z.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-xl border border-border/60 bg-background/30 p-3`,children:[(0,z.jsx)(O,{evidence:ee}),(0,z.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.placement?y(`environment.attemptPlacementRecorded`,{target:e.placement.targetKey}):y(`environment.attemptPlacementPending`)})]}),(0,z.jsx)(M,{projectId:v,executionRunId:e.execution_run_id}),e.execution_status===`failed`&&(0,z.jsx)(Ee,{attempt:e,diagnostics:r,repair:i,selectedDiagnosticIds:a,selectedRawOutputAttemptRunIds:o,selectedAttemptRunIds:s,selectedTicketId:c,pending:l,activeRepair:u,autoFix:d,onSelectedTicketChange:f,onToggleDiagnostic:p,onToggleRawOutput:m,onStartRepair:h,onStopRepair:g}),(0,z.jsx)(G,{attempt:e},e.execution_run_id)]}):n?(0,z.jsx)(K,{definition:n,policy:_}):(0,z.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,z.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:y(`selectAttemptTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:y(`selectAttemptDescription`)})]})},q={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`},Oe=(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`,ke=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,Ae=({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,z.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?q.current:q.blocked),children:t(n)})]}),(0,z.jsx)(ge,{title:t(`gateDetails`),children:(0,z.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:t(`gateScope`)}),(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,z.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,z.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,z.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(ke(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,z.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Oe(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,z.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2 py-1 text-xs`,q[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,z.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},je=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`,Me=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,Ne=(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),Pe=({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)),g=[...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,z.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,z.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,z.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,z.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,z.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:g.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?Ne(t,o,s,c):0,g=f.has(e.id),_=p.has(e.id),v=`${d(`category.${e.category}`)} · ${d(g?`required`:`optional`)} · ${d(_?`preReview`:`finalOnly`)}`;return(0,z.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,z.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,z.jsxs)(`button`,{type:`button`,className:h(`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(Me(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,je(t)),children:d(Me(t))})]}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:v}),m>0&&(0,z.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,z.jsxs)(`button`,{type:`button`,className:h(`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,z.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:v})]})]})},t?.execution_run_id??e.id)})})})]})},Fe=(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},Ie=new Set([`queued`,`running`,`waiting`]),Le=75,Re=32,ze=64,Be=3,Ve=32,He=8,J=(e,t)=>e instanceof A?e.message:t,Ue=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)))},We=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),Ge=({projectId:e,targetKind:t,targetBundleId:n,definitions:r,requiredDefinitionIds:i=[],preReviewDefinitionIds:a=[],gateEvaluationId:o=null,directBatchRunId:s=null,directAttemptRunId:c=null,onSelectionChange:l,onUnavailable:u,onStatusChange:d})=>{let{t:f}=I(`common`,{keyPrefix:`checksDialog`}),p=ue(),[m,h]=(0,R.useState)(()=>new Set(r.map(e=>e.id))),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,ee]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),[te,w]=(0,R.useState)(!0),[E,D]=(0,R.useState)(null),[k,oe]=(0,R.useState)(null),[j,se]=(0,R.useState)(new Set),[le,fe]=(0,R.useState)(new Set),[ge,_e]=(0,R.useState)(``),[M,be]=(0,R.useState)(null),[N,F]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(0),[Te,L]=(0,R.useState)(null),B=(0,R.useRef)(g),V=(0,R.useRef)(null),H=(0,R.useRef)(new Set),U=(0,R.useRef)(new Map),W=(0,R.useRef)(0),Ee=(0,R.useRef)(0),G=(0,R.useRef)(null),K=(0,R.useRef)(!1),q=(0,R.useRef)(!0),Oe=(0,R.useRef)(null),ke=(0,R.useRef)(`automatic`),je=(0,R.useRef)(null),Me=(0,R.useRef)(async()=>void 0),Ne=(0,R.useRef)(async()=>void 0),Ge=(0,R.useRef)(()=>void 0),Ke=(0,R.useRef)(0),qe=(0,R.useRef)(k);B.current=g,qe.current=k,q.current=te||E!==null;let Y=(0,R.useCallback)((e,t)=>{Oe.current=e,ke.current=t,ee(e)},[]),Je=(0,R.useCallback)(e=>{oe(e),be(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),se(t=>{let n=Ue(e);return new Set([...t].filter(e=>n.has(e)))}),fe(t=>{let n=We(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&&Y(Fe(t.attempts,e)?.execution_run_id??null,`automatic`)},[Y]),Ye=(0,R.useCallback)(e=>{let t=U.current;if(!t.has(e.attempt_run_id)&&t.size>=Re){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(-(ze-1)),e])},[]),Xe=(0,R.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 U.current.keys())a.has(e)||(U.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=U.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=me(T(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),U.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};G.current=e.batch.execution_run_id,B.current=s,_(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,d=Oe.current,p=ke.current,m=!!(d&&s.attempts.some(e=>e.execution_run_id===d)),h=Fe(s.attempts,qe.current?.batch_run_id===s.batch.execution_run_id?qe.current:null),g=je.current,v=!!(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`)Y(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(v)Y(c.execution_run_id,`manual`);else if(y&&p===`manual`)Y(m?d:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=p!==`external`||d!==c.execution_run_id;Y(c.execution_run_id,`external`),e&&l?.(s.batch.execution_run_id,c.execution_run_id)}else v||y?p===`manual`&&m?Y(d,`manual`):Y(h?.execution_run_id??null,`automatic`):(Y(t,`external`),u?.());else n===`preserve`?p===`external`&&d?m?Y(d,`external`):(Y(d,`external`),u?.()):p===`manual`&&m?Y(d,`manual`):Y(p===`automatic`&&m?d:h?.execution_run_id??null,`automatic`):p===`manual`&&m?Y(d,`manual`):Y(h?.execution_run_id??null,`automatic`);i?Ge.current(e.batch.execution_run_id):Ke.current=0,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))},[l,u,f,Y]),X=(0,R.useCallback)(async(t,n)=>{let r=++W.current,i=await xe(e,t,n);if(r!==W.current||i.batch.execution_run_id!==t||G.current!==null&&G.current!==t){i.batch.execution_run_id!==t&&u?.();return}Xe(i,t===s?c:null)},[c,s,Xe,u,e]);Me.current=X,Ge.current=(0,R.useCallback)(e=>{if(V.current)return;if(Ke.current>=Be){Ke.current=0,H.current.clear(),U.current.clear();return}let t=Le*2**Ke.current;V.current=setTimeout(()=>{V.current=null,Ke.current+=1,Me.current(e).catch(t=>{L(J(t,f(`errors.load`))),H.current.size>0&&Ge.current(e)})},t)},[f]);let Ze=(0,R.useCallback)(async r=>{let i=++W.current,a=await ne(e,t,n,r);if(i===W.current){if(a.batch_run_id){G.current=a.batch_run_id,await X(a.batch_run_id,r);return}!r?.aborted&&i===W.current&&(G.current=null,B.current=null,_(null),Y(null,`automatic`))}},[X,e,n,t,Y]),Z=(0,R.useCallback)(async()=>{if(o||s){let e=G.current;e&&await X(e);return}await Ze()},[s,o,X,Ze]);Ne.current=Z;let Qe=(0,R.useCallback)(e=>{V.current||=setTimeout(()=>{V.current=null,X(e).catch(e=>L(J(e,f(`errors.load`))))},Le)},[X,f]);(0,R.useEffect)(()=>{let t=new AbortController;return w(!0),L(null),(async()=>{if(s){if(y(null),c){let n=await re(e,c,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!==s){u?.();return}}G.current=s,await X(s,t.signal);return}if(!o){y(null),await Ze(t.signal);return}let n=await ve(e,o,t.signal);if(y(n),n.sourceBatchRunId){G.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}G.current=null,B.current=null,_(null),Y(null,`automatic`)})().catch(e=>{P(e)||(e instanceof A&&e.status===404&&u?.(),L(J(e,f(`errors.load`))))}).finally(()=>{t.signal.aborted||(w(!1),q.current=!1,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le)))}),()=>t.abort()},[c,s,o,X,Ze,u,e,f,Y]),(0,R.useEffect)(()=>{let t=g?.batch.execution_run_id;if(!t){Ee.current+=1,oe(null),se(new Set),fe(new Set),_e(``),be(null);return}qe.current?.batch_run_id!==t&&(oe(null),se(new Set),fe(new Set),_e(``),be(null));let n=++Ee.current,r=new AbortController;return pe(e,t,r.signal).then(e=>{n===Ee.current&&e.batch_run_id===t&&G.current===t&&Je(e)}).catch(e=>{P(e)||L(J(e,f(`errors.diagnostics`)))}),()=>r.abort()},[g?.batch.execution_run_id,Ce,Je,e,f]),(0,R.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)){Ye(t),r&&H.current.has(t.attempt_run_id)&&Ge.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){Ye(t),Qe(r.batch.execution_run_id);return}let a=r.attempts[i],o=me(T(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){H.current.add(t.attempt_run_id),Ye(t),Ge.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,_(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(q.current){K.current=!0;return}let n=B.current,r=t.execution_run_id??t.id;if(we(e=>e+1),M&&r===M.execution_run_id&&M.source_batch_run_id===G.current&&ce(e,M.execution_run_id).then(be).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){W.current+=1,Qe(n.batch.execution_run_id);return}K.current=!0,!q.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))},r=()=>{we(e=>e+1),Z().catch(e=>L(J(e,f(`errors.load`))))};return p.on(`check-attempt:output`,t),p.on(`execution-run:updated`,n),p.on(`lifecycle-event:created`,n),p.on(`connect`,r),()=>{p.off(`check-attempt:output`,t),p.off(`execution-run:updated`,n),p.off(`lifecycle-event:created`,n),p.off(`connect`,r)}},[M,Ye,e,Z,Qe,p,f]),(0,R.useEffect)(()=>()=>{V.current&&clearTimeout(V.current),H.current.clear(),U.current.clear()},[]);let $e=(e,t)=>{W.current+=1,G.current=e.batch.execution_run_id,Xe(e,null,t)},et=async(e,t)=>{W.current+=1,q.current=!0,D(e),L(null);try{let n=await t();e!==`stop`&&(je.current=null),$e(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&l?.(n.batch.execution_run_id,void 0)}catch(t){L(J(t,f(`errors.${e}`))),t instanceof A&&t.status===409&&await Z().catch(()=>void 0)}finally{D(null),q.current=te,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))}},tt=g?Ie.has(g.batch.execution_status):!1,nt=g?tt?`running`:g.batch.execution_status===`completed`?`finished`:g.batch.execution_status===`cancelled`||g.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,rt=g?.batch.execution_run_id??null,Q=k?.batch_run_id===rt?k:null,it=M?.source_batch_run_id===rt?M:null,$=Q?.auto_fix??null,at=!!($&&!$.terminal_reason),ot=Q?Ue(Q):new Set,st=Q?We(Q):new Set,ct=new Set([...j].filter(e=>ot.has(e))),lt=new Set([...le].filter(e=>st.has(e))),ut=[...m],dt=g?.attempts.filter(e=>e.execution_status!==`completed`).length??0,ft=async()=>{let t=[...ct],n=[...lt];if(!(!Q||!rt||G.current!==rt||Q.repair.eligibility.eligible!==!0||it?.terminal_result===null||$&&!$.terminal_reason||t.length===0&&n.length===0)){F(!0),L(null);try{let r=await ie(e,t,n,Q.repair.accepts_ticket_id?Q.repair.candidate_tickets.some(e=>e.id===ge)?ge:Q.repair.candidate_tickets[0]?.id||null:null);be(r.source_batch_run_id===rt?r:null)}catch(t){if(L(J(t,f(`errors.repair`))),t instanceof A&&t.status===409&&g){let t=g.batch.execution_run_id,n=++Ee.current;pe(e,t).then(e=>{n===Ee.current&&e.batch_run_id===t&&G.current===t&&Je(e)}).catch(()=>void 0)}}finally{F(!1)}}},pt=async()=>{let t=$&&!$.terminal_reason?$.execution_run_id:it?.execution_run_id;if(t){F(!0),L(null);try{let n=await Se(e,t);`source_batch_run_id`in n&&be(n),we(e=>e+1)}catch(e){L(J(e,f(`errors.repairStop`)))}finally{F(!1)}}},mt=new Set([...Q?.attempts.filter(e=>e.diagnostics.some(e=>ct.has(e.id))).map(e=>e.attempt_run_id)??[],...lt]),ht=(e,t,n)=>{se(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=Ve||!Q||!ot.has(t))return r;let a=new Set(Q.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=He?r:(i.add(t),i)})},gt=(e,t)=>{fe(n=>{let r=new Set(n);return t?!mt.has(e)&&mt.size>=He||!st.has(e)?n:(r.add(e),r):(r.delete(e),r)})},_t=(e,t)=>{h(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},vt=e=>{g&&(S(null),je.current={batchRunId:g.batch.execution_run_id,attemptRunId:e,previousBatchRunId:s===g.batch.execution_run_id?s:null,previousAttemptRunId:s===g.batch.execution_run_id?c:null},Y(e,`manual`),l?.(g.batch.execution_run_id,e))},yt=e=>{let t=g?.attempts.find(t=>t.definition_id===e);if(t){vt(t.execution_run_id);return}S(e)},bt=x?g?.attempts.find(e=>e.definition_id===x)??null:g?.attempts.find(e=>e.execution_run_id===b)??null,xt=bt?.command_snapshot??r.find(e=>e.id===x)??null,St=x??bt?.definition_id??null,Ct=xt?{required:i.includes(xt.id),preReview:a.includes(xt.id)}:null,wt=g?ae(g.batch):null,Tt=g?g.batch.running_count+g.batch.queued_count:0;return(0,R.useEffect)(()=>{d?.(nt)},[nt,d]),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Te&&(0,z.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:Te}),(0,z.jsxs)(`div`,{role:`toolbar`,"aria-label":f(`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,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:f(`runActions`)})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(C,{type:`button`,size:`sm`,disabled:ut.length===0||tt||at||E!==null,onClick:()=>void et(`run`,()=>ye(e,{targetKind:t,targetBundleId:n,definitionIds:ut})),children:f(E===`run`?`starting`:`runSelected`)}),g&&tt&&(0,z.jsx)(C,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null||N,onClick:()=>void(at?pt():et(`stop`,()=>de(e,g.batch.execution_run_id))),children:f(E===`stop`||N?`stopping`:`stop`)}),g&&!tt&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{type:`button`,variant:`outline`,size:`xs`,disabled:at||E!==null,onClick:()=>void et(`rerun`,()=>he(e,g.batch.execution_run_id,{mode:`all`})),children:f(`rerunAll`)}),(0,z.jsx)(C,{type:`button`,variant:`outline`,size:`xs`,disabled:at||E!==null||dt===0,onClick:()=>void et(`rerun`,()=>he(e,g.batch.execution_run_id,{mode:`failed_only`})),children:f(`rerunFailed`)})]})]})]}),(0,z.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,z.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,z.jsx)(Pe,{definitions:r,attempts:g?.attempts??[],requiredDefinitionIds:i,preReviewDefinitionIds:a,selectedDefinitionIds:m,selectedCheckId:St,diagnostics:Q,selectedDiagnosticIds:ct,selectedRawOutputAttemptRunIds:lt,onToggleDefinition:_t,onSelectCheck:yt})}),(0,z.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[o&&!v&&te&&(0,z.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:f(`gateLoading`)}),v&&(0,z.jsx)(Ae,{evaluation:v}),te&&(0,z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:f(`loading`)}),!te&&!g&&!xt&&(0,z.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-foreground`,children:f(`emptyTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:f(`emptyDescription`)})]}),g&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:f(`status.${g.batch.execution_status}`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f(`summary`,{passed:g.batch.passed_count,failed:g.batch.failed_count,running:g.batch.running_count,queued:g.batch.queued_count})}),g.batch.stop_requested&&(0,z.jsx)(`span`,{className:`text-xs text-amber-200`,children:f(`stopRequested`)}),wt&&(0,z.jsx)(O,{evidence:wt})]}),wt?.provider===`docker_sandbox`&&tt&&(0,z.jsxs)(`p`,{className:`mb-4 max-w-3xl text-xs text-amber-100`,children:[f(`environment.batchOwnership`,{count:Tt}),` `,f(`environment.wholeSandboxStop`)]})]}),(g||xt)&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(De,{projectId:e,attempt:bt,batch:g?.batch??null,definition:xt,diagnostics:Q?.attempts.find(e=>e.attempt_run_id===bt?.execution_run_id)??null,repair:Q?.repair??null,selectedDiagnosticIds:ct,selectedRawOutputAttemptRunIds:lt,selectedAttemptRunIds:mt,selectedTicketId:ge,pending:N,activeRepair:it,autoFix:$,policy:Ct,onSelectedTicketChange:_e,onToggleDiagnostic:(e,t)=>bt&&ht(bt.execution_run_id,e,t),onToggleRawOutput:e=>bt&&gt(bt.execution_run_id,e),onStartRepair:()=>void ft(),onStopRepair:()=>void pt()})})]})]})]})},Ke=(e,t)=>D(w(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),qe=(e,t)=>D(w(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Y=(e,t={})=>D(w(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),Je=(e,t)=>D(w(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),Ye=e=>D(w(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),Xe=e=>Te(w(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),X=256*1024,Ze=24,Z=(e,t)=>p.t(`common:testsDialog.${e}`,t),Qe=(e,t)=>{let n=`${e}${t}`;return n.length<=X?n:n.slice(-X)},$e=(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,et=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=Ze,tt=e=>{e.scrollTop=e.scrollHeight},nt=(e,t=!1)=>{tt(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{tt(e),t&&(r=window.requestAnimationFrame(()=>{tt(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},rt=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`,Q=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`},it=e=>{let t=e.split(`/`);return t[t.length-1]||e},$=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),at=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),ot=(e,t)=>{let n=$(t);return n.length===0?e:e.flatMap(e=>{let t=it(e.path);if(at(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>at(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},st=e=>Z(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ct=e=>e?.selection?e.selection.kind===`all`?Z(`selection.allTests`):e.selection.kind===`case`?e.selection.name:it(e.selection.path):Z(`selection.noRunYet`),lt=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`,ut=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,dt=(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,ft=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,pt=({line:e,tone:t})=>(0,z.jsx)(`div`,{"data-tone":t,className:h(`whitespace-pre-wrap break-words`,ut(t)),children:e===``?` `:e}),mt=(0,R.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,z.jsxs)(`button`,{type:`button`,"aria-label":Z(`caseRow.runAriaLabel`,{name:r}),title:r,className:h(`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,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));mt.displayName=`TestCaseRow`;var ht=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:a,isExpanded:o,onRunCase:s,onRunFile:c,onToggleFile:l})=>{let u=e===`file`&&n===a.path,d=e===`case`&&n===a.path;return(0,z.jsx)(Ce,{open:o,onOpenChange:e=>{l(a.path,e)},children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(i,{asChild:!0,children:(0,z.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Z(o?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:a.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,z.jsx)(b,{className:h(`h-4 w-4 transition-transform`,o&&`rotate-180`)})})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Z(`fileRow.runAriaLabel`,{path:a.path}),className:h(`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`,(u||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{c(a.path)},children:(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,z.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,z.jsx)(L,{className:`h-3.5 w-3.5`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:it(a.path)}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:a.path})]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Z(`fileRow.testCount`,{count:a.cases.length})})]})]})})]}),(0,z.jsx)(_,{children:(0,z.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:a.cases.length===0?(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Z(`fileRow.noNamedTests`)}):(0,z.jsx)(`div`,{className:`space-y-1`,children:a.cases.map(i=>{let o=e===`case`&&n===a.path&&t===i.name;return(0,z.jsx)(mt,{canRunGranular:r,filePath:a.path,isActive:o,name:i.name,onRunCase:s},i.id)})})})})]})})});ht.displayName=`DiscoveryFileRow`;var gt=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:s,fullSuiteOnlyNotice:c,isLoading:l,selectedCommandId:u,selectedCommandName:p,sessionError:_,sessionStatus:v,shouldShowCommandSelector:ee,onRunCase:x,onRunFile:S,onSelectCommand:te,onToggleFile:w})=>{let[T,ne]=(0,R.useState)(``),E=(0,R.useMemo)(()=>ot(a,T),[a,T]),D=(0,R.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),re=$(T).length>0;return(0,z.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[ee&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Z(`scope.label`)}),(0,z.jsxs)(le,{children:[(0,z.jsx)(m,{asChild:!0,children:(0,z.jsxs)(C,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Z(`scope.selectedCommandAriaLabel`),disabled:r.length===0||v===`running`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:p??Z(`scope.selectTestScope`)}),(0,z.jsx)(b,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(d,{align:`start`,className:`w-72`,children:r.map(e=>(0,z.jsx)(f,{className:h(u===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{te(e.id)},children:(0,z.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),c&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:c}),(a.length>0||T.length>0)&&(0,z.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,z.jsx)(y,{type:`search`,value:T,onChange:e=>{ne(e.target.value)},placeholder:Z(`filter.placeholder`),"aria-label":Z(`filter.ariaLabel`),className:`pr-10`}),T.length>0&&(0,z.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Z(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{ne(``)},children:(0,z.jsx)(o,{className:`size-4`})})]}),!r.length&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Z(`discovery.noCommands`)}),_&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:_}),(0,z.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,z.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Z(`discovery.fileCount`,{count:E.length}),`, `,Z(`discovery.caseCount`,{count:D})]})}),l&&(0,z.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!l?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilesDetected`)}):E.length===0?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilterMatches`)}):E.map(r=>(0,z.jsx)(ht,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:re||(s[r.path]??!1),onRunCase:x,onRunFile:S,onToggleFile:w},r.path))})]})]})})});gt.displayName=`DiscoveryPane`;var _t=(0,R.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,R.useMemo)(()=>t?se(t).replace(/\r\n/g,`
1
+ import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,B as r,C as i,E as a,F as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,St as v,U as y,V as b,W as ee,X as x,Y as S,Z as C,_ as te,_t as w,a as T,at as ne,b as E,bt as D,c as re,ct as ie,d as ae,f as O,g as k,gt as A,h as oe,ht as j,i as se,it as ce,j as le,l as ue,lt as de,n as fe,nt as pe,o as me,ot as he,p as ge,q as _e,rt as ve,s as M,st as ye,t as be,tt as xe,ut as Se,v as N,vt as P,w as F,x as Ce,xt as I,y as we,yt as Te,z as L}from"./index-DXJSLf4W.js";var R=e(v(),1),z=j(),B=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}`},V=[`error`,`warning`,`info`,`unknown`],H=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},U=({counts:e,totalCount:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=V.filter(t=>e[t]>0);return(0,z.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,z.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,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},W=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:a,onSelectedTicketChange:o})=>{let{t:s}=I(`common`,{keyPrefix:`checksDialog.diagnostics`}),c=e.currency??`unavailable`;return(0,z.jsxs)(Ce,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,z.jsx)(i,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":s(`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,z.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:s(`technicalDetails`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:s(`technicalDetailsHint`)}),(0,z.jsx)(b,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsxs)(_,{className:`border-t border-border/60 px-3 py-3`,children:[(0,z.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`parser.${t.parser_kind}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserStateLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`state.${t.status}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`parserRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`retentionState.${t.retention_state}`)})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`outputRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`retentionState.${e.output_retention_state}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`applicabilityLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`applicability`,{state:s(`applicabilityState.${c}`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`sourceLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:s(`destinationTitle`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:s(`destination.${n.destination}`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:s(`destinationHint`)})]})]}),r&&n&&(0,z.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[s(`ticketLabel`),(0,z.jsxs)(`select`,{value:a,onChange:e=>o(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,z.jsx)(`option`,{value:``,children:s(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},Ee=({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??[],y=H(v),b=!!(l&&!l.terminal_reason),ee=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`),te=!!(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,E=a.size>=8&&!a.has(e.execution_run_id),D=ne?h(`diagnosticLimit`,{count:32}):E?h(`attemptLimit`,{count:8}):null,re=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),ie=T+i.size,ae=ie>0&&(!re||o!==``),O=n&&!n.eligibility.eligible?h(`disabled.${n.eligibility.reason}`):null,k=_&&t&&(_.status===`interrupted`||v.length===0&&[`unsupported`,`malformed`].includes(_.status))?_.status:null,A=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count===0),oe=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count>0),j=_?.diagnostic_count??v.length;return(0,z.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,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:h(`title`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:_&&_.status===`pending`?h(`loading`):_&&j>0?oe||_.retention_state===`expired`?h(`totalAvailable`,{count:j}):h(`availableCount`,{count:j}):h(t?`noneAvailable`:`loading`)}),(0,z.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,z.jsx)(U,{counts:y,totalCount:j})]})}),_?.retention_state===`expired`&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`expired`)}),_?.truncated&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`truncated`)}),k&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`fallback.${k}`)}),A&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`noStructuredDiagnostics`)}),oe&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`structuredDetailsUnavailable`)}),te&&(0,z.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,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":h(`rawOutputSelect`),checked:w,disabled:x||!w&&E,onChange:e=>f(e.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:h(`rawOutputSelect`)}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(`rawOutputHint`)}),e.retained_start_offset>0&&(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:h(`rawOutputTruncated`)})]})]}),t&&v.length>0&&(0,z.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,z.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:h(`selectLegend`)}),(0,z.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>{let t=B(e),n=r.has(e.id);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!S||x||!n&&D!==null,onChange:t=>d(e.id,t.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:h(`severity.${e.severity}`)}),e.code&&(0,z.jsx)(`code`,{children:e.code})]}),(0,z.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,z.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),O&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:O}),D&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),c&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:h(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),l&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,role:`status`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:l.terminal_reason?h(`autoFix.terminal.${l.terminal_reason}`):ee?.fallback_used?h(`autoFix.phase.fallback`):h(`autoFix.phase.${l.phase}`)}),!l.terminal_reason&&l.attempt_count>0&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:h(`autoFix.attempt`,{current:l.attempt_count,total:l.max_attempts})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h(`selectedEvidence`,{count:ie})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(C,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!ae||s||x,title:O??void 0,onClick:p,children:s?h(`starting`):h(`repairSelectedEvidence`,{count:ie})}),x&&(0,z.jsx)(C,{type:`button`,variant:`destructive`,size:`sm`,disabled:s||l?.phase===`stopping`,onClick:m,children:h(b?`autoFix.stop`:`stopRepair`)})]})]}),(0,z.jsx)(W,{attempt:e,parser:_,repair:n,ticketRequired:re,selectedTicketId:o,onSelectedTicketChange:u})]})},G=({attempt:e})=>{let{t}=I(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?se(e.retained_output):``;return(0,z.jsxs)(ge,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,z.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,z.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,z.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,z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},K=({definition:e,policy:t})=>{let{t:n}=I(`common`,{keyPrefix:`checksDialog`});return(0,z.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,z.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,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},De=({attempt:e,batch:t,definition:n,diagnostics:r,repair:i,selectedDiagnosticIds:a,selectedRawOutputAttemptRunIds:o,selectedAttemptRunIds:s,selectedTicketId:c,pending:l,activeRepair:u,autoFix:d,onSelectedTicketChange:f,onToggleDiagnostic:p,onToggleRawOutput:m,onStartRepair:h,onStopRepair:g,policy:_,projectId:v})=>{let{t:y}=I(`common`,{keyPrefix:`checksDialog`}),{t:b}=I(`common`,{keyPrefix:`activityView`}),ee=t?ae(t,e):null;return e?(0,z.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:y(`status.${e.execution_status}`)})]}),e.outcome&&(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:y(`outcomeValue.${e.outcome}`)})]}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??y(`targetRoot`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`outcome`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?y(`outcomeValue.${e.outcome}`):y(`status.${e.execution_status}`)})]}),e.currency&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`currencyLabel`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:b(`currency.${e.currency}`)})]}),_&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:y(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[y(_.required?`required`:`optional`),` · `,y(_.preReview?`preReview`:`finalOnly`)]})]})]}),ee&&(0,z.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-xl border border-border/60 bg-background/30 p-3`,children:[(0,z.jsx)(O,{evidence:ee}),(0,z.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:e.placement?y(`environment.attemptPlacementRecorded`,{target:e.placement.targetKey}):y(`environment.attemptPlacementPending`)})]}),(0,z.jsx)(M,{projectId:v,executionRunId:e.execution_run_id}),e.execution_status===`failed`&&(0,z.jsx)(Ee,{attempt:e,diagnostics:r,repair:i,selectedDiagnosticIds:a,selectedRawOutputAttemptRunIds:o,selectedAttemptRunIds:s,selectedTicketId:c,pending:l,activeRepair:u,autoFix:d,onSelectedTicketChange:f,onToggleDiagnostic:p,onToggleRawOutput:m,onStartRepair:h,onStopRepair:g}),(0,z.jsx)(G,{attempt:e},e.execution_run_id)]}):n?(0,z.jsx)(K,{definition:n,policy:_}):(0,z.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,z.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:y(`selectAttemptTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:y(`selectAttemptDescription`)})]})},q={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`},Oe=(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`,ke=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,Ae=({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,z.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?q.current:q.blocked),children:t(n)})]}),(0,z.jsx)(ge,{title:t(`gateDetails`),children:(0,z.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:t(`gateScope`)}),(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,z.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,z.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,z.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(ke(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,z.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Oe(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,z.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2 py-1 text-xs`,q[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,z.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},je=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`,Me=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,Ne=(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),Pe=({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)),g=[...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,z.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,z.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,z.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,z.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,z.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:g.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?Ne(t,o,s,c):0,g=f.has(e.id),_=p.has(e.id),v=`${d(`category.${e.category}`)} · ${d(g?`required`:`optional`)} · ${d(_?`preReview`:`finalOnly`)}`;return(0,z.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,z.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,z.jsxs)(`button`,{type:`button`,className:h(`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(Me(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,z.jsx)(`span`,{className:h(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,je(t)),children:d(Me(t))})]}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:v}),m>0&&(0,z.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,z.jsxs)(`button`,{type:`button`,className:h(`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,z.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:v})]})]})},t?.execution_run_id??e.id)})})})]})},Fe=(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},Ie=new Set([`queued`,`running`,`waiting`]),Le=75,Re=32,ze=64,Be=3,Ve=32,He=8,J=(e,t)=>e instanceof A?e.message:t,Ue=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)))},We=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),Ge=({projectId:e,targetKind:t,targetBundleId:n,definitions:r,requiredDefinitionIds:i=[],preReviewDefinitionIds:a=[],gateEvaluationId:o=null,directBatchRunId:s=null,directAttemptRunId:c=null,onSelectionChange:l,onUnavailable:u,onStatusChange:d})=>{let{t:f}=I(`common`,{keyPrefix:`checksDialog`}),p=ue(),[m,h]=(0,R.useState)(()=>new Set(r.map(e=>e.id))),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)(null),[b,ee]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),[te,w]=(0,R.useState)(!0),[E,D]=(0,R.useState)(null),[k,oe]=(0,R.useState)(null),[j,se]=(0,R.useState)(new Set),[le,fe]=(0,R.useState)(new Set),[ge,_e]=(0,R.useState)(``),[M,be]=(0,R.useState)(null),[N,F]=(0,R.useState)(!1),[Ce,we]=(0,R.useState)(0),[Te,L]=(0,R.useState)(null),B=(0,R.useRef)(g),V=(0,R.useRef)(null),H=(0,R.useRef)(new Set),U=(0,R.useRef)(new Map),W=(0,R.useRef)(0),Ee=(0,R.useRef)(0),G=(0,R.useRef)(null),K=(0,R.useRef)(!1),q=(0,R.useRef)(!0),Oe=(0,R.useRef)(null),ke=(0,R.useRef)(`automatic`),je=(0,R.useRef)(null),Me=(0,R.useRef)(async()=>void 0),Ne=(0,R.useRef)(async()=>void 0),Ge=(0,R.useRef)(()=>void 0),Ke=(0,R.useRef)(0),qe=(0,R.useRef)(k);B.current=g,qe.current=k,q.current=te||E!==null;let Y=(0,R.useCallback)((e,t)=>{Oe.current=e,ke.current=t,ee(e)},[]),Je=(0,R.useCallback)(e=>{oe(e),be(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),se(t=>{let n=Ue(e);return new Set([...t].filter(e=>n.has(e)))}),fe(t=>{let n=We(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&&Y(Fe(t.attempts,e)?.execution_run_id??null,`automatic`)},[Y]),Ye=(0,R.useCallback)(e=>{let t=U.current;if(!t.has(e.attempt_run_id)&&t.size>=Re){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(-(ze-1)),e])},[]),Xe=(0,R.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 U.current.keys())a.has(e)||(U.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=U.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=me(T(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),U.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};G.current=e.batch.execution_run_id,B.current=s,_(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,d=Oe.current,p=ke.current,m=!!(d&&s.attempts.some(e=>e.execution_run_id===d)),h=Fe(s.attempts,qe.current?.batch_run_id===s.batch.execution_run_id?qe.current:null),g=je.current,v=!!(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`)Y(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(v)Y(c.execution_run_id,`manual`);else if(y&&p===`manual`)Y(m?d:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=p!==`external`||d!==c.execution_run_id;Y(c.execution_run_id,`external`),e&&l?.(s.batch.execution_run_id,c.execution_run_id)}else v||y?p===`manual`&&m?Y(d,`manual`):Y(h?.execution_run_id??null,`automatic`):(Y(t,`external`),u?.());else n===`preserve`?p===`external`&&d?m?Y(d,`external`):(Y(d,`external`),u?.()):p===`manual`&&m?Y(d,`manual`):Y(p===`automatic`&&m?d:h?.execution_run_id??null,`automatic`):p===`manual`&&m?Y(d,`manual`):Y(h?.execution_run_id??null,`automatic`);i?Ge.current(e.batch.execution_run_id):Ke.current=0,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))},[l,u,f,Y]),X=(0,R.useCallback)(async(t,n)=>{let r=++W.current,i=await xe(e,t,n);if(r!==W.current||i.batch.execution_run_id!==t||G.current!==null&&G.current!==t){i.batch.execution_run_id!==t&&u?.();return}Xe(i,t===s?c:null)},[c,s,Xe,u,e]);Me.current=X,Ge.current=(0,R.useCallback)(e=>{if(V.current)return;if(Ke.current>=Be){Ke.current=0,H.current.clear(),U.current.clear();return}let t=Le*2**Ke.current;V.current=setTimeout(()=>{V.current=null,Ke.current+=1,Me.current(e).catch(t=>{L(J(t,f(`errors.load`))),H.current.size>0&&Ge.current(e)})},t)},[f]);let Ze=(0,R.useCallback)(async r=>{let i=++W.current,a=await ne(e,t,n,r);if(i===W.current){if(a.batch_run_id){G.current=a.batch_run_id,await X(a.batch_run_id,r);return}!r?.aborted&&i===W.current&&(G.current=null,B.current=null,_(null),Y(null,`automatic`))}},[X,e,n,t,Y]),Z=(0,R.useCallback)(async()=>{if(o||s){let e=G.current;e&&await X(e);return}await Ze()},[s,o,X,Ze]);Ne.current=Z;let Qe=(0,R.useCallback)(e=>{V.current||=setTimeout(()=>{V.current=null,X(e).catch(e=>L(J(e,f(`errors.load`))))},Le)},[X,f]);(0,R.useEffect)(()=>{let t=new AbortController;return w(!0),L(null),(async()=>{if(s){if(y(null),c){let n=await re(e,c,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!==s){u?.();return}}G.current=s,await X(s,t.signal);return}if(!o){y(null),await Ze(t.signal);return}let n=await ve(e,o,t.signal);if(y(n),n.sourceBatchRunId){G.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}G.current=null,B.current=null,_(null),Y(null,`automatic`)})().catch(e=>{P(e)||(e instanceof A&&e.status===404&&u?.(),L(J(e,f(`errors.load`))))}).finally(()=>{t.signal.aborted||(w(!1),q.current=!1,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le)))}),()=>t.abort()},[c,s,o,X,Ze,u,e,f,Y]),(0,R.useEffect)(()=>{let t=g?.batch.execution_run_id;if(!t){Ee.current+=1,oe(null),se(new Set),fe(new Set),_e(``),be(null);return}qe.current?.batch_run_id!==t&&(oe(null),se(new Set),fe(new Set),_e(``),be(null));let n=++Ee.current,r=new AbortController;return pe(e,t,r.signal).then(e=>{n===Ee.current&&e.batch_run_id===t&&G.current===t&&Je(e)}).catch(e=>{P(e)||L(J(e,f(`errors.diagnostics`)))}),()=>r.abort()},[g?.batch.execution_run_id,Ce,Je,e,f]),(0,R.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)){Ye(t),r&&H.current.has(t.attempt_run_id)&&Ge.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){Ye(t),Qe(r.batch.execution_run_id);return}let a=r.attempts[i],o=me(T(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){H.current.add(t.attempt_run_id),Ye(t),Ge.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,_(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(q.current){K.current=!0;return}let n=B.current,r=t.execution_run_id??t.id;if(we(e=>e+1),M&&r===M.execution_run_id&&M.source_batch_run_id===G.current&&ce(e,M.execution_run_id).then(be).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){W.current+=1,Qe(n.batch.execution_run_id);return}K.current=!0,!q.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))},r=()=>{we(e=>e+1),Z().catch(e=>L(J(e,f(`errors.load`))))};return p.on(`check-attempt:output`,t),p.on(`execution-run:updated`,n),p.on(`lifecycle-event:created`,n),p.on(`connect`,r),()=>{p.off(`check-attempt:output`,t),p.off(`execution-run:updated`,n),p.off(`lifecycle-event:created`,n),p.off(`connect`,r)}},[M,Ye,e,Z,Qe,p,f]),(0,R.useEffect)(()=>()=>{V.current&&clearTimeout(V.current),H.current.clear(),U.current.clear()},[]);let $e=(e,t)=>{W.current+=1,G.current=e.batch.execution_run_id,Xe(e,null,t)},et=async(e,t)=>{W.current+=1,q.current=!0,D(e),L(null);try{let n=await t();e!==`stop`&&(je.current=null),$e(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&l?.(n.batch.execution_run_id,void 0)}catch(t){L(J(t,f(`errors.${e}`))),t instanceof A&&t.status===409&&await Z().catch(()=>void 0)}finally{D(null),q.current=te,K.current&&!V.current&&(K.current=!1,V.current=setTimeout(()=>{V.current=null,Ne.current().catch(e=>L(J(e,f(`errors.load`))))},Le))}},tt=g?Ie.has(g.batch.execution_status):!1,nt=g?tt?`running`:g.batch.execution_status===`completed`?`finished`:g.batch.execution_status===`cancelled`||g.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,rt=g?.batch.execution_run_id??null,Q=k?.batch_run_id===rt?k:null,it=M?.source_batch_run_id===rt?M:null,$=Q?.auto_fix??null,at=!!($&&!$.terminal_reason),ot=Q?Ue(Q):new Set,st=Q?We(Q):new Set,ct=new Set([...j].filter(e=>ot.has(e))),lt=new Set([...le].filter(e=>st.has(e))),ut=[...m],dt=g?.attempts.filter(e=>e.execution_status!==`completed`).length??0,ft=async()=>{let t=[...ct],n=[...lt];if(!(!Q||!rt||G.current!==rt||Q.repair.eligibility.eligible!==!0||it?.terminal_result===null||$&&!$.terminal_reason||t.length===0&&n.length===0)){F(!0),L(null);try{let r=await ie(e,t,n,Q.repair.accepts_ticket_id?Q.repair.candidate_tickets.some(e=>e.id===ge)?ge:Q.repair.candidate_tickets[0]?.id||null:null);be(r.source_batch_run_id===rt?r:null)}catch(t){if(L(J(t,f(`errors.repair`))),t instanceof A&&t.status===409&&g){let t=g.batch.execution_run_id,n=++Ee.current;pe(e,t).then(e=>{n===Ee.current&&e.batch_run_id===t&&G.current===t&&Je(e)}).catch(()=>void 0)}}finally{F(!1)}}},pt=async()=>{let t=$&&!$.terminal_reason?$.execution_run_id:it?.execution_run_id;if(t){F(!0),L(null);try{let n=await Se(e,t);`source_batch_run_id`in n&&be(n),we(e=>e+1)}catch(e){L(J(e,f(`errors.repairStop`)))}finally{F(!1)}}},mt=new Set([...Q?.attempts.filter(e=>e.diagnostics.some(e=>ct.has(e.id))).map(e=>e.attempt_run_id)??[],...lt]),ht=(e,t,n)=>{se(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=Ve||!Q||!ot.has(t))return r;let a=new Set(Q.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=He?r:(i.add(t),i)})},gt=(e,t)=>{fe(n=>{let r=new Set(n);return t?!mt.has(e)&&mt.size>=He||!st.has(e)?n:(r.add(e),r):(r.delete(e),r)})},_t=(e,t)=>{h(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},vt=e=>{g&&(S(null),je.current={batchRunId:g.batch.execution_run_id,attemptRunId:e,previousBatchRunId:s===g.batch.execution_run_id?s:null,previousAttemptRunId:s===g.batch.execution_run_id?c:null},Y(e,`manual`),l?.(g.batch.execution_run_id,e))},yt=e=>{let t=g?.attempts.find(t=>t.definition_id===e);if(t){vt(t.execution_run_id);return}S(e)},bt=x?g?.attempts.find(e=>e.definition_id===x)??null:g?.attempts.find(e=>e.execution_run_id===b)??null,xt=bt?.command_snapshot??r.find(e=>e.id===x)??null,St=x??bt?.definition_id??null,Ct=xt?{required:i.includes(xt.id),preReview:a.includes(xt.id)}:null,wt=g?ae(g.batch):null,Tt=g?g.batch.running_count+g.batch.queued_count:0;return(0,R.useEffect)(()=>{d?.(nt)},[nt,d]),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Te&&(0,z.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:Te}),(0,z.jsxs)(`div`,{role:`toolbar`,"aria-label":f(`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,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:f(`runActions`)})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(C,{type:`button`,size:`sm`,disabled:ut.length===0||tt||at||E!==null,onClick:()=>void et(`run`,()=>ye(e,{targetKind:t,targetBundleId:n,definitionIds:ut})),children:f(E===`run`?`starting`:`runSelected`)}),g&&tt&&(0,z.jsx)(C,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null||N,onClick:()=>void(at?pt():et(`stop`,()=>de(e,g.batch.execution_run_id))),children:f(E===`stop`||N?`stopping`:`stop`)}),g&&!tt&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{type:`button`,variant:`outline`,size:`xs`,disabled:at||E!==null,onClick:()=>void et(`rerun`,()=>he(e,g.batch.execution_run_id,{mode:`all`})),children:f(`rerunAll`)}),(0,z.jsx)(C,{type:`button`,variant:`outline`,size:`xs`,disabled:at||E!==null||dt===0,onClick:()=>void et(`rerun`,()=>he(e,g.batch.execution_run_id,{mode:`failed_only`})),children:f(`rerunFailed`)})]})]})]}),(0,z.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,z.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,z.jsx)(Pe,{definitions:r,attempts:g?.attempts??[],requiredDefinitionIds:i,preReviewDefinitionIds:a,selectedDefinitionIds:m,selectedCheckId:St,diagnostics:Q,selectedDiagnosticIds:ct,selectedRawOutputAttemptRunIds:lt,onToggleDefinition:_t,onSelectCheck:yt})}),(0,z.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[o&&!v&&te&&(0,z.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:f(`gateLoading`)}),v&&(0,z.jsx)(Ae,{evaluation:v}),te&&(0,z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:f(`loading`)}),!te&&!g&&!xt&&(0,z.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-foreground`,children:f(`emptyTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:f(`emptyDescription`)})]}),g&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:f(`status.${g.batch.execution_status}`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f(`summary`,{passed:g.batch.passed_count,failed:g.batch.failed_count,running:g.batch.running_count,queued:g.batch.queued_count})}),g.batch.stop_requested&&(0,z.jsx)(`span`,{className:`text-xs text-amber-200`,children:f(`stopRequested`)}),wt&&(0,z.jsx)(O,{evidence:wt})]}),wt?.provider===`docker_sandbox`&&tt&&(0,z.jsxs)(`p`,{className:`mb-4 max-w-3xl text-xs text-amber-100`,children:[f(`environment.batchOwnership`,{count:Tt}),` `,f(`environment.wholeSandboxStop`)]})]}),(g||xt)&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(De,{projectId:e,attempt:bt,batch:g?.batch??null,definition:xt,diagnostics:Q?.attempts.find(e=>e.attempt_run_id===bt?.execution_run_id)??null,repair:Q?.repair??null,selectedDiagnosticIds:ct,selectedRawOutputAttemptRunIds:lt,selectedAttemptRunIds:mt,selectedTicketId:ge,pending:N,activeRepair:it,autoFix:$,policy:Ct,onSelectedTicketChange:_e,onToggleDiagnostic:(e,t)=>bt&&ht(bt.execution_run_id,e,t),onToggleRawOutput:e=>bt&&gt(bt.execution_run_id,e),onStartRepair:()=>void ft(),onStopRepair:()=>void pt()})})]})]})]})},Ke=(e,t)=>D(w(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),qe=(e,t)=>D(w(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Y=(e,t={})=>D(w(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),Je=(e,t)=>D(w(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),Ye=e=>D(w(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),Xe=e=>Te(w(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),X=256*1024,Ze=24,Z=(e,t)=>p.t(`common:testsDialog.${e}`,t),Qe=(e,t)=>{let n=`${e}${t}`;return n.length<=X?n:n.slice(-X)},$e=(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,et=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=Ze,tt=e=>{e.scrollTop=e.scrollHeight},nt=(e,t=!1)=>{tt(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{tt(e),t&&(r=window.requestAnimationFrame(()=>{tt(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},rt=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`,Q=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`},it=e=>{let t=e.split(`/`);return t[t.length-1]||e},$=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),at=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),ot=(e,t)=>{let n=$(t);return n.length===0?e:e.flatMap(e=>{let t=it(e.path);if(at(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>at(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},st=e=>Z(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ct=e=>e?.selection?e.selection.kind===`all`?Z(`selection.allTests`):e.selection.kind===`case`?e.selection.name:it(e.selection.path):Z(`selection.noRunYet`),lt=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`,ut=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,dt=(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,ft=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,pt=({line:e,tone:t})=>(0,z.jsx)(`div`,{"data-tone":t,className:h(`whitespace-pre-wrap break-words`,ut(t)),children:e===``?` `:e}),mt=(0,R.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,z.jsxs)(`button`,{type:`button`,"aria-label":Z(`caseRow.runAriaLabel`,{name:r}),title:r,className:h(`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,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));mt.displayName=`TestCaseRow`;var ht=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:a,isExpanded:o,onRunCase:s,onRunFile:c,onToggleFile:l})=>{let u=e===`file`&&n===a.path,d=e===`case`&&n===a.path;return(0,z.jsx)(Ce,{open:o,onOpenChange:e=>{l(a.path,e)},children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(i,{asChild:!0,children:(0,z.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Z(o?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:a.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,z.jsx)(b,{className:h(`h-4 w-4 transition-transform`,o&&`rotate-180`)})})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Z(`fileRow.runAriaLabel`,{path:a.path}),className:h(`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`,(u||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{c(a.path)},children:(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,z.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,z.jsx)(L,{className:`h-3.5 w-3.5`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:it(a.path)}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:a.path})]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Z(`fileRow.testCount`,{count:a.cases.length})})]})]})})]}),(0,z.jsx)(_,{children:(0,z.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:a.cases.length===0?(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Z(`fileRow.noNamedTests`)}):(0,z.jsx)(`div`,{className:`space-y-1`,children:a.cases.map(i=>{let o=e===`case`&&n===a.path&&t===i.name;return(0,z.jsx)(mt,{canRunGranular:r,filePath:a.path,isActive:o,name:i.name,onRunCase:s},i.id)})})})})]})})});ht.displayName=`DiscoveryFileRow`;var gt=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:s,fullSuiteOnlyNotice:c,isLoading:l,selectedCommandId:u,selectedCommandName:p,sessionError:_,sessionStatus:v,shouldShowCommandSelector:ee,onRunCase:x,onRunFile:S,onSelectCommand:te,onToggleFile:w})=>{let[T,ne]=(0,R.useState)(``),E=(0,R.useMemo)(()=>ot(a,T),[a,T]),D=(0,R.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),re=$(T).length>0;return(0,z.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[ee&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Z(`scope.label`)}),(0,z.jsxs)(le,{children:[(0,z.jsx)(m,{asChild:!0,children:(0,z.jsxs)(C,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Z(`scope.selectedCommandAriaLabel`),disabled:r.length===0||v===`running`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:p??Z(`scope.selectTestScope`)}),(0,z.jsx)(b,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(d,{align:`start`,className:`w-72`,children:r.map(e=>(0,z.jsx)(f,{className:h(u===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{te(e.id)},children:(0,z.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),c&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:c}),(a.length>0||T.length>0)&&(0,z.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,z.jsx)(y,{type:`search`,value:T,onChange:e=>{ne(e.target.value)},placeholder:Z(`filter.placeholder`),"aria-label":Z(`filter.ariaLabel`),className:`pr-10`}),T.length>0&&(0,z.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Z(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{ne(``)},children:(0,z.jsx)(o,{className:`size-4`})})]}),!r.length&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Z(`discovery.noCommands`)}),_&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:_}),(0,z.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,z.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Z(`discovery.fileCount`,{count:E.length}),`, `,Z(`discovery.caseCount`,{count:D})]})}),l&&(0,z.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!l?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilesDetected`)}):E.length===0?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilterMatches`)}):E.map(r=>(0,z.jsx)(ht,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:re||(s[r.path]??!1),onRunCase:x,onRunFile:S,onToggleFile:w},r.path))})]})]})})});gt.displayName=`DiscoveryPane`;var _t=(0,R.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,R.useMemo)(()=>t?se(t).replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `).split(`
4
4
  `).map(e=>({line:e,tone:lt(e)})):[],[t]);return(0,z.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,z.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,z.jsx)(F,{variant:`outline`,className:h(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,rt(i)),children:st(i)}),a&&(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,z.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,z.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:Q(e)}),n&&(0,z.jsx)(F,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:Z(`output.trimmed`)})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,z.jsx)(`div`,{ref:o,"aria-label":Z(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,z.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,z.jsx)(pt,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,z.jsx)(`div`,{className:`text-slate-200`,children:Z(`output.empty`)})})})})]})})});_t.displayName=`OutputPane`;var vt=(0,R.forwardRef)(({testCommands:e,onStatusChange:n,onTargetLabelChange:r,onClose:i,...o},d)=>{let f=o.scope,p=o.projectId,m=o.scope===`ticket`?o.ticketId:null,h=o.scope===`project`?o.targetKind:null,g=o.scope===`project`?o.targetBundleId:null,[_,v]=(0,R.useState)(e),[y,b]=(0,R.useState)(null),[te,w]=(0,R.useState)([]),[T,ne]=(0,R.useState)(``),[E,D]=(0,R.useState)({}),[re,ie]=(0,R.useState)(!0),[ae,O]=(0,R.useState)(!1),[k,j]=(0,R.useState)(!1),[se,ce]=(0,R.useState)(null),[le,ue]=(0,R.useState)(!1),[de,pe]=(0,R.useState)(!1),me=(0,R.useRef)(null),he=(0,R.useRef)(!1),ge=(0,R.useRef)(null),ve=(0,R.useRef)(!0),M=(0,R.useRef)(null),ye=(0,R.useRef)(null),be=y?.selection?.kind??null,xe=y?.selection?.kind===`all`?null:y?.selection?.path??null,Se=y?.selection?.kind===`case`?y.selection.name:null,N=y?.id??null,P=y?.status??null,F=(0,R.useMemo)(()=>_.find(e=>e.id===T)??null,[_,T]),Ce=(0,R.useMemo)(()=>{if(y?.summary?.failed_count==null&&y?.summary?.passed_count==null&&y?.summary?.failed_file_count==null&&y?.summary?.passed_file_count==null)return null;let e=y?.summary?.failed_count==null&&y?.summary?.passed_count==null;return{failed:P===`failed`&&y?.summary?.failed_count==null&&y?.summary?.failed_file_count!=null||e?{count:y?.summary?.failed_file_count??0,label:Z(`summaryCounts.filesFailed`)}:{count:y?.summary?.failed_count??0,label:Z(`summaryCounts.failed`)},passed:e?{count:y?.summary?.passed_file_count??0,label:Z(`summaryCounts.filesPassed`)}:{count:y?.summary?.passed_count??y?.summary?.passed_file_count??0,label:Z(`summaryCounts.passed`)}}},[y?.summary?.failed_count,y?.summary?.passed_count,y?.summary?.failed_file_count,y?.summary?.passed_file_count,P]),I=F?.runner===`unknown`?Z(`scope.fullSuiteOnlyNotice`):null,we=!!(F&&y?.status!==`running`&&!ae&&!k),Te=we,L=we&&de,B=_.length>1,{runs:V}=fe(p),H=y?.run_id?V.find(e=>e.id===y.run_id)??null:null;(0,R.useEffect)(()=>{T||_.length===0||ne(_[0]?.id??``)},[_,T]),(0,R.useEffect)(()=>{e.length>0&&v(t=>dt(t,e)?t:e)},[e]),(0,R.useEffect)(()=>{if(_.length>0||!p)return;let e=new AbortController;return t(e.signal).then(e=>{let t=e.find(e=>e.id===p);t&&v(e=>{let n=oe(t);return dt(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[_.length,p]),(0,R.useEffect)(()=>{let e=e=>{!e||e.id!==me.current||b(t=>$e(t,e))},t=e=>{!e||e.session_id!==me.current||b(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Qe(t.output,e.chunk),output_truncated:e.output_truncated})};return a.on(`test-session:updated`,e),a.on(`test-session:output`,t),()=>{a.off(`test-session:updated`,e),a.off(`test-session:output`,t)}},[]),(0,R.useEffect)(()=>{let e=ge.current;if(!e){M.current=y?.output??null,ye.current=y?.status??null;return}let t=M.current!==(y?.output??null),n=ye.current!==`running`&&y?.status===`running`,r=ye.current===`running`&&y?.status!==`running`;if(n&&(ve.current=!0),n||t&&y?.status===`running`&&ve.current||r&&ve.current){let t=nt(e,r);return M.current=y?.output??null,ye.current=y?.status??null,t}M.current=y?.output??null,ye.current=y?.status??null},[y?.output,y?.status]),(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(f===`project`){if(!p)return;t=await Ke(p,{target_kind:h??`repo_root`,target_bundle_id:g??null})}else t=await qe(m??``,p);if(e){Xe(t.id).catch(()=>{});return}me.current=t.id,b(t)}catch(t){e||ce(t instanceof A?t.message:Z(`messages.loadRunnerError`))}finally{!e&&me.current==null&&ie(!1)}})(),()=>{e=!0}},[p,f,g,h,m]),(0,R.useEffect)(()=>{H&&b(e=>{if(!e||e.run_id!==H.id)return e;let t=H.status===`completed`?`passed`:H.status===`failed`?`failed`:H.status===`cancelled`||H.status===`interrupted`?`stopped`:`running`;return e.status===t&&e.error===(H.failure?.message??e.error)?e:{...e,status:t,error:H.failure?.message??e.error,started_at:H.started_at??e.started_at,completed_at:H.completed_at??e.completed_at}})},[H]),(0,R.useEffect)(()=>{if(!y?.id){pe(!1);return}if(_.length>0&&!T){pe(!1);return}let e=new AbortController,t=!1;return ie(!0),pe(!1),Y(y.id,{commandId:T||null,signal:e.signal}).then(e=>{t||(w(e.files),pe(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||ce(n instanceof A?n.message:Z(`messages.discoverError`))}).finally(()=>{t||ie(!1)}),()=>{t=!0,e.abort()}},[_.length,T,y?.id]),(0,R.useEffect)(()=>()=>{let e=me.current;!e||he.current||(he.current=!0,Xe(e).catch(()=>{}))},[]);let U=(0,R.useCallback)(async e=>{if(!(!N||P===`running`||!F||ae||k)){ce(null),O(!0);try{let t=await Je(N,{command_id:F.id,selection:e});b(e=>$e(e,t))}catch(e){ce(e instanceof A?e.message:Z(`messages.startError`))}finally{O(!1)}}},[ae,k,F,N,P]),W=(0,R.useCallback)(async()=>{if(!(!N||P!==`running`||k)){ce(null),j(!0);try{let e=await Ye(N);b(t=>$e(t,e))}catch(e){ce(e instanceof A?e.message:Z(`messages.stopError`))}finally{j(!1)}}},[k,N,P]),Ee=(0,R.useCallback)(()=>{let e=me.current;if(!e||he.current){i();return}he.current=!0,i(),Xe(e).catch(()=>{})},[i]),G=(0,R.useCallback)(()=>{if(P===`running`){ue(!0);return}Ee()},[Ee,P]);(0,R.useImperativeHandle)(d,()=>({requestClose:G}),[G]),(0,R.useEffect)(()=>{n?.(P===`running`?`running`:P===`passed`?`finished`:P===`failed`||P===`error`?`error`:P===`stopped`?`interrupted`:`inactive`)},[n,P]),(0,R.useEffect)(()=>{y?.target_label&&r?.(y.target_label)},[r,y?.target_label]);let K=(0,R.useCallback)(()=>{let e=ge.current;e&&(ve.current=et(e))},[]),De=(0,R.useCallback)(e=>{ne(e)},[]),q=(0,R.useCallback)((e,t)=>{D(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Oe=(0,R.useCallback)(e=>{U({kind:`file`,path:e})},[U]),ke=(0,R.useCallback)((e,t)=>{U({kind:`case`,path:e,name:t})},[U]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,z.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,z.jsx)(gt,{activeSelectionKind:be,activeSelectionName:Se,activeSelectionPath:xe,availableCommands:_,canRunGranular:L,discovery:te,expandedFiles:E,fullSuiteOnlyNotice:I,isLoading:re,selectedCommandId:T,selectedCommandName:F?.name??null,sessionError:se,sessionStatus:P,shouldShowCommandSelector:B,onRunCase:ke,onRunFile:Oe,onSelectCommand:De,onToggleFile:q}),(0,z.jsx)(_t,{durationMs:y?.duration_ms??null,output:y?.output??``,outputTruncated:y?.output_truncated??!1,selectionLabel:ct(y),status:P,summaryCounts:Ce,viewportRef:ge,onScroll:K})]}),(0,z.jsx)(c,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,z.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:y?.status===`running`?(0,z.jsxs)(C,{type:`button`,variant:`destructive`,className:ft,onClick:()=>{W()},disabled:k,children:[(0,z.jsx)(s,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:Z(`actions.stop`)})]}):(0,z.jsxs)(C,{type:`button`,variant:`success`,className:ft,disabled:!Te,onClick:()=>{U({kind:`all`})},children:[(0,z.jsx)(u,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:Z(`actions.run`)})]})})})]}),(0,z.jsx)(ee,{open:le,onOpenChange:ue,children:(0,z.jsxs)(l,{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,z.jsxs)(S,{children:[(0,z.jsx)(x,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:Z(`closeConfirmation.title`)}),(0,z.jsx)(_e,{className:`text-sm text-foreground whitespace-pre-line`,children:Z(`closeConfirmation.description`)})]}),(0,z.jsxs)(c,{className:`sm:flex-row sm:justify-end`,children:[(0,z.jsx)(C,{type:`button`,variant:`ghost`,onClick:()=>ue(!1),children:Z(`closeConfirmation.keepRunning`)}),(0,z.jsx)(C,{type:`button`,variant:`destructive`,onClick:()=>{ue(!1),Ee()},children:Z(`closeConfirmation.stopAndClose`)})]})]})})]})});vt.displayName=`TestsPanel`;var yt=`archon.verification-tab`,bt=()=>{try{let e=window.localStorage.getItem(yt);return e===`checks`||e===`tests`?e:null}catch{return null}},xt=e=>{try{window.localStorage.setItem(yt,e)}catch{}},St=({targetLabel:e,definitions:t,requiredDefinitionIds:i=[],preReviewDefinitionIds:a=[],checksTarget:s,testsTarget:c,onClose:u,onOpenActivity:d,requestedInitialTab:f,directBatchRunId:p,directAttemptRunId:m,onCheckSelectionChange:h,onUnavailable:g})=>{let{t:_}=I(`common`,{keyPrefix:`verificationDialog`}),v=k(t),y=s!==null&&(t.length>0||!!s.gateEvaluationId||!!p),b=c!==null&&v.length>0,[S,w]=(0,R.useState)(()=>{if(f===`checks`&&y||f===`tests`&&b)return f;let e=bt();return e===`checks`&&y||e===`tests`&&b?e:y?`checks`:`tests`}),[T,ne]=(0,R.useState)(()=>new Set([S])),[D,re]=(0,R.useState)(`inactive`),[ie,ae]=(0,R.useState)(`inactive`),O=(0,R.useRef)(null),A=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(S===`checks`&&!y||S===`tests`&&!b){let e=y?`checks`:`tests`;w(e),ne(t=>new Set(t).add(e))}},[S,y,b]);let oe=e=>{if(A.current=e??null,c){let e=O.current;if(e){e.requestClose();return}}(e??u)()},j=()=>{let e=A.current??u;A.current=null,e()};return(0,z.jsx)(ee,{open:!0,onOpenChange:e=>{e||oe()},children:(0,z.jsxs)(l,{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,z.jsx)(x,{className:`sr-only`,children:_(`title`)}),(0,z.jsx)(_e,{className:`sr-only`,children:_(`description`)}),(0,z.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,z.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,z.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,z.jsx)(r,{className:`size-5`})}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:_(`title`)}),(0,z.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,z.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>oe(d),children:_(`openActivity`)}),(0,z.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":_(`close`),onClick:()=>oe(),children:(0,z.jsx)(o,{className:`size-4`})})]})]}),(0,z.jsxs)(te,{value:S,onValueChange:e=>{e!==`checks`&&e!==`tests`||(w(e),ne(t=>new Set(t).add(e)),xt(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,z.jsxs)(we,{"aria-label":_(`tabsAriaLabel`),children:[y&&(0,z.jsxs)(E,{value:`checks`,className:`gap-2`,children:[(0,z.jsx)(r,{className:`size-4`}),(0,z.jsx)(`span`,{children:_(`tabs.checks.label`)}),(0,z.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":_(`status.checks.${D}`),children:(0,z.jsx)(n,{state:D})})]}),b&&(0,z.jsxs)(E,{value:`tests`,className:`gap-2`,children:[(0,z.jsx)(be,{className:`size-4`}),(0,z.jsx)(`span`,{children:_(`tabs.tests.label`)}),(0,z.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":_(`status.tests.${ie}`),children:(0,z.jsx)(n,{state:ie})})]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:_(`tabs.${S}.description`)})]}),y&&s&&T.has(`checks`)&&(0,z.jsx)(N,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,z.jsx)(Ge,{...s,definitions:t,requiredDefinitionIds:i,preReviewDefinitionIds:a,directBatchRunId:p,directAttemptRunId:m,onSelectionChange:S===`checks`?h:void 0,onUnavailable:g,onStatusChange:re})}),c&&v.length>0&&T.has(`tests`)&&(0,z.jsx)(N,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,z.jsx)(vt,{ref:O,...c,testCommands:v,onStatusChange:ae,onClose:j})})]})]})})};export{St as VerificationDialog};