@vostride/agent-qa-dashboard-ui 0.1.12 → 0.1.14

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 (96) hide show
  1. package/dist/assets/{arrow-up-down-CN-uHgX9.js → arrow-up-down-D_ErIdrE.js} +1 -1
  2. package/dist/assets/{badge-DrW2vGVJ.js → badge-ClWCtaXi.js} +1 -1
  3. package/dist/assets/{batch-action-bar-uEhHVDds.js → batch-action-bar-BoqzHfwU.js} +1 -1
  4. package/dist/assets/{circle-alert-BKX0IIz1.js → circle-alert-D7wbtVU2.js} +1 -1
  5. package/dist/assets/{circle-x-yPIxYoz1.js → circle-x-BOV-jCVR.js} +1 -1
  6. package/dist/assets/config-BH2rUSDL.js +10 -0
  7. package/dist/assets/{copy-Clw3wvSn.js → copy-DW4nc-pA.js} +1 -1
  8. package/dist/assets/{display-step-NqsJgW_B.js → display-step-vpHdm2LX.js} +1 -1
  9. package/dist/assets/{dist-BPheZrD6.js → dist-BABsMbMt.js} +1 -1
  10. package/dist/assets/dist-Bc4r79ls.js +1 -0
  11. package/dist/assets/{dist-m_OM4Je_.js → dist-BsGrTrYb.js} +1 -1
  12. package/dist/assets/{empty-state-BTvOA5lp.js → empty-state-BTFWlITi.js} +1 -1
  13. package/dist/assets/{external-link-C_uggQOc.js → external-link-CnabSkqe.js} +1 -1
  14. package/dist/assets/{eye-CZrufbYE.js → eye-Cj7s1eMQ.js} +1 -1
  15. package/dist/assets/{file-code-B3iDpJRP.js → file-code-DxVUPin2.js} +1 -1
  16. package/dist/assets/{file-search-DHHwYVza.js → file-search-BRbGARSr.js} +1 -1
  17. package/dist/assets/filename-validation-wKCpNal3.js +1 -0
  18. package/dist/assets/{grip-vertical-A-AANrBM.js → grip-vertical-C5AW4fiD.js} +1 -1
  19. package/dist/assets/{hook-editor-yhQoi-Ky.js → hook-editor-KoqKvv73.js} +1 -1
  20. package/dist/assets/{hook-runtime-JF-0oZpz.js → hook-runtime-DZ6bR69q.js} +1 -1
  21. package/dist/assets/{hook-viewer-DIkxp9uJ.js → hook-viewer-DWsN8RyZ.js} +1 -1
  22. package/dist/assets/hooks-BfUXcuyV.js +1 -0
  23. package/dist/assets/{id-badge-NwZYoNfB.js → id-badge-BpTnHwvn.js} +2 -2
  24. package/dist/assets/{index-Bvtm2F6f.js → index-C3AdCkmj.js} +2 -2
  25. package/dist/assets/index-DzWZqTlZ.css +2 -0
  26. package/dist/assets/{insights-DuYBsUzB.js → insights-Dtq5Rwby.js} +1 -1
  27. package/dist/assets/{insights-line-grid-BKOqA-1W.js → insights-line-grid-X5lNbmTY.js} +6 -6
  28. package/dist/assets/{lib-58FyJI_k.js → lib-u_ZEFKZp.js} +1 -1
  29. package/dist/assets/live-run-CfMxOSfk.js +1 -0
  30. package/dist/assets/{memory-B7nfWNTH.js → memory-DS-02aNZ.js} +1 -1
  31. package/dist/assets/memory-product-5m-eyxzH.js +2 -0
  32. package/dist/assets/{monaco-editor-DNT0Mzki.js → monaco-editor-BEWq4fzI.js} +2 -2
  33. package/dist/assets/{monaco-editor-inner-DuCqlGei.js → monaco-editor-inner-B6AQm3h7.js} +2 -2
  34. package/dist/assets/{monaco.contribution-LYJB_lCm.js → monaco.contribution-Dum2B1vn.js} +2 -2
  35. package/dist/assets/{observation-block-4AqYhL1h.js → observation-block-2qfTbm41.js} +1 -1
  36. package/dist/assets/{observation-markdown-Dx_5-T0t.js → observation-markdown-CIs-5TY2.js} +1 -1
  37. package/dist/assets/{pencil-DdRoBrsh.js → pencil-BUQgVaEH.js} +1 -1
  38. package/dist/assets/plus-Bf5Mbita.js +1 -0
  39. package/dist/assets/popover-OAiTzjiL.js +1 -0
  40. package/dist/assets/{refresh-cw-C_0AkMuu.js → refresh-cw-D0OwRzvm.js} +1 -1
  41. package/dist/assets/{resizable-BGEcNRZO.js → resizable-ugU12HrY.js} +1 -1
  42. package/dist/assets/run-detail-Cr984qgU.js +1 -0
  43. package/dist/assets/runs-CDAIeUbq.js +1 -0
  44. package/dist/assets/{scroll-area-CnATfQoe.js → scroll-area-CX3T8JWh.js} +1 -1
  45. package/dist/assets/{select-CeVjgiKI.js → select-D0GpDfUa.js} +1 -1
  46. package/dist/assets/{shortcut-hints-Bs5o743i.js → shortcut-hints-B8kCurzo.js} +1 -1
  47. package/dist/assets/split-button-CRYV8xU8.js +1 -0
  48. package/dist/assets/square-K8N8Yius.js +1 -0
  49. package/dist/assets/{step-name-pills-Dta5ZGMZ.js → step-name-pills-BQ8yv40K.js} +1 -1
  50. package/dist/assets/suite-editor-aAjvjp2R.js +5 -0
  51. package/dist/assets/suite-navbar-UATCw4Qb.js +1 -0
  52. package/dist/assets/suite-viewer-CmbLH1G2.js +1 -0
  53. package/dist/assets/{suites-BvfwzFEd.js → suites-BlJfefzt.js} +1 -1
  54. package/dist/assets/{switch-ByV5GV5L.js → switch-Dv7aVqt1.js} +1 -1
  55. package/dist/assets/tab-console-Ciur_Bee.js +1 -0
  56. package/dist/assets/{table-D08QBBt4.js → table-BOjrxBBL.js} +1 -1
  57. package/dist/assets/{tabs-DrB_Acb3.js → tabs-BEp-p5jh.js} +1 -1
  58. package/dist/assets/test-editor-CFzp3eq1.js +9 -0
  59. package/dist/assets/test-navbar-ChNg-qki.js +7 -0
  60. package/dist/assets/{test-viewer-BwUQNVa4.js → test-viewer-DEQQDURn.js} +1 -1
  61. package/dist/assets/tests-Dzlh9Zho.js +1 -0
  62. package/dist/assets/{tests-suites-table-widths-DNWnkAjA.js → tests-suites-table-widths-D2sc1JmR.js} +1 -1
  63. package/dist/assets/{textarea-DChEVvwQ.js → textarea-BFsDx2mB.js} +1 -1
  64. package/dist/assets/{trash-2-7P1Dp87k.js → trash-2-Dv939XWG.js} +1 -1
  65. package/dist/assets/{tsMode-DEhRZlmT.js → tsMode-CnaplBFQ.js} +1 -1
  66. package/dist/assets/use-hook-run-session-BLSTM6LJ.js +1 -0
  67. package/dist/assets/{use-keyboard-shortcuts-EAppuiKO.js → use-keyboard-shortcuts-COnAPsDD.js} +1 -1
  68. package/dist/assets/{use-page-title-B1t9-5_U.js → use-page-title-CsUoFrfG.js} +1 -1
  69. package/dist/assets/use-run-status-favicon-DLOLF3Hx.js +1 -0
  70. package/dist/assets/{use-selection-queue-BboTDies.js → use-selection-queue-BkEWIfvw.js} +1 -1
  71. package/dist/assets/{viewer-url-state-6mOK5_sY.js → viewer-url-state-PwkMc-qK.js} +1 -1
  72. package/dist/assets/{zap-KFJmkY3Y.js → zap-Dx2CqraS.js} +1 -1
  73. package/dist/index.html +2 -2
  74. package/package.json +2 -2
  75. package/dist/assets/config-TRu3J-E7.js +0 -10
  76. package/dist/assets/dist-BPJgj1d0.js +0 -1
  77. package/dist/assets/filename-validation-4sTTEagx.js +0 -1
  78. package/dist/assets/hooks-CDRbjPKv.js +0 -1
  79. package/dist/assets/index-CW7tbJhs.css +0 -2
  80. package/dist/assets/live-run-ucgeJa3o.js +0 -1
  81. package/dist/assets/memory-product-D1u5V75o.js +0 -2
  82. package/dist/assets/plus-pXO98OAE.js +0 -1
  83. package/dist/assets/popover-DGZi688D.js +0 -1
  84. package/dist/assets/run-detail-3tlB8sew.js +0 -1
  85. package/dist/assets/runs-CywxkFZ6.js +0 -1
  86. package/dist/assets/split-button-DcY8ames.js +0 -1
  87. package/dist/assets/square-D71GHEET.js +0 -1
  88. package/dist/assets/suite-editor-Bnf6KMna.js +0 -5
  89. package/dist/assets/suite-navbar-PStktQ6j.js +0 -1
  90. package/dist/assets/suite-viewer-BD74MY_X.js +0 -1
  91. package/dist/assets/tab-console-BQFkZJG_.js +0 -1
  92. package/dist/assets/test-editor-w7ZQPYgH.js +0 -9
  93. package/dist/assets/test-navbar-DoHKAy1p.js +0 -7
  94. package/dist/assets/tests-B5ELKDH2.js +0 -1
  95. package/dist/assets/use-hook-run-session-x-d_iodT.js +0 -1
  96. package/dist/assets/use-run-status-favicon-D69P46yH.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l}from"./use-run-status-favicon-D69P46yH.js";import{c as u,d,f as ee,l as f,s as p}from"./tab-console-BQFkZJG_.js";import{i as te,n as ne,o as re,s as ie,t as ae,u as m}from"./select-CeVjgiKI.js";import{t as oe}from"./circle-alert-BKX0IIz1.js";import{t as se}from"./copy-Clw3wvSn.js";import{t as h}from"./external-link-C_uggQOc.js";import{t as ce}from"./file-search-DHHwYVza.js";import{n as g,r as le}from"./shortcut-hints-Bs5o743i.js";import{t as ue}from"./use-page-title-B1t9-5_U.js";import{n as de,r as fe,t as pe}from"./popover-DGZi688D.js";import{t as me}from"./scroll-area-CnATfQoe.js";import{i as he,n as ge,r as _e,t as ve}from"./tabs-DrB_Acb3.js";import{$ as ye,$n as _,At as v,Bt as be,Ft as xe,I as Se,It as Ce,Jn as y,L as we,Lt as Te,Mt as b,Nn as Ee,Nt as De,Pt as x,Q as Oe,Qn as ke,Rt as S,St as Ae,U as je,Ut as C,Wn as w,Wt as T,cr as Me,jt as E,lr as Ne,n as Pe,nr as Fe,pr as Ie,qt as D,tr as O,ur as Le,zt as k}from"./index-Bvtm2F6f.js";import{t as A}from"./badge-DrW2vGVJ.js";import{n as Re,r as ze,t as Be}from"./resizable-BGEcNRZO.js";import{t as Ve}from"./empty-state-BTvOA5lp.js";import{t as He}from"./use-keyboard-shortcuts-EAppuiKO.js";import{t as j}from"./format-BpI4TiHn.js";import{i as Ue,n as We}from"./display-step-NqsJgW_B.js";var Ge=y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ke=y(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),qe=y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Je=y(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),M=e(Ie(),1),N=ke();function Ye({status:e}){switch(e){case`passed`:return(0,N.jsx)(A,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/20`,children:`Passed`});case`failed`:return(0,N.jsx)(A,{variant:`destructive`,children:`Failed`});case`healed`:return(0,N.jsx)(A,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Healed`});case`flaky`:return(0,N.jsx)(A,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Flaky`});case`skipped`:return(0,N.jsx)(A,{variant:`secondary`,children:`Skipped`});case`cancelled`:return(0,N.jsx)(A,{className:`bg-muted text-muted-foreground border-border`,children:`Cancelled`});default:return(0,N.jsx)(A,{variant:`outline`,children:e})}}function Xe({run:e,steps:t,shortcutsOpen:n,onToggleShortcuts:a,onOpenArtifacts:o}){let s=Me(),c=t.reduce((e,t)=>e+(t.totalTokens??0),0),l=t.reduce((e,t)=>e+(t.promptTokens??0),0),u=t.reduce((e,t)=>e+(t.completionTokens??0),0),f=e.suiteId!=null&&e.parentRunId==null,p=f&&e.suiteId?_.suiteView(e.suiteId):e.testId?_.testView(e.testId):null,te=f&&e.suiteId?`Open suite`:`Open test`,ne=r(e.id,e.videoPath),re=e.metadata?.farmSessionUrl;return(0,N.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center justify-between border-b px-4 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,N.jsx)(`button`,{onClick:()=>s(_.runs),className:`text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:`Runs`}),(0,N.jsx)(w,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,N.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.name}),p?(0,N.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,"aria-label":te,className:`shrink-0 text-muted-foreground transition-colors hover:text-foreground`,children:(0,N.jsx)(i,{className:`h-3.5 w-3.5`})}):null,(0,N.jsx)(Ye,{status:e.status})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[e.modelName&&(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,N.jsx)(ee,{className:`h-3.5 w-3.5`}),e.modelName]}),c>0&&(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1 cursor-default`,children:[(0,N.jsx)(Ge,{className:`h-3.5 w-3.5`}),j(l),` / `,j(u)]})}),(0,N.jsx)(b,{children:`Prompt tokens / Completion tokens`})]}),(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,N.jsx)(d,{className:`h-3.5 w-3.5`}),D(e.duration)]}),(0,N.jsx)(`div`,{className:`h-4 w-px bg-border`}),(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open run artifacts`,onClick:()=>o?.(`attributes`),children:(0,N.jsx)(Ke,{className:`h-3.5 w-3.5`})})}),(0,N.jsx)(b,{children:`Run details (I/C/M)`})]}),(0,N.jsxs)(pe,{open:n,onOpenChange:e=>{e!==n&&a()},children:[(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsx)(fe,{asChild:!0,children:(0,N.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,children:(0,N.jsx)(le,{className:`h-3.5 w-3.5`})})})}),(0,N.jsx)(b,{children:`Shortcuts (Shift+?)`})]}),(0,N.jsx)(de,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Navigation`}),(0,N.jsx)(g,{hints:[{key:`↑ / K`,label:`Previous item`},{key:`↓ / J`,label:`Next item`},{key:`Shift+↑`,label:`Previous step`},{key:`Shift+↓`,label:`Next step`}]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Tabs`}),(0,N.jsx)(g,{hints:[{key:`1`,label:`Overview`},{key:`2`,label:`Env`},{key:`3`,label:`Network`},{key:`4`,label:`Console`},{key:`5`,label:`ARIA`},{key:`6`,label:`A11y`}]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Screenshots`}),(0,N.jsx)(g,{hints:[{key:`B`,label:`Before screenshot`},{key:`A`,label:`After screenshot`}]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Phases`}),(0,N.jsx)(g,{hints:[{key:`Shift+1`,label:`Toggle Observe`},{key:`Shift+2`,label:`Toggle Plan`},{key:`Shift+3`,label:`Toggle Execute`},{key:`Shift+4`,label:`Toggle Verify`}]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,N.jsx)(g,{hints:[{key:`I`,label:`Details: Attributes`},{key:`C`,label:`Artifacts: Config`},{key:`M`,label:`Artifacts: Memory`},{key:`R`,label:`Re-run`},{key:`V`,label:`Video`},{key:`Shift+?`,label:`Shortcuts`},{key:`Esc`,label:`Close`}]})]})]})})]}),(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`Re-run`,onClick:()=>{let t=e.attributes[`agent-qa.runner`]===`local`;Ae({file:e.filePath??e.name,local:t}).then(e=>{v.success(`Re-run started`),s(_.runLive(e.runId))}).catch(()=>v.error(`Failed to start re-run`))},children:(0,N.jsx)(qe,{className:`h-3.5 w-3.5`})})}),(0,N.jsx)(b,{children:`Re-run (R)`})]}),ne&&(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsx)(`a`,{href:ne,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open recording`,children:(0,N.jsx)(C,{variant:`ghost`,size:`icon-sm`,children:(0,N.jsx)(Je,{className:`h-3.5 w-3.5`})})})}),(0,N.jsx)(b,{children:`Recording (V)`})]}),re&&(0,N.jsxs)(E,{children:[(0,N.jsx)(x,{asChild:!0,children:(0,N.jsx)(`a`,{href:re,target:`_blank`,rel:`noopener noreferrer`,children:(0,N.jsx)(C,{variant:`ghost`,size:`icon-sm`,children:(0,N.jsx)(h,{className:`h-3.5 w-3.5`})})})}),(0,N.jsx)(b,{children:`BrowserStack`})]})]})]})}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ze(e){return Array.isArray(e)}function F(e,t=`Not captured`){return e===void 0?t:e===null?`None`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?Number.isFinite(e)?String(e):`None`:typeof e==`string`?e.length>0?e:`None`:Array.isArray(e)?`${e.length} ${e.length===1?`item`:`items`}`:P(e)?`${Object.keys(e).length} ${Object.keys(e).length===1?`field`:`fields`}`:String(e)}function Qe({section:e}){return(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border px-4 py-4 text-sm text-muted-foreground`,children:[e,` was not captured for this run.`]})}function I({title:e,badges:t=[],children:n,className:r}){return(0,N.jsxs)(`section`,{className:T(`rounded-[2px] border border-border bg-transparent`,r),children:[(0,N.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2 border-b px-4 py-3`,children:[(0,N.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:e}),t.map(e=>(0,N.jsx)(A,{variant:`outline`,className:`text-[10px]`,children:e},e))]}),(0,N.jsx)(`div`,{className:`space-y-3 px-4 py-4`,children:n})]})}function L({rows:e}){return(0,N.jsx)(`div`,{className:`divide-y divide-border/50`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`grid gap-1 py-1.5 text-xs sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-3`,children:[(0,N.jsx)(`dt`,{className:`font-medium text-muted-foreground`,children:e.label}),(0,N.jsx)(`dd`,{className:T(`min-w-0 break-words text-foreground`,e.mono&&`break-all font-mono`),children:e.value})]},e.label))})}function $e({value:e}){return(0,N.jsx)(`span`,{className:T(`break-words`,(e==null||typeof e==`boolean`||typeof e==`number`)&&`font-mono text-[11px]`,e==null?`text-muted-foreground`:`text-foreground`),children:F(e)})}function R({value:e,label:t=`root`,level:n=0}){if(Ze(e))return(0,N.jsxs)(p,{children:[(0,N.jsxs)(f,{className:`group flex w-full min-w-0 items-center gap-1.5 py-1.5 text-left text-xs hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,N.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:t}),(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-foreground`,children:[e.length,` `,e.length===1?`item`:`items`]})]}),(0,N.jsx)(u,{children:(0,N.jsx)(`div`,{className:`ml-3 border-l border-border pl-3`,children:e.length===0?(0,N.jsx)(`div`,{className:`py-1.5 text-xs text-muted-foreground`,children:`None`}):e.map((e,r)=>(0,N.jsx)(R,{label:`${r}`,value:e,level:n+1},`${t}-${r}`))})})]});if(P(e)){let r=Object.entries(e);return(0,N.jsxs)(p,{defaultOpen:n===0,children:[(0,N.jsxs)(f,{className:`group flex w-full min-w-0 items-center gap-1.5 py-1.5 text-left text-xs hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,N.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:t}),(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-foreground`,children:[r.length,` `,r.length===1?`field`:`fields`]})]}),(0,N.jsx)(u,{children:(0,N.jsx)(`div`,{className:`ml-3 border-l border-border pl-3`,children:r.length===0?(0,N.jsx)(`div`,{className:`py-1.5 text-xs text-muted-foreground`,children:`None`}):r.map(([e,t])=>(0,N.jsx)(R,{label:e,value:t,level:n+1},e))})})]})}return(0,N.jsxs)(`div`,{className:`grid gap-1 py-1.5 text-xs sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-3`,children:[(0,N.jsx)(`span`,{className:`min-w-0 break-words font-medium text-muted-foreground`,children:t}),(0,N.jsx)($e,{value:e})]})}function et({label:e,content:t}){return t?(0,N.jsxs)(p,{children:[(0,N.jsxs)(f,{className:`group flex w-full items-center gap-1.5 rounded-[2px] py-1.5 text-left text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3 transition-transform group-data-[state=open]:rotate-90`}),e]}),(0,N.jsx)(u,{children:(0,N.jsx)(`pre`,{className:`mt-2 max-h-80 overflow-x-auto overflow-y-auto rounded-[2px] border border-border bg-muted/30 p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-foreground`,children:t})})]}):null}function z(e,t){return e?e[t]:void 0}function B(e,t){let n=z(e,t);return typeof n==`string`&&n.length>0?n:null}function V(e,t){let n=z(e,t);return P(n)?n:null}function H(e,t){let n=z(e,t);return Ze(n)?n:[]}function tt(e){return P(e)&&[B(e,`code`),B(e,`phase`),B(e,`message`)].filter(Boolean).join(` - `)||null}function U(e){let t=B(e,`kind`);return t===`test`||t===`suite`?t:`unknown`}function W(e,t){let n=B(e,`childRunId`);if(n)return n;let r=B(e,`testId`),i=B(e,`name`);return t.children.find(({run:e})=>!!(r&&e.testId===r||i&&e.name===i))?.run.id??null}function G({config:e}){let t=V(e,`envFile`),n=V(e,`secretsFile`),r=H(e,`hooks`),i=V(e,`model`),a=B(n,`path`),o=B(n,`status`),s=typeof z(n,`count`)==`number`?z(n,`count`):null;return(0,N.jsx)(L,{rows:[{label:`Raw config`,value:B(e,`rawConfigContent`)?`Captured`:`Not captured`},{label:`Env file`,value:F(B(t,`path`))},{label:`Secrets file`,value:n?(0,N.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`break-all font-mono text-xs`,children:F(a)}),o?(0,N.jsx)(A,{variant:`outline`,className:`text-[10px]`,children:o}):null,s===null?null:(0,N.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s,` secret`,s===1?``:`s`]})]}):`Not captured`},{label:`CLI vars`,value:F(Object.keys(V(e,`cliVars`)??{}).length),mono:!0},{label:`Inline vars`,value:F(Object.keys(V(e,`inlineVars`)??{}).length),mono:!0},{label:`Hooks`,value:F(r.length),mono:!0},{label:`Model`,value:i?(0,N.jsx)(R,{label:`model`,value:i}):`Not captured`}]})}function nt({source:e}){let t=U(e),n=tt(z(e,`error`));return(0,N.jsx)(L,{rows:[{label:`Kind`,value:t,mono:!0},{label:`Name`,value:F(B(e,`name`))},{label:t===`suite`?`Suite ID`:`Test ID`,value:F(B(e,t===`suite`?`suiteId`:`testId`)),mono:!0},{label:`Path`,value:F(B(e,`filePath`)),mono:!0},{label:`Load status`,value:F(B(e,`loadStatus`)),mono:!0},{label:`Error`,value:n??`None`}]})}function K({source:e,response:t}){let n=H(e,`members`).filter(P).sort((e,t)=>(typeof e.index==`number`?e.index:0)-(typeof t.index==`number`?t.index:0));return n.length===0?null:(0,N.jsx)(I,{title:`Suite Members`,badges:[`${n.length} members`],children:(0,N.jsx)(`div`,{className:`space-y-3`,children:n.map(e=>{let n=V(e,`ref`),r=typeof e.index==`number`?e.index:0,i=W(e,t),a=tt(z(e,`error`));return(0,N.jsxs)(`div`,{"data-suite-member-index":r,className:`rounded-[2px] border border-border p-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,N.jsxs)(A,{variant:`outline`,className:`text-[10px]`,children:[`#`,r+1]}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-sm font-medium`,children:B(e,`name`)??B(n,`test`)??`Unnamed member`}),(0,N.jsx)(A,{variant:`outline`,className:`text-[10px]`,children:F(B(e,`loadStatus`))})]}),(0,N.jsx)(L,{rows:[{label:`Test ID`,value:F(B(e,`testId`)),mono:!0},{label:`Ref`,value:F(B(n,`test`)),mono:!0},{label:`Ref ID`,value:F(B(n,`id`)),mono:!0},{label:`Path`,value:F(B(e,`filePath`)),mono:!0},{label:`Target`,value:F(B(e,`target`))},{label:`Child run`,value:i?(0,N.jsx)(`a`,{className:`break-all text-primary hover:underline`,href:_.runDetail(i),children:i}):`Not captured`,mono:!!i},{label:`Error`,value:a??`None`}]}),(0,N.jsxs)(p,{children:[(0,N.jsxs)(f,{className:`group mt-2 flex w-full items-center gap-1.5 text-left text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,N.jsx)(w,{className:`h-3 w-3 transition-transform group-data-[state=open]:rotate-90`}),`Member snapshots`]}),(0,N.jsxs)(u,{className:`mt-2 space-y-2`,children:[(0,N.jsx)(et,{label:`Raw member YAML`,content:B(e,`rawYaml`)}),z(e,`resolvedDefinition`)===void 0?null:(0,N.jsx)(R,{label:`resolvedDefinition`,value:z(e,`resolvedDefinition`)})]})]})]},`${r}-${B(e,`testId`)??B(n,`test`)??`member`}`)})})})}function q({response:e}){let t=e.artifact,n=t?.payload??{schemaVersion:1},r=P(n)?n:{schemaVersion:1},i=V(r,`config`),a=V(r,`source`),o=V(r,`runtime`),s=H(r,`errors`),c=new Set(e.missingSections),l=U(a);return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(I,{title:`Run Summary`,badges:[t?.kind??`unknown`],children:(0,N.jsx)(L,{rows:[{label:`Run`,value:e.run.name},{label:`Run ID`,value:e.run.id,mono:!0},{label:`Artifact kind`,value:t?.kind??`unknown`,mono:!0},{label:`Schema version`,value:t?.schemaVersion??r.schemaVersion??`Not captured`,mono:!0},{label:`Finalized`,value:t?.finalizedAt??`Not finalized`,mono:!0},{label:`Test ID`,value:F(e.run.testId),mono:!0},{label:`Suite ID`,value:F(e.run.suiteId),mono:!0},{label:`Platform`,value:F(e.run.platform)},{label:`Target`,value:F(e.run.targetName)}]})}),(0,N.jsx)(I,{title:`Global Config`,children:c.has(`config`)||!i?(0,N.jsx)(Qe,{section:`Config`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(G,{config:i}),z(i,`parsedConfig`)===void 0?null:(0,N.jsx)(R,{label:`parsedConfig`,value:z(i,`parsedConfig`)}),(0,N.jsx)(et,{label:`Raw global config`,content:B(i,`rawConfigContent`)})]})}),(0,N.jsx)(I,{title:`Effective Config`,children:c.has(`config`)||!i?(0,N.jsx)(Qe,{section:`Config`}):(0,N.jsx)(R,{label:`effectiveConfig`,value:z(i,`effectiveConfig`)})}),(0,N.jsx)(I,{title:`Source Snapshot`,badges:[l],children:c.has(`source`)||!a?(0,N.jsx)(Qe,{section:`Source`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(nt,{source:a}),(0,N.jsx)(et,{label:l===`suite`?`Raw suite YAML`:`Raw test YAML`,content:B(a,`rawYaml`)}),z(a,`resolvedDefinition`)===void 0?null:(0,N.jsx)(R,{label:`resolvedDefinition`,value:z(a,`resolvedDefinition`)})]})}),a?(0,N.jsx)(K,{source:a,response:e}):null,o||s.length>0?(0,N.jsxs)(I,{title:`Runtime and Errors`,badges:s.length>0?[`${s.length} errors`]:[],children:[o?(0,N.jsx)(R,{label:`runtime`,value:o}):null,s.length>0?(0,N.jsx)(`div`,{className:`space-y-2`,children:s.map((e,t)=>(0,N.jsx)(`div`,{className:`rounded-[2px] border border-red-500/20 bg-red-500/5 p-3 text-sm`,children:tt(e)??JSON.stringify(e)},t))}):null]}):null]})}var rt=[{action:`add`,title:`Added`,className:`border-emerald-500/20 bg-emerald-500/5 text-emerald-500`},{action:`confirm`,title:`Updated/Confirmed`,className:`border-blue-500/20 bg-blue-500/5 text-blue-500`},{action:`deprecate`,title:`Deprecated`,className:`border-amber-500/25 bg-amber-500/5 text-amber-500`},{action:`delete`,title:`Deleted`,className:`border-red-500/20 bg-red-500/5 text-red-500`}];function J(e,t){return e?e[t]:void 0}function Y(e,t){let n=J(e,t);return typeof n==`string`&&n.length>0?n:null}function X(e,t){let n=J(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null}function Z(e){if(!P(e))return null;let t=Y(e,`id`),n=Y(e,`title`),r=Y(e,`content`),i=X(e,`trust`),a=X(e,`confirmed_count`),o=X(e,`contradicted_count`);return!t||!n||!r||i===null||a===null||o===null?null:{id:t,title:n,content:r,trust:i,last_confirmed:Y(e,`last_confirmed`)??`Not captured`,confirmed_count:a,contradicted_count:o,source_test:Y(e,`source_test`)??`Not captured`}}function it(e){if(!P(e))return null;let t=Y(e,`action`);if(t!==`add`&&t!==`confirm`&&t!==`deprecate`&&t!==`delete`)return null;let n=Y(e,`tier`);return n!==`products`&&n!==`suites`&&n!==`tests`?null:{action:t,tier:n,scope:Y(e,`scope`)??`unknown`,observationId:Y(e,`observationId`)??Z(J(e,`after`))?.id??Z(J(e,`before`))?.id??`unknown`,reasoning:Y(e,`reasoning`)??`No curator reasoning captured.`,before:Z(J(e,`before`)),after:Z(J(e,`after`)),error:Y(e,`error`)??void 0}}function at(e){let t=e.artifact?.payload;if(!P(t))return null;let n=J(t,`memory`);if(!P(n))return null;let r=J(n,`log`);return P(r)?r:null}function ot(e){let t=J(e,`deltas`);return Ze(t)?t.map(it).filter(e=>!!e):[]}function Q(e){return Object.fromEntries(rt.map(t=>[t.action,e.filter(e=>e.action===t.action)]))}function $(e,t,n){return X(e,t===`confirm`?`confirmed`:t===`add`?`added`:t===`deprecate`?`deprecated`:`deleted`)??n}function st(e,t){if(e==null||t==null)return null;let n=Math.round((t-e)*1e3)/1e3;return n===0?`0`:n>0?`+${n}`:String(n)}function ct(e,t){return!e||!t?[]:[`title`,`content`,`trust`,`confirmed_count`,`contradicted_count`,`last_confirmed`,`source_test`].filter(n=>e[n]!==t[n])}function lt({log:e,counts:t}){let n=J(e,`tokenUsage`),r=X(e,`curatorDuration`),i=P(n)?X(n,`promptTokens`):null,a=P(n)?X(n,`completionTokens`):null,o=P(n)?X(n,`totalTokens`):null;return(0,N.jsxs)(`section`,{className:`rounded-[2px] border border-border`,children:[(0,N.jsx)(`div`,{className:`grid grid-cols-2 divide-x divide-y divide-border/50 sm:grid-cols-4 sm:divide-y-0`,children:rt.map(e=>(0,N.jsxs)(`div`,{className:`px-3 py-3`,children:[(0,N.jsx)(`div`,{className:`text-[11px] font-medium text-muted-foreground`,children:e.title}),(0,N.jsx)(`div`,{className:`mt-1 font-mono text-lg text-foreground`,children:t[e.action]})]},e.action))}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[`Curator duration: `,r==null?`Not captured`:D(r)]}),(0,N.jsxs)(`span`,{children:[`Tokens: `,o==null?`Not captured`:`${j(i??0)} / ${j(a??0)} / ${j(o)}`]})]})]})}function ut({label:e,observation:t,tone:n}){return t?(0,N.jsxs)(`div`,{className:T(`rounded-[2px] border border-border border-l-2 p-3`,n===`before`?`border-l-red-500/60 bg-red-500/5`:`border-l-emerald-500/60 bg-emerald-500/5`),children:[(0,N.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold text-muted-foreground`,children:e}),(0,N.jsx)(L,{rows:[{label:`Title`,value:t.title},{label:`ID`,value:t.id,mono:!0},{label:`Trust`,value:t.trust,mono:!0},{label:`Confirmed`,value:t.confirmed_count,mono:!0},{label:`Contradicted`,value:t.contradicted_count,mono:!0},{label:`Source test`,value:t.source_test,mono:!0},{label:`Last confirmed`,value:t.last_confirmed,mono:!0}]}),(0,N.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-sm leading-6 text-foreground`,children:t.content})]}):null}function dt({delta:e,groupClassName:t}){let n=e.after?.title??e.before?.title??e.observationId,r=st(e.before?.trust,e.after?.trust),i=st(e.before?.confirmed_count,e.after?.confirmed_count),a=st(e.before?.contradicted_count,e.after?.contradicted_count),o=ct(e.before,e.after);return(0,N.jsx)(p,{children:(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border p-3`,children:[(0,N.jsxs)(f,{className:`group flex w-full min-w-0 items-start gap-2 text-left`,children:[(0,N.jsx)(w,{className:`mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,N.jsx)(`h4`,{className:`min-w-0 flex-1 break-words text-sm font-medium text-foreground`,children:n}),(0,N.jsx)(A,{variant:`outline`,className:T(`text-[10px]`,t),children:rt.find(t=>t.action===e.action)?.title??e.action}),(0,N.jsxs)(A,{variant:`outline`,className:`max-w-full whitespace-normal break-all text-left text-[10px]`,children:[e.tier,`/`,e.scope]})]}),(0,N.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2 font-mono text-[11px] text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`break-all`,children:e.observationId}),r?(0,N.jsxs)(`span`,{children:[`trust `,r]}):null,i?(0,N.jsxs)(`span`,{children:[`confirmed `,i]}):null,a?(0,N.jsxs)(`span`,{children:[`contradicted `,a]}):null]}),(0,N.jsx)(`p`,{className:`mt-2 line-clamp-2 break-words text-xs text-muted-foreground`,children:e.reasoning})]})]}),(0,N.jsxs)(u,{className:`mt-3 space-y-3`,children:[o.length>0?(0,N.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Changed fields: `,(0,N.jsx)(`span`,{className:`font-mono text-foreground`,children:o.join(`, `)})]}):(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Changed fields: None captured`}),e.error?(0,N.jsxs)(`div`,{className:`text-xs text-red-500`,children:[`Error: `,e.error]}):null,e.action===`add`?(0,N.jsx)(ut,{label:`After`,observation:e.after,tone:`after`}):e.action===`delete`?(0,N.jsx)(ut,{label:`Before`,observation:e.before,tone:`before`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ut,{label:`Before`,observation:e.before,tone:`before`}),(0,N.jsx)(ut,{label:`After`,observation:e.after,tone:`after`})]})]})]})})}function ft({response:e}){let t=at(e);if(e.missingSections.includes(`memory`)||!t)return(0,N.jsx)(`div`,{className:`rounded-[2px] border border-border px-4 py-4 text-sm text-muted-foreground`,children:`Memory was not captured for this run.`});let n=Q(ot(t)),r={add:$(t,`add`,n.add.length),confirm:$(t,`confirm`,n.confirm.length),deprecate:$(t,`deprecate`,n.deprecate.length),delete:$(t,`delete`,n.delete.length)},i=r.add+r.confirm+r.deprecate+r.delete;return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsx)(lt,{log:t,counts:r}),i===0?(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border px-4 py-4`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`No memory changes`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Memory completed without adding, updating, deprecating, or deleting observations.`})]}):null,rt.map(e=>{let t=n[e.action];return(0,N.jsx)(I,{title:e.title,badges:[`${r[e.action]} changes`],className:`scroll-mt-4`,children:(0,N.jsx)(`div`,{"data-memory-group":e.title,className:`space-y-3`,children:t.length===0?(0,N.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`No `,e.title.toLowerCase(),` changes.`]}):t.map(t=>(0,N.jsx)(dt,{delta:t,groupClassName:e.className},`${t.action}-${t.observationId}`))})},e.action)}),Ze(J(t,`errors`))&&J(t,`errors`).length>0?(0,N.jsx)(I,{title:`Memory Errors`,badges:[`${J(t,`errors`).length} errors`],children:(0,N.jsx)(`div`,{className:`space-y-2`,children:J(t,`errors`).map((e,t)=>(0,N.jsx)(`div`,{className:`rounded-[2px] border border-red-500/20 bg-red-500/5 p-3 text-sm text-red-500`,children:F(e)},t))})}):null]})}function pt(){return(0,N.jsxs)(`div`,{className:`space-y-4`,"aria-label":`Loading artifact data`,children:[(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading artifact data...`}),[0,1,2].map(e=>(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border p-4`,children:[(0,N.jsx)(xe,{className:`h-4 w-40`}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(xe,{className:`h-3 w-full`}),(0,N.jsx)(xe,{className:`h-3 w-5/6`}),(0,N.jsx)(xe,{className:`h-3 w-3/5`})]})]},e))]})}function mt({error:e,onRetry:t}){return(0,N.jsx)(`div`,{className:`rounded-[2px] border border-red-500/20 bg-red-500/5 p-4`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,N.jsx)(oe,{className:`mt-0.5 h-4 w-4 shrink-0 text-red-500`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Could not load artifact data`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Retry the request. If it continues, verify the dashboard server can read run artifacts.`}),(0,N.jsx)(`p`,{className:`mt-2 break-words font-mono text-xs text-red-500`,children:e}),(0,N.jsx)(C,{className:`mt-3`,size:`sm`,variant:`outline`,onClick:t,children:`Retry`})]})]})})}function ht(){return(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border p-4`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Artifact data is not available for this run`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`This run does not have a persisted artifact record.`})]})}function gt(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e[t];return n&&typeof n==`object`&&!Array.isArray(n)?n:null}function _t(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=Object.entries(e).filter(e=>typeof e[1]==`string`);return Object.fromEntries(t)}function vt(e){let t=_t(e.run.attributes);if(Object.keys(t).length>0)return t;let n=e.artifact?.payload;return _t(gt(gt(n,`metadata`),`attributes`))}function yt(e){return Object.entries(e).sort(([e],[t])=>{let n=e.startsWith(`agent-qa.`);return n===t.startsWith(`agent-qa.`)?e.localeCompare(t):n?-1:1})}function bt(e){navigator.clipboard?.writeText(e)}function xt({response:e}){let t=yt(vt(e));return t.length===0?(0,N.jsxs)(`div`,{className:`rounded-[2px] border border-border p-4`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`No run attributes`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`This run did not record any attributes.`})]}):(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.jsxs)(C,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>bt(JSON.stringify(Object.fromEntries(t),null,2)),children:[(0,N.jsx)(se,{className:`size-4`}),`Copy JSON`]})}),(0,N.jsx)(`div`,{className:`overflow-hidden rounded-[2px] border border-border`,children:(0,N.jsx)(`table`,{className:`w-full table-fixed text-sm`,children:(0,N.jsx)(`tbody`,{children:t.map(([e,t])=>(0,N.jsxs)(`tr`,{className:`border-b border-border/70 last:border-b-0`,children:[(0,N.jsx)(`th`,{className:`w-[240px] align-top px-3 py-2 text-left font-mono text-xs font-medium text-muted-foreground`,children:e}),(0,N.jsx)(`td`,{className:`align-top px-3 py-2`,children:(0,N.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-1 break-all font-mono text-xs text-foreground`,children:t}),(0,N.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy ${e} value`,title:`Copy value`,onClick:()=>bt(t),children:(0,N.jsx)(se,{className:`size-3.5`})})]})})]},e))})})})]})}function St({tab:e,response:t}){return e===`attributes`?(0,N.jsx)(xt,{response:t}):e===`config`?(0,N.jsx)(q,{response:t}):(0,N.jsx)(ft,{response:t})}function Ct({tab:e,response:t,loading:n,error:r,onRetry:i}){return n?(0,N.jsx)(pt,{}):r?(0,N.jsx)(mt,{error:r,onRetry:i}):!t||e!==`attributes`&&!t.artifact?(0,N.jsx)(ht,{}):(0,N.jsx)(St,{tab:e,response:t})}function wt({run:e,open:t,tab:n,response:r,loading:i,error:a,onOpenChange:o,onTabChange:s,onRetry:c}){let l=r?.artifact??null,u=e.name||`Run ${e.id}`;return(0,N.jsx)(Ce,{open:t,onOpenChange:o,children:(0,N.jsxs)(Te,{side:`right`,className:`w-[min(820px,92vw)] sm:max-w-none gap-0 overflow-hidden p-0`,children:[(0,N.jsxs)(k,{className:`border-b px-4 py-3 pr-12`,children:[(0,N.jsx)(be,{className:`text-base leading-snug`,children:`Run details`}),(0,N.jsx)(S,{className:`truncate text-xs`,children:u}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1 text-xs text-muted-foreground`,children:[(0,N.jsx)(`span`,{className:`break-all font-mono`,children:e.id}),l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(A,{variant:`outline`,className:`text-[10px]`,children:l.kind}),(0,N.jsxs)(A,{variant:`outline`,className:`text-[10px]`,children:[`schema `,l.schemaVersion]}),(0,N.jsx)(A,{variant:`outline`,className:T(`text-[10px]`,l.finalizedAt?`border-emerald-500/20 text-emerald-500`:`border-amber-500/25 text-amber-500`),children:l.finalizedAt?`finalized`:`open`})]}):null]})]}),(0,N.jsxs)(ve,{value:n,onValueChange:e=>s(e),className:`min-h-0 flex-1 overflow-hidden`,children:[(0,N.jsx)(`div`,{className:`border-b px-3`,children:(0,N.jsxs)(_e,{variant:`line`,className:`h-9 w-full justify-start`,children:[(0,N.jsx)(he,{value:`attributes`,className:`max-w-32 flex-none`,children:`Attributes`}),(0,N.jsx)(he,{value:`config`,className:`max-w-32 flex-none`,children:`Config`}),(0,N.jsx)(he,{value:`memory`,className:`max-w-32 flex-none`,children:`Memory`})]})}),(0,N.jsxs)(me,{className:`min-h-0 flex-1`,children:[(0,N.jsx)(ge,{value:`attributes`,className:`m-0 px-4 py-4`,children:(0,N.jsx)(Ct,{tab:`attributes`,response:r,loading:i,error:a,onRetry:c})}),(0,N.jsx)(ge,{value:`config`,className:`m-0 px-4 py-4`,children:(0,N.jsx)(Ct,{tab:`config`,response:r,loading:i,error:a,onRetry:c})}),(0,N.jsx)(ge,{value:`memory`,className:`m-0 px-4 py-4`,children:(0,N.jsx)(Ct,{tab:`memory`,response:r,loading:i,error:a,onRetry:c})})]})]})]})})}function Tt({status:e}){let t=O(e);return(0,N.jsx)(A,{className:Fe(t.tone),children:t.label})}function Et(e,t){let n=e.split(/\s+/);return n.length<=t?{truncated:e,isTruncated:!1}:{truncated:n.slice(0,t).join(` `)+`...`,isTruncated:!0}}function Dt({summary:e}){let[t,n]=(0,M.useState)(!1),[r,i]=(0,M.useState)(!1),{truncated:a,isTruncated:o}=Et(e,20);return(0,N.jsx)(`div`,{className:`mx-2 mt-2 rounded-[2px] border border-red-500/20 bg-red-500/5 px-3 py-2 shrink-0`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(oe,{className:`h-4 w-4 text-red-400 shrink-0 mt-0.5`}),(0,N.jsx)(`span`,{className:`flex-1 text-sm text-foreground/80 select-text`,children:t?e:a}),(0,N.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),2e3)},className:`shrink-0 mt-0.5 p-0.5 rounded-sm hover:bg-red-500/10 transition-colors`,title:`Copy failure summary`,children:r?(0,N.jsx)(m,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,N.jsx)(se,{className:`h-3.5 w-3.5 text-muted-foreground`})}),o&&(0,N.jsx)(`button`,{onClick:()=>n(e=>!e),className:`shrink-0 mt-0.5 p-0.5 rounded-sm hover:bg-red-500/10 transition-colors`,children:(0,N.jsx)(w,{className:T(`h-3.5 w-3.5 text-muted-foreground transition-transform`,t&&`rotate-90`)})})]})})}function Ot(e,t){let n=new Map(t.map((e,t)=>[e.id,t]));return[...e].sort((e,t)=>{let r=n.get(e.runId)??0,i=n.get(t.runId)??0;return r===i?e.stepOrder-t.stepOrder:r-i})}function kt(e){return e?.suiteId!=null&&e.parentRunId==null}function At(e,t,n,r){return Ue((r&&n===`all`&&t.length>0?Ot(e,t):[...e].sort((e,t)=>e.stepOrder-t.stepOrder)).map(We))}function jt(e,t,n){let r=t.get(`step`),i=t.get(`run`),a=t.get(`sub`);if(r){let t=Number.parseInt(r,10),o=e.find(e=>e.rawStepOrder===t?n&&i?e.rawRunId===i:!0:!1);if(o)return a==null?{type:`step`,stepId:o.id}:{type:`subaction`,stepId:o.id,subIndex:Number.parseInt(a,10)}}return e.length>0?{type:`step`,stepId:e[0].id}:null}function Mt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.top+12,a=n.bottom-12;if(r.top>=i&&r.bottom<=a)return;let o=r.top<i?e.scrollTop+(r.top-i):e.scrollTop+(r.bottom-a),s=Math.max(0,o);if(typeof e.scrollTo==`function`){e.scrollTo({top:s,behavior:`smooth`});return}e.scrollTop=s}function Nt(){let{id:e}=Ne(),i=Me(),[d,ee]=Le(),[m,oe]=(0,M.useState)(null);ue(m?`Run - ${m.name}`:`Run`),a(l(m?.status));let[se,h]=(0,M.useState)([]),[g,le]=(0,M.useState)([]),[de,fe]=(0,M.useState)(null),[pe,me]=(0,M.useState)(!0),[he,ge]=(0,M.useState)(!1),[_e,ve]=(0,M.useState)(!1),[be,xe]=(0,M.useState)(1),Ce=(0,M.useRef)(null),y=(0,M.useRef)(null),Te=(0,M.useRef)(null),b=(0,M.useRef)(null),[x,ke]=(0,M.useState)([]),[S,E]=(0,M.useState)(`all`),[Fe,Ie]=(0,M.useState)([]),[D,O]=(0,M.useState)(null),[k,A]=(0,M.useState)([]),[Ue,We]=(0,M.useState)(null),[Ge,Ke]=(0,M.useState)(!1),[qe,Je]=(0,M.useState)(null),[Ye,P]=(0,M.useState)(!1),[Ze,F]=(0,M.useState)(`attributes`),[Qe,I]=(0,M.useState)(null),[L,$e]=(0,M.useState)(!1),[R,et]=(0,M.useState)(null),z=(0,M.useRef)(null),B=(0,M.useRef)(0),[V,H]=(0,M.useState)(()=>{let e=d.get(`tab`);return e===`screenshot`?`overview`:e??`overview`});(0,M.useEffect)(()=>{if(!e)return;b.current=null;let t=!1,n=0;async function r(){try{let{executions:n}=await we();if(t)return;if(n.some(t=>t.runId===e)){i(_.runLive(e),{replace:!0});return}}catch{}try{let n=await Oe(e);if(t)return;if(oe(n.run),kt(n.run)&&n.tests&&n.tests.length>0){ke(n.tests),E(`all`);let e=[];for(let r of n.tests)try{let n=await Oe(r.id);if(t)return;e.push(...n.steps)}catch{}Ie(e),h(e),O(jt(At(e,n.tests,`all`,!0),d,!0))}else{h(n.steps);let e=n.attempts??[];if(le(e),e.length>0){let n=e[e.length-1];fe(n.id);let r=await Oe(n.id);t||(h(r.steps),O(jt(At(r.steps,[],``,!1),d,!1)))}else O(jt(At(n.steps,[],``,!1),d,!1))}}catch(e){if(t)return;if(e instanceof Error&&e.message.includes(`404`)){if(n<5){n++,setTimeout(()=>{t||r()},1e3);return}ge(!0)}else v.error(`Failed to load run`)}finally{t||me(!1)}}return r(),()=>{t=!0}},[e,i]),(0,M.useEffect)(()=>{if(!e||pe)return;let t=!1;return je(e).then(({logs:e})=>{t||A(e)}).catch(()=>{}),()=>{t=!0}},[e,pe]),(0,M.useEffect)(()=>{z.current=null,B.current+=1,I(null),et(null),$e(!1)},[m?.id]);let tt=(0,M.useCallback)(async()=>{if(!m?.id)return;let e=B.current+1;B.current=e,$e(!0),et(null);try{let t=await ye(m.id);if(B.current!==e)return;z.current=m.id,I(t)}catch(t){if(B.current!==e)return;et(t instanceof Error?t.message:`Failed to load artifact data`)}finally{B.current===e&&$e(!1)}},[m?.id]);(0,M.useEffect)(()=>{!Ye||!m?.id||L||R||z.current===m.id&&Qe||tt()},[Ye,R,L,Qe,tt,m?.id]);let U=(0,M.useCallback)(e=>{F(e),P(!0)},[]),W=(0,M.useMemo)(()=>At(se,x,S,kt(m)),[se,x,S,m]),G=(0,M.useMemo)(()=>o(D)?W.find(e=>e.id===D.stepId)??null:null,[D,W]),nt=G?.rawRunId??m?.id??null;(0,M.useEffect)(()=>{if(!nt){We(null);return}We(null);let e=!1;return Se(nt).then(t=>{e||We(t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[nt]);let K=(0,M.useMemo)(()=>!c(D)||!G?null:G.subActionsData?.[D.subIndex]??null,[D,G]),q=(0,M.useMemo)(()=>{if(!G)return null;if(K){let e=K.screenshotBeforePath??null,t=K.screenshotAfterPath??null;return!e&&!t?null:{key:[G.id,`sub`,K.index,e??``,t??``].join(`|`),beforePath:e,afterPath:t}}let e=G.screenshotBeforePath,t=G.screenshotPath;return!e&&!t?null:{key:[G.id,`step`,e??``,t??``].join(`|`),beforePath:e,afterPath:t}},[G,K]),rt=q&&qe?.key===q.key?qe.side:void 0,J=o(D)?D.stepId:null,Y=(0,M.useMemo)(()=>k.filter(e=>e.stepId===null&&e.phase===`setup`),[k]),X=(0,M.useMemo)(()=>k.filter(e=>e.stepId===null&&e.phase===`teardown`),[k]),Z=(0,M.useMemo)(()=>k.filter(e=>e.stepId!==null),[k]),it=(0,M.useMemo)(()=>G?Z.filter(e=>e.stepId===G.id?!0:!e.stepId||G.rawRunId&&e.runId&&G.rawRunId!==e.runId?!1:Number.parseInt(e.stepId,10)===G.rawStepOrder):[],[Z,G]),at=(0,M.useMemo)(()=>D?.type===`hook`?k.find(e=>e.id===D.hookId)??null:null,[D,k]),ot=(0,M.useMemo)(()=>D?.type===`execution`?k.find(e=>e.id===D.logId)??null:null,[D,k]),Q=(0,M.useMemo)(()=>{let e=[],t=kt(m)&&S===`all`&&x.length>0,n=t?new Set(x.map(e=>e.id)):null;for(let t of Y)(!n||!n.has(t.runId))&&e.push({type:`hook`,logId:t.id});if(t){let t=new Map;for(let e of W){let n=e.rawRunId??e.id,r=t.get(n)??[];r.push(e),t.set(n,r)}for(let[n,r]of t){for(let t of Y)t.runId===n&&e.push({type:`hook`,logId:t.id});for(let t of r)if(e.push({type:`step`,stepId:t.id}),t.id===J){let n=Z.filter(e=>e.stepId===t.id?!0:!e.stepId||t.rawRunId&&e.runId&&t.rawRunId!==e.runId?!1:Number.parseInt(e.stepId,10)===t.rawStepOrder);for(let r of n)e.push({type:`exec`,stepId:t.id,logId:r.id});t.subActionsData&&t.subActionsData.forEach((n,r)=>{e.push({type:`sub`,stepId:t.id,subIndex:r})})}for(let t of X)t.runId===n&&e.push({type:`hook`,logId:t.id})}}else for(let t of W)if(e.push({type:`step`,stepId:t.id}),t.id===J){let n=Z.filter(e=>e.stepId===t.id?!0:!e.stepId||t.rawRunId&&e.runId&&t.rawRunId!==e.runId?!1:Number.parseInt(e.stepId,10)===t.rawStepOrder);for(let r of n)e.push({type:`exec`,stepId:t.id,logId:r.id});t.subActionsData&&t.subActionsData.forEach((n,r)=>{e.push({type:`sub`,stepId:t.id,subIndex:r})})}for(let t of X)(!n||!n.has(t.runId))&&e.push({type:`hook`,logId:t.id});return e},[W,J,Z,Y,X,m,S,x]),$=(0,M.useMemo)(()=>D?Q.findIndex(e=>D.type===`hook`&&e.type===`hook`?e.logId===D.hookId:D.type===`step`&&e.type===`step`?e.stepId===D.stepId:D.type===`subaction`&&e.type===`sub`?e.stepId===D.stepId&&e.subIndex===D.subIndex:D.type===`execution`&&e.type===`exec`?e.logId===D.logId:!1):-1,[Q,D]);function st(e){return e.type===`hook`?{type:`hook`,hookId:e.logId}:e.type===`step`?{type:`step`,stepId:e.stepId}:e.type===`exec`?{type:`execution`,stepId:e.stepId,logId:e.logId}:{type:`subaction`,stepId:e.stepId,subIndex:e.subIndex}}let ct=[`overview`,`env`,`network`,`console`,`aria`,`a11y`],lt=(0,M.useCallback)(e=>{V===`overview`&&q&&(e===`before`?q.beforePath:q.afterPath)&&Je({key:q.key,side:e})},[V,q]);He((0,M.useMemo)(()=>{let e={arrowdown:()=>{Q.length!==0&&O(st($===-1?Q[0]:Q[Math.min($+1,Q.length-1)]))},arrowup:()=>{Q.length!==0&&O(st($===-1?Q[Q.length-1]:Q[Math.max($-1,0)]))},j:()=>{e.arrowdown({})},k:()=>{e.arrowup({})},"shift+arrowdown":()=>{if(Q.length===0)return;let e=Q.findIndex((e,t)=>t>$&&e.type===`step`);e!==-1&&O(st(Q[e]))},"shift+arrowup":()=>{if(Q.length===0)return;let e=-1;for(let t=$-1;t>=0;t--)if(Q[t].type===`step`){e=t;break}e!==-1&&O(st(Q[e]))},1:()=>H(ct[0]),2:()=>H(ct[1]),3:()=>H(ct[2]),4:()=>H(ct[3]),5:()=>H(ct[4]),6:()=>H(ct[5]),a:()=>lt(`after`),b:()=>lt(`before`),i:()=>U(`attributes`),c:()=>U(`config`),m:()=>U(`memory`),r:()=>{if(!m)return;let e=m.attributes[`agent-qa.runner`]===`local`;Ae({file:m.filePath??m.name,local:e}).then(e=>{v.success(`Re-run started`),i(_.runLive(e.runId))}).catch(()=>v.error(`Failed to start re-run`))},escape:()=>{Ye?P(!1):_e?ve(!1):O(null)},v:()=>{m?.videoPath&&ve(!0)},"shift+?":()=>Ke(e=>!e),"shift+!":()=>y.current?.togglePhase(0),"shift+@":()=>y.current?.togglePhase(1),"shift+#":()=>y.current?.togglePhase(2),"shift+$":()=>y.current?.togglePhase(3)};return e},[Q,$,D,m,i,Ye,_e,y,lt,U])),(0,M.useEffect)(()=>{let e=o(D)?W.find(e=>e.id===D.stepId):null,t=e?.rawStepOrder,n=e?.rawRunId;ee(e=>{let r=new URLSearchParams(e);return t==null?r.delete(`step`):r.set(`step`,String(t)),kt(m)&&S===`all`&&n?r.set(`run`,n):r.delete(`run`),c(D)?r.set(`sub`,String(D.subIndex)):r.delete(`sub`),V===`overview`?r.delete(`tab`):r.set(`tab`,V),r},{replace:!0})},[D,V,W,m,S,ee]),(0,M.useEffect)(()=>{if(!o(D))return;let e=Te.current;if(!e)return;if(D.type===`step`&&!d.has(`step`)&&!d.has(`sub`)&&W[0]?.id===D.stepId){b.current=D.stepId;return}b.current=null;let t=D.type===`step`?`[data-step-id="${D.stepId}"]`:D.type===`execution`?`[data-execution-id="${D.logId}"]`:c(D)?`[data-sub-action-id="${D.stepId}-${D.subIndex}"]`:null;if(!t)return;let n=requestAnimationFrame(()=>{let n=e.querySelector(t);n&&Mt(e,n)});return()=>cancelAnimationFrame(n)},[D,W,d]);let ut=(0,M.useCallback)(async e=>{fe(e);try{let t=await Oe(e);h(t.steps),O(jt(At(t.steps,[],``,!1),d,!1))}catch{v.error(`Failed to load attempt`)}},[d]),dt=(0,M.useCallback)(async t=>{if(E(t),t===`all`)h(Fe),O(jt(At(Fe,x,`all`,kt(m)),d,!0)),e&&je(e).then(({logs:e})=>A(e)).catch(()=>{});else try{let e=await Oe(t);h(e.steps);let{logs:n}=await je(t);A(n),O(jt(At(e.steps,[],t,!1),d,!1))}catch{v.error(`Failed to load test steps`)}},[Fe,e,m,d,x]);if(pe)return(0,N.jsx)(Pe,{});if(he||!m)return(0,N.jsx)(Ve,{icon:ce,title:`Run not found`,description:`This test run doesn't exist or has been deleted`,actionLabel:`View All Runs`,onAction:()=>i(_.runs)});let ft=r(m.id,m.videoPath);return(0,N.jsx)(De,{children:(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,N.jsx)(Xe,{run:m,steps:se,shortcutsOpen:Ge,onToggleShortcuts:()=>Ke(e=>!e),onOpenArtifacts:U}),(0,N.jsxs)(ze,{orientation:`horizontal`,className:`min-h-0 flex-1 overflow-hidden`,children:[(0,N.jsx)(Re,{defaultSize:35,minSize:20,children:(0,N.jsxs)(`div`,{ref:Te,className:`flex h-full min-h-0 min-w-0 flex-col overflow-y-auto`,children:[kt(m)&&x.length>0?(0,N.jsx)(`div`,{className:`border-b px-3 py-2 shrink-0`,children:(0,N.jsxs)(ae,{value:S,onValueChange:dt,children:[(0,N.jsx)(re,{className:`w-full h-8 text-xs`,children:(0,N.jsx)(ie,{})}),(0,N.jsxs)(ne,{children:[(0,N.jsxs)(te,{value:`all`,children:[`All Tests (`,x.length,`)`]}),x.map(e=>(0,N.jsx)(te,{value:e.id,children:(0,N.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.name,(0,N.jsx)(Tt,{status:e.status})]})},e.id))]})]})}):g.length>0?(0,N.jsx)(`div`,{className:`flex gap-1 border-b px-3 py-2 shrink-0`,children:g.map(e=>(0,N.jsxs)(`button`,{onClick:()=>ut(e.id),className:T(`px-3 py-1 text-xs rounded-sm border-b-2 transition-colors`,de===e.id?`border-primary text-foreground font-medium`:`border-transparent text-muted-foreground hover:text-foreground`),children:[`Attempt `,e.attemptNumber,(0,N.jsx)(`span`,{className:`ml-1.5`,children:(0,N.jsx)(Tt,{status:e.status})})]},e.id))}):null,m.status===`failed`&&m.failureSummary&&(0,N.jsx)(Dt,{summary:m.failureSummary}),m.status===`failed`&&m.errorLog&&(0,N.jsxs)(p,{className:`mx-2 mt-1`,children:[(0,N.jsxs)(f,{className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors group w-full`,children:[(0,N.jsx)(w,{className:`h-3 w-3 transition-transform group-data-[state=open]:rotate-90`}),(0,N.jsx)(`span`,{children:`Error Details`})]}),(0,N.jsx)(u,{children:(0,N.jsx)(`pre`,{className:`mt-1 text-xs font-mono bg-muted/30 border border-border/50 rounded-[2px] px-3 py-2 overflow-x-auto whitespace-pre-wrap max-h-60 overflow-y-auto text-foreground/70 select-text`,children:m.errorLog})})]}),m.memoryLog&&(()=>{let e=JSON.parse(m.memoryLog);return(0,N.jsxs)(p,{className:`mx-2 mt-1`,children:[(0,N.jsxs)(f,{className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors group w-full`,children:[(0,N.jsx)(w,{className:`h-3 w-3 transition-transform group-data-[state=open]:rotate-90`}),(0,N.jsx)(`span`,{children:`Memory`}),(0,N.jsxs)(`span`,{className:`ml-1 text-[10px] opacity-60`,children:[e.added,`A `,e.confirmed,`C `,e.deprecated,`D`]})]}),(0,N.jsx)(u,{children:(0,N.jsxs)(`div`,{className:`mt-1 grid grid-cols-2 gap-x-6 gap-y-1 text-xs px-3 py-2 bg-muted/30 border border-border/50 rounded-[2px]`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Added`}),(0,N.jsx)(`span`,{className:`font-mono`,children:e.added})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Confirmed`}),(0,N.jsx)(`span`,{className:`font-mono`,children:e.confirmed})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Deprecated`}),(0,N.jsx)(`span`,{className:`font-mono`,children:e.deprecated})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Errors`}),(0,N.jsx)(`span`,{className:`font-mono`,children:e.errors.length})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Curator Duration`}),(0,N.jsxs)(`span`,{className:`font-mono`,children:[(e.curatorDuration/1e3).toFixed(1),`s`]})]}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`Tokens`}),(0,N.jsx)(`span`,{className:`font-mono`,children:e.tokenUsage?`${j(e.tokenUsage.promptTokens)} / ${j(e.tokenUsage.completionTokens)}`:`—`})]})]})})]})})(),(0,N.jsx)(t,{steps:W,selection:D,onSelect:O,suiteTests:kt(m)?x:void 0,suiteSelectedView:S,setupHooks:Y,teardownHooks:X,inlineLogs:Z})]})}),(0,N.jsx)(Be,{withHandle:!0}),(0,N.jsx)(Re,{defaultSize:65,minSize:30,children:(0,N.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:D?.type===`hook`&&at?(0,N.jsx)(n,{log:at}):D?.type===`execution`&&ot?(0,N.jsx)(n,{log:ot}):(0,N.jsx)(s,{activeTab:V,onTabChange:H,step:G,subAction:K,runId:G?.rawRunId??m.id,allSteps:W,executionLogs:it,accessibilitySummary:Ue,platform:m.platform,screenshotSide:rt,onScreenshotSideChange:lt,pipelineRef:y})})})]}),(0,N.jsx)(wt,{run:m,open:Ye,tab:Ze,response:Qe,loading:L,error:R,onOpenChange:P,onTabChange:F,onRetry:tt}),_e&&ft&&(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center`,onClick:()=>ve(!1),children:[(0,N.jsx)(C,{variant:`secondary`,size:`icon-sm`,className:`absolute top-4 right-4 h-8 w-8 bg-background/80 backdrop-blur-sm z-10`,onClick:()=>ve(!1),children:(0,N.jsx)(Ee,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,onClick:e=>e.stopPropagation(),children:[(0,N.jsx)(`video`,{ref:Ce,src:ft,controls:!0,autoPlay:!0,className:`rounded-lg`,style:{maxWidth:`90vw`,maxHeight:`calc(90vh - 3rem)`},onLoadedMetadata:()=>{Ce.current&&(Ce.current.playbackRate=be)}}),(0,N.jsx)(`div`,{className:`flex items-center gap-1 bg-background/80 backdrop-blur-sm rounded-full px-1 py-0.5`,children:[.5,1,1.5,2,3,4].map(e=>(0,N.jsxs)(`button`,{onClick:()=>{xe(e),Ce.current&&(Ce.current.playbackRate=e)},className:`px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${be===e?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`}`,children:[e,`x`]},e))})]})]})]})})}export{Nt as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./arrow-up-down-CN-uHgX9.js";import{i as n,l as r,n as i,o as a,s as o,t as s}from"./select-CeVjgiKI.js";import{n as c}from"./split-button-DcY8ames.js";import{n as l,r as u}from"./shortcut-hints-Bs5o743i.js";import{t as d}from"./plus-pXO98OAE.js";import{t as f}from"./trash-2-7P1Dp87k.js";import{t as p}from"./use-page-title-B1t9-5_U.js";import{n as m,t as h}from"./batch-action-bar-uEhHVDds.js";import{n as g,r as _,t as v}from"./popover-DGZi688D.js";import{n as y,t as b}from"./scroll-area-CnATfQoe.js";import{i as x,r as ee,t as te}from"./tabs-DrB_Acb3.js";import{$n as ne,At as S,Gt as re,Ht as C,In as w,Jt as T,Kt as ie,L as ae,Mt as oe,Nn as se,Nt as ce,Pt as le,Qn as ue,Rn as de,St as fe,Ut as E,Wn as pe,Wt as D,Z as O,a as me,cr as he,et as ge,gt as _e,j as ve,jt as k,nr as A,nt as j,pr as M,qt as N,tr as P,tt as F,ur as I}from"./index-Bvtm2F6f.js";import{t as L}from"./badge-DrW2vGVJ.js";import{n as R,o as ye,r as be,t as z}from"./lib-58FyJI_k.js";import{a as xe,i as B,n as Se,o as V,r as H,t as Ce}from"./table-D08QBBt4.js";import{t as we}from"./empty-state-BTvOA5lp.js";import{t as Te}from"./use-keyboard-shortcuts-EAppuiKO.js";import{n as Ee,t as De}from"./use-selection-queue-BboTDies.js";var U=e(M(),1),W=ue();function Oe({startedAt:e}){let[t,n]=(0,U.useState)(()=>{let t=new Date(T(e)).getTime();return Math.max(0,Math.floor((Date.now()-t)/1e3))});return(0,U.useEffect)(()=>{let t=new Date(T(e)).getTime(),r=setInterval(()=>{n(Math.max(0,Math.floor((Date.now()-t)/1e3)))},1e3);return()=>clearInterval(r)},[e]),(0,W.jsxs)(`span`,{className:`text-blue-500 tabular-nums`,children:[Math.floor(t/60),`m `,t%60,`s`]})}var ke={select:`44px`,status:`136px`,target:`180px`,attributes:`260px`,duration:`104px`,createdAt:`128px`},G=[`agent-qa.trigger`,`agent-qa.runner`];function K(e){return e===`ios`?`iOS`:e.charAt(0).toUpperCase()+e.slice(1)}function Ae(e){return`${e.targetName?.trim()||`No target`} (${K(e.platform)})`}function je(e){return e.suiteId!=null&&e.parentRunId==null}function q(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=new Map(G.map((e,t)=>[e,t]));return Object.entries(e??{}).filter(([,e])=>typeof e==`string`).sort(([e],[t])=>{let i=n.get(e),a=n.get(t);if(i!==void 0||a!==void 0)return(i??2**53-1)-(a??2**53-1);let o=r.get(e),s=r.get(t);return o!==void 0||s!==void 0?(o??2**53-1)-(s??2**53-1):e.localeCompare(t)})}function J({attributes:e,activeKeys:t}){let n=q(e,t);if(n.length===0)return(0,W.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`No attributes`});let r=n.length>2?1:2,i=n.slice(0,r),a=n.length-i.length;return(0,W.jsxs)(k,{children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsxs)(`div`,{className:`max-h-[38px] overflow-hidden text-[12px] leading-[18px]`,"aria-label":n.map(([e,t])=>`${e}=${t}`).join(`, `),children:[i.map(([e,t])=>(0,W.jsxs)(`div`,{className:`min-w-0 truncate font-mono`,children:[(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`=`]}),(0,W.jsx)(`span`,{className:`text-foreground`,children:t})]},e)),a>0?(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-muted-foreground`,children:[`+`,a,` more`]}):null]})}),(0,W.jsx)(oe,{side:`top`,align:`start`,className:`max-w-[420px] p-2`,children:(0,W.jsx)(`div`,{className:`max-h-64 overflow-auto font-mono text-[11px] leading-5`,children:n.map(([e,t])=>(0,W.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e}),(0,W.jsx)(`span`,{className:`truncate text-foreground`,children:t})]},e))})})]})}function Y(e){return e.mode===`regex`?`${e.key} matches ${e.value}`:`${e.key} = ${e.value}`}function Me({predicates:e,onChange:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(`exact`),[u,p]=(0,U.useState)(null),[m,h]=(0,U.useState)([]),[y,b]=(0,U.useState)([]);(0,U.useEffect)(()=>{if(!n)return;let e=!1;return ge({q:i,limit:8}).then(t=>{e||h(t.keys)}).catch(()=>{e||h([])}),()=>{e=!0}},[i,n]),(0,U.useEffect)(()=>{if(!n||!i.trim()){b([]);return}let e=!1;return F(i.trim(),{q:o,limit:8}).then(t=>{e||b(t.values)}).catch(()=>{e||b([])}),()=>{e=!0}},[i,n,o]);function x(){let n=i.trim(),r=o.trim();if(!n||!r){p(`Enter an attribute key and value, or remove this filter.`);return}if(c===`regex`)try{new RegExp(r)}catch{p(`Enter a valid regular expression.`);return}p(null);let u=e.filter(e=>e.key!==n);t?.([...u,{key:n,value:r,mode:c}]),a(``),s(``),l(`exact`)}function ee(n){t?.(e.filter((e,t)=>t!==n))}return(0,W.jsxs)(v,{open:n,onOpenChange:r,children:[(0,W.jsx)(_,{asChild:!0,children:(0,W.jsxs)(E,{type:`button`,variant:e.length>0?`secondary`:`outline`,size:`sm`,"aria-label":`Filter by attributes`,className:`h-9 gap-2`,children:[(0,W.jsx)(w,{className:`size-4`}),`Attributes`,e.length>0?` (${e.length})`:``]})}),(0,W.jsxs)(g,{align:`start`,className:`w-[380px] p-0`,children:[(0,W.jsx)(`div`,{className:`border-b px-3 py-2`,children:(0,W.jsx)(`h3`,{className:`text-sm font-medium`,children:`Filter by attributes`})}),(0,W.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,htmlFor:`run-attribute-key`,children:`Key`}),(0,W.jsx)(C,{id:`run-attribute-key`,value:i,onChange:e=>{a(e.target.value),p(null)},placeholder:`git.branch`}),(0,W.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-border/60`,children:m.length>0?m.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left text-xs hover:bg-muted`,onClick:()=>a(e.key),children:[(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.key}),(0,W.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.count})]},e.key)):(0,W.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No attributes found`})})]}),(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,htmlFor:`run-attribute-value`,children:`Value`}),(0,W.jsx)(C,{id:`run-attribute-value`,value:o,onChange:e=>{s(e.target.value),p(null)},placeholder:c===`regex`?`^(master|main)$`:`master`,"aria-describedby":u?`run-attribute-filter-error`:void 0}),(0,W.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-border/60`,children:y.length>0?y.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left text-xs hover:bg-muted`,onClick:()=>s(e.value),children:[(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.value}),(0,W.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.count})]},e.value)):(0,W.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No values found for this key`})})]})]}),(0,W.jsxs)(`div`,{className:`inline-flex rounded border border-border p-0.5`,children:[(0,W.jsx)(`button`,{type:`button`,className:D(`rounded-[2px] px-2 py-1 text-xs`,c===`exact`?`bg-primary text-primary-foreground`:`text-muted-foreground`),"aria-pressed":c===`exact`,onClick:()=>l(`exact`),children:`Exact match`}),(0,W.jsx)(`button`,{type:`button`,className:D(`rounded-[2px] px-2 py-1 text-xs`,c===`regex`?`bg-primary text-primary-foreground`:`text-muted-foreground`),"aria-pressed":c===`regex`,onClick:()=>l(`regex`),children:`Regex`})]}),u?(0,W.jsx)(`p`,{id:`run-attribute-filter-error`,className:`text-xs text-destructive`,children:u}):null,(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(E,{type:`button`,size:`sm`,onClick:x,children:[(0,W.jsx)(d,{className:`size-4`}),`Apply filter`]}),(0,W.jsx)(E,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>t?.([]),disabled:e.length===0,children:`Clear attributes`})]}),e.length>0?(0,W.jsx)(`div`,{className:`space-y-1 border-t pt-3`,children:e.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1 break-all font-mono`,children:Y(e)}),(0,W.jsx)(E,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.key} filter`,onClick:()=>ee(t),children:(0,W.jsx)(f,{className:`size-3.5`})})]},`${e.key}-${e.mode}`))}):null]})]})]})}function X({status:e}){let t=P(e);return(0,W.jsx)(L,{className:A(t.tone),children:t.label})}function Ne({column:e,label:n}){return(0,W.jsx)(`div`,{className:`flex justify-end`,children:(0,W.jsxs)(E,{type:`button`,variant:`ghost`,size:`xs`,"data-runs-sort-button":`compact`,className:`h-7 max-w-full shrink justify-end px-1.5 text-[12px] leading-none text-foreground/90`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[(0,W.jsx)(`span`,{className:`truncate`,children:n}),(0,W.jsx)(t,{})]})})}var Pe=[{accessorKey:`status`,header:({column:e})=>(0,W.jsxs)(E,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Status`,(0,W.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{accessorKey:`name`,header:({column:e})=>(0,W.jsxs)(E,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Test Name`,(0,W.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{id:`target`,accessorFn:e=>`${e.targetName??`No target`} ${e.platform}`,header:({column:e})=>(0,W.jsxs)(E,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Target`,(0,W.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{id:`attributes`,accessorFn:e=>Object.entries(e.attributes??{}).map(([e,t])=>`${e}=${t}`).join(` `),header:`Attributes`},{accessorKey:`duration`,header:({column:e})=>(0,W.jsx)(Ne,{column:e,label:`Duration`})},{accessorKey:`createdAt`,header:({column:e})=>(0,W.jsx)(Ne,{column:e,label:`Started`})}];function Fe(e){e.stopPropagation()}function Ie(e,t){if(e.length===0)return!1;let n=e.filter(e=>t.has(e)).length;return n===0?!1:n===e.length?!0:`indeterminate`}function Le(e){let t=ke[e];if(t)return{width:t,minWidth:t}}function Z(e){return D(`h-10 bg-background text-[13px] font-medium text-foreground/90`,e===`select`&&`w-11 px-2 text-center`,e===`status`&&`w-[136px] px-3`,e===`name`&&`px-3`,e===`target`&&`w-[180px] px-3`,e===`attributes`&&`w-[260px] px-3`,e===`duration`&&`w-[104px] px-3 text-right`,e===`createdAt`&&`w-[128px] px-3 text-right`)}function Q(e,t){return D(`py-2 align-top`,e===`select`&&`w-11 px-2`,e===`status`&&`w-[136px] px-3`,e===`name`&&D(`max-w-0 px-3`,t&&`pl-8`),e===`target`&&`w-[180px] max-w-0 px-3 text-muted-foreground`,e===`attributes`&&`w-[260px] max-w-0 px-3`,e===`duration`&&`w-[104px] px-3 text-right tabular-nums`,e===`createdAt`&&`w-[128px] px-3 text-right tabular-nums`)}function $({isActive:e,isBatchSelected:t,isChild:n}){return D(`cursor-pointer outline-none hover:bg-muted/20 focus-visible:bg-primary/10`,n&&`bg-muted/[0.04]`,t&&!e&&`bg-muted/20`,e&&`bg-primary/10 ring-1 ring-inset ring-primary/60`)}function Re(e,t){let n=[];for(let r of e)if(n.push({id:r.id,run:r,isChild:!1,parentId:null}),!(!je(r)||!t.has(r.id)))for(let e of r.tests??[])n.push({id:e.id,run:e,isChild:!0,parentId:r.id});return n}function ze({runs:e,total:t,isLoading:c,page:l,onPageChange:u,onSearchChange:d,searchValue:f,selectedRunId:p=null,onSelectedRunIdChange:h,expandedSuites:g=new Set,onToggleSuite:_,onOpenRun:v,onVisibleRunsChange:x,platformFilter:ee=``,onPlatformChange:te,targetFilter:ne=``,targetOptions:S=[],onTargetChange:w,attributePredicates:T=[],onAttributePredicatesChange:ae,sorting:se,onSortingChange:ue,headerActions:de,topSlot:fe,enableSelection:D=!1,selectedRunIds:O=new Set,onToggleRunSelection:me,onToggleVisibleSelection:he}){let[ge,_e]=(0,U.useState)([]),ve=se??ge,A=ue??_e,j=R({data:e,columns:[...D?[{id:`select`,header:({table:e})=>(0,W.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,W.jsx)(m,{checked:Ie(e.getRowModel().rows.map(e=>e.original.id),O),onCheckedChange:t=>he?.(e.getRowModel().rows.map(e=>e.original),t===!0),onClick:e=>e.stopPropagation(),"aria-label":`Select all`})}),enableSorting:!1}]:[],...Pe],getRowId:e=>e.id,getCoreRowModel:be(),getSortedRowModel:ye(),onSortingChange:A,state:{sorting:ve}}),M=j.getHeaderGroups(),P=j.getRowModel().rows,F=(0,U.useMemo)(()=>P.map(e=>e.original),[P]),I=(0,U.useMemo)(()=>Re(F,g),[g,F]),L=Math.ceil(t/50),we=l*50+1,Te=Math.min((l+1)*50,t),Ee=Array.from(new Set([ne,...S].filter(e=>!!e))),De=[...D?[`select`]:[],`status`,`name`,`target`,`attributes`,`duration`,`createdAt`],ke=(0,U.useMemo)(()=>T.map(e=>e.key),[T]);(0,U.useEffect)(()=>{x?.(I)},[x,I]),(0,U.useEffect)(()=>{if(!p)return;let e=document.querySelector(`[data-runs-row-surface="${p}"]`);e&&document.activeElement!==e&&e.focus()},[p]);function G(e){return e.status===`running`&&e.startedAt?(0,W.jsx)(`span`,{className:`text-sm tabular-nums`,children:(0,W.jsx)(Oe,{startedAt:e.startedAt})}):e.status===`running`?(0,W.jsx)(`span`,{className:`text-sm text-blue-500`,children:`Starting...`}):(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:N(e.duration)})}function K(e,t){h?.(e.id),v?.(e,t)}function q(e,t){t.key===`Enter`&&(t.preventDefault(),K(e,t))}return(0,W.jsx)(ce,{children:(0,W.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`shrink-0 space-y-4`,children:[fe,(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(C,{placeholder:`Search runs...`,value:f,onChange:e=>d(e.target.value),className:`max-w-[220px]`}),te&&(0,W.jsxs)(s,{value:ee||`all`,onValueChange:e=>te(e===`all`?``:e),children:[(0,W.jsx)(a,{className:`w-[140px]`,children:(0,W.jsx)(o,{placeholder:`All platforms`})}),(0,W.jsxs)(i,{children:[(0,W.jsx)(n,{value:`all`,children:`All platforms`}),(0,W.jsx)(n,{value:`web`,children:`Web`}),(0,W.jsx)(n,{value:`android`,children:`Android`}),(0,W.jsx)(n,{value:`ios`,children:`iOS`})]})]}),w&&(0,W.jsxs)(s,{value:ne||`all`,onValueChange:e=>w(e===`all`?``:e),children:[(0,W.jsx)(a,{className:`w-[180px]`,children:(0,W.jsx)(o,{placeholder:`All targets`})}),(0,W.jsxs)(i,{children:[(0,W.jsx)(n,{value:`all`,children:`All targets`}),Ee.map(e=>(0,W.jsx)(n,{value:e,children:e},e))]})]}),ae&&(0,W.jsx)(Me,{predicates:T,onChange:ae}),(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading...`}),de]})]})]}),(0,W.jsxs)(b,{className:`min-h-0 flex-1 rounded-md border`,children:[(0,W.jsxs)(Ce,{className:`min-w-full table-fixed`,children:[(0,W.jsx)(`colgroup`,{children:De.map(e=>(0,W.jsx)(`col`,{style:Le(e)},e))}),(0,W.jsx)(xe,{children:M.map(e=>(0,W.jsx)(V,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,W.jsx)(B,{className:Z(e.column.id),children:e.isPlaceholder?null:z(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,W.jsx)(Se,{children:P.length?P.map(e=>{let t=e.original,n=je(t),i=n&&g.has(t.id),a=t.tests??[],o=a.filter(e=>e.status===`passed`).length,s=p===t.id,c=O.has(t.id);return(0,W.jsxs)(U.Fragment,{children:[(0,W.jsxs)(V,{tabIndex:s?0:-1,"data-runs-row-surface":t.id,"data-active":String(s),"data-state":c?`selected`:void 0,"aria-selected":s,className:$({isActive:s,isBatchSelected:c,isChild:!1}),onClick:e=>K(t,e),onFocus:()=>h?.(t.id),onKeyDown:e=>q(t,e),children:[D&&(0,W.jsx)(H,{className:Q(`select`,!1),onClick:e=>e.stopPropagation(),children:(0,W.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,W.jsx)(m,{checked:O.has(t.id),onCheckedChange:e=>me?.(t,e===!0),"aria-label":`Select row`})})}),(0,W.jsx)(H,{className:Q(`status`,!1),children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(X,{status:t.status}),n&&a.length>0&&(0,W.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/80 tabular-nums`,children:[o,`/`,a.length]})]})}),(0,W.jsx)(H,{className:Q(`name`,!1),children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n&&(0,W.jsx)(`button`,{type:`button`,className:`rounded p-0.5 hover:bg-muted`,onClick:e=>{Fe(e),_?.(t.id)},children:i?(0,W.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(pe,{className:`h-4 w-4 text-muted-foreground`})}),(0,W.jsx)(`span`,{className:`block whitespace-normal break-words text-sm font-medium leading-snug text-foreground`,children:t.name})]})}),(0,W.jsx)(H,{className:Q(`target`,!1),children:(0,W.jsx)(`span`,{className:`block whitespace-normal break-words text-[13px] leading-snug text-muted-foreground/90`,children:Ae(t)})}),(0,W.jsx)(H,{className:Q(`attributes`,!1),children:(0,W.jsx)(J,{attributes:t.attributes,activeKeys:ke})}),(0,W.jsx)(H,{className:Q(`duration`,!1),children:G(t)}),(0,W.jsx)(H,{className:Q(`createdAt`,!1),children:(0,W.jsxs)(k,{children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:re(t.createdAt)})}),(0,W.jsx)(oe,{children:ie(t.createdAt)})]})})]}),i&&a.map(t=>{let n=p===t.id;return(0,W.jsxs)(V,{tabIndex:n?0:-1,"data-runs-row-surface":t.id,"data-active":String(n),"aria-selected":n,className:$({isActive:n,isBatchSelected:!1,isChild:!0}),onClick:e=>K(t,e),onFocus:()=>h?.(t.id),onKeyDown:e=>q(t,e),children:[D&&(0,W.jsx)(H,{className:Q(`select`,!0)}),(0,W.jsx)(H,{className:Q(`status`,!0),children:(0,W.jsx)(X,{status:t.status})}),(0,W.jsx)(H,{className:Q(`name`,!0),children:(0,W.jsx)(`span`,{className:`block whitespace-normal break-words text-sm leading-snug text-foreground/90`,children:t.name})}),(0,W.jsx)(H,{className:Q(`target`,!0),children:(0,W.jsx)(`span`,{className:`block whitespace-normal break-words text-[13px] leading-snug text-muted-foreground`,children:Ae(t)})}),(0,W.jsx)(H,{className:Q(`attributes`,!0),children:(0,W.jsx)(J,{attributes:t.attributes,activeKeys:ke})}),(0,W.jsx)(H,{className:Q(`duration`,!0),children:G(t)}),(0,W.jsx)(H,{className:Q(`createdAt`,!0),children:(0,W.jsxs)(k,{children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:re(t.createdAt)})}),(0,W.jsx)(oe,{children:ie(t.createdAt)})]})})]},`${e.id}-child-${t.id}`)})]},e.id)}):(0,W.jsx)(V,{children:(0,W.jsx)(H,{colSpan:De.length,className:`h-24 text-center`,children:`No results.`})})})]}),(0,W.jsx)(y,{orientation:`horizontal`})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t>0?`Showing ${we}-${Te} of ${t}`:`No runs found`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>u(l-1),disabled:l===0,children:`Previous`}),(0,W.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>u(l+1),disabled:l>=L-1||L===0,children:`Next`})]})]})]})})}var Be=new Set([`all`,`running`,`queued`,`completed`,`failed`]),Ve=new Set([`asc`,`desc`]);function He(e){if(!e)return 1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>1?t:1}function Ue(e){let t=new URLSearchParams;e.tab!==`all`&&t.set(`tab`,e.tab),e.search&&t.set(`search`,e.search),e.platform&&t.set(`platform`,e.platform),e.target&&t.set(`target`,e.target);for(let n of e.attributePredicates){if(!n.key||!n.value)continue;let e=n.mode===`regex`?`attributes[${n.key}][regex]`:`attributes[${n.key}]`;t.set(e,n.value)}return e.sort&&(t.set(`sort`,e.sort),t.set(`order`,e.order)),e.page>1&&t.set(`page`,String(e.page)),t}function We(e){let t=[];for(let[n,r]of e.entries()){let e=/^attributes\[([^\]]+)\](?:\[(regex)\])?$/.exec(n);!e||!r||t.push({key:e[1],value:r,mode:e[2]===`regex`?`regex`:`exact`})}return t}function Ge(){let[e,t]=I(),n=e.get(`tab`),r=n&&Be.has(n)?n:`all`,i=e.get(`search`)??``,a=e.get(`platform`)??``,o=e.get(`target`)??``,s=(0,U.useMemo)(()=>We(e),[e]),c=e.get(`sort`)??``,l=e.get(`order`)??`desc`,u=Ve.has(l)?l:`desc`,d=He(e.get(`page`)),f=(0,U.useMemo)(()=>c?[{id:c,desc:u===`desc`}]:[],[c,u]),p=(0,U.useRef)(f);p.current=f;let m=(0,U.useMemo)(()=>({tab:r,search:i,platform:a,target:o,attributePredicates:s,sort:c,order:u,page:d}),[r,i,a,o,s,c,u,d]);(0,U.useEffect)(()=>{let n=Ue(m);e.toString()!==n.toString()&&t(n,{replace:!0})},[e,t,m]);let h=(0,U.useCallback)((e,n)=>{let r={...m,...e};n?.resetPage&&(r.page=1),t(Ue(r),{replace:!0})},[t,m]);return{tab:r,search:i,platform:a,target:o,attributePredicates:s,sort:c,order:u,page:d,sorting:f,onSortingChange:(0,U.useCallback)(e=>{let t=typeof e==`function`?e(p.current):e;t.length>0?h({sort:t[0].id,order:t[0].desc?`desc`:`asc`}):h({sort:``,order:`desc`})},[h]),setTab:(0,U.useCallback)(e=>h({tab:e},{resetPage:!0}),[h]),setSearch:(0,U.useCallback)(e=>h({search:e},{resetPage:!0}),[h]),setPlatform:(0,U.useCallback)(e=>h({platform:e},{resetPage:!0}),[h]),setTarget:(0,U.useCallback)(e=>h({target:e},{resetPage:!0}),[h]),setAttributePredicates:(0,U.useCallback)(e=>h({attributePredicates:e},{resetPage:!0}),[h]),setPage:(0,U.useCallback)(e=>h({page:e}),[h])}}var Ke={all:``,running:`running`,queued:`pending`,completed:`passed`,failed:`failed`};function qe(e,t){let n=e.trim().toLowerCase();if(!n)return!0;let r=t.runId.toLowerCase().includes(n),i=(t.testName??``).toLowerCase().includes(n);return r||i}function Je(){p(`Runs`);let e=he(),[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(0),[a,o]=(0,U.useState)([]),[s,d]=(0,U.useState)(!0),{tab:f,search:m,platform:g,target:_,attributePredicates:v,page:y,sorting:b,onSortingChange:re,setTab:C,setSearch:w,setPlatform:T,setTarget:ie,setAttributePredicates:ue,setPage:pe}=Ge(),[D,ge]=(0,U.useState)(!1),[A,M]=(0,U.useState)(null),[N,P]=(0,U.useState)([]),[F,I]=(0,U.useState)(()=>new Set),[R,ye]=(0,U.useState)(null),[be,z]=(0,U.useState)(!1),[xe,B]=(0,U.useState)(!1),[Se,V]=(0,U.useState)(!0),[H,Ce]=(0,U.useState)(!0),{hasFarm:Oe,isLoading:ke}=c(),G=(0,U.useCallback)(async(e,t,r,a)=>{try{if(r&&r!==`running`){n(e),i(t);return}let{executions:o}=await ae();if(o.length===0){n(e),i(t);return}let s=new Set(e.map(e=>e.id)),c=o.filter(e=>!s.has(e.runId)).filter(e=>qe(a,e)).map(e=>({id:e.runId,name:e.testName??`Running test...`,filePath:null,status:`running`,duration:e.duration,attributes:{},environment:null,metadata:null,startedAt:e.startedAt,endedAt:null,videoPath:null,failureSummary:null,errorLog:null,memoryLog:null,testId:null,suiteId:null,platform:`web`,testFileContent:null,modelName:null,llmProvider:null,parentRunId:null,attemptNumber:1,retryCount:0,maxRetries:0,createdAt:e.startedAt}));n([...c,...e]),i(t+c.length)}catch{n(e),i(t)}},[]),K=(0,U.useCallback)(e=>({limit:50,offset:(e.page-1)*50,name:e.name||void 0,status:e.status||void 0,platform:e.platform||void 0,target:e.target||void 0,attributes:e.attributes}),[]),Ae=Ke[f]??``,je=(0,U.useCallback)(async e=>{try{d(!0);let[t,n]=await Promise.all([j(K(e)),O()]);ye(n),o(t.targets??[]),await G(t.runs,t.total,e.status,e.name)}catch{S.error(`Failed to load runs`)}finally{d(!1),ge(!0)}},[G,K]),q=(0,U.useCallback)(async e=>{try{let[t,n]=await Promise.all([j(K(e)),O()]);ye(n),o(t.targets??[]),await G(t.runs,t.total,e.status,e.name)}catch{}},[G,K]),J=(0,U.useMemo)(()=>({page:y,name:m,status:Ae,platform:g,target:_,attributes:v}),[y,m,Ae,g,_,v]);(0,U.useEffect)(()=>{je(J)},[je,J]),(0,U.useEffect)(()=>{if(!D)return;let e=setInterval(()=>{q(J)},5e3);return()=>clearInterval(e)},[D,q,J]),(0,U.useEffect)(()=>{M(null),I(new Set),P([])},[f,m,g,_,v,y]),(0,U.useEffect)(()=>{A&&(N.some(e=>e.id===A)||M(t.find(e=>e.tests?.some(e=>e.id===A))?.id??null))},[t,A,N]);let Y=De({items:t,getId:e=>e.id,visibleIds:t.map(e=>e.id)}),Me=Y.selectedIds,X=Y.selectedItems,Ne=(0,U.useCallback)(()=>{Y.clearSelection(),B(!1),V(!0),Ce(!0)},[Y]),Pe=(0,U.useCallback)(async e=>{if(X.length===0)return;let t=X.flatMap(e=>e.filePath?[e.filePath]:[]);if(t.length===0){S.error(`No selected runs can be rerun`);return}z(!0);try{let n=await Promise.allSettled(t.map(t=>fe({file:t,local:e,noCache:!Se,noMemory:!H}))),r=n.filter(e=>e.status===`fulfilled`).length,i=n.length-r;i>0?S.error(`${r} runs queued, ${i} failed`):S.success(`${r} runs queued`),B(!1)}finally{z(!1)}},[X,Se,H]),Fe=(0,U.useCallback)(async()=>{if(X.length===0)return;let e=Array.from(new Set(X.flatMap(e=>e.filePath?[e.filePath]:[])));if(e.length===0){S.error(`No selected runs have file paths to purge`);return}z(!0);try{let t=await Promise.allSettled(e.map(e=>_e({file:e}))),n=t.filter(e=>e.status===`fulfilled`).length,r=t.filter(e=>e.status===`fulfilled`).reduce((e,t)=>e+t.value.purged,0),i=t.length-n;i>0?S.error(`Purged ${r} plans from ${n} tests, ${i} failed`):S.success(`Purged ${r} cached plan${r===1?``:`s`} from ${n} test${n===1?``:`s`}`)}finally{z(!1)}},[X]),Ie=(0,U.useCallback)(async()=>{if(X.length!==0){z(!0);try{let e=await Promise.allSettled(X.map(e=>ve(e.id))),t=X.filter((t,n)=>e[n]?.status===`fulfilled`),r=new Set(e.flatMap(e=>e.status===`fulfilled`?e.value.deletedRunIds:[])),a=e.length-t.length;t.length>0&&(Y.setItemsSelected(t,!1),n(e=>e.filter(e=>!r.has(e.id))),i(e=>Math.max(0,e-t.length)),B(!1)),a>0?S.error(`Deleted ${t.length} run${t.length===1?``:`s`}, ${a} failed`):S.success(`Deleted ${t.length} run${t.length===1?``:`s`}`)}finally{z(!1)}}},[X,Y]),Le=(0,U.useCallback)(e=>{I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Z=(0,U.useCallback)((t,n)=>{let r=ne.runDetailOrLive(t.id,t.status);if(n?.metaKey||n?.ctrlKey||n?.button===1){window.open(r,`_blank`,`noopener,noreferrer`);return}e(r)},[e]),Q=(0,U.useCallback)((e,t)=>{Z(e,t)},[Z]),$=(0,U.useMemo)(()=>N.findIndex(e=>e.id===A),[A,N]);Te((0,U.useMemo)(()=>{let e=e=>{if(N.length!==0){if($===-1){M(e>0?N[0].id:N[N.length-1].id);return}M(N[Math.max(0,Math.min($+e,N.length-1))].id)}},t=()=>e(1),n=()=>e(-1);return{j:t,arrowdown:t,k:n,arrowup:n,enter:e=>{$<0||Z(N[$].run,e)}}},[Z,$,N]));let Re=R?.running.count??0,Be=R?.pending.count??0,Ve=Be>0||Re>0;if(!D)return(0,W.jsx)(me,{});let He=!!m||f!==`all`||!!g||!!_||v.length>0;if(t.length===0&&!He)return(0,W.jsx)(we,{icon:de,title:`No test runs yet`,description:`Run your first test to see results here`,actionLabel:`View Tests`,onAction:()=>e(ne.tests)});let Ue=(0,W.jsx)(te,{value:f,onValueChange:C,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(ee,{variant:`line`,children:[(0,W.jsx)(x,{value:`all`,children:`All`}),(0,W.jsxs)(x,{value:`running`,children:[`Running`,Re>0&&(0,W.jsx)(L,{variant:`secondary`,className:`ml-1 px-1.5 text-xs`,children:Re})]}),(0,W.jsxs)(x,{value:`queued`,children:[`Queued`,Be>0&&(0,W.jsx)(L,{variant:`secondary`,className:`ml-1 px-1.5 text-xs`,children:Be})]}),(0,W.jsx)(x,{value:`completed`,children:`Completed`}),(0,W.jsx)(x,{value:`failed`,children:`Failed`})]}),Ve&&R&&(0,W.jsxs)(L,{variant:`outline`,className:`text-xs`,children:[R.activeSlots,`/`,R.concurrency,` slots`]})]})});return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4 overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Runs`}),(0,W.jsx)(ce,{children:(0,W.jsxs)(k,{children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,children:(0,W.jsx)(u,{className:`h-4 w-4`})})}),(0,W.jsx)(oe,{side:`bottom`,className:`p-3`,children:(0,W.jsx)(l,{hints:[{key:`J / ↓`,label:`Next row`},{key:`K / ↑`,label:`Previous row`},{key:`Enter`,label:`Open run`},{key:`⌘+Enter`,label:`Open in new tab`}]})})]})})]}),(0,W.jsx)(ze,{topSlot:Ue,runs:t,total:r,isLoading:s,page:y-1,onPageChange:e=>pe(e+1),onSearchChange:w,searchValue:m,selectedRunId:A,onSelectedRunIdChange:M,expandedSuites:F,onToggleSuite:Le,onOpenRun:Q,onVisibleRunsChange:P,platformFilter:g,onPlatformChange:T,targetFilter:_,targetOptions:a,onTargetChange:ie,attributePredicates:v,onAttributePredicatesChange:ue,sorting:b,onSortingChange:re,enableSelection:!0,selectedRunIds:Y.selectedIdSet,onToggleRunSelection:Y.setItemSelected,onToggleVisibleSelection:Y.setItemsSelected}),(0,W.jsx)(h,{selectedCount:Me.length,summaryMeta:Y.hiddenCount>0?`${Y.hiddenCount} hidden by filters`:void 0,secondaryIcon:(0,W.jsx)(se,{className:`size-4`}),secondaryAriaLabel:`Clear queue`,onDelete:Ie,actionSlot:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Ee,{selectedCount:Y.selectedCount,hiddenCount:Y.hiddenCount,useCache:Se,useMemory:H,browserStackAvailable:!ke&&Oe,open:xe,onOpenChange:B,onUseCacheChange:V,onUseMemoryChange:Ce,onRunLocal:()=>Pe(!0),onRunBrowserStack:()=>Pe(!1),disabled:be}),(0,W.jsx)(E,{variant:`outline`,size:`sm`,onClick:Fe,disabled:be,children:`Purge cache`})]}),onCancel:Ne,isRunning:be})]})}export{Je as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{l as t}from"./select-CeVjgiKI.js";import{t as n}from"./shortcut-hints-Bs5o743i.js";import{t as r}from"./dist-BPJgj1d0.js";import{r as i}from"./use-page-title-B1t9-5_U.js";import{n as a,r as o,t as s}from"./dist-BPheZrD6.js";import{$t as c,Cn as l,Dn as u,En as d,Jn as f,Mn as p,Qn as m,Qt as ee,Rn as h,Ut as g,V as te,Wt as _,Xt as v,Zt as y,_n as ne,bn as b,en as x,fn as S,gn as re,hn as ie,jn as C,kn as w,mn as ae,pn as oe,pr as se,vn as T,wn as E,xn as ce,yn as D}from"./index-Bvtm2F6f.js";var O=f(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),k=f(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),A=e(se(),1),j=m(),M=[`Enter`,` `],le=[`ArrowDown`,`PageUp`,`Home`],ue=[`ArrowUp`,`PageDown`,`End`],de=[...le,...ue],fe={ltr:[...M,`ArrowRight`],rtl:[...M,`ArrowLeft`]},N={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},P=`Menu`,[F,pe,me]=r(P),[I,he]=E(P,[me,x,o]),L=x(),ge=o(),[_e,R]=I(P),[ve,z]=I(P),ye=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,l=L(t),[u,d]=A.useState(null),f=A.useRef(!1),p=T(o),m=i(a);return A.useEffect(()=>{let e=()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>f.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,j.jsx)(c,{...l,children:(0,j.jsx)(_e,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:d,children:(0,j.jsx)(ve,{scope:t,onClose:A.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:s,children:r})})})};ye.displayName=P;var be=`MenuAnchor`,B=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=L(n);return(0,j.jsx)(v,{...i,...r,ref:t})});B.displayName=be;var V=`MenuPortal`,[xe,Se]=I(V,{forceMount:void 0}),Ce=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=R(V,t);return(0,j.jsx)(xe,{scope:t,forceMount:n,children:(0,j.jsx)(b,{present:n||a.open,children:(0,j.jsx)(ie,{asChild:!0,container:i,children:r})})})};Ce.displayName=V;var H=`MenuContent`,[we,U]=I(H),Te=A.forwardRef((e,t)=>{let n=Se(H,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=R(H,e.__scopeMenu),o=z(H,e.__scopeMenu);return(0,j.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(b,{present:r||a.open,children:(0,j.jsx)(F.Slot,{scope:e.__scopeMenu,children:o.modal?(0,j.jsx)(Ee,{...i,ref:t}):(0,j.jsx)(De,{...i,ref:t})})})})}),Ee=A.forwardRef((e,t)=>{let n=R(H,e.__scopeMenu),r=A.useRef(null),i=p(t,r);return A.useEffect(()=>{let e=r.current;if(e)return S(e)},[]),(0,j.jsx)(W,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),De=A.forwardRef((e,t)=>{let n=R(H,e.__scopeMenu);return(0,j.jsx)(W,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oe=w(`MenuContent.ScrollLock`),W=A.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:g,disableOutsideScroll:te,..._}=e,v=R(H,n),y=z(H,n),b=L(n),x=ge(n),S=pe(n),[ie,C]=A.useState(null),w=A.useRef(null),se=p(t,w,v.onContentChange),T=A.useRef(0),E=A.useRef(``),ce=A.useRef(0),D=A.useRef(null),O=A.useRef(`right`),k=A.useRef(0),M=te?oe:A.Fragment,le=te?{as:Oe,allowPinchZoom:!0}:void 0,fe=e=>{let t=E.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ct(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};A.useEffect(()=>()=>window.clearTimeout(T.current),[]),ae();let N=A.useCallback(e=>O.current===D.current?.side&&ut(e,D.current?.area),[]);return(0,j.jsx)(we,{scope:n,searchRef:E,onItemEnter:A.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:A.useCallback(e=>{N(e)||(w.current?.focus(),C(null))},[N]),onTriggerLeave:A.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:A.useCallback(e=>{D.current=e},[]),children:(0,j.jsx)(M,{...le,children:(0,j.jsx)(re,{asChild:!0,trapped:i,onMountAutoFocus:l(o,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,j.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:g,children:(0,j.jsx)(a,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:ie,onCurrentTabStopIdChange:C,onEntryFocus:l(u,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,j.jsx)(ee,{role:`menu`,"aria-orientation":`vertical`,"data-state":it(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:se,style:{outline:`none`,..._.style},onKeyDown:l(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&fe(e.key));let i=w.current;if(e.target!==i||!de.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);ue.includes(e.key)&&a.reverse(),ot(a)}),onBlur:l(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:l(e.onPointerMove,Y(e=>{let t=e.target,n=k.current!==e.clientX;e.currentTarget.contains(t)&&n&&(O.current=e.clientX>k.current?`right`:`left`,k.current=e.clientX)}))})})})})})})});Te.displayName=H;var ke=`MenuGroup`,Ae=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{role:`group`,...r,ref:t})});Ae.displayName=ke;var je=`MenuLabel`,Me=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{...r,ref:t})});Me.displayName=je;var G=`MenuItem`,Ne=`menu.itemSelect`,K=A.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=A.useRef(null),o=z(G,e.__scopeMenu),s=U(G,e.__scopeMenu),c=p(t,a),d=A.useRef(!1),f=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ne,{bubbles:!0,cancelable:!0});e.addEventListener(Ne,e=>r?.(e),{once:!0}),u(e,t),t.defaultPrevented?d.current=!1:o.onClose()}};return(0,j.jsx)(Pe,{...i,ref:c,disabled:n,onClick:l(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:l(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:l(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||M.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});K.displayName=G;var Pe=A.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=U(G,n),c=ge(n),u=A.useRef(null),f=p(t,u),[m,ee]=A.useState(!1),[h,g]=A.useState(``);return A.useEffect(()=>{let e=u.current;e&&g((e.textContent??``).trim())},[a.children]),(0,j.jsx)(F.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,j.jsx)(s,{asChild:!0,...c,focusable:!r,children:(0,j.jsx)(d.div,{role:`menuitem`,"data-highlighted":m?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:f,onPointerMove:l(e.onPointerMove,Y(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:l(e.onPointerLeave,Y(e=>o.onItemLeave(e))),onFocus:l(e.onFocus,()=>ee(!0)),onBlur:l(e.onBlur,()=>ee(!1))})})})}),Fe=`MenuCheckboxItem`,Ie=A.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,j.jsx)(We,{scope:e.__scopeMenu,checked:n,children:(0,j.jsx)(K,{role:`menuitemcheckbox`,"aria-checked":J(n)?`mixed`:n,...i,ref:t,"data-state":at(n),onSelect:l(i.onSelect,()=>r?.(J(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ie.displayName=Fe;var Le=`MenuRadioGroup`,[Re,ze]=I(Le,{value:void 0,onValueChange:()=>{}}),Be=A.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=T(r);return(0,j.jsx)(Re,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,j.jsx)(Ae,{...i,ref:t})})});Be.displayName=Le;var Ve=`MenuRadioItem`,He=A.forwardRef((e,t)=>{let{value:n,...r}=e,i=ze(Ve,e.__scopeMenu),a=n===i.value;return(0,j.jsx)(We,{scope:e.__scopeMenu,checked:a,children:(0,j.jsx)(K,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":at(a),onSelect:l(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});He.displayName=Ve;var Ue=`MenuItemIndicator`,[We,Ge]=I(Ue,{checked:!1}),Ke=A.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ge(Ue,n);return(0,j.jsx)(b,{present:r||J(a.checked)||a.checked===!0,children:(0,j.jsx)(d.span,{...i,ref:t,"data-state":at(a.checked)})})});Ke.displayName=Ue;var qe=`MenuSeparator`,Je=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Je.displayName=qe;var Ye=`MenuArrow`,Xe=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=L(n);return(0,j.jsx)(y,{...i,...r,ref:t})});Xe.displayName=Ye;var Ze=`MenuSub`,[Qe,$e]=I(Ze),et=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=R(Ze,t),o=L(t),[s,l]=A.useState(null),[u,d]=A.useState(null),f=T(i);return A.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,j.jsx)(c,{...o,children:(0,j.jsx)(_e,{scope:t,open:r,onOpenChange:f,content:u,onContentChange:d,children:(0,j.jsx)(Qe,{scope:t,contentId:D(),triggerId:D(),trigger:s,onTriggerChange:l,children:n})})})};et.displayName=Ze;var q=`MenuSubTrigger`,tt=A.forwardRef((e,t)=>{let n=R(q,e.__scopeMenu),r=z(q,e.__scopeMenu),i=$e(q,e.__scopeMenu),a=U(q,e.__scopeMenu),o=A.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},d=A.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return A.useEffect(()=>d,[d]),A.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,j.jsx)(B,{asChild:!0,...u,children:(0,j.jsx)(Pe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":it(n.open),...e,ref:C(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:l(e.onPointerMove,Y(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:l(e.onPointerLeave,Y(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:l(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||fe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});tt.displayName=q;var nt=`MenuSubContent`,rt=A.forwardRef((e,t)=>{let n=Se(H,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=R(H,e.__scopeMenu),o=z(H,e.__scopeMenu),s=$e(nt,e.__scopeMenu),c=A.useRef(null),u=p(t,c);return(0,j.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(b,{present:r||a.open,children:(0,j.jsx)(F.Slot,{scope:e.__scopeMenu,children:(0,j.jsx)(W,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:l(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:l(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=N[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});rt.displayName=nt;function it(e){return e?`open`:`closed`}function J(e){return e===`indeterminate`}function at(e){return J(e)?`indeterminate`:e?`checked`:`unchecked`}function ot(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function st(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ct(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=st(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function lt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ut(e,t){return t?lt({x:e.clientX,y:e.clientY},t):!1}function Y(e){return t=>t.pointerType===`mouse`?e(t):void 0}var dt=ye,ft=B,pt=Ce,mt=Te,ht=Ae,gt=Me,_t=K,vt=Ie,yt=Be,bt=He,xt=Ke,St=Je,Ct=Xe,wt=tt,Tt=rt,X=`DropdownMenu`,[Et,Dt]=E(X,[he]),Z=he(),[Ot,kt]=Et(X),At=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Z(t),l=A.useRef(null),[u,d]=ce({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,j.jsx)(Ot,{scope:t,triggerId:D(),triggerRef:l,contentId:D(),open:u,onOpenChange:d,onOpenToggle:A.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,j.jsx)(dt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};At.displayName=X;var jt=`DropdownMenuTrigger`,Mt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=kt(jt,n),o=Z(n);return(0,j.jsx)(ft,{asChild:!0,...o,children:(0,j.jsx)(d.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:C(t,a.triggerRef),onPointerDown:l(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:l(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mt.displayName=jt;var Nt=`DropdownMenuPortal`,Pt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Z(t);return(0,j.jsx)(pt,{...r,...n})};Pt.displayName=Nt;var Ft=`DropdownMenuContent`,It=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kt(Ft,n),a=Z(n),o=A.useRef(!1);return(0,j.jsx)(mt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:l(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:l(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});It.displayName=Ft;var Lt=`DropdownMenuGroup`,Rt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(ht,{...i,...r,ref:t})});Rt.displayName=Lt;var zt=`DropdownMenuLabel`,Bt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(gt,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`DropdownMenuItem`,Ht=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(_t,{...i,...r,ref:t})});Ht.displayName=Vt;var Ut=`DropdownMenuCheckboxItem`,Wt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(vt,{...i,...r,ref:t})});Wt.displayName=Ut;var Gt=`DropdownMenuRadioGroup`,Kt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(yt,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuRadioItem`,Jt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(bt,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuItemIndicator`,Xt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(xt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuSeparator`,Qt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(St,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuArrow`,en=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(Ct,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuSubTrigger`,nn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(wt,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuSubContent`,an=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(Tt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});an.displayName=rn;var on=At,sn=Mt,cn=Pt,ln=It,un=Ht,dn=Qt;function fn({...e}){return(0,j.jsx)(on,{"data-slot":`dropdown-menu`,...e})}function pn({...e}){return(0,j.jsx)(sn,{"data-slot":`dropdown-menu-trigger`,...e})}function mn({className:e,sideOffset:t=4,...n}){return(0,j.jsx)(cn,{children:(0,j.jsx)(ln,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:_(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Q({className:e,inset:t,variant:n=`default`,...r}){return(0,j.jsx)(un,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:_(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function hn({className:e,...t}){return(0,j.jsx)(dn,{"data-slot":`dropdown-menu-separator`,className:_(`-mx-1 my-1 h-px bg-border`,e),...t})}var $=null,gn=null;function _n(){let[e,t]=(0,A.useState)(()=>$?{...$,isLoading:!1}:{defaultRunMode:`local`,hasFarm:!1,isLoading:!0});return(0,A.useEffect)(()=>{if($){t({...$,isLoading:!1});return}gn||=te().then(e=>{let t=e.config,n=t.farm;$={defaultRunMode:t.defaultRunMode===`farm`?`farm`:`local`,hasFarm:!!n?.provider}}).catch(()=>{$={defaultRunMode:`local`,hasFarm:!1}}).finally(()=>{gn=null}),gn.then(()=>{t({...$,isLoading:!1})})},[]),e}function vn({onRun:e,onRunNoCache:r,onPurgeCache:i,disabled:a=!1,size:o=`default`,className:s,label:c,shortcutKey:l}){let{hasFarm:u}=_n(),d=u||!!r||!!i,f=c??`Run`,p=l?(0,j.jsx)(n,{shortcut:l,className:`border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground`}):null;return d?(0,j.jsxs)(`div`,{className:_(`inline-flex items-center`,s),children:[(0,j.jsxs)(g,{size:o,disabled:a,onClick:()=>e(!0),className:`rounded-r-none`,children:[(0,j.jsx)(h,{className:`size-4`}),f,p]}),(0,j.jsxs)(fn,{children:[(0,j.jsx)(pn,{asChild:!0,children:(0,j.jsx)(g,{variant:`default`,size:o,disabled:a,className:`rounded-l-none border-l border-l-primary-foreground/20 px-2`,children:(0,j.jsx)(t,{className:`h-4 w-4`})})}),(0,j.jsxs)(mn,{align:`end`,children:[(0,j.jsxs)(Q,{onClick:()=>e(!0),children:[(0,j.jsx)(k,{className:`mr-2 h-4 w-4`}),`Run Local`]}),u&&(0,j.jsxs)(Q,{onClick:()=>e(!1),children:[(0,j.jsx)(O,{className:`mr-2 h-4 w-4`}),`Run on Farm`]}),(r||i)&&(0,j.jsx)(hn,{}),r&&(0,j.jsx)(Q,{onClick:()=>r(!0),children:`Run without cache`}),i&&(0,j.jsx)(Q,{onClick:i,children:`Purge cache`})]})]})]}):(0,j.jsxs)(g,{size:o,disabled:a,onClick:()=>e(!0),className:s,children:[(0,j.jsx)(h,{className:`size-4`}),f,p]})}export{Q as a,O as c,mn as i,_n as n,pn as o,fn as r,k as s,vn as t};
@@ -1 +0,0 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]);export{t};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{c as t}from"./id-badge-NwZYoNfB.js";import{t as n}from"./monaco-editor-DNT0Mzki.js";import{n as r}from"./split-button-DcY8ames.js";import{a as i,c as a,i as ee,n as o,o as te,r as ne,s,t as c}from"./filename-validation-4sTTEagx.js";import{t as re}from"./use-page-title-B1t9-5_U.js";import{a as ie,n as ae}from"./dist-m_OM4Je_.js";import{i as oe,n as se,r as ce,t as le}from"./tabs-DrB_Acb3.js";import{$n as l,At as u,Bn as ue,Bt as de,D as fe,E as pe,Et as me,Ht as he,It as ge,Lt as _e,Mt as d,Ot as ve,Pt as f,Qn as ye,Rt as be,S as xe,St as Se,V as Ce,Vn as we,Yt as Te,cr as Ee,jt as p,lr as De,ot as Oe,pr as ke,r as Ae,ur as je,zt as Me}from"./index-Bvtm2F6f.js";import{n as m,r as Ne,t as Pe}from"./resizable-BGEcNRZO.js";import{t as Fe}from"./empty-state-BTvOA5lp.js";import{t as Ie}from"./use-keyboard-shortcuts-EAppuiKO.js";import{i as Le,n as Re,r as ze,t as Be}from"./suite-navbar-PStktQ6j.js";var h=e(ke(),1);function Ve(e,t){return c(e,t,`suiteMatch`)}var g=ye(),He=`name: My Suite
2
- target: ""
3
- tests: []
4
- `;function Ue(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function We(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function Ge({text:e}){return(0,g.jsxs)(p,{children:[(0,g.jsx)(f,{asChild:!0,children:(0,g.jsx)(ue,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,g.jsx)(d,{className:`max-w-[250px] text-[13px]`,children:e})]})}function _(){let e=De()[`suite-id`]??``,c=Ee(),[ue]=je(),d=Te(),{defaultRunMode:f}=r(),{targets:ye,globalUse:p,isLoading:ke}=t(),_=!e,Ke=ue.get(`live`)===`1`,v=(0,h.useRef)(null),y=(0,h.useRef)(null),qe=(0,h.useRef)(()=>{}),Je=(0,h.useRef)(!1),b=(0,h.useRef)(null),x=(0,h.useRef)(null),[S,C]=(0,h.useState)(_?He:``),[Ye,Xe]=(0,h.useState)(``),[w,Ze]=(0,h.useState)(``),[T,Qe]=(0,h.useState)(!_),[$e,et]=(0,h.useState)(!1),[tt,nt]=(0,h.useState)(!1),[rt,it]=(0,h.useState)(!1),[at,ot]=(0,h.useState)(!1),[E,st]=(0,h.useState)(null),[ct,lt]=(0,h.useState)(!1),[ut,dt]=(0,h.useState)(!1),[D,ft]=(0,h.useState)([]),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(null),[M,N]=(0,h.useState)(!1),[P,F]=(0,h.useState)(!1),[I,L]=(0,h.useState)(null),[pt,R]=(0,h.useState)(`reasoning`),[mt,z]=(0,h.useState)(null),[B,V]=(0,h.useState)({setup:[],teardown:[]}),[H,ht]=(0,h.useState)(``),gt=!_&&S!==Ye,_t=_&&w?Ve(w.trim(),D):null,U=_&&!!w&&!!_t,{suggestions:vt}=o(null),yt=(0,h.useMemo)(()=>vt.filter(e=>e.namespace!==`capture`),[vt]),W=(0,h.useMemo)(()=>ze(S),[S]),bt=W?.suiteId??``,xt=W?.name||(_?`New Suite`:H),G=ee(O,{tests:(0,h.useMemo)(()=>W?W.tests.map(e=>({draftId:e.id,testId:e.id,path:e.test,name:e.test.split(`/`).pop()??e.test,steps:[],setup:[],teardown:[]})):[],[W]),setupHooks:B.setup,teardownHooks:B.teardown,allowReconnect:!1}),K=G.terminateSession;y.current=O,qe.current=K;let St=W?.target?.trim()??``,q=P?`connecting`:G.connectionState,J=O!==null,Y=J&&W!==null&&(!Ue(W.setup??[],B.setup)||!Ue(W.teardown??[],B.teardown)),Ct=J&&q===`connected`&&W!==null&&W.tests.length>0,wt=P||J,Tt=P||J||at||E!==null||_||W===null||!W?.target.trim()||ke;re((0,h.useMemo)(()=>J&&A!==null?`Live #${A} — ${W?.name?.trim()||xt||`Suite`}`:_?`New Suite`:`Edit Suite`,[J,A,W?.name,xt,_]));let X=(0,h.useMemo)(()=>{if(W)return{suiteName:W.name,suiteContext:W.context||void 0}},[W]),Et=(0,h.useMemo)(()=>I===`ended`?{reason:`ended`,title:`Live session ended`,description:`The current draft is unchanged. Close live mode or start a fresh disposable session from this target.`}:I===`disconnected`?{reason:`disconnected`,title:`Live session disconnected`,description:`The connection dropped and the disposable session was terminated. Start a fresh session to reconnect.`}:null,[I]);(0,h.useEffect)(()=>{if(_)return;let t=!1;return Oe(e).then(e=>{t||(C(e.content),Xe(e.content),ht(e.path),Qe(!1))}).catch(()=>{t||(et(!0),Qe(!1))}),()=>{t=!0}},[e,_]),(0,h.useEffect)(()=>{let e=!1;return Ce().then(t=>{if(e)return;let n=t.config?.workspace?.suiteMatch;Array.isArray(n)&&ft(n)}).catch(()=>{}),()=>{e=!0}},[]),(0,h.useEffect)(()=>{_&&C(e=>Le(e,[`suite-id`],ae()))},[_]),(0,h.useEffect)(()=>{if(_||T)return;let e=ze(S);e&&!e.suiteId&&C(e=>Le(e,[`suite-id`],ae()))},[_,T,Ye]);let Z=(0,h.useCallback)(async()=>{nt(!0);try{if(_){let e=Ve(w.trim(),D);if(e){u.error(e);return}await fe(w.trim(),S),u.success(`Suite file created`);let t=W?.suiteId??``;if(!t){u.error(`Created suite is missing suite-id; please reload`);return}c(l.suiteEdit(t))}else await me(e,S),Xe(S),u.success(`Saved`)}catch(e){e instanceof xe&&e.missingTests&&e.missingTests.length>0?u.error(`Cannot save — referenced tests not found: ${e.missingTests.map(e=>e.test).join(`, `)}`):u.error(`Failed to save: ${e instanceof Error?e.message:String(e)}`)}finally{nt(!1)}},[_,w,D,S,e,W?.suiteId,c]),Dt=(0,h.useCallback)(async()=>{it(!0);try{let e=await ve(S);e.valid?u.success(`Valid suite`):u.error(e.errors.map(e=>e.message).join(`
5
- `))}catch(e){u.error(`Validation failed: ${e instanceof Error?e.message:String(e)}`)}finally{it(!1)}},[S]),Ot=(0,h.useCallback)(async e=>{if(!_){ot(!0);try{st((await Se({file:H,local:e})).runId),u.success(`Suite run started`)}catch(e){u.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`)}finally{ot(!1)}}},[_,H]),kt=(0,h.useCallback)(()=>st(null),[]),At=(0,h.useCallback)(()=>{i(`page`,`closing live mode`,{liveSessionId:O??void 0,terminalReason:I??void 0}),v.current?.abort(),v.current=null,O&&K(),F(!1),k(null),j(null),L(null),z(null),b.current=null,x.current=null,V({setup:[],teardown:[]}),N(!1)},[O,I,K]),jt=(0,h.useCallback)(()=>{i(`page`,`ending live session from UI`,{liveSessionId:O??void 0}),v.current?.abort(),v.current=null,O&&K(),F(!1),k(null),j(null),L(`ended`),z(null),b.current=null,x.current=null,V({setup:[],teardown:[]}),N(!1)},[O,K]),Q=(0,h.useCallback)(async(e,t)=>{let n=e.target.trim();if(!n){u.error(`Select a target before starting live mode`);return}let r=new AbortController;v.current?.abort(),v.current=r,N(!0),L(null),R(`reasoning`),z(null),b.current=null,x.current=null,F(!0);try{t?.replaceCurrentSession&&y.current&&(K(),k(null),j(null));let a=ne({content:S,targetName:n,targets:ye,globalUse:p});i(`page`,`requesting live session`,{targetName:n,platform:a.platform,headless:a.headless??void 0,replacingSession:t?.replaceCurrentSession??!1});let ee=[...e.setup??[]],o=[...e.teardown??[]],te=e.suiteId?{type:`suite`,id:e.suiteId}:void 0,{sessionId:s,sessionNumber:c}=await pe({...a,setupHooks:ee,teardownHooks:o,entity:te},r.signal);if(r.signal.aborted)return;V({setup:ee,teardown:o}),k(s),j(c),i(`page`,`live session created`,{sessionId:s,targetName:n})}catch(e){We(e)||(i(`page`,`failed to create live session`,{error:e instanceof Error?e.message:String(e),targetName:n}),u.error(e instanceof Error?e.message:`Failed to start live session`)),t?.replaceCurrentSession||N(!1)}finally{v.current===r&&(v.current=null),F(!1)}},[S,p,ye,K]),$=(0,h.useCallback)(async()=>{if(!Tt){if(!W){u.error(`Fix YAML errors before starting live mode`);return}await Q(W)}},[W,Q,Tt]),Mt=(0,h.useCallback)(async()=>{if(J){if(!W){u.error(`Fix YAML errors before restarting live mode`);return}await Q(W,{replaceCurrentSession:!0})}},[W,J,Q]),Nt=(0,h.useCallback)(e=>{if(e){N(!0);return}At()},[At]),Pt=(0,h.useCallback)((e,t)=>{if(!J){u.error(`Start a live session first.`);return}let n=(e===`setup`?G.setupHooks:G.teardownHooks).find(e=>e.id===t);n&&z({type:`suite-hook`,phase:e,hookId:n.id}),R(`reasoning`),G.executeHookById(e,t)},[J,G]),Ft=(0,h.useCallback)(e=>{z({type:`test`,testIndex:e}),R(`reasoning`),G.executeTestByIndex(e,X)},[X,G]);if((0,h.useEffect)(()=>()=>{v.current?.abort(),y.current&&qe.current()},[]),(0,h.useEffect)(()=>{O&&q===`disconnected`&&(i(`page`,`live session moved to terminal state`,{liveSessionId:O,liveConnectionState:q}),k(null),j(null),F(!1),L(`disconnected`),z(null),b.current=null,x.current=null,V({setup:[],teardown:[]}),N(!0))},[q,O]),(0,h.useEffect)(()=>{if(!M||G.runningTestIndex===null)return;let e=`${G.tests[G.runningTestIndex]?.testExecutionId??`pending`}:${G.runningTestIndex}`;b.current!==e&&(b.current=e,z({type:`test`,testIndex:G.runningTestIndex}),R(`reasoning`))},[G.runningTestIndex,G.tests,M]),(0,h.useEffect)(()=>{if(!M||G.runningTestIndex!==null)return;let e=G.tests.map((e,t)=>({index:t,test:e})).filter(({test:e})=>e.status===`failed`).sort((e,t)=>(t.test.lastRunAt??``).localeCompare(e.test.lastRunAt??``))[0];if(!e)return;let t=e.test.testExecutionId??e.test.lastRunAt??`failed:${e.index}`;x.current!==t&&(x.current=t,z({type:`test`,testIndex:e.index}),R(`reasoning`))},[G.runningTestIndex,G.tests,M]),(0,h.useEffect)(()=>{!Ke||Je.current||_||T||$e||P||M||J||!W||!W.target.trim()||(Je.current=!0,c(l.suiteEdit(e),{replace:!0}),$())},[W,$,J,_,P,T,M,c,$e,e,Ke]),Ie((0,h.useMemo)(()=>({r:()=>{_||Ot(f===`local`)},escape:()=>{E&&kt()}}),[_,E,Ot,kt,f])),(0,h.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),Z())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Z]),T)return(0,g.jsx)(Ae,{});if($e)return(0,g.jsx)(Fe,{icon:we,title:`Suite not found`,description:`This suite doesn't exist`,actionLabel:`View All Suites`,onAction:()=>c(l.suites)});let It=(0,g.jsxs)(le,{defaultValue:`builder`,className:`flex-1 flex min-h-0 flex-col`,children:[(0,g.jsxs)(ce,{variant:`line`,className:`px-4`,children:[(0,g.jsx)(oe,{value:`builder`,children:`Builder`}),(0,g.jsx)(oe,{value:`yaml`,children:`YAML`})]}),(0,g.jsx)(se,{value:`builder`,className:`mt-2 flex-1 overflow-auto [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground/50 [&::-webkit-scrollbar-track]:bg-transparent [scrollbar-width:thin]`,children:(0,g.jsx)(Re,{content:S,onChange:C,suggestions:yt,isCreateMode:_,liveMode:M,liveTests:G.tests,liveSetupHooks:G.setupHooks,liveTeardownHooks:G.teardownHooks,runningTestIndex:G.runningTestIndex,canRunTest:J&&G.connectionState===`connected`,canRunAll:Ct,isRunningAll:G.isRunningAllTests,isStoppingRunAll:G.isStoppingRunAllTests,onRunTest:Ft,onCancelTest:e=>{G.runningTestIndex===e&&G.cancelStep()},onRunAll:()=>void G.runAllTests(X),onStopAll:G.cancelRunAllTests,setupHooksStale:Y,onRestartSession:Y?()=>void Mt():void 0,selection:mt,onSelect:z,onRunLiveHook:Pt})}),(0,g.jsx)(se,{value:`yaml`,className:`flex-1 min-h-0 mt-2`,children:(0,g.jsx)(n,{value:S,onChange:C,onSave:Z,className:`h-full`,filePath:H||void 0})})]}),Lt=(0,g.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[_&&(0,g.jsx)(`div`,{className:`px-4 pt-3`,children:(0,g.jsxs)(`div`,{className:`rounded-md border bg-muted/15 px-3 py-2`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsxs)(ie,{className:`flex items-center gap-1 text-xs font-medium`,children:[`File Path `,(0,g.jsx)(Ge,{text:`Path is relative to your workspace root. Must match your workspace's suiteMatch pattern. Directories are created automatically on save.`})]}),(0,g.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Created only when you save`})]}),(0,g.jsx)(he,{placeholder:`my-suite.suite.yaml`,value:w,onChange:e=>Ze(e.target.value),className:`mt-2 max-w-md h-8 text-sm font-mono ${U?`border-red-500 focus-visible:ring-red-500`:``}`}),U&&(0,g.jsx)(`p`,{className:`mt-1 text-xs text-red-500`,children:_t})]})}),It]}),Rt=(0,g.jsx)(te,{connectionState:G.connectionState,isLaunching:P,targetName:St||`Selected Target`,targetLabel:G.currentUrl||`Configured start URL`,liveSessionNumber:A,platform:G.platform,screenshot:G.screenshot,currentUrl:G.currentUrl,pendingNavigation:G.pendingNavigation,steps:G.steps,setupHooks:G.setupHooks,teardownHooks:G.teardownHooks,tests:G.tests,selection:mt,runningStepId:G.runningStepId,terminalState:Et,draftState:W===null?`invalid`:gt||_?`unsaved`:`saved`,ariaTree:G.ariaTree,errorMessage:G.error,devtoolsTab:pt,canRunAll:Ct,isRunningAll:G.isRunningAllTests,isStoppingRunAll:G.isStoppingRunAllTests,setupHooksStale:Y,executionUnit:`test`,runAllLabel:`Run All Tests`,stopAllLabel:`Stop Run All`,unitRowsSlot:null,onDevtoolsTabChange:R,onRunAll:()=>void G.runAllTests(X),onStopAll:G.cancelRunAllTests,onEndSession:jt,onRestartSession:Y?()=>void Mt():void 0,showEndSessionAction:d,onCloseLiveMode:At,onStartFreshSession:()=>void $(),onBack:G.goBack,onForward:G.goForward,onRefresh:G.refreshPage,onNavigate:G.navigate,onRequestAriaTree:G.requestAriaTree});return(0,g.jsxs)(`div`,{className:`flex h-screen flex-col`,children:[(0,g.jsx)(Be,{suiteName:xt,suiteId:bt,unsaved:gt,isCreateMode:_,mode:`edit`,suiteHref:_?void 0:l.suiteView(e),isSaving:tt,isValidating:rt,isRunning:at,runDisabled:wt,hasInvalidFilename:U,shortcutsOpen:ut,hasLiveSession:J,liveConnectionState:q,isLiveActionDisabled:Tt,liveSessionNumber:A,onBack:()=>c(l.suites),onSave:Z,onValidate:Dt,onRun:Ot,onLiveConnect:M?void 0:$,onLiveEnd:J?jt:void 0,onSettingsOpen:()=>lt(!0),onToggleShortcuts:()=>dt(e=>!e)}),E?(0,g.jsxs)(Ne,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,g.jsx)(m,{defaultSize:60,minSize:30,children:(0,g.jsx)(n,{value:S,onChange:C,onSave:Z,className:`h-full`})}),(0,g.jsx)(Pe,{withHandle:!0}),(0,g.jsx)(m,{defaultSize:40,minSize:25,children:(0,g.jsx)(s,{runId:E,onClose:kt})})]}):M&&!d?(0,g.jsxs)(Ne,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,g.jsx)(m,{defaultSize:45,minSize:30,children:Lt}),(0,g.jsx)(Pe,{withHandle:!0}),(0,g.jsx)(m,{defaultSize:55,minSize:40,children:Rt})]}):Lt,(0,g.jsx)(ge,{open:ct,onOpenChange:lt,children:(0,g.jsxs)(_e,{side:`right`,className:`sm:max-w-[400px] overflow-y-auto p-0`,children:[(0,g.jsxs)(Me,{className:`px-4 pt-4 pb-2`,children:[(0,g.jsx)(de,{children:`Suite Settings`}),(0,g.jsx)(be,{children:`Advanced configuration for this suite`})]}),(0,g.jsx)(`div`,{className:`px-4 pb-4`,children:(0,g.jsx)(a,{content:S,onChange:C,selectedTarget:W?.target,showMeta:!1})})]})}),d&&(0,g.jsx)(ge,{open:M,onOpenChange:Nt,children:(0,g.jsxs)(_e,{side:`bottom`,showCloseButton:!1,className:`h-[100dvh] max-h-[100dvh] rounded-none p-0`,children:[(0,g.jsxs)(Me,{className:`sr-only`,children:[(0,g.jsx)(de,{children:`Live Session`}),(0,g.jsx)(be,{children:`Live execution workspace for the current suite draft.`})]}),Rt]})})]})}export{_ as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as i,t as a}from"./select-CeVjgiKI.js";import{t as o}from"./circle-alert-BKX0IIz1.js";import{C as s,S as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as ee,y as te}from"./id-badge-NwZYoNfB.js";import{n as ne,r as O}from"./monaco-editor-DNT0Mzki.js";import{t as re}from"./circle-x-yPIxYoz1.js";import{c as ie,t as k}from"./split-button-DcY8ames.js";import{t as ae}from"./grip-vertical-A-AANrBM.js";import{n as A,r as j,t as M}from"./shortcut-hints-Bs5o743i.js";import{t as oe}from"./plus-pXO98OAE.js";import{t as N}from"./refresh-cw-C_0AkMuu.js";import{n as P,t as F}from"./textarea-DChEVvwQ.js";import{t as I}from"./square-D71GHEET.js";import{a as L,n as R}from"./dist-m_OM4Je_.js";import{n as z,r as B,t as V}from"./popover-DGZi688D.js";import{Bn as H,Fn as se,Ht as ce,Mt as U,Nn as le,Pn as W,Pt as G,Qn as ue,Rn as de,Un as K,Ut as q,Wn as J,Wt as Y,c as fe,d as pe,dt as me,jt as X,l as he,o as ge,pr as _e,s as ve,sr as Z,u as ye,zn as be}from"./index-Bvtm2F6f.js";import{t as xe}from"./badge-DrW2vGVJ.js";import{t as Se}from"./display-step-NqsJgW_B.js";var Q=e(_e(),1),$=ue();function Ce({text:e}){return(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(H,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,$.jsx)(U,{className:`max-w-[250px] text-[13px]`,children:e})]})}function we({name:e,suiteId:o,target:c,context:l,isCreateMode:d,suggestions:p,hookLabels:m={},onChange:h,disabled:g=!1}){let{targets:v,isLoading:y}=_(),{targets:x}=f(),S=c?x[c]:void 0,w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(0),D=u({text:l,cursorPos:T,suggestions:p,anchorRef:w,onInsert:(e,t,n)=>{h(`context`,l.slice(0,t)+e+l.slice(n)),requestAnimationFrame(()=>w.current?.focus())}}),ee=!y&&v.length>0;return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(L,{htmlFor:`suite-name`,className:`text-xs flex items-center gap-1`,children:[`Suite Name `,(0,$.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,$.jsx)(ce,{id:`suite-name`,value:e,onChange:e=>h(`name`,e.target.value),placeholder:`My Suite`,required:!0,disabled:g,className:`h-8 text-sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(L,{htmlFor:`suite-id`,className:`text-xs flex items-center gap-1`,children:[`Suite ID `,(0,$.jsx)(Ce,{text:`Unique identifier used for memory and analytics. Changing this breaks the association with past runs and observations.`})]}),d?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ce,{id:`suite-id`,value:o,readOnly:!0,disabled:!0,className:`h-8 text-sm font-mono pr-9`}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>h(`suite-id`,R()),"aria-label":`Generate new ID`,disabled:g,className:`absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6`,children:(0,$.jsx)(N,{className:`size-3.5`})})]}):(0,$.jsx)(`p`,{className:`text-[13px] font-mono text-muted-foreground`,children:o||`No ID assigned`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(L,{htmlFor:`suite-target`,className:`text-xs flex items-center gap-1`,children:[`Target `,(0,$.jsx)(`span`,{className:`text-destructive`,children:`*`}),` `,(0,$.jsx)(Ce,{text:`A registered app target from your workspace config. Defines where the suite runs (web URL or mobile app).`})]}),ee?(0,$.jsxs)(a,{value:c||void 0,onValueChange:e=>h(`target`,e),disabled:g,children:[(0,$.jsx)(r,{id:`suite-target`,className:`w-full h-8 text-sm`,children:(0,$.jsx)(i,{placeholder:`Select a target`})}),(0,$.jsx)(n,{children:v.map(e=>(0,$.jsx)(t,{value:e,children:e},e))})]}):y?null:(0,$.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No targets configured.`,` `,(0,$.jsx)(Z,{to:`/config`,className:`text-primary underline underline-offset-4 hover:text-primary/80`,children:`Add targets in Settings.`})]}),S&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted-foreground mt-1.5`,children:[S.platform===`web`?(0,$.jsx)(ie,{className:`h-3.5 w-3.5 shrink-0`}):(0,$.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`text-muted-foreground/70 uppercase text-[11px] tracking-wider shrink-0`,children:S.platform}),(0,$.jsxs)(`span`,{className:`font-mono truncate`,children:[S.product&&(0,$.jsx)(`span`,{className:`mr-1.5`,children:S.product}),S.platform===`web`&&S.url,S.platform===`android`&&`${S.appPackage}${S.appActivity?` / ${S.appActivity}`:``}`,S.platform===`ios`&&S.bundleId]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(L,{htmlFor:`suite-context`,className:`text-xs flex items-center gap-1`,children:[`Context `,(0,$.jsx)(Ce,{text:`Additional instructions passed to every test in this suite before its own context. Use this for suite-wide setup notes or shared preconditions.`})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(F,{ref:w,id:`suite-context`,value:l,onChange:e=>{h(`context`,e.target.value),E(e.target.selectionStart??0)},onKeyDown:e=>{D.handleKeyDown(e)},onBlur:()=>setTimeout(()=>D.setVisible(!1),150),placeholder:`Additional instructions applied to every test in this suite...`,disabled:g,className:`min-h-[60px] resize-none text-sm`,rows:2}),D.dropdown]}),C(l)&&(0,$.jsx)(b,{text:l,hookLabels:m})]})]})}function Te(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function Ee({status:e}){switch(e){case`running`:return(0,$.jsx)(D,{className:`size-3 text-primary`});case`passed`:return(0,$.jsx)(K,{className:`size-3 text-emerald-500`});case`failed`:return(0,$.jsx)(se,{className:`size-3 text-destructive`});default:return(0,$.jsx)(W,{className:`size-3 text-muted-foreground`})}}function De({status:e}){switch(e){case`running`:case`cancelling`:return(0,$.jsx)(D,{className:`size-3 text-primary`});case`passed`:return(0,$.jsx)(K,{className:`size-3 text-emerald-500`});case`failed`:return(0,$.jsx)(re,{className:`size-3 text-red-500`});case`cancelled`:return(0,$.jsx)(I,{className:`size-3 text-amber-500`});default:return(0,$.jsx)(D,{className:`size-3 text-muted-foreground/50`})}}function Oe(e){return e.observation?e.observation:e.reasoning?e.reasoning:e.plannedAction==null?e.verifierReasoning?e.verifierReasoning:e.result:`Planned action captured`}function ke({id:e,name:t,path:n,testId:r,isMissing:i,onRemove:a,disabled:o=!1,actionsLocked:s=!1,sortableDisabled:l=!1,liveMode:u=!1,liveStatus:d=`idle`,liveDuration:f,liveError:p=null,liveSteps:m=[],runningStepIndex:h=null,perTestSetupHooks:g=[],perTestTeardownHooks:_=[],canRunTest:y=!0,onRunTest:b,onCancelTest:x,testIndex:S,selection:C=null,onSelect:w}){let{attributes:T,listeners:E,setNodeRef:ee,transform:te,transition:ne,isDragging:O}=v({id:e,disabled:o||l}),ie={transform:c.Transform.toString(te),transition:ne,opacity:O?.55:1,zIndex:O?10:void 0},k=u&&d===`running`,A=u&&d===`passed`,j=u&&d===`failed`,M=u&&(A||j||u&&d===`cancelled`)&&f!=null,oe=u&&C?.type===`test`&&S!==void 0&&C.testIndex===S,N=u&&g.length+_.length>0,P=u?m.map(e=>({step:e,displayStep:Se(e,e.stepIndex)})):[],F=C&&`stepId`in C?C.stepId:null,L=C?.type===`subaction`?C.subIndex:null;return(0,$.jsxs)(`div`,{ref:ee,style:ie,className:Y(`relative overflow-hidden flex flex-col gap-0.5 rounded-md border bg-card/60 px-3 py-2 hover:bg-card transition-colors`,i&&`border-amber-500/30`,i&&`bg-amber-500/[0.06]`,!i&&`border-border/70`,O&&`shadow-lg ring-2 ring-primary/20`,o&&`opacity-60`,k&&`live-running-surface border-border/60 bg-primary/5`,j&&!k&&`border-destructive/30`,j&&!k&&!oe&&`ring-1 ring-destructive/20`,oe&&!k&&`bg-primary/10 ring-1 ring-primary/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:`mt-0.5 flex shrink-0 items-center p-0.5 text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing touch-none disabled:cursor-not-allowed`,...T,...E,"aria-label":`Reorder ${t}`,"aria-disabled":o||l,disabled:o||l,children:(0,$.jsx)(ae,{className:`size-3.5`})}),k&&(0,$.jsx)(D,{className:`size-4 shrink-0 mt-0.5 text-primary`}),A&&(0,$.jsx)(K,{className:`size-3.5 text-emerald-500 shrink-0 mt-1`}),j&&(0,$.jsx)(re,{className:`size-3.5 text-red-500 shrink-0 mt-1`}),(0,$.jsxs)(`div`,{className:Y(`flex-1 min-w-0 space-y-0.5`,u&&w&&`cursor-pointer`),onClick:u&&w&&S!==void 0?()=>w({type:`test`,testIndex:S}):void 0,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:t}),(0,$.jsx)(`div`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:n}),(0,$.jsx)(`div`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:r}),P.length>0&&(0,$.jsx)(`div`,{className:`mt-1.5 space-y-1.5`,children:P.map(({step:e,displayStep:t},n)=>{let r=e.status===`running`||h===e.stepIndex,i=oe&&F===null&&(r||h===null&&n===P.length-1),a=F===e.id||i,o=t.subActionsData??[];return(0,$.jsxs)(`div`,{className:Y(`relative overflow-hidden rounded-sm border bg-background/60`,r?`live-running-surface border-border/60 bg-primary/5`:a?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-border/60`),children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left`,onClick:t=>{t.stopPropagation(),w?.({type:`step`,stepId:e.id})},"aria-label":`Select step ${e.stepIndex+1} ${e.instruction}`,children:[(0,$.jsx)(De,{status:e.status}),(0,$.jsxs)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[`Step `,e.stepIndex+1]}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:e.instruction})]}),(r||a)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-2 gap-y-0.5 px-2 pb-1 text-[11px] text-muted-foreground`,children:[r&&(0,$.jsx)(`span`,{children:`Current step`}),a&&(0,$.jsx)(`span`,{children:`Inspecting below`})]}),o.length>0&&(0,$.jsx)(`div`,{className:`space-y-1 border-t border-border/50 px-2 py-1.5`,children:o.map(t=>(0,$.jsxs)(`button`,{type:`button`,className:Y(`flex w-full min-w-0 items-center gap-2 rounded-sm px-1.5 py-1 text-left text-[11px] transition-colors`,a&&L===t.index?`bg-primary/15 text-foreground`:`text-muted-foreground hover:bg-muted/40`),onClick:n=>{n.stopPropagation(),w?.({type:`subaction`,stepId:e.id,subIndex:t.index})},"aria-label":`Select sub-action ${t.index+1} for step ${e.stepIndex+1}`,children:[(0,$.jsxs)(`span`,{className:`shrink-0 font-medium`,children:[`Sub `,t.index+1]}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Oe(t)})]},`${e.id}-sub-${t.index}`))})]},e.id)})}),i&&(0,$.jsx)(`div`,{className:`text-[11px] text-amber-700 dark:text-amber-300`,children:`This test file no longer exists in your workspace.`})]}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex shrink-0 self-start items-center gap-1`,children:[M&&(0,$.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground whitespace-nowrap shrink-0`,children:Te(f)}),u&&!k&&(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:b,disabled:!y||!b||s,className:Y(`text-muted-foreground hover:text-foreground`,(!y||!b||s)&&`text-muted-foreground/30`),"aria-label":d===`idle`?`Run test ${t}`:`Re-run test ${t}`,children:(0,$.jsx)(de,{className:`size-3.5`})}),u&&k&&x&&(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:x,className:`text-muted-foreground hover:text-foreground`,"aria-label":`Cancel test ${t}`,children:(0,$.jsx)(I,{className:`size-3`})}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-destructive`,onClick:a,disabled:o||s,"aria-label":`Remove ${t}`,children:(0,$.jsx)(le,{className:`size-3.5`})})]})]}),j&&p&&(0,$.jsxs)(`p`,{className:`text-destructive text-xs mt-1 ml-7 line-clamp-2`,children:[p,` — see Reasoning tab for details`]}),N&&(0,$.jsxs)(`ul`,{className:`mt-1.5 space-y-1 pl-5`,children:[g.map(e=>{let t=C?.type===`test-hook`&&C.hookId===e.id;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>S!==void 0&&w?.({type:`test-hook`,testIndex:S,phase:`setup`,hookId:e.id}),className:Y(`relative flex w-full items-center gap-2 overflow-hidden rounded-sm border px-1.5 py-0.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-transparent bg-transparent hover:bg-muted/40`),children:[(0,$.jsx)(W,{className:`size-3 text-muted-foreground shrink-0`}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate flex-1`,children:[`setup: `,e.name]}),(0,$.jsx)(Ee,{status:e.status})]})},`setup-${e.id}`)}),_.map(e=>{let t=C?.type===`test-hook`&&C.hookId===e.id;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>S!==void 0&&w?.({type:`test-hook`,testIndex:S,phase:`teardown`,hookId:e.id}),className:Y(`relative flex w-full items-center gap-2 overflow-hidden rounded-sm border px-1.5 py-0.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-transparent bg-transparent hover:bg-muted/40`),children:[(0,$.jsx)(W,{className:`size-3 text-muted-foreground shrink-0`}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate flex-1`,children:[`teardown: `,e.name]}),(0,$.jsx)(Ee,{status:e.status})]})},`teardown-${e.id}`)})]})]})}function Ae({availableTests:e,onAdd:t,disabled:n=!1}){return e.length===0?(0,$.jsxs)(`div`,{className:`rounded-md border bg-card/20 p-3 text-sm text-muted-foreground`,children:[`No test files found.`,` `,(0,$.jsx)(Z,{to:`/tests/new`,className:`text-primary underline underline-offset-4 hover:text-primary/80`,children:`Create a test first.`})]}):(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(ge,{className:`rounded-md border`,children:[(0,$.jsx)(he,{placeholder:`Search by test name, path, or ID...`,disabled:n}),(0,$.jsxs)(pe,{className:`max-h-64`,children:[(0,$.jsx)(ve,{children:`No tests match your query.`}),(0,$.jsx)(fe,{children:e.map(e=>(0,$.jsx)(ye,{value:`${e.name} ${e.path} ${e.testId??``}`,onSelect:()=>t({test:e.path,id:e.testId??``}),disabled:n,className:`px-2 py-1.5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5 w-full min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.name}),(0,$.jsx)(`span`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:e.path}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:e.testId??``})]})},e.path))})]})]}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60`,children:`Type to filter by name, path, or test ID. Click to add. Same test can be added multiple times.`})]})}var je=[`name`,`suite-id`,`target`,`use`,`context`,`setup`,`tests`,`teardown`];function Me(e){function t(e,n){if(S(e)){n?e.items.sort((e,t)=>{let n=je.indexOf(String(e.key)),r=je.indexOf(String(t.key));return(n===-1?je.length:n)-(r===-1?je.length:r)}):e.items.sort((e,t)=>String(e.key).localeCompare(String(t.key)));for(let n of e.items)t(n.value,!1)}}t(e.contents,!0)}function Ne(e){return Me(e),e.toString()}function Pe(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Fe(e){return Array.isArray(e)?e.map(e=>{if(e&&typeof e==`object`&&`test`in e&&`id`in e){let t=e;if(typeof t.test==`string`&&typeof t.id==`string`)return{test:t.test,id:t.id}}return null}).filter(e=>e!==null):[]}function Ie(e){try{let t=y(e);if(t.errors.length>0)return null;let n=t.toJSON();return!n||typeof n!=`object`?null:{name:n.name??``,suiteId:n[`suite-id`]??``,target:n.target??``,context:n.context??``,setup:Pe(n.setup),teardown:Pe(n.teardown),tests:Fe(n.tests)}}catch{return null}}function Le(e,t,n){try{let r=y(e);return n===void 0||Array.isArray(n)&&n.length===0||n===``?r.deleteIn(t):r.setIn(t,n),Ne(r)}catch{return e}}function Re(e,t,n){try{if(t===n||t<0||n<0)return e;let r=y(e),i=Fe(r.toJSON()?.tests);if(t>=i.length||n>=i.length)return e;let a=[...i],[o]=a.splice(t,1);return a.splice(n,0,o),r.setIn([`tests`],a),Ne(r)}catch{return e}}function ze(e,t){try{let n=y(e),r=Fe(n.toJSON()?.tests);return n.setIn([`tests`],[...r,t]),Ne(n)}catch{return e}}function Be(e,t){try{let n=y(e),r=Fe(n.toJSON()?.tests);if(t<0||t>=r.length)return e;let i=r.filter((e,n)=>n!==t);return i.length===0?n.deleteIn([`tests`]):n.setIn([`tests`],i),Ne(n)}catch{return e}}function Ve({text:e}){return(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(H,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,$.jsx)(U,{className:`max-w-[250px] text-[13px]`,children:e})]})}function He({status:e}){switch(e){case`running`:return(0,$.jsx)(D,{className:`size-3.5 text-primary`});case`passed`:return(0,$.jsx)(K,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,$.jsx)(se,{className:`size-3.5 text-destructive`});default:return(0,$.jsx)(W,{className:`size-3.5 text-muted-foreground`})}}function Ue(e){return e===`running`||e===`cancelling`}function We(e){return e===`running`||e===`cancelling`}function Ge(e){return e===`running`}function Ke(e){return e.some(e=>Ge(e.status))}function qe(e){return Ue(e.status)||e.runningStepIndex!==null||e.liveSteps.some(e=>We(e.status))||Ke(e.perTestSetupHooks)||Ke(e.perTestTeardownHooks)}function Je({title:e,hooks:t,selection:n,onSelect:r}){return t.length===0?null:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider font-medium text-muted-foreground`,children:e}),(0,$.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>{let t=n?.type===`suite-hook`&&n.hookId===e.id;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r?.({type:`suite-hook`,phase:e.phase,hookId:e.id}),className:Y(`relative flex w-full items-center gap-2 overflow-hidden rounded-md border px-3 py-1.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-border/60 bg-card/40 hover:bg-card/60`),children:[(0,$.jsx)(He,{status:e.status}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,$.jsx)(`div`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.id})]})]})},e.id)})})]})}function Ye({content:e,onChange:t,disabled:n=!1,suggestions:r,isCreateMode:i=!1,liveMode:a=!1,liveTests:s=[],liveSetupHooks:c=[],liveTeardownHooks:u=[],runningTestIndex:f=null,canRunTest:_=!0,canRunAll:v=!1,isRunningAll:y=!1,isStoppingRunAll:b=!1,onRunTest:S,onCancelTest:C,onRunAll:w,onStopAll:D,onRunLiveHook:ne,setupHooksStale:re=!1,onRestartSession:ie,selection:k=null,onSelect:ae}){let A=(0,Q.useRef)(null),{hooks:j,warningCopy:M}=T(),N=j??[],P=(0,Q.useMemo)(()=>Object.fromEntries(N.map(e=>[e.id,e.name])),[N]),[F,L]=(0,Q.useState)([]),[R,z]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{me().then(e=>L(e.files)).catch(()=>{})},[]),(0,Q.useEffect)(()=>{if(!R)return;function e(e){e.key===`Escape`&&z(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R]);let B=Ie(e),V=B===null,H=B??A.current;B&&(A.current=B);let ce=ee(d(E,{activationConstraint:{distance:8}}),d(l,{coordinateGetter:x})),U=(0,Q.useCallback)((n,r)=>{t(Le(e,[n],r))},[e,t]),le=(0,Q.useCallback)(n=>{t(ze(e,n))},[e,t]),G=(0,Q.useCallback)(n=>{t(Be(e,n))},[e,t]),ue=H?.tests.map((e,t)=>`test-${t}`)??[],de=a&&(y||b),K=a&&(f!==null||s.some(e=>qe(e))||Ke(c)||Ke(u)),J=de||K,Y=de,fe=n||V||J,pe=(0,Q.useCallback)(r=>{if(n||V||J)return;let{active:i,over:a}=r;if(!a||i.id===a.id)return;let o=parseInt(String(i.id).replace(`test-`,``),10),s=parseInt(String(a.id).replace(`test-`,``),10);if(Number.isNaN(o)||Number.isNaN(s))return;let c=Re(e,o,s);c!==e&&t(c)},[e,n,t,J,V]);return(0,$.jsx)(`div`,{className:`flex flex-col`,children:(0,$.jsxs)(`div`,{className:`space-y-4 p-4`,children:[V&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,$.jsx)(o,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{children:`YAML has errors — builder shows last valid state`})]}),a&&re&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,$.jsx)(se,{className:`mt-0.5 size-4 shrink-0`}),(0,$.jsx)(`span`,{children:`Setup hooks changed — restart session to re-apply the latest setup and teardown hooks.`})]}),ie&&(0,$.jsx)(q,{type:`button`,size:`sm`,className:`shrink-0`,onClick:ie,children:`Restart Live Session`})]}),H?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{name:H.name,suiteId:H.suiteId,target:H.target,context:H.context,isCreateMode:i,suggestions:r,hookLabels:P,onChange:U,disabled:n||V}),a&&(0,$.jsx)(Je,{title:`Setup Hooks (Live)`,hooks:c,selection:k,onSelect:ae}),(0,$.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-card/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(W,{className:`size-4 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Hooks`})]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[H.setup.length+H.teardown.length,` `,H.setup.length+H.teardown.length===1?`hook`:`hooks`]})]}),M&&(0,$.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(o,{className:`mt-0.5 size-3.5 shrink-0`}),(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:M.title}),(0,$.jsx)(`p`,{children:M.body})]})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Search hook names or paste an h_ ID. Saved as stable ID in YAML. Inline runHook uses the stable hook ID.`}),(0,$.jsx)(p,{phase:`setup`,label:`Setup`,values:H.setup,suggestions:N,disabled:fe,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>U(`setup`,e)}),(0,$.jsx)(p,{phase:`teardown`,label:`Teardown`,values:H.teardown,suggestions:N,disabled:fe,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>U(`teardown`,e)})]})]}),a&&(0,$.jsx)(Je,{title:`Teardown Hooks (Live)`,hooks:u,selection:k,onSelect:ae}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[`Tests in Suite`,` `,(0,$.jsx)(Ve,{text:`Tests run in the order shown. Drag to reorder. The suite fails fast if any referenced test is missing at save.`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[H.tests.length,` `,H.tests.length===1?`test`:`tests`]}),a&&(0,$.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:y?D:w,disabled:b||!y&&!v,children:b?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(be,{className:`size-3.5 animate-spin`}),`Stopping...`]}):y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{className:`size-3.5`}),`Stop Run All`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{className:`size-3.5`}),`Run All Tests`]})})]})]}),H.tests.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tests added yet. Use the picker below.`}):(0,$.jsx)(h,{sensors:ce,collisionDetection:te,onDragEnd:pe,children:(0,$.jsx)(m,{items:ue,strategy:g,children:(0,$.jsx)(`div`,{className:`space-y-1.5`,children:H.tests.map((e,t)=>{let r=F.find(t=>t.path===e.test),i=r?.name??e.test.split(`/`).pop()??e.test,o=F.length>0&&!r,c=a?s[t]:void 0,l=a?_&&f===null&&!Y:!0;return(0,$.jsx)(ke,{id:`test-${t}`,name:i,path:e.test,testId:e.id,isMissing:o,onRemove:()=>G(t),disabled:n||V,actionsLocked:Y,sortableDisabled:J,liveMode:a,liveStatus:c?.status,liveDuration:c?.duration,liveError:c?.error??null,liveSteps:c?.liveSteps??[],runningStepIndex:c?.runningStepIndex??null,perTestSetupHooks:c?.perTestSetupHooks??[],perTestTeardownHooks:c?.perTestTeardownHooks??[],canRunTest:l,onRunTest:a&&S?()=>S(t):void 0,onCancelTest:a&&C?()=>C(t):void 0,testIndex:t,selection:k,onSelect:ae},`test-${t}`)})})})})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Available Tests`}),(0,$.jsxs)(q,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>z(e=>!e),disabled:n||V||Y,"aria-expanded":R,"aria-controls":`suite-test-picker-region`,children:[(0,$.jsx)(oe,{className:`size-3`}),R?`Hide picker`:`Add new test`]})]}),R&&(0,$.jsx)(`div`,{id:`suite-test-picker-region`,children:(0,$.jsx)(Ae,{availableTests:F,onAdd:le,disabled:n||V||Y})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12 text-sm text-muted-foreground`,children:`Enter valid YAML to use the visual builder`})]})})}function Xe({suiteName:e,suiteId:t,unsaved:n,isCreateMode:r,mode:i=`view`,suiteHref:a,isSaving:o,isValidating:s,isRunning:c,runDisabled:l=!1,hasInvalidFilename:u,shortcutsOpen:d,showSuiteId:f=!0,hasLiveSession:p=!1,liveConnectionState:m=`idle`,isLiveActionDisabled:h=!1,liveSessionNumber:g=null,onSave:_,onValidate:v,onRun:y,onLiveConnect:b,onLiveEnd:x,onSettingsOpen:S,onToggleShortcuts:C}){let T=i===`view`&&!r,E=!!b||!!x||p||m===`connecting`,D=!r||E,ee=!r&&!T&&i===`edit`,te=`Start a disposable live session for this suite. Setup hooks run on connect, included tests run serially on a shared browser context, teardown hooks run when the session ends, and changes are not saved automatically.`;return(0,$.jsxs)(`div`,{"data-testid":`suite-navbar-root`,className:`flex h-14 shrink-0 items-center justify-between border-b px-4 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Z,{to:`/suites`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:`Suites`}),(0,$.jsx)(J,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),r?(0,$.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`New Suite`}):a&&!T?(0,$.jsx)(Z,{to:a,className:`truncate text-sm font-medium hover:text-primary transition-colors`,children:e}):(0,$.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e}),ee&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`Edit`})]}),n&&(0,$.jsx)(xe,{variant:`outline`,className:`text-xs`,children:`Unsaved`}),!T&&!r&&t&&f&&(0,$.jsx)(w,{label:`S`,value:t})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-3 shrink-0`,children:T?(0,$.jsxs)($.Fragment,{children:[a?(0,$.jsx)(q,{variant:`outline`,size:`sm`,asChild:!0,children:(0,$.jsxs)(Z,{to:a,children:[`Edit`,(0,$.jsx)(M,{shortcut:`E`})]})}):(0,$.jsxs)(q,{variant:`outline`,size:`sm`,disabled:!0,children:[`Edit`,(0,$.jsx)(M,{shortcut:`E`})]}),(0,$.jsx)(k,{onRun:y,disabled:c||l,label:c?`Running...`:`Run`,shortcutKey:`R`,size:`sm`}),E&&(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsxs)(q,{size:`sm`,onClick:b,disabled:h||!b,children:[m===`connecting`?(0,$.jsx)(be,{className:`h-3.5 w-3.5 animate-spin`}):(0,$.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`,(0,$.jsx)(M,{shortcut:`L`,className:`border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground`})]})}),(0,$.jsx)(U,{className:`max-w-sm text-[13px]`,children:te})]}),!r&&(0,$.jsxs)(V,{open:d,onOpenChange:e=>{e||C()},children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(q,{variant:`ghost`,size:`icon-sm`,onClick:C,"aria-label":`Shortcuts`,children:(0,$.jsx)(j,{className:`h-3.5 w-3.5`})})})}),(0,$.jsx)(U,{children:`Shortcuts`})]}),(0,$.jsx)(z,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,$.jsx)(`div`,{className:`space-y-3`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,$.jsx)(A,{hints:[{key:`E`,label:`Edit`},{key:`R`,label:`Run`},{key:`L`,label:`Connect Live Session`}]})]})})})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:v,disabled:s||u,children:[(0,$.jsx)(K,{className:`h-3.5 w-3.5`}),s?`Validating...`:`Validate`]}),(0,$.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:_,disabled:o||u,children:[(0,$.jsx)(ne,{className:`h-3.5 w-3.5`}),o?`Saving...`:`Save`]}),(0,$.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,$.jsx)(P,{className:`h-3.5 w-3.5`}),`Settings`]}),D&&(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),!r&&(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(k,{onRun:y,disabled:c||l||p,label:c?`Running...`:`Run Suite`,size:`sm`})})}),p&&(0,$.jsx)(U,{children:`End the live session to queue a new suite run.`})]}),E&&(p&&m!==`connecting`?(0,$.jsxs)(q,{variant:`destructive`,size:`sm`,onClick:x,disabled:!x,children:[(0,$.jsx)(I,{className:`h-3.5 w-3.5`}),`End Live Session`]}):(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsxs)(q,{size:`sm`,onClick:b,disabled:h||!b,children:[m===`connecting`?(0,$.jsx)(be,{className:`h-3.5 w-3.5 animate-spin`}):(0,$.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`]})}),(0,$.jsx)(U,{className:`max-w-sm text-[13px]`,children:te})]})),!T&&p&&typeof g==`number`&&(m===`connected`||m===`executing`)&&(0,$.jsxs)(xe,{variant:`outline`,"aria-live":`polite`,className:`text-[10px] tracking-wider font-medium text-muted-foreground bg-muted/50 border-border/50`,children:[`Session #`,g]}),!r&&(0,$.jsxs)(V,{open:d,onOpenChange:e=>{e||C()},children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(q,{variant:`ghost`,size:`icon-sm`,onClick:C,children:(0,$.jsx)(j,{className:`h-3.5 w-3.5`})})})}),(0,$.jsx)(U,{children:`Shortcuts`})]}),(0,$.jsx)(z,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,$.jsx)(`div`,{className:`space-y-3`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,$.jsx)(A,{hints:[{key:`R`,label:`Run suite`},{key:`Cmd+S`,label:`Save`},{key:`Esc`,label:`Close results panel`}]})]})})})]})]})})]})}export{Le as i,Ye as n,Ie as r,Xe as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./monaco-editor-DNT0Mzki.js";import{t as n}from"./file-code-B3iDpJRP.js";import{n as r}from"./split-button-DcY8ames.js";import{t as i}from"./zap-KFJmkY3Y.js";import{t as a}from"./use-page-title-B1t9-5_U.js";import{a as o,n as s,o as ee,t as c}from"./insights-line-grid-BKOqA-1W.js";import{i as l,n as u,r as d,t as f}from"./tabs-DrB_Acb3.js";import{$n as p,At as m,Gt as h,Jt as g,Kt as _,Mt as v,Nt as te,Pt as y,Qn as b,St as ne,Ut as x,at as re,cr as ie,jt as S,lr as ae,ot as oe,pr as C,qt as w,r as se,sr as T,ur as ce}from"./index-Bvtm2F6f.js";import{t as E}from"./badge-DrW2vGVJ.js";import{a as D,i as O,n as k,o as A,r as j,t as M}from"./table-D08QBBt4.js";import{t as le}from"./empty-state-BTvOA5lp.js";import{t as ue}from"./use-keyboard-shortcuts-EAppuiKO.js";import{n as de,t as fe}from"./suite-navbar-PStktQ6j.js";import{n as pe,r as me,t as he}from"./viewer-url-state-6mOK5_sY.js";var N=e(C(),1),P=b(),ge=[`builder`,`yaml`,`memory`];function _e(e){let t=e.trim();return t.length>=2&&(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))?t.slice(1,-1).trim():t}function F(e){return{suiteId:e,total:0,flakyScore:0,isFlaky:!1,runs:[],trends:{daily:[],passRate:0,totalRuns:0,avgDuration:0}}}function I(e){if(!e)return``;let t=new Date(g(e)),n=Date.now()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);return o<7?`${o}d ago`:h(e)}function L({status:e}){switch(e){case`passed`:return(0,P.jsx)(E,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/20`,children:`Passed`});case`failed`:return(0,P.jsx)(E,{variant:`destructive`,children:`Failed`});case`healed`:return(0,P.jsx)(E,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Healed`});case`flaky`:return(0,P.jsx)(E,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Flaky`});case`running`:return(0,P.jsx)(E,{className:`bg-blue-500/15 text-blue-500 border-blue-500/20 animate-pulse`,children:`Running`});case`cancelled`:return(0,P.jsx)(E,{className:`bg-muted text-muted-foreground border-border`,children:`Cancelled`});default:return(0,P.jsx)(E,{variant:`outline`,children:e})}}function R({configured:e,mode:t,scopedCount:n,totalCount:r,onModeChange:i}){return e?(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`div`,{className:`inline-flex rounded border border-border p-0.5`,children:[`scoped`,`all`].map(e=>(0,P.jsx)(x,{type:`button`,size:`xs`,variant:t===e?`default`:`ghost`,"aria-pressed":t===e,className:`h-7 rounded-[2px] px-2 text-xs`,onClick:()=>i(e),children:e===`scoped`?`Scoped`:`All runs`},e))}),(0,P.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` scoped / `,r,` total runs`]})]}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No analytics scope configured`})}function z({runs:e,compactDate:t=!1}){return e.length===0?(0,P.jsx)(`div`,{className:`flex items-center justify-center h-16 text-sm text-muted-foreground`,children:`No runs yet`}):(0,P.jsxs)(M,{children:[(0,P.jsx)(D,{children:(0,P.jsxs)(A,{children:[(0,P.jsx)(O,{children:`Status`}),(0,P.jsx)(O,{children:`Duration`}),(0,P.jsx)(O,{children:`Date`})]})}),(0,P.jsx)(k,{children:e.map(e=>(0,P.jsxs)(A,{className:`relative cursor-pointer hover:bg-muted/50`,children:[(0,P.jsxs)(j,{children:[(0,P.jsx)(T,{to:p.runDetailOrLive(e.id,e.status),className:`absolute inset-0`,tabIndex:-1}),(0,P.jsx)(L,{status:e.status})]}),(0,P.jsx)(j,{children:e.status===`running`?(0,P.jsx)(`span`,{className:`text-blue-500 text-sm`,children:`In progress...`}):(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:w(e.duration)})}),(0,P.jsx)(j,{children:t?(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:I(e.createdAt)}):(0,P.jsxs)(S,{children:[(0,P.jsx)(y,{asChild:!0,children:(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:h(e.createdAt)})}),(0,P.jsx)(v,{children:_(e.createdAt)})]})})]},e.id))})]})}function B(){let e=ae(),h=ie(),[g,_]=ce(),{defaultRunMode:v}=r(),y=e[`suite-id`]??``,b=(0,N.useMemo)(()=>he(g,ge),[g]),x=(0,N.useMemo)(()=>pe(b,g),[g,b]),S=b.tab,C=b.view,[T,D]=(0,N.useState)(``),[O,k]=(0,N.useState)(``),[A,j]=(0,N.useState)(!0),[M,I]=(0,N.useState)(!1),[L,B]=(0,N.useState)(()=>F(y)),[V,H]=(0,N.useState)(`all`),[U,W]=(0,N.useState)(!1),[ve,ye]=(0,N.useState)(!1),G=(0,N.useMemo)(()=>{let e=T.match(/^name:\s*(.+)$/m);return e?_e(e[1]):null},[T]);a(G||`Suite`);let K=L.scope?.configured===!0,q=V===`scoped`&&K&&L.scopedTrends?L.scopedTrends:L.trends,J=V===`scoped`&&K&&L.scopedFlakyScore!==void 0?L.scopedFlakyScore:L.flakyScore,be=V===`scoped`&&K?L.scopedRuns??[]:L.runs,xe=(0,N.useMemo)(()=>q.daily.map(e=>({date:e.date,passRate:e.total>0?Math.round(e.passed/e.total*1e3)/10:0})),[q]),Se=(0,N.useMemo)(()=>L.trends.daily.map(e=>({date:e.date,duration:e.avgDuration})),[L]),Y=be;(0,N.useEffect)(()=>{H(L.scope?.configured?`scoped`:`all`)},[L]),(0,N.useEffect)(()=>{x.toString()!==g.toString()&&_(x,{replace:!0})},[x,g,_]),(0,N.useEffect)(()=>{if(!y){I(!0),j(!1),B(F(``));return}let e=!1;return j(!0),I(!1),D(``),k(``),B(F(y)),oe(y).then(t=>{e||(D(t.content),k(t.path))}).catch(()=>{e||(I(!0),m.error(`Failed to load suite file`))}).finally(()=>{e||j(!1)}),()=>{e=!0}},[y]),(0,N.useEffect)(()=>{if(!y)return;let e=!1;return re(y,{limit:50}).then(t=>{e||B(t)}).catch(()=>{e||B(F(y))}),()=>{e=!0}},[y]);let X=async e=>{if(!(U||!O)){W(!0);try{let t=await ne({file:O,local:e});m.success(`Run started`),h(p.runLive(t.runId))}catch(e){m.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`)}finally{W(!1)}}},Z=p.suiteEdit(y),Q=`${Z}?live=1`;ue({e:()=>h(Z),r:()=>{O&&X(v===`local`)},l:()=>h(Q)});let $=e=>{_(pe(e,g),{replace:!0})};if(A)return(0,P.jsx)(se,{});if(M)return(0,P.jsx)(le,{icon:n,title:`Suite not found`,description:`This suite doesn't exist`,actionLabel:`View All Suites`,onAction:()=>h(p.suites)});let Ce=(0,P.jsx)(de,{content:T,onChange:()=>{},disabled:!0,suggestions:[]}),we=(0,P.jsx)(t,{value:T,onChange:()=>{},readOnly:!0,className:`h-full`}),Te=(0,P.jsxs)(`aside`,{"data-testid":`suite-detail-analytics-sidebar`,className:`flex flex-col gap-0 overflow-y-auto border-t border-border md:border-t-0 md:border-l md:border-border`,children:[(0,P.jsx)(`div`,{className:`border-b border-border px-3 py-2`,children:(0,P.jsx)(R,{configured:K,mode:V,scopedCount:L.scope?.scopedCount??0,totalCount:L.scope?.totalCount??L.total,onModeChange:H})}),(0,P.jsxs)(s,{className:`grid-cols-2 divide-x divide-y-0 border-x-0 border-t-0`,children:[(0,P.jsxs)(c,{className:`flex flex-col gap-0.5 px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Pass Rate`}),(0,P.jsxs)(`span`,{className:`text-xl font-semibold text-foreground`,children:[Math.round(q.passRate*100),`%`]})]}),(0,P.jsxs)(c,{className:`flex flex-col gap-0.5 px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Avg Duration`}),(0,P.jsx)(`span`,{className:`text-xl font-semibold text-foreground`,children:w(L.trends.avgDuration)})]}),(0,P.jsxs)(c,{className:`flex flex-col gap-0.5 border-t border-border px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Total Runs`}),(0,P.jsx)(`span`,{className:`text-xl font-semibold text-foreground`,children:L.total.toLocaleString()})]}),(0,P.jsxs)(c,{className:`flex flex-col gap-0.5 border-t border-border px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Flaky Score`}),(0,P.jsxs)(`span`,{className:`text-xl font-semibold text-foreground`,children:[(J*100).toFixed(0),`%`]})]})]}),(0,P.jsx)(s,{className:`border-x-0 border-y-0`,children:(0,P.jsxs)(c,{className:`flex flex-col gap-2 px-3 py-3`,children:[(0,P.jsxs)(`span`,{className:`text-sm font-medium text-foreground`,children:[V===`scoped`&&K?`Scoped Runs`:`All Runs`,` (`,Y.length,`)`]}),(0,P.jsx)(z,{runs:Y.slice(0,5),compactDate:!0})]})})]});return(0,P.jsx)(te,{children:(0,P.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,P.jsx)(fe,{suiteName:G||`Suite`,suiteId:y,unsaved:!1,isCreateMode:!1,mode:`view`,suiteHref:Z,isSaving:!1,isValidating:!1,isRunning:U,runDisabled:!O,hasInvalidFilename:!1,shortcutsOpen:ve,showSuiteId:!1,onBack:()=>h(p.suites),onSave:()=>{},onValidate:()=>{},onRun:e=>X(e),onLiveConnect:()=>h(Q),onSettingsOpen:()=>{},onToggleShortcuts:()=>ye(e=>!e)}),(0,P.jsxs)(f,{value:S,onValueChange:e=>$({tab:e,view:C}),className:`flex-1 min-h-0 flex flex-col`,children:[(0,P.jsx)(`div`,{className:`px-4 border-b border-border`,children:(0,P.jsxs)(d,{variant:`line`,children:[(0,P.jsx)(l,{value:`overview`,children:`Overview`}),(0,P.jsx)(l,{value:`insights`,children:`Insights`})]})}),(0,P.jsxs)(u,{value:`overview`,className:`flex-1 min-h-0 mt-0 grid grid-cols-1 md:grid-cols-[minmax(480px,1fr)_minmax(260px,320px)]`,children:[(0,P.jsx)(`div`,{className:`min-w-0 min-h-0 flex flex-col`,children:(0,P.jsxs)(f,{value:C,onValueChange:e=>$({tab:S,view:e}),className:`flex-1 min-h-0 flex flex-col`,children:[(0,P.jsx)(`div`,{className:`border-b border-border`,children:(0,P.jsxs)(d,{variant:`line`,className:`w-full grid grid-cols-3 px-4 md:w-fit md:inline-flex`,children:[(0,P.jsx)(l,{value:`builder`,children:`Builder`}),(0,P.jsx)(l,{value:`yaml`,children:`YAML`}),(0,P.jsx)(l,{value:`memory`,children:`Memory`})]})}),(0,P.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[(0,P.jsx)(u,{value:`builder`,className:`absolute inset-0 overflow-y-auto data-[state=inactive]:hidden`,children:Ce}),(0,P.jsx)(u,{value:`yaml`,className:`absolute inset-0 data-[state=inactive]:hidden`,children:we}),(0,P.jsx)(u,{value:`memory`,className:`absolute inset-0 overflow-y-auto data-[state=inactive]:hidden`,children:(0,P.jsx)(me,{scope:`suite`,scopeId:y,emptyTitle:`No suite memory yet`,emptyDescription:`This suite doesn't have cataloged observations in this workspace yet. Run the suite with memory enabled, then reopen this tab.`})})]})]})}),Te]}),(0,P.jsx)(u,{value:`insights`,className:`flex-1 overflow-y-auto mt-0`,children:(0,P.jsxs)(`div`,{"data-testid":`suite-detail-insights`,className:`space-y-3 px-4 py-3`,children:[L.isFlaky&&(0,P.jsxs)(E,{variant:`destructive`,children:[(0,P.jsx)(i,{className:`size-3`}),`Flaky (score: `,L.flakyScore.toFixed(2),`)`]}),(0,P.jsxs)(s,{className:`grid-cols-2 divide-x divide-y-0 md:grid-cols-4`,children:[(0,P.jsx)(c,{className:`border-b border-border md:border-b-0`,children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Total Runs`}),(0,P.jsx)(`p`,{className:`mt-0.5 text-2xl font-semibold`,children:L.total.toLocaleString()})]})}),(0,P.jsx)(c,{className:`border-b border-border md:border-b-0 md:border-r`,children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pass Rate`}),(0,P.jsxs)(`p`,{className:`mt-0.5 text-2xl font-semibold`,children:[Math.round(q.passRate*100),`%`]})]})}),(0,P.jsx)(c,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Avg Duration`}),(0,P.jsx)(`p`,{className:`mt-0.5 text-2xl font-semibold`,children:w(L.trends.avgDuration)})]})}),(0,P.jsx)(c,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Flaky Score`}),(0,P.jsxs)(`p`,{className:`mt-0.5 text-2xl font-semibold`,children:[(J*100).toFixed(0),`%`]})]})})]}),(0,P.jsx)(s,{children:(0,P.jsx)(c,{className:`px-4 py-3`,children:(0,P.jsx)(R,{configured:K,mode:V,scopedCount:L.scope?.scopedCount??0,totalCount:L.scope?.totalCount??L.total,onModeChange:H})})}),q.daily.length>0&&(0,P.jsxs)(s,{className:`md:grid-cols-2 md:divide-x md:divide-y-0`,children:[(0,P.jsxs)(c,{className:`px-4 py-3`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Pass Rate`}),(0,P.jsx)(`div`,{className:`h-[160px] overflow-hidden`,children:(0,P.jsx)(ee,{data:xe})})]}),(0,P.jsxs)(c,{className:`px-4 py-3`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Duration`}),(0,P.jsx)(`div`,{className:`h-[160px] overflow-hidden`,children:(0,P.jsx)(o,{data:Se})})]})]}),(0,P.jsx)(s,{children:(0,P.jsxs)(c,{className:`px-4 py-3`,children:[(0,P.jsxs)(`p`,{className:`text-sm font-medium mb-2`,children:[V===`scoped`&&K?`Scoped Runs`:`All Runs`,` (`,Y.length,`)`]}),(0,P.jsx)(z,{runs:Y})]})})]})})]})]})})}export{B as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{i as t,l as n,n as r,o as i,s as a,t as o,u as s}from"./select-CeVjgiKI.js";import{t as c}from"./circle-x-yPIxYoz1.js";import{t as l}from"./copy-Clw3wvSn.js";import{t as u}from"./eye-CZrufbYE.js";import{t as d}from"./refresh-cw-C_0AkMuu.js";import{t as f}from"./dist-BPJgj1d0.js";import{r as p}from"./use-page-title-B1t9-5_U.js";import{Cn as m,En as h,Ft as g,Jn as _,Ln as v,Mn as y,Nn as ee,Qn as te,Rn as ne,Sn as re,Un as b,Wn as x,Wt as S,bn as ie,it as ae,pr as oe,qt as C,wn as se,xn as w,yn as T}from"./index-Bvtm2F6f.js";import{t as E}from"./badge-DrW2vGVJ.js";var ce=_(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),le=_(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ue=_(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),D=e(oe(),1),O=te(),k=`Collapsible`,[de,fe]=se(k),[pe,A]=de(k),me=D.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=w({prop:r,defaultProp:i??!1,onChange:o,caller:k});return(0,O.jsx)(pe,{scope:n,disabled:a,contentId:T(),open:c,onOpenToggle:D.useCallback(()=>l(e=>!e),[l]),children:(0,O.jsx)(h.div,{"data-state":P(c),"data-disabled":a?``:void 0,...s,ref:t})})});me.displayName=k;var he=`CollapsibleTrigger`,j=D.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=A(he,n);return(0,O.jsx)(h.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":P(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:m(e.onClick,i.onOpenToggle)})});j.displayName=he;var M=`CollapsibleContent`,N=D.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=A(M,e.__scopeCollapsible);return(0,O.jsx)(ie,{present:n||i.open,children:({present:e})=>(0,O.jsx)(ge,{...r,ref:t,present:e})})});N.displayName=M;var ge=D.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=A(M,n),[s,c]=D.useState(r),l=D.useRef(null),u=y(t,l),d=D.useRef(0),f=d.current,p=D.useRef(0),m=p.current,g=o.open||s,_=D.useRef(g),v=D.useRef(void 0);return D.useEffect(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),re(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,_.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,O.jsx)(h.div,{"data-state":P(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&i})});function P(e){return e?`open`:`closed`}var F=me,_e=j,ve=N,I=`Accordion`,ye=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[L,be,xe]=f(I),[R,Se]=se(I,[xe,fe]),z=fe(),Ce=D.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,O.jsx)(L.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,O.jsx)(Oe,{...a,ref:t}):(0,O.jsx)(De,{...i,ref:t})})});Ce.displayName=I;var[B,we]=R(I),[Te,Ee]=R(I,{collapsible:!1}),De=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=w({prop:n,defaultProp:r??``,onChange:i,caller:I});return(0,O.jsx)(B,{scope:e.__scopeAccordion,value:D.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:D.useCallback(()=>a&&c(``),[a,c]),children:(0,O.jsx)(Te,{scope:e.__scopeAccordion,collapsible:a,children:(0,O.jsx)(Ae,{...o,ref:t})})})}),Oe=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=w({prop:n,defaultProp:r??[],onChange:i,caller:I}),c=D.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=D.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,O.jsx)(B,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,O.jsx)(Te,{scope:e.__scopeAccordion,collapsible:!0,children:(0,O.jsx)(Ae,{...a,ref:t})})})}),[ke,V]=R(I),Ae=D.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=y(D.useRef(null),t),c=be(n),l=p(i)===`ltr`,u=m(e.onKeyDown,e=>{if(!ye.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=()=>{o=r+1,o>s&&(o=0)},d=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,O.jsx)(ke,{scope:n,disabled:r,direction:i,orientation:a,children:(0,O.jsx)(L.Slot,{scope:n,children:(0,O.jsx)(h.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),H=`AccordionItem`,[je,U]=R(H),Me=D.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=V(H,n),o=we(H,n),s=z(n),c=T(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,O.jsx)(je,{scope:n,open:l,disabled:u,triggerId:c,children:(0,O.jsx)(F,{"data-orientation":a.orientation,"data-state":Re(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});Me.displayName=H;var Ne=`AccordionHeader`,Pe=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(Ne,n);return(0,O.jsx)(h.h3,{"data-orientation":i.orientation,"data-state":Re(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});Pe.displayName=Ne;var W=`AccordionTrigger`,Fe=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(W,n),o=Ee(W,n),s=z(n);return(0,O.jsx)(L.ItemSlot,{scope:n,children:(0,O.jsx)(_e,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});Fe.displayName=W;var Ie=`AccordionContent`,Le=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(Ie,n),o=z(n);return(0,O.jsx)(ve,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});Le.displayName=Ie;function Re(e){return e?`open`:`closed`}var ze=Ce,Be=Me,Ve=Pe,He=Fe,Ue=Le;function G({...e}){return(0,O.jsx)(F,{"data-slot":`collapsible`,...e})}function K({...e}){return(0,O.jsx)(j,{"data-slot":`collapsible-trigger`,...e})}function q({...e}){return(0,O.jsx)(N,{"data-slot":`collapsible-content`,...e})}function We({confidence:e}){let t=Math.round(e*100);return(0,O.jsxs)(E,{variant:`outline`,className:S(`text-xs font-mono`,t>80?`bg-emerald-500/10 text-emerald-500 border-emerald-500/20`:t>=50?`bg-amber-500/10 text-amber-500 border-amber-500/20`:`bg-red-500/10 text-red-500 border-red-500/20`),children:[t,`%`]})}function Ge({...e}){return(0,O.jsx)(ze,{"data-slot":`accordion`,...e})}function Ke({className:e,...t}){return(0,O.jsx)(Be,{"data-slot":`accordion-item`,className:S(`border-b last:border-b-0`,e),...t})}function qe({className:e,children:t,...r}){return(0,O.jsx)(Ve,{className:`flex`,children:(0,O.jsxs)(He,{"data-slot":`accordion-trigger`,className:S(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...r,children:[t,(0,O.jsx)(n,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function Je({className:e,children:t,...n}){return(0,O.jsx)(Ue,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,O.jsx)(`div`,{className:S(`pt-0 pb-4`,e),children:t})})}function Ye({attempts:e}){return!e||e.length===0?null:(0,O.jsx)(Ge,{type:`single`,collapsible:!0,className:`w-full`,children:e.map((e,t)=>(0,O.jsxs)(Ke,{value:`attempt-${t}`,children:[(0,O.jsx)(qe,{className:`py-2 text-sm`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`Attempt `,e.attemptNumber??t+1]}),e.strategy&&(0,O.jsx)(E,{variant:`secondary`,className:`text-xs`,children:e.strategy}),e.success?(0,O.jsx)(b,{className:`h-3.5 w-3.5 text-emerald-500`}):(0,O.jsx)(c,{className:`h-3.5 w-3.5 text-red-500`})]})}),(0,O.jsxs)(Je,{className:`space-y-2`,children:[e.reasoning&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Reasoning`}),(0,O.jsx)(`p`,{className:`text-sm`,children:e.reasoning})]}),e.observationBefore&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Observation Before`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.observationBefore.length>200?`${e.observationBefore.slice(0,200)}…`:e.observationBefore})]}),e.observationAfter&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Observation After`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.observationAfter.length>200?`${e.observationAfter.slice(0,200)}…`:e.observationAfter})]}),e.action!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Action`}),(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto`,children:typeof e.action==`string`?e.action:JSON.stringify(e.action,null,2)})]})]})]},t))})}var J=[{key:`observe`,label:`Observe`,icon:u},{key:`plan`,label:`Plan`,icon:ce},{key:`execute`,label:`Execute`,icon:ne},{key:`verify`,label:`Verify`,icon:ue},{key:`heal`,label:`Heal`,icon:d}];function Xe(e){return e==null?``:typeof e==`string`?e:JSON.stringify(e,null,2)}function Y({config:e,content:t,duration:n,outcome:r,children:i,open:a,onOpenChange:o,sectionRef:s}){let[c,l]=(0,D.useState)(!1),u=a!==void 0,d=u?a:c,f=u?o:l,p=e.icon,m=t||i;return(0,O.jsxs)(G,{open:d,onOpenChange:f,children:[(0,O.jsxs)(K,{ref:s,className:`flex w-full items-center gap-2 py-1.5 text-left group sticky top-0 z-20 bg-background`,children:[(0,O.jsx)(`div`,{className:`flex items-center justify-center h-4 w-4 rounded-full bg-background border shrink-0`,children:(0,O.jsx)(p,{className:`h-2.5 w-2.5 text-muted-foreground`})}),(0,O.jsx)(`span`,{className:`text-sm font-medium`,children:e.label}),n!=null&&(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:C(n)}),r,(0,O.jsx)(`span`,{className:`flex-1`}),m&&(0,O.jsx)(x,{className:S(`h-3 w-3 text-muted-foreground transition-transform duration-200`,d&&`rotate-90`)})]}),m&&(0,O.jsx)(q,{className:`overflow-hidden min-w-0 max-w-full`,children:(0,O.jsxs)(`div`,{className:`min-w-0 max-w-full pl-6 pb-2 space-y-2`,children:[t&&(0,O.jsx)(`div`,{"data-reasoning-content-shell":`true`,className:`min-w-0 max-w-full rounded-sm`,children:(0,O.jsx)(`div`,{"data-reasoning-prose":`true`,className:`m-0 whitespace-pre-wrap break-words text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:t})}),i&&(0,O.jsx)(`div`,{"data-reasoning-children":`true`,className:`min-w-0 max-w-full`,children:i})]})})]})}function Ze(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observe`,icon:J[0].icon,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Plan`,icon:J[1].icon,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Execute`,icon:J[2].icon,content:null,duration:null,children:(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}var Qe=(0,D.forwardRef)(function({step:e},t){let n=Ze(e);return n.length===0&&e.error?(0,O.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded p-2 text-sm break-words [overflow-wrap:anywhere]`,children:e.error}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)($e,{ref:t,sections:n}),e.error&&(0,O.jsx)(`div`,{className:`pl-6 pb-2`,children:(0,O.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded p-2 text-sm break-words [overflow-wrap:anywhere]`,children:e.error})})]})}),$e=(0,D.forwardRef)(function({sections:e},t){let[n,r]=(0,D.useState)(()=>e.map(()=>!1)),i=(0,D.useRef)([]),a=(0,D.useCallback)(e=>{r(t=>{let n=[...t],r=n[e];return n[e]=!r,r||requestAnimationFrame(()=>{i.current[e]?.scrollIntoView({block:`start`,behavior:`smooth`})}),n})},[]);return(0,D.useImperativeHandle)(t,()=>({togglePhase:a}),[a]),(0,O.jsxs)(`div`,{className:`relative space-y-0`,children:[(0,O.jsx)(`div`,{className:`absolute left-[7px] top-4 bottom-4 w-px bg-border`}),e.map((e,t)=>(0,O.jsx)(Y,{config:{key:e.key,label:e.label,icon:e.icon},content:e.content,duration:e.duration,outcome:e.outcome,open:n[t],onOpenChange:e=>r(n=>{let r=[...n];return r[t]=e,r}),sectionRef:e=>{i.current[t]=e},children:e.children},e.key))]})}),et=(0,D.forwardRef)(function({runId:e,stepOrder:t,stepData:n},r){let[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(!0),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)([!1,!1,!1,!1]),f=(0,D.useRef)([null,null,null,null]),p=(0,D.useCallback)(e=>{d(t=>{let n=[...t],r=n[e];return n[e]=!r,r||requestAnimationFrame(()=>{f.current[e]?.scrollIntoView({block:`start`,behavior:`smooth`})}),n})},[]);if((0,D.useImperativeHandle)(r,()=>({togglePhase:p}),[p]),(0,D.useEffect)(()=>{let n=!1;return ae(e,t).then(e=>{n||(a(e.trace),s(!1))}).catch(e=>{n||(l(e instanceof Error?e.message:`Failed to load reasoning`),s(!1))}),()=>{n=!0}},[e,t]),o)return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(g,{className:`h-4 w-3/4`}),(0,O.jsx)(g,{className:`h-4 w-1/2`}),(0,O.jsx)(g,{className:`h-4 w-2/3`})]});if(!i&&c||!i)return(0,O.jsx)(Qe,{ref:r,step:n});let m=i.healAttempts&&i.healAttempts.length>0;return(0,O.jsxs)(`div`,{className:`relative space-y-0`,children:[(0,O.jsx)(`div`,{className:`absolute left-[7px] top-4 bottom-4 w-px bg-border`}),(0,O.jsx)(Y,{config:J[0],content:i.observeText,duration:i.observeDuration,open:u[0],onOpenChange:e=>d(t=>{let n=[...t];return n[0]=e,n}),sectionRef:e=>{f.current[0]=e}}),(0,O.jsx)(Y,{config:J[1],content:i.planReasoning,duration:i.planDuration,outcome:i.planConfidence==null?void 0:(0,O.jsx)(We,{confidence:i.planConfidence}),open:u[1],onOpenChange:e=>d(t=>{let n=[...t];return n[1]=e,n}),sectionRef:e=>{f.current[1]=e},children:i.planAction!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Planned Action`}),(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:Xe(i.planAction)})]})}),(0,O.jsx)(Y,{config:J[2],content:null,duration:i.executeDuration,open:u[2],onOpenChange:e=>d(t=>{let n=[...t];return n[2]=e,n}),sectionRef:e=>{f.current[2]=e},children:i.executeAction!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Executed Action`}),(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:Xe(i.executeAction)})]})}),(0,O.jsx)(Y,{config:J[3],content:i.verifyReasoning,duration:i.verifyDuration,outcome:i.verifySuccess==null?void 0:(0,O.jsx)(`span`,{className:S(`text-xs font-medium`,i.verifySuccess?`text-emerald-500`:`text-red-500`),children:i.verifySuccess?`Passed`:`Failed`}),open:u[3],onOpenChange:e=>d(t=>{let n=[...t];return n[3]=e,n}),sectionRef:e=>{f.current[3]=e}}),m&&(0,O.jsx)(Y,{config:J[4],content:null,duration:null,children:(0,O.jsx)(Ye,{attempts:i.healAttempts})})]})}),tt=(0,D.forwardRef)(function(e,t){return e.mode===`static`?(0,O.jsx)($e,{sections:e.sections,ref:t}):(0,O.jsx)(et,{runId:e.runId,stepOrder:e.stepOrder,stepData:e.stepData,ref:t})});function nt(e){switch(e){case`env`:return`bg-blue-500/15 text-blue-400 border-blue-500/20`;case`capture`:return`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`;case`cli`:return`bg-purple-500/15 text-purple-400 border-purple-500/20`;case`inline`:return`bg-amber-500/15 text-amber-400 border-amber-500/20`;case`suite`:return`bg-cyan-500/15 text-cyan-400 border-cyan-500/20`;case`test`:return`bg-pink-500/15 text-pink-400 border-pink-500/20`;case`hook`:return`bg-orange-500/15 text-orange-400 border-orange-500/20`;case`step`:return`bg-teal-500/15 text-teal-400 border-teal-500/20`;default:return`bg-muted text-muted-foreground`}}function X({title:e,count:t,defaultOpen:n,children:r}){return(0,O.jsxs)(G,{defaultOpen:n,children:[(0,O.jsxs)(K,{className:`flex items-center gap-1.5 w-full px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors`,children:[(0,O.jsx)(x,{className:`h-3 w-3 transition-transform duration-200 [[data-state=open]>&]:rotate-90`}),e,(0,O.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:[`(`,t,`)`]})]}),(0,O.jsx)(q,{children:r})]})}function Z({message:e}){return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-muted-foreground/60 italic`,children:e})}function rt({step:e,executionLogs:t=[]}){let n=e.variableSnapshot,r=n?Object.entries(n):[],i=t.filter(e=>e.type===`runjs`),a=t.filter(e=>e.type===`hook`);return(0,O.jsxs)(`div`,{className:`py-1`,children:[(0,O.jsx)(X,{title:`Env`,count:r.length,defaultOpen:r.length>0,children:r.length===0?(0,O.jsx)(Z,{message:`No variables at this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{className:`border-b`,children:[(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Variable`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Value`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Source`})]})}),(0,O.jsx)(`tbody`,{children:r.map(([e,t])=>(0,O.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,O.jsx)(`td`,{className:`py-1.5 px-2 font-mono text-xs text-muted-foreground`,children:e}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 font-mono text-xs break-all`,children:t.value}),(0,O.jsx)(`td`,{className:`py-1.5 px-2`,children:(0,O.jsx)(E,{className:S(`text-[10px] px-1.5 py-0 border`,nt(t.source)),children:t.source})})]},e))})]})})}),(0,O.jsx)(X,{title:`runJS`,count:i.length,defaultOpen:i.length>0,children:i.length===0?(0,O.jsx)(Z,{message:`No runJS executions for this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:i.map(e=>(0,O.jsxs)(`div`,{className:`rounded-md border border-border/50 p-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[e.status===`passed`?(0,O.jsx)(b,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}):(0,O.jsx)(c,{className:`h-3.5 w-3.5 text-red-500 shrink-0`}),(0,O.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,O.jsx)(`span`,{className:`text-muted-foreground ml-auto shrink-0`,children:C(e.duration)})]}),e.stdout&&(0,O.jsx)(`pre`,{className:`mt-1 p-1.5 rounded bg-muted/50 font-mono text-[11px] whitespace-pre-wrap break-all overflow-hidden`,children:e.stdout}),e.returnData!=null&&(0,O.jsxs)(`div`,{className:`mt-1 p-1.5 rounded bg-muted/50`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Return: `}),(0,O.jsx)(`span`,{className:`font-mono text-[11px]`,children:typeof e.returnData==`string`?e.returnData:JSON.stringify(e.returnData)})]})]},e.id))})}),(0,O.jsx)(X,{title:`Hooks`,count:a.length,defaultOpen:a.length>0,children:a.length===0?(0,O.jsx)(Z,{message:`No hooks ran for this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:a.map(e=>(0,O.jsxs)(`div`,{className:`rounded-md border border-border/50 p-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[e.status===`passed`?(0,O.jsx)(b,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}):(0,O.jsx)(c,{className:`h-3.5 w-3.5 text-red-500 shrink-0`}),(0,O.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,O.jsx)(`span`,{className:`text-muted-foreground ml-auto shrink-0`,children:C(e.duration)})]}),e.variables&&Object.keys(e.variables).length>0&&(0,O.jsxs)(`div`,{className:`mt-1.5 space-y-0.5`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:`Emitted variables:`}),Object.entries(e.variables).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex gap-2 pl-2 font-mono text-[11px]`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),(0,O.jsx)(`span`,{className:`break-all`,children:t})]},e))]}),e.stdout&&(0,O.jsx)(`pre`,{className:`mt-1 p-1.5 rounded bg-muted/50 font-mono text-[11px] whitespace-pre-wrap break-all overflow-hidden max-h-24 overflow-y-auto`,children:e.stdout})]},e.id))})})]})}function it(e){return e>=1e3?`+${(e/1e3).toFixed(1)}s`:`+${Math.round(e)}ms`}function at(e){return Object.entries(e).filter(([e,t])=>e!==`startTime`&&t>0)}function ot(e){return e>=200&&e<300?`text-emerald-500`:e>=300&&e<400?`text-amber-500`:e>=400?`text-red-500`:`text-muted-foreground`}function st({headers:e}){let t=Object.entries(e);return t.length===0?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`None`}):(0,O.jsx)(`div`,{className:`space-y-0.5`,children:t.map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex gap-2 text-xs font-mono`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[e,`:`]}),(0,O.jsx)(`span`,{className:`break-all`,children:t})]},e))})}function Q({label:e,children:t}){return(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:e}),t]})}function ct({text:e}){let[t,n]=(0,D.useState)(!1);return(0,O.jsx)(`button`,{onClick:(0,D.useCallback)(t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},[e]),className:`text-muted-foreground hover:text-foreground`,children:t?(0,O.jsx)(s,{className:`h-3 w-3`}):(0,O.jsx)(l,{className:`h-3 w-3`})})}function lt({body:e,contentType:t}){let n=t.toLowerCase();if(n.includes(`application/json`))try{return(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:JSON.stringify(JSON.parse(e),null,2)})}catch{return(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e})}return n.includes(`image/svg+xml`)?(0,O.jsx)(`img`,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:`SVG response`,className:`max-h-48`}):e.startsWith(`data:image/`)?(0,O.jsx)(`img`,{src:e,alt:`Image response`,className:`max-h-48 rounded-sm`}):n.includes(`image/`)?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Image not previewable (re-run test to capture)`}):(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e})}function ut({entry:e}){let t=e.method===`POST`||e.method===`PUT`||e.method===`PATCH`;return(0,O.jsx)(`tr`,{children:(0,O.jsx)(`td`,{colSpan:6,className:`px-0 py-0`,children:(0,O.jsxs)(`div`,{className:`bg-muted/20 border-b border-border/50 px-4 py-3 space-y-4`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,O.jsx)(Q,{label:`Request Headers`,children:(0,O.jsx)(st,{headers:e.requestHeaders??{}})}),(0,O.jsx)(Q,{label:`Response Headers`,children:(0,O.jsx)(st,{headers:e.responseHeaders??{}})})]}),t&&(0,O.jsx)(Q,{label:`Request Body`,children:e.requestBody?(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e.requestBody}):(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`No request body`})}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,O.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Response Body`}),e.body&&(0,O.jsx)(ct,{text:e.body})]}),e.body?(0,O.jsx)(lt,{body:e.body,contentType:e.responseHeaders?.[`content-type`]??``}):(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Not captured`})]}),e.timing&&(()=>{let t=at(e.timing);return t.length===0?null:(0,O.jsx)(Q,{label:`Timing`,children:(0,O.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:t.map(([e,t])=>(0,O.jsxs)(`div`,{className:`text-xs font-mono`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),` `,(0,O.jsxs)(`span`,{children:[Math.round(t),`ms`]})]},e))})})})()]})})})}function $({text:e,query:t}){if(!t)return(0,O.jsx)(O.Fragment,{children:e});let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsxs)(O.Fragment,{children:[e.slice(0,n),(0,O.jsx)(`mark`,{className:`bg-yellow-400/30 text-inherit rounded-sm px-0.5`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function dt({step:e,allSteps:t,platform:n}){let[r,i]=(0,D.useState)(new Set),a=(0,D.useMemo)(()=>{let n=e.displayStepOrder??e.stepOrder,r=[];for(let e of t){let t=e.displayStepOrder??e.stepOrder;if(t>n)continue;let i=t===n;for(let t of e.networkLogs??[])r.push({...t,isCurrent:i})}return r.sort((e,t)=>e.startTime-t.startTime)},[e,t]),o=(0,D.useMemo)(()=>a.length===0?0:Math.min(...a.map(e=>e.startTime)),[a]),[s,c]=(0,D.useState)(``),l=(0,D.useDeferredValue)(s),u=(0,D.useMemo)(()=>{if(!l)return a;let e=l.toLowerCase();return a.filter(t=>t.url.toLowerCase().includes(e)||t.method.toLowerCase().includes(e)||String(t.status).includes(e))},[a,l]);(0,D.useEffect)(()=>{i(new Set)},[l]);let d=(0,D.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return a.length===0?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:n===`android`||n===`ios`?`Network capture is not available for mobile tests`:`No network requests captured for this step`}):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`sticky top-0 z-10 bg-background border-b border-border/50 px-3 py-1.5 flex items-center gap-2`,children:[(0,O.jsx)(v,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,O.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Filter...`,className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`}),s&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[u.length,` of `,a.length]}),(0,O.jsx)(`button`,{onClick:()=>c(``),className:`text-muted-foreground hover:text-foreground`,children:(0,O.jsx)(ee,{className:`h-3.5 w-3.5`})})]})]}),(0,O.jsx)(`div`,{className:`p-3`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{className:`border-b`,children:[(0,O.jsx)(`th`,{className:`w-6`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground w-16`,children:`Method`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`URL`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground w-16`,children:`Status`}),(0,O.jsx)(`th`,{className:`text-right py-1.5 px-2 text-xs font-medium text-muted-foreground w-20`,children:`Time`}),(0,O.jsx)(`th`,{className:`text-right py-1.5 px-2 text-xs font-medium text-muted-foreground w-20`,children:`Duration`})]})}),(0,O.jsx)(`tbody`,{children:u.map((e,t)=>{let n=e.endTime-e.startTime,i=r.has(t);return(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`tr`,{onClick:()=>d(t),className:S(`border-b border-border/50 cursor-pointer hover:bg-muted/30 transition-colors`,i&&`bg-muted/20`,!e.isCurrent&&`opacity-40`),children:[(0,O.jsx)(`td`,{className:`py-1.5 pl-2 pr-0 w-6`,children:(0,O.jsx)(x,{className:S(`h-3 w-3 text-muted-foreground transition-transform`,i&&`rotate-90`)})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2`,children:(0,O.jsx)(E,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:(0,O.jsx)($,{text:e.method,query:l})})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 text-xs font-mono truncate max-w-0 min-w-0`,children:(0,O.jsx)($,{text:e.url,query:l})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2`,children:(0,O.jsx)(`span`,{className:S(`text-xs font-mono`,ot(e.status)),children:(0,O.jsx)($,{text:String(e.status),query:l})})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 text-xs font-mono text-muted-foreground text-right`,children:it(e.startTime-o)}),(0,O.jsxs)(`td`,{className:`py-1.5 px-2 text-xs text-muted-foreground text-right`,children:[n<1?`<1`:Math.round(n),`ms`]})]}),i&&(0,O.jsx)(ut,{entry:e})]},t)})})]})})]})}function ft(e){switch(e.toLowerCase()){case`error`:return`text-red-400`;case`warn`:case`warning`:return`text-amber-400`;case`info`:return`text-blue-400`;case`debug`:return`text-cyan-400`;default:return`text-muted-foreground`}}function pt(e){switch(e){case`setup`:return`bg-blue-500/15 text-blue-400 border-blue-500/20`;case`teardown`:return`bg-purple-500/15 text-purple-400 border-purple-500/20`;case`inline`:return`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`;default:return`bg-muted text-muted-foreground`}}var mt=[`error`,`warn`,`info`,`log`,`debug`];function ht({text:e,query:t}){if(!t)return(0,O.jsx)(O.Fragment,{children:e});let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsxs)(O.Fragment,{children:[e.slice(0,n),(0,O.jsx)(`mark`,{className:`bg-yellow-400/30 text-inherit rounded-sm px-0.5`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function gt({step:e,allSteps:n,executionLogs:s,isHookStep:c}){let l=(0,D.useMemo)(()=>{let t=e.displayStepOrder??e.stepOrder,r=[];for(let e of n){let n=e.displayStepOrder??e.stepOrder;if(n>t)continue;let i=n===t;for(let t of e.consoleLogs??[])r.push({...t,isCurrent:i})}return r.sort((e,t)=>e.timestamp-t.timestamp)},[e,n]),[u,d]=(0,D.useState)(``),f=(0,D.useDeferredValue)(u),[p,m]=(0,D.useState)(`all`),h=(0,D.useMemo)(()=>{let e=l;if(p!==`all`&&(e=e.filter(e=>{let t=e.level.toLowerCase(),n=mt.indexOf(p);if(n===-1)return!0;let r=mt.indexOf(t);return r!==-1&&r>=n})),f){let t=f.toLowerCase();e=e.filter(e=>e.text.toLowerCase().includes(t)||e.level.toLowerCase().includes(t))}return e},[l,f,p]),g=c&&s&&s.length>0,_=l.length>0;return!g&&!_?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:`No console output captured for this step`}):(0,O.jsxs)(`div`,{className:`w-full overflow-hidden`,children:[_&&(0,O.jsxs)(`div`,{className:`sticky top-0 z-10 bg-background border-b border-border/50 px-3 py-1.5 flex items-center gap-2`,children:[(0,O.jsx)(v,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,O.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`Filter...`,className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`}),u&&(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[h.length,` of `,l.length]}),(0,O.jsx)(`div`,{className:`h-3 w-px bg-border/50 shrink-0`}),(0,O.jsxs)(o,{value:p,onValueChange:m,children:[(0,O.jsx)(i,{size:`sm`,className:`h-6 rounded-sm text-xs px-2 gap-1 border-border/50 min-w-0 w-auto`,children:(0,O.jsx)(a,{})}),(0,O.jsxs)(r,{className:`rounded-sm`,children:[(0,O.jsx)(t,{value:`all`,className:`text-xs`,children:`All levels`}),(0,O.jsx)(t,{value:`error`,className:`text-xs`,children:`Errors`}),(0,O.jsx)(t,{value:`warn`,className:`text-xs`,children:`Warnings`}),(0,O.jsx)(t,{value:`info`,className:`text-xs`,children:`Info`}),(0,O.jsx)(t,{value:`log`,className:`text-xs`,children:`Log`}),(0,O.jsx)(t,{value:`debug`,className:`text-xs`,children:`Debug`})]})]}),u&&(0,O.jsx)(`button`,{onClick:()=>d(``),className:`text-muted-foreground hover:text-foreground shrink-0`,children:(0,O.jsx)(ee,{className:`h-3.5 w-3.5`})})]}),(0,O.jsxs)(`div`,{className:`p-3 space-y-0.5 overflow-x-hidden w-full max-w-full`,children:[g&&(0,O.jsx)(`div`,{className:`space-y-2 mb-3`,children:s.map(e=>(0,O.jsxs)(`div`,{className:`border border-border/50 rounded-sm overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 bg-muted/20 border-b border-border/30`,children:[(0,O.jsx)(E,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.name}),(0,O.jsx)(E,{className:S(`text-[10px] px-1.5 py-0`,pt(e.phase)),children:e.phase}),(0,O.jsx)(`span`,{className:S(`text-[10px] font-mono`,e.status===`passed`?`text-emerald-500`:`text-red-500`),children:e.status}),(0,O.jsxs)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:[e.duration,`ms`]})]}),e.stdout&&(0,O.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-foreground/90`,children:e.stdout}),e.stderr&&(0,O.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-red-400/80 border-t border-border/30`,children:e.stderr})]},e.id))}),g&&_&&(0,O.jsx)(`div`,{className:`border-t border-border/30 pt-2 mb-1`,children:(0,O.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wider`,children:`Browser Console`})}),_&&h.map((e,t)=>(0,O.jsxs)(`div`,{className:S(`flex items-start gap-1.5 py-0.5 px-2 hover:bg-muted/30 font-mono text-xs overflow-hidden max-w-full`,!e.isCurrent&&`opacity-40`),children:[(0,O.jsx)(`span`,{className:S(`shrink-0 text-[10px]`,ft(e.level)),children:e.level}),(0,O.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0 text-[10px] tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()}),(0,O.jsx)(`span`,{className:`flex-1 min-w-0 break-all whitespace-pre-wrap overflow-hidden`,children:(0,O.jsx)(ht,{text:e.text,query:f})})]},t))]})]})}export{Ye as a,q as c,le as d,ce as f,tt as i,K as l,dt as n,We as o,rt as r,G as s,gt as t,ue as u};
@@ -1,9 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{c as t}from"./id-badge-NwZYoNfB.js";import{t as n}from"./monaco-editor-DNT0Mzki.js";import{t as r}from"./file-code-B3iDpJRP.js";import{n as i}from"./split-button-DcY8ames.js";import{t as a}from"./refresh-cw-C_0AkMuu.js";import{a as o,c as s,i as c,n as ee,o as te,r as ne,s as l,t as re}from"./filename-validation-4sTTEagx.js";import{t as ie}from"./use-page-title-B1t9-5_U.js";import{a as ae,c as u,d as oe,f as d,i as se,l as ce,n as le,o as ue,p as f,r as de,s as fe,t as pe,u as p}from"./test-navbar-DoHKAy1p.js";import{a as me,r as he}from"./dist-m_OM4Je_.js";import{i as ge,n as _e,r as ve,t as ye}from"./tabs-DrB_Acb3.js";import{$n as m,At as h,Bn as be,Bt as xe,Dt as Se,E as Ce,Ft as g,Ht as we,It as Te,Lt as Ee,Mt as _,Nn as De,O as Oe,P as ke,Pt as v,Qn as y,Rt as Ae,St as je,Ut as b,V as Me,Wt as Ne,Yt as Pe,cr as Fe,ft as x,jt as S,kt as Ie,lr as Le,pr as Re,qn as C,r as ze,ur as Be,ut as Ve,zt as He}from"./index-Bvtm2F6f.js";import{n as Ue,r as We,t as Ge}from"./resizable-BGEcNRZO.js";import{t as Ke}from"./empty-state-BTvOA5lp.js";import{t as qe}from"./use-keyboard-shortcuts-EAppuiKO.js";import{t as Je}from"./observation-markdown-Dx_5-T0t.js";var w=e(Re(),1),T=y();function E(e){return e>=.7?`text-emerald-500`:e>=.4?`text-amber-500`:`text-destructive`}function Ye(e){try{return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}catch{return e}}function Xe({observation:e,onDelete:t,isDeleting:n}){return(0,T.jsxs)(`div`,{className:`rounded-md border bg-card/60 px-3 py-2 space-y-1.5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px]`,children:[(0,T.jsxs)(S,{children:[(0,T.jsx)(v,{asChild:!0,children:(0,T.jsx)(`span`,{className:Ne(`font-mono tabular-nums font-medium cursor-default`,E(e.trust)),children:e.trust.toFixed(2)})}),(0,T.jsx)(_,{side:`top`,className:`max-w-xs text-xs`,children:`Trust score (0–1). Higher means the agent is more confident this observation is accurate. Increases when confirmed across runs, decreases when contradicted.`})]}),(0,T.jsxs)(S,{children:[(0,T.jsx)(v,{asChild:!0,children:(0,T.jsx)(`span`,{className:`text-muted-foreground cursor-default`,children:Ye(e.created)})}),(0,T.jsx)(_,{side:`top`,className:`text-xs`,children:`First observed on this date`})]}),(0,T.jsxs)(S,{children:[(0,T.jsx)(v,{asChild:!0,children:(0,T.jsxs)(`span`,{className:`text-muted-foreground cursor-default`,children:[e.confirmed_count,`x confirmed · `,e.contradicted_count,`x contradicted`]})}),(0,T.jsx)(_,{side:`top`,className:`max-w-xs text-xs`,children:`Confirmed: how many runs validated this observation. Contradicted: how many runs found it inaccurate.`})]}),(0,T.jsx)(`div`,{className:`ml-auto`,children:(0,T.jsxs)(ae,{children:[(0,T.jsx)(f,{asChild:!0,children:(0,T.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:n,"aria-label":`Delete observation: ${e.title.slice(0,40)}`,className:`shrink-0 text-muted-foreground/70 hover:text-destructive`,children:(0,T.jsx)(De,{className:`size-3.5`})})}),(0,T.jsxs)(u,{size:`sm`,children:[(0,T.jsxs)(oe,{children:[(0,T.jsx)(d,{children:`Delete observation?`}),(0,T.jsx)(ce,{children:`This observation will be permanently removed. The agent will no longer use it during future runs.`})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(fe,{children:`Cancel`}),(0,T.jsx)(ue,{variant:`destructive`,onClick:()=>t(e.id),disabled:n,children:`Delete Observation`})]})]})]})})]}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(`h4`,{className:`text-sm font-semibold tracking-tight text-foreground`,children:e.title}),(0,T.jsx)(Je,{content:e.content})]})]})}function Ze({testId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)([]),[o,s]=(0,w.useState)(!0),[c,ee]=(0,w.useState)(null),[te,ne]=(0,w.useState)(null),l=(0,w.useCallback)(()=>{let t=!1;return s(!0),ee(null),i([]),x(e).then(e=>{t||(n(e.observations),i(e.invalidFiles),s(!1))}).catch(e=>{t||(n([]),ee(e instanceof Error?e.message:`Failed to load observations`),s(!1))}),()=>{t=!0}},[e]);(0,w.useEffect)(()=>l(),[l]);let re=(0,w.useCallback)(async t=>{ne(t);try{await ke(e,t),n(e=>e.filter(e=>e.id!==t)),h.success(`Observation deleted`)}catch(e){h.error(`Failed to delete: ${e instanceof Error?e.message:String(e)}`)}finally{ne(null)}},[e]);return o?(0,T.jsxs)(`div`,{className:`space-y-2 px-4 py-2`,children:[(0,T.jsx)(g,{className:`h-16 w-full rounded-md`}),(0,T.jsx)(g,{className:`h-16 w-full rounded-md`}),(0,T.jsx)(g,{className:`h-16 w-full rounded-md`})]}):c?(0,T.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 px-4 py-12 text-center`,children:[(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Could not load observations. Check that the dashboard server is running and try again.`}),(0,T.jsxs)(b,{variant:`outline`,size:`sm`,onClick:l,children:[(0,T.jsx)(a,{className:`mr-1.5 size-3.5`}),`Retry`]})]}):t.length===0?(0,T.jsxs)(`div`,{className:`space-y-3 px-4 py-2`,children:[r.length>0?(0,T.jsx)(D,{invalidFiles:r}):null,(0,T.jsx)(Ke,{icon:C,title:`No observations yet`,description:`Memory observations are created automatically when this test runs. They help the agent remember facts about your product.`})]}):(0,T.jsxs)(`div`,{className:`space-y-2 px-4 py-2`,children:[r.length>0?(0,T.jsx)(D,{invalidFiles:r}):null,(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[t.length,` observation`,t.length===1?``:`s`]})}),(0,T.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,T.jsx)(Xe,{observation:e,onDelete:re,isDeleting:te===e.id},e.id))})]})}function D({invalidFiles:e}){return(0,T.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-950 dark:text-amber-200`,children:[(0,T.jsxs)(`p`,{className:`font-medium`,children:[e.length,` invalid memory file`,e.length===1?``:`s`,` hidden from this panel.`]}),(0,T.jsx)(`p`,{className:`mt-1 text-[11px] text-amber-900/80 dark:text-amber-200/80`,children:e.map(e=>e.filename).join(`, `)})]})}var Qe=`name: My Test
2
- test-id: ""
3
- target: ""
4
- context: ""
5
- steps:
6
- - Navigate to the homepage
7
- - Verify the page loads
8
- `;function $e({text:e}){return(0,T.jsxs)(S,{children:[(0,T.jsx)(v,{asChild:!0,children:(0,T.jsx)(be,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,T.jsx)(_,{className:`max-w-[250px] text-[13px]`,children:e})]})}function et(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function tt(e,t,n){if(t===`web`)return n||e?.url||`Configured start URL`;let r=e?.device;return(typeof r?.deviceName==`string`?r.deviceName:typeof r?.name==`string`?r.name:null)||e?.product||e?.bundleId||e?.appPackage||(t===`android`?`Android device`:`iOS device`)}function nt(e){return JSON.stringify({text:e.text,overrides:e.overrides??null})}function rt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function it(e){let t=(0,w.useRef)([]);return(0,w.useMemo)(()=>{let n=t.current,r=new Set,i=e.map((e,t)=>{let i=nt(e),a=n[t];if(a&&a.signature===i)return r.add(a.id),{id:a.id,instruction:e.text,signature:i};let o=n.find(e=>e.signature===i&&!r.has(e.id));return o?(r.add(o.id),{id:o.id,instruction:e.text,signature:i}):a&&!r.has(a.id)?(r.add(a.id),{id:a.id,instruction:e.text,signature:i}):{id:crypto.randomUUID(),instruction:e.text,signature:i}});return t.current=i.map(({id:e,signature:t})=>({id:e,signature:t})),i},[e])}function at(){let{t_id:e}=Le(),a=Fe(),[ae]=Be(),u=Pe(),{defaultRunMode:oe}=i(),{targets:d,globalUse:ce,isLoading:ue}=t(),f=e??``,{suggestions:fe}=ee(f||null),p=!e,be=ae.get(`live`)===`1`,g=(0,w.useRef)(null),_=(0,w.useRef)(null),De=(0,w.useRef)(null),ke=(0,w.useRef)(()=>{}),v=(0,w.useRef)(!1),[y,b]=(0,w.useState)(p?Qe:``),[Ne,x]=(0,w.useState)(``),[S,Re]=(0,w.useState)(``),[C,Je]=(0,w.useState)(!p),[E,Ye]=(0,w.useState)(!1),[Xe,D]=(0,w.useState)(!1),[nt,at]=(0,w.useState)(!1),[O,ot]=(0,w.useState)(!1),[k,st]=(0,w.useState)(null),[A,j]=(0,w.useState)(null),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(!1),[R,ct]=(0,w.useState)(null),[lt,z]=(0,w.useState)(`reasoning`),[ut,B]=(0,w.useState)(null),[dt,V]=(0,w.useState)({setup:[],teardown:[]}),[H,ft]=(0,w.useState)(null),[pt,mt]=(0,w.useState)(!1),[ht,gt]=(0,w.useState)(!1),[U,_t]=(0,w.useState)(void 0),[vt,yt]=(0,w.useState)(``),W=!p&&y!==Ne,bt=p&&S?re(S.trim(),U,`testMatch`):null,xt=p&&!!S&&!!bt;(0,w.useEffect)(()=>{if(p)return;let e=!1;return Je(!0),Ve(f).then(t=>{e||(b(t.content),x(t.content),yt(t.path))}).catch(()=>{e||(Ye(!0),h.error(`Failed to load test file`))}).finally(()=>{e||Je(!1)}),()=>{e=!0}},[f,p]),(0,w.useEffect)(()=>{if(!p)return;let e=!1;return Me().then(t=>{if(e)return;let n=t.config.workspace?.testMatch;_t(Array.isArray(n)?n:[])}).catch(()=>{e||_t([])}),()=>{e=!0}},[p]),(0,w.useEffect)(()=>{if(!p)return;let e=he();b(t=>de(t,[`test-id`],e))},[p]);let G=(0,w.useMemo)(()=>se(y),[y]);G&&(g.current=G);let K=G??g.current,q=it(K?.steps??[]),St=(0,w.useMemo)(()=>q.map(e=>({draftId:e.id,instruction:e.instruction})),[q]),J=(0,w.useMemo)(()=>G?{testName:G.name.trim()||`Untitled Live Draft`,testContext:G.context.trim()||void 0}:null,[G]),Y=c(A,{steps:St,setupHooks:dt.setup,teardownHooks:dt.teardown,allowReconnect:!1}),X=Y.terminateSession;De.current=A,ke.current=X;let Ct=K?.target?.trim()??``,wt=Ct?d[Ct]:void 0,Tt=A?Y.platform:wt?.platform??`web`,Et=(0,w.useMemo)(()=>tt(wt,Tt,Y.currentUrl),[wt,Tt,Y.currentUrl]),Dt=G===null?`invalid`:W||p?`unsaved`:`saved`,Ot=(0,w.useMemo)(()=>q.map(e=>e.id),[q]),Z=I?`connecting`:Y.connectionState,Q=A!==null,kt=Q&&G!==null&&!rt(G.setup,dt.setup);ie((0,w.useMemo)(()=>Q&&M!==null?`Live #${M} — ${K?.name?.trim()||f||`Test`}`:p?`New Test`:`Edit Test`,[Q,M,K?.name,f,p]));let At=(0,w.useMemo)(()=>R===`ended`?{reason:`ended`,title:`Live session ended`,description:`The current draft is unchanged. Close live mode or start a fresh disposable session from this target.`}:R===`disconnected`?{reason:`disconnected`,title:`Live session disconnected`,description:`The connection dropped and the disposable session was terminated. Start a fresh session to reconnect.`}:null,[R]),jt=Q&&Z===`connected`&&G!==null&&G.steps.some(e=>e.text.trim()),Mt=I||Q,Nt=I||Q||O||k!==null||G===null||!G?.target.trim()||ue,$=(0,w.useCallback)(async()=>{D(!0);try{if(p){let e=re(S.trim(),U,`testMatch`);if(e){h.error(e);return}await Oe(S.trim(),y),h.success(`Test file created`),a(m.testView(G?.testId??``))}else await Se(f,y),x(y),h.success(`Saved`)}catch(e){h.error(`Failed to save: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}},[p,S,U,y,f,a,G]),Pt=(0,w.useCallback)(()=>{o(`page`,`closing live mode`,{liveSessionId:A??void 0,terminalReason:R??void 0}),_.current?.abort(),_.current=null,A&&X(),L(!1),j(null),N(null),ct(null),B(null),V({setup:[],teardown:[]}),F(!1)},[A,R,X]),Ft=(0,w.useCallback)(()=>{o(`page`,`ending live session from UI`,{liveSessionId:A??void 0}),_.current?.abort(),_.current=null,A&&X(),L(!1),j(null),N(null),ct(`ended`),B(null),V({setup:[],teardown:[]}),F(!0)},[A,X]),It=(0,w.useCallback)(async(e,t)=>{let n=e.target.trim();if(!n){h.error(`Select a target before starting live mode`);return}let r=new AbortController;_.current?.abort(),_.current=r,F(!0),ct(null),z(`reasoning`),B(null),L(!0);try{t?.replaceCurrentSession&&A&&(X(),j(null),N(null));let i=ne({content:y,targetName:n,targets:d,globalUse:ce});o(`page`,`requesting live session`,{targetName:n,platform:i.platform,headless:i.headless??void 0,replacingSession:t?.replaceCurrentSession??!1});let a=[...e.setup],s=[...e.teardown],c=e.testId?.trim()||null,ee=c?{type:`test`,id:c}:void 0,{sessionId:te,sessionNumber:l}=await Ce({...i,setupHooks:a,teardownHooks:s,entity:ee},r.signal);if(r.signal.aborted)return;V({setup:a,teardown:s}),j(te),N(l),o(`page`,`live session created`,{sessionId:te,targetName:n})}catch(e){et(e)||(o(`page`,`failed to create live session`,{error:e instanceof Error?e.message:String(e),targetName:n}),h.error(e instanceof Error?e.message:`Failed to start live session`)),t?.replaceCurrentSession||F(!1)}finally{_.current===r&&(_.current=null),L(!1)}},[y,ce,A,d,X]),Lt=(0,w.useCallback)(async()=>{if(!Nt){if(!G){h.error(`Fix YAML errors before starting live mode`);return}await It(G)}},[G,It,Nt]),Rt=(0,w.useCallback)(async()=>{if(Q){if(!G){h.error(`Fix YAML errors before restarting live mode`);return}await It(G,{replaceCurrentSession:!0})}},[G,Q,It]),zt=(0,w.useCallback)(e=>{if(e){F(!0);return}Pt()},[Pt]),Bt=async()=>{at(!0);try{let e=await Ie(y,vt||S.trim());if(e.valid)h.success(`Valid YAML`);else{let t=e.errors.map(e=>e.line?`Line ${e.line}: ${e.message}`:e.message).join(`
9
- `);h.error(t)}}catch(e){h.error(`Validation error: ${e instanceof Error?e.message:String(e)}`)}finally{at(!1)}},Vt=(0,w.useCallback)(async e=>{if(!O){try{if(p){let e=re(S.trim(),U,`testMatch`);if(e){h.error(e);return}await Oe(S.trim(),y),a(m.testView(G?.testId??``));return}W&&(await Se(f,y),x(y))}catch(e){h.error(`Failed to save before run: ${e instanceof Error?e.message:String(e)}`);return}ot(!0);try{st((await je({file:vt,local:e})).runId),h.success(`Run started`)}catch(e){h.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`),ot(!1)}}},[O,p,S,U,y,W,f,vt,a,G]),Ht=(0,w.useCallback)(()=>{st(null),ot(!1)},[]),Ut=(0,w.useCallback)(e=>{if(!Q)return;if(!J){h.error(`Fix YAML errors before running live steps. Live mode uses the current valid draft, not the last valid snapshot.`);return}let t=Y.steps[e]?.id;t&&B({type:`step`,stepId:t}),z(`reasoning`),Y.executeStepByIndex(e,J)},[J,Q,Y]),Wt=(0,w.useCallback)(e=>{Y.runningStepIndex===e&&(z(`reasoning`),Y.cancelStep())},[Y]),Gt=(0,w.useCallback)((e,t)=>{if(!Q)return;if(e===`setup`){h.error(`Setup hooks only run when a live session starts`);return}let n=Y.teardownHooks.find(e=>e.id===t);n&&B({type:`hook`,hookId:n.id}),z(`reasoning`),Y.executeHookById(e,t)},[Q,Y]);if((0,w.useEffect)(()=>()=>{_.current?.abort(),De.current&&ke.current()},[]),(0,w.useEffect)(()=>{A&&Z===`disconnected`&&(o(`page`,`live session moved to terminal state`,{liveSessionId:A,liveConnectionState:Z}),j(null),N(null),L(!1),ct(`disconnected`),B(null),V({setup:[],teardown:[]}),F(!0))},[Z,A]),(0,w.useEffect)(()=>{!be||v.current||p||C||E||I||P||Q||!G||!G.target.trim()||(v.current=!0,a(m.testEdit(f),{replace:!0}),Lt())},[G,Lt,Q,p,I,C,P,a,E,be,f]),(0,w.useEffect)(()=>{H&&!Ot.includes(H)&&ft(null)},[Ot,H]),(0,w.useEffect)(()=>{if(!P){B(null);return}let e=[...Y.setupHooks,...Y.teardownHooks];if(Y.steps.length===0&&e.length===0){B(null);return}B(t=>t?.type===`hook`&&e.some(e=>e.id===t.hookId)||t&&`stepId`in t&&Y.steps.some(e=>e.id===t.stepId)?t:e.length>0?{type:`hook`,hookId:e[0].id}:{type:`step`,stepId:Y.steps[0].id})},[Y.setupHooks,Y.steps,Y.teardownHooks,P]),qe((0,w.useMemo)(()=>({r:()=>{p||Vt(oe===`local`)},escape:()=>{k&&Ht()}}),[p,k,Vt,Ht,oe])),(0,w.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),$())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[$]),C)return(0,T.jsx)(ze,{});if(E)return(0,T.jsx)(Ke,{icon:r,title:`Test not found`,description:`This test file doesn't exist`,actionLabel:`View All Tests`,onAction:()=>a(m.tests)});let Kt=(0,T.jsx)(le,{content:y,onChange:b,isCreateMode:p,showLiveStepActions:Q,canRunLiveStep:Z===`connected`&&G!==null,canRunLiveHook:Z===`connected`&&G!==null,liveEditorSteps:Y.steps,draftStepIds:Ot,liveSetupHooks:Y.setupHooks,liveTeardownHooks:Y.teardownHooks,onRunLiveStep:Ut,onCancelLiveStep:Wt,onRunLiveHook:Gt,openStepSettingsId:H,onOpenStepSettingsChange:ft,selection:ut,onSelect:B,variableSuggestions:fe}),qt=(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[p&&(0,T.jsx)(`div`,{className:`px-4 pt-3`,children:(0,T.jsxs)(`div`,{className:`rounded-md border bg-muted/15 px-3 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(me,{className:`flex items-center gap-1 text-xs font-medium`,children:[`File Path `,(0,T.jsx)($e,{text:`Path is relative to your workspace root. Must match your workspace's testMatch pattern. Directories are created automatically on save.`})]}),(0,T.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Created only when you save`})]}),(0,T.jsx)(we,{placeholder:`my-test.yaml`,value:S,onChange:e=>Re(e.target.value),className:`mt-2 max-w-md ${xt?`border-red-500 focus-visible:ring-red-500`:``}`}),xt&&(0,T.jsx)(`p`,{className:`mt-1 text-xs text-red-500`,children:bt})]})}),(0,T.jsxs)(ye,{defaultValue:`builder`,className:`flex-1 flex min-h-0 flex-col`,children:[(0,T.jsxs)(ve,{variant:`line`,className:`px-4`,children:[(0,T.jsx)(ge,{value:`builder`,children:`Builder`}),(0,T.jsx)(ge,{value:`yaml`,children:`YAML`}),!p&&(0,T.jsx)(ge,{value:`memory`,children:`Memory`})]}),(0,T.jsx)(_e,{value:`builder`,className:`mt-2 flex-1 overflow-auto`,children:Kt}),(0,T.jsx)(_e,{value:`yaml`,className:`flex-1 min-h-0 mt-2`,children:(0,T.jsx)(n,{value:y,onChange:b,onSave:$,showErrors:!0,className:`h-full`})}),!p&&(0,T.jsx)(_e,{value:`memory`,className:`mt-2 flex-1 overflow-auto`,children:(0,T.jsx)(Ze,{testId:f})})]})]}),Jt=(0,T.jsx)(te,{connectionState:Y.connectionState,isLaunching:I,targetName:Ct||`Selected Target`,targetLabel:Et,liveSessionNumber:M,platform:Tt,screenshot:Y.screenshot,currentUrl:Y.currentUrl,pendingNavigation:Y.pendingNavigation,steps:Y.steps,setupHooks:Y.setupHooks,teardownHooks:Y.teardownHooks,selection:ut,runningStepId:Y.runningStepId,terminalState:At,draftState:Dt,ariaTree:Y.ariaTree,errorMessage:Y.error,devtoolsTab:lt,canRunAll:jt,isRunningAll:Y.isRunningAll,isStoppingRunAll:Y.isStoppingRunAll,setupHooksStale:kt,onDevtoolsTabChange:z,onRunAll:()=>{if(!J){h.error(`Fix YAML errors before running live steps. Live mode uses the current valid draft, not the last valid snapshot.`);return}Y.runAll(J)},onStopAll:Y.cancelRunAll,onEndSession:Ft,onRestartSession:kt?()=>void Rt():void 0,showEndSessionAction:u,onCloseLiveMode:Pt,onStartFreshSession:()=>void Lt(),onBack:Y.goBack,onForward:Y.goForward,onRefresh:Y.refreshPage,onNavigate:Y.navigate,onRequestAriaTree:Y.requestAriaTree});return(0,T.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,T.jsx)(pe,{testName:p?`New Test`:K?.name??f,testId:K?.testId??``,unsaved:W,isCreateMode:p,mode:p?`view`:`edit`,testHref:p?void 0:m.testView(f),isSaving:Xe,isValidating:nt,isRunning:O,runDisabled:Mt,hasInvalidFilename:xt,showTestId:!1,hasLiveSession:Q,liveConnectionState:Z,isLiveActionDisabled:Nt,liveSessionNumber:M,onBack:()=>a(p?m.tests:m.testView(f)),onSave:$,onValidate:Bt,onRun:Vt,onLiveConnect:P?void 0:Lt,onLiveEnd:Q?Ft:void 0,onSettingsOpen:()=>mt(!0),shortcutsOpen:ht,onToggleShortcuts:()=>gt(e=>!e)}),k?(0,T.jsxs)(We,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,T.jsx)(Ue,{defaultSize:60,minSize:30,children:(0,T.jsx)(n,{value:y,onChange:b,onSave:$,className:`h-full`})}),(0,T.jsx)(Ge,{withHandle:!0}),(0,T.jsx)(Ue,{defaultSize:40,minSize:25,children:(0,T.jsx)(l,{runId:k,onClose:Ht})})]}):P&&!u?(0,T.jsxs)(We,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,T.jsx)(Ue,{defaultSize:42,minSize:34,children:qt}),(0,T.jsx)(Ge,{withHandle:!0}),(0,T.jsx)(Ue,{defaultSize:58,minSize:38,children:Jt})]}):qt,(0,T.jsx)(Te,{open:pt,onOpenChange:mt,children:(0,T.jsxs)(Ee,{side:`right`,className:`sm:max-w-[400px] overflow-y-auto p-0`,children:[(0,T.jsxs)(He,{className:`px-4 pt-4 pb-2`,children:[(0,T.jsx)(xe,{children:`Test Settings`}),(0,T.jsx)(Ae,{children:`Advanced configuration for this test`})]}),(0,T.jsx)(`div`,{className:`px-4 pb-4`,children:(0,T.jsx)(s,{content:y,onChange:b,selectedTarget:K?.target})})]})}),u&&(0,T.jsx)(Te,{open:P,onOpenChange:zt,children:(0,T.jsxs)(Ee,{side:`bottom`,showCloseButton:!1,className:`h-[100dvh] max-h-[100dvh] rounded-none p-0`,children:[(0,T.jsxs)(He,{className:`sr-only`,children:[(0,T.jsx)(xe,{children:`Live Session`}),(0,T.jsx)(Ae,{children:`Live execution workspace for the current draft.`})]}),Jt]})})]})}export{at as default};