@straiffi/archon 1.2.19 → 1.2.21
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{Bt as t,Ft as n,Kt as r,Mt as i,Pt as a,Vt as o,a as s,c,h as l,i as u,l as d,m as f,n as p,o as m,r as ee,s as te,t as h,u as g,yt as ne}from"./dropdown-menu-DDo1cQ39.js";import{a as _,c as v,d as y,f as b,h as x,i as S,l as C,m as re,n as w,o as T,p as E,r as D,s as ie,t as O,u as ae}from"./index-Dy6YE0Lr.js";var k=e(r(),1),oe=(e,t)=>o(n(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),se=(e,t)=>o(n(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),ce=(e,t={})=>o(n(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),le=(e,t)=>o(n(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),ue=e=>o(n(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),A=e=>t(n(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),j=i(),M=256*1024,N=24,P=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),F=(e,t)=>m.t(`common:testsDialog.${e}`,t),de=(e,t)=>{let n=`${e}${t}`;return n.length<=M?n:n.slice(-M)},I=e=>e.replace(P,``),fe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=N,L=e=>{e.scrollTop=e.scrollHeight},pe=(e,t=!1)=>{L(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{L(e),t&&(r=window.requestAnimationFrame(()=>{L(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},me=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;if(typeof t.id!=`string`||typeof t.name!=`string`||typeof t.command!=`string`)return[];let n=t.runner===`vitest`||t.runner===`jest`||t.runner===`unknown`?t.runner:`auto`;return[{id:t.id,name:t.name,command:t.command,runner:n,...typeof t.cwd==`string`&&t.cwd.trim()!==``?{cwd:t.cwd}:{}}]}):[]}catch{return[]}},R=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`,he=e=>e==null?null:e<1e3?`${e} ms`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`,z=e=>{let t=e.split(`/`);return t[t.length-1]||e},B=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),V=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),H=(e,t)=>{let n=B(t);return n.length===0?e:e.flatMap(e=>{let t=z(e.path);if(V(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>V(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},U=e=>F(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ge=e=>e?.selection?e.selection.kind===`all`?F(`selection.allTests`):e.selection.kind===`case`?e.selection.name:z(e.selection.path):F(`selection.noRunYet`),W=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`,G=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,_e=(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,ve=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,K=({line:e,tone:t})=>(0,j.jsx)(`div`,{"data-tone":t,className:l(`whitespace-pre-wrap break-words`,G(t)),children:e===``?` `:e}),q=(0,k.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,j.jsxs)(`button`,{type:`button`,"aria-label":F(`caseRow.runAriaLabel`,{name:r}),title:r,className:l(`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,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,j.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));q.displayName=`TestCaseRow`;var J=(0,k.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let u=e===`file`&&n===i.path,p=e===`case`&&n===i.path;return(0,j.jsx)(D,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{asChild:!0,children:(0,j.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":F(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(d,{className:l(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,j.jsx)(`button`,{type:`button`,"aria-label":F(`fileRow.runAriaLabel`,{path:i.path}),className:l(`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||p)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,j.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,j.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:z(i.path)}),(0,j.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:F(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,j.jsx)(S,{children:(0,j.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,j.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:F(`fileRow.noNamedTests`)}):(0,j.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,j.jsx)(q,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});J.displayName=`DiscoveryFileRow`;var ye=(0,k.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:o,fullSuiteOnlyNotice:s,isLoading:m,selectedCommandId:ne,selectedCommandName:_,sessionError:v,sessionStatus:y,shouldShowCommandSelector:b,onRunCase:x,onRunFile:S,onSelectCommand:C,onToggleFile:re})=>{let[w,T]=(0,k.useState)(``),E=(0,k.useMemo)(()=>H(a,w),[a,w]),D=(0,k.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),ie=B(w).length>0;return(0,j.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[b&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:F(`scope.label`)}),(0,j.jsxs)(h,{children:[(0,j.jsx)(u,{asChild:!0,children:(0,j.jsxs)(f,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":F(`scope.selectedCommandAriaLabel`),disabled:r.length===0||y===`running`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:_??F(`scope.selectTestScope`)}),(0,j.jsx)(d,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,j.jsx)(p,{align:`start`,className:`w-72`,children:r.map(e=>(0,j.jsx)(ee,{className:l(ne===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{C(e.id)},children:(0,j.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),s&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:s}),(a.length>0||w.length>0)&&(0,j.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,j.jsx)(g,{type:`search`,value:w,onChange:e=>{T(e.target.value)},placeholder:F(`filter.placeholder`),"aria-label":F(`filter.ariaLabel`),className:`pr-10`}),w.length>0&&(0,j.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":F(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{T(``)},children:(0,j.jsx)(te,{className:`size-4`})})]}),!r.length&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:F(`discovery.noCommands`)}),v&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:v}),(0,j.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,j.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[F(`discovery.fileCount`,{count:E.length}),`, `,F(`discovery.caseCount`,{count:D})]})}),m&&(0,j.jsx)(c,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!m?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilesDetected`)}):E.length===0?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilterMatches`)}):E.map(r=>(0,j.jsx)(J,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:ie||(o[r.path]??!1),onRunCase:x,onRunFile:S,onToggleFile:re},r.path))})]})]})})});ye.displayName=`DiscoveryPane`;var be=(0,k.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:c})=>{let u=(0,k.useMemo)(()=>t?I(t).replaceAll(`\r
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{Bt as t,Ft as n,Kt as r,Mt as i,Pt as a,Vt as o,a as s,c,h as l,i as u,l as d,m as f,n as p,o as m,r as ee,s as te,t as h,u as g,yt as ne}from"./dropdown-menu-DDo1cQ39.js";import{a as _,c as v,d as y,f as b,h as x,i as S,l as C,m as re,n as w,o as T,p as E,r as D,s as ie,t as O,u as ae}from"./index-BoUb738B.js";var k=e(r(),1),oe=(e,t)=>o(n(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),se=(e,t)=>o(n(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),ce=(e,t={})=>o(n(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),le=(e,t)=>o(n(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),ue=e=>o(n(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),A=e=>t(n(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),j=i(),M=256*1024,N=24,P=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),F=(e,t)=>m.t(`common:testsDialog.${e}`,t),de=(e,t)=>{let n=`${e}${t}`;return n.length<=M?n:n.slice(-M)},I=e=>e.replace(P,``),fe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=N,L=e=>{e.scrollTop=e.scrollHeight},pe=(e,t=!1)=>{L(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{L(e),t&&(r=window.requestAnimationFrame(()=>{L(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},me=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;if(typeof t.id!=`string`||typeof t.name!=`string`||typeof t.command!=`string`)return[];let n=t.runner===`vitest`||t.runner===`jest`||t.runner===`unknown`?t.runner:`auto`;return[{id:t.id,name:t.name,command:t.command,runner:n,...typeof t.cwd==`string`&&t.cwd.trim()!==``?{cwd:t.cwd}:{}}]}):[]}catch{return[]}},R=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`,he=e=>e==null?null:e<1e3?`${e} ms`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`,z=e=>{let t=e.split(`/`);return t[t.length-1]||e},B=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),V=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),H=(e,t)=>{let n=B(t);return n.length===0?e:e.flatMap(e=>{let t=z(e.path);if(V(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>V(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},U=e=>F(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ge=e=>e?.selection?e.selection.kind===`all`?F(`selection.allTests`):e.selection.kind===`case`?e.selection.name:z(e.selection.path):F(`selection.noRunYet`),W=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`,G=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,_e=(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,ve=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,K=({line:e,tone:t})=>(0,j.jsx)(`div`,{"data-tone":t,className:l(`whitespace-pre-wrap break-words`,G(t)),children:e===``?` `:e}),q=(0,k.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,j.jsxs)(`button`,{type:`button`,"aria-label":F(`caseRow.runAriaLabel`,{name:r}),title:r,className:l(`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,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,j.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));q.displayName=`TestCaseRow`;var J=(0,k.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let u=e===`file`&&n===i.path,p=e===`case`&&n===i.path;return(0,j.jsx)(D,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{asChild:!0,children:(0,j.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":F(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(d,{className:l(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,j.jsx)(`button`,{type:`button`,"aria-label":F(`fileRow.runAriaLabel`,{path:i.path}),className:l(`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||p)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,j.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,j.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:z(i.path)}),(0,j.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:F(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,j.jsx)(S,{children:(0,j.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,j.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:F(`fileRow.noNamedTests`)}):(0,j.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,j.jsx)(q,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});J.displayName=`DiscoveryFileRow`;var ye=(0,k.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:o,fullSuiteOnlyNotice:s,isLoading:m,selectedCommandId:ne,selectedCommandName:_,sessionError:v,sessionStatus:y,shouldShowCommandSelector:b,onRunCase:x,onRunFile:S,onSelectCommand:C,onToggleFile:re})=>{let[w,T]=(0,k.useState)(``),E=(0,k.useMemo)(()=>H(a,w),[a,w]),D=(0,k.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),ie=B(w).length>0;return(0,j.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[b&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:F(`scope.label`)}),(0,j.jsxs)(h,{children:[(0,j.jsx)(u,{asChild:!0,children:(0,j.jsxs)(f,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":F(`scope.selectedCommandAriaLabel`),disabled:r.length===0||y===`running`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:_??F(`scope.selectTestScope`)}),(0,j.jsx)(d,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,j.jsx)(p,{align:`start`,className:`w-72`,children:r.map(e=>(0,j.jsx)(ee,{className:l(ne===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{C(e.id)},children:(0,j.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),s&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:s}),(a.length>0||w.length>0)&&(0,j.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,j.jsx)(g,{type:`search`,value:w,onChange:e=>{T(e.target.value)},placeholder:F(`filter.placeholder`),"aria-label":F(`filter.ariaLabel`),className:`pr-10`}),w.length>0&&(0,j.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":F(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{T(``)},children:(0,j.jsx)(te,{className:`size-4`})})]}),!r.length&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:F(`discovery.noCommands`)}),v&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:v}),(0,j.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,j.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[F(`discovery.fileCount`,{count:E.length}),`, `,F(`discovery.caseCount`,{count:D})]})}),m&&(0,j.jsx)(c,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!m?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilesDetected`)}):E.length===0?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilterMatches`)}):E.map(r=>(0,j.jsx)(J,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:ie||(o[r.path]??!1),onRunCase:x,onRunFile:S,onToggleFile:re},r.path))})]})]})})});ye.displayName=`DiscoveryPane`;var be=(0,k.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:c})=>{let u=(0,k.useMemo)(()=>t?I(t).replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).replaceAll(`\r`,`
|
|
4
4
|
`).split(`
|
|
5
|
-
`).map(e=>({line:e,tone:W(e)})):[],[t]);return(0,j.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,j.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,j.jsx)(s,{variant:`outline`,className:l(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,R(i)),children:U(i)}),a&&(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,j.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,j.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:he(e)}),n&&(0,j.jsx)(s,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:F(`output.trimmed`)})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,j.jsx)(`div`,{ref:o,"aria-label":F(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:c,children:(0,j.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:u.length>0?u.map((e,t)=>(0,j.jsx)(K,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,j.jsx)(`div`,{className:`text-slate-200`,children:F(`output.empty`)})})})})]})})});be.displayName=`OutputPane`;var xe=({testCommands:e,onClose:t,...n})=>{let r=n.scope,i=n.projectId,o=n.scope===`ticket`?n.ticketId:null,s=n.scope===`project`?n.targetKind:null,c=n.scope===`project`?n.targetBundleId:null,[l,u]=(0,k.useState)(e),[d,p]=(0,k.useState)(null),[m,ee]=(0,k.useState)([]),[h,g]=(0,k.useState)(``),[_,S]=(0,k.useState)({}),[w,D]=(0,k.useState)(!0),[M,N]=(0,k.useState)(!1),[P,I]=(0,k.useState)(!1),[L,R]=(0,k.useState)(null),[he,z]=(0,k.useState)(!1),[B,V]=(0,k.useState)(!1),H=(0,k.useRef)(null),U=(0,k.useRef)(!1),W=(0,k.useRef)(null),G=(0,k.useRef)(!0),K=(0,k.useRef)(null),q=(0,k.useRef)(null),J=d?.selection?.kind??null,xe=d?.selection?.kind===`all`?null:d?.selection?.path??null,Se=d?.selection?.kind===`case`?d.selection.name:null,Y=d?.id??null,X=d?.status??null,Z=(0,k.useMemo)(()=>l.find(e=>e.id===h)??null,[l,h]),Ce=(0,k.useMemo)(()=>{if(d?.summary?.failed_count==null&&d?.summary?.passed_count==null&&d?.summary?.failed_file_count==null&&d?.summary?.passed_file_count==null)return null;let e=d?.summary?.failed_count==null&&d?.summary?.passed_count==null;return{failed:X===`failed`&&d?.summary?.failed_count==null&&d?.summary?.failed_file_count!=null||e?{count:d?.summary?.failed_file_count??0,label:F(`summaryCounts.filesFailed`)}:{count:d?.summary?.failed_count??0,label:F(`summaryCounts.failed`)},passed:e?{count:d?.summary?.passed_file_count??0,label:F(`summaryCounts.filesPassed`)}:{count:d?.summary?.passed_count??d?.summary?.passed_file_count??0,label:F(`summaryCounts.passed`)}}},[d?.summary?.failed_count,d?.summary?.passed_count,d?.summary?.failed_file_count,d?.summary?.passed_file_count,X]),we=Z?.runner===`unknown`?F(`scope.fullSuiteOnlyNotice`):null,Te=!!(Z&&d?.status!==`running`&&!M&&!P),Ee=Te,De=Te&&B,Oe=l.length>1;(0,k.useEffect)(()=>{h||l.length===0||g(l[0]?.id??``)},[l,h]),(0,k.useEffect)(()=>{e.length>0&&u(t=>_e(t,e)?t:e)},[e]),(0,k.useEffect)(()=>{if(l.length>0||!i)return;let e=new AbortController;return ne(e.signal).then(e=>{let t=e.find(e=>e.id===i);t&&u(e=>{let n=me(t.test_commands);return _e(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[l.length,i]),(0,k.useEffect)(()=>{let e=e=>{!e||e.id!==H.current||p(e)},t=e=>{!e||e.session_id!==H.current||p(t=>!t||t.id!==e.session_id?t:{...t,output:de(t.output,e.chunk),output_truncated:e.output_truncated})};return O.on(`test-session:updated`,e),O.on(`test-session:output`,t),()=>{O.off(`test-session:updated`,e),O.off(`test-session:output`,t)}},[]),(0,k.useEffect)(()=>{let e=W.current;if(!e){K.current=d?.output??null,q.current=d?.status??null;return}let t=K.current!==(d?.output??null),n=q.current!==`running`&&d?.status===`running`,r=q.current===`running`&&d?.status!==`running`;if(n&&(G.current=!0),n||t&&d?.status===`running`&&G.current||r&&G.current){let t=pe(e,r);return K.current=d?.output??null,q.current=d?.status??null,t}K.current=d?.output??null,q.current=d?.status??null},[d?.output,d?.status]),(0,k.useEffect)(()=>{let e=!1;return(async()=>{try{let t=r===`project`?await oe(i,{target_kind:s??`repo_root`,target_bundle_id:c??null}):await se(o??``,i);if(e)return;H.current=t.id,p(t)}catch(t){e||R(t instanceof a?t.message:F(`messages.loadRunnerError`))}finally{!e&&H.current==null&&D(!1)}})(),()=>{e=!0}},[i,r,c,s,o]),(0,k.useEffect)(()=>{if(!d?.id){V(!1);return}if(l.length>0&&!h){V(!1);return}let e=new AbortController,t=!1;return D(!0),V(!1),ce(d.id,{commandId:h||null,signal:e.signal}).then(e=>{t||(ee(e.files),V(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||R(n instanceof a?n.message:F(`messages.discoverError`))}).finally(()=>{t||D(!1)}),()=>{t=!0,e.abort()}},[l.length,h,d?.id]),(0,k.useEffect)(()=>()=>{let e=H.current;!e||U.current||(U.current=!0,A(e).catch(()=>{}))},[]);let Q=(0,k.useCallback)(async e=>{if(!(!Y||X===`running`||!Z||M||P)){R(null),N(!0);try{p(await le(Y,{command_id:Z.id,selection:e}))}catch(e){R(e instanceof a?e.message:F(`messages.startError`))}finally{N(!1)}}},[M,P,Z,Y,X]),ke=(0,k.useCallback)(async()=>{if(!(!Y||X!==`running`||P)){R(null),I(!0);try{p(await ue(Y))}catch(e){R(e instanceof a?e.message:F(`messages.stopError`))}finally{I(!1)}}},[P,Y,X]),$=(0,k.useCallback)(()=>{let e=H.current;if(!e||U.current){t();return}U.current=!0,t(),A(e).catch(()=>{})},[t]),Ae=(0,k.useCallback)(()=>{if(X===`running`){z(!0);return}$()},[$,X]),je=(0,k.useCallback)(()=>{let e=W.current;e&&(G.current=fe(e))},[]),Me=(0,k.useCallback)(e=>{g(e)},[]),Ne=(0,k.useCallback)((e,t)=>{S(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Pe=(0,k.useCallback)(e=>{Q({kind:`file`,path:e})},[Q]),Fe=(0,k.useCallback)((e,t)=>{Q({kind:`case`,path:e,name:t})},[Q]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(C,{open:!0,onOpenChange:e=>{e||Ae()},children:(0,j.jsxs)(y,{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-7xl`,children:[(0,j.jsx)(x,{className:`sr-only`,children:F(`dialog.srTitle`)}),(0,j.jsx)(b,{className:`sr-only`,children:F(`dialog.srDescription`)}),(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-sky-200`,children:(0,j.jsx)(v,{className:`h-5 w-5`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:F(`dialog.title`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d?.target_label??F(`dialog.preparingTarget`)})]})]})}),(0,j.jsx)(ae,{asChild:!0,children:(0,j.jsx)(f,{type:`button`,"aria-label":F(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(te,{className:`h-4 w-4`})})})]}),(0,j.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,j.jsx)(ye,{activeSelectionKind:J,activeSelectionName:Se,activeSelectionPath:xe,availableCommands:l,canRunGranular:De,discovery:m,expandedFiles:_,fullSuiteOnlyNotice:we,isLoading:w,selectedCommandId:h,selectedCommandName:Z?.name??null,sessionError:L,sessionStatus:X,shouldShowCommandSelector:Oe,onRunCase:Fe,onRunFile:Pe,onSelectCommand:Me,onToggleFile:Ne}),(0,j.jsx)(be,{durationMs:d?.duration_ms??null,output:d?.output??``,outputTruncated:d?.output_truncated??!1,selectionLabel:ge(d),status:X,summaryCounts:Ce,viewportRef:W,onScroll:je})]}),(0,j.jsx)(E,{className:`border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,j.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:d?.status===`running`?(0,j.jsxs)(f,{type:`button`,variant:`destructive`,className:ve,onClick:()=>{ke()},disabled:P,children:[(0,j.jsx)(T,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.stop`)})]}):(0,j.jsxs)(f,{type:`button`,variant:`success`,className:ve,disabled:!Ee,onClick:()=>{Q({kind:`all`})},children:[(0,j.jsx)(ie,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.run`)})]})})})]})}),(0,j.jsx)(C,{open:he,onOpenChange:z,children:(0,j.jsxs)(y,{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,j.jsxs)(re,{children:[(0,j.jsx)(x,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:F(`closeConfirmation.title`)}),(0,j.jsx)(b,{className:`text-sm text-foreground whitespace-pre-line`,children:F(`closeConfirmation.description`)})]}),(0,j.jsxs)(E,{className:`sm:flex-row sm:justify-end`,children:[(0,j.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>z(!1),children:F(`closeConfirmation.keepRunning`)}),(0,j.jsx)(f,{type:`button`,variant:`destructive`,onClick:()=>{z(!1),$()},children:F(`closeConfirmation.stopAndClose`)})]})]})})]})};export{xe as TestsDialog};
|
|
5
|
+
`).map(e=>({line:e,tone:W(e)})):[],[t]);return(0,j.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,j.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,j.jsx)(s,{variant:`outline`,className:l(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,R(i)),children:U(i)}),a&&(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,j.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,j.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:he(e)}),n&&(0,j.jsx)(s,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:F(`output.trimmed`)})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,j.jsx)(`div`,{ref:o,"aria-label":F(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:c,children:(0,j.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:u.length>0?u.map((e,t)=>(0,j.jsx)(K,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,j.jsx)(`div`,{className:`text-slate-200`,children:F(`output.empty`)})})})})]})})});be.displayName=`OutputPane`;var xe=({testCommands:e,onClose:t,...n})=>{let r=n.scope,i=n.projectId,o=n.scope===`ticket`?n.ticketId:null,s=n.scope===`project`?n.targetKind:null,c=n.scope===`project`?n.targetBundleId:null,[l,u]=(0,k.useState)(e),[d,p]=(0,k.useState)(null),[m,ee]=(0,k.useState)([]),[h,g]=(0,k.useState)(``),[_,S]=(0,k.useState)({}),[w,D]=(0,k.useState)(!0),[M,N]=(0,k.useState)(!1),[P,I]=(0,k.useState)(!1),[L,R]=(0,k.useState)(null),[he,z]=(0,k.useState)(!1),[B,V]=(0,k.useState)(!1),H=(0,k.useRef)(null),U=(0,k.useRef)(!1),W=(0,k.useRef)(null),G=(0,k.useRef)(!0),K=(0,k.useRef)(null),q=(0,k.useRef)(null),J=d?.selection?.kind??null,xe=d?.selection?.kind===`all`?null:d?.selection?.path??null,Se=d?.selection?.kind===`case`?d.selection.name:null,Y=d?.id??null,X=d?.status??null,Z=(0,k.useMemo)(()=>l.find(e=>e.id===h)??null,[l,h]),Ce=(0,k.useMemo)(()=>{if(d?.summary?.failed_count==null&&d?.summary?.passed_count==null&&d?.summary?.failed_file_count==null&&d?.summary?.passed_file_count==null)return null;let e=d?.summary?.failed_count==null&&d?.summary?.passed_count==null;return{failed:X===`failed`&&d?.summary?.failed_count==null&&d?.summary?.failed_file_count!=null||e?{count:d?.summary?.failed_file_count??0,label:F(`summaryCounts.filesFailed`)}:{count:d?.summary?.failed_count??0,label:F(`summaryCounts.failed`)},passed:e?{count:d?.summary?.passed_file_count??0,label:F(`summaryCounts.filesPassed`)}:{count:d?.summary?.passed_count??d?.summary?.passed_file_count??0,label:F(`summaryCounts.passed`)}}},[d?.summary?.failed_count,d?.summary?.passed_count,d?.summary?.failed_file_count,d?.summary?.passed_file_count,X]),we=Z?.runner===`unknown`?F(`scope.fullSuiteOnlyNotice`):null,Te=!!(Z&&d?.status!==`running`&&!M&&!P),Ee=Te,De=Te&&B,Oe=l.length>1;(0,k.useEffect)(()=>{h||l.length===0||g(l[0]?.id??``)},[l,h]),(0,k.useEffect)(()=>{e.length>0&&u(t=>_e(t,e)?t:e)},[e]),(0,k.useEffect)(()=>{if(l.length>0||!i)return;let e=new AbortController;return ne(e.signal).then(e=>{let t=e.find(e=>e.id===i);t&&u(e=>{let n=me(t.test_commands);return _e(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[l.length,i]),(0,k.useEffect)(()=>{let e=e=>{!e||e.id!==H.current||p(e)},t=e=>{!e||e.session_id!==H.current||p(t=>!t||t.id!==e.session_id?t:{...t,output:de(t.output,e.chunk),output_truncated:e.output_truncated})};return O.on(`test-session:updated`,e),O.on(`test-session:output`,t),()=>{O.off(`test-session:updated`,e),O.off(`test-session:output`,t)}},[]),(0,k.useEffect)(()=>{let e=W.current;if(!e){K.current=d?.output??null,q.current=d?.status??null;return}let t=K.current!==(d?.output??null),n=q.current!==`running`&&d?.status===`running`,r=q.current===`running`&&d?.status!==`running`;if(n&&(G.current=!0),n||t&&d?.status===`running`&&G.current||r&&G.current){let t=pe(e,r);return K.current=d?.output??null,q.current=d?.status??null,t}K.current=d?.output??null,q.current=d?.status??null},[d?.output,d?.status]),(0,k.useEffect)(()=>{let e=!1;return(async()=>{try{let t=r===`project`?await oe(i,{target_kind:s??`repo_root`,target_bundle_id:c??null}):await se(o??``,i);if(e)return;H.current=t.id,p(t)}catch(t){e||R(t instanceof a?t.message:F(`messages.loadRunnerError`))}finally{!e&&H.current==null&&D(!1)}})(),()=>{e=!0}},[i,r,c,s,o]),(0,k.useEffect)(()=>{if(!d?.id){V(!1);return}if(l.length>0&&!h){V(!1);return}let e=new AbortController,t=!1;return D(!0),V(!1),ce(d.id,{commandId:h||null,signal:e.signal}).then(e=>{t||(ee(e.files),V(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||R(n instanceof a?n.message:F(`messages.discoverError`))}).finally(()=>{t||D(!1)}),()=>{t=!0,e.abort()}},[l.length,h,d?.id]),(0,k.useEffect)(()=>()=>{let e=H.current;!e||U.current||(U.current=!0,A(e).catch(()=>{}))},[]);let Q=(0,k.useCallback)(async e=>{if(!(!Y||X===`running`||!Z||M||P)){R(null),N(!0);try{p(await le(Y,{command_id:Z.id,selection:e}))}catch(e){R(e instanceof a?e.message:F(`messages.startError`))}finally{N(!1)}}},[M,P,Z,Y,X]),ke=(0,k.useCallback)(async()=>{if(!(!Y||X!==`running`||P)){R(null),I(!0);try{p(await ue(Y))}catch(e){R(e instanceof a?e.message:F(`messages.stopError`))}finally{I(!1)}}},[P,Y,X]),$=(0,k.useCallback)(()=>{let e=H.current;if(!e||U.current){t();return}U.current=!0,t(),A(e).catch(()=>{})},[t]),Ae=(0,k.useCallback)(()=>{if(X===`running`){z(!0);return}$()},[$,X]),je=(0,k.useCallback)(()=>{let e=W.current;e&&(G.current=fe(e))},[]),Me=(0,k.useCallback)(e=>{g(e)},[]),Ne=(0,k.useCallback)((e,t)=>{S(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Pe=(0,k.useCallback)(e=>{Q({kind:`file`,path:e})},[Q]),Fe=(0,k.useCallback)((e,t)=>{Q({kind:`case`,path:e,name:t})},[Q]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(C,{open:!0,onOpenChange:e=>{e||Ae()},children:(0,j.jsxs)(y,{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-7xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,j.jsx)(x,{className:`sr-only`,children:F(`dialog.srTitle`)}),(0,j.jsx)(b,{className:`sr-only`,children:F(`dialog.srDescription`)}),(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-sky-200`,children:(0,j.jsx)(v,{className:`h-5 w-5`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:F(`dialog.title`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d?.target_label??F(`dialog.preparingTarget`)})]})]})}),(0,j.jsx)(ae,{asChild:!0,children:(0,j.jsx)(f,{type:`button`,"aria-label":F(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(te,{className:`h-4 w-4`})})})]}),(0,j.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,j.jsx)(ye,{activeSelectionKind:J,activeSelectionName:Se,activeSelectionPath:xe,availableCommands:l,canRunGranular:De,discovery:m,expandedFiles:_,fullSuiteOnlyNotice:we,isLoading:w,selectedCommandId:h,selectedCommandName:Z?.name??null,sessionError:L,sessionStatus:X,shouldShowCommandSelector:Oe,onRunCase:Fe,onRunFile:Pe,onSelectCommand:Me,onToggleFile:Ne}),(0,j.jsx)(be,{durationMs:d?.duration_ms??null,output:d?.output??``,outputTruncated:d?.output_truncated??!1,selectionLabel:ge(d),status:X,summaryCounts:Ce,viewportRef:W,onScroll:je})]}),(0,j.jsx)(E,{className:`border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,j.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:d?.status===`running`?(0,j.jsxs)(f,{type:`button`,variant:`destructive`,className:ve,onClick:()=>{ke()},disabled:P,children:[(0,j.jsx)(T,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.stop`)})]}):(0,j.jsxs)(f,{type:`button`,variant:`success`,className:ve,disabled:!Ee,onClick:()=>{Q({kind:`all`})},children:[(0,j.jsx)(ie,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.run`)})]})})})]})}),(0,j.jsx)(C,{open:he,onOpenChange:z,children:(0,j.jsxs)(y,{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,j.jsxs)(re,{children:[(0,j.jsx)(x,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:F(`closeConfirmation.title`)}),(0,j.jsx)(b,{className:`text-sm text-foreground whitespace-pre-line`,children:F(`closeConfirmation.description`)})]}),(0,j.jsxs)(E,{className:`sm:flex-row sm:justify-end`,children:[(0,j.jsx)(f,{type:`button`,variant:`ghost`,onClick:()=>z(!1),children:F(`closeConfirmation.keepRunning`)}),(0,j.jsx)(f,{type:`button`,variant:`destructive`,onClick:()=>{z(!1),$()},children:F(`closeConfirmation.stopAndClose`)})]})]})})]})};export{xe as TestsDialog};
|