@vostride/agent-qa-dashboard-ui 0.1.9 → 0.1.11

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 (98) hide show
  1. package/dist/assets/{arrow-up-down-DyIZvSrC.js → arrow-up-down-D8UGCR46.js} +1 -1
  2. package/dist/assets/{badge-BbhOGRC0.js → badge-Dd058S66.js} +1 -1
  3. package/dist/assets/{batch-action-bar-CZxUcNFZ.js → batch-action-bar-BlKdJC25.js} +1 -1
  4. package/dist/assets/{circle-alert-pBH5T6su.js → circle-alert-Cr31wwud.js} +1 -1
  5. package/dist/assets/{circle-x-DLBotPS8.js → circle-x-CbsF-Or-.js} +1 -1
  6. package/dist/assets/config-B6eE0o2y.js +10 -0
  7. package/dist/assets/{copy-Gj5_oF-8.js → copy-BdD4bkD_.js} +1 -1
  8. package/dist/assets/display-step-4AfU6w4K.js +1 -0
  9. package/dist/assets/{dist-DZYW0-Ta.js → dist-D9h3nbVK.js} +1 -1
  10. package/dist/assets/{dist-DFSjTjXY.js → dist-DrO-WGvP.js} +1 -1
  11. package/dist/assets/dist-KjoEChiB.js +1 -0
  12. package/dist/assets/{empty-state-Dluv5C1Q.js → empty-state-c1UKljbh.js} +1 -1
  13. package/dist/assets/{external-link-BZ9gsZx_.js → external-link-MKpqbawt.js} +1 -1
  14. package/dist/assets/{eye-CZ7GiZXJ.js → eye-vXF-W3Sy.js} +1 -1
  15. package/dist/assets/{file-code-GHpcb0ud.js → file-code-C7vOuS4q.js} +1 -1
  16. package/dist/assets/{file-search-CIA16Vb8.js → file-search-COrO0ndH.js} +1 -1
  17. package/dist/assets/filename-validation-Ccwuaki1.js +1 -0
  18. package/dist/assets/{grip-vertical-aDoBVncr.js → grip-vertical-B4rX3Pd9.js} +1 -1
  19. package/dist/assets/{hook-editor-Dvrur2VR.js → hook-editor-fVte-sFt.js} +1 -1
  20. package/dist/assets/{hook-runtime-ChJ0-jZo.js → hook-runtime-CPPjqz70.js} +1 -1
  21. package/dist/assets/hook-viewer-Ceps9GqL.js +1 -0
  22. package/dist/assets/hooks-BwveYPPu.js +1 -0
  23. package/dist/assets/{id-badge-Dzm7eQ9l.js → id-badge-5c0D9pZV.js} +2 -2
  24. package/dist/assets/{index-B3xPCIyH.js → index-CZotRLCc.js} +2 -2
  25. package/dist/assets/{insights-rNBE_Oot.js → insights-D_d7szDN.js} +1 -1
  26. package/dist/assets/{insights-line-grid-G3ouKANt.js → insights-line-grid-DzQiRxUU.js} +4 -4
  27. package/dist/assets/{lib-BPEPp1D-.js → lib-CCr9qhea.js} +1 -1
  28. package/dist/assets/live-run-BxEaMSEi.js +1 -0
  29. package/dist/assets/{memory-DcKox3BM.js → memory-7vVmoZvP.js} +1 -1
  30. package/dist/assets/memory-product-B30NAtAP.js +2 -0
  31. package/dist/assets/{monaco-editor-CDJrOpKK.js → monaco-editor-Ba9qdSve.js} +2 -2
  32. package/dist/assets/{monaco-editor-inner-Q9WqqJ52.js → monaco-editor-inner-CeD8qR_F.js} +2 -2
  33. package/dist/assets/{monaco.contribution-DTHp-zXN.js → monaco.contribution-ZpEX2Im1.js} +2 -2
  34. package/dist/assets/{observation-block-DdB7C1c0.js → observation-block-BRa3lkBV.js} +1 -1
  35. package/dist/assets/observation-markdown-BJ9B18Mk.js +1 -0
  36. package/dist/assets/{pencil-BmkcPKBm.js → pencil-BdoVUAcl.js} +1 -1
  37. package/dist/assets/plus-BDA9KiOF.js +1 -0
  38. package/dist/assets/popover-BAlAEoO4.js +1 -0
  39. package/dist/assets/{refresh-cw-v_0wwa0P.js → refresh-cw-3zJOKpgR.js} +1 -1
  40. package/dist/assets/{resizable-COfX_iMb.js → resizable-BuOu2RfX.js} +1 -1
  41. package/dist/assets/run-detail-BkmoKeU2.js +1 -0
  42. package/dist/assets/runs-Bs16pBe9.js +1 -0
  43. package/dist/assets/{scroll-area-DfPMtFw0.js → scroll-area-48uajHeh.js} +1 -1
  44. package/dist/assets/select-B2_tSMl_.js +1 -0
  45. package/dist/assets/{shortcut-hints-CfVf0REF.js → shortcut-hints-BnEYaq1r.js} +1 -1
  46. package/dist/assets/split-button-C54F4hz3.js +1 -0
  47. package/dist/assets/square-lmyO8EeE.js +1 -0
  48. package/dist/assets/{step-name-pills-COKv64-4.js → step-name-pills-hCVbMRBe.js} +1 -1
  49. package/dist/assets/suite-editor-HxXY0n_h.js +5 -0
  50. package/dist/assets/suite-navbar-DzgJZNSk.js +1 -0
  51. package/dist/assets/suite-viewer-DX-uI0KI.js +1 -0
  52. package/dist/assets/{suites-Cbjz7uPI.js → suites-BrCm410e.js} +1 -1
  53. package/dist/assets/{switch-BOdp7A9U.js → switch-C7U17ptQ.js} +1 -1
  54. package/dist/assets/tab-console-W4FDWhGS.js +1 -0
  55. package/dist/assets/table-BGMQ2E9D.js +1 -0
  56. package/dist/assets/{tabs-CfNQIHt-.js → tabs-CWnvxa-h.js} +1 -1
  57. package/dist/assets/test-editor-C7jMc_bm.js +9 -0
  58. package/dist/assets/test-navbar-1FE5zQJP.js +7 -0
  59. package/dist/assets/{test-viewer-C6Rg-HeW.js → test-viewer-yi44-64J.js} +1 -1
  60. package/dist/assets/tests-D9iNxwue.js +1 -0
  61. package/dist/assets/{tests-suites-table-widths-tlOYaS72.js → tests-suites-table-widths-C3pXnpiW.js} +1 -1
  62. package/dist/assets/{textarea-ByegDm2e.js → textarea-C-0LUFGZ.js} +1 -1
  63. package/dist/assets/{trash-2-CawFHfTJ.js → trash-2-Cj6kkRf4.js} +1 -1
  64. package/dist/assets/{tsMode-DGJI_hpV.js → tsMode-fizT3CAG.js} +1 -1
  65. package/dist/assets/{use-hook-run-session-Cjqu9VED.js → use-hook-run-session-RvECpdZN.js} +1 -1
  66. package/dist/assets/{use-keyboard-shortcuts-BRF3cm7O.js → use-keyboard-shortcuts-BTppBDf3.js} +1 -1
  67. package/dist/assets/{use-page-title-CK82kWb2.js → use-page-title-BeSr97vd.js} +1 -1
  68. package/dist/assets/use-run-status-favicon-ClaOG7BI.js +1 -0
  69. package/dist/assets/{use-selection-queue-CZ4rXNAT.js → use-selection-queue-B7ZRHEAV.js} +1 -1
  70. package/dist/assets/{viewer-url-state-CZTYs75z.js → viewer-url-state-aAMA3-2e.js} +1 -1
  71. package/dist/assets/{zap-C7OZlYXQ.js → zap-oUNJUGP6.js} +1 -1
  72. package/dist/index.html +1 -1
  73. package/package.json +2 -2
  74. package/dist/assets/config-BfxB7vJt.js +0 -10
  75. package/dist/assets/display-step-CV3zilMS.js +0 -1
  76. package/dist/assets/dist-o2A-YJGQ.js +0 -1
  77. package/dist/assets/filename-validation-BOmZP9gf.js +0 -1
  78. package/dist/assets/hook-viewer-DwQt3CRN.js +0 -1
  79. package/dist/assets/hooks-DcW2AVgE.js +0 -1
  80. package/dist/assets/live-run-C2WLFzlf.js +0 -1
  81. package/dist/assets/memory-product-oHTD8fqS.js +0 -2
  82. package/dist/assets/observation-markdown-CvCuqq7R.js +0 -1
  83. package/dist/assets/plus-C6Zz9JLt.js +0 -1
  84. package/dist/assets/popover-CvQRjfg5.js +0 -1
  85. package/dist/assets/run-detail-B6QhqCjq.js +0 -1
  86. package/dist/assets/runs-DO4LkmoV.js +0 -1
  87. package/dist/assets/select-B5gV6YUf.js +0 -1
  88. package/dist/assets/split-button-C7J0EKrF.js +0 -1
  89. package/dist/assets/square-CvSqzenY.js +0 -1
  90. package/dist/assets/suite-editor-CaMQ5mWb.js +0 -5
  91. package/dist/assets/suite-navbar-CnJmeIp-.js +0 -1
  92. package/dist/assets/suite-viewer-HsI0Pn4t.js +0 -1
  93. package/dist/assets/tab-console-CLKFTABo.js +0 -1
  94. package/dist/assets/table-DL0PmHAE.js +0 -1
  95. package/dist/assets/test-editor-CIRL6zSb.js +0 -9
  96. package/dist/assets/test-navbar-CZhYoxgB.js +0 -7
  97. package/dist/assets/tests-C0Xhq39F.js +0 -1
  98. package/dist/assets/use-run-status-favicon-DoJZcfHz.js +0 -1
@@ -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-B5gV6YUf.js";import{t as c}from"./circle-x-DLBotPS8.js";import{t as l}from"./copy-Gj5_oF-8.js";import{t as u}from"./eye-CZ7GiZXJ.js";import{t as d}from"./refresh-cw-v_0wwa0P.js";import{t as f}from"./dist-o2A-YJGQ.js";import{r as p}from"./use-page-title-CK82kWb2.js";import{Cn as m,Hn as h,In as g,Kt as _,Ln as v,Mn as ee,Pt as y,Sn as te,Tn as b,Un as x,Ut as S,Zn as ne,bn as C,fr as re,jn as ie,qn as w,rt as ae,vn as oe,xn as se,yn as ce}from"./index-B3xPCIyH.js";import{t as T}from"./badge-BbhOGRC0.js";var E=w(`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=w(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ue=w(`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(re(),1),O=ne(),k=`Collapsible`,[de,fe]=m(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]=C({prop:r,defaultProp:i??!1,onChange:o,caller:k});return(0,O.jsx)(pe,{scope:n,disabled:a,contentId:oe(),open:c,onOpenToggle:D.useCallback(()=>l(e=>!e),[l]),children:(0,O.jsx)(b.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)(b.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:te(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)(ce,{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=ie(t,l),d=D.useRef(0),f=d.current,p=D.useRef(0),m=p.current,h=o.open||s,g=D.useRef(h),_=D.useRef(void 0);return D.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),se(()=>{let e=l.current;if(e){_.current=_.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,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,O.jsx)(b.div,{"data-state":P(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...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:h&&i})});function P(e){return e?`open`:`closed`}var _e=me,ve=j,ye=N,F=`Accordion`,be=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[I,xe,Se]=f(F),[L,Ce]=m(F,[Se,fe]),R=fe(),we=D.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,O.jsx)(I.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,O.jsx)(ke,{...a,ref:t}):(0,O.jsx)(Oe,{...i,ref:t})})});we.displayName=F;var[z,Te]=L(F),[Ee,De]=L(F,{collapsible:!1}),Oe=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=C({prop:n,defaultProp:r??``,onChange:i,caller:F});return(0,O.jsx)(z,{scope:e.__scopeAccordion,value:D.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:D.useCallback(()=>a&&c(``),[a,c]),children:(0,O.jsx)(Ee,{scope:e.__scopeAccordion,collapsible:a,children:(0,O.jsx)(je,{...o,ref:t})})})}),ke=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=C({prop:n,defaultProp:r??[],onChange:i,caller:F}),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)(z,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,O.jsx)(Ee,{scope:e.__scopeAccordion,collapsible:!0,children:(0,O.jsx)(je,{...a,ref:t})})})}),[Ae,B]=L(F),je=D.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=ie(D.useRef(null),t),c=xe(n),l=p(i)===`ltr`,u=te(e.onKeyDown,e=>{if(!be.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)(Ae,{scope:n,disabled:r,direction:i,orientation:a,children:(0,O.jsx)(I.Slot,{scope:n,children:(0,O.jsx)(b.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),V=`AccordionItem`,[Me,H]=L(V),Ne=D.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=B(V,n),o=Te(V,n),s=R(n),c=oe(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,O.jsx)(Me,{scope:n,open:l,disabled:u,triggerId:c,children:(0,O.jsx)(_e,{"data-orientation":a.orientation,"data-state":ze(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});Ne.displayName=V;var Pe=`AccordionHeader`,Fe=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=B(F,n),a=H(Pe,n);return(0,O.jsx)(b.h3,{"data-orientation":i.orientation,"data-state":ze(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});Fe.displayName=Pe;var U=`AccordionTrigger`,Ie=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=B(F,n),a=H(U,n),o=De(U,n),s=R(n);return(0,O.jsx)(I.ItemSlot,{scope:n,children:(0,O.jsx)(ve,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});Ie.displayName=U;var Le=`AccordionContent`,Re=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=B(F,n),a=H(Le,n),o=R(n);return(0,O.jsx)(ye,{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}})});Re.displayName=Le;function ze(e){return e?`open`:`closed`}var Be=we,Ve=Ne,He=Fe,Ue=Ie,We=Re;function W({...e}){return(0,O.jsx)(_e,{"data-slot":`collapsible`,...e})}function G({...e}){return(0,O.jsx)(j,{"data-slot":`collapsible-trigger`,...e})}function K({...e}){return(0,O.jsx)(N,{"data-slot":`collapsible-content`,...e})}function Ge({confidence:e}){let t=Math.round(e*100);return(0,O.jsxs)(T,{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 Ke({...e}){return(0,O.jsx)(Be,{"data-slot":`accordion`,...e})}function qe({className:e,...t}){return(0,O.jsx)(Ve,{"data-slot":`accordion-item`,className:S(`border-b last:border-b-0`,e),...t})}function Je({className:e,children:t,...r}){return(0,O.jsx)(He,{className:`flex`,children:(0,O.jsxs)(Ue,{"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 Ye({className:e,children:t,...n}){return(0,O.jsx)(We,{"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 Xe({attempts:e}){return!e||e.length===0?null:(0,O.jsx)(Ke,{type:`single`,collapsible:!0,className:`w-full`,children:e.map((e,t)=>(0,O.jsxs)(qe,{value:`attempt-${t}`,children:[(0,O.jsx)(Je,{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)(T,{variant:`secondary`,className:`text-xs`,children:e.strategy}),e.success?(0,O.jsx)(h,{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)(Ye,{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 q=[{key:`observe`,label:`Observe`,icon:u},{key:`plan`,label:`Plan`,icon:E},{key:`execute`,label:`Execute`,icon:v},{key:`verify`,label:`Verify`,icon:ue},{key:`heal`,label:`Heal`,icon:d}];function Ze(e){return e==null?``:typeof e==`string`?e:JSON.stringify(e,null,2)}function J({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)(W,{open:d,onOpenChange:f,children:[(0,O.jsxs)(G,{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:_(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)(K,{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 Qe(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observe`,icon:q[0].icon,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Plan`,icon:q[1].icon,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Execute`,icon:q[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 $e=(0,D.forwardRef)(function({step:e},t){let n=Qe(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)(et,{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})})]})}),et=(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)(J,{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))]})}),tt=(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)(y,{className:`h-4 w-3/4`}),(0,O.jsx)(y,{className:`h-4 w-1/2`}),(0,O.jsx)(y,{className:`h-4 w-2/3`})]});if(!i&&c||!i)return(0,O.jsx)($e,{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)(J,{config:q[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)(J,{config:q[1],content:i.planReasoning,duration:i.planDuration,outcome:i.planConfidence==null?void 0:(0,O.jsx)(Ge,{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:Ze(i.planAction)})]})}),(0,O.jsx)(J,{config:q[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:Ze(i.executeAction)})]})}),(0,O.jsx)(J,{config:q[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)(J,{config:q[4],content:null,duration:null,children:(0,O.jsx)(Xe,{attempts:i.healAttempts})})]})}),nt=(0,D.forwardRef)(function(e,t){return e.mode===`static`?(0,O.jsx)(et,{sections:e.sections,ref:t}):(0,O.jsx)(tt,{runId:e.runId,stepOrder:e.stepOrder,stepData:e.stepData,ref:t})});function rt(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 Y({title:e,count:t,defaultOpen:n,children:r}){return(0,O.jsxs)(W,{defaultOpen:n,children:[(0,O.jsxs)(G,{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)(K,{children:r})]})}function X({message:e}){return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-muted-foreground/60 italic`,children:e})}function it({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)(Y,{title:`Env`,count:r.length,defaultOpen:r.length>0,children:r.length===0?(0,O.jsx)(X,{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)(T,{className:S(`text-[10px] px-1.5 py-0 border`,rt(t.source)),children:t.source})})]},e))})]})})}),(0,O.jsx)(Y,{title:`runJS`,count:i.length,defaultOpen:i.length>0,children:i.length===0?(0,O.jsx)(X,{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)(h,{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:_(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)(Y,{title:`Hooks`,count:a.length,defaultOpen:a.length>0,children:a.length===0?(0,O.jsx)(X,{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)(h,{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:_(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 at(e){return e>=1e3?`+${(e/1e3).toFixed(1)}s`:`+${Math.round(e)}ms`}function ot(e){return Object.entries(e).filter(([e,t])=>e!==`startTime`&&t>0)}function st(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 ct({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 Z({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 lt({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 ut({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 dt({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)(Z,{label:`Request Headers`,children:(0,O.jsx)(ct,{headers:e.requestHeaders??{}})}),(0,O.jsx)(Z,{label:`Response Headers`,children:(0,O.jsx)(ct,{headers:e.responseHeaders??{}})})]}),t&&(0,O.jsx)(Z,{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)(lt,{text:e.body})]}),e.body?(0,O.jsx)(ut,{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=ot(e.timing);return t.length===0?null:(0,O.jsx)(Z,{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 Q({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 ft({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)(g,{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)(T,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:(0,O.jsx)(Q,{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)(Q,{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`,st(e.status)),children:(0,O.jsx)(Q,{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:at(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)(dt,{entry:e})]},t)})})]})})]})}function pt(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 mt(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 $=[`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=$.indexOf(p);if(n===-1)return!0;let r=$.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]),_=c&&s&&s.length>0,v=l.length>0;return!_&&!v?(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:[v&&(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)(g,{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:[_&&(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)(T,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.name}),(0,O.jsx)(T,{className:S(`text-[10px] px-1.5 py-0`,mt(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))}),_&&v&&(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`})}),v&&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]`,pt(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{Xe as a,K as c,le as d,E as f,nt as i,G as l,ft as n,Ge as o,it as r,W as s,gt as t,ue as u};
@@ -1 +0,0 @@
1
- import"./chunk-CilyBKbf.js";import{Ut as e,Zn as t,fr as n}from"./index-B3xPCIyH.js";n();var r=t();function i({className:t,...n}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:e(`w-full caption-bottom text-sm`,t),...n})})}function a({className:t,...n}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:e(`[&_tr]:border-b`,t),...n})}function o({className:t,...n}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:e(`[&_tr:last-child]:border-0`,t),...n})}function s({className:t,...n}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:e(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,t),...n})}function c({className:t,...n}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:e(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,t),...n})}function l({className:t,...n}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:e(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,t),...n})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -1,9 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{c as t}from"./id-badge-Dzm7eQ9l.js";import{t as n}from"./monaco-editor-CDJrOpKK.js";import{t as r}from"./file-code-GHpcb0ud.js";import{n as i}from"./split-button-C7J0EKrF.js";import{t as a}from"./refresh-cw-v_0wwa0P.js";import{a as o,c as s,i as c,n as l,o as ee,r as te,s as u,t as d}from"./filename-validation-BOmZP9gf.js";import{t as ne}from"./use-page-title-CK82kWb2.js";import{a as re,c as f,d as ie,f as p,i as ae,l as oe,n as se,o as ce,p as m,r as le,s as ue,t as de,u as h}from"./test-navbar-CZhYoxgB.js";import{a as fe,r as pe}from"./dist-DFSjTjXY.js";import{i as me,n as he,r as ge,t as _e}from"./tabs-CfNQIHt-.js";import{At as g,B as ve,E as ye,Et as be,Ft as xe,Ht as Se,It as Ce,Jt as we,Kn as _,Lt as Te,Mn as Ee,Nt as v,O as De,Ot as Oe,P as ke,Pt as y,Qn as b,Rt as Ae,Ut as x,Vt as je,Zn as Me,cr as Ne,dt as S,fr as C,jt as w,kt as T,lr as Pe,lt as Fe,r as Ie,sr as Le,xt as Re,zn as ze,zt as Be}from"./index-B3xPCIyH.js";import{n as Ve,r as He,t as Ue}from"./resizable-COfX_iMb.js";import{t as We}from"./empty-state-Dluv5C1Q.js";import{t as Ge}from"./use-keyboard-shortcuts-BRF3cm7O.js";import{t as Ke}from"./observation-markdown-CvCuqq7R.js";var E=e(C(),1),D=Me();function qe(e){return e>=.7?`text-emerald-500`:e>=.4?`text-amber-500`:`text-destructive`}function Je(e){try{return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}catch{return e}}function Ye({observation:e,onDelete:t,isDeleting:n}){return(0,D.jsxs)(`div`,{className:`rounded-md border bg-card/60 px-3 py-2 space-y-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px]`,children:[(0,D.jsxs)(g,{children:[(0,D.jsx)(v,{asChild:!0,children:(0,D.jsx)(`span`,{className:x(`font-mono tabular-nums font-medium cursor-default`,qe(e.trust)),children:e.trust.toFixed(2)})}),(0,D.jsx)(w,{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,D.jsxs)(g,{children:[(0,D.jsx)(v,{asChild:!0,children:(0,D.jsx)(`span`,{className:`text-muted-foreground cursor-default`,children:Je(e.created)})}),(0,D.jsx)(w,{side:`top`,className:`text-xs`,children:`First observed on this date`})]}),(0,D.jsxs)(g,{children:[(0,D.jsx)(v,{asChild:!0,children:(0,D.jsxs)(`span`,{className:`text-muted-foreground cursor-default`,children:[e.confirmed_count,`x confirmed · `,e.contradicted_count,`x contradicted`]})}),(0,D.jsx)(w,{side:`top`,className:`max-w-xs text-xs`,children:`Confirmed: how many runs validated this observation. Contradicted: how many runs found it inaccurate.`})]}),(0,D.jsx)(`div`,{className:`ml-auto`,children:(0,D.jsxs)(re,{children:[(0,D.jsx)(m,{asChild:!0,children:(0,D.jsx)(Se,{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,D.jsx)(Ee,{className:`size-3.5`})})}),(0,D.jsxs)(f,{size:`sm`,children:[(0,D.jsxs)(ie,{children:[(0,D.jsx)(p,{children:`Delete observation?`}),(0,D.jsx)(oe,{children:`This observation will be permanently removed. The agent will no longer use it during future runs.`})]}),(0,D.jsxs)(h,{children:[(0,D.jsx)(ue,{children:`Cancel`}),(0,D.jsx)(ce,{variant:`destructive`,onClick:()=>t(e.id),disabled:n,children:`Delete Observation`})]})]})]})})]}),(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(`h4`,{className:`text-sm font-semibold tracking-tight text-foreground`,children:e.title}),(0,D.jsx)(Ke,{content:e.content})]})]})}function Xe({testId:e}){let[t,n]=(0,E.useState)([]),[r,i]=(0,E.useState)([]),[o,s]=(0,E.useState)(!0),[c,l]=(0,E.useState)(null),[ee,te]=(0,E.useState)(null),u=(0,E.useCallback)(()=>{let t=!1;return s(!0),l(null),i([]),S(e).then(e=>{t||(n(e.observations),i(e.invalidFiles),s(!1))}).catch(e=>{t||(n([]),l(e instanceof Error?e.message:`Failed to load observations`),s(!1))}),()=>{t=!0}},[e]);(0,E.useEffect)(()=>u(),[u]);let d=(0,E.useCallback)(async t=>{te(t);try{await ke(e,t),n(e=>e.filter(e=>e.id!==t)),T.success(`Observation deleted`)}catch(e){T.error(`Failed to delete: ${e instanceof Error?e.message:String(e)}`)}finally{te(null)}},[e]);return o?(0,D.jsxs)(`div`,{className:`space-y-2 px-4 py-2`,children:[(0,D.jsx)(y,{className:`h-16 w-full rounded-md`}),(0,D.jsx)(y,{className:`h-16 w-full rounded-md`}),(0,D.jsx)(y,{className:`h-16 w-full rounded-md`})]}):c?(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 px-4 py-12 text-center`,children:[(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Could not load observations. Check that the dashboard server is running and try again.`}),(0,D.jsxs)(Se,{variant:`outline`,size:`sm`,onClick:u,children:[(0,D.jsx)(a,{className:`mr-1.5 size-3.5`}),`Retry`]})]}):t.length===0?(0,D.jsxs)(`div`,{className:`space-y-3 px-4 py-2`,children:[r.length>0?(0,D.jsx)(O,{invalidFiles:r}):null,(0,D.jsx)(We,{icon:_,title:`No observations yet`,description:`Memory observations are created automatically when this test runs. They help the agent remember facts about your product.`})]}):(0,D.jsxs)(`div`,{className:`space-y-2 px-4 py-2`,children:[r.length>0?(0,D.jsx)(O,{invalidFiles:r}):null,(0,D.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,D.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[t.length,` observation`,t.length===1?``:`s`]})}),(0,D.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,D.jsx)(Ye,{observation:e,onDelete:d,isDeleting:ee===e.id},e.id))})]})}function O({invalidFiles:e}){return(0,D.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,D.jsxs)(`p`,{className:`font-medium`,children:[e.length,` invalid memory file`,e.length===1?``:`s`,` hidden from this panel.`]}),(0,D.jsx)(`p`,{className:`mt-1 text-[11px] text-amber-900/80 dark:text-amber-200/80`,children:e.map(e=>e.filename).join(`, `)})]})}var Ze=`name: My Test
2
- test-id: ""
3
- target: ""
4
- context: ""
5
- steps:
6
- - Navigate to the homepage
7
- - Verify the page loads
8
- `;function Qe({text:e}){return(0,D.jsxs)(g,{children:[(0,D.jsx)(v,{asChild:!0,children:(0,D.jsx)(ze,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,D.jsx)(w,{className:`max-w-[250px] text-[13px]`,children:e})]})}function $e(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function et(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 tt(e){return JSON.stringify({text:e.text,overrides:e.overrides??null})}function nt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function rt(e){let t=(0,E.useRef)([]);return(0,E.useMemo)(()=>{let n=t.current,r=new Set,i=e.map((e,t)=>{let i=tt(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 it(){let{t_id:e}=Ne(),a=Le(),[re]=Pe(),f=we(),{defaultRunMode:ie}=i(),{targets:p,globalUse:oe,isLoading:ce}=t(),m=e??``,{suggestions:ue}=l(m||null),h=!e,g=re.get(`live`)===`1`,Se=(0,E.useRef)(null),_=(0,E.useRef)(null),Ee=(0,E.useRef)(null),v=(0,E.useRef)(()=>{}),ke=(0,E.useRef)(!1),[y,x]=(0,E.useState)(h?Ze:``),[Me,S]=(0,E.useState)(``),[C,w]=(0,E.useState)(``),[ze,Ke]=(0,E.useState)(!h),[qe,Je]=(0,E.useState)(!1),[Ye,O]=(0,E.useState)(!1),[tt,it]=(0,E.useState)(!1),[k,at]=(0,E.useState)(!1),[A,ot]=(0,E.useState)(null),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(null),[st,V]=(0,E.useState)(`reasoning`),[ct,H]=(0,E.useState)(null),[lt,U]=(0,E.useState)({setup:[],teardown:[]}),[W,ut]=(0,E.useState)(null),[dt,ft]=(0,E.useState)(!1),[pt,mt]=(0,E.useState)(!1),[G,ht]=(0,E.useState)(void 0),[gt,_t]=(0,E.useState)(``),vt=!h&&y!==Me,yt=h&&C?d(C.trim(),G,`testMatch`):null,bt=h&&!!C&&!!yt;(0,E.useEffect)(()=>{if(h)return;let e=!1;return Ke(!0),Fe(m).then(t=>{e||(x(t.content),S(t.content),_t(t.path))}).catch(()=>{e||(Je(!0),T.error(`Failed to load test file`))}).finally(()=>{e||Ke(!1)}),()=>{e=!0}},[m,h]),(0,E.useEffect)(()=>{if(!h)return;let e=!1;return ve().then(t=>{if(e)return;let n=t.config.workspace?.testMatch;ht(Array.isArray(n)?n:[])}).catch(()=>{e||ht([])}),()=>{e=!0}},[h]),(0,E.useEffect)(()=>{if(!h)return;let e=pe();x(t=>le(t,[`test-id`],e))},[h]);let K=(0,E.useMemo)(()=>ae(y),[y]);K&&(Se.current=K);let q=K??Se.current,xt=rt(q?.steps??[]),St=(0,E.useMemo)(()=>xt.map(e=>({draftId:e.id,instruction:e.instruction})),[xt]),J=(0,E.useMemo)(()=>K?{testName:K.name.trim()||`Untitled Live Draft`,testContext:K.context.trim()||void 0}:null,[K]),Y=c(j,{steps:St,setupHooks:lt.setup,teardownHooks:lt.teardown,allowReconnect:!1}),X=Y.terminateSession;Ee.current=j,v.current=X;let Ct=q?.target?.trim()??``,wt=Ct?p[Ct]:void 0,Tt=j?Y.platform:wt?.platform??`web`,Et=(0,E.useMemo)(()=>et(wt,Tt,Y.currentUrl),[wt,Tt,Y.currentUrl]),Dt=K===null?`invalid`:vt||h?`unsaved`:`saved`,Ot=(0,E.useMemo)(()=>xt.map(e=>e.id),[xt]),Z=L?`connecting`:Y.connectionState,Q=j!==null,kt=Q&&K!==null&&!nt(K.setup,lt.setup);ne((0,E.useMemo)(()=>Q&&N!==null?`Live #${N} — ${q?.name?.trim()||m||`Test`}`:h?`New Test`:`Edit Test`,[Q,N,q?.name,m,h]));let At=(0,E.useMemo)(()=>z===`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.`}:z===`disconnected`?{reason:`disconnected`,title:`Live session disconnected`,description:`The connection dropped and the disposable session was terminated. Start a fresh session to reconnect.`}:null,[z]),jt=Q&&Z===`connected`&&K!==null&&K.steps.some(e=>e.text.trim()),Mt=L||Q,Nt=L||Q||k||A!==null||K===null||!K?.target.trim()||ce,$=(0,E.useCallback)(async()=>{O(!0);try{if(h){let e=d(C.trim(),G,`testMatch`);if(e){T.error(e);return}await De(C.trim(),y),T.success(`Test file created`),a(b.testView(K?.testId??``))}else await be(m,y),S(y),T.success(`Saved`)}catch(e){T.error(`Failed to save: ${e instanceof Error?e.message:String(e)}`)}finally{O(!1)}},[h,C,G,y,m,a,K]),Pt=(0,E.useCallback)(()=>{o(`page`,`closing live mode`,{liveSessionId:j??void 0,terminalReason:z??void 0}),_.current?.abort(),_.current=null,j&&X(),R(!1),M(null),P(null),B(null),H(null),U({setup:[],teardown:[]}),I(!1)},[j,z,X]),Ft=(0,E.useCallback)(()=>{o(`page`,`ending live session from UI`,{liveSessionId:j??void 0}),_.current?.abort(),_.current=null,j&&X(),R(!1),M(null),P(null),B(`ended`),H(null),U({setup:[],teardown:[]}),I(!0)},[j,X]),It=(0,E.useCallback)(async(e,t)=>{let n=e.target.trim();if(!n){T.error(`Select a target before starting live mode`);return}let r=new AbortController;_.current?.abort(),_.current=r,I(!0),B(null),V(`reasoning`),H(null),R(!0);try{t?.replaceCurrentSession&&j&&(X(),M(null),P(null));let i=te({content:y,targetName:n,targets:p,globalUse:oe});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,l=c?{type:`test`,id:c}:void 0,{sessionId:ee,sessionNumber:u}=await ye({...i,setupHooks:a,teardownHooks:s,entity:l},r.signal);if(r.signal.aborted)return;U({setup:a,teardown:s}),M(ee),P(u),o(`page`,`live session created`,{sessionId:ee,targetName:n})}catch(e){$e(e)||(o(`page`,`failed to create live session`,{error:e instanceof Error?e.message:String(e),targetName:n}),T.error(e instanceof Error?e.message:`Failed to start live session`)),t?.replaceCurrentSession||I(!1)}finally{_.current===r&&(_.current=null),R(!1)}},[y,oe,j,p,X]),Lt=(0,E.useCallback)(async()=>{if(!Nt){if(!K){T.error(`Fix YAML errors before starting live mode`);return}await It(K)}},[K,It,Nt]),Rt=(0,E.useCallback)(async()=>{if(Q){if(!K){T.error(`Fix YAML errors before restarting live mode`);return}await It(K,{replaceCurrentSession:!0})}},[K,Q,It]),zt=(0,E.useCallback)(e=>{if(e){I(!0);return}Pt()},[Pt]),Bt=async()=>{it(!0);try{let e=await Oe(y,gt||C.trim());if(e.valid)T.success(`Valid YAML`);else{let t=e.errors.map(e=>e.line?`Line ${e.line}: ${e.message}`:e.message).join(`
9
- `);T.error(t)}}catch(e){T.error(`Validation error: ${e instanceof Error?e.message:String(e)}`)}finally{it(!1)}},Vt=(0,E.useCallback)(async e=>{if(!k){try{if(h){let e=d(C.trim(),G,`testMatch`);if(e){T.error(e);return}await De(C.trim(),y),a(b.testView(K?.testId??``));return}vt&&(await be(m,y),S(y))}catch(e){T.error(`Failed to save before run: ${e instanceof Error?e.message:String(e)}`);return}at(!0);try{ot((await Re({file:gt,local:e})).runId),T.success(`Run started`)}catch(e){T.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`),at(!1)}}},[k,h,C,G,y,vt,m,gt,a,K]),Ht=(0,E.useCallback)(()=>{ot(null),at(!1)},[]),Ut=(0,E.useCallback)(e=>{if(!Q)return;if(!J){T.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&&H({type:`step`,stepId:t}),V(`reasoning`),Y.executeStepByIndex(e,J)},[J,Q,Y]),Wt=(0,E.useCallback)(e=>{Y.runningStepIndex===e&&(V(`reasoning`),Y.cancelStep())},[Y]),Gt=(0,E.useCallback)((e,t)=>{if(!Q)return;if(e===`setup`){T.error(`Setup hooks only run when a live session starts`);return}let n=Y.teardownHooks.find(e=>e.id===t);n&&H({type:`hook`,hookId:n.id}),V(`reasoning`),Y.executeHookById(e,t)},[Q,Y]);if((0,E.useEffect)(()=>()=>{_.current?.abort(),Ee.current&&v.current()},[]),(0,E.useEffect)(()=>{j&&Z===`disconnected`&&(o(`page`,`live session moved to terminal state`,{liveSessionId:j,liveConnectionState:Z}),M(null),P(null),R(!1),B(`disconnected`),H(null),U({setup:[],teardown:[]}),I(!0))},[Z,j]),(0,E.useEffect)(()=>{!g||ke.current||h||ze||qe||L||F||Q||!K||!K.target.trim()||(ke.current=!0,a(b.testEdit(m),{replace:!0}),Lt())},[K,Lt,Q,h,L,ze,F,a,qe,g,m]),(0,E.useEffect)(()=>{W&&!Ot.includes(W)&&ut(null)},[Ot,W]),(0,E.useEffect)(()=>{if(!F){H(null);return}let e=[...Y.setupHooks,...Y.teardownHooks];if(Y.steps.length===0&&e.length===0){H(null);return}H(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,F]),Ge((0,E.useMemo)(()=>({r:()=>{h||Vt(ie===`local`)},escape:()=>{A&&Ht()}}),[h,A,Vt,Ht,ie])),(0,E.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),$())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[$]),ze)return(0,D.jsx)(Ie,{});if(qe)return(0,D.jsx)(We,{icon:r,title:`Test not found`,description:`This test file doesn't exist`,actionLabel:`View All Tests`,onAction:()=>a(b.tests)});let Kt=(0,D.jsx)(se,{content:y,onChange:x,isCreateMode:h,showLiveStepActions:Q,canRunLiveStep:Z===`connected`&&K!==null,canRunLiveHook:Z===`connected`&&K!==null,liveEditorSteps:Y.steps,draftStepIds:Ot,liveSetupHooks:Y.setupHooks,liveTeardownHooks:Y.teardownHooks,onRunLiveStep:Ut,onCancelLiveStep:Wt,onRunLiveHook:Gt,openStepSettingsId:W,onOpenStepSettingsChange:ut,selection:ct,onSelect:H,variableSuggestions:ue}),qt=(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[h&&(0,D.jsx)(`div`,{className:`px-4 pt-3`,children:(0,D.jsxs)(`div`,{className:`rounded-md border bg-muted/15 px-3 py-2`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(fe,{className:`flex items-center gap-1 text-xs font-medium`,children:[`File Path `,(0,D.jsx)(Qe,{text:`Path is relative to your workspace root. Must match your workspace's testMatch pattern. Directories are created automatically on save.`})]}),(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Created only when you save`})]}),(0,D.jsx)(je,{placeholder:`my-test.yaml`,value:C,onChange:e=>w(e.target.value),className:`mt-2 max-w-md ${bt?`border-red-500 focus-visible:ring-red-500`:``}`}),bt&&(0,D.jsx)(`p`,{className:`mt-1 text-xs text-red-500`,children:yt})]})}),(0,D.jsxs)(_e,{defaultValue:`builder`,className:`flex-1 flex min-h-0 flex-col`,children:[(0,D.jsxs)(ge,{variant:`line`,className:`px-4`,children:[(0,D.jsx)(me,{value:`builder`,children:`Builder`}),(0,D.jsx)(me,{value:`yaml`,children:`YAML`}),!h&&(0,D.jsx)(me,{value:`memory`,children:`Memory`})]}),(0,D.jsx)(he,{value:`builder`,className:`mt-2 flex-1 overflow-auto`,children:Kt}),(0,D.jsx)(he,{value:`yaml`,className:`flex-1 min-h-0 mt-2`,children:(0,D.jsx)(n,{value:y,onChange:x,onSave:$,showErrors:!0,className:`h-full`})}),!h&&(0,D.jsx)(he,{value:`memory`,className:`mt-2 flex-1 overflow-auto`,children:(0,D.jsx)(Xe,{testId:m})})]})]}),Jt=(0,D.jsx)(ee,{connectionState:Y.connectionState,isLaunching:L,targetName:Ct||`Selected Target`,targetLabel:Et,liveSessionNumber:N,platform:Tt,screenshot:Y.screenshot,currentUrl:Y.currentUrl,pendingNavigation:Y.pendingNavigation,steps:Y.steps,setupHooks:Y.setupHooks,teardownHooks:Y.teardownHooks,selection:ct,runningStepId:Y.runningStepId,terminalState:At,draftState:Dt,ariaTree:Y.ariaTree,errorMessage:Y.error,devtoolsTab:st,canRunAll:jt,isRunningAll:Y.isRunningAll,isStoppingRunAll:Y.isStoppingRunAll,setupHooksStale:kt,onDevtoolsTabChange:V,onRunAll:()=>{if(!J){T.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:f,onCloseLiveMode:Pt,onStartFreshSession:()=>void Lt(),onBack:Y.goBack,onForward:Y.goForward,onRefresh:Y.refreshPage,onNavigate:Y.navigate,onRequestAriaTree:Y.requestAriaTree});return(0,D.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,D.jsx)(de,{testName:h?`New Test`:q?.name??m,testId:q?.testId??``,unsaved:vt,isCreateMode:h,mode:h?`view`:`edit`,testHref:h?void 0:b.testView(m),isSaving:Ye,isValidating:tt,isRunning:k,runDisabled:Mt,hasInvalidFilename:bt,showTestId:!1,hasLiveSession:Q,liveConnectionState:Z,isLiveActionDisabled:Nt,liveSessionNumber:N,onBack:()=>a(h?b.tests:b.testView(m)),onSave:$,onValidate:Bt,onRun:Vt,onLiveConnect:F?void 0:Lt,onLiveEnd:Q?Ft:void 0,onSettingsOpen:()=>ft(!0),shortcutsOpen:pt,onToggleShortcuts:()=>mt(e=>!e)}),A?(0,D.jsxs)(He,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,D.jsx)(Ve,{defaultSize:60,minSize:30,children:(0,D.jsx)(n,{value:y,onChange:x,onSave:$,className:`h-full`})}),(0,D.jsx)(Ue,{withHandle:!0}),(0,D.jsx)(Ve,{defaultSize:40,minSize:25,children:(0,D.jsx)(u,{runId:A,onClose:Ht})})]}):F&&!f?(0,D.jsxs)(He,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,D.jsx)(Ve,{defaultSize:42,minSize:34,children:qt}),(0,D.jsx)(Ue,{withHandle:!0}),(0,D.jsx)(Ve,{defaultSize:58,minSize:38,children:Jt})]}):qt,(0,D.jsx)(xe,{open:dt,onOpenChange:ft,children:(0,D.jsxs)(Ce,{side:`right`,className:`sm:max-w-[400px] overflow-y-auto p-0`,children:[(0,D.jsxs)(Ae,{className:`px-4 pt-4 pb-2`,children:[(0,D.jsx)(Be,{children:`Test Settings`}),(0,D.jsx)(Te,{children:`Advanced configuration for this test`})]}),(0,D.jsx)(`div`,{className:`px-4 pb-4`,children:(0,D.jsx)(s,{content:y,onChange:x,selectedTarget:q?.target})})]})}),f&&(0,D.jsx)(xe,{open:F,onOpenChange:zt,children:(0,D.jsxs)(Ce,{side:`bottom`,showCloseButton:!1,className:`h-[100dvh] max-h-[100dvh] rounded-none p-0`,children:[(0,D.jsxs)(Ae,{className:`sr-only`,children:[(0,D.jsx)(Be,{children:`Live Session`}),(0,D.jsx)(Te,{children:`Live execution workspace for the current draft.`})]}),Jt]})})]})}export{it as default};
@@ -1,7 +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-B5gV6YUf.js";import{t as o}from"./circle-alert-pBH5T6su.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 ee,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as te}from"./id-badge-Dzm7eQ9l.js";import{n as ne,r as O}from"./monaco-editor-CDJrOpKK.js";import{c as k,t as A}from"./split-button-C7J0EKrF.js";import{t as re}from"./grip-vertical-aDoBVncr.js";import{n as j,r as M,t as N}from"./shortcut-hints-CfVf0REF.js";import{t as ie}from"./plus-C6Zz9JLt.js";import{t as P}from"./refresh-cw-v_0wwa0P.js";import{n as F,t as ae}from"./textarea-ByegDm2e.js";import{t as oe}from"./square-CvSqzenY.js";import{a as I,r as L}from"./dist-DFSjTjXY.js";import{n as R,r as z,t as se}from"./popover-CvQRjfg5.js";import{t as ce}from"./switch-BOdp7A9U.js";import{At as B,Cn as le,Fn as ue,Hn as V,Ht as H,Ln as de,Mn as fe,Nn as pe,Nt as U,Pn as me,Rn as W,Sn as he,Un as ge,Ut as G,Vt as K,Zn as _e,an as ve,cn as ye,fr as be,in as xe,jn as Se,jt as q,kn as Ce,ln as we,nn as Te,on as Ee,or as J,rn as De,sn as Oe,tn as ke,un as Ae,zn as je}from"./index-B3xPCIyH.js";import{t as Me}from"./badge-BbhOGRC0.js";var Y=e(be(),1),X=_e(),Ne=`AlertDialog`,[Pe,Fe]=le(Ne,[Ae]),Z=Ae(),Ie=e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,X.jsx)(Ee,{...r,...n,modal:!0})};Ie.displayName=Ne;var Le=`AlertDialogTrigger`,Re=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,X.jsx)(ye,{...i,...r,ref:t})});Re.displayName=Le;var ze=`AlertDialogPortal`,Be=e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,X.jsx)(ve,{...r,...n})};Be.displayName=ze;var Ve=`AlertDialogOverlay`,He=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,X.jsx)(xe,{...i,...r,ref:t})});He.displayName=Ve;var Q=`AlertDialogContent`,[Ue,We]=Pe(Q),Ge=Ce(`AlertDialogContent`),Ke=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=Y.useRef(null),s=Se(t,o),c=Y.useRef(null);return(0,X.jsx)(we,{contentName:Q,titleName:qe,docsSlug:`alert-dialog`,children:(0,X.jsx)(Ue,{scope:n,cancelRef:c,children:(0,X.jsxs)(Te,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:he(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,X.jsx)(Ge,{children:r}),(0,X.jsx)(tt,{contentRef:o})]})})})});Ke.displayName=Q;var qe=`AlertDialogTitle`,Je=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,X.jsx)(Oe,{...i,...r,ref:t})});Je.displayName=qe;var Ye=`AlertDialogDescription`,Xe=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,X.jsx)(De,{...i,...r,ref:t})});Xe.displayName=Ye;var Ze=`AlertDialogAction`,Qe=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,X.jsx)(ke,{...i,...r,ref:t})});Qe.displayName=Ze;var $e=`AlertDialogCancel`,et=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=We($e,n),a=Z(n),o=Se(t,i);return(0,X.jsx)(ke,{...a,...r,ref:o})});et.displayName=$e;var tt=({contentRef:e})=>{let t=`\`${Q}\` requires a description for the component to be accessible for screen reader users.
2
-
3
- You can add a description to the \`${Q}\` by passing a \`${Ye}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
-
5
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Q}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
-
7
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return Y.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},nt=Ie,rt=Re,it=Be,at=He,ot=Ke,st=Qe,ct=et,lt=Je,ut=Xe;function dt({...e}){return(0,X.jsx)(nt,{"data-slot":`alert-dialog`,...e})}function ft({...e}){return(0,X.jsx)(rt,{"data-slot":`alert-dialog-trigger`,...e})}function pt({...e}){return(0,X.jsx)(it,{"data-slot":`alert-dialog-portal`,...e})}function mt({className:e,...t}){return(0,X.jsx)(at,{"data-slot":`alert-dialog-overlay`,className:G(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function ht({className:e,size:t=`default`,...n}){return(0,X.jsxs)(pt,{children:[(0,X.jsx)(mt,{}),(0,X.jsx)(ot,{"data-slot":`alert-dialog-content`,"data-size":t,className:G(`group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs 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 data-[size=default]:sm:max-w-lg`,e),...n})]})}function gt({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:G(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function _t({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:G(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function vt({className:e,...t}){return(0,X.jsx)(lt,{"data-slot":`alert-dialog-title`,className:G(`text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function yt({className:e,...t}){return(0,X.jsx)(ut,{"data-slot":`alert-dialog-description`,className:G(`text-sm text-muted-foreground`,e),...t})}function bt({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,X.jsx)(H,{variant:t,size:n,asChild:!0,children:(0,X.jsx)(st,{"data-slot":`alert-dialog-action`,className:G(e),...r})})}function xt({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,X.jsx)(H,{variant:t,size:n,asChild:!0,children:(0,X.jsx)(ct,{"data-slot":`alert-dialog-cancel`,className:G(e),...r})})}var St={running:{label:`Running`,badgeClass:`border-primary/30 bg-primary/10 text-primary`,cardClass:`live-running-surface border-border/60 bg-primary/5`},cancelling:{label:`Cancelling`,badgeClass:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`,cardClass:`border-amber-500/30 bg-amber-500/5`},passed:{label:`Passed`,badgeClass:`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,cardClass:`border-emerald-500/25 bg-emerald-500/[0.03]`},failed:{label:`Failed`,badgeClass:`border-destructive/30 bg-destructive/10 text-destructive`,cardClass:`border-destructive/25 bg-destructive/[0.03]`},cancelled:{label:`Cancelled`,badgeClass:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`,cardClass:`border-amber-500/25 bg-amber-500/[0.03]`}};function Ct(e){let t=[];return e.timeout&&t.push(`TIMEOUT: ${e.timeout.toUpperCase()}`),e.retries!=null&&t.push(`RETRIES: ${e.retries}`),e.screenshot!=null&&t.push(`SCREENSHOT: ${e.screenshot?`ON`:`OFF`}`),e.maxAttempts!=null&&t.push(`MAX ATTEMPTS: ${e.maxAttempts}`),t.length>0?t.join(` · `):null}function wt(e){return e instanceof HTMLElement?!!e.closest(`button, textarea, input, select, label, [role="switch"]`):!1}function Tt({result:e}){switch(e){case`success`:return(0,X.jsx)(V,{className:`size-3.5 text-emerald-500`});case`failure`:return(0,X.jsx)(me,{className:`size-3.5 text-destructive`});default:return(0,X.jsx)(E,{className:`size-3.5 text-muted-foreground`})}}function Et({status:e}){switch(e){case`running`:return(0,X.jsx)(W,{className:`size-3.5 animate-spin text-primary`});case`cancelling`:return(0,X.jsx)(W,{className:`size-3.5 animate-spin text-amber-500`});case`passed`:return(0,X.jsx)(V,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,X.jsx)(me,{className:`size-3.5 text-destructive`});case`cancelled`:return(0,X.jsx)(E,{className:`size-3.5 text-amber-500`})}}function Dt(e){if(!e.plannedAction)return`Sub-action ${e.index+1}`;try{let t=typeof e.plannedAction==`string`?JSON.parse(e.plannedAction):e.plannedAction;if(t&&typeof t==`object`){let e=[t.type||t.action||``,t.target||t.selector||t.ref||``].filter(Boolean).join(` `);if(e)return e}}catch{if(typeof e.plannedAction==`string`)return e.plannedAction}return`Sub-action ${e.index+1}`}function Ot({id:e,index:t,value:n,overrides:r,onChange:i,onOverrideChange:a,onDelete:o,disabled:s=!1,liveStatus:l=`idle`,showLiveControls:d=!1,canRunLiveStep:f=!1,onRunLiveStep:p,onCancelLiveStep:m,stepError:h,isSettingsOpen:g=!1,onToggleSettings:ee,isSelected:v=!1,onSelectStep:b,subActions:x,selectedSubActionIndex:C=null,onSelectSubAction:w,suggestions:T=[],hookLabels:E={}}){let D=l===`running`||l===`cancelling`,{attributes:te,listeners:ne,setNodeRef:O,transform:k,transition:A,isDragging:j}=_({id:e,disabled:s||D}),M=(0,Y.useRef)(null),[N,ie]=(0,Y.useState)(0),P=u({text:n,cursorPos:N,suggestions:T,anchorRef:M,onInsert:(0,Y.useCallback)((e,r,a)=>{i(t,n.slice(0,r)+e+n.slice(a)),requestAnimationFrame(()=>{let t=M.current;if(t){let n=r+e.length;t.selectionStart=n,t.selectionEnd=n,t.focus()}})},[n,i,t])}),F=(0,Y.useMemo)(()=>Object.fromEntries(T.filter(e=>e.namespace===`runHook`&&e.insertValue).map(e=>[e.insertValue,e.name])),[T]),ae=(0,Y.useMemo)(()=>({...E,...F}),[E,F]),L=Ct(r),R=L!==null,z=l===`idle`?null:St[l],se=v||g||D,B=(0,Y.useCallback)(()=>{let e=M.current;e&&(e.style.height=`0`,e.style.height=`${e.scrollHeight}px`)},[]);(0,Y.useEffect)(()=>{B()},[n,B]),(0,Y.useEffect)(()=>{let e=M.current;if(!e)return;let t=new ResizeObserver(()=>B());return t.observe(e.parentElement??e),()=>t.disconnect()},[B]);let le={transform:c.Transform.toString(k),transition:A,opacity:j?.5:1,zIndex:j?10:void 0},V=(0,Y.useCallback)(t=>{!b||wt(t)||b(e)},[e,b]);return(0,X.jsxs)(`div`,{ref:O,style:le,onClick:e=>V(e.target),className:G(`group/step relative overflow-hidden rounded-md border bg-card/60 transition-colors`,`hover:bg-card`,j&&`shadow-lg ring-2 ring-primary/20`,z?.cardClass,v&&`ring-2 ring-primary/35 ring-offset-1 ring-offset-background bg-primary/[0.04]`,s&&`pointer-events-none opacity-60`),children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,X.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`,"aria-label":`Reorder step ${t+1}`,disabled:s||D,...te,...ne,children:(0,X.jsx)(re,{className:`size-3.5`})}),(0,X.jsxs)(`span`,{className:`mt-[3px] shrink-0 text-[11px] tabular-nums text-muted-foreground/50`,children:[`#`,t+1]}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[l!==`idle`&&z&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(Et,{status:l}),(0,X.jsx)(`span`,{className:`font-medium`,children:z.label})]}),(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`textarea`,{ref:M,value:n,onChange:e=>{i(t,e.target.value),ie(e.target.selectionStart??0),B()},onKeyDown:e=>{P.handleKeyDown(e)},onBlur:()=>{setTimeout(()=>P.setVisible(!1),150)},placeholder:`Describe what this step should do...`,disabled:s||D,rows:1,className:`min-w-0 w-full resize-none overflow-hidden border-none bg-transparent p-0 text-sm text-foreground outline-none placeholder:text-muted-foreground/40`,"aria-haspopup":P.visible?`listbox`:void 0,"aria-expanded":P.visible||void 0}),P.dropdown]}),S(n)&&(0,X.jsx)(y,{text:n,hookLabels:ae}),(R||g)&&(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-muted-foreground/70`,children:[(0,X.jsx)(ue,{className:`size-3 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate text-[11px] font-mono uppercase tracking-wide`,children:L??`Step settings open`})]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-start gap-2`,children:(0,X.jsxs)(`div`,{className:G(`mt-0.5 flex shrink-0 items-center gap-1 transition-opacity`,se?`opacity-100`:`opacity-0 pointer-events-none group-hover/step:pointer-events-auto group-hover/step:opacity-100 group-focus-within/step:pointer-events-auto group-focus-within/step:opacity-100`),children:[d&&(D?(0,X.jsxs)(H,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>m?.(t),disabled:s||!m,children:[l===`cancelling`?(0,X.jsx)(W,{className:`size-3 animate-spin`}):(0,X.jsx)(oe,{className:`size-3`}),`Cancel`]}):(0,X.jsxs)(H,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>p?.(t),disabled:s||!f||!p,children:[(0,X.jsx)(de,{className:`size-3`}),`Run`]})),(0,X.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>ee?.(e),disabled:s,className:G(`shrink-0 text-muted-foreground/70 hover:text-foreground`,g&&`bg-muted/60 text-foreground`),"aria-label":`Open settings for step ${t+1}`,title:`Step settings`,children:(0,X.jsx)(ue,{className:`size-3.5`})}),(0,X.jsxs)(dt,{children:[(0,X.jsx)(ft,{asChild:!0,children:(0,X.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:s||D,"aria-label":`Delete step ${t+1}`,title:`Delete step`,className:`text-muted-foreground/70 hover:text-destructive`,children:(0,X.jsx)(fe,{className:`size-3.5`})})}),(0,X.jsxs)(ht,{size:`sm`,children:[(0,X.jsxs)(gt,{children:[(0,X.jsx)(vt,{children:`Delete step?`}),(0,X.jsxs)(yt,{children:[`Step #`,t+1,` will be removed. This cannot be undone.`]})]}),(0,X.jsxs)(_t,{children:[(0,X.jsx)(xt,{children:`Cancel`}),(0,X.jsx)(bt,{variant:`destructive`,onClick:()=>o(t),children:`Delete`})]})]})]})]})})]}),g&&(0,X.jsx)(`div`,{className:`border-t px-3 py-3`,children:(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(I,{htmlFor:`step-${t}-timeout`,className:`text-[11px] text-muted-foreground`,children:`Timeout`}),(0,X.jsx)(K,{id:`step-${t}-timeout`,value:r.timeout??``,onChange:e=>a(t,`timeout`,e.target.value||void 0),placeholder:`e.g. 30s`,disabled:s,className:`h-8 text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(I,{htmlFor:`step-${t}-retries`,className:`text-[11px] text-muted-foreground`,children:`Retries`}),(0,X.jsx)(K,{id:`step-${t}-retries`,type:`number`,min:0,value:r.retries??``,onChange:e=>a(t,`retries`,e.target.value?Number(e.target.value):void 0),placeholder:`0`,disabled:s,className:`h-8 text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(I,{htmlFor:`step-${t}-maxAttempts`,className:`text-[11px] text-muted-foreground`,children:`Max Attempts`}),(0,X.jsx)(K,{id:`step-${t}-maxAttempts`,type:`number`,min:1,value:r.maxAttempts??``,onChange:e=>a(t,`maxAttempts`,e.target.value?Number(e.target.value):void 0),placeholder:`1`,disabled:s,className:`h-8 text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(I,{className:`text-[11px] text-muted-foreground`,children:`Screenshot`}),(0,X.jsx)(`div`,{className:`flex h-8 items-center`,children:(0,X.jsx)(ce,{checked:r.screenshot??!1,onCheckedChange:e=>a(t,`screenshot`,e?!0:void 0),disabled:s})})]})]})}),x&&x.length>0&&(0,X.jsxs)(`div`,{className:`border-t px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Sub-actions`}),(0,X.jsx)(Me,{variant:`outline`,className:`text-[10px]`,children:x.length})]}),(0,X.jsx)(`div`,{className:`space-y-1`,children:x.map((t,n)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>w?.(e,n),className:G(`flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-xs transition-colors`,C===n?`border-primary/40 bg-primary/10 text-foreground`:`border-border/60 bg-background/70 text-muted-foreground hover:border-border hover:text-foreground`),children:[(0,X.jsx)(Tt,{result:t.result}),(0,X.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[`#`,n+1]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Dt(t)})]},`${e}-sub-${n}`))})]}),l===`failed`&&(0,X.jsx)(`div`,{className:`border-t px-3 py-2 text-xs text-destructive`,children:h||`Step failed. Select the step to inspect reasoning, env, network, or console output.`})]})}function kt({text:e}){return(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(je,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,X.jsx)(q,{className:`max-w-[250px] text-[13px]`,children:e})]})}function At({name:e,testId:o,target:c,context:l,isCreateMode:u,onChange:d,disabled:p=!1}){let{targets:m,isLoading:h}=ee(),{targets:g}=f(),_=c?g[c]:void 0;return(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(I,{htmlFor:`test-name`,className:`text-xs`,children:[`Test Name `,(0,X.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,X.jsx)(K,{id:`test-name`,value:e,onChange:e=>d(`name`,e.target.value),placeholder:`My Test`,disabled:p,className:`h-8 text-sm`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(I,{htmlFor:`test-id`,className:`text-xs flex items-center gap-1`,children:[`Test ID `,(0,X.jsx)(kt,{text:`Unique identifier used for memory and analytics. Changing this breaks the association with past runs and observations.`})]}),u?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(K,{id:`test-id`,value:o,readOnly:!0,disabled:!0,className:`h-8 text-sm font-mono flex-1`}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>d(`test-id`,L()),"aria-label":`Generate new ID`,disabled:p,children:(0,X.jsx)(P,{className:`size-3.5`})})]}):(0,X.jsx)(`p`,{className:`text-[13px] font-mono text-muted-foreground`,children:o||`No ID assigned`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(I,{htmlFor:`test-target`,className:`text-xs flex items-center gap-1`,children:[`Target `,(0,X.jsx)(`span`,{className:`text-destructive`,children:`*`}),` `,(0,X.jsx)(kt,{text:`A registered app target from your workspace config. Defines where the test runs (web URL or mobile app).`})]}),!h&&m.length===0?(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No targets configured.`,` `,(0,X.jsx)(J,{to:`/config`,className:`text-primary underline underline-offset-4 hover:text-primary/80`,children:`Add targets in Settings`}),`.`]}):(0,X.jsxs)(a,{value:c||void 0,onValueChange:e=>d(`target`,e),disabled:p||h,children:[(0,X.jsx)(r,{className:`w-full h-8 text-sm`,children:(0,X.jsx)(i,{placeholder:`Select a target`})}),(0,X.jsx)(n,{children:m.map(e=>(0,X.jsx)(t,{value:e,children:e},e))})]}),_&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted-foreground mt-1.5`,children:[_.platform===`web`?(0,X.jsx)(k,{className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`text-muted-foreground/70 uppercase text-[11px] tracking-wider shrink-0`,children:_.platform}),(0,X.jsxs)(`span`,{className:`font-mono truncate`,children:[_.product&&(0,X.jsx)(`span`,{className:`mr-1.5`,children:_.product}),_.platform===`web`&&_.url,_.platform===`android`&&`${_.appPackage}${_.appActivity?` / ${_.appActivity}`:``}`,_.platform===`ios`&&_.bundleId]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(I,{htmlFor:`test-context`,className:`text-xs flex items-center gap-1`,children:[`Context `,(0,X.jsx)(kt,{text:`Additional instructions the AI agent receives before executing steps. Use this for login credentials, test-specific rules, or environment details.`})]}),(0,X.jsx)(ae,{id:`test-context`,value:l,onChange:e=>d(`context`,e.target.value),placeholder:`Additional instructions for the AI agent...`,disabled:p,className:`min-h-[60px] resize-none text-sm`,rows:2})]})]})}var jt=[`name`,`test-id`,`target`,`use`,`meta`,`context`,`setup`,`steps`,`teardown`];function Mt(e){function t(e,n){if(x(e)){n?e.items.sort((e,t)=>{let n=jt.indexOf(String(e.key)),r=jt.indexOf(String(t.key));return(n===-1?jt.length:n)-(r===-1?jt.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 $(e){return Mt(e),e.toString()}function Nt(e,t,n){let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}function Pt(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Ft(e){try{let t=v(e);if(t.errors.length>0)return null;let n=t.toJSON();return!n||typeof n!=`object`?null:{name:n.name??``,testId:n[`test-id`]??``,target:n.target??``,context:n.context??``,setup:Pt(n.setup),steps:Array.isArray(n.steps)?n.steps.map(e=>{if(typeof e==`string`)return{text:e,overrides:{}};let t=e;return{text:t.step??``,overrides:{timeout:t.timeout,retries:t.retries,screenshot:t.screenshot,maxAttempts:t.maxAttempts}}}):[],teardown:Pt(n.teardown)}}catch{return null}}function It(e,t,n){try{let r=v(e);return n===void 0||Array.isArray(n)&&n.length===0?r.deleteIn(t):r.setIn(t,n),$(r)}catch{return e}}function Lt(e,t,n){try{let r=v(e),i=r.getIn([`steps`,t]);if(i&&typeof i==`object`&&`toJSON`in i){let e=i.toJSON();if(e&&typeof e==`object`&&`step`in e)return r.setIn([`steps`,t,`step`],n),$(r)}return r.setIn([`steps`,t],n),$(r)}catch{return e}}function Rt(e,t,n,r){try{let i=v(e),a=i.getIn([`steps`,t]),o=a&&typeof a==`object`&&`toJSON`in a?a.toJSON():a;if(typeof o==`string`||!o){let e=typeof o==`string`?o:``;i.setIn([`steps`,t],{step:e,[n]:r})}else if(r===void 0||r===``||r===null){i.deleteIn([`steps`,t,n]);let e=i.getIn([`steps`,t])?.toJSON?.();e&&typeof e==`object`&&Object.keys(e).filter(e=>e!==`step`).length===0&&i.setIn([`steps`,t],e.step??``)}else i.setIn([`steps`,t,n],r);return $(i)}catch{return e}}function zt(e,t){try{let n=v(e),r=n.getIn([`steps`]);return r&&typeof r.deleteIn==`function`&&r.deleteIn([t]),$(n)}catch{return e}}function Bt(e){try{let t=v(e),n=t.toJSON(),r=Array.isArray(n?.steps)?[...n.steps,``]:[``];return t.setIn([`steps`],r),$(t)}catch{return e}}function Vt(e,t,n,r){try{if(n===r||n<0||r<0)return e;let i=v(e),a=i.getIn([t]),o=a&&typeof a==`object`&&`toJSON`in a&&typeof a.toJSON==`function`?a.toJSON():a;return!Array.isArray(o)||n>=o.length||r>=o.length?e:(i.setIn([t],Nt(o,n,r)),$(i))}catch{return e}}function Ht({status:e}){switch(e){case`running`:return(0,X.jsx)(E,{className:`size-3.5 text-primary`});case`passed`:return(0,X.jsx)(V,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,X.jsx)(me,{className:`size-3.5 text-destructive`});default:return(0,X.jsx)(pe,{className:`size-3.5 text-muted-foreground`})}}function Ut({phase:e,title:t,hooks:n,selection:r,onSelect:i,canRunHook:a=!1,onRunHook:o}){return n.length===0?null:(0,X.jsxs)(`div`,{"data-live-hook-section":e,className:`space-y-1.5`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t}),(0,X.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>(0,X.jsxs)(`div`,{className:G(`relative overflow-hidden flex items-center gap-2 rounded-md border bg-muted/15 px-3 py-2 transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:r?.type===`hook`&&r.hookId===e.id?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-border/60 hover:border-border hover:bg-muted/25`),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i?.({type:`hook`,hookId:e.id}),className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,X.jsx)(Ht,{status:e.status}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,X.jsx)(`div`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.id}),(0,X.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e.status===`pending`?`Waiting for session lifecycle`:e.status===`running`?`Running hook`:e.status===`passed`?`Completed`:e.error??`Hook failed`})]})]}),a&&(0,X.jsxs)(H,{type:`button`,variant:`outline`,size:`xs`,className:`shrink-0`,onClick:t=>{t.stopPropagation(),i?.({type:`hook`,hookId:e.id}),o?.(e.phase,e.id)},disabled:e.status===`running`||!o,children:[(0,X.jsx)(de,{className:`size-3`}),`Run`]})]},e.id))})]})}function Wt({content:e,onChange:t,isCreateMode:n,disabled:r=!1,showLiveStepActions:i=!1,canRunLiveStep:a=!1,canRunLiveHook:s=!1,liveEditorSteps:c,draftStepIds:u,liveSetupHooks:f,liveTeardownHooks:ee,onRunLiveStep:_,onCancelLiveStep:v,onRunLiveHook:y,openStepSettingsId:x,onOpenStepSettingsChange:S,selection:C,onSelect:E,variableSuggestions:ne}){let O=(0,Y.useRef)(null),{hooks:k,warningCopy:A}=w(),re=(0,Y.useMemo)(()=>Object.fromEntries(k.map(e=>[e.id,e.name])),[k]),j=Ft(e),M=j===null,N=j??O.current;j&&(O.current=j);let P=D(d(T,{activationConstraint:{distance:8}}),d(l,{coordinateGetter:b})),F=(0,Y.useCallback)((n,r)=>{t(It(e,[n],r))},[e,t]),ae=(0,Y.useCallback)((n,r)=>{t(Lt(e,n,r))},[e,t]),oe=(0,Y.useCallback)((n,r,i)=>{t(Rt(e,n,r,i))},[e,t]),I=(0,Y.useCallback)(n=>{t(zt(e,n))},[e,t]),L=(0,Y.useCallback)(()=>{t(Bt(e))},[e,t]),R=(0,Y.useMemo)(()=>N?.steps.map((e,t)=>u?.[t]??c?.[t]?.id??`draft-step-${t}`)??[],[N?.steps,u,c]),z=(0,Y.useCallback)(n=>{if(r||M)return;let{active:i,over:a}=n;if(!a||i.id===a.id)return;let o=R.indexOf(String(i.id)),s=R.indexOf(String(a.id));if(o===-1||s===-1)return;let c=Vt(e,`steps`,o,s);c!==e&&t(c)},[e,r,t,R,M]);return(0,X.jsx)(`div`,{className:`flex flex-col`,children:(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[M&&(0,X.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,X.jsx)(o,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{children:`YAML has errors — builder shows last valid state`})]}),N?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(At,{name:N.name,testId:N.testId,target:N.target,context:N.context,isCreateMode:n??!1,onChange:F,disabled:r||M}),(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-card/20 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(pe,{className:`size-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Hooks`})]}),(0,X.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[N.setup.length+N.teardown.length,` `,N.setup.length+N.teardown.length===1?`hook`:`hooks`]})]}),A&&(0,X.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,X.jsx)(o,{className:`mt-0.5 size-3.5 shrink-0`}),(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:A.title}),(0,X.jsx)(`p`,{children:A.body})]})]}),(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.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,X.jsx)(p,{phase:`setup`,label:`Setup`,values:N.setup,suggestions:k,disabled:r||M,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>F(`setup`,e)}),(0,X.jsx)(p,{phase:`teardown`,label:`Teardown`,values:N.teardown,suggestions:k,disabled:r||M,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>F(`teardown`,e)})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[i&&(0,X.jsx)(Ut,{phase:`setup`,title:`Setup Run Status`,hooks:f??[],selection:C??null,onSelect:E,canRunHook:!1,onRunHook:y}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[`Steps`,(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(je,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,X.jsx)(q,{className:`max-w-[250px] text-[13px]`,children:`Plain-English instructions the AI agent executes in order. Each step is interpreted and acted upon independently.`})]})]}),(0,X.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[N.steps.length,` `,N.steps.length===1?`step`:`steps`]})]}),(0,X.jsx)(h,{sensors:P,collisionDetection:te,onDragEnd:z,children:(0,X.jsx)(m,{items:R,strategy:g,children:(0,X.jsx)(`div`,{className:`space-y-1.5`,children:N.steps.map((e,t)=>(()=>{let n=c?.[t],o=R[t]??n?.id??`draft-step-${t}`,s=C?.type===`subaction`&&C.stepId===o?C.subIndex:null,l=C?.type===`step`||C?.type===`subaction`?C.stepId===o:!1,u=n?.status??`idle`;return(0,X.jsx)(Ot,{id:o,index:t,value:e.text,overrides:e.overrides,onChange:ae,onOverrideChange:oe,onDelete:I,disabled:r||M,liveStatus:u,showLiveControls:i,canRunLiveStep:a&&!!e.text.trim(),onRunLiveStep:_,onCancelLiveStep:v,stepError:n?.error,isSettingsOpen:x===o,onToggleSettings:e=>S?.(x===e?null:e),isSelected:l,onSelectStep:e=>E?.({type:`step`,stepId:e}),subActions:n?.subActionsData??null,selectedSubActionIndex:s,onSelectSubAction:(e,t)=>E?.({type:`subaction`,stepId:e,subIndex:t}),suggestions:ne,hookLabels:re},o)})())})})}),(0,X.jsxs)(H,{variant:`outline`,size:`sm`,className:`w-full mt-2 text-xs`,onClick:L,disabled:r||M,children:[(0,X.jsx)(ie,{className:`size-3.5`}),`Add Step`]}),i&&(0,X.jsx)(Ut,{phase:`teardown`,title:`Teardown Run Status`,hooks:ee??[],selection:C??null,onSelect:E,canRunHook:s,onRunHook:y})]})]}):(0,X.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 Gt({testName:e,testId:t,unsaved:n,isCreateMode:r,mode:i=`view`,testHref:a,isSaving:o,isValidating:s,isRunning:c,runDisabled:l=!1,hasInvalidFilename:u,shortcutsOpen:d,showTestId:f=!0,hasLiveSession:p=!1,liveConnectionState:m=`disconnected`,isLiveActionDisabled:h=!1,liveSessionNumber:g=null,onSave:ee,onValidate:_,onRun:v,onLiveConnect:y,onLiveEnd:b,onSettingsOpen:x,onToggleShortcuts:S}){let w=i===`view`&&!r,T=!!y||!!b||p||m===`connecting`,E=!r||T,D=!r&&!w&&i===`edit`,te=!w&&p&&typeof g==`number`&&(m===`connected`||m===`executing`),k=`Start a disposable live session for this test. Setup hooks run on connect, teardown hooks run when the session ends, and changes are not saved automatically.`;return(0,X.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center justify-between border-b px-4 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,X.jsx)(J,{to:`/tests`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:`Tests`}),(0,X.jsx)(ge,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),r?(0,X.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`New Test`}):a&&!w?(0,X.jsx)(J,{to:a,className:`truncate text-sm font-medium hover:text-primary transition-colors`,children:e}):(0,X.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e}),D&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ge,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,X.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`Edit`})]}),n&&(0,X.jsx)(Me,{variant:`outline`,className:`text-xs`,children:`Unsaved`}),!w&&!r&&t&&f&&(0,X.jsx)(C,{label:`T`,value:t})]}),(0,X.jsx)(`div`,{className:`flex items-center gap-3 shrink-0`,children:w?(0,X.jsxs)(X.Fragment,{children:[a?(0,X.jsx)(H,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(J,{to:a,children:[`Edit`,(0,X.jsx)(N,{shortcut:`E`})]})}):(0,X.jsxs)(H,{variant:`outline`,size:`sm`,disabled:!0,children:[`Edit`,(0,X.jsx)(N,{shortcut:`E`})]}),(0,X.jsx)(A,{onRun:v,disabled:c||l,label:c?`Running...`:`Run`,shortcutKey:`R`,size:`sm`}),T&&(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(H,{size:`sm`,onClick:y,disabled:h||!y,children:[m===`connecting`?(0,X.jsx)(W,{className:`h-3.5 w-3.5 animate-spin`}):(0,X.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`,(0,X.jsx)(N,{shortcut:`L`,className:`border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground`})]})}),(0,X.jsx)(q,{className:`max-w-sm text-[13px]`,children:k})]}),!r&&(0,X.jsxs)(se,{open:d,onOpenChange:e=>{e||S()},children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(H,{variant:`ghost`,size:`icon-sm`,onClick:S,"aria-label":`Shortcuts`,children:(0,X.jsx)(M,{className:`h-3.5 w-3.5`})})})}),(0,X.jsx)(q,{children:`Shortcuts`})]}),(0,X.jsx)(R,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,X.jsx)(`div`,{className:`space-y-3`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,X.jsx)(j,{hints:[{key:`E`,label:`Edit`},{key:`R`,label:`Run`},{key:`L`,label:`Connect Live Session`}]})]})})})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:_,disabled:s||u,children:[(0,X.jsx)(V,{className:`h-3.5 w-3.5`}),s?`Validating...`:`Validate`]}),(0,X.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:ee,disabled:o||u,children:[(0,X.jsx)(ne,{className:`h-3.5 w-3.5`}),o?`Saving...`:`Save`]}),(0,X.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:x,children:[(0,X.jsx)(F,{className:`h-3.5 w-3.5`}),`Settings`]}),E&&(0,X.jsx)(`div`,{className:`h-4 w-px bg-border`}),!r&&(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(A,{onRun:v,disabled:c||l,label:c?`Running...`:`Run`,size:`sm`})}),T&&(p&&m!==`connecting`?(0,X.jsxs)(H,{variant:`destructive`,size:`sm`,onClick:b,disabled:!b,children:[(0,X.jsx)(oe,{className:`h-3.5 w-3.5`}),`End Live Session`]}):(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(H,{size:`sm`,onClick:y,disabled:h||!y,children:[m===`connecting`?(0,X.jsx)(W,{className:`h-3.5 w-3.5 animate-spin`}):(0,X.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`]})}),(0,X.jsx)(q,{className:`max-w-sm text-[13px]`,children:k})]})),te&&(0,X.jsxs)(Me,{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,X.jsxs)(se,{open:d,onOpenChange:e=>{e||S()},children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(U,{asChild:!0,children:(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(H,{variant:`ghost`,size:`icon-sm`,onClick:S,"aria-label":`Shortcuts`,children:(0,X.jsx)(M,{className:`h-3.5 w-3.5`})})})}),(0,X.jsx)(q,{children:`Shortcuts`})]}),(0,X.jsx)(R,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,X.jsx)(`div`,{className:`space-y-3`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,X.jsx)(j,{hints:[{key:`R`,label:`Run test`},{key:`Cmd+S`,label:`Save`},{key:`Esc`,label:`Close results panel`}]})]})})})]})]})})]})}export{dt as a,ht as c,gt as d,vt as f,Ft as i,yt as l,Wt as n,bt as o,ft as p,It as r,xt as s,Gt as t,_t as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./arrow-up-down-DyIZvSrC.js";import{i as n,n as r,o as i,s as a,t as o}from"./select-B5gV6YUf.js";import{n as s}from"./split-button-C7J0EKrF.js";import{n as c,r as l}from"./shortcut-hints-CfVf0REF.js";import{t as u}from"./plus-C6Zz9JLt.js";import{t as d}from"./use-page-title-CK82kWb2.js";import{t as f}from"./batch-action-bar-CZxUcNFZ.js";import{n as p,t as ee}from"./scroll-area-DfPMtFw0.js";import{At as m,Ht as h,Mn as te,Mt as ne,N as re,Nt as ie,Qn as g,Ut as _,Vn as ae,Vt as oe,Wt as v,Zn as se,a as ce,fr as y,ht as le,jt as ue,kt as b,lr as de,or as x,sr as fe,tt as pe,ut as me,xt as he}from"./index-B3xPCIyH.js";import{t as S}from"./badge-BbhOGRC0.js";import{a as ge,n as _e,o as ve,r as ye,t as be}from"./lib-BPEPp1D-.js";import{a as xe,i as Se,n as Ce,o as C,r as we,t as Te}from"./table-DL0PmHAE.js";import{t as Ee}from"./empty-state-Dluv5C1Q.js";import{t as De}from"./use-keyboard-shortcuts-BRF3cm7O.js";import{n as Oe,t as ke}from"./use-selection-queue-CZ4rXNAT.js";import{n as Ae,r as je,t as Me}from"./tests-suites-table-widths-tlOYaS72.js";var w=e(y(),1),T=new Set([`asc`,`desc`]),E=50;function Ne(e){if(!e)return 1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>1?t:1}function D(e){let t=new URLSearchParams;return e.search&&t.set(`search`,e.search),e.status&&t.set(`status`,e.status),e.platform&&t.set(`platform`,e.platform),e.target&&t.set(`target`,e.target),e.sort&&(t.set(`sort`,e.sort),t.set(`order`,e.order)),e.page>1&&t.set(`page`,String(e.page)),t}function Pe(){let[e,t]=de(),n=e.get(`search`)??``,r=e.get(`status`)??``,i=e.get(`platform`)??``,a=e.get(`target`)??``,o=e.get(`sort`)??``,s=e.get(`order`)??`desc`,c=T.has(s)?s:`desc`,l=Ne(e.get(`page`)),u=(0,w.useMemo)(()=>o?[{id:o,desc:c===`desc`}]:[],[o,c]),d=(0,w.useRef)(u);d.current=u;let f=(0,w.useMemo)(()=>({search:n,status:r,platform:i,target:a,sort:o,order:c,page:l}),[n,r,i,a,o,c,l]);(0,w.useEffect)(()=>{let n=D(f);e.toString()!==n.toString()&&t(n,{replace:!0})},[e,t,f]);let p=(0,w.useCallback)((e,n)=>{let r={...f,...e};n?.resetPage&&(r.page=1),t(D(r),{replace:!0})},[t,f]),ee=(0,w.useCallback)(e=>{let t=typeof e==`function`?e(d.current):e;t.length>0?p({sort:t[0].id,order:t[0].desc?`desc`:`asc`}):p({sort:``,order:`desc`})},[p]),m=(0,w.useMemo)(()=>({pageIndex:l-1,pageSize:E}),[l]);return{search:n,status:r,platform:i,target:a,sort:o,order:c,page:l,sorting:u,pagination:m,onSortingChange:ee,onPaginationChange:(0,w.useCallback)(e=>{p({page:(typeof e==`function`?e(m):e).pageIndex+1})},[m,p]),setSearch:(0,w.useCallback)(e=>p({search:e},{resetPage:!0}),[p]),setStatus:(0,w.useCallback)(e=>p({status:e},{resetPage:!0}),[p]),setPlatform:(0,w.useCallback)(e=>p({platform:e},{resetPage:!0}),[p]),setTarget:(0,w.useCallback)(e=>p({target:e},{resetPage:!0}),[p]),setPage:(0,w.useCallback)(e=>p({page:e}),[p])}}var O=se();function k({status:e}){switch(e){case`passed`:return(0,O.jsx)(S,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/20`,children:`Passed`});case`failed`:return(0,O.jsx)(S,{variant:`destructive`,children:`Failed`});case`healed`:return(0,O.jsx)(S,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Healed`});case`flaky`:return(0,O.jsx)(S,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Flaky`});case`running`:return(0,O.jsx)(S,{className:`bg-blue-500/15 text-blue-500 border-blue-500/20 animate-pulse`,children:`Running`});case`cancelled`:return(0,O.jsx)(S,{className:`bg-muted text-muted-foreground border-border`,children:`Cancelled`});default:return(0,O.jsx)(S,{variant:`outline`,children:e})}}var Fe=new Set([`passed`,`healed`]),Ie=new Set([`passed`,`healed`,`failed`,`flaky`,`cancelled`]);function A(e){return e?e===`ios`?`iOS`:e.charAt(0).toUpperCase()+e.slice(1):`—`}function j(e){return e.replace(/\\/g,`/`)}function M(e){let t=j(e).split(`/`).filter(Boolean);return t.length>1?t.slice(1).join(`/`):t[0]??e}function N(e){return e.createdAt||e.startedAt||e.endedAt||``}function Le(e){return _(`h-10 bg-background text-[13px] font-medium text-foreground/90`,e===`select`?`px-2 text-center`:`px-3`,(e===`passRate`||e===`lastRun`)&&`text-right`)}function Re(e){return _(`py-2 align-top`,e===`select`&&`px-2`,e===`name`&&`max-w-0 px-3`,(e===`target`||e===`targetName`)&&`max-w-0 px-3`,e===`platform`&&`px-3`,e===`passRate`&&`px-3 text-right`,e===`lastRun`&&`max-w-0 px-3 text-right`)}function ze({isActive:e,isBatchSelected:t}){return _(`cursor-pointer outline-none hover:bg-muted/20 focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/60`,t&&!e&&`bg-muted/20`,e&&`bg-primary/10 ring-1 ring-inset ring-primary/60`)}var P=[{accessorKey:`name`,header:({column:e})=>(0,O.jsxs)(h,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Test Name`,(0,O.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,O.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,O.jsx)(`span`,{className:`block whitespace-normal break-words text-sm font-medium leading-snug text-foreground`,children:e.getValue(`name`)}),(0,O.jsx)(`span`,{className:`block whitespace-normal break-all text-xs leading-snug text-muted-foreground`,children:M(e.original.path)})]}),filterFn:(e,t,n)=>{let r=e.getValue(`name`).toLowerCase(),i=e.original.path.toLowerCase(),a=n.toLowerCase();return r.includes(a)||i.includes(a)}},{accessorKey:`targetName`,header:({column:e})=>(0,O.jsxs)(h,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Target`,(0,O.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,O.jsx)(`span`,{className:`block whitespace-normal break-words text-sm leading-snug text-muted-foreground`,children:e.original.targetName??`No target`})},{accessorKey:`platform`,header:({column:e})=>(0,O.jsxs)(h,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Platform`,(0,O.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,O.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:A(e.getValue(`platform`))})},{accessorKey:`passRate`,header:({column:e})=>(0,O.jsxs)(h,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Pass rate`,(0,O.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>e.original.passRate===null?(0,O.jsxs)(`div`,{className:`space-y-0.5 text-right`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`No runs`}),(0,O.jsx)(`div`,{className:`text-xs tabular-nums text-muted-foreground`,children:`0 completed`})]}):(0,O.jsxs)(`div`,{className:`space-y-0.5 text-right`,children:[(0,O.jsxs)(`div`,{className:`text-sm font-medium tabular-nums text-foreground`,children:[e.original.passRate,`%`]}),(0,O.jsxs)(`div`,{className:`text-xs tabular-nums text-muted-foreground`,children:[e.original.passCount,`/`,e.original.completedRunCount]})]})},{id:`lastRun`,accessorFn:e=>e.lastRun?.createdAt??e.lastRun?.startedAt??e.lastRun?.endedAt??``,header:({column:e})=>(0,O.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,O.jsxs)(h,{variant:`ghost`,className:`h-auto justify-end px-0 text-[13px] font-medium text-foreground/90 hover:bg-transparent`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Last run`,(0,O.jsx)(t,{className:`ml-2 h-4 w-4`})]})}),cell:({row:e})=>e.original.lastRun?(0,O.jsxs)(x,{to:g.runDetail(e.original.lastRun.id),className:`relative z-10 flex w-full flex-col items-end gap-1 rounded-sm text-right focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(k,{status:e.original.lastRun.status}),(0,O.jsx)(`span`,{className:`whitespace-normal break-words text-xs leading-snug text-muted-foreground`,children:v(N(e.original.lastRun))})]}):(0,O.jsx)(`span`,{className:`block text-sm text-muted-foreground`,children:`No runs`}),sortingFn:(e,t)=>{let n=N(e.original.lastRun??{createdAt:``,startedAt:null,endedAt:null}),r=N(t.original.lastRun??{createdAt:``,startedAt:null,endedAt:null});return n.localeCompare(r)}}];function F(){d(`Tests`);let[e,t]=(0,w.useState)([]),[v,se]=(0,w.useState)([]),[y,de]=(0,w.useState)([]),[x,S]=(0,w.useState)(!0),[T,E]=(0,w.useState)(!1),[Ne,D]=(0,w.useState)(!1),[k,A]=(0,w.useState)(!0),[F,Be]=(0,w.useState)(!0),I=fe(),{hasFarm:Ve,isLoading:He}=s();(0,w.useEffect)(()=>{let e=!1;return Promise.all([me(),pe({limit:200})]).then(([n,r])=>{e||(t(n.files),de(n.targets??[]),se(r.runs))}).catch(()=>{e||b.error(`Failed to load test files`)}).finally(()=>{e||S(!1)}),()=>{e=!0}},[]);let{search:L,status:R,platform:z,target:B,page:V,sorting:Ue,pagination:H,onSortingChange:We,onPaginationChange:Ge,setSearch:Ke,setStatus:qe,setPlatform:Je,setTarget:Ye,setPage:Xe}=Pe(),[U,W]=(0,w.useState)(-1),Ze=(0,w.useRef)([]),G=(0,w.useMemo)(()=>{let t=new Map,n=new Map,r=(e,t,n)=>{if(!t)return;let r=e.get(t);r?r.push(n):e.set(t,[n])};for(let e of v){if(!e.filePath)continue;let i=j(e.filePath);r(t,i,e),r(n,M(i),e)}return e.map(e=>{let r=j(e.path),i=[...t.get(r)??n.get(M(r))??[]].sort((e,t)=>N(t).localeCompare(N(e))),a=i.filter(e=>Ie.has(e.status)),o=a.filter(e=>Fe.has(e.status)).length,s=a.length>0?Math.round(o/a.length*100):null,c=i[0]??null;return{path:e.path,name:e.name,testId:e.testId,targetName:e.targetName,platform:e.platform,lastRunStatus:c?.status??null,lastRun:c,passRate:s,passCount:o,completedRunCount:a.length}})},[e,v]),K=(0,w.useMemo)(()=>{let e=G;if(L){let t=L.toLowerCase();e=e.filter(e=>{let n=e.targetName?.toLowerCase()??``;return e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)||n.includes(t)})}return R&&(e=R===`no-runs`?e.filter(e=>!e.lastRunStatus):e.filter(e=>e.lastRunStatus===R)),z&&(e=e.filter(e=>e.platform===z)),B&&(e=e.filter(e=>e.targetName===B)),e},[G,L,R,z,B]),q=ke({items:G,getId:e=>e.path,visibleIds:K.map(e=>e.path)}),Qe=(0,w.useMemo)(()=>Array.from(new Set([B,...y,...G.map(e=>e.targetName??``)].filter(e=>!!e))),[G,B,y]),$e={id:`select`,header:({table:e})=>(0,O.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,O.jsx)(je,{checked:q.getVisibleSelectionState(e.getRowModel().rows.map(e=>e.original.path)),onCheckedChange:t=>q.setItemsSelected(e.getRowModel().rows.map(e=>e.original),t),ariaLabel:`Select all`})}),cell:({row:e})=>(0,O.jsx)(je,{checked:q.isSelected(e.original.path),onCheckedChange:t=>q.setItemSelected(e.original,t)}),enableSorting:!1,size:48},J=q.selectedIds,Y=q.selectedItems,et=(0,w.useCallback)(()=>{q.clearSelection(),D(!1),A(!0),Be(!0)},[q]),tt=(0,w.useCallback)(async e=>{if(J.length!==0){E(!0);try{let t=await Promise.allSettled(J.map(t=>he({file:t,local:e,noCache:!k,noMemory:!F}))),n=t.filter(e=>e.status===`fulfilled`).length,r=t.length-n;r>0?b.error(`${n} runs queued, ${r} failed`):b.success(`${n} runs queued`),D(!1)}finally{E(!1)}}},[J,k,F]),nt=(0,w.useCallback)(async()=>{if(J.length!==0){E(!0);try{let e=await Promise.allSettled(J.map(e=>le({file:e}))),t=e.filter(e=>e.status===`fulfilled`).length,n=e.filter(e=>e.status===`fulfilled`).reduce((e,t)=>e+t.value.purged,0),r=e.length-t;r>0?b.error(`Purged ${n} plans from ${t} tests, ${r} failed`):b.success(`Purged ${n} cached plan${n===1?``:`s`}`)}finally{E(!1)}}},[J]),rt=(0,w.useCallback)(async()=>{if(Y.length!==0){E(!0);try{let e=await Promise.allSettled(Y.map(e=>e.testId?re(e.testId):Promise.reject(Error(`Missing test id for ${e.path}`)))),n=Y.filter((t,n)=>e[n]?.status===`fulfilled`),r=new Set(n.map(e=>e.path)),i=e.length-n.length;n.length>0&&(q.setItemsSelected(n,!1),t(e=>e.filter(e=>!r.has(e.path))),D(!1)),i>0?b.error(`Deleted ${n.length} test${n.length===1?``:`s`}, ${i} failed`):b.success(`Deleted ${n.length} test${n.length===1?``:`s`}`)}finally{E(!1)}}},[Y,q]),X=_e({data:K,columns:[$e,...P],getCoreRowModel:ye(),getSortedRowModel:ve(),getPaginationRowModel:ge(),onSortingChange:We,onPaginationChange:Ge,getRowId:e=>e.path,state:{sorting:Ue,pagination:H}}),Z=X.getRowModel().rows,Q=q.hiddenCount,it=L;(0,w.useEffect)(()=>{if(x)return;let e=Math.max(1,Math.ceil(K.length/H.pageSize));V>e&&Xe(e)},[K.length,x,V,H.pageSize,Xe]);let at=(0,w.useCallback)(e=>{Ke(e),W(-1)},[Ke]);De((0,w.useMemo)(()=>{let e=()=>W(e=>Math.min(e+1,Z.length-1)),t=()=>W(e=>Math.max(e-1,0));return{j:e,arrowdown:e,k:t,arrowup:t,enter:e=>{if(U>=0&&Z[U]){let t=Z[U].original,n=g.testView(t.testId??t.path);e.metaKey||e.ctrlKey?window.open(n,`_blank`):I(n)}}}},[Z,U,I])),(0,w.useEffect)(()=>{if(U<0)return;let e=Ze.current[U];e&&document.activeElement!==e&&e.focus()},[U,Z.length]);let ot=(0,w.useCallback)((e,t)=>{t&&t.preventDefault(),I(g.testView(e.testId??e.path))},[I]);if(x)return(0,O.jsx)(ce,{});if(e.length===0)return(0,O.jsx)(Ee,{icon:ae,title:`No tests found`,description:`Create your first test file to get started`,actionLabel:`Create Test`,onAction:()=>I(g.testNew)});let $=K.length,st=H.pageIndex,ct=H.pageSize,lt=st*ct+1,ut=Math.min(lt+ct-1,$);return(0,O.jsx)(ne,{children:(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Tests`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsx)(h,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,children:(0,O.jsx)(l,{className:`h-4 w-4`})})}),(0,O.jsx)(ue,{side:`bottom`,className:`p-3`,children:(0,O.jsx)(c,{hints:[{key:`J / ↓`,label:`Next row`},{key:`K / ↑`,label:`Previous row`},{key:`Enter`,label:`Open test`},{key:`⌘+Enter`,label:`Open in new tab`}]})})]}),(0,O.jsxs)(h,{size:`sm`,onClick:()=>I(g.testNew),children:[(0,O.jsx)(u,{className:`size-4`}),`New Test`]})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,O.jsx)(oe,{placeholder:`Search tests...`,value:it,onChange:e=>at(e.target.value),className:`max-w-[220px]`}),(0,O.jsxs)(o,{value:R||`all`,onValueChange:e=>{qe(e===`all`?``:e),W(-1)},children:[(0,O.jsx)(i,{className:`w-[150px]`,children:(0,O.jsx)(a,{placeholder:`All statuses`})}),(0,O.jsxs)(r,{children:[(0,O.jsx)(n,{value:`all`,children:`All statuses`}),(0,O.jsx)(n,{value:`passed`,children:`Passed`}),(0,O.jsx)(n,{value:`failed`,children:`Failed`}),(0,O.jsx)(n,{value:`running`,children:`Running`}),(0,O.jsx)(n,{value:`no-runs`,children:`No runs`})]})]}),(0,O.jsxs)(o,{value:z||`all`,onValueChange:e=>{Je(e===`all`?``:e),W(-1)},children:[(0,O.jsx)(i,{className:`w-[140px]`,children:(0,O.jsx)(a,{placeholder:`All platforms`})}),(0,O.jsxs)(r,{children:[(0,O.jsx)(n,{value:`all`,children:`All platforms`}),(0,O.jsx)(n,{value:`web`,children:`Web`}),(0,O.jsx)(n,{value:`android`,children:`Android`}),(0,O.jsx)(n,{value:`ios`,children:`iOS`})]})]}),(0,O.jsxs)(o,{value:B||`all`,onValueChange:e=>{Ye(e===`all`?``:e),W(-1)},children:[(0,O.jsx)(i,{className:`w-[180px]`,children:(0,O.jsx)(a,{placeholder:`All targets`})}),(0,O.jsxs)(r,{children:[(0,O.jsx)(n,{value:`all`,children:`All targets`}),Qe.map(e=>(0,O.jsx)(n,{value:e,children:e},e))]})]})]}),(0,O.jsxs)(ee,{className:`rounded-md border`,children:[(0,O.jsxs)(Te,{className:`min-w-full table-fixed`,children:[(0,O.jsx)(`colgroup`,{children:Me.map(e=>{let t=Ae(e);return(0,O.jsx)(`col`,{"data-column-id":e,style:t?{width:t}:void 0},e)})}),(0,O.jsx)(xe,{children:X.getHeaderGroups().map(e=>(0,O.jsx)(C,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,O.jsx)(Se,{className:Le(e.column.id),children:e.isPlaceholder?null:be(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,O.jsx)(Ce,{children:Z.length?Z.map((e,t)=>{let n=t===U,r=q.isSelected(e.original.path);return(0,O.jsx)(C,{ref:e=>{Ze.current[t]=e},"data-runs-row-surface":e.id,tabIndex:n?0:-1,"aria-selected":n,className:ze({isActive:n,isBatchSelected:r}),onClick:()=>ot(e.original),onFocus:()=>W(t),onKeyDown:t=>{t.key===`Enter`&&ot(e.original,t)},children:e.getVisibleCells().map(e=>{let t=e.column.id===`select`;return(0,O.jsx)(we,{className:_(Re(e.column.id),t&&`relative z-10`),children:be(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)}):(0,O.jsx)(C,{children:(0,O.jsx)(we,{colSpan:P.length+1,className:`h-24 text-center`,children:`No tests match the current search or filters.`})})})]}),(0,O.jsx)(p,{orientation:`horizontal`})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between px-2`,children:[(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:$>0?`Showing ${lt}-${ut} of ${$}${it||R||z||B?` (${G.length} total)`:``}`:`No tests found`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(h,{variant:`outline`,size:`sm`,onClick:()=>X.previousPage(),disabled:!X.getCanPreviousPage(),children:`Previous`}),(0,O.jsx)(h,{variant:`outline`,size:`sm`,onClick:()=>X.nextPage(),disabled:!X.getCanNextPage(),children:`Next`})]})]}),(0,O.jsx)(f,{selectedCount:q.selectedCount,summaryMeta:Q>0?`${Q} hidden by filters`:void 0,secondaryIcon:(0,O.jsx)(te,{className:`size-4`}),secondaryAriaLabel:`Clear queue`,onDelete:rt,actionSlot:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(Oe,{selectedCount:q.selectedCount,hiddenCount:Q,useCache:k,useMemory:F,browserStackAvailable:!He&&Ve,open:Ne,onOpenChange:D,onUseCacheChange:A,onUseMemoryChange:Be,onRunLocal:()=>tt(!0),onRunBrowserStack:()=>tt(!1),disabled:T}),(0,O.jsx)(h,{variant:`outline`,size:`sm`,onClick:nt,disabled:T,children:`Purge cache`})]}),onCancel:et,isRunning:T})]})})}export{F as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{a as t,f as n,i as r,n as i,r as a,t as o,u as s}from"./tab-console-CLKFTABo.js";import{u as c}from"./select-B5gV6YUf.js";import{t as l}from"./circle-x-DLBotPS8.js";import{t as u}from"./copy-Gj5_oF-8.js";import{t as d}from"./eye-CZ7GiZXJ.js";import{t as f}from"./refresh-cw-v_0wwa0P.js";import{t as p}from"./zap-C7OZlYXQ.js";import{n as m,r as h,t as g}from"./popover-CvQRjfg5.js";import{t as _}from"./scroll-area-DfPMtFw0.js";import{i as v,n as y,r as b,t as x}from"./tabs-CfNQIHt-.js";import{At as S,Hn as C,Ht as w,In as ee,Kt as T,Ln as E,Mn as te,Nn as D,Nt as ne,Pt as O,Rn as re,Ut as k,Zn as A,fr as j,ir as M,jt as N,qn as P,rt as F}from"./index-B3xPCIyH.js";import{t as I}from"./badge-BbhOGRC0.js";import{n as L}from"./step-name-pills-COKv64-4.js";var R=P(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),ie=P(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),z=P(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),B=P(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),ae=P(`crosshair`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]),oe=P(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),V=A();function H({log:e}){return(0,V.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,V.jsx)(`div`,{className:`shrink-0 border-b px-4 py-3`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,V.jsx)(I,{className:k(`px-1.5 py-0 text-[10px]`,e.status===`passed`?`border-emerald-500/20 bg-emerald-500/15 text-emerald-500`:e.status===`running`?`border-blue-500/20 bg-blue-500/15 text-blue-500`:`border-red-500/20 bg-red-500/15 text-red-500`),children:e.status}),(0,V.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.phase}),(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:T(e.duration)})]})}),(0,V.jsx)(_,{className:`flex-1`,children:(0,V.jsxs)(`div`,{className:`space-y-4 p-4`,children:[e.stdout&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`stdout`}),(0,V.jsx)(`pre`,{className:`rounded-md bg-muted/50 p-2 font-mono text-xs whitespace-pre-wrap break-all`,children:e.stdout})]}),e.stderr&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`stderr`}),(0,V.jsx)(`pre`,{className:`rounded-md bg-red-500/5 p-2 font-mono text-xs whitespace-pre-wrap break-all text-red-400`,children:e.stderr})]}),e.variables&&Object.keys(e.variables).length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Emitted Variables`}),(0,V.jsx)(`table`,{className:`w-full text-sm`,children:(0,V.jsx)(`tbody`,{children:Object.entries(e.variables).map(([e,t])=>(0,V.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,V.jsx)(`td`,{className:`px-2 py-1 font-mono text-xs text-muted-foreground`,children:e}),(0,V.jsx)(`td`,{className:`px-2 py-1 font-mono text-xs break-all`,children:t})]},e))})})]}),e.returnData!=null&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Return Data`}),(0,V.jsx)(`pre`,{className:`rounded-md bg-muted/50 p-2 font-mono text-xs whitespace-pre-wrap break-all`,children:typeof e.returnData==`string`?e.returnData:JSON.stringify(e.returnData,null,2)})]})]})})]})}var U=e(j(),1);function W({children:e,marker:t,state:n,tone:r,label:i}){let a=r===`primary`?`text-primary`:`text-amber-500`;return(0,V.jsxs)(S,{children:[(0,V.jsx)(ne,{asChild:!0,children:(0,V.jsxs)(`span`,{className:`relative inline-flex shrink-0 cursor-default`,children:[e,(0,V.jsx)(`span`,{"data-cache-marker":t,"data-cache-state":n,"aria-label":i,className:k(`absolute -bottom-px -right-px inline-flex size-2 items-center justify-center rounded-full border border-background/90 bg-background/70 shadow-[0_0_0_1px_color-mix(in_srgb,var(--border)_70%,transparent)]`,a),children:(0,V.jsx)(p,{className:k(`size-1.5 fill-current stroke-[2.5]`,a)})})]})}),(0,V.jsx)(N,{children:i})]})}function se(e){if(!e)return null;try{let t=typeof e==`string`?JSON.parse(e):e;if(t&&typeof t==`object`)return[t.type||t.action||``,t.target||t.selector||``].filter(Boolean).join(` `)}catch{return String(e)}return null}function ce({sub:e,index:t,stepId:n,isSelected:r,onSelect:i}){let a=se(e.plannedAction),o=e.phaseDurations?(e.phaseDurations.observe??0)+(e.phaseDurations.plan??0)+(e.phaseDurations.execute??0)+(e.phaseDurations.verify??0):null,s=(0,V.jsx)(`span`,{className:`relative inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:e.result===`in-progress`?(0,V.jsx)(re,{className:`h-3 w-3 text-blue-500 animate-spin shrink-0`}):e.result===`success`?(0,V.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 shrink-0`}):(0,V.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-red-500 shrink-0`})});return(0,V.jsx)(`li`,{role:`treeitem`,"aria-level":2,"aria-selected":r,"data-sub-action-id":`${n}-${t}`,children:(0,V.jsxs)(`button`,{className:k(`flex w-full items-center gap-2 py-1.5 px-3 text-left rounded-[2px] text-sm`,`hover:bg-muted/50 transition-colors`,r&&`bg-primary/10 ring-1 ring-primary/30`),onClick:i,children:[e.cached?(0,V.jsx)(W,{marker:`sub-action-status`,state:`cached`,tone:`primary`,label:`Cached action`,children:s}):s,(0,V.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[`#`,t+1]}),a&&(0,V.jsx)(`span`,{className:`flex-1 min-w-0 text-xs truncate text-muted-foreground`,children:a}),o!=null&&(0,V.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:T(o)})]})})}function G({log:e,isSelected:t,onSelect:n}){let r=e.type===`runjs`?B:D;return(0,V.jsx)(`li`,{role:`treeitem`,"aria-level":2,"aria-selected":t,"data-execution-id":e.id,children:(0,V.jsxs)(`button`,{className:k(`flex w-full items-start gap-2 py-1.5 px-3 text-left rounded-[2px] text-sm`,`hover:bg-muted/50 transition-colors`,t&&`bg-primary/10 ring-1 ring-primary/30`),onClick:n,children:[e.status===`passed`?(0,V.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 shrink-0 mx-[5px]`}):(0,V.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-red-500 shrink-0 mx-[5px]`}),(0,V.jsx)(r,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5`}),e.phase===`inline`&&(0,V.jsx)(`span`,{className:`text-[9px] px-1 py-0 rounded bg-amber-500/15 text-amber-400 border border-amber-500/20 font-medium shrink-0`,children:`pre`}),(0,V.jsx)(`span`,{className:`flex-1 min-w-0 text-xs break-all text-muted-foreground`,children:e.name}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:T(e.duration)})]})})}function K({status:e}){switch(e){case`passed`:return(0,V.jsx)(C,{className:`h-4 w-4 text-emerald-500 shrink-0 mt-0.5`});case`failed`:return(0,V.jsx)(l,{className:`h-4 w-4 text-red-500 shrink-0 mt-0.5`});case`healed`:case`flaky`:return(0,V.jsx)(f,{className:`h-4 w-4 text-amber-500 shrink-0 mt-0.5`});default:return(0,V.jsx)(z,{className:`h-4 w-4 text-muted-foreground shrink-0 mt-0.5`})}}function q({step:e,isSelected:t,isExpanded:n,selection:r,onSelect:i,inlineLogs:a=[],embedded:o=!1}){let s=e.subActionsData??[],c=s.length>0,l=s.filter(e=>e.cached).length,u=s.length===0?`none`:l===s.length?`all`:l>0?`some`:`none`,d=c||a.length>0,f=(0,V.jsx)(K,{status:e.status}),p=u===`all`?(0,V.jsx)(W,{marker:`step-status`,state:`all`,tone:`primary`,label:`All actions cached`,children:f}):u===`some`?(0,V.jsx)(W,{marker:`step-status`,state:`some`,tone:`amber`,label:`${l} of ${s.length} actions cached`,children:f}):f;return(0,V.jsxs)(`li`,{role:`treeitem`,"aria-expanded":d?n:void 0,"aria-selected":t&&r?.type===`step`,"aria-level":1,"data-step-id":e.id,className:k(!o&&`mx-2 mb-1.5 rounded-[2px]`,d&&n&&!o&&`border border-border/70 bg-muted/15 relative before:absolute before:left-[19.5px] before:w-px before:bg-border/60 before:top-[19px] before:bottom-[13px]`,d&&n&&o&&`relative before:absolute before:left-[19.5px] before:w-px before:bg-border/60 before:top-[19px] before:bottom-[13px]`),children:[(0,V.jsxs)(`button`,{className:k(`flex w-full items-start gap-2 py-2 px-3 text-left rounded-[2px]`,`hover:bg-muted/50 transition-colors`,t&&r?.type===`step`&&`bg-primary/10 ring-1 ring-primary/30`),onClick:()=>i({type:`step`,stepId:e.id}),children:[p,(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e.displayStepTotal?(0,V.jsxs)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70`,children:[`Step `,e.displayStepOrder,` of `,e.displayStepTotal]}):null,(0,V.jsx)(L,{step:e})]}),(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 pt-0.5`,children:T(e.duration)})]}),n&&d&&(0,V.jsxs)(`ul`,{role:`group`,children:[a.map(t=>(0,V.jsx)(G,{log:t,isSelected:r?.type===`execution`&&r.logId===t.id,onSelect:()=>i({type:`execution`,stepId:e.id,logId:t.id})},t.id)),s.map((t,n)=>(0,V.jsx)(ce,{sub:t,index:n,stepId:e.id,isSelected:r?.type===`subaction`&&r.stepId===e.id&&r.subIndex===n,onSelect:()=>i({type:`subaction`,stepId:e.id,subIndex:n})},n))]})]})}function J(e){return e?.type===`step`||e?.type===`subaction`||e?.type===`execution`}function Y(e){return e?.type===`subaction`}function le({log:e,isSelected:t,onSelect:n}){return(0,V.jsx)(`li`,{role:`treeitem`,"aria-level":1,"aria-selected":t,children:(0,V.jsxs)(`button`,{className:k(`flex w-full items-center gap-2 py-1.5 px-3 text-left rounded-[2px] text-sm`,`hover:bg-muted/50 transition-colors`,t&&`bg-primary/10 ring-1 ring-primary/30`),onClick:n,children:[e.status===`passed`?(0,V.jsx)(C,{className:`h-3 w-3 text-emerald-500 shrink-0`}):e.status===`running`?(0,V.jsx)(z,{className:`h-3 w-3 text-blue-500 shrink-0`}):(0,V.jsx)(l,{className:`h-3 w-3 text-red-500 shrink-0`}),(0,V.jsx)(D,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,V.jsx)(`span`,{className:`flex-1 min-w-0 text-xs truncate`,children:e.name}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:T(e.duration)})]})})}function X({title:e}){return(0,V.jsx)(`div`,{className:`px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/60`,children:e})}function Z({title:e,hooks:t,selection:n,onSelect:r}){return t.length===0?null:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(X,{title:e}),(0,V.jsx)(`div`,{className:`mx-2 mb-1.5 rounded-[2px] border border-border/70 bg-muted/15`,children:(0,V.jsx)(`ul`,{role:`group`,children:t.map(e=>(0,V.jsx)(le,{log:e,isSelected:n?.type===`hook`&&n.hookId===e.id,onSelect:()=>r({type:`hook`,hookId:e.id})},e.id))})})]})}function ue({steps:e,selection:t,onSelect:n,suiteTests:r,suiteSelectedView:i,setupHooks:a=[],teardownHooks:o=[],inlineLogs:s=[]}){J(t)&&t.stepId;let c=(0,U.useMemo)(()=>{let t=new Map;for(let n of s){if(!n.stepId)continue;let r=Number(n.stepId),i=e.find(e=>e.rawRunId&&n.runId&&e.rawRunId!==n.runId?!1:e.rawStepOrder===r)?.id??n.stepId,a=t.get(i)??[];a.push(n),t.set(i,a)}return t},[s,e]);if(e.length===0)return a.length>0||o.length>0?(0,V.jsx)(_,{className:`flex-1`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(Z,{title:`Setup`,hooks:a,selection:t,onSelect:n}),(0,V.jsx)(Z,{title:`Teardown`,hooks:o,selection:t,onSelect:n})]})}):(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:`No steps were executed.`});if(r&&r.length>0&&i===`all`){let i=new Map;for(let t of e){let e=t.runId??t.id,n=i.get(e)??[];n.push(t),i.set(e,n)}let s=new Set(r.map(e=>e.id)),l=a.filter(e=>!s.has(e.runId)),u=o.filter(e=>!s.has(e.runId));return(0,V.jsx)(_,{className:`flex-1`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(Z,{title:`Setup`,hooks:l,selection:t,onSelect:n}),(0,V.jsx)(X,{title:`Steps`}),(0,V.jsx)(`ul`,{role:`tree`,"aria-label":`Test steps`,className:`py-1`,children:r.map(e=>{let r=e.id,s=i.get(r)??[],l=e.name??`Unknown Test`,u=a.filter(e=>e.runId===r),d=o.filter(e=>e.runId===r);return(0,V.jsxs)(`li`,{role:`none`,children:[(0,V.jsxs)(`div`,{className:`mt-3 mb-1 flex items-center justify-between bg-muted/30 px-3 py-1.5 text-xs font-medium text-muted-foreground first:mt-0`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:l}),(0,V.jsx)(`span`,{className:`ml-2 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground/70`,children:e.status})]}),u.length>0&&(0,V.jsx)(Z,{title:`Setup`,hooks:u,selection:t,onSelect:n}),s.length>0?(0,V.jsx)(`ul`,{role:`group`,children:s.map(e=>(0,V.jsx)(q,{step:e,isSelected:J(t)&&t.stepId===e.id,isExpanded:!0,selection:t,onSelect:n,inlineLogs:c.get(e.id)??[]},e.id))}):(0,V.jsx)(`div`,{className:`mx-2 mb-1.5 rounded-[2px] border border-border/60 bg-muted/10 px-3 py-2 text-xs text-muted-foreground`,children:e.status===`skipped`?`Skipped`:e.status===`cancelled`?`Cancelled`:`Pending`}),d.length>0&&(0,V.jsx)(Z,{title:`Teardown`,hooks:d,selection:t,onSelect:n})]},r)})}),(0,V.jsx)(Z,{title:`Teardown`,hooks:u,selection:t,onSelect:n})]})})}return(0,V.jsx)(_,{className:`flex-1`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(Z,{title:`Setup`,hooks:a,selection:t,onSelect:n}),(0,V.jsx)(X,{title:`Steps`}),(0,V.jsx)(`ul`,{role:`tree`,"aria-label":`Test steps`,className:`py-1`,children:e.map(e=>(0,V.jsx)(q,{step:e,isSelected:J(t)&&t.stepId===e.id,isExpanded:!0,selection:t,onSelect:n,inlineLogs:c.get(e.id)??[]},e.id))}),(0,V.jsx)(Z,{title:`Teardown`,hooks:o,selection:t,onSelect:n})]})})}var de=[`data:image/`,`blob:`,`http://`,`https://`];function fe(e){return e.replace(/\\/g,`/`)}function pe(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function me(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function he(e){if(de.some(t=>e.startsWith(t)))return e;let t=fe(e),n=t.split(`/`).filter(Boolean);if(n.length>=2){let e=n[n.length-1];return`/api/screenshots/${n[n.length-2]}/${e}`}return`/api/screenshots/${t}`}function ge(e,t){let n=t?.trim();if(!n)return null;if(pe(n))return n;if(me(n))return null;let r=fe(n),i=r.split(`/`).filter(Boolean);return i.length===0?null:r.startsWith(`${e}/`)?`/api/videos/${r}`:i.length===1?`/api/videos/${e}/${i[0]}`:`/api/videos/${r}`}function _e({screenshotPath:e,annotation:t,refLabel:n,className:r}){let i=(0,U.useRef)(null),[a]=(0,U.useState)(()=>Math.random().toString(36).slice(2,8)),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)({width:0,height:0}),[f,p]=(0,U.useState)({width:0,height:0}),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)({x:0,y:0}),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(!0),T=he(e);(0,U.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{for(let t of e)d({width:t.contentRect.width,height:t.contentRect.height})});return t.observe(e),()=>t.disconnect()},[]),(0,U.useEffect)(()=>{if(!b)return;let e=e=>{e.key===`Escape`&&x(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b]);let E=(0,U.useCallback)(e=>{let t=e.currentTarget;p({width:t.naturalWidth,height:t.naturalHeight}),s(!0)},[]),D=(0,U.useCallback)(e=>{let t=e.currentTarget.getBoundingClientRect();_({x:e.clientX-t.left,y:e.clientY-t.top})},[]),ne=t?.viewport?.width||f.width||1,re=t?.viewport?.height||f.height||1,A=u.width,j=u.height,M=f.width/(f.height||1),N=A/(j||1),P=A,F=j,I=0,L=0;o&&f.width>0&&(M>N?(P=A,F=A/M,L=(j-F)/2):(F=j,P=j*M,I=(A-P)/2));let R=P/ne,z=F/re,B=2.5,H=P*B,W=F*B,se=-((g.x-I)*B-150/2),ce=-((g.y-L)*B-150/2),G=g.x+20,K=g.y+20;G+150>A&&(G=g.x-150-10),K+150>j&&(K=g.y-150-10),G<0&&(G=0),K<0&&(K=0);let q=v&&m&&o;if(c)return(0,V.jsx)(`div`,{className:k(`relative rounded-lg border bg-muted/20 flex items-center justify-center`,r),style:{aspectRatio:`16 / 9`,maxHeight:`50vh`},children:(0,V.jsxs)(`div`,{className:`text-muted-foreground flex flex-col items-center gap-2`,children:[(0,V.jsx)(ie,{className:`h-8 w-8`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`Screenshot unavailable`})]})});let J=!!(t?.clickPoint||t?.boundingBox||t?.failureHighlight||t?.startPoint||t?.endPoint||t?.direction||t?.pinchScale),Y=o&&t&&S&&(0,V.jsxs)(V.Fragment,{children:[t.failureHighlight&&(0,V.jsx)(`div`,{className:`absolute border-2 border-red-500/70 rounded-sm bg-red-500/15 animate-pulse pointer-events-none`,style:{left:I+t.failureHighlight.x*R,top:L+t.failureHighlight.y*z,width:t.failureHighlight.width*R,height:t.failureHighlight.height*z}}),t.boundingBox&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`absolute border-2 border-emerald-500/70 rounded-sm bg-emerald-500/10 pointer-events-none`,style:{left:I+t.boundingBox.x*R,top:L+t.boundingBox.y*z,width:t.boundingBox.width*R,height:t.boundingBox.height*z}}),n&&(0,V.jsx)(`div`,{className:`absolute text-[10px] font-mono font-bold text-white bg-emerald-600/90 px-1 rounded-sm pointer-events-none leading-tight`,style:{left:I+t.boundingBox.x*R,top:L+t.boundingBox.y*z-14},children:n})]}),t.clickPoint&&(0,V.jsx)(`div`,{className:`absolute pointer-events-none`,style:{left:I+t.clickPoint.x*R,top:L+t.clickPoint.y*z,transform:`translate(-50%, -50%)`,zIndex:1},children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-turquoise-500 border-[1.5px] border-black/60 shadow-[0_0_0_1px_rgba(255,255,255,0.4)]`}),(0,V.jsx)(`div`,{className:`absolute rounded-full border-2 border-turquoise-500/50 animate-ping`,style:{width:22,height:22,left:-8.5,top:-8.5}})]})}),t.startPoint&&t.endPoint&&(()=>{let e=t.type===`drag`?`oklch(0.65 0.19 150)`:`oklch(0.65 0.19 210)`,n=t.type===`drag`?`oklch(0.65 0.19 150 / 0.4)`:`oklch(0.65 0.19 210 / 0.4)`,r=I+t.startPoint.x*R,i=L+t.startPoint.y*z,a=I+t.endPoint.x*R,o=L+t.endPoint.y*z;return(0,V.jsxs)(V.Fragment,{children:[Array.from({length:4},(e,t)=>{let s=(t+1)/5;return(0,V.jsx)(`div`,{className:`absolute pointer-events-none animate-gesture-trail`,style:{left:r+(a-r)*s,top:i+(o-i)*s,transform:`translate(-50%, -50%)`,zIndex:1,animationDelay:`${t*.15}s`},children:(0,V.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full`,style:{backgroundColor:n}})},`trail-${t}`)}),(0,V.jsx)(`div`,{className:`absolute pointer-events-none`,style:{left:r,top:i,transform:`translate(-50%, -50%)`,zIndex:1},children:(0,V.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full border-[1.5px] border-black/50 shadow-[0_0_0_1px_rgba(255,255,255,0.3)]`,style:{backgroundColor:e}})}),(0,V.jsx)(`div`,{className:`absolute pointer-events-none`,style:{left:a,top:o,transform:`translate(-50%, -50%)`,zIndex:1},children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-2 h-2 rounded-full border-[1.5px] border-black/50 shadow-[0_0_0_1px_rgba(255,255,255,0.3)]`,style:{backgroundColor:e}}),(0,V.jsx)(`div`,{className:`absolute rounded-full border-[1.5px] animate-ping`,style:{borderColor:n,width:18,height:18,left:-7,top:-7}})]})})]})})(),t.direction&&!t.startPoint&&(()=>{let e=t.clickPoint?I+t.clickPoint.x*R:I+P/2,n=t.clickPoint?L+t.clickPoint.y*z:L+F/2,r=Math.min(F,P)*.35,[i,o]={up:[0,-r],down:[0,r],left:[-r,0],right:[r,0]}[t.direction]||[0,0];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`svg`,{className:`absolute pointer-events-none`,style:{left:I,top:L,zIndex:1},width:P,height:F,children:[(0,V.jsxs)(`defs`,{children:[(0,V.jsx)(`marker`,{id:`scroll-arrow-border-${a}`,markerWidth:`16`,markerHeight:`14`,refX:`14`,refY:`7`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,V.jsx)(`path`,{d:`M1 1 L14 7 L1 13`,fill:`none`,stroke:`oklch(0 0 0 / 0.5)`,strokeWidth:`3`,strokeLinejoin:`round`,strokeLinecap:`round`})}),(0,V.jsx)(`marker`,{id:`scroll-arrow-${a}`,markerWidth:`16`,markerHeight:`14`,refX:`14`,refY:`7`,orient:`auto`,markerUnits:`userSpaceOnUse`,children:(0,V.jsx)(`path`,{d:`M1 1 L14 7 L1 13`,fill:`none`,stroke:`oklch(0.719 0.119 209.8)`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`})})]}),(0,V.jsx)(`line`,{x1:e-I,y1:n-L,x2:e-I+i,y2:n-L+o,stroke:`oklch(0 0 0 / 0.5)`,strokeWidth:4,strokeLinecap:`round`,markerEnd:`url(#scroll-arrow-border-${a})`}),(0,V.jsx)(`line`,{x1:e-I,y1:n-L,x2:e-I+i,y2:n-L+o,stroke:`oklch(0.719 0.119 209.8 / 0.8)`,strokeWidth:2.5,strokeLinecap:`round`,markerEnd:`url(#scroll-arrow-${a})`})]}),(0,V.jsx)(`div`,{className:`absolute pointer-events-none`,style:{left:e,top:n,transform:`translate(-50%, -50%)`,zIndex:2},children:(0,V.jsxs)(`div`,{className:`relative flex items-center justify-center`,style:{width:22,height:22},children:[(0,V.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-turquoise-500 border-[1.5px] border-black/60 shadow-[0_0_0_1px_rgba(255,255,255,0.4)]`}),(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-turquoise-500/50 animate-ping`})]})})]})})(),t.pinchScale&&(()=>{let e=t.startPoint?I+t.startPoint.x*R:I+P/2,n=t.startPoint?L+t.startPoint.y*z:L+F/2,r=t.pinchScale===`out`?`animate-gesture-pinch-out`:`animate-gesture-pinch-in`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`absolute pointer-events-none ${r}`,style:{left:e-24,top:n,transform:`translate(-50%, -50%)`,zIndex:1},children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-turquoise-500 border-[1.5px] border-black/50 shadow-[0_0_0_1px_rgba(255,255,255,0.3)]`}),(0,V.jsx)(`div`,{className:`absolute rounded-full border-[1.5px] border-turquoise-500/40 animate-ping`,style:{width:18,height:18,left:-6.5,top:-6.5}})]})}),(0,V.jsx)(`div`,{className:`absolute pointer-events-none ${r}`,style:{left:e+24,top:n,transform:`translate(-50%, -50%)`,zIndex:1,animationDirection:`reverse`},children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-turquoise-500 border-[1.5px] border-black/50 shadow-[0_0_0_1px_rgba(255,255,255,0.3)]`}),(0,V.jsx)(`div`,{className:`absolute rounded-full border-[1.5px] border-turquoise-500/40 animate-ping`,style:{width:18,height:18,left:-6.5,top:-6.5}})]})})]})})()]});return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:i,className:k(`relative overflow-hidden rounded-lg border bg-muted/20 group w-full`,r),style:{aspectRatio:o&&f.width>0?`${f.width} / ${f.height}`:`16 / 9`,maxHeight:`50vh`},onMouseMove:v?D:void 0,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[!o&&(0,V.jsx)(O,{className:`absolute inset-0 rounded-lg`}),(0,V.jsx)(`img`,{src:T,alt:`Step screenshot`,className:k(`w-full h-full object-contain`,!o&&`opacity-0`),onLoad:E,onError:()=>l(!0)}),Y,q&&(0,V.jsx)(`div`,{className:`absolute rounded-full border-2 border-primary/50 shadow-lg pointer-events-none z-10`,style:{width:150,height:150,left:G,top:K,backgroundImage:`url(${T})`,backgroundSize:`${H}px ${W}px`,backgroundPosition:`${se}px ${ce}px`,backgroundRepeat:`no-repeat`}}),o&&(0,V.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-20`,children:[J&&(0,V.jsx)(w,{variant:`secondary`,size:`icon-sm`,className:`h-7 w-7 bg-background/80 backdrop-blur-sm`,onClick:e=>{e.stopPropagation(),C(!S)},title:S?`Hide annotations`:`Show annotations`,children:(0,V.jsx)(ae,{className:k(`h-3.5 w-3.5`,S&&`text-primary`)})}),(0,V.jsx)(w,{variant:`secondary`,size:`icon-sm`,className:`h-7 w-7 bg-background/80 backdrop-blur-sm`,onClick:e=>{e.stopPropagation(),y(!v)},title:v?`Disable magnifier`:`Enable magnifier`,children:(0,V.jsx)(ee,{className:k(`h-3.5 w-3.5`,v&&`text-primary`)})}),(0,V.jsx)(w,{variant:`secondary`,size:`icon-sm`,className:`h-7 w-7 bg-background/80 backdrop-blur-sm`,onClick:e=>{e.stopPropagation(),x(!0)},title:`View full size`,children:(0,V.jsx)(oe,{className:`h-3.5 w-3.5`})})]})]}),b&&(0,V.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center`,onClick:()=>x(!1),children:[(0,V.jsx)(w,{variant:`secondary`,size:`icon-sm`,className:`absolute top-4 right-4 h-8 w-8 bg-background/80 backdrop-blur-sm z-10`,onClick:()=>x(!1),children:(0,V.jsx)(te,{className:`h-4 w-4`})}),(0,V.jsx)(`img`,{src:T,alt:`Step screenshot (full size)`,className:`object-contain rounded-lg`,style:{maxWidth:`90vw`,maxHeight:`90vh`},onClick:e=>e.stopPropagation()})]})]})}var ve=`rounded-sm border border-border/60 bg-muted/20 p-1`,ye=`rounded-sm px-3 py-1 text-xs font-medium transition-colors`,be=`bg-primary/10 text-foreground ring-1 ring-primary/30`,xe=`text-muted-foreground hover:bg-muted hover:text-foreground`;function Se(e){if(!e)return null;try{let t=typeof e==`string`?JSON.parse(e):e;if(t&&typeof t==`object`)return{type:t.type||t.action||`unknown`,target:t.target||t.selector||``}}catch{return{type:String(e),target:``}}return null}function Ce(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:d,content:e.observation,duration:e.phaseDurations?.observe??null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:e.phaseDurations?.plan??null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:E,content:null,duration:e.phaseDurations?.execute??null,children:(0,V.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),e.verifierReasoning&&t.push({key:`verifier`,label:`Verifier`,icon:s,content:e.verifierReasoning,duration:e.phaseDurations?.verify??null}),t}function we(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:d,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:E,content:null,duration:null,children:(0,V.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}function Te({step:e,subAction:n,runId:i,screenshotSide:a,onScreenshotSideChange:o,pipelineRef:s}){let c=(e.subActionsData?.length??0)>1;if(n){let e=n.screenshotBeforePath,t=n.screenshotAfterPath;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(De,{beforePath:e??null,afterPath:t??null,annotation:n.annotation,refLabel:n.plannedAction&&typeof n.plannedAction==`object`&&n.plannedAction!==null&&`ref`in n.plannedAction?n.plannedAction.ref:void 0,screenContextBefore:n.screenContextBefore,screenContextAfter:n.screenContextAfter,screenshotSide:a,onScreenshotSideChange:o}),(0,V.jsx)(`div`,{className:`border-t`,children:(0,V.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsxs)(`span`,{className:`font-medium`,children:[`Sub-action #`,n.index+1]}),(0,V.jsx)(`span`,{className:`text-xs font-medium ${n.result===`success`?`text-emerald-500`:`text-red-500`}`,children:n.result}),n.confidence!=null&&(0,V.jsxs)(`span`,{className:`text-xs ${n.confidence>=.8?`text-emerald-500`:n.confidence>=.5?`text-amber-500`:`text-red-500`}`,children:[Math.round(n.confidence*100),`%`]})]}),(0,V.jsx)(r,{ref:s,mode:`static`,sections:Ce(n)}),n.error&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Error`}),(0,V.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:n.error})]})]})})]})}let l=e.screenshotBeforePath,u=e.screenshotPath,d=c?null:e.annotationData,f=c?void 0:e.action&&typeof e.action==`object`&&e.action!==null&&`ref`in e.action?e.action.ref:void 0,p=Se(e.action);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(De,{beforePath:l,afterPath:u,annotation:d,refLabel:f,screenContextBefore:e.screenContextBefore,screenContextAfter:e.screenContextAfter,screenshotSide:a,onScreenshotSideChange:o}),(0,V.jsx)(`div`,{className:`border-t`,children:(0,V.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[i?(0,V.jsx)(r,{ref:s,runId:i,stepOrder:e.rawStepOrder,stepData:e}):(0,V.jsx)(r,{ref:s,mode:`static`,sections:we(e)}),p&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Action`}),(0,V.jsxs)(`p`,{className:`text-sm`,children:[p.type,p.target&&(0,V.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:p.target})]})]}),e.plannedAction!=null&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Planned Action`}),(0,V.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,style:{maxHeight:`12rem`},children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})]}),e.error&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Error`}),(0,V.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-sm break-words [overflow-wrap:anywhere]`,children:e.error})]}),e.healingAttempts&&e.healingAttempts.length>0&&(0,V.jsx)(t,{attempts:e.healingAttempts})]})})]})}function Ee({url:e}){let[t,n]=(0,U.useState)(!1);return e?(0,V.jsxs)(`div`,{className:`w-0 flex-1 flex items-center gap-1`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-w-0 overflow-hidden bg-muted/50 rounded-sm px-2 py-0.5 text-xs font-mono truncate text-muted-foreground`,children:e}),(0,V.jsxs)(g,{children:[(0,V.jsx)(h,{asChild:!0,children:(0,V.jsx)(`button`,{className:`shrink-0 p-1 rounded-sm hover:bg-muted transition-colors`,children:(0,V.jsx)(R,{className:`h-3 w-3 text-muted-foreground`})})}),(0,V.jsx)(m,{align:`end`,className:`w-auto max-w-md p-3`,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-xs font-mono break-all select-text`,children:e}),(0,V.jsxs)(`button`,{onClick:()=>{navigator.clipboard.writeText(e).catch(()=>{}),n(!0),setTimeout(()=>n(!1),2e3)},className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[t?(0,V.jsx)(c,{className:`h-3 w-3`}):(0,V.jsx)(u,{className:`h-3 w-3`}),t?`Copied`:`Copy URL`]})]})})]})]}):null}function De({beforePath:e,afterPath:t,annotation:n,refLabel:r,screenContextBefore:i,screenContextAfter:a,screenshotSide:o,onScreenshotSideChange:s}){let c=!!e,l=!!t,u=c?`before`:`after`,[d,f]=(0,U.useState)(u);(0,U.useEffect)(()=>{f(u)},[e,t,u]);let p=o??d,m=p===`before`&&c?`before`:p===`after`&&l?`after`:u,h=e=>{if(!(e===`before`&&!c)&&!(e===`after`&&!l)){if(s){s(e);return}f(e)}};return!c&&!l?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground gap-2 py-12`,children:[(0,V.jsx)(ie,{className:`h-8 w-8`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`No screenshot for this step`})]}):(0,V.jsxs)(`div`,{className:`p-3 space-y-2 min-w-0`,children:[c&&l&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex gap-1 shrink-0 ${ve}`,children:[(0,V.jsx)(`button`,{onClick:()=>h(`before`),className:`${ye} ${m===`before`?be:xe}`,children:`Before`}),(0,V.jsx)(`button`,{onClick:()=>h(`after`),className:`${ye} ${m===`after`?be:xe}`,children:`After`})]}),(i||a)&&(0,V.jsx)(Ee,{url:m===`before`?i:a})]}),m===`before`&&c&&(0,V.jsx)(_e,{screenshotPath:e,annotation:n,refLabel:r,className:`w-full rounded-sm overflow-hidden`}),m===`after`&&l&&(0,V.jsx)(_e,{screenshotPath:t,annotation:c?null:n,refLabel:c?void 0:r,className:`w-full rounded-sm overflow-hidden`})]})}var Oe=`rounded-sm border border-border/60 bg-muted/20 p-1`,Q=`rounded-sm px-3 py-1 text-xs font-medium transition-colors`,ke=`bg-primary/10 text-foreground ring-1 ring-primary/30`,Ae=`text-muted-foreground hover:bg-muted hover:text-foreground`;function je({step:e,subAction:t,runId:n}){let[r,i]=(0,U.useState)(`before`);if(t){let e=t.screenStateBefore,n=t.screenStateAfter;return!e&&!n?(0,V.jsx)(Pe,{}):(0,V.jsx)(Ne,{before:e??null,after:n??null,tab:r,setTab:i})}return(0,V.jsx)(Me,{step:e,runId:n,tab:r,setTab:i})}function Me({step:e,runId:t,tab:n,setTab:r}){let[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!0);return(0,U.useEffect)(()=>{let n=!1;return l(!0),F(t,e.rawStepOrder).then(e=>{n||(a(e.trace.screenStateBefore),s(e.trace.screenStateAfter),l(!1))}).catch(()=>{n||l(!1)}),()=>{n=!0}},[t,e.rawStepOrder]),c?(0,V.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,V.jsx)(O,{className:`h-4 w-3/4`}),(0,V.jsx)(O,{className:`h-4 w-1/2`}),(0,V.jsx)(O,{className:`h-4 w-2/3`})]}):!i&&!o?(0,V.jsx)(Pe,{}):(0,V.jsx)(Ne,{before:i,after:o,tab:n,setTab:r})}function Ne({before:e,after:t,tab:n,setTab:r}){let i=!!e,a=!!t;return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-2 overflow-hidden p-3`,children:[i&&a&&(0,V.jsxs)(`div`,{className:`flex gap-1 ${Oe}`,children:[(0,V.jsx)(`button`,{onClick:()=>r(`before`),className:`${Q} ${n===`before`?ke:Ae}`,children:`Before`}),(0,V.jsx)(`button`,{onClick:()=>r(`after`),className:`${Q} ${n===`after`?ke:Ae}`,children:`After`})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-sm border border-border/60 bg-muted/20`,children:(0,V.jsx)(`div`,{className:`h-full overflow-auto overscroll-contain`,children:(0,V.jsx)(`pre`,{className:`min-w-full p-3 text-xs font-mono whitespace-pre`,children:n===`before`&&i?e:a?t:e})})})]})}function Pe(){return(0,V.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:`No ARIA tree snapshot available for this step`})}function Fe(e){switch(e){case`critical`:return`bg-red-500/15 text-red-500 border-red-500/20`;case`serious`:return`bg-orange-500/15 text-orange-500 border-orange-500/20`;case`moderate`:return`bg-amber-500/15 text-amber-500 border-amber-500/20`;case`minor`:return`bg-blue-500/15 text-blue-500 border-blue-500/20`;default:return`bg-muted text-muted-foreground`}}function Ie({step:e}){let t=e.accessibilityViolations;return!t||t.length===0?(0,V.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:`No accessibility violations detected`}):(0,V.jsx)(`div`,{className:`p-3 space-y-3`,children:t.map((e,t)=>(0,V.jsxs)(`div`,{className:`border border-border/50 rounded-sm p-3 space-y-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(I,{className:k(`text-[10px] px-1.5 py-0`,Fe(e.impact)),children:e.impact}),(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:e.help})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),e.nodes.length>0&&(0,V.jsx)(`div`,{className:`space-y-1 mt-1`,children:e.nodes.map((e,t)=>(0,V.jsx)(`pre`,{className:`text-[10px] font-mono bg-muted/30 rounded p-1.5 overflow-x-auto whitespace-pre-wrap break-words`,children:e.html},t))}),(0,V.jsx)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-[10px] text-blue-500 hover:underline`,children:`Learn more`})]},t))})}function Le({activeTab:e,onTabChange:t,step:n,subAction:r,runId:s,allSteps:c,executionLogs:l=[],platform:u,screenshotSide:d,onScreenshotSideChange:f,pipelineRef:p}){let m=l.length>0,h=(0,U.useRef)(null),g=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(e!==`console`&&e!==`network`)return;let t=e===`console`?h:g;requestAnimationFrame(()=>{let e=t.current?.querySelector(`[data-slot="scroll-area-viewport"]`);e&&(e.scrollTop=e.scrollHeight)})},[e,n?.id]),n?(0,V.jsxs)(x,{value:e,onValueChange:t,className:`flex h-full min-h-0 flex-col overflow-hidden gap-0`,children:[(0,V.jsxs)(b,{variant:`line`,className:`w-full justify-start border-b px-3 h-9 shrink-0 rounded-none`,children:[(0,V.jsx)(v,{value:`overview`,className:`text-xs rounded-none flex-initial`,children:`Overview`}),(0,V.jsx)(v,{value:`env`,className:`text-xs rounded-none flex-initial`,children:`Variables`}),(0,V.jsx)(v,{value:`network`,className:`text-xs rounded-none flex-initial`,children:`Network`}),(0,V.jsx)(v,{value:`console`,className:`text-xs rounded-none flex-initial`,children:m?`stdout`:`Console`}),(0,V.jsx)(v,{value:`aria`,className:`text-xs rounded-none flex-initial`,children:`ARIA Tree`}),(0,V.jsx)(v,{value:`a11y`,className:`text-xs rounded-none flex-initial`,children:`A11y`})]}),(0,V.jsx)(y,{value:`overview`,className:`flex-1 min-h-0`,children:(0,V.jsx)(_,{className:`h-full`,children:(0,V.jsx)(Te,{step:n,subAction:r,runId:s,screenshotSide:d,onScreenshotSideChange:f,pipelineRef:p})})}),(0,V.jsx)(y,{value:`env`,className:`flex-1 min-h-0`,children:(0,V.jsx)(_,{className:`h-full`,children:(0,V.jsx)(a,{step:n,executionLogs:l})})}),(0,V.jsx)(y,{value:`network`,className:`flex-1 min-h-0`,children:(0,V.jsx)(`div`,{ref:g,className:`h-full`,children:(0,V.jsx)(_,{className:`h-full`,children:(0,V.jsx)(i,{step:n,allSteps:c,platform:u})})})}),(0,V.jsx)(y,{value:`console`,className:`flex-1 min-h-0`,children:(0,V.jsx)(`div`,{ref:h,className:`h-full`,children:(0,V.jsx)(_,{className:`h-full`,children:(0,V.jsx)(o,{step:n,allSteps:c,executionLogs:l,isHookStep:m})})})}),(0,V.jsx)(y,{value:`aria`,className:`flex flex-1 min-h-0 overflow-hidden`,children:(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(je,{step:n,subAction:r,runId:s??``})})}),(0,V.jsx)(y,{value:`a11y`,className:`flex-1 min-h-0`,children:(0,V.jsx)(_,{className:`h-full`,children:(0,V.jsx)(Ie,{step:n})})})]}):(0,V.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`Select a step to view details`})}var $=`/favicon.svg`,Re=`link[rel="icon"][type="image/svg+xml"]`,ze=`data:image/svg+xml,`,Be=`#1BA8A4`,Ve={running:`#3B82F6`,passed:`#10B981`,failed:`#EF4444`,cancelled:`#737373`},He=`M323.737 74.0036C321.678 45.7468 307.367 20.4603 274.355 7.62753C237.635 -6.64743 193.906 0.707226 159.595 16.555C123.709 33.1301 79.4877 66.4329 68.7041 107.674C64.4889 123.793 65.8966 141.625 74.0475 156.147C84.524 174.812 105.284 186.34 126.509 188.709C155.758 191.973 186.212 179.951 208.798 161.766C221.672 151.401 233.416 137.876 240.032 122.593C245.968 108.883 247.372 92.6358 241.051 79.1C232.452 60.686 212.101 52.6385 192.81 55.6667C190.276 56.0569 187.867 56.6097 185.58 57.2681C183.292 57.9233 181.123 58.6816 179.071 59.528C174.96 61.1995 171.314 63.2018 168.074 65.329C164.839 67.4688 162.013 69.7616 159.591 72.0974C159.042 72.6512 158.503 73.1949 157.975 73.728C157.403 74.2983 156.905 74.8399 156.405 75.3741C155.412 76.4424 154.506 77.4954 153.649 78.4973C151.95 80.5145 150.496 82.3772 149.251 84.0721C146.746 87.4439 144.991 90.0845 143.806 91.8622C143.224 92.7564 142.783 93.4344 142.486 93.889C142.195 94.3472 142.047 94.5798 142.047 94.5798C141.56 95.3492 141.534 96.3676 142.066 97.1784C142.789 98.2807 144.267 98.5866 145.366 97.8607C145.366 97.8607 145.595 97.7094 146.048 97.4115C146.496 97.1104 147.164 96.6612 148.045 96.0686C149.796 94.8803 152.379 93.101 155.711 90.89C159.064 88.6975 163.129 86.0856 168.019 83.6181C169.17 83.0505 170.364 82.5052 171.643 82.0103C172.913 81.508 174.233 81.0227 175.625 80.6096C178.393 79.7611 181.387 79.0894 184.521 78.7039C186.088 78.517 187.686 78.3869 189.3 78.3476C190.915 78.312 192.544 78.3635 194.161 78.5064C199.857 79.0389 206.946 80.8278 210.393 85.7883C212.64 89.023 212.942 93.2873 212.188 97.1561C210.88 103.87 206.746 109.679 202.191 114.771C186.162 132.688 162.952 145.008 138.913 147.011C118.893 148.576 100.226 139.353 97.5544 117.418C95.6448 101.742 102.982 86.1918 113.092 74.0838C127.362 56.9936 145.131 42.6953 165.374 33.7232C172.833 30.4168 180.568 27.6382 188.491 25.5933C209.564 20.1131 234.474 18.5074 254.87 27.3737C274.418 35.8716 286.877 55.0613 286.483 76.4807C286.365 82.7505 285.206 89.1452 283.246 95.5313C281.308 101.923 278.484 108.284 275.041 114.413C271.579 120.542 267.503 126.447 262.989 132.001C240.471 159.732 205.211 180.858 172.707 194.714C133.472 211.439 58.5315 231.21 30.5129 185.239C15.9075 161.276 21.2651 130.621 29.1883 105.347C29.4747 104.433 29.1915 103.391 28.3958 102.763C27.3676 101.951 25.8789 102.129 25.07 103.16C25.07 103.16 24.3939 104.021 23.0836 105.69C22.7533 106.097 22.4023 106.602 22.0042 107.145C21.6092 107.69 21.1767 108.288 20.7066 108.937C9.05634 125.023 1.26869 144.477 0.139985 164.406C-0.898721 182.75 3.84163 201.559 14.4087 216.568C27.0823 234.568 47.3503 246.191 68.6072 251.765C102.301 260.599 139.556 257.617 172.626 247.578C180.417 245.213 188.18 242.456 195.864 239.289C203.543 236.112 211.124 232.493 218.604 228.502C245.711 214.042 271.483 194.467 290.821 170.385C311.713 144.368 326.151 107.143 323.737 74.0036Z`;function Ue(){let e=document.querySelector(Re);if(e)return e;let t=document.createElement(`link`);return t.setAttribute(`rel`,`icon`),t.setAttribute(`type`,`image/svg+xml`),t.setAttribute(`href`,$),document.head.appendChild(t),t}function We(e){return e===`failed`?`<path d="M208 142L310 244M310 142L208 244" stroke="#EF4444" stroke-width="26" stroke-linecap="round"/>`:`<circle cx="258" cy="192" r="61" fill="${Ve[e]}"/>`}function Ge(e){switch(M(e)){case`running`:case`pending`:case`queued`:return`running`;case`passed`:case`flaky`:case`healed`:return`passed`;case`failed`:case`timeout`:return`failed`;case`cancelled`:return`cancelled`;case`skipped`:case`unknown`:return`default`}}function Ke(e){if(e===`default`)return $;let t=[`<svg width="324" height="257" viewBox="0 0 324 257" fill="none" xmlns="http://www.w3.org/2000/svg">`,`<path d="${He}" fill="${Be}"/>`,We(e),`</svg>`].join(``);return`${ze}${encodeURIComponent(t)}`}function qe(e){(0,U.useEffect)(()=>(Ue().setAttribute(`href`,Ke(e)),()=>{Ue().setAttribute(`href`,$)}),[e])}export{ue as a,H as c,ge as i,R as l,qe as n,J as o,Le as r,Y as s,Ge as t};