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

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 (97) hide show
  1. package/dist/assets/{arrow-up-down-D_ErIdrE.js → arrow-up-down-CwmMJuHC.js} +1 -1
  2. package/dist/assets/{badge-ClWCtaXi.js → badge-D56AWxFv.js} +1 -1
  3. package/dist/assets/{batch-action-bar-BoqzHfwU.js → batch-action-bar-DI05CPwy.js} +1 -1
  4. package/dist/assets/{circle-alert-D7wbtVU2.js → circle-alert-RZI0g_tD.js} +1 -1
  5. package/dist/assets/{circle-x-BOV-jCVR.js → circle-x-CcGlHxRU.js} +1 -1
  6. package/dist/assets/config-BafxmOwJ.js +10 -0
  7. package/dist/assets/{copy-DW4nc-pA.js → copy-CWpai22Y.js} +1 -1
  8. package/dist/assets/{display-step-vpHdm2LX.js → display-step-nrAd20yH.js} +1 -1
  9. package/dist/assets/{dist-BsGrTrYb.js → dist-CyWxUoCv.js} +1 -1
  10. package/dist/assets/{dist-BABsMbMt.js → dist-DaacWHUX.js} +1 -1
  11. package/dist/assets/dist-itgTE_D5.js +1 -0
  12. package/dist/assets/{empty-state-BTFWlITi.js → empty-state-DEbHhF9f.js} +1 -1
  13. package/dist/assets/{external-link-CnabSkqe.js → external-link-xaS9gsyo.js} +1 -1
  14. package/dist/assets/{eye-Cj7s1eMQ.js → eye-BmHDIr7J.js} +1 -1
  15. package/dist/assets/{file-code-DxVUPin2.js → file-code-B22xRpxi.js} +1 -1
  16. package/dist/assets/{file-search-BRbGARSr.js → file-search-CeDGqauF.js} +1 -1
  17. package/dist/assets/filename-validation-Dabe2ngK.js +1 -0
  18. package/dist/assets/{grip-vertical-C5AW4fiD.js → grip-vertical-CJUfU7Zx.js} +1 -1
  19. package/dist/assets/{hook-editor-KoqKvv73.js → hook-editor-CmPzPqnr.js} +1 -1
  20. package/dist/assets/{hook-runtime-DZ6bR69q.js → hook-runtime-D7L2zX15.js} +1 -1
  21. package/dist/assets/{hook-viewer-DWsN8RyZ.js → hook-viewer-BvNgWI6w.js} +1 -1
  22. package/dist/assets/hooks-C1lVbVNu.js +1 -0
  23. package/dist/assets/{id-badge-BpTnHwvn.js → id-badge-DO71VWC9.js} +2 -2
  24. package/dist/assets/index-B5JVEaaS.css +2 -0
  25. package/dist/assets/index-C_HfATr4.js +57 -0
  26. package/dist/assets/{insights-Dtq5Rwby.js → insights-EjXDNx86.js} +1 -1
  27. package/dist/assets/{insights-line-grid-X5lNbmTY.js → insights-line-grid-CJdb529A.js} +6 -6
  28. package/dist/assets/{lib-u_ZEFKZp.js → lib-hhwTCYTD.js} +1 -1
  29. package/dist/assets/live-run-CnQOMMWG.js +1 -0
  30. package/dist/assets/{memory-DS-02aNZ.js → memory-BSLWD6RW.js} +1 -1
  31. package/dist/assets/{memory-product-5m-eyxzH.js → memory-product-0B7_AV3X.js} +2 -2
  32. package/dist/assets/{monaco-editor-BEWq4fzI.js → monaco-editor-BYBlJAjA.js} +2 -2
  33. package/dist/assets/{monaco-editor-inner-B6AQm3h7.js → monaco-editor-inner-C0PbrlIr.js} +2 -2
  34. package/dist/assets/{monaco.contribution-Dum2B1vn.js → monaco.contribution-Bq7keHQp.js} +2 -2
  35. package/dist/assets/{observation-block-2qfTbm41.js → observation-block-DvMkTmgC.js} +1 -1
  36. package/dist/assets/observation-markdown-Bgcyet5t.js +1 -0
  37. package/dist/assets/{pencil-BUQgVaEH.js → pencil-Dga__f-A.js} +1 -1
  38. package/dist/assets/plus-BhWnvE6F.js +1 -0
  39. package/dist/assets/popover-Boe1excX.js +1 -0
  40. package/dist/assets/{refresh-cw-D0OwRzvm.js → refresh-cw-Dhidp9m2.js} +1 -1
  41. package/dist/assets/{resizable-ugU12HrY.js → resizable-o8j3Lihm.js} +1 -1
  42. package/dist/assets/run-detail-CPo5ENE6.js +1 -0
  43. package/dist/assets/runs-CvH2p_Ks.js +1 -0
  44. package/dist/assets/{scroll-area-CX3T8JWh.js → scroll-area-B8cRs7wd.js} +1 -1
  45. package/dist/assets/select-BE8tKMJy.js +1 -0
  46. package/dist/assets/{shortcut-hints-B8kCurzo.js → shortcut-hints-BGIo5sip.js} +1 -1
  47. package/dist/assets/split-button-CcR2TDPY.js +1 -0
  48. package/dist/assets/square-8TpalBCd.js +1 -0
  49. package/dist/assets/{step-name-pills-BQ8yv40K.js → step-name-pills-0sDNmrmn.js} +1 -1
  50. package/dist/assets/suite-editor-BUzpsLUR.js +5 -0
  51. package/dist/assets/suite-navbar-COFDYHho.js +1 -0
  52. package/dist/assets/{suite-viewer-CmbLH1G2.js → suite-viewer-B62crjkX.js} +1 -1
  53. package/dist/assets/suites-vH7UvBPg.js +1 -0
  54. package/dist/assets/{switch-Dv7aVqt1.js → switch-A6NW_YxI.js} +1 -1
  55. package/dist/assets/tab-console-BXF3HNpW.js +1 -0
  56. package/dist/assets/{table-BOjrxBBL.js → table-D4kdbpq8.js} +1 -1
  57. package/dist/assets/{tabs-BEp-p5jh.js → tabs-C3NqUdx9.js} +1 -1
  58. package/dist/assets/test-editor-BnD3gcCG.js +9 -0
  59. package/dist/assets/test-navbar-ZDxlwtJH.js +7 -0
  60. package/dist/assets/{test-viewer-DEQQDURn.js → test-viewer-B-G8G6FH.js} +1 -1
  61. package/dist/assets/tests-BcPHa9Nc.js +1 -0
  62. package/dist/assets/{tests-suites-table-widths-D2sc1JmR.js → tests-suites-table-widths-CPWjMEBc.js} +1 -1
  63. package/dist/assets/{textarea-BFsDx2mB.js → textarea-87HpNno6.js} +1 -1
  64. package/dist/assets/{trash-2-Dv939XWG.js → trash-2-sbLDCPlz.js} +1 -1
  65. package/dist/assets/{tsMode-CnaplBFQ.js → tsMode-BHB8FsID.js} +1 -1
  66. package/dist/assets/{use-hook-run-session-BLSTM6LJ.js → use-hook-run-session-n1RKgcn6.js} +1 -1
  67. package/dist/assets/{use-keyboard-shortcuts-COnAPsDD.js → use-keyboard-shortcuts-BM0qq0DE.js} +1 -1
  68. package/dist/assets/{use-page-title-CsUoFrfG.js → use-page-title-CyHzJAcR.js} +1 -1
  69. package/dist/assets/use-run-status-favicon-DTTz9_8q.js +1 -0
  70. package/dist/assets/{use-selection-queue-BkEWIfvw.js → use-selection-queue-CIpsCzay.js} +1 -1
  71. package/dist/assets/{viewer-url-state-PwkMc-qK.js → viewer-url-state-BgjmiiI7.js} +1 -1
  72. package/dist/assets/{zap-Dx2CqraS.js → zap-DwOV0Yov.js} +1 -1
  73. package/dist/index.html +2 -2
  74. package/package.json +2 -2
  75. package/dist/assets/config-BH2rUSDL.js +0 -10
  76. package/dist/assets/dist-Bc4r79ls.js +0 -1
  77. package/dist/assets/filename-validation-wKCpNal3.js +0 -1
  78. package/dist/assets/hooks-BfUXcuyV.js +0 -1
  79. package/dist/assets/index-C3AdCkmj.js +0 -57
  80. package/dist/assets/index-DzWZqTlZ.css +0 -2
  81. package/dist/assets/live-run-CfMxOSfk.js +0 -1
  82. package/dist/assets/observation-markdown-CIs-5TY2.js +0 -1
  83. package/dist/assets/plus-Bf5Mbita.js +0 -1
  84. package/dist/assets/popover-OAiTzjiL.js +0 -1
  85. package/dist/assets/run-detail-Cr984qgU.js +0 -1
  86. package/dist/assets/runs-CDAIeUbq.js +0 -1
  87. package/dist/assets/select-D0GpDfUa.js +0 -1
  88. package/dist/assets/split-button-CRYV8xU8.js +0 -1
  89. package/dist/assets/square-K8N8Yius.js +0 -1
  90. package/dist/assets/suite-editor-aAjvjp2R.js +0 -5
  91. package/dist/assets/suite-navbar-UATCw4Qb.js +0 -1
  92. package/dist/assets/suites-BlJfefzt.js +0 -1
  93. package/dist/assets/tab-console-Ciur_Bee.js +0 -1
  94. package/dist/assets/test-editor-CFzp3eq1.js +0 -9
  95. package/dist/assets/test-navbar-ChNg-qki.js +0 -7
  96. package/dist/assets/tests-Dzlh9Zho.js +0 -1
  97. package/dist/assets/use-run-status-favicon-DLOLF3Hx.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./arrow-up-down-D_ErIdrE.js";import{i as n,l as r,n as i,o as a,s as o,t as s}from"./select-D0GpDfUa.js";import{n as c}from"./split-button-CRYV8xU8.js";import{n as l,r as u}from"./shortcut-hints-B8kCurzo.js";import{t as d}from"./plus-Bf5Mbita.js";import{t as f}from"./trash-2-Dv939XWG.js";import{t as p}from"./use-page-title-CsUoFrfG.js";import{n as m,t as h}from"./batch-action-bar-BoqzHfwU.js";import{n as g,r as _,t as v}from"./popover-OAiTzjiL.js";import{n as y,t as b}from"./scroll-area-CX3T8JWh.js";import{i as x,r as ee,t as te}from"./tabs-BEp-p5jh.js";import{$n as ne,Ct as re,Ft as ie,Gn as ae,Gt as S,Jt as oe,Kt as se,L as C,Ln as w,Mt as ce,Nt as le,Pn as ue,Pt as de,Q as fe,Ut as pe,Wt as T,Yt as E,_t as me,a as D,dr as O,er as he,j as ge,jt as k,lr as _e,mr as A,nr as j,nt as M,qt as ve,rr as ye,rt as N,tt as P,zn as be}from"./index-C3AdCkmj.js";import{t as F}from"./badge-ClWCtaXi.js";import{n as I,o as xe,r as Se,t as L}from"./lib-u_ZEFKZp.js";import{a as Ce,i as R,n as z,o as B,r as V,t as we}from"./table-BOjrxBBL.js";import{t as Te}from"./empty-state-BTFWlITi.js";import{t as Ee}from"./use-keyboard-shortcuts-COnAPsDD.js";import{n as De,t as Oe}from"./use-selection-queue-BkEWIfvw.js";var H=e(A(),1),U=ne();function ke({startedAt:e}){let[t,n]=(0,H.useState)(()=>{let t=new Date(E(e)).getTime();return Math.max(0,Math.floor((Date.now()-t)/1e3))});return(0,H.useEffect)(()=>{let t=new Date(E(e)).getTime(),r=setInterval(()=>{n(Math.max(0,Math.floor((Date.now()-t)/1e3)))},1e3);return()=>clearInterval(r)},[e]),(0,U.jsxs)(`span`,{className:`text-blue-500 tabular-nums`,children:[Math.floor(t/60),`m `,t%60,`s`]})}var W={select:`44px`,status:`136px`,target:`180px`,attributes:`260px`,duration:`104px`,createdAt:`128px`},G=[`agent-qa.trigger`,`agent-qa.runner`];function K(e){return e===`ios`?`iOS`:e.charAt(0).toUpperCase()+e.slice(1)}function Ae(e){return`${e.targetName?.trim()||`No target`} (${K(e.platform)})`}function je(e){return e.suiteId!=null&&e.parentRunId==null}function q(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=new Map(G.map((e,t)=>[e,t]));return Object.entries(e??{}).filter(([,e])=>typeof e==`string`).sort(([e],[t])=>{let i=n.get(e),a=n.get(t);if(i!==void 0||a!==void 0)return(i??2**53-1)-(a??2**53-1);let o=r.get(e),s=r.get(t);return o!==void 0||s!==void 0?(o??2**53-1)-(s??2**53-1):e.localeCompare(t)})}function J({attributes:e,activeKeys:t}){let n=q(e,t);if(n.length===0)return(0,U.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`No attributes`});let r=n.length>2?1:2,i=n.slice(0,r),a=n.length-i.length;return(0,U.jsxs)(ce,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`max-h-[38px] overflow-hidden text-[12px] leading-[18px]`,"aria-label":n.map(([e,t])=>`${e}=${t}`).join(`, `),children:[i.map(([e,t])=>(0,U.jsxs)(`div`,{className:`min-w-0 truncate font-mono`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`=`]}),(0,U.jsx)(`span`,{className:`text-foreground`,children:t})]},e)),a>0?(0,U.jsxs)(`div`,{className:`font-mono text-[11px] text-muted-foreground`,children:[`+`,a,` more`]}):null]})}),(0,U.jsx)(le,{side:`top`,align:`start`,className:`max-w-[420px] p-2`,children:(0,U.jsx)(`div`,{className:`max-h-64 overflow-auto font-mono text-[11px] leading-5`,children:n.map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`truncate text-foreground`,children:t})]},e))})})]})}function Y(e){return e.mode===`regex`?`${e.key} matches ${e.value}`:`${e.key} = ${e.value}`}function Me({predicates:e,onChange:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(`exact`),[u,p]=(0,H.useState)(null),[m,h]=(0,H.useState)([]),[y,b]=(0,H.useState)([]);(0,H.useEffect)(()=>{if(!n)return;let e=!1;return P({q:i,limit:8}).then(t=>{e||h(t.keys)}).catch(()=>{e||h([])}),()=>{e=!0}},[i,n]),(0,H.useEffect)(()=>{if(!n||!i.trim()){b([]);return}let e=!1;return M(i.trim(),{q:o,limit:8}).then(t=>{e||b(t.values)}).catch(()=>{e||b([])}),()=>{e=!0}},[i,n,o]);function x(){let n=i.trim(),r=o.trim();if(!n||!r){p(`Enter an attribute key and value, or remove this filter.`);return}if(c===`regex`)try{new RegExp(r)}catch{p(`Enter a valid regular expression.`);return}p(null);let u=e.filter(e=>e.key!==n);t?.([...u,{key:n,value:r,mode:c}]),a(``),s(``),l(`exact`)}function ee(n){t?.(e.filter((e,t)=>t!==n))}return(0,U.jsxs)(v,{open:n,onOpenChange:r,children:[(0,U.jsx)(_,{asChild:!0,children:(0,U.jsxs)(T,{type:`button`,variant:e.length>0?`secondary`:`outline`,size:`sm`,"aria-label":`Filter by attributes`,className:`h-9 gap-2`,children:[(0,U.jsx)(w,{className:`size-4`}),`Attributes`,e.length>0?` (${e.length})`:``]})}),(0,U.jsxs)(g,{align:`start`,className:`w-[380px] p-0`,children:[(0,U.jsx)(`div`,{className:`border-b px-3 py-2`,children:(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Filter by attributes`})}),(0,U.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,htmlFor:`run-attribute-key`,children:`Key`}),(0,U.jsx)(pe,{id:`run-attribute-key`,value:i,onChange:e=>{a(e.target.value),p(null)},placeholder:`git.branch`}),(0,U.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-border/60`,children:m.length>0?m.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left text-xs hover:bg-muted`,onClick:()=>a(e.key),children:[(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.key}),(0,U.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.count})]},e.key)):(0,U.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No attributes found`})})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,htmlFor:`run-attribute-value`,children:`Value`}),(0,U.jsx)(pe,{id:`run-attribute-value`,value:o,onChange:e=>{s(e.target.value),p(null)},placeholder:c===`regex`?`^(master|main)$`:`master`,"aria-describedby":u?`run-attribute-filter-error`:void 0}),(0,U.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-border/60`,children:y.length>0?y.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left text-xs hover:bg-muted`,onClick:()=>s(e.value),children:[(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.value}),(0,U.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.count})]},e.value)):(0,U.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:`No values found for this key`})})]})]}),(0,U.jsxs)(`div`,{className:`inline-flex rounded border border-border p-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,className:S(`rounded-[2px] px-2 py-1 text-xs`,c===`exact`?`bg-primary text-primary-foreground`:`text-muted-foreground`),"aria-pressed":c===`exact`,onClick:()=>l(`exact`),children:`Exact match`}),(0,U.jsx)(`button`,{type:`button`,className:S(`rounded-[2px] px-2 py-1 text-xs`,c===`regex`?`bg-primary text-primary-foreground`:`text-muted-foreground`),"aria-pressed":c===`regex`,onClick:()=>l(`regex`),children:`Regex`})]}),u?(0,U.jsx)(`p`,{id:`run-attribute-filter-error`,className:`text-xs text-destructive`,children:u}):null,(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(T,{type:`button`,size:`sm`,onClick:x,children:[(0,U.jsx)(d,{className:`size-4`}),`Apply filter`]}),(0,U.jsx)(T,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>t?.([]),disabled:e.length===0,children:`Clear attributes`})]}),e.length>0?(0,U.jsx)(`div`,{className:`space-y-1 border-t pt-3`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 break-all font-mono`,children:Y(e)}),(0,U.jsx)(T,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.key} filter`,onClick:()=>ee(t),children:(0,U.jsx)(f,{className:`size-3.5`})})]},`${e.key}-${e.mode}`))}):null]})]})]})}function X({status:e}){let t=j(e);return(0,U.jsx)(F,{className:ye(t.tone),children:t.label})}function Ne({column:e,label:n}){return(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsxs)(T,{type:`button`,variant:`ghost`,size:`xs`,"data-runs-sort-button":`compact`,className:`h-7 max-w-full shrink justify-end px-1.5 text-[12px] leading-none text-foreground/90`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[(0,U.jsx)(`span`,{className:`truncate`,children:n}),(0,U.jsx)(t,{})]})})}var Pe=[{accessorKey:`status`,header:({column:e})=>(0,U.jsxs)(T,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Status`,(0,U.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{accessorKey:`name`,header:({column:e})=>(0,U.jsxs)(T,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Test Name`,(0,U.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{id:`target`,accessorFn:e=>`${e.targetName??`No target`} ${e.platform}`,header:({column:e})=>(0,U.jsxs)(T,{variant:`ghost`,className:`-ml-2`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Target`,(0,U.jsx)(t,{className:`ml-2 h-4 w-4`})]})},{id:`attributes`,accessorFn:e=>Object.entries(e.attributes??{}).map(([e,t])=>`${e}=${t}`).join(` `),header:`Attributes`},{accessorKey:`duration`,header:({column:e})=>(0,U.jsx)(Ne,{column:e,label:`Duration`})},{accessorKey:`createdAt`,header:({column:e})=>(0,U.jsx)(Ne,{column:e,label:`Started`})}];function Fe(e){e.stopPropagation()}function Ie(e,t){if(e.length===0)return!1;let n=e.filter(e=>t.has(e)).length;return n===0?!1:n===e.length?!0:`indeterminate`}function Le(e){let t=W[e];if(t)return{width:t,minWidth:t}}function Z(e){return S(`h-10 bg-background text-[13px] font-medium text-foreground/90`,e===`select`&&`w-11 px-2 text-center`,e===`status`&&`w-[136px] px-3`,e===`name`&&`px-3`,e===`target`&&`w-[180px] px-3`,e===`attributes`&&`w-[260px] px-3`,e===`duration`&&`w-[104px] px-3 text-right`,e===`createdAt`&&`w-[128px] px-3 text-right`)}function Q(e,t){return S(`py-2 align-top`,e===`select`&&`w-11 px-2`,e===`status`&&`w-[136px] px-3`,e===`name`&&S(`max-w-0 px-3`,t&&`pl-8`),e===`target`&&`w-[180px] max-w-0 px-3 text-muted-foreground`,e===`attributes`&&`w-[260px] max-w-0 px-3`,e===`duration`&&`w-[104px] px-3 text-right tabular-nums`,e===`createdAt`&&`w-[128px] px-3 text-right tabular-nums`)}function $({isActive:e,isBatchSelected:t,isChild:n}){return S(`cursor-pointer outline-none hover:bg-muted/20 focus-visible:bg-primary/10`,n&&`bg-muted/[0.04]`,t&&!e&&`bg-muted/20`,e&&`bg-primary/10 ring-1 ring-inset ring-primary/60`)}function Re(e,t){let n=[];for(let r of e)if(n.push({id:r.id,run:r,isChild:!1,parentId:null}),!(!je(r)||!t.has(r.id)))for(let e of r.tests??[])n.push({id:e.id,run:e,isChild:!0,parentId:r.id});return n}function ze({runs:e,total:t,isLoading:c,page:l,onPageChange:u,onSearchChange:d,searchValue:f,selectedRunId:p=null,onSelectedRunIdChange:h,expandedSuites:g=new Set,onToggleSuite:_,onOpenRun:v,onVisibleRunsChange:x,platformFilter:ee=``,onPlatformChange:te,targetFilter:ne=``,targetOptions:re=[],onTargetChange:S,attributePredicates:C=[],onAttributePredicatesChange:w,sorting:ue,onSortingChange:fe,headerActions:E,topSlot:me,enableSelection:D=!1,selectedRunIds:O=new Set,onToggleRunSelection:he,onToggleVisibleSelection:ge}){let[k,_e]=(0,H.useState)([]),A=ue??k,j=fe??_e,M=I({data:e,columns:[...D?[{id:`select`,header:({table:e})=>(0,U.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,U.jsx)(m,{checked:Ie(e.getRowModel().rows.map(e=>e.original.id),O),onCheckedChange:t=>ge?.(e.getRowModel().rows.map(e=>e.original),t===!0),onClick:e=>e.stopPropagation(),"aria-label":`Select all`})}),enableSorting:!1}]:[],...Pe],getRowId:e=>e.id,getCoreRowModel:Se(),getSortedRowModel:xe(),onSortingChange:j,state:{sorting:A}}),ye=M.getHeaderGroups(),N=M.getRowModel().rows,P=(0,H.useMemo)(()=>N.map(e=>e.original),[N]),be=(0,H.useMemo)(()=>Re(P,g),[g,P]),F=Math.ceil(t/50),Te=l*50+1,Ee=Math.min((l+1)*50,t),De=Array.from(new Set([ne,...re].filter(e=>!!e))),Oe=[...D?[`select`]:[],`status`,`name`,`target`,`attributes`,`duration`,`createdAt`],W=(0,H.useMemo)(()=>C.map(e=>e.key),[C]);(0,H.useEffect)(()=>{x?.(be)},[x,be]),(0,H.useEffect)(()=>{if(!p)return;let e=document.querySelector(`[data-runs-row-surface="${p}"]`);e&&document.activeElement!==e&&e.focus()},[p]);function G(e){return e.status===`running`&&e.startedAt?(0,U.jsx)(`span`,{className:`text-sm tabular-nums`,children:(0,U.jsx)(ke,{startedAt:e.startedAt})}):e.status===`running`?(0,U.jsx)(`span`,{className:`text-sm text-blue-500`,children:`Starting...`}):(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:oe(e.duration)})}function K(e,t){h?.(e.id),v?.(e,t)}function q(e,t){t.key===`Enter`&&(t.preventDefault(),K(e,t))}return(0,U.jsx)(de,{children:(0,U.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`shrink-0 space-y-4`,children:[me,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(pe,{placeholder:`Search runs...`,value:f,onChange:e=>d(e.target.value),className:`max-w-[220px]`}),te&&(0,U.jsxs)(s,{value:ee||`all`,onValueChange:e=>te(e===`all`?``:e),children:[(0,U.jsx)(a,{className:`w-[140px]`,children:(0,U.jsx)(o,{placeholder:`All platforms`})}),(0,U.jsxs)(i,{children:[(0,U.jsx)(n,{value:`all`,children:`All platforms`}),(0,U.jsx)(n,{value:`web`,children:`Web`}),(0,U.jsx)(n,{value:`android`,children:`Android`}),(0,U.jsx)(n,{value:`ios`,children:`iOS`})]})]}),S&&(0,U.jsxs)(s,{value:ne||`all`,onValueChange:e=>S(e===`all`?``:e),children:[(0,U.jsx)(a,{className:`w-[180px]`,children:(0,U.jsx)(o,{placeholder:`All targets`})}),(0,U.jsxs)(i,{children:[(0,U.jsx)(n,{value:`all`,children:`All targets`}),De.map(e=>(0,U.jsx)(n,{value:e,children:e},e))]})]}),w&&(0,U.jsx)(Me,{predicates:C,onChange:w}),(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c&&(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Loading...`}),E]})]})]}),(0,U.jsxs)(b,{className:`min-h-0 flex-1 rounded-md border`,children:[(0,U.jsxs)(we,{className:`min-w-full table-fixed`,children:[(0,U.jsx)(`colgroup`,{children:Oe.map(e=>(0,U.jsx)(`col`,{style:Le(e)},e))}),(0,U.jsx)(Ce,{children:ye.map(e=>(0,U.jsx)(B,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,U.jsx)(R,{className:Z(e.column.id),children:e.isPlaceholder?null:L(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,U.jsx)(z,{children:N.length?N.map(e=>{let t=e.original,n=je(t),i=n&&g.has(t.id),a=t.tests??[],o=a.filter(e=>e.status===`passed`).length,s=p===t.id,c=O.has(t.id);return(0,U.jsxs)(H.Fragment,{children:[(0,U.jsxs)(B,{tabIndex:s?0:-1,"data-runs-row-surface":t.id,"data-active":String(s),"data-state":c?`selected`:void 0,"aria-selected":s,className:$({isActive:s,isBatchSelected:c,isChild:!1}),onClick:e=>K(t,e),onFocus:()=>h?.(t.id),onKeyDown:e=>q(t,e),children:[D&&(0,U.jsx)(V,{className:Q(`select`,!1),onClick:e=>e.stopPropagation(),children:(0,U.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,U.jsx)(m,{checked:O.has(t.id),onCheckedChange:e=>he?.(t,e===!0),"aria-label":`Select row`})})}),(0,U.jsx)(V,{className:Q(`status`,!1),children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(X,{status:t.status}),n&&a.length>0&&(0,U.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/80 tabular-nums`,children:[o,`/`,a.length]})]})}),(0,U.jsx)(V,{className:Q(`name`,!1),children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n&&(0,U.jsx)(`button`,{type:`button`,className:`rounded p-0.5 hover:bg-muted`,onClick:e=>{Fe(e),_?.(t.id)},children:i?(0,U.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(ae,{className:`h-4 w-4 text-muted-foreground`})}),(0,U.jsx)(`span`,{className:`block whitespace-normal break-words text-sm font-medium leading-snug text-foreground`,children:t.name})]})}),(0,U.jsx)(V,{className:Q(`target`,!1),children:(0,U.jsx)(`span`,{className:`block whitespace-normal break-words text-[13px] leading-snug text-muted-foreground/90`,children:Ae(t)})}),(0,U.jsx)(V,{className:Q(`attributes`,!1),children:(0,U.jsx)(J,{attributes:t.attributes,activeKeys:W})}),(0,U.jsx)(V,{className:Q(`duration`,!1),children:G(t)}),(0,U.jsx)(V,{className:Q(`createdAt`,!1),children:(0,U.jsxs)(ce,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:se(t.createdAt)})}),(0,U.jsx)(le,{children:ve(t.createdAt)})]})})]}),i&&a.map(t=>{let n=p===t.id;return(0,U.jsxs)(B,{tabIndex:n?0:-1,"data-runs-row-surface":t.id,"data-active":String(n),"aria-selected":n,className:$({isActive:n,isBatchSelected:!1,isChild:!0}),onClick:e=>K(t,e),onFocus:()=>h?.(t.id),onKeyDown:e=>q(t,e),children:[D&&(0,U.jsx)(V,{className:Q(`select`,!0)}),(0,U.jsx)(V,{className:Q(`status`,!0),children:(0,U.jsx)(X,{status:t.status})}),(0,U.jsx)(V,{className:Q(`name`,!0),children:(0,U.jsx)(`span`,{className:`block whitespace-normal break-words text-sm leading-snug text-foreground/90`,children:t.name})}),(0,U.jsx)(V,{className:Q(`target`,!0),children:(0,U.jsx)(`span`,{className:`block whitespace-normal break-words text-[13px] leading-snug text-muted-foreground`,children:Ae(t)})}),(0,U.jsx)(V,{className:Q(`attributes`,!0),children:(0,U.jsx)(J,{attributes:t.attributes,activeKeys:W})}),(0,U.jsx)(V,{className:Q(`duration`,!0),children:G(t)}),(0,U.jsx)(V,{className:Q(`createdAt`,!0),children:(0,U.jsxs)(ce,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:se(t.createdAt)})}),(0,U.jsx)(le,{children:ve(t.createdAt)})]})})]},`${e.id}-child-${t.id}`)})]},e.id)}):(0,U.jsx)(B,{children:(0,U.jsx)(V,{colSpan:Oe.length,className:`h-24 text-center`,children:`No results.`})})})]}),(0,U.jsx)(y,{orientation:`horizontal`})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t>0?`Showing ${Te}-${Ee} of ${t}`:`No runs found`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>u(l-1),disabled:l===0,children:`Previous`}),(0,U.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>u(l+1),disabled:l>=F-1||F===0,children:`Next`})]})]})]})})}var Be=new Set([`all`,`running`,`queued`,`completed`,`failed`]),Ve=new Set([`asc`,`desc`]);function He(e){if(!e)return 1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>1?t:1}function Ue(e){let t=new URLSearchParams;e.tab!==`all`&&t.set(`tab`,e.tab),e.search&&t.set(`search`,e.search),e.platform&&t.set(`platform`,e.platform),e.target&&t.set(`target`,e.target);for(let n of e.attributePredicates){if(!n.key||!n.value)continue;let e=n.mode===`regex`?`attributes[${n.key}][regex]`:`attributes[${n.key}]`;t.set(e,n.value)}return e.sort&&(t.set(`sort`,e.sort),t.set(`order`,e.order)),e.page>1&&t.set(`page`,String(e.page)),t}function We(e){let t=[];for(let[n,r]of e.entries()){let e=/^attributes\[([^\]]+)\](?:\[(regex)\])?$/.exec(n);!e||!r||t.push({key:e[1],value:r,mode:e[2]===`regex`?`regex`:`exact`})}return t}function Ge(){let[e,t]=O(),n=e.get(`tab`),r=n&&Be.has(n)?n:`all`,i=e.get(`search`)??``,a=e.get(`platform`)??``,o=e.get(`target`)??``,s=(0,H.useMemo)(()=>We(e),[e]),c=e.get(`sort`)??``,l=e.get(`order`)??`desc`,u=Ve.has(l)?l:`desc`,d=He(e.get(`page`)),f=(0,H.useMemo)(()=>c?[{id:c,desc:u===`desc`}]:[],[c,u]),p=(0,H.useRef)(f);p.current=f;let m=(0,H.useMemo)(()=>({tab:r,search:i,platform:a,target:o,attributePredicates:s,sort:c,order:u,page:d}),[r,i,a,o,s,c,u,d]);(0,H.useEffect)(()=>{let n=Ue(m);e.toString()!==n.toString()&&t(n,{replace:!0})},[e,t,m]);let h=(0,H.useCallback)((e,n)=>{let r={...m,...e};n?.resetPage&&(r.page=1),t(Ue(r),{replace:!0})},[t,m]);return{tab:r,search:i,platform:a,target:o,attributePredicates:s,sort:c,order:u,page:d,sorting:f,onSortingChange:(0,H.useCallback)(e=>{let t=typeof e==`function`?e(p.current):e;t.length>0?h({sort:t[0].id,order:t[0].desc?`desc`:`asc`}):h({sort:``,order:`desc`})},[h]),setTab:(0,H.useCallback)(e=>h({tab:e},{resetPage:!0}),[h]),setSearch:(0,H.useCallback)(e=>h({search:e},{resetPage:!0}),[h]),setPlatform:(0,H.useCallback)(e=>h({platform:e},{resetPage:!0}),[h]),setTarget:(0,H.useCallback)(e=>h({target:e},{resetPage:!0}),[h]),setAttributePredicates:(0,H.useCallback)(e=>h({attributePredicates:e},{resetPage:!0}),[h]),setPage:(0,H.useCallback)(e=>h({page:e}),[h])}}var Ke={all:``,running:`running`,queued:`pending`,completed:`passed`,failed:`failed`};function qe(e,t){let n=e.trim().toLowerCase();if(!n)return!0;let r=t.runId.toLowerCase().includes(n),i=(t.testName??``).toLowerCase().includes(n);return r||i}function Je(){p(`Runs`);let e=_e(),[t,n]=(0,H.useState)([]),[r,i]=(0,H.useState)(0),[a,o]=(0,H.useState)([]),[s,d]=(0,H.useState)(!0),{tab:f,search:m,platform:g,target:_,attributePredicates:v,page:y,sorting:b,onSortingChange:ne,setTab:ae,setSearch:S,setPlatform:oe,setTarget:se,setAttributePredicates:w,setPage:pe}=Ge(),[E,O]=(0,H.useState)(!1),[A,j]=(0,H.useState)(null),[M,ve]=(0,H.useState)([]),[ye,P]=(0,H.useState)(()=>new Set),[I,xe]=(0,H.useState)(null),[Se,L]=(0,H.useState)(!1),[Ce,R]=(0,H.useState)(!1),[z,B]=(0,H.useState)(!0),[V,we]=(0,H.useState)(!0),{hasFarm:ke,isLoading:W}=c(),G=(0,H.useCallback)(async(e,t,r,a)=>{try{if(r&&r!==`running`){n(e),i(t);return}let{executions:o}=await C();if(o.length===0){n(e),i(t);return}let s=new Set(e.map(e=>e.id)),c=o.filter(e=>!s.has(e.runId)).filter(e=>qe(a,e)).map(e=>({id:e.runId,name:e.testName??`Running test...`,filePath:null,status:`running`,duration:e.duration,attributes:{},environment:null,metadata:null,startedAt:e.startedAt,endedAt:null,videoPath:null,failureSummary:null,errorLog:null,memoryLog:null,testId:null,suiteId:null,platform:`web`,testFileContent:null,modelName:null,llmProvider:null,parentRunId:null,attemptNumber:1,retryCount:0,maxRetries:0,createdAt:e.startedAt}));n([...c,...e]),i(t+c.length)}catch{n(e),i(t)}},[]),K=(0,H.useCallback)(e=>({limit:50,offset:(e.page-1)*50,name:e.name||void 0,status:e.status||void 0,platform:e.platform||void 0,target:e.target||void 0,attributes:e.attributes}),[]),Ae=Ke[f]??``,je=(0,H.useCallback)(async e=>{try{d(!0);let[t,n]=await Promise.all([N(K(e)),fe()]);xe(n),o(t.targets??[]),await G(t.runs,t.total,e.status,e.name)}catch{k.error(`Failed to load runs`)}finally{d(!1),O(!0)}},[G,K]),q=(0,H.useCallback)(async e=>{try{let[t,n]=await Promise.all([N(K(e)),fe()]);xe(n),o(t.targets??[]),await G(t.runs,t.total,e.status,e.name)}catch{}},[G,K]),J=(0,H.useMemo)(()=>({page:y,name:m,status:Ae,platform:g,target:_,attributes:v}),[y,m,Ae,g,_,v]);(0,H.useEffect)(()=>{je(J)},[je,J]),(0,H.useEffect)(()=>{if(!E)return;let e=setInterval(()=>{q(J)},5e3);return()=>clearInterval(e)},[E,q,J]),(0,H.useEffect)(()=>{j(null),P(new Set),ve([])},[f,m,g,_,v,y]),(0,H.useEffect)(()=>{A&&(M.some(e=>e.id===A)||j(t.find(e=>e.tests?.some(e=>e.id===A))?.id??null))},[t,A,M]);let Y=Oe({items:t,getId:e=>e.id,visibleIds:t.map(e=>e.id)}),Me=Y.selectedIds,X=Y.selectedItems,Ne=(0,H.useCallback)(()=>{Y.clearSelection(),R(!1),B(!0),we(!0)},[Y]),Pe=(0,H.useCallback)(async e=>{if(X.length===0)return;let t=X.flatMap(e=>e.filePath?[e.filePath]:[]);if(t.length===0){k.error(`No selected runs can be rerun`);return}L(!0);try{let n=await Promise.allSettled(t.map(t=>re({file:t,local:e,noCache:!z,noMemory:!V}))),r=n.filter(e=>e.status===`fulfilled`).length,i=n.length-r;i>0?k.error(`${r} runs queued, ${i} failed`):k.success(`${r} runs queued`),R(!1)}finally{L(!1)}},[X,z,V]),Fe=(0,H.useCallback)(async()=>{if(X.length===0)return;let e=Array.from(new Set(X.flatMap(e=>e.filePath?[e.filePath]:[])));if(e.length===0){k.error(`No selected runs have file paths to purge`);return}L(!0);try{let t=await Promise.allSettled(e.map(e=>me({file:e}))),n=t.filter(e=>e.status===`fulfilled`).length,r=t.filter(e=>e.status===`fulfilled`).reduce((e,t)=>e+t.value.purged,0),i=t.length-n;i>0?k.error(`Purged ${r} plans from ${n} tests, ${i} failed`):k.success(`Purged ${r} cached plan${r===1?``:`s`} from ${n} test${n===1?``:`s`}`)}finally{L(!1)}},[X]),Ie=(0,H.useCallback)(async()=>{if(X.length!==0){L(!0);try{let e=await Promise.allSettled(X.map(e=>ge(e.id))),t=X.filter((t,n)=>e[n]?.status===`fulfilled`),r=new Set(e.flatMap(e=>e.status===`fulfilled`?e.value.deletedRunIds:[])),a=e.length-t.length;t.length>0&&(Y.setItemsSelected(t,!1),n(e=>e.filter(e=>!r.has(e.id))),i(e=>Math.max(0,e-t.length)),R(!1)),a>0?k.error(`Deleted ${t.length} run${t.length===1?``:`s`}, ${a} failed`):k.success(`Deleted ${t.length} run${t.length===1?``:`s`}`)}finally{L(!1)}}},[X,Y]),Le=(0,H.useCallback)(e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Z=(0,H.useCallback)((t,n)=>{let r=he.runDetailOrLive(t.id,t.status);if(n?.metaKey||n?.ctrlKey||n?.button===1){window.open(r,`_blank`,`noopener,noreferrer`);return}e(r)},[e]),Q=(0,H.useCallback)((e,t)=>{Z(e,t)},[Z]),$=(0,H.useMemo)(()=>M.findIndex(e=>e.id===A),[A,M]);Ee((0,H.useMemo)(()=>{let e=e=>{if(M.length!==0){if($===-1){j(e>0?M[0].id:M[M.length-1].id);return}j(M[Math.max(0,Math.min($+e,M.length-1))].id)}},t=()=>e(1),n=()=>e(-1);return{j:t,arrowdown:t,k:n,arrowup:n,enter:e=>{$<0||Z(M[$].run,e)}}},[Z,$,M]));let Re=I?.running.count??0,Be=I?.pending.count??0,Ve=Be>0||Re>0;if(!E)return(0,U.jsx)(D,{});let He=!!m||f!==`all`||!!g||!!_||v.length>0;if(t.length===0&&!He)return(0,U.jsx)(Te,{icon:be,title:`No test runs yet`,description:`Run your first test to see results here`,actionLabel:`View Tests`,onAction:()=>e(he.tests)});let Ue=(0,U.jsx)(te,{value:f,onValueChange:ae,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(ee,{variant:`line`,children:[(0,U.jsx)(x,{value:`all`,children:`All`}),(0,U.jsxs)(x,{value:`running`,children:[`Running`,Re>0&&(0,U.jsx)(F,{variant:`secondary`,className:`ml-1 px-1.5 text-xs`,children:Re})]}),(0,U.jsxs)(x,{value:`queued`,children:[`Queued`,Be>0&&(0,U.jsx)(F,{variant:`secondary`,className:`ml-1 px-1.5 text-xs`,children:Be})]}),(0,U.jsx)(x,{value:`completed`,children:`Completed`}),(0,U.jsx)(x,{value:`failed`,children:`Failed`})]}),Ve&&I&&(0,U.jsxs)(F,{variant:`outline`,className:`text-xs`,children:[I.activeSlots,`/`,I.concurrency,` slots`]})]})});return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-4 overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Runs`}),(0,U.jsx)(de,{children:(0,U.jsxs)(ce,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,children:(0,U.jsx)(u,{className:`h-4 w-4`})})}),(0,U.jsx)(le,{side:`bottom`,className:`p-3`,children:(0,U.jsx)(l,{hints:[{key:`J / ↓`,label:`Next row`},{key:`K / ↑`,label:`Previous row`},{key:`Enter`,label:`Open run`},{key:`⌘+Enter`,label:`Open in new tab`}]})})]})})]}),(0,U.jsx)(ze,{topSlot:Ue,runs:t,total:r,isLoading:s,page:y-1,onPageChange:e=>pe(e+1),onSearchChange:S,searchValue:m,selectedRunId:A,onSelectedRunIdChange:j,expandedSuites:ye,onToggleSuite:Le,onOpenRun:Q,onVisibleRunsChange:ve,platformFilter:g,onPlatformChange:oe,targetFilter:_,targetOptions:a,onTargetChange:se,attributePredicates:v,onAttributePredicatesChange:w,sorting:b,onSortingChange:ne,enableSelection:!0,selectedRunIds:Y.selectedIdSet,onToggleRunSelection:Y.setItemSelected,onToggleVisibleSelection:Y.setItemsSelected}),(0,U.jsx)(h,{selectedCount:Me.length,summaryMeta:Y.hiddenCount>0?`${Y.hiddenCount} hidden by filters`:void 0,secondaryIcon:(0,U.jsx)(ue,{className:`size-4`}),secondaryAriaLabel:`Clear queue`,onDelete:Ie,actionSlot:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(De,{selectedCount:Y.selectedCount,hiddenCount:Y.hiddenCount,useCache:z,useMemory:V,browserStackAvailable:!W&&ke,open:Ce,onOpenChange:R,onUseCacheChange:B,onUseMemoryChange:we,onRunLocal:()=>Pe(!0),onRunBrowserStack:()=>Pe(!1),disabled:Se}),(0,U.jsx)(T,{variant:`outline`,size:`sm`,onClick:Fe,disabled:Se,children:`Purge cache`})]}),onCancel:Ne,isRunning:Se})]})}export{Je as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./dist-Bc4r79ls.js";import{n,r}from"./use-page-title-CsUoFrfG.js";import{$n as i,$t as a,An as o,Cn as s,Dn as c,En as l,Gt as u,Nn as d,Qt as f,Sn as p,Tn as m,Yn as h,Zt as g,_n as _,bn as v,en as y,gn as b,hn as x,mn as S,mr as C,pn as w,pr as T,tn as E,vn as D,wn as O,yn as k}from"./index-C3AdCkmj.js";var A=h(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),j=h(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),M=h(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),N=e(T(),1),P=e(C(),1);function F(e){let t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var I=i(),L=[` `,`Enter`,`ArrowUp`,`ArrowDown`],R=[` `,`Enter`],z=`Select`,[B,V,H]=t(z),[U,W]=m(z,[H,E]),G=E(),[ee,K]=U(z),[te,ne]=U(z),q=e=>{let{__scopeSelect:t,children:n,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:g}=e,_=G(t),[b,x]=P.useState(null),[S,C]=P.useState(null),[w,T]=P.useState(!1),E=r(u),[D,O]=p({prop:i,defaultProp:a??!1,onChange:o,caller:z}),[k,A]=p({prop:s,defaultProp:c,onChange:l,caller:z}),j=P.useRef(null),M=b?g||!!b.closest(`form`):!0,[N,F]=P.useState(new Set),L=Array.from(N).map(e=>e.props.value).join(`;`);return(0,I.jsx)(y,{..._,children:(0,I.jsxs)(ee,{required:h,scope:t,trigger:b,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:v(),value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:j,disabled:m,children:[(0,I.jsx)(B.Provider,{scope:t,children:(0,I.jsx)(te,{scope:e.__scopeSelect,onNativeOptionAdd:P.useCallback(e=>{F(t=>new Set(t).add(e))},[]),onNativeOptionRemove:P.useCallback(e=>{F(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),M?(0,I.jsxs)(Ge,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:k,onChange:e=>A(e.target.value),disabled:m,form:g,children:[k===void 0?(0,I.jsx)(`option`,{value:``}):null,Array.from(N)]},L):null]})})};q.displayName=z;var re=`SelectTrigger`,J=P.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=G(n),o=K(re,n),s=o.disabled||r,l=d(t,o.onTriggerChange),u=V(n),f=P.useRef(`touch`),[p,m,h]=qe(e=>{let t=u().filter(e=>!e.disabled),n=Je(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,I.jsx)(g,{asChild:!0,...a,children:(0,I.jsx)(c.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ke(o.value)?``:void 0,...i,ref:l,onClick:O(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:O(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:O(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&L.includes(e.key)&&(_(),e.preventDefault())})})})});J.displayName=re;var ie=`SelectValue`,ae=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...l}=e,u=K(ie,n),{onValueNodeHasChildrenChange:f}=u,p=a!==void 0,m=d(t,u.onValueNodeChange);return s(()=>{f(p)},[f,p]),(0,I.jsx)(c.span,{...l,ref:m,style:{pointerEvents:`none`},children:Ke(u.value)?(0,I.jsx)(I.Fragment,{children:o}):a})});ae.displayName=ie;var oe=`SelectIcon`,se=P.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(c.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});se.displayName=oe;var ce=`SelectPortal`,le=e=>(0,I.jsx)(b,{asChild:!0,...e});le.displayName=ce;var Y=`SelectContent`,ue=P.forwardRef((e,t)=>{let n=K(Y,e.__scopeSelect),[r,i]=P.useState();if(s(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?N.createPortal((0,I.jsx)(de,{scope:e.__scopeSelect,children:(0,I.jsx)(B.Slot,{scope:e.__scopeSelect,children:(0,I.jsx)(`div`,{children:e.children})})}),t):null}return(0,I.jsx)(me,{...e,ref:t})});ue.displayName=Y;var X=10,[de,Z]=U(Y),fe=`SelectContentImpl`,pe=o(`SelectContent.RemoveScroll`),me=P.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:v,...y}=e,b=K(Y,n),[C,T]=P.useState(null),[E,k]=P.useState(null),A=d(t,e=>T(e)),[j,M]=P.useState(null),[N,F]=P.useState(null),L=V(n),[R,z]=P.useState(!1),B=P.useRef(!1);P.useEffect(()=>{if(C)return w(C)},[C]),x();let H=P.useCallback(e=>{let[t,...n]=L().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[L,E]),U=P.useCallback(()=>H([j,C]),[H,j,C]);P.useEffect(()=>{R&&U()},[R,U]);let{onOpenChange:W,triggerPointerDownPosRef:G}=b;P.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(G.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||W(!1),document.removeEventListener(`pointermove`,t),G.current=null};return G.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,W,G]),P.useEffect(()=>{let e=()=>W(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[W]);let[ee,te]=qe(e=>{let t=L().filter(e=>!e.disabled),n=Je(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ne=P.useCallback((e,t,n)=>{let r=!B.current&&!n;(b.value!==void 0&&b.value===t||r)&&(M(e),r&&(B.current=!0))},[b.value]),q=P.useCallback(()=>C?.focus(),[C]),re=P.useCallback((e,t,n)=>{let r=!B.current&&!n;(b.value!==void 0&&b.value===t||r)&&F(e)},[b.value]),J=r===`popper`?ve:ge,ie=J===ve?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:v}:{};return(0,I.jsx)(de,{scope:n,content:C,viewport:E,onViewportChange:k,itemRefCallback:ne,selectedItem:j,onItemLeave:q,itemTextRefCallback:re,focusSelectedItem:U,selectedItemText:N,position:r,isPositioned:R,searchRef:ee,children:(0,I.jsx)(S,{as:pe,allowPinchZoom:!0,children:(0,I.jsx)(_,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:O(i,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(D,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,I.jsx)(J,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...ie,onPlaced:()=>z(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:O(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>H(t)),e.preventDefault()}})})})})})})});me.displayName=fe;var he=`SelectItemAlignedPosition`,ge=P.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=K(Y,r),l=Z(Y,r),[u,f]=P.useState(null),[p,m]=P.useState(null),h=d(t,e=>m(e)),g=V(r),_=P.useRef(!1),v=P.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:x,focusSelectedItem:S}=l,C=P.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&p&&y&&b&&x){let e=o.trigger.getBoundingClientRect(),t=p.getBoundingClientRect(),r=o.valueNode.getBoundingClientRect(),a=x.getBoundingClientRect();if(o.dir!==`rtl`){let i=a.left-t.left,o=r.left-i,s=e.left-o,c=e.width+s,l=Math.max(c,t.width),d=window.innerWidth-X,f=n(o,[X,Math.max(X,d-l)]);u.style.minWidth=c+`px`,u.style.left=f+`px`}else{let i=t.right-a.right,o=window.innerWidth-r.right-i,s=window.innerWidth-e.right-o,c=e.width+s,l=Math.max(c,t.width),d=window.innerWidth-X,f=n(o,[X,Math.max(X,d-l)]);u.style.minWidth=c+`px`,u.style.right=f+`px`}let s=g(),c=window.innerHeight-X*2,l=y.scrollHeight,d=window.getComputedStyle(p),f=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),h=parseInt(d.borderBottomWidth,10),v=parseInt(d.paddingBottom,10),S=f+m+l+v+h,C=Math.min(b.offsetHeight*5,S),w=window.getComputedStyle(y),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-X,O=c-D,k=b.offsetHeight/2,A=b.offsetTop+k,j=f+m+A,M=S-j;if(j<=D){let e=s.length>0&&b===s[s.length-1].ref.current;u.style.bottom=`0px`;let t=p.clientHeight-y.offsetTop-y.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+h);u.style.height=n+`px`}else{let e=s.length>0&&b===s[0].ref.current;u.style.top=`0px`;let t=Math.max(D,f+y.offsetTop+(e?T:0)+k)+M;u.style.height=t+`px`,y.scrollTop=j-D+y.offsetTop}u.style.margin=`${X}px 0`,u.style.minHeight=C+`px`,u.style.maxHeight=c+`px`,i?.(),requestAnimationFrame(()=>_.current=!0)}},[g,o.trigger,o.valueNode,u,p,y,b,x,o.dir,i]);s(()=>C(),[C]);let[w,T]=P.useState();return s(()=>{p&&T(window.getComputedStyle(p).zIndex)},[p]),(0,I.jsx)(ye,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:_,onScrollButtonChange:P.useCallback(e=>{e&&v.current===!0&&(C(),S?.(),v.current=!1)},[C,S]),children:(0,I.jsx)(`div`,{ref:f,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},children:(0,I.jsx)(c.div,{...a,ref:h,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});ge.displayName=he;var _e=`SelectPopperPosition`,ve=P.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...o}=e,s=G(n);return(0,I.jsx)(a,{...s,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...o.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});ve.displayName=_e;var[ye,be]=U(Y,{}),xe=`SelectViewport`,Se=P.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(xe,n),o=be(xe,n),s=d(t,a.onViewportChange),l=P.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(B.Slot,{scope:n,children:(0,I.jsx)(c.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:O(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Se.displayName=xe;var Ce=`SelectGroup`,[we,Te]=U(Ce),Ee=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=v();return(0,I.jsx)(we,{scope:n,id:i,children:(0,I.jsx)(c.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ee.displayName=Ce;var De=`SelectLabel`,Oe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Te(De,n);return(0,I.jsx)(c.div,{id:i.id,...r,ref:t})});Oe.displayName=De;var Q=`SelectItem`,[ke,Ae]=U(Q),je=P.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=K(Q,n),l=Z(Q,n),u=s.value===r,[f,p]=P.useState(a??``),[m,h]=P.useState(!1),g=d(t,e=>l.itemRefCallback?.(e,r,i)),_=v(),y=P.useRef(`touch`),b=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,I.jsx)(ke,{scope:n,value:r,disabled:i,textId:_,isSelected:u,onItemTextChange:P.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(B.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,I.jsx)(c.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":u&&m,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:O(o.onFocus,()=>h(!0)),onBlur:O(o.onBlur,()=>h(!1)),onClick:O(o.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:O(o.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:O(o.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:O(o.onPointerMove,e=>{y.current=e.pointerType,i?l.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:O(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:O(o.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(R.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});je.displayName=Q;var $=`SelectItemText`,Me=P.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=K($,n),l=Z($,n),u=Ae($,n),f=ne($,n),[p,m]=P.useState(null),h=d(t,e=>m(e),u.onItemTextChange,e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,_=P.useMemo(()=>(0,I.jsx)(`option`,{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=f;return s(()=>(v(_),()=>y(_)),[v,y,_]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(c.span,{id:u.textId,...a,ref:h}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?N.createPortal(a.children,o.valueNode):null]})});Me.displayName=$;var Ne=`SelectItemIndicator`,Pe=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ae(Ne,n).isSelected?(0,I.jsx)(c.span,{"aria-hidden":!0,...r,ref:t}):null});Pe.displayName=Ne;var Fe=`SelectScrollUpButton`,Ie=P.forwardRef((e,t)=>{let n=Z(Fe,e.__scopeSelect),r=be(Fe,e.__scopeSelect),[i,a]=P.useState(!1),o=d(t,r.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ie.displayName=Fe;var Le=`SelectScrollDownButton`,Re=P.forwardRef((e,t)=>{let n=Z(Le,e.__scopeSelect),r=be(Le,e.__scopeSelect),[i,a]=P.useState(!1),o=d(t,r.onScrollButtonChange);return s(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(ze,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Re.displayName=Le;var ze=P.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=P.useRef(null),l=V(n),u=P.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return P.useEffect(()=>()=>u(),[u]),s(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,I.jsx)(c.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:O(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:O(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:O(i.onPointerLeave,()=>{u()})})}),Be=`SelectSeparator`,Ve=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,I.jsx)(c.div,{"aria-hidden":!0,...r,ref:t})});Ve.displayName=Be;var He=`SelectArrow`,Ue=P.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n),a=K(He,n),o=Z(He,n);return a.open&&o.position===`popper`?(0,I.jsx)(f,{...i,...r,ref:t}):null});Ue.displayName=He;var We=`SelectBubbleInput`,Ge=P.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=P.useRef(null),a=d(r,i),o=F(t);return P.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,I.jsx)(c.select,{...n,style:{...l,...n.style},ref:a,defaultValue:t})});Ge.displayName=We;function Ke(e){return e===``||e===void 0}function qe(e){let t=k(e),n=P.useRef(``),r=P.useRef(0),i=P.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=P.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Je(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ye(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ye(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Xe=q,Ze=J,Qe=ae,$e=se,et=le,tt=ue,nt=Se,rt=Ee,it=Oe,at=je,ot=Me,st=Pe,ct=Ie,lt=Re;function ut({...e}){return(0,I.jsx)(Xe,{"data-slot":`select`,...e})}function dt({...e}){return(0,I.jsx)(rt,{"data-slot":`select-group`,...e})}function ft({...e}){return(0,I.jsx)(Qe,{"data-slot":`select-value`,...e})}function pt({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(Ze,{"data-slot":`select-trigger`,"data-size":t,className:u(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)($e,{asChild:!0,children:(0,I.jsx)(j,{className:`size-4 opacity-50`})})]})}function mt({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,I.jsx)(et,{children:(0,I.jsxs)(tt,{"data-slot":`select-content`,className:u(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,I.jsx)(_t,{}),(0,I.jsx)(nt,{className:u(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(vt,{})]})})}function ht({className:e,...t}){return(0,I.jsx)(it,{"data-slot":`select-label`,className:u(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function gt({className:e,children:t,...n}){return(0,I.jsxs)(at,{"data-slot":`select-item`,className:u(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(st,{children:(0,I.jsx)(A,{className:`size-4`})})}),(0,I.jsx)(ot,{children:t})]})}function _t({className:e,...t}){return(0,I.jsx)(ct,{"data-slot":`select-scroll-up-button`,className:u(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(M,{className:`size-4`})})}function vt({className:e,...t}){return(0,I.jsx)(lt,{"data-slot":`select-scroll-down-button`,className:u(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(j,{className:`size-4`})})}export{ht as a,F as c,gt as i,j as l,mt as n,pt as o,dt as r,ft as s,ut as t,A as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{l as t}from"./select-D0GpDfUa.js";import{t as n}from"./shortcut-hints-B8kCurzo.js";import{t as r}from"./dist-Bc4r79ls.js";import{r as i}from"./use-page-title-CsUoFrfG.js";import{n as a,r as o,t as s}from"./dist-BABsMbMt.js";import{$n as c,$t as l,An as u,Dn as d,Gt as f,H as p,Mn as m,Nn as h,On as ee,Qt as te,Sn as g,Tn as _,Wt as v,Yn as ne,Zt as re,_n as ie,bn as y,en as b,gn as x,hn as ae,mn as oe,mr as S,pn as se,tn as C,vn as ce,wn as w,xn as T,yn as E,zn as D}from"./index-C3AdCkmj.js";var O=ne(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),k=ne(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),A=e(S(),1),j=c(),M=[`Enter`,` `],le=[`ArrowDown`,`PageUp`,`Home`],ue=[`ArrowUp`,`PageDown`,`End`],de=[...le,...ue],fe={ltr:[...M,`ArrowRight`],rtl:[...M,`ArrowLeft`]},N={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},P=`Menu`,[F,pe,me]=r(P),[I,he]=_(P,[me,C,o]),L=C(),ge=o(),[_e,R]=I(P),[ve,z]=I(P),ye=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,c=L(t),[l,u]=A.useState(null),d=A.useRef(!1),f=E(o),p=i(a);return A.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,j.jsx)(b,{...c,children:(0,j.jsx)(_e,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,j.jsx)(ve,{scope:t,onClose:A.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:s,children:r})})})};ye.displayName=P;var be=`MenuAnchor`,B=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=L(n);return(0,j.jsx)(re,{...i,...r,ref:t})});B.displayName=be;var V=`MenuPortal`,[xe,Se]=I(V,{forceMount:void 0}),Ce=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=R(V,t);return(0,j.jsx)(xe,{scope:t,forceMount:n,children:(0,j.jsx)(T,{present:n||a.open,children:(0,j.jsx)(x,{asChild:!0,container:i,children:r})})})};Ce.displayName=V;var H=`MenuContent`,[we,U]=I(H),Te=A.forwardRef((e,t)=>{let n=Se(H,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=R(H,e.__scopeMenu),o=z(H,e.__scopeMenu);return(0,j.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(T,{present:r||a.open,children:(0,j.jsx)(F.Slot,{scope:e.__scopeMenu,children:o.modal?(0,j.jsx)(Ee,{...i,ref:t}):(0,j.jsx)(De,{...i,ref:t})})})})}),Ee=A.forwardRef((e,t)=>{let n=R(H,e.__scopeMenu),r=A.useRef(null),i=h(t,r);return A.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,j.jsx)(W,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),De=A.forwardRef((e,t)=>{let n=R(H,e.__scopeMenu);return(0,j.jsx)(W,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oe=u(`MenuContent.ScrollLock`),W=A.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:ee,disableOutsideScroll:te,...g}=e,_=R(H,n),v=z(H,n),ne=L(n),re=ge(n),y=pe(n),[b,x]=A.useState(null),S=A.useRef(null),se=h(t,S,_.onContentChange),C=A.useRef(0),T=A.useRef(``),E=A.useRef(0),D=A.useRef(null),O=A.useRef(`right`),k=A.useRef(0),M=te?oe:A.Fragment,le=te?{as:Oe,allowPinchZoom:!0}:void 0,fe=e=>{let t=T.current+e,n=y().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ct(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){T.current=t,window.clearTimeout(C.current),t!==``&&(C.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};A.useEffect(()=>()=>window.clearTimeout(C.current),[]),ae();let N=A.useCallback(e=>O.current===D.current?.side&&ut(e,D.current?.area),[]);return(0,j.jsx)(we,{scope:n,searchRef:T,onItemEnter:A.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:A.useCallback(e=>{N(e)||(S.current?.focus(),x(null))},[N]),onTriggerLeave:A.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:E,onPointerGraceIntentChange:A.useCallback(e=>{D.current=e},[]),children:(0,j.jsx)(M,{...le,children:(0,j.jsx)(ie,{asChild:!0,trapped:i,onMountAutoFocus:w(o,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,j.jsx)(ce,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:ee,children:(0,j.jsx)(a,{asChild:!0,...re,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:b,onCurrentTabStopIdChange:x,onEntryFocus:w(u,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,j.jsx)(l,{role:`menu`,"aria-orientation":`vertical`,"data-state":it(_.open),"data-radix-menu-content":``,dir:v.dir,...ne,...g,ref:se,style:{outline:`none`,...g.style},onKeyDown:w(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&fe(e.key));let i=S.current;if(e.target!==i||!de.includes(e.key))return;e.preventDefault();let a=y().filter(e=>!e.disabled).map(e=>e.ref.current);ue.includes(e.key)&&a.reverse(),ot(a)}),onBlur:w(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),T.current=``)}),onPointerMove:w(e.onPointerMove,Y(e=>{let t=e.target,n=k.current!==e.clientX;e.currentTarget.contains(t)&&n&&(O.current=e.clientX>k.current?`right`:`left`,k.current=e.clientX)}))})})})})})})});Te.displayName=H;var ke=`MenuGroup`,Ae=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{role:`group`,...r,ref:t})});Ae.displayName=ke;var je=`MenuLabel`,Me=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{...r,ref:t})});Me.displayName=je;var G=`MenuItem`,Ne=`menu.itemSelect`,K=A.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=A.useRef(null),o=z(G,e.__scopeMenu),s=U(G,e.__scopeMenu),c=h(t,a),l=A.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ne,{bubbles:!0,cancelable:!0});e.addEventListener(Ne,e=>r?.(e),{once:!0}),ee(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,j.jsx)(Pe,{...i,ref:c,disabled:n,onClick:w(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:w(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:w(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||M.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});K.displayName=G;var Pe=A.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=U(G,n),c=ge(n),l=A.useRef(null),u=h(t,l),[f,p]=A.useState(!1),[m,ee]=A.useState(``);return A.useEffect(()=>{let e=l.current;e&&ee((e.textContent??``).trim())},[a.children]),(0,j.jsx)(F.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:(0,j.jsx)(s,{asChild:!0,...c,focusable:!r,children:(0,j.jsx)(d.div,{role:`menuitem`,"data-highlighted":f?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:w(e.onPointerMove,Y(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:w(e.onPointerLeave,Y(e=>o.onItemLeave(e))),onFocus:w(e.onFocus,()=>p(!0)),onBlur:w(e.onBlur,()=>p(!1))})})})}),Fe=`MenuCheckboxItem`,Ie=A.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,j.jsx)(We,{scope:e.__scopeMenu,checked:n,children:(0,j.jsx)(K,{role:`menuitemcheckbox`,"aria-checked":J(n)?`mixed`:n,...i,ref:t,"data-state":at(n),onSelect:w(i.onSelect,()=>r?.(J(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ie.displayName=Fe;var Le=`MenuRadioGroup`,[Re,ze]=I(Le,{value:void 0,onValueChange:()=>{}}),Be=A.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=E(r);return(0,j.jsx)(Re,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,j.jsx)(Ae,{...i,ref:t})})});Be.displayName=Le;var Ve=`MenuRadioItem`,He=A.forwardRef((e,t)=>{let{value:n,...r}=e,i=ze(Ve,e.__scopeMenu),a=n===i.value;return(0,j.jsx)(We,{scope:e.__scopeMenu,checked:a,children:(0,j.jsx)(K,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":at(a),onSelect:w(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});He.displayName=Ve;var Ue=`MenuItemIndicator`,[We,Ge]=I(Ue,{checked:!1}),Ke=A.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ge(Ue,n);return(0,j.jsx)(T,{present:r||J(a.checked)||a.checked===!0,children:(0,j.jsx)(d.span,{...i,ref:t,"data-state":at(a.checked)})})});Ke.displayName=Ue;var qe=`MenuSeparator`,Je=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,j.jsx)(d.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Je.displayName=qe;var Ye=`MenuArrow`,Xe=A.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=L(n);return(0,j.jsx)(te,{...i,...r,ref:t})});Xe.displayName=Ye;var Ze=`MenuSub`,[Qe,$e]=I(Ze),et=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=R(Ze,t),o=L(t),[s,c]=A.useState(null),[l,u]=A.useState(null),d=E(i);return A.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,j.jsx)(b,{...o,children:(0,j.jsx)(_e,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,j.jsx)(Qe,{scope:t,contentId:y(),triggerId:y(),trigger:s,onTriggerChange:c,children:n})})})};et.displayName=Ze;var q=`MenuSubTrigger`,tt=A.forwardRef((e,t)=>{let n=R(q,e.__scopeMenu),r=z(q,e.__scopeMenu),i=$e(q,e.__scopeMenu),a=U(q,e.__scopeMenu),o=A.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=A.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return A.useEffect(()=>u,[u]),A.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,j.jsx)(B,{asChild:!0,...l,children:(0,j.jsx)(Pe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":it(n.open),...e,ref:m(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:w(e.onPointerMove,Y(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:w(e.onPointerLeave,Y(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:w(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||fe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});tt.displayName=q;var nt=`MenuSubContent`,rt=A.forwardRef((e,t)=>{let n=Se(H,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=R(H,e.__scopeMenu),o=z(H,e.__scopeMenu),s=$e(nt,e.__scopeMenu),c=A.useRef(null),l=h(t,c);return(0,j.jsx)(F.Provider,{scope:e.__scopeMenu,children:(0,j.jsx)(T,{present:r||a.open,children:(0,j.jsx)(F.Slot,{scope:e.__scopeMenu,children:(0,j.jsx)(W,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:w(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:w(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:w(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=N[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});rt.displayName=nt;function it(e){return e?`open`:`closed`}function J(e){return e===`indeterminate`}function at(e){return J(e)?`indeterminate`:e?`checked`:`unchecked`}function ot(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function st(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ct(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=st(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function lt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ut(e,t){return t?lt({x:e.clientX,y:e.clientY},t):!1}function Y(e){return t=>t.pointerType===`mouse`?e(t):void 0}var dt=ye,ft=B,pt=Ce,mt=Te,ht=Ae,gt=Me,_t=K,vt=Ie,yt=Be,bt=He,xt=Ke,St=Je,Ct=Xe,wt=tt,Tt=rt,X=`DropdownMenu`,[Et,Dt]=_(X,[he]),Z=he(),[Ot,kt]=Et(X),At=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Z(t),l=A.useRef(null),[u,d]=g({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,j.jsx)(Ot,{scope:t,triggerId:y(),triggerRef:l,contentId:y(),open:u,onOpenChange:d,onOpenToggle:A.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,j.jsx)(dt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};At.displayName=X;var jt=`DropdownMenuTrigger`,Mt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=kt(jt,n),o=Z(n);return(0,j.jsx)(ft,{asChild:!0,...o,children:(0,j.jsx)(d.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:m(t,a.triggerRef),onPointerDown:w(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:w(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Mt.displayName=jt;var Nt=`DropdownMenuPortal`,Pt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Z(t);return(0,j.jsx)(pt,{...r,...n})};Pt.displayName=Nt;var Ft=`DropdownMenuContent`,It=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kt(Ft,n),a=Z(n),o=A.useRef(!1);return(0,j.jsx)(mt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:w(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});It.displayName=Ft;var Lt=`DropdownMenuGroup`,Rt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(ht,{...i,...r,ref:t})});Rt.displayName=Lt;var zt=`DropdownMenuLabel`,Bt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(gt,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`DropdownMenuItem`,Ht=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(_t,{...i,...r,ref:t})});Ht.displayName=Vt;var Ut=`DropdownMenuCheckboxItem`,Wt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(vt,{...i,...r,ref:t})});Wt.displayName=Ut;var Gt=`DropdownMenuRadioGroup`,Kt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(yt,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuRadioItem`,Jt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(bt,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuItemIndicator`,Xt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(xt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuSeparator`,Qt=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(St,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=`DropdownMenuArrow`,en=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(Ct,{...i,...r,ref:t})});en.displayName=$t;var tn=`DropdownMenuSubTrigger`,nn=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(wt,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuSubContent`,an=A.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,j.jsx)(Tt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});an.displayName=rn;var on=At,sn=Mt,cn=Pt,ln=It,un=Ht,dn=Qt;function fn({...e}){return(0,j.jsx)(on,{"data-slot":`dropdown-menu`,...e})}function pn({...e}){return(0,j.jsx)(sn,{"data-slot":`dropdown-menu-trigger`,...e})}function mn({className:e,sideOffset:t=4,...n}){return(0,j.jsx)(cn,{children:(0,j.jsx)(ln,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:f(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Q({className:e,inset:t,variant:n=`default`,...r}){return(0,j.jsx)(un,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:f(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function hn({className:e,...t}){return(0,j.jsx)(dn,{"data-slot":`dropdown-menu-separator`,className:f(`-mx-1 my-1 h-px bg-border`,e),...t})}var $=null,gn=null;function _n(){let[e,t]=(0,A.useState)(()=>$?{...$,isLoading:!1}:{defaultRunMode:`local`,hasFarm:!1,isLoading:!0});return(0,A.useEffect)(()=>{if($){t({...$,isLoading:!1});return}gn||=p().then(e=>{let t=e.config,n=t.farm;$={defaultRunMode:t.defaultRunMode===`farm`?`farm`:`local`,hasFarm:!!n?.provider}}).catch(()=>{$={defaultRunMode:`local`,hasFarm:!1}}).finally(()=>{gn=null}),gn.then(()=>{t({...$,isLoading:!1})})},[]),e}function vn({onRun:e,onRunNoCache:r,onPurgeCache:i,disabled:a=!1,size:o=`default`,className:s,label:c,shortcutKey:l}){let{hasFarm:u}=_n(),d=u||!!r||!!i,p=c??`Run`,m=l?(0,j.jsx)(n,{shortcut:l,className:`border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground`}):null;return d?(0,j.jsxs)(`div`,{className:f(`inline-flex items-center`,s),children:[(0,j.jsxs)(v,{size:o,disabled:a,onClick:()=>e(!0),className:`rounded-r-none`,children:[(0,j.jsx)(D,{className:`size-4`}),p,m]}),(0,j.jsxs)(fn,{children:[(0,j.jsx)(pn,{asChild:!0,children:(0,j.jsx)(v,{variant:`default`,size:o,disabled:a,className:`rounded-l-none border-l border-l-primary-foreground/20 px-2`,children:(0,j.jsx)(t,{className:`h-4 w-4`})})}),(0,j.jsxs)(mn,{align:`end`,children:[(0,j.jsxs)(Q,{onClick:()=>e(!0),children:[(0,j.jsx)(k,{className:`mr-2 h-4 w-4`}),`Run Local`]}),u&&(0,j.jsxs)(Q,{onClick:()=>e(!1),children:[(0,j.jsx)(O,{className:`mr-2 h-4 w-4`}),`Run on Farm`]}),(r||i)&&(0,j.jsx)(hn,{}),r&&(0,j.jsx)(Q,{onClick:()=>r(!0),children:`Run without cache`}),i&&(0,j.jsx)(Q,{onClick:i,children:`Purge cache`})]})]})]}):(0,j.jsxs)(v,{size:o,disabled:a,onClick:()=>e(!0),className:s,children:[(0,j.jsx)(D,{className:`size-4`}),p,m]})}export{Q as a,O as c,mn as i,_n as n,pn as o,fn as r,k as s,vn as t};
@@ -1 +0,0 @@
1
- import{Yn as e}from"./index-C3AdCkmj.js";var t=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]);export{t};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{c as t}from"./id-badge-BpTnHwvn.js";import{t as n}from"./monaco-editor-BEWq4fzI.js";import{n as r}from"./split-button-CRYV8xU8.js";import{a as i,c as a,i as o,n as ee,o as te,r as ne,s as re,t as s}from"./filename-validation-wKCpNal3.js";import{t as ie}from"./use-page-title-CsUoFrfG.js";import{a as ae,n as oe}from"./dist-BsGrTrYb.js";import{i as se,n as ce,r as le,t as ue}from"./tabs-BEp-p5jh.js";import{$n as de,Bt as fe,Ct as pe,D as me,Dt as he,E as ge,Ft as c,H as _e,Hn as ve,Lt as ye,Mt as l,Nt as be,Rt as xe,S as Se,Ut as Ce,Vn as u,Vt as we,Xt as Te,dr as Ee,er as d,jt as f,kt as De,lr as Oe,mr as ke,r as Ae,st as je,ur as Me,zt as Ne}from"./index-C3AdCkmj.js";import{n as p,r as Pe,t as Fe}from"./resizable-ugU12HrY.js";import{t as Ie}from"./empty-state-BTFWlITi.js";import{t as Le}from"./use-keyboard-shortcuts-COnAPsDD.js";import{i as Re,n as ze,r as Be,t as Ve}from"./suite-navbar-UATCw4Qb.js";var m=e(ke(),1);function He(e,t){return s(e,t,`suiteMatch`)}var h=de(),Ue=`name: My Suite
2
- target: ""
3
- tests: []
4
- `;function We(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ge(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function Ke({text:e}){return(0,h.jsxs)(l,{children:[(0,h.jsx)(c,{asChild:!0,children:(0,h.jsx)(u,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,h.jsx)(be,{className:`max-w-[250px] text-[13px]`,children:e})]})}function g(){let e=Me()[`suite-id`]??``,s=Oe(),[de]=Ee(),c=Te(),{defaultRunMode:l}=r(),{targets:be,globalUse:u,isLoading:ke}=t(),g=!e,qe=de.get(`live`)===`1`,_=(0,m.useRef)(null),v=(0,m.useRef)(null),Je=(0,m.useRef)(()=>{}),Ye=(0,m.useRef)(!1),y=(0,m.useRef)(null),b=(0,m.useRef)(null),[x,S]=(0,m.useState)(g?Ue:``),[Xe,Ze]=(0,m.useState)(``),[C,Qe]=(0,m.useState)(``),[w,$e]=(0,m.useState)(!g),[T,et]=(0,m.useState)(!1),[tt,nt]=(0,m.useState)(!1),[rt,it]=(0,m.useState)(!1),[at,ot]=(0,m.useState)(!1),[E,st]=(0,m.useState)(null),[ct,lt]=(0,m.useState)(!1),[ut,dt]=(0,m.useState)(!1),[ft,pt]=(0,m.useState)([]),[D,O]=(0,m.useState)(null),[k,A]=(0,m.useState)(null),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(!1),[F,I]=(0,m.useState)(null),[mt,L]=(0,m.useState)(`reasoning`),[ht,R]=(0,m.useState)(null),[z,B]=(0,m.useState)({setup:[],teardown:[]}),[V,gt]=(0,m.useState)(``),_t=!g&&x!==Xe,vt=g&&C?He(C.trim(),ft):null,H=g&&!!C&&!!vt,{suggestions:yt}=ee(null),bt=(0,m.useMemo)(()=>yt.filter(e=>e.namespace!==`capture`),[yt]),U=(0,m.useMemo)(()=>Be(x),[x]),xt=U?.suiteId??``,W=U?.name||(g?`New Suite`:V),G=o(D,{tests:(0,m.useMemo)(()=>U?U.tests.map(e=>({draftId:e.id,testId:e.id,path:e.test,name:e.test.split(`/`).pop()??e.test,steps:[],setup:[],teardown:[]})):[],[U]),setupHooks:z.setup,teardownHooks:z.teardown,allowReconnect:!1}),K=G.terminateSession;v.current=D,Je.current=K;let St=U?.target?.trim()??``,q=N?`connecting`:G.connectionState,J=D!==null,Y=J&&U!==null&&(!We(U.setup??[],z.setup)||!We(U.teardown??[],z.teardown)),Ct=J&&q===`connected`&&U!==null&&U.tests.length>0,wt=N||J,Tt=N||J||at||E!==null||g||U===null||!U?.target.trim()||ke;ie((0,m.useMemo)(()=>J&&k!==null?`Live #${k} — ${U?.name?.trim()||W||`Suite`}`:g?`New Suite`:`Edit Suite`,[J,k,U?.name,W,g]));let X=(0,m.useMemo)(()=>{if(U)return{suiteName:U.name,suiteContext:U.context||void 0}},[U]),Et=(0,m.useMemo)(()=>F===`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.`}:F===`disconnected`?{reason:`disconnected`,title:`Live session disconnected`,description:`The connection dropped and the disposable session was terminated. Start a fresh session to reconnect.`}:null,[F]);(0,m.useEffect)(()=>{if(g)return;let t=!1;return je(e).then(e=>{t||(S(e.content),Ze(e.content),gt(e.path),$e(!1))}).catch(()=>{t||(et(!0),$e(!1))}),()=>{t=!0}},[e,g]),(0,m.useEffect)(()=>{let e=!1;return _e().then(t=>{if(e)return;let n=t.config?.workspace?.suiteMatch;Array.isArray(n)&&pt(n)}).catch(()=>{}),()=>{e=!0}},[]),(0,m.useEffect)(()=>{g&&S(e=>Re(e,[`suite-id`],oe()))},[g]),(0,m.useEffect)(()=>{if(g||w)return;let e=Be(x);e&&!e.suiteId&&S(e=>Re(e,[`suite-id`],oe()))},[g,w,Xe]);let Z=(0,m.useCallback)(async()=>{nt(!0);try{if(g){let e=He(C.trim(),ft);if(e){f.error(e);return}await me(C.trim(),x),f.success(`Suite file created`);let t=U?.suiteId??``;if(!t){f.error(`Created suite is missing suite-id; please reload`);return}s(d.suiteEdit(t))}else await he(e,x),Ze(x),f.success(`Saved`)}catch(e){e instanceof Se&&e.missingTests&&e.missingTests.length>0?f.error(`Cannot save — referenced tests not found: ${e.missingTests.map(e=>e.test).join(`, `)}`):f.error(`Failed to save: ${e instanceof Error?e.message:String(e)}`)}finally{nt(!1)}},[g,C,ft,x,e,U?.suiteId,s]),Dt=(0,m.useCallback)(async()=>{it(!0);try{let e=await De(x);e.valid?f.success(`Valid suite`):f.error(e.errors.map(e=>e.message).join(`
5
- `))}catch(e){f.error(`Validation failed: ${e instanceof Error?e.message:String(e)}`)}finally{it(!1)}},[x]),Ot=(0,m.useCallback)(async e=>{if(!g){ot(!0);try{st((await pe({file:V,local:e})).runId),f.success(`Suite run started`)}catch(e){f.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`)}finally{ot(!1)}}},[g,V]),kt=(0,m.useCallback)(()=>st(null),[]),At=(0,m.useCallback)(()=>{i(`page`,`closing live mode`,{liveSessionId:D??void 0,terminalReason:F??void 0}),_.current?.abort(),_.current=null,D&&K(),P(!1),O(null),A(null),I(null),R(null),y.current=null,b.current=null,B({setup:[],teardown:[]}),M(!1)},[D,F,K]),jt=(0,m.useCallback)(()=>{i(`page`,`ending live session from UI`,{liveSessionId:D??void 0}),_.current?.abort(),_.current=null,D&&K(),P(!1),O(null),A(null),I(`ended`),R(null),y.current=null,b.current=null,B({setup:[],teardown:[]}),M(!1)},[D,K]),Q=(0,m.useCallback)(async(e,t)=>{let n=e.target.trim();if(!n){f.error(`Select a target before starting live mode`);return}let r=new AbortController;_.current?.abort(),_.current=r,M(!0),I(null),L(`reasoning`),R(null),y.current=null,b.current=null,P(!0);try{t?.replaceCurrentSession&&v.current&&(K(),O(null),A(null));let a=ne({content:x,targetName:n,targets:be,globalUse:u});i(`page`,`requesting live session`,{targetName:n,platform:a.platform,headless:a.headless??void 0,replacingSession:t?.replaceCurrentSession??!1});let o=[...e.setup??[]],ee=[...e.teardown??[]],te=e.suiteId?{type:`suite`,id:e.suiteId}:void 0,{sessionId:re,sessionNumber:s}=await ge({...a,setupHooks:o,teardownHooks:ee,entity:te},r.signal);if(r.signal.aborted)return;B({setup:o,teardown:ee}),O(re),A(s),i(`page`,`live session created`,{sessionId:re,targetName:n})}catch(e){Ge(e)||(i(`page`,`failed to create live session`,{error:e instanceof Error?e.message:String(e),targetName:n}),f.error(e instanceof Error?e.message:`Failed to start live session`)),t?.replaceCurrentSession||M(!1)}finally{_.current===r&&(_.current=null),P(!1)}},[x,u,be,K]),$=(0,m.useCallback)(async()=>{if(!Tt){if(!U){f.error(`Fix YAML errors before starting live mode`);return}await Q(U)}},[U,Q,Tt]),Mt=(0,m.useCallback)(async()=>{if(J){if(!U){f.error(`Fix YAML errors before restarting live mode`);return}await Q(U,{replaceCurrentSession:!0})}},[U,J,Q]),Nt=(0,m.useCallback)(e=>{if(e){M(!0);return}At()},[At]),Pt=(0,m.useCallback)((e,t)=>{if(!J){f.error(`Start a live session first.`);return}let n=(e===`setup`?G.setupHooks:G.teardownHooks).find(e=>e.id===t);n&&R({type:`suite-hook`,phase:e,hookId:n.id}),L(`reasoning`),G.executeHookById(e,t)},[J,G]),Ft=(0,m.useCallback)(e=>{R({type:`test`,testIndex:e}),L(`reasoning`),G.executeTestByIndex(e,X)},[X,G]);if((0,m.useEffect)(()=>()=>{_.current?.abort(),v.current&&Je.current()},[]),(0,m.useEffect)(()=>{D&&q===`disconnected`&&(i(`page`,`live session moved to terminal state`,{liveSessionId:D,liveConnectionState:q}),O(null),A(null),P(!1),I(`disconnected`),R(null),y.current=null,b.current=null,B({setup:[],teardown:[]}),M(!0))},[q,D]),(0,m.useEffect)(()=>{if(!j||G.runningTestIndex===null)return;let e=`${G.tests[G.runningTestIndex]?.testExecutionId??`pending`}:${G.runningTestIndex}`;y.current!==e&&(y.current=e,R({type:`test`,testIndex:G.runningTestIndex}),L(`reasoning`))},[G.runningTestIndex,G.tests,j]),(0,m.useEffect)(()=>{if(!j||G.runningTestIndex!==null)return;let e=G.tests.map((e,t)=>({index:t,test:e})).filter(({test:e})=>e.status===`failed`).sort((e,t)=>(t.test.lastRunAt??``).localeCompare(e.test.lastRunAt??``))[0];if(!e)return;let t=e.test.testExecutionId??e.test.lastRunAt??`failed:${e.index}`;b.current!==t&&(b.current=t,R({type:`test`,testIndex:e.index}),L(`reasoning`))},[G.runningTestIndex,G.tests,j]),(0,m.useEffect)(()=>{!qe||Ye.current||g||w||T||N||j||J||!U||!U.target.trim()||(Ye.current=!0,s(d.suiteEdit(e),{replace:!0}),$())},[U,$,J,g,N,w,j,s,T,e,qe]),Le((0,m.useMemo)(()=>({r:()=>{g||Ot(l===`local`)},escape:()=>{E&&kt()}}),[g,E,Ot,kt,l])),(0,m.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),Z())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Z]),w)return(0,h.jsx)(Ae,{});if(T)return(0,h.jsx)(Ie,{icon:ve,title:`Suite not found`,description:`This suite doesn't exist`,actionLabel:`View All Suites`,onAction:()=>s(d.suites)});let It=(0,h.jsxs)(ue,{defaultValue:`builder`,className:`flex-1 flex min-h-0 flex-col`,children:[(0,h.jsxs)(le,{variant:`line`,className:`px-4`,children:[(0,h.jsx)(se,{value:`builder`,children:`Builder`}),(0,h.jsx)(se,{value:`yaml`,children:`YAML`})]}),(0,h.jsx)(ce,{value:`builder`,className:`mt-2 flex-1 overflow-auto [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb:hover]:bg-muted-foreground/50 [&::-webkit-scrollbar-track]:bg-transparent [scrollbar-width:thin]`,children:(0,h.jsx)(ze,{content:x,onChange:S,suggestions:bt,isCreateMode:g,liveMode:j,liveTests:G.tests,liveSetupHooks:G.setupHooks,liveTeardownHooks:G.teardownHooks,runningTestIndex:G.runningTestIndex,canRunTest:J&&G.connectionState===`connected`,canRunAll:Ct,isRunningAll:G.isRunningAllTests,isStoppingRunAll:G.isStoppingRunAllTests,onRunTest:Ft,onCancelTest:e=>{G.runningTestIndex===e&&G.cancelStep()},onRunAll:()=>void G.runAllTests(X),onStopAll:G.cancelRunAllTests,setupHooksStale:Y,onRestartSession:Y?()=>void Mt():void 0,selection:ht,onSelect:R,onRunLiveHook:Pt})}),(0,h.jsx)(ce,{value:`yaml`,className:`flex-1 min-h-0 mt-2`,children:(0,h.jsx)(n,{value:x,onChange:S,onSave:Z,className:`h-full`,filePath:V||void 0})})]}),Lt=(0,h.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[g&&(0,h.jsx)(`div`,{className:`px-4 pt-3`,children:(0,h.jsxs)(`div`,{className:`rounded-md border bg-muted/15 px-3 py-2`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(ae,{className:`flex items-center gap-1 text-xs font-medium`,children:[`File Path `,(0,h.jsx)(Ke,{text:`Path is relative to your workspace root. Must match your workspace's suiteMatch pattern. Directories are created automatically on save.`})]}),(0,h.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Created only when you save`})]}),(0,h.jsx)(Ce,{placeholder:`my-suite.suite.yaml`,value:C,onChange:e=>Qe(e.target.value),className:`mt-2 max-w-md h-8 text-sm font-mono ${H?`border-red-500 focus-visible:ring-red-500`:``}`}),H&&(0,h.jsx)(`p`,{className:`mt-1 text-xs text-red-500`,children:vt})]})}),It]}),Rt=(0,h.jsx)(te,{connectionState:G.connectionState,isLaunching:N,targetName:St||`Selected Target`,targetLabel:G.currentUrl||`Configured start URL`,liveSessionNumber:k,platform:G.platform,screenshot:G.screenshot,currentUrl:G.currentUrl,pendingNavigation:G.pendingNavigation,steps:G.steps,setupHooks:G.setupHooks,teardownHooks:G.teardownHooks,tests:G.tests,selection:ht,runningStepId:G.runningStepId,terminalState:Et,draftState:U===null?`invalid`:_t||g?`unsaved`:`saved`,ariaTree:G.ariaTree,errorMessage:G.error,devtoolsTab:mt,canRunAll:Ct,isRunningAll:G.isRunningAllTests,isStoppingRunAll:G.isStoppingRunAllTests,setupHooksStale:Y,executionUnit:`test`,runAllLabel:`Run All Tests`,stopAllLabel:`Stop Run All`,unitRowsSlot:null,onDevtoolsTabChange:L,onRunAll:()=>void G.runAllTests(X),onStopAll:G.cancelRunAllTests,onEndSession:jt,onRestartSession:Y?()=>void Mt():void 0,showEndSessionAction:c,onCloseLiveMode:At,onStartFreshSession:()=>void $(),onBack:G.goBack,onForward:G.goForward,onRefresh:G.refreshPage,onNavigate:G.navigate,onRequestAriaTree:G.requestAriaTree});return(0,h.jsxs)(`div`,{className:`flex h-screen flex-col`,children:[(0,h.jsx)(Ve,{suiteName:W,suiteId:xt,unsaved:_t,isCreateMode:g,mode:`edit`,suiteHref:g?void 0:d.suiteView(e),isSaving:tt,isValidating:rt,isRunning:at,runDisabled:wt,hasInvalidFilename:H,shortcutsOpen:ut,hasLiveSession:J,liveConnectionState:q,isLiveActionDisabled:Tt,liveSessionNumber:k,onBack:()=>s(d.suites),onSave:Z,onValidate:Dt,onRun:Ot,onLiveConnect:j?void 0:$,onLiveEnd:J?jt:void 0,onSettingsOpen:()=>lt(!0),onToggleShortcuts:()=>dt(e=>!e)}),E?(0,h.jsxs)(Pe,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,h.jsx)(p,{defaultSize:60,minSize:30,children:(0,h.jsx)(n,{value:x,onChange:S,onSave:Z,className:`h-full`})}),(0,h.jsx)(Fe,{withHandle:!0}),(0,h.jsx)(p,{defaultSize:40,minSize:25,children:(0,h.jsx)(re,{runId:E,onClose:kt})})]}):j&&!c?(0,h.jsxs)(Pe,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,h.jsx)(p,{defaultSize:45,minSize:30,children:Lt}),(0,h.jsx)(Fe,{withHandle:!0}),(0,h.jsx)(p,{defaultSize:55,minSize:40,children:Rt})]}):Lt,(0,h.jsx)(ye,{open:ct,onOpenChange:lt,children:(0,h.jsxs)(xe,{side:`right`,className:`sm:max-w-[400px] overflow-y-auto p-0`,children:[(0,h.jsxs)(fe,{className:`px-4 pt-4 pb-2`,children:[(0,h.jsx)(we,{children:`Suite Settings`}),(0,h.jsx)(Ne,{children:`Advanced configuration for this suite`})]}),(0,h.jsx)(`div`,{className:`px-4 pb-4`,children:(0,h.jsx)(a,{content:x,onChange:S,selectedTarget:U?.target,showMeta:!1})})]})}),c&&(0,h.jsx)(ye,{open:j,onOpenChange:Nt,children:(0,h.jsxs)(xe,{side:`bottom`,showCloseButton:!1,className:`h-[100dvh] max-h-[100dvh] rounded-none p-0`,children:[(0,h.jsxs)(fe,{className:`sr-only`,children:[(0,h.jsx)(we,{children:`Live Session`}),(0,h.jsx)(Ne,{children:`Live execution workspace for the current suite draft.`})]}),Rt]})})]})}export{g as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as i,t as a}from"./select-D0GpDfUa.js";import{t as o}from"./circle-alert-D7wbtVU2.js";import{C as s,S as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as ee,y as te}from"./id-badge-BpTnHwvn.js";import{n as ne,r as O}from"./monaco-editor-BEWq4fzI.js";import{t as re}from"./circle-x-BOV-jCVR.js";import{c as ie,t as k}from"./split-button-CRYV8xU8.js";import{t as ae}from"./grip-vertical-C5AW4fiD.js";import{n as A,r as j,t as M}from"./shortcut-hints-B8kCurzo.js";import{t as oe}from"./plus-Bf5Mbita.js";import{t as N}from"./refresh-cw-D0OwRzvm.js";import{n as P,t as F}from"./textarea-BFsDx2mB.js";import{t as se}from"./square-K8N8Yius.js";import{a as I,n as L}from"./dist-BsGrTrYb.js";import{n as ce,r as R,t as z}from"./popover-OAiTzjiL.js";import{$n as B,Bn as le,Fn as V,Ft as H,Gn as U,Gt as W,In as ue,Mt as G,Nt as K,Pn as de,Ut as fe,Vn as q,Wn as J,Wt as Y,c as pe,cr as X,d as me,ft as he,l as ge,mr as _e,o as ve,s as ye,u as be,zn as xe}from"./index-C3AdCkmj.js";import{t as Se}from"./badge-ClWCtaXi.js";import{t as Ce}from"./display-step-vpHdm2LX.js";var Z=e(_e(),1),Q=B();function we({text:e}){return(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(q,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,Q.jsx)(K,{className:`max-w-[250px] text-[13px]`,children:e})]})}function Te({name:e,suiteId:o,target:c,context:l,isCreateMode:d,suggestions:p,hookLabels:m={},onChange:h,disabled:g=!1}){let{targets:v,isLoading:y}=_(),{targets:x}=f(),S=c?x[c]:void 0,w=(0,Z.useRef)(null),[T,E]=(0,Z.useState)(0),D=u({text:l,cursorPos:T,suggestions:p,anchorRef:w,onInsert:(e,t,n)=>{h(`context`,l.slice(0,t)+e+l.slice(n)),requestAnimationFrame(()=>w.current?.focus())}}),ee=!y&&v.length>0;return(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(I,{htmlFor:`suite-name`,className:`text-xs flex items-center gap-1`,children:[`Suite Name `,(0,Q.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,Q.jsx)(fe,{id:`suite-name`,value:e,onChange:e=>h(`name`,e.target.value),placeholder:`My Suite`,required:!0,disabled:g,className:`h-8 text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(I,{htmlFor:`suite-id`,className:`text-xs flex items-center gap-1`,children:[`Suite ID `,(0,Q.jsx)(we,{text:`Unique identifier used for memory and analytics. Changing this breaks the association with past runs and observations.`})]}),d?(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(fe,{id:`suite-id`,value:o,readOnly:!0,disabled:!0,className:`h-8 text-sm font-mono pr-9`}),(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>h(`suite-id`,L()),"aria-label":`Generate new ID`,disabled:g,className:`absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6`,children:(0,Q.jsx)(N,{className:`size-3.5`})})]}):(0,Q.jsx)(`p`,{className:`text-[13px] font-mono text-muted-foreground`,children:o||`No ID assigned`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(I,{htmlFor:`suite-target`,className:`text-xs flex items-center gap-1`,children:[`Target `,(0,Q.jsx)(`span`,{className:`text-destructive`,children:`*`}),` `,(0,Q.jsx)(we,{text:`A registered app target from your workspace config. Defines where the suite runs (web URL or mobile app).`})]}),ee?(0,Q.jsxs)(a,{value:c||void 0,onValueChange:e=>h(`target`,e),disabled:g,children:[(0,Q.jsx)(r,{id:`suite-target`,className:`w-full h-8 text-sm`,children:(0,Q.jsx)(i,{placeholder:`Select a target`})}),(0,Q.jsx)(n,{children:v.map(e=>(0,Q.jsx)(t,{value:e,children:e},e))})]}):y?null:(0,Q.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No targets configured.`,` `,(0,Q.jsx)(X,{to:`/config`,className:`text-primary underline underline-offset-4 hover:text-primary/80`,children:`Add targets in Settings.`})]}),S&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted-foreground mt-1.5`,children:[S.platform===`web`?(0,Q.jsx)(ie,{className:`h-3.5 w-3.5 shrink-0`}):(0,Q.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground/70 uppercase text-[11px] tracking-wider shrink-0`,children:S.platform}),(0,Q.jsxs)(`span`,{className:`font-mono truncate`,children:[S.product&&(0,Q.jsx)(`span`,{className:`mr-1.5`,children:S.product}),S.platform===`web`&&S.url,S.platform===`android`&&`${S.appPackage}${S.appActivity?` / ${S.appActivity}`:``}`,S.platform===`ios`&&S.bundleId]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(I,{htmlFor:`suite-context`,className:`text-xs flex items-center gap-1`,children:[`Context `,(0,Q.jsx)(we,{text:`Additional instructions passed to every test in this suite before its own context. Use this for suite-wide setup notes or shared preconditions.`})]}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(F,{ref:w,id:`suite-context`,value:l,onChange:e=>{h(`context`,e.target.value),E(e.target.selectionStart??0)},onKeyDown:e=>{D.handleKeyDown(e)},onBlur:()=>setTimeout(()=>D.setVisible(!1),150),placeholder:`Additional instructions applied to every test in this suite...`,disabled:g,className:`min-h-[60px] resize-none text-sm`,rows:2}),D.dropdown]}),C(l)&&(0,Q.jsx)(b,{text:l,hookLabels:m})]})]})}function Ee(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function De({status:e}){switch(e){case`running`:return(0,Q.jsx)(D,{className:`size-3 text-primary`});case`passed`:return(0,Q.jsx)(J,{className:`size-3 text-emerald-500`});case`failed`:return(0,Q.jsx)(ue,{className:`size-3 text-destructive`});default:return(0,Q.jsx)(V,{className:`size-3 text-muted-foreground`})}}function Oe({status:e}){switch(e){case`running`:case`cancelling`:return(0,Q.jsx)(D,{className:`size-3 text-primary`});case`passed`:return(0,Q.jsx)(J,{className:`size-3 text-emerald-500`});case`failed`:return(0,Q.jsx)(re,{className:`size-3 text-red-500`});case`cancelled`:return(0,Q.jsx)(se,{className:`size-3 text-amber-500`});default:return(0,Q.jsx)(D,{className:`size-3 text-muted-foreground/50`})}}function ke(e){return e.observation?e.observation:e.reasoning?e.reasoning:e.plannedAction==null?e.verifierReasoning?e.verifierReasoning:e.result:`Planned action captured`}function Ae({id:e,name:t,path:n,testId:r,isMissing:i,onRemove:a,disabled:o=!1,actionsLocked:s=!1,sortableDisabled:l=!1,liveMode:u=!1,liveStatus:d=`idle`,liveDuration:f,liveError:p=null,liveSteps:m=[],runningStepIndex:h=null,perTestSetupHooks:g=[],perTestTeardownHooks:_=[],canRunTest:y=!0,onRunTest:b,onCancelTest:x,testIndex:S,selection:C=null,onSelect:w}){let{attributes:T,listeners:E,setNodeRef:ee,transform:te,transition:ne,isDragging:O}=v({id:e,disabled:o||l}),ie={transform:c.Transform.toString(te),transition:ne,opacity:O?.55:1,zIndex:O?10:void 0},k=u&&d===`running`,A=u&&d===`passed`,j=u&&d===`failed`,M=u&&(A||j||u&&d===`cancelled`)&&f!=null,oe=u&&C?.type===`test`&&S!==void 0&&C.testIndex===S,N=u&&g.length+_.length>0,P=u?m.map(e=>({step:e,displayStep:Ce(e,e.stepIndex)})):[],F=C&&`stepId`in C?C.stepId:null,I=C?.type===`subaction`?C.subIndex:null;return(0,Q.jsxs)(`div`,{ref:ee,style:ie,className:W(`relative overflow-hidden flex flex-col gap-0.5 rounded-md border bg-card/60 px-3 py-2 hover:bg-card transition-colors`,i&&`border-amber-500/30`,i&&`bg-amber-500/[0.06]`,!i&&`border-border/70`,O&&`shadow-lg ring-2 ring-primary/20`,o&&`opacity-60`,k&&`live-running-surface border-border/60 bg-primary/5`,j&&!k&&`border-destructive/30`,j&&!k&&!oe&&`ring-1 ring-destructive/20`,oe&&!k&&`bg-primary/10 ring-1 ring-primary/30`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`mt-0.5 flex shrink-0 items-center p-0.5 text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing touch-none disabled:cursor-not-allowed`,...T,...E,"aria-label":`Reorder ${t}`,"aria-disabled":o||l,disabled:o||l,children:(0,Q.jsx)(ae,{className:`size-3.5`})}),k&&(0,Q.jsx)(D,{className:`size-4 shrink-0 mt-0.5 text-primary`}),A&&(0,Q.jsx)(J,{className:`size-3.5 text-emerald-500 shrink-0 mt-1`}),j&&(0,Q.jsx)(re,{className:`size-3.5 text-red-500 shrink-0 mt-1`}),(0,Q.jsxs)(`div`,{className:W(`flex-1 min-w-0 space-y-0.5`,u&&w&&`cursor-pointer`),onClick:u&&w&&S!==void 0?()=>w({type:`test`,testIndex:S}):void 0,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:t}),(0,Q.jsx)(`div`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:n}),(0,Q.jsx)(`div`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:r}),P.length>0&&(0,Q.jsx)(`div`,{className:`mt-1.5 space-y-1.5`,children:P.map(({step:e,displayStep:t},n)=>{let r=e.status===`running`||h===e.stepIndex,i=oe&&F===null&&(r||h===null&&n===P.length-1),a=F===e.id||i,o=t.subActionsData??[];return(0,Q.jsxs)(`div`,{className:W(`relative overflow-hidden rounded-sm border bg-background/60`,r?`live-running-surface border-border/60 bg-primary/5`:a?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-border/60`),children:[(0,Q.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left`,onClick:t=>{t.stopPropagation(),w?.({type:`step`,stepId:e.id})},"aria-label":`Select step ${e.stepIndex+1} ${e.instruction}`,children:[(0,Q.jsx)(Oe,{status:e.status}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[`Step `,e.stepIndex+1]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:e.instruction})]}),(r||a)&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-2 gap-y-0.5 px-2 pb-1 text-[11px] text-muted-foreground`,children:[r&&(0,Q.jsx)(`span`,{children:`Current step`}),a&&(0,Q.jsx)(`span`,{children:`Inspecting below`})]}),o.length>0&&(0,Q.jsx)(`div`,{className:`space-y-1 border-t border-border/50 px-2 py-1.5`,children:o.map(t=>(0,Q.jsxs)(`button`,{type:`button`,className:W(`flex w-full min-w-0 items-center gap-2 rounded-sm px-1.5 py-1 text-left text-[11px] transition-colors`,a&&I===t.index?`bg-primary/15 text-foreground`:`text-muted-foreground hover:bg-muted/40`),onClick:n=>{n.stopPropagation(),w?.({type:`subaction`,stepId:e.id,subIndex:t.index})},"aria-label":`Select sub-action ${t.index+1} for step ${e.stepIndex+1}`,children:[(0,Q.jsxs)(`span`,{className:`shrink-0 font-medium`,children:[`Sub `,t.index+1]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:ke(t)})]},`${e.id}-sub-${t.index}`))})]},e.id)})}),i&&(0,Q.jsx)(`div`,{className:`text-[11px] text-amber-700 dark:text-amber-300`,children:`This test file no longer exists in your workspace.`})]}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex shrink-0 self-start items-center gap-1`,children:[M&&(0,Q.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground whitespace-nowrap shrink-0`,children:Ee(f)}),u&&!k&&(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:b,disabled:!y||!b||s,className:W(`text-muted-foreground hover:text-foreground`,(!y||!b||s)&&`text-muted-foreground/30`),"aria-label":d===`idle`?`Run test ${t}`:`Re-run test ${t}`,children:(0,Q.jsx)(xe,{className:`size-3.5`})}),u&&k&&x&&(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:x,className:`text-muted-foreground hover:text-foreground`,"aria-label":`Cancel test ${t}`,children:(0,Q.jsx)(se,{className:`size-3`})}),(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-destructive`,onClick:a,disabled:o||s,"aria-label":`Remove ${t}`,children:(0,Q.jsx)(de,{className:`size-3.5`})})]})]}),j&&p&&(0,Q.jsxs)(`p`,{className:`text-destructive text-xs mt-1 ml-7 line-clamp-2`,children:[p,` — see Reasoning tab for details`]}),N&&(0,Q.jsxs)(`ul`,{className:`mt-1.5 space-y-1 pl-5`,children:[g.map(e=>{let t=C?.type===`test-hook`&&C.hookId===e.id;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>S!==void 0&&w?.({type:`test-hook`,testIndex:S,phase:`setup`,hookId:e.id}),className:W(`relative flex w-full items-center gap-2 overflow-hidden rounded-sm border px-1.5 py-0.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-transparent bg-transparent hover:bg-muted/40`),children:[(0,Q.jsx)(V,{className:`size-3 text-muted-foreground shrink-0`}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate flex-1`,children:[`setup: `,e.name]}),(0,Q.jsx)(De,{status:e.status})]})},`setup-${e.id}`)}),_.map(e=>{let t=C?.type===`test-hook`&&C.hookId===e.id;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>S!==void 0&&w?.({type:`test-hook`,testIndex:S,phase:`teardown`,hookId:e.id}),className:W(`relative flex w-full items-center gap-2 overflow-hidden rounded-sm border px-1.5 py-0.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-transparent bg-transparent hover:bg-muted/40`),children:[(0,Q.jsx)(V,{className:`size-3 text-muted-foreground shrink-0`}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate flex-1`,children:[`teardown: `,e.name]}),(0,Q.jsx)(De,{status:e.status})]})},`teardown-${e.id}`)})]})]})}function je({availableTests:e,onAdd:t,disabled:n=!1}){return e.length===0?(0,Q.jsxs)(`div`,{className:`rounded-md border bg-card/20 p-3 text-sm text-muted-foreground`,children:[`No test files found.`,` `,(0,Q.jsx)(X,{to:`/tests/new`,className:`text-primary underline underline-offset-4 hover:text-primary/80`,children:`Create a test first.`})]}):(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(ve,{className:`rounded-md border`,children:[(0,Q.jsx)(ge,{placeholder:`Search by test name, path, or ID...`,disabled:n}),(0,Q.jsxs)(me,{className:`max-h-64`,children:[(0,Q.jsx)(ye,{children:`No tests match your query.`}),(0,Q.jsx)(pe,{children:e.map(e=>(0,Q.jsx)(be,{value:`${e.name} ${e.path} ${e.testId??``}`,onSelect:()=>t({test:e.path,id:e.testId??``}),disabled:n,className:`px-2 py-1.5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5 w-full min-w-0`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:e.path}),(0,Q.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:e.testId??``})]})},e.path))})]})]}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60`,children:`Type to filter by name, path, or test ID. Click to add. Same test can be added multiple times.`})]})}var $=[`name`,`suite-id`,`target`,`use`,`context`,`setup`,`tests`,`teardown`];function Me(e){function t(e,n){if(S(e)){n?e.items.sort((e,t)=>{let n=$.indexOf(String(e.key)),r=$.indexOf(String(t.key));return(n===-1?$.length:n)-(r===-1?$.length:r)}):e.items.sort((e,t)=>String(e.key).localeCompare(String(t.key)));for(let n of e.items)t(n.value,!1)}}t(e.contents,!0)}function Ne(e){return Me(e),e.toString()}function Pe(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Fe(e){return Array.isArray(e)?e.map(e=>{if(e&&typeof e==`object`&&`test`in e&&`id`in e){let t=e;if(typeof t.test==`string`&&typeof t.id==`string`)return{test:t.test,id:t.id}}return null}).filter(e=>e!==null):[]}function Ie(e){try{let t=y(e);if(t.errors.length>0)return null;let n=t.toJSON();return!n||typeof n!=`object`?null:{name:n.name??``,suiteId:n[`suite-id`]??``,target:n.target??``,context:n.context??``,setup:Pe(n.setup),teardown:Pe(n.teardown),tests:Fe(n.tests)}}catch{return null}}function Le(e,t,n){try{let r=y(e);return n===void 0||Array.isArray(n)&&n.length===0||n===``?r.deleteIn(t):r.setIn(t,n),Ne(r)}catch{return e}}function Re(e,t,n){try{if(t===n||t<0||n<0)return e;let r=y(e),i=Fe(r.toJSON()?.tests);if(t>=i.length||n>=i.length)return e;let a=[...i],[o]=a.splice(t,1);return a.splice(n,0,o),r.setIn([`tests`],a),Ne(r)}catch{return e}}function ze(e,t){try{let n=y(e),r=Fe(n.toJSON()?.tests);return n.setIn([`tests`],[...r,t]),Ne(n)}catch{return e}}function Be(e,t){try{let n=y(e),r=Fe(n.toJSON()?.tests);if(t<0||t>=r.length)return e;let i=r.filter((e,n)=>n!==t);return i.length===0?n.deleteIn([`tests`]):n.setIn([`tests`],i),Ne(n)}catch{return e}}function Ve({text:e}){return(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(q,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,Q.jsx)(K,{className:`max-w-[250px] text-[13px]`,children:e})]})}function He({status:e}){switch(e){case`running`:return(0,Q.jsx)(D,{className:`size-3.5 text-primary`});case`passed`:return(0,Q.jsx)(J,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,Q.jsx)(ue,{className:`size-3.5 text-destructive`});default:return(0,Q.jsx)(V,{className:`size-3.5 text-muted-foreground`})}}function Ue(e){return e===`running`||e===`cancelling`}function We(e){return e===`running`||e===`cancelling`}function Ge(e){return e===`running`}function Ke(e){return e.some(e=>Ge(e.status))}function qe(e){return Ue(e.status)||e.runningStepIndex!==null||e.liveSteps.some(e=>We(e.status))||Ke(e.perTestSetupHooks)||Ke(e.perTestTeardownHooks)}function Je({title:e,hooks:t,selection:n,onSelect:r}){return t.length===0?null:(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider font-medium text-muted-foreground`,children:e}),(0,Q.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>{let t=n?.type===`suite-hook`&&n.hookId===e.id;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r?.({type:`suite-hook`,phase:e.phase,hookId:e.id}),className:W(`relative flex w-full items-center gap-2 overflow-hidden rounded-md border px-3 py-1.5 text-left transition-colors`,e.status===`running`?`live-running-surface border-border/60 bg-primary/5`:t?`border-primary/20 bg-primary/10 ring-1 ring-primary/30`:`border-border/60 bg-card/40 hover:bg-card/60`),children:[(0,Q.jsx)(He,{status:e.status}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,Q.jsx)(`div`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.id})]})]})},e.id)})})]})}function Ye({content:e,onChange:t,disabled:n=!1,suggestions:r,isCreateMode:i=!1,liveMode:a=!1,liveTests:s=[],liveSetupHooks:c=[],liveTeardownHooks:u=[],runningTestIndex:f=null,canRunTest:_=!0,canRunAll:v=!1,isRunningAll:y=!1,isStoppingRunAll:b=!1,onRunTest:S,onCancelTest:C,onRunAll:w,onStopAll:D,onRunLiveHook:ne,setupHooksStale:re=!1,onRestartSession:ie,selection:k=null,onSelect:ae}){let A=(0,Z.useRef)(null),{hooks:j,warningCopy:M}=T(),N=j??[],P=(0,Z.useMemo)(()=>Object.fromEntries(N.map(e=>[e.id,e.name])),[N]),[F,I]=(0,Z.useState)([]),[L,ce]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{he().then(e=>I(e.files)).catch(()=>{})},[]),(0,Z.useEffect)(()=>{if(!L)return;function e(e){e.key===`Escape`&&ce(!1)}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L]);let R=Ie(e),z=R===null,B=R??A.current;R&&(A.current=R);let H=ee(d(E,{activationConstraint:{distance:8}}),d(l,{coordinateGetter:x})),U=(0,Z.useCallback)((n,r)=>{t(Le(e,[n],r))},[e,t]),W=(0,Z.useCallback)(n=>{t(ze(e,n))},[e,t]),G=(0,Z.useCallback)(n=>{t(Be(e,n))},[e,t]),K=B?.tests.map((e,t)=>`test-${t}`)??[],de=a&&(y||b),fe=a&&(f!==null||s.some(e=>qe(e))||Ke(c)||Ke(u)),q=de||fe,J=de,pe=n||z||q,X=(0,Z.useCallback)(r=>{if(n||z||q)return;let{active:i,over:a}=r;if(!a||i.id===a.id)return;let o=parseInt(String(i.id).replace(`test-`,``),10),s=parseInt(String(a.id).replace(`test-`,``),10);if(Number.isNaN(o)||Number.isNaN(s))return;let c=Re(e,o,s);c!==e&&t(c)},[e,n,t,q,z]);return(0,Q.jsx)(`div`,{className:`flex flex-col`,children:(0,Q.jsxs)(`div`,{className:`space-y-4 p-4`,children:[z&&(0,Q.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,Q.jsx)(o,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{children:`YAML has errors — builder shows last valid state`})]}),a&&re&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,Q.jsx)(ue,{className:`mt-0.5 size-4 shrink-0`}),(0,Q.jsx)(`span`,{children:`Setup hooks changed — restart session to re-apply the latest setup and teardown hooks.`})]}),ie&&(0,Q.jsx)(Y,{type:`button`,size:`sm`,className:`shrink-0`,onClick:ie,children:`Restart Live Session`})]}),B?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Te,{name:B.name,suiteId:B.suiteId,target:B.target,context:B.context,isCreateMode:i,suggestions:r,hookLabels:P,onChange:U,disabled:n||z}),a&&(0,Q.jsx)(Je,{title:`Setup Hooks (Live)`,hooks:c,selection:k,onSelect:ae}),(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-card/20 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(V,{className:`size-4 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Hooks`})]}),(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[B.setup.length+B.teardown.length,` `,B.setup.length+B.teardown.length===1?`hook`:`hooks`]})]}),M&&(0,Q.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,Q.jsx)(o,{className:`mt-0.5 size-3.5 shrink-0`}),(0,Q.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:M.title}),(0,Q.jsx)(`p`,{children:M.body})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.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,Q.jsx)(p,{phase:`setup`,label:`Setup`,values:B.setup,suggestions:N,disabled:pe,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>U(`setup`,e)}),(0,Q.jsx)(p,{phase:`teardown`,label:`Teardown`,values:B.teardown,suggestions:N,disabled:pe,placeholder:`Search hook names or paste an h_ ID`,onChange:e=>U(`teardown`,e)})]})]}),a&&(0,Q.jsx)(Je,{title:`Teardown Hooks (Live)`,hooks:u,selection:k,onSelect:ae}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[`Tests in Suite`,` `,(0,Q.jsx)(Ve,{text:`Tests run in the order shown. Drag to reorder. The suite fails fast if any referenced test is missing at save.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/50`,children:[B.tests.length,` `,B.tests.length===1?`test`:`tests`]}),a&&(0,Q.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:y?D:w,disabled:b||!y&&!v,children:b?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(le,{className:`size-3.5 animate-spin`}),`Stopping...`]}):y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(se,{className:`size-3.5`}),`Stop Run All`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{className:`size-3.5`}),`Run All Tests`]})})]})]}),B.tests.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tests added yet. Use the picker below.`}):(0,Q.jsx)(h,{sensors:H,collisionDetection:te,onDragEnd:X,children:(0,Q.jsx)(m,{items:K,strategy:g,children:(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:B.tests.map((e,t)=>{let r=F.find(t=>t.path===e.test),i=r?.name??e.test.split(`/`).pop()??e.test,o=F.length>0&&!r,c=a?s[t]:void 0,l=a?_&&f===null&&!J:!0;return(0,Q.jsx)(Ae,{id:`test-${t}`,name:i,path:e.test,testId:e.id,isMissing:o,onRemove:()=>G(t),disabled:n||z,actionsLocked:J,sortableDisabled:q,liveMode:a,liveStatus:c?.status,liveDuration:c?.duration,liveError:c?.error??null,liveSteps:c?.liveSteps??[],runningStepIndex:c?.runningStepIndex??null,perTestSetupHooks:c?.perTestSetupHooks??[],perTestTeardownHooks:c?.perTestTeardownHooks??[],canRunTest:l,onRunTest:a&&S?()=>S(t):void 0,onCancelTest:a&&C?()=>C(t):void 0,testIndex:t,selection:k,onSelect:ae},`test-${t}`)})})})})]}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Available Tests`}),(0,Q.jsxs)(Y,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>ce(e=>!e),disabled:n||z||J,"aria-expanded":L,"aria-controls":`suite-test-picker-region`,children:[(0,Q.jsx)(oe,{className:`size-3`}),L?`Hide picker`:`Add new test`]})]}),L&&(0,Q.jsx)(`div`,{id:`suite-test-picker-region`,children:(0,Q.jsx)(je,{availableTests:F,onAdd:W,disabled:n||z||J})})]})]}):(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12 text-sm text-muted-foreground`,children:`Enter valid YAML to use the visual builder`})]})})}function Xe({suiteName:e,suiteId:t,unsaved:n,isCreateMode:r,mode:i=`view`,suiteHref:a,isSaving:o,isValidating:s,isRunning:c,runDisabled:l=!1,hasInvalidFilename:u,shortcutsOpen:d,showSuiteId:f=!0,hasLiveSession:p=!1,liveConnectionState:m=`idle`,isLiveActionDisabled:h=!1,liveSessionNumber:g=null,onSave:_,onValidate:v,onRun:y,onLiveConnect:b,onLiveEnd:x,onSettingsOpen:S,onToggleShortcuts:C}){let T=i===`view`&&!r,E=!!b||!!x||p||m===`connecting`,D=!r||E,ee=!r&&!T&&i===`edit`,te=`Start a disposable live session for this suite. Setup hooks run on connect, included tests run serially on a shared browser context, teardown hooks run when the session ends, and changes are not saved automatically.`;return(0,Q.jsxs)(`div`,{"data-testid":`suite-navbar-root`,className:`flex h-14 shrink-0 items-center justify-between border-b px-4 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(X,{to:`/suites`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:`Suites`}),(0,Q.jsx)(U,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),r?(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`New Suite`}):a&&!T?(0,Q.jsx)(X,{to:a,className:`truncate text-sm font-medium hover:text-primary transition-colors`,children:e}):(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e}),ee&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:`Edit`})]}),n&&(0,Q.jsx)(Se,{variant:`outline`,className:`text-xs`,children:`Unsaved`}),!T&&!r&&t&&f&&(0,Q.jsx)(w,{label:`S`,value:t})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-3 shrink-0`,children:T?(0,Q.jsxs)(Q.Fragment,{children:[a?(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Q.jsxs)(X,{to:a,children:[`Edit`,(0,Q.jsx)(M,{shortcut:`E`})]})}):(0,Q.jsxs)(Y,{variant:`outline`,size:`sm`,disabled:!0,children:[`Edit`,(0,Q.jsx)(M,{shortcut:`E`})]}),(0,Q.jsx)(k,{onRun:y,disabled:c||l,label:c?`Running...`:`Run`,shortcutKey:`R`,size:`sm`}),E&&(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(Y,{size:`sm`,onClick:b,disabled:h||!b,children:[m===`connecting`?(0,Q.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`,(0,Q.jsx)(M,{shortcut:`L`,className:`border-primary-foreground/20 bg-primary-foreground/10 text-primary-foreground`})]})}),(0,Q.jsx)(K,{className:`max-w-sm text-[13px]`,children:te})]}),!r&&(0,Q.jsxs)(z,{open:d,onOpenChange:e=>{e||C()},children:[(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:C,"aria-label":`Shortcuts`,children:(0,Q.jsx)(j,{className:`h-3.5 w-3.5`})})})}),(0,Q.jsx)(K,{children:`Shortcuts`})]}),(0,Q.jsx)(ce,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,Q.jsx)(`div`,{className:`space-y-3`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,Q.jsx)(A,{hints:[{key:`E`,label:`Edit`},{key:`R`,label:`Run`},{key:`L`,label:`Connect Live Session`}]})]})})})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,disabled:s||u,children:[(0,Q.jsx)(J,{className:`h-3.5 w-3.5`}),s?`Validating...`:`Validate`]}),(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:_,disabled:o||u,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),o?`Saving...`:`Save`]}),(0,Q.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,Q.jsx)(P,{className:`h-3.5 w-3.5`}),`Settings`]}),D&&(0,Q.jsx)(`div`,{className:`h-4 w-px bg-border`}),!r&&(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(k,{onRun:y,disabled:c||l||p,label:c?`Running...`:`Run Suite`,size:`sm`})})}),p&&(0,Q.jsx)(K,{children:`End the live session to queue a new suite run.`})]}),E&&(p&&m!==`connecting`?(0,Q.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:x,disabled:!x,children:[(0,Q.jsx)(se,{className:`h-3.5 w-3.5`}),`End Live Session`]}):(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(Y,{size:`sm`,onClick:b,disabled:h||!b,children:[m===`connecting`?(0,Q.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(O,{className:`h-3.5 w-3.5`}),m===`connecting`?`Connecting...`:`Connect Live Session`]})}),(0,Q.jsx)(K,{className:`max-w-sm text-[13px]`,children:te})]})),!T&&p&&typeof g==`number`&&(m===`connected`||m===`executing`)&&(0,Q.jsxs)(Se,{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,Q.jsxs)(z,{open:d,onOpenChange:e=>{e||C()},children:[(0,Q.jsxs)(G,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(R,{asChild:!0,children:(0,Q.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:C,children:(0,Q.jsx)(j,{className:`h-3.5 w-3.5`})})})}),(0,Q.jsx)(K,{children:`Shortcuts`})]}),(0,Q.jsx)(ce,{align:`end`,sideOffset:8,className:`w-72 p-4`,children:(0,Q.jsx)(`div`,{className:`space-y-3`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium mb-2`,children:`Actions`}),(0,Q.jsx)(A,{hints:[{key:`R`,label:`Run suite`},{key:`Cmd+S`,label:`Save`},{key:`Esc`,label:`Close results panel`}]})]})})})]})]})})]})}export{Le as i,Ye as n,Ie as r,Xe as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./arrow-up-down-D_ErIdrE.js";import{i as n,n as r,o as i,s as a,t as o}from"./select-D0GpDfUa.js";import{n as s,r as c}from"./shortcut-hints-B8kCurzo.js";import{t as ee}from"./plus-Bf5Mbita.js";import{t as te}from"./use-page-title-CsUoFrfG.js";import{t as ne}from"./batch-action-bar-BoqzHfwU.js";import{n as re,t as ie}from"./scroll-area-CX3T8JWh.js";import{$n as l,Ct as u,Ft as ae,Gt as d,Hn as oe,Kt as se,M as ce,Mt as f,Nt as p,Pt as le,Ut as ue,Wt as m,a as de,cr as fe,ct as pe,dr as h,er as g,jt as _,lr as me,mr as v,rt as he}from"./index-C3AdCkmj.js";import{t as y}from"./badge-ClWCtaXi.js";import{a as ge,i as _e,n as ve,o as ye,r as be,t as b}from"./lib-u_ZEFKZp.js";import{a as xe,i as Se,n as Ce,o as x,r as S,t as we}from"./table-BOjrxBBL.js";import{t as Te}from"./empty-state-BTFWlITi.js";import{t as C}from"./use-keyboard-shortcuts-COnAPsDD.js";import{n as w,r as T,t as E}from"./tests-suites-table-widths-D2sc1JmR.js";var D=e(v(),1);function O(){let[e,t]=h(),n=e.get(`status`)??``,r=e.get(`platform`)??``,i=e.get(`sort`)??``,a=e.get(`order`)??`desc`,o=(0,D.useCallback)((e,n)=>{t(t=>{let r=new URLSearchParams(t);return n?r.set(e,n):r.delete(e),r},{replace:!0})},[t]),s=(0,D.useMemo)(()=>i?[{id:i,desc:a===`desc`}]:[],[i,a]),c=(0,D.useRef)(s);return c.current=s,{status:n,platform:r,sort:i,order:a,sorting:s,onSortingChange:(0,D.useCallback)(e=>{let n=typeof e==`function`?e(c.current):e;t(e=>{let t=new URLSearchParams(e);return n.length>0?(t.set(`sort`,n[0].id),t.set(`order`,n[0].desc?`desc`:`asc`)):(t.delete(`sort`),t.delete(`order`)),t},{replace:!0})},[t]),setStatus:(0,D.useCallback)(e=>o(`status`,e),[o]),setPlatform:(0,D.useCallback)(e=>o(`platform`,e),[o])}}var k=l(),Ee=new Set([`passed`,`healed`]),De=new Set([`passed`,`healed`,`failed`,`flaky`,`cancelled`]),Oe=50;function ke(e){return e?e===`ios`?`iOS`:e.charAt(0).toUpperCase()+e.slice(1):`—`}function A(e){return e.createdAt||e.startedAt||e.endedAt||``}function Ae({status:e}){switch(e){case`passed`:return(0,k.jsx)(y,{className:`bg-emerald-500/15 text-emerald-500 border-emerald-500/20`,children:`Passed`});case`failed`:return(0,k.jsx)(y,{variant:`destructive`,children:`Failed`});case`healed`:return(0,k.jsx)(y,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Healed`});case`flaky`:return(0,k.jsx)(y,{className:`bg-amber-500/15 text-amber-500 border-amber-500/20`,children:`Flaky`});case`running`:return(0,k.jsx)(y,{className:`bg-blue-500/15 text-blue-500 border-blue-500/20 animate-pulse`,children:`Running`});case`cancelled`:return(0,k.jsx)(y,{className:`bg-muted text-muted-foreground border-border`,children:`Cancelled`});default:return(0,k.jsx)(y,{variant:`outline`,children:e})}}function je(e){return d(`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 Me(e){return d(`py-2 align-top`,e===`select`&&`px-2`,e===`name`&&`max-w-0 px-3`,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 Ne({isActive:e,isBatchSelected:t}){return d(`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`)}function j(){te(`Suites`);let[e,l]=(0,D.useState)([]),[h,v]=(0,D.useState)([]),[y,j]=(0,D.useState)(!0),[M,N]=(0,D.useState)({}),[Pe,P]=(0,D.useState)(!1),[Fe,Ie]=(0,D.useState)([]),[F,I]=(0,D.useState)(-1),L=(0,D.useRef)([]),R=me(),{status:z,platform:B,sorting:Le,onSortingChange:Re,setStatus:ze,setPlatform:Be}=O();(0,D.useEffect)(()=>{let e=!1;return Promise.all([pe(),he({limit:200})]).then(([t,n])=>{e||(l(t.files),v(n.runs))}).catch(()=>{e||_.error(`Failed to load suites`)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[]);let V=(0,D.useMemo)(()=>e.map(e=>{let t=[...h.filter(t=>t.suiteId&&e.suiteId?t.suiteId===e.suiteId:t.suiteId?!1:t.name===e.name)].sort((e,t)=>A(t).localeCompare(A(e))),n=t.filter(e=>De.has(e.status)),r=n.filter(e=>Ee.has(e.status)).length,i=n.length>0?Math.round(r/n.length*100):null,a=t[0]??null,o=t.find(e=>e.targetName?.trim())??null;return{path:e.path,suiteId:e.suiteId,name:e.name,platform:e.platform??o?.platform??a?.platform??null,lastRunStatus:a?.status??null,lastRun:a,targetName:o?.targetName?.trim()??a?.targetName?.trim()??null,passRate:i,passCount:r,completedRunCount:n.length}}),[e,h]),H=(0,D.useMemo)(()=>{let e=V;return z&&(e=z===`no-runs`?e.filter(e=>!e.lastRunStatus):e.filter(e=>e.lastRunStatus===z)),B&&(e=e.filter(e=>e.platform===B)),e},[V,z,B]),Ve={id:`select`,header:({table:e})=>(0,k.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,k.jsx)(T,{checked:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected()&&`indeterminate`,onCheckedChange:t=>e.toggleAllPageRowsSelected(t),ariaLabel:`Select all`})}),cell:({row:e})=>(0,k.jsx)(T,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(t)}),enableSorting:!1,size:48},U=(0,D.useMemo)(()=>[{accessorKey:`name`,header:({column:e})=>(0,k.jsxs)(m,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Name`,(0,k.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,k.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,k.jsx)(`span`,{className:`block whitespace-normal break-words text-sm font-medium leading-snug text-foreground`,children:e.getValue(`name`)}),(0,k.jsx)(`span`,{className:`block whitespace-normal break-all text-xs leading-snug text-muted-foreground`,children:e.original.path})]}),size:400,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,k.jsxs)(m,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Target`,(0,k.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,k.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,k.jsxs)(m,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Platform`,(0,k.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>(0,k.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:ke(e.getValue(`platform`))})},{accessorKey:`passRate`,header:({column:e})=>(0,k.jsxs)(m,{variant:`ghost`,className:`-ml-4`,onClick:()=>e.toggleSorting(e.getIsSorted()===`asc`),children:[`Pass rate`,(0,k.jsx)(t,{className:`ml-2 h-4 w-4`})]}),cell:({row:e})=>e.original.passRate===null?(0,k.jsxs)(`div`,{className:`space-y-0.5 text-right`,children:[(0,k.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`No runs`}),(0,k.jsx)(`div`,{className:`text-xs tabular-nums text-muted-foreground`,children:`0 completed`})]}):(0,k.jsxs)(`div`,{className:`space-y-0.5 text-right`,children:[(0,k.jsxs)(`div`,{className:`text-sm font-medium tabular-nums text-foreground`,children:[e.original.passRate,`%`]}),(0,k.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,k.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,k.jsxs)(m,{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,k.jsx)(t,{className:`ml-2 h-4 w-4`})]})}),cell:({row:e})=>e.original.lastRun?(0,k.jsxs)(fe,{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,k.jsx)(Ae,{status:e.original.lastRun.status}),(0,k.jsx)(`span`,{className:`whitespace-normal break-words text-xs leading-snug text-muted-foreground`,children:se(A(e.original.lastRun))})]}):(0,k.jsx)(`span`,{className:`block text-sm text-muted-foreground`,children:`No runs`})}],[]),W=(0,D.useMemo)(()=>Object.keys(M).filter(e=>M[e]),[M]),G=(0,D.useMemo)(()=>H.filter(e=>W.includes(e.path)),[H,W]),K=(0,D.useCallback)(async e=>{if(G.length!==0){P(!0);try{let t=await Promise.allSettled(G.map(t=>u({file:t.path,local:e}))),n=t.filter(e=>e.status===`fulfilled`).length,r=t.length-n;r>0?_.error(`${n} runs queued, ${r} failed`):_.success(`${n} runs queued`),N({})}finally{P(!1)}}},[G]),He=(0,D.useCallback)(async e=>{if(G.length!==0){P(!0);try{let t=await Promise.allSettled(G.map(t=>u({file:t.path,noCache:!0,local:e}))),n=t.filter(e=>e.status===`fulfilled`).length,r=t.length-n;r>0?_.error(`${n} runs queued (no cache), ${r} failed`):_.success(`${n} runs queued (no cache)`),N({})}finally{P(!1)}}},[G]),Ue=(0,D.useCallback)(async()=>{if(G.length!==0){P(!0);try{let e=await Promise.allSettled(G.map(e=>ce(e.path))),t=G.filter((t,n)=>e[n]?.status===`fulfilled`),n=new Set(t.map(e=>e.path)),r=e.length-t.length;t.length>0&&(l(e=>e.filter(e=>!n.has(e.path))),N(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e))))),r>0?_.error(`Deleted ${t.length} suite${t.length===1?``:`s`}, ${r} failed`):_.success(`Deleted ${t.length} suite${t.length===1?``:`s`}`)}finally{P(!1)}}},[G]),q=ve({data:H,columns:[Ve,...U],getCoreRowModel:be(),getSortedRowModel:ye(),getFilteredRowModel:_e(),getPaginationRowModel:ge(),onSortingChange:Re,onColumnFiltersChange:Ie,enableRowSelection:!0,onRowSelectionChange:N,getRowId:e=>e.path,state:{sorting:Le,columnFilters:Fe,rowSelection:M},initialState:{pagination:{pageSize:Oe}}}),J=q.getRowModel().rows,Y=q.getColumn(`name`)?.getFilterValue()??``,We=(0,D.useCallback)(e=>{q.getColumn(`name`)?.setFilterValue(e||void 0),q.setPageIndex(0),I(-1),N({})},[q]);C((0,D.useMemo)(()=>{let e=()=>I(e=>Math.min(e+1,J.length-1)),t=()=>I(e=>Math.max(e-1,0));return{j:e,arrowdown:e,k:t,arrowup:t,enter:e=>{if(F>=0&&J[F]){let t=J[F].original;if(!t.suiteId)return;let n=g.suiteView(t.suiteId);e.metaKey||e.ctrlKey?window.open(n,`_blank`):R(n)}}}},[J,F,R])),(0,D.useEffect)(()=>{if(F<0)return;let e=L.current[F];e&&document.activeElement!==e&&e.focus()},[F,J.length]);let X=(0,D.useCallback)((e,t)=>{e.suiteId&&(t&&t.preventDefault(),R(g.suiteView(e.suiteId)))},[R]);if(y)return(0,k.jsx)(de,{});if(e.length===0)return(0,k.jsx)(Te,{icon:oe,title:`No suites found`,description:`Create your first suite file`,actionLabel:`New Suite`,onAction:()=>R(g.suiteNew)});let Z=q.getFilteredRowModel().rows.length,Ge=q.getState().pagination.pageIndex,Q=q.getState().pagination.pageSize,$=Ge*Q+1,Ke=Math.min($+Q-1,Z);return(0,k.jsx)(le,{children:(0,k.jsxs)(`div`,{className:`space-y-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,k.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Suites`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(f,{children:[(0,k.jsx)(ae,{asChild:!0,children:(0,k.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Keyboard shortcuts`,children:(0,k.jsx)(c,{className:`h-4 w-4`})})}),(0,k.jsx)(p,{side:`bottom`,className:`p-3`,children:(0,k.jsx)(s,{hints:[{key:`J / ↓`,label:`Next row`},{key:`K / ↑`,label:`Previous row`},{key:`Enter`,label:`Open suite`},{key:`⌘+Enter`,label:`Open in new tab`}]})})]}),(0,k.jsxs)(m,{size:`sm`,onClick:()=>R(g.suiteNew),children:[(0,k.jsx)(ee,{className:`size-4`}),`New Suite`]})]})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,k.jsx)(ue,{placeholder:`Search suites...`,value:Y,onChange:e=>We(e.target.value),className:`max-w-[220px]`}),(0,k.jsxs)(o,{value:z||`all`,onValueChange:e=>{ze(e===`all`?``:e),I(-1),N({})},children:[(0,k.jsx)(i,{className:`w-[150px]`,children:(0,k.jsx)(a,{placeholder:`All statuses`})}),(0,k.jsxs)(r,{children:[(0,k.jsx)(n,{value:`all`,children:`All statuses`}),(0,k.jsx)(n,{value:`passed`,children:`Passed`}),(0,k.jsx)(n,{value:`failed`,children:`Failed`}),(0,k.jsx)(n,{value:`running`,children:`Running`}),(0,k.jsx)(n,{value:`no-runs`,children:`No runs`})]})]}),(0,k.jsxs)(o,{value:B||`all`,onValueChange:e=>{Be(e===`all`?``:e),I(-1),N({})},children:[(0,k.jsx)(i,{className:`w-[140px]`,children:(0,k.jsx)(a,{placeholder:`All platforms`})}),(0,k.jsxs)(r,{children:[(0,k.jsx)(n,{value:`all`,children:`All platforms`}),(0,k.jsx)(n,{value:`web`,children:`Web`}),(0,k.jsx)(n,{value:`android`,children:`Android`}),(0,k.jsx)(n,{value:`ios`,children:`iOS`})]})]})]}),(0,k.jsxs)(ie,{className:`rounded-md border`,children:[(0,k.jsxs)(we,{className:`min-w-full table-fixed`,children:[(0,k.jsx)(`colgroup`,{children:E.map(e=>{let t=w(e);return(0,k.jsx)(`col`,{"data-column-id":e,style:t?{width:t}:void 0},e)})}),(0,k.jsx)(xe,{children:q.getHeaderGroups().map(e=>(0,k.jsx)(x,{className:`hover:bg-transparent`,children:e.headers.map(e=>(0,k.jsx)(Se,{className:je(e.column.id),children:e.isPlaceholder?null:b(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,k.jsx)(Ce,{children:J.length?J.map((e,t)=>{let n=t===F,r=e.getIsSelected();return(0,k.jsx)(x,{ref:e=>{L.current[t]=e},"data-runs-row-surface":e.id,tabIndex:n?0:-1,"aria-selected":n,className:Ne({isActive:n,isBatchSelected:r}),onClick:()=>{I(t),X(e.original)},onFocus:()=>I(t),onKeyDown:t=>{t.key===`Enter`&&X(e.original,t)},children:e.getVisibleCells().map(e=>{let t=e.column.id===`select`;return(0,k.jsx)(S,{className:d(Me(e.column.id),t&&`relative z-10`),children:b(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)}):(0,k.jsx)(x,{children:(0,k.jsx)(S,{colSpan:U.length+1,className:`h-24 text-center`,children:`No results.`})})})]}),(0,k.jsx)(re,{orientation:`horizontal`})]}),(0,k.jsxs)(`div`,{className:`flex items-center justify-between px-2`,children:[(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:Z>0?`Showing ${$}-${Ke} of ${Z}${Y||z||B?` (${V.length} total)`:``}`:`No suites found`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>q.previousPage(),disabled:!q.getCanPreviousPage(),children:`Previous`}),(0,k.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>q.nextPage(),disabled:!q.getCanNextPage(),children:`Next`})]})]}),(0,k.jsx)(ne,{selectedCount:W.length,onRun:K,onRunNoCache:He,onDelete:Ue,onCancel:()=>N({}),isRunning:Pe})]})})}export{j as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{i as t,l as n,n as r,o as i,s as a,t as o,u as s}from"./select-D0GpDfUa.js";import{t as c}from"./circle-x-BOV-jCVR.js";import{t as l}from"./copy-DW4nc-pA.js";import{t as u}from"./eye-Cj7s1eMQ.js";import{t as d}from"./refresh-cw-D0OwRzvm.js";import{t as f}from"./dist-Bc4r79ls.js";import{r as p}from"./use-page-title-CsUoFrfG.js";import{$n as m,Cn as h,Dn as g,Gn as _,Gt as v,It as y,Jt as b,Nn as x,Pn as ee,Rn as te,Sn as S,Tn as ne,Wn as C,Yn as w,at as re,bn as ie,mr as ae,wn as oe,xn as se,zn as ce}from"./index-C3AdCkmj.js";import{t as T}from"./badge-ClWCtaXi.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(ae(),1),O=m(),k=`Collapsible`,[de,fe]=ne(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]=S({prop:r,defaultProp:i??!1,onChange:o,caller:k});return(0,O.jsx)(pe,{scope:n,disabled:a,contentId:ie(),open:c,onOpenToggle:D.useCallback(()=>l(e=>!e),[l]),children:(0,O.jsx)(g.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)(g.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:oe(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)(se,{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=x(t,l),d=D.useRef(0),f=d.current,p=D.useRef(0),m=p.current,_=o.open||s,v=D.useRef(_),y=D.useRef(void 0);return D.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),h(()=>{let e=l.current;if(e){y.current=y.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,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(r)}},[o.open,r]),(0,O.jsx)(g.div,{"data-state":P(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!_,...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:_&&i})});function P(e){return e?`open`:`closed`}var F=me,_e=j,ve=N,I=`Accordion`,ye=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[L,be,xe]=f(I),[R,Se]=ne(I,[xe,fe]),z=fe(),Ce=D.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,O.jsx)(L.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,O.jsx)(Oe,{...a,ref:t}):(0,O.jsx)(De,{...i,ref:t})})});Ce.displayName=I;var[B,we]=R(I),[Te,Ee]=R(I,{collapsible:!1}),De=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=S({prop:n,defaultProp:r??``,onChange:i,caller:I});return(0,O.jsx)(B,{scope:e.__scopeAccordion,value:D.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:D.useCallback(()=>a&&c(``),[a,c]),children:(0,O.jsx)(Te,{scope:e.__scopeAccordion,collapsible:a,children:(0,O.jsx)(Ae,{...o,ref:t})})})}),Oe=D.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=S({prop:n,defaultProp:r??[],onChange:i,caller:I}),c=D.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=D.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,O.jsx)(B,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,O.jsx)(Te,{scope:e.__scopeAccordion,collapsible:!0,children:(0,O.jsx)(Ae,{...a,ref:t})})})}),[ke,V]=R(I),Ae=D.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=x(D.useRef(null),t),c=be(n),l=p(i)===`ltr`,u=oe(e.onKeyDown,e=>{if(!ye.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=()=>{o=r+1,o>s&&(o=0)},d=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,O.jsx)(ke,{scope:n,disabled:r,direction:i,orientation:a,children:(0,O.jsx)(L.Slot,{scope:n,children:(0,O.jsx)(g.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),H=`AccordionItem`,[je,U]=R(H),Me=D.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=V(H,n),o=we(H,n),s=z(n),c=ie(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,O.jsx)(je,{scope:n,open:l,disabled:u,triggerId:c,children:(0,O.jsx)(F,{"data-orientation":a.orientation,"data-state":Re(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});Me.displayName=H;var Ne=`AccordionHeader`,Pe=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(Ne,n);return(0,O.jsx)(g.h3,{"data-orientation":i.orientation,"data-state":Re(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});Pe.displayName=Ne;var W=`AccordionTrigger`,Fe=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(W,n),o=Ee(W,n),s=z(n);return(0,O.jsx)(L.ItemSlot,{scope:n,children:(0,O.jsx)(_e,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});Fe.displayName=W;var Ie=`AccordionContent`,Le=D.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=V(I,n),a=U(Ie,n),o=z(n);return(0,O.jsx)(ve,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});Le.displayName=Ie;function Re(e){return e?`open`:`closed`}var ze=Ce,Be=Me,Ve=Pe,He=Fe,Ue=Le;function G({...e}){return(0,O.jsx)(F,{"data-slot":`collapsible`,...e})}function K({...e}){return(0,O.jsx)(j,{"data-slot":`collapsible-trigger`,...e})}function q({...e}){return(0,O.jsx)(N,{"data-slot":`collapsible-content`,...e})}function We({confidence:e}){let t=Math.round(e*100);return(0,O.jsxs)(T,{variant:`outline`,className:v(`text-xs font-mono`,t>80?`bg-emerald-500/10 text-emerald-500 border-emerald-500/20`:t>=50?`bg-amber-500/10 text-amber-500 border-amber-500/20`:`bg-red-500/10 text-red-500 border-red-500/20`),children:[t,`%`]})}function Ge({...e}){return(0,O.jsx)(ze,{"data-slot":`accordion`,...e})}function Ke({className:e,...t}){return(0,O.jsx)(Be,{"data-slot":`accordion-item`,className:v(`border-b last:border-b-0`,e),...t})}function qe({className:e,children:t,...r}){return(0,O.jsx)(Ve,{className:`flex`,children:(0,O.jsxs)(He,{"data-slot":`accordion-trigger`,className:v(`flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180`,e),...r,children:[t,(0,O.jsx)(n,{className:`pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200`})]})})}function Je({className:e,children:t,...n}){return(0,O.jsx)(Ue,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,O.jsx)(`div`,{className:v(`pt-0 pb-4`,e),children:t})})}function Ye({attempts:e}){return!e||e.length===0?null:(0,O.jsx)(Ge,{type:`single`,collapsible:!0,className:`w-full`,children:e.map((e,t)=>(0,O.jsxs)(Ke,{value:`attempt-${t}`,children:[(0,O.jsx)(qe,{className:`py-2 text-sm`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsxs)(`span`,{className:`font-medium`,children:[`Attempt `,e.attemptNumber??t+1]}),e.strategy&&(0,O.jsx)(T,{variant:`secondary`,className:`text-xs`,children:e.strategy}),e.success?(0,O.jsx)(C,{className:`h-3.5 w-3.5 text-emerald-500`}):(0,O.jsx)(c,{className:`h-3.5 w-3.5 text-red-500`})]})}),(0,O.jsxs)(Je,{className:`space-y-2`,children:[e.reasoning&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Reasoning`}),(0,O.jsx)(`p`,{className:`text-sm`,children:e.reasoning})]}),e.observationBefore&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Observation Before`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.observationBefore.length>200?`${e.observationBefore.slice(0,200)}…`:e.observationBefore})]}),e.observationAfter&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Observation After`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.observationAfter.length>200?`${e.observationAfter.slice(0,200)}…`:e.observationAfter})]}),e.action!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Action`}),(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto`,children:typeof e.action==`string`?e.action:JSON.stringify(e.action,null,2)})]})]})]},t))})}var J=[{key:`observe`,label:`Observe`,icon:u},{key:`plan`,label:`Plan`,icon:E},{key:`execute`,label:`Execute`,icon:ce},{key:`verify`,label:`Verify`,icon:ue},{key:`heal`,label:`Heal`,icon:d}];function Xe(e){return e==null?``:typeof e==`string`?e:JSON.stringify(e,null,2)}function Y({config:e,content:t,duration:n,outcome:r,children:i,open:a,onOpenChange:o,sectionRef:s}){let[c,l]=(0,D.useState)(!1),u=a!==void 0,d=u?a:c,f=u?o:l,p=e.icon,m=t||i;return(0,O.jsxs)(G,{open:d,onOpenChange:f,children:[(0,O.jsxs)(K,{ref:s,className:`flex w-full items-center gap-2 py-1.5 text-left group sticky top-0 z-20 bg-background`,children:[(0,O.jsx)(`div`,{className:`flex items-center justify-center h-4 w-4 rounded-full bg-background border shrink-0`,children:(0,O.jsx)(p,{className:`h-2.5 w-2.5 text-muted-foreground`})}),(0,O.jsx)(`span`,{className:`text-sm font-medium`,children:e.label}),n!=null&&(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(n)}),r,(0,O.jsx)(`span`,{className:`flex-1`}),m&&(0,O.jsx)(_,{className:v(`h-3 w-3 text-muted-foreground transition-transform duration-200`,d&&`rotate-90`)})]}),m&&(0,O.jsx)(q,{className:`overflow-hidden min-w-0 max-w-full`,children:(0,O.jsxs)(`div`,{className:`min-w-0 max-w-full pl-6 pb-2 space-y-2`,children:[t&&(0,O.jsx)(`div`,{"data-reasoning-content-shell":`true`,className:`min-w-0 max-w-full rounded-sm`,children:(0,O.jsx)(`div`,{"data-reasoning-prose":`true`,className:`m-0 whitespace-pre-wrap break-words text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:t})}),i&&(0,O.jsx)(`div`,{"data-reasoning-children":`true`,className:`min-w-0 max-w-full`,children:i})]})})]})}function Ze(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observe`,icon:J[0].icon,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Plan`,icon:J[1].icon,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Execute`,icon:J[2].icon,content:null,duration:null,children:(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}var Qe=(0,D.forwardRef)(function({step:e},t){let n=Ze(e);return n.length===0&&e.error?(0,O.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded p-2 text-sm break-words [overflow-wrap:anywhere]`,children:e.error}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)($e,{ref:t,sections:n}),e.error&&(0,O.jsx)(`div`,{className:`pl-6 pb-2`,children:(0,O.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded p-2 text-sm break-words [overflow-wrap:anywhere]`,children:e.error})})]})}),$e=(0,D.forwardRef)(function({sections:e},t){let[n,r]=(0,D.useState)(()=>e.map(()=>!1)),i=(0,D.useRef)([]),a=(0,D.useCallback)(e=>{r(t=>{let n=[...t],r=n[e];return n[e]=!r,r||requestAnimationFrame(()=>{i.current[e]?.scrollIntoView({block:`start`,behavior:`smooth`})}),n})},[]);return(0,D.useImperativeHandle)(t,()=>({togglePhase:a}),[a]),(0,O.jsxs)(`div`,{className:`relative space-y-0`,children:[(0,O.jsx)(`div`,{className:`absolute left-[7px] top-4 bottom-4 w-px bg-border`}),e.map((e,t)=>(0,O.jsx)(Y,{config:{key:e.key,label:e.label,icon:e.icon},content:e.content,duration:e.duration,outcome:e.outcome,open:n[t],onOpenChange:e=>r(n=>{let r=[...n];return r[t]=e,r}),sectionRef:e=>{i.current[t]=e},children:e.children},e.key))]})}),et=(0,D.forwardRef)(function({runId:e,stepOrder:t,stepData:n},r){let[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(!0),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)([!1,!1,!1,!1]),f=(0,D.useRef)([null,null,null,null]),p=(0,D.useCallback)(e=>{d(t=>{let n=[...t],r=n[e];return n[e]=!r,r||requestAnimationFrame(()=>{f.current[e]?.scrollIntoView({block:`start`,behavior:`smooth`})}),n})},[]);if((0,D.useImperativeHandle)(r,()=>({togglePhase:p}),[p]),(0,D.useEffect)(()=>{let n=!1;return re(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)(Qe,{ref:r,step:n});let m=i.healAttempts&&i.healAttempts.length>0;return(0,O.jsxs)(`div`,{className:`relative space-y-0`,children:[(0,O.jsx)(`div`,{className:`absolute left-[7px] top-4 bottom-4 w-px bg-border`}),(0,O.jsx)(Y,{config:J[0],content:i.observeText,duration:i.observeDuration,open:u[0],onOpenChange:e=>d(t=>{let n=[...t];return n[0]=e,n}),sectionRef:e=>{f.current[0]=e}}),(0,O.jsx)(Y,{config:J[1],content:i.planReasoning,duration:i.planDuration,outcome:i.planConfidence==null?void 0:(0,O.jsx)(We,{confidence:i.planConfidence}),open:u[1],onOpenChange:e=>d(t=>{let n=[...t];return n[1]=e,n}),sectionRef:e=>{f.current[1]=e},children:i.planAction!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Planned Action`}),(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:Xe(i.planAction)})]})}),(0,O.jsx)(Y,{config:J[2],content:null,duration:i.executeDuration,open:u[2],onOpenChange:e=>d(t=>{let n=[...t];return n[2]=e,n}),sectionRef:e=>{f.current[2]=e},children:i.executeAction!=null&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium mb-0.5`,children:`Executed Action`}),(0,O.jsx)(`pre`,{className:`min-w-0 max-w-full text-xs font-mono bg-muted/50 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:Xe(i.executeAction)})]})}),(0,O.jsx)(Y,{config:J[3],content:i.verifyReasoning,duration:i.verifyDuration,outcome:i.verifySuccess==null?void 0:(0,O.jsx)(`span`,{className:v(`text-xs font-medium`,i.verifySuccess?`text-emerald-500`:`text-red-500`),children:i.verifySuccess?`Passed`:`Failed`}),open:u[3],onOpenChange:e=>d(t=>{let n=[...t];return n[3]=e,n}),sectionRef:e=>{f.current[3]=e}}),m&&(0,O.jsx)(Y,{config:J[4],content:null,duration:null,children:(0,O.jsx)(Ye,{attempts:i.healAttempts})})]})}),tt=(0,D.forwardRef)(function(e,t){return e.mode===`static`?(0,O.jsx)($e,{sections:e.sections,ref:t}):(0,O.jsx)(et,{runId:e.runId,stepOrder:e.stepOrder,stepData:e.stepData,ref:t})});function nt(e){switch(e){case`env`:return`bg-blue-500/15 text-blue-400 border-blue-500/20`;case`capture`:return`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`;case`cli`:return`bg-purple-500/15 text-purple-400 border-purple-500/20`;case`inline`:return`bg-amber-500/15 text-amber-400 border-amber-500/20`;case`suite`:return`bg-cyan-500/15 text-cyan-400 border-cyan-500/20`;case`test`:return`bg-pink-500/15 text-pink-400 border-pink-500/20`;case`hook`:return`bg-orange-500/15 text-orange-400 border-orange-500/20`;case`step`:return`bg-teal-500/15 text-teal-400 border-teal-500/20`;default:return`bg-muted text-muted-foreground`}}function X({title:e,count:t,defaultOpen:n,children:r}){return(0,O.jsxs)(G,{defaultOpen:n,children:[(0,O.jsxs)(K,{className:`flex items-center gap-1.5 w-full px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors`,children:[(0,O.jsx)(_,{className:`h-3 w-3 transition-transform duration-200 [[data-state=open]>&]:rotate-90`}),e,(0,O.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:[`(`,t,`)`]})]}),(0,O.jsx)(q,{children:r})]})}function Z({message:e}){return(0,O.jsx)(`div`,{className:`px-4 py-3 text-xs text-muted-foreground/60 italic`,children:e})}function rt({step:e,executionLogs:t=[]}){let n=e.variableSnapshot,r=n?Object.entries(n):[],i=t.filter(e=>e.type===`runjs`),a=t.filter(e=>e.type===`hook`);return(0,O.jsxs)(`div`,{className:`py-1`,children:[(0,O.jsx)(X,{title:`Env`,count:r.length,defaultOpen:r.length>0,children:r.length===0?(0,O.jsx)(Z,{message:`No variables at this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2`,children:(0,O.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{className:`border-b`,children:[(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Variable`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Value`}),(0,O.jsx)(`th`,{className:`text-left py-1.5 px-2 text-xs font-medium text-muted-foreground`,children:`Source`})]})}),(0,O.jsx)(`tbody`,{children:r.map(([e,t])=>(0,O.jsxs)(`tr`,{className:`border-b border-border/50`,children:[(0,O.jsx)(`td`,{className:`py-1.5 px-2 font-mono text-xs text-muted-foreground`,children:e}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 font-mono text-xs break-all`,children:t.value}),(0,O.jsx)(`td`,{className:`py-1.5 px-2`,children:(0,O.jsx)(T,{className:v(`text-[10px] px-1.5 py-0 border`,nt(t.source)),children:t.source})})]},e))})]})})}),(0,O.jsx)(X,{title:`runJS`,count:i.length,defaultOpen:i.length>0,children:i.length===0?(0,O.jsx)(Z,{message:`No runJS executions for this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:i.map(e=>(0,O.jsxs)(`div`,{className:`rounded-md border border-border/50 p-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[e.status===`passed`?(0,O.jsx)(C,{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:b(e.duration)})]}),e.stdout&&(0,O.jsx)(`pre`,{className:`mt-1 p-1.5 rounded bg-muted/50 font-mono text-[11px] whitespace-pre-wrap break-all overflow-hidden`,children:e.stdout}),e.returnData!=null&&(0,O.jsxs)(`div`,{className:`mt-1 p-1.5 rounded bg-muted/50`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Return: `}),(0,O.jsx)(`span`,{className:`font-mono text-[11px]`,children:typeof e.returnData==`string`?e.returnData:JSON.stringify(e.returnData)})]})]},e.id))})}),(0,O.jsx)(X,{title:`Hooks`,count:a.length,defaultOpen:a.length>0,children:a.length===0?(0,O.jsx)(Z,{message:`No hooks ran for this step`}):(0,O.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:a.map(e=>(0,O.jsxs)(`div`,{className:`rounded-md border border-border/50 p-2 text-xs`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[e.status===`passed`?(0,O.jsx)(C,{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:b(e.duration)})]}),e.variables&&Object.keys(e.variables).length>0&&(0,O.jsxs)(`div`,{className:`mt-1.5 space-y-0.5`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:`Emitted variables:`}),Object.entries(e.variables).map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex gap-2 pl-2 font-mono text-[11px]`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),(0,O.jsx)(`span`,{className:`break-all`,children:t})]},e))]}),e.stdout&&(0,O.jsx)(`pre`,{className:`mt-1 p-1.5 rounded bg-muted/50 font-mono text-[11px] whitespace-pre-wrap break-all overflow-hidden max-h-24 overflow-y-auto`,children:e.stdout})]},e.id))})})]})}function it(e){return e>=1e3?`+${(e/1e3).toFixed(1)}s`:`+${Math.round(e)}ms`}function at(e){return Object.entries(e).filter(([e,t])=>e!==`startTime`&&t>0)}function ot(e){return e>=200&&e<300?`text-emerald-500`:e>=300&&e<400?`text-amber-500`:e>=400?`text-red-500`:`text-muted-foreground`}function st({headers:e}){let t=Object.entries(e);return t.length===0?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`None`}):(0,O.jsx)(`div`,{className:`space-y-0.5`,children:t.map(([e,t])=>(0,O.jsxs)(`div`,{className:`flex gap-2 text-xs font-mono`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[e,`:`]}),(0,O.jsx)(`span`,{className:`break-all`,children:t})]},e))})}function Q({label:e,children:t}){return(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:e}),t]})}function ct({text:e}){let[t,n]=(0,D.useState)(!1);return(0,O.jsx)(`button`,{onClick:(0,D.useCallback)(t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},[e]),className:`text-muted-foreground hover:text-foreground`,children:t?(0,O.jsx)(s,{className:`h-3 w-3`}):(0,O.jsx)(l,{className:`h-3 w-3`})})}function lt({body:e,contentType:t}){let n=t.toLowerCase();if(n.includes(`application/json`))try{return(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:JSON.stringify(JSON.parse(e),null,2)})}catch{return(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e})}return n.includes(`image/svg+xml`)?(0,O.jsx)(`img`,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:`SVG response`,className:`max-h-48`}):e.startsWith(`data:image/`)?(0,O.jsx)(`img`,{src:e,alt:`Image response`,className:`max-h-48 rounded-sm`}):n.includes(`image/`)?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Image not previewable (re-run test to capture)`}):(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e})}function ut({entry:e}){let t=e.method===`POST`||e.method===`PUT`||e.method===`PATCH`;return(0,O.jsx)(`tr`,{children:(0,O.jsx)(`td`,{colSpan:6,className:`px-0 py-0`,children:(0,O.jsxs)(`div`,{className:`bg-muted/20 border-b border-border/50 px-4 py-3 space-y-4`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,O.jsx)(Q,{label:`Request Headers`,children:(0,O.jsx)(st,{headers:e.requestHeaders??{}})}),(0,O.jsx)(Q,{label:`Response Headers`,children:(0,O.jsx)(st,{headers:e.responseHeaders??{}})})]}),t&&(0,O.jsx)(Q,{label:`Request Body`,children:e.requestBody?(0,O.jsx)(`pre`,{className:`text-xs font-mono bg-background/60 rounded-sm px-3 py-2 overflow-x-auto max-h-48 whitespace-pre-wrap break-all`,children:e.requestBody}):(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`No request body`})}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,O.jsx)(`h4`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Response Body`}),e.body&&(0,O.jsx)(ct,{text:e.body})]}),e.body?(0,O.jsx)(lt,{body:e.body,contentType:e.responseHeaders?.[`content-type`]??``}):(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Not captured`})]}),e.timing&&(()=>{let t=at(e.timing);return t.length===0?null:(0,O.jsx)(Q,{label:`Timing`,children:(0,O.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:t.map(([e,t])=>(0,O.jsxs)(`div`,{className:`text-xs font-mono`,children:[(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),` `,(0,O.jsxs)(`span`,{children:[Math.round(t),`ms`]})]},e))})})})()]})})})}function $({text:e,query:t}){if(!t)return(0,O.jsx)(O.Fragment,{children:e});let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsxs)(O.Fragment,{children:[e.slice(0,n),(0,O.jsx)(`mark`,{className:`bg-yellow-400/30 text-inherit rounded-sm px-0.5`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function dt({step:e,allSteps:t,platform:n}){let[r,i]=(0,D.useState)(new Set),a=(0,D.useMemo)(()=>{let n=e.displayStepOrder??e.stepOrder,r=[];for(let e of t){let t=e.displayStepOrder??e.stepOrder;if(t>n)continue;let i=t===n;for(let t of e.networkLogs??[])r.push({...t,isCurrent:i})}return r.sort((e,t)=>e.startTime-t.startTime)},[e,t]),o=(0,D.useMemo)(()=>a.length===0?0:Math.min(...a.map(e=>e.startTime)),[a]),[s,c]=(0,D.useState)(``),l=(0,D.useDeferredValue)(s),u=(0,D.useMemo)(()=>{if(!l)return a;let e=l.toLowerCase();return a.filter(t=>t.url.toLowerCase().includes(e)||t.method.toLowerCase().includes(e)||String(t.status).includes(e))},[a,l]);(0,D.useEffect)(()=>{i(new Set)},[l]);let d=(0,D.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return a.length===0?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:n===`android`||n===`ios`?`Network capture is not available for mobile tests`:`No network requests captured for this step`}):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`sticky top-0 z-10 bg-background border-b border-border/50 px-3 py-1.5 flex items-center gap-2`,children:[(0,O.jsx)(te,{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:v(`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)(_,{className:v(`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)($,{text:e.method,query:l})})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 text-xs font-mono truncate max-w-0 min-w-0`,children:(0,O.jsx)($,{text:e.url,query:l})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2`,children:(0,O.jsx)(`span`,{className:v(`text-xs font-mono`,ot(e.status)),children:(0,O.jsx)($,{text:String(e.status),query:l})})}),(0,O.jsx)(`td`,{className:`py-1.5 px-2 text-xs font-mono text-muted-foreground text-right`,children:it(e.startTime-o)}),(0,O.jsxs)(`td`,{className:`py-1.5 px-2 text-xs text-muted-foreground text-right`,children:[n<1?`<1`:Math.round(n),`ms`]})]}),i&&(0,O.jsx)(ut,{entry:e})]},t)})})]})})]})}function ft(e){switch(e.toLowerCase()){case`error`:return`text-red-400`;case`warn`:case`warning`:return`text-amber-400`;case`info`:return`text-blue-400`;case`debug`:return`text-cyan-400`;default:return`text-muted-foreground`}}function pt(e){switch(e){case`setup`:return`bg-blue-500/15 text-blue-400 border-blue-500/20`;case`teardown`:return`bg-purple-500/15 text-purple-400 border-purple-500/20`;case`inline`:return`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`;default:return`bg-muted text-muted-foreground`}}var mt=[`error`,`warn`,`info`,`log`,`debug`];function ht({text:e,query:t}){if(!t)return(0,O.jsx)(O.Fragment,{children:e});let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsxs)(O.Fragment,{children:[e.slice(0,n),(0,O.jsx)(`mark`,{className:`bg-yellow-400/30 text-inherit rounded-sm px-0.5`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function gt({step:e,allSteps:n,executionLogs:s,isHookStep:c}){let l=(0,D.useMemo)(()=>{let t=e.displayStepOrder??e.stepOrder,r=[];for(let e of n){let n=e.displayStepOrder??e.stepOrder;if(n>t)continue;let i=n===t;for(let t of e.consoleLogs??[])r.push({...t,isCurrent:i})}return r.sort((e,t)=>e.timestamp-t.timestamp)},[e,n]),[u,d]=(0,D.useState)(``),f=(0,D.useDeferredValue)(u),[p,m]=(0,D.useState)(`all`),h=(0,D.useMemo)(()=>{let e=l;if(p!==`all`&&(e=e.filter(e=>{let t=e.level.toLowerCase(),n=mt.indexOf(p);if(n===-1)return!0;let r=mt.indexOf(t);return r!==-1&&r>=n})),f){let t=f.toLowerCase();e=e.filter(e=>e.text.toLowerCase().includes(t)||e.level.toLowerCase().includes(t))}return e},[l,f,p]),g=c&&s&&s.length>0,_=l.length>0;return!g&&!_?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm py-12`,children:`No console output captured for this step`}):(0,O.jsxs)(`div`,{className:`w-full overflow-hidden`,children:[_&&(0,O.jsxs)(`div`,{className:`sticky top-0 z-10 bg-background border-b border-border/50 px-3 py-1.5 flex items-center gap-2`,children:[(0,O.jsx)(te,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,O.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`Filter...`,className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`}),u&&(0,O.jsxs)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:[h.length,` of `,l.length]}),(0,O.jsx)(`div`,{className:`h-3 w-px bg-border/50 shrink-0`}),(0,O.jsxs)(o,{value:p,onValueChange:m,children:[(0,O.jsx)(i,{size:`sm`,className:`h-6 rounded-sm text-xs px-2 gap-1 border-border/50 min-w-0 w-auto`,children:(0,O.jsx)(a,{})}),(0,O.jsxs)(r,{className:`rounded-sm`,children:[(0,O.jsx)(t,{value:`all`,className:`text-xs`,children:`All levels`}),(0,O.jsx)(t,{value:`error`,className:`text-xs`,children:`Errors`}),(0,O.jsx)(t,{value:`warn`,className:`text-xs`,children:`Warnings`}),(0,O.jsx)(t,{value:`info`,className:`text-xs`,children:`Info`}),(0,O.jsx)(t,{value:`log`,className:`text-xs`,children:`Log`}),(0,O.jsx)(t,{value:`debug`,className:`text-xs`,children:`Debug`})]})]}),u&&(0,O.jsx)(`button`,{onClick:()=>d(``),className:`text-muted-foreground hover:text-foreground shrink-0`,children:(0,O.jsx)(ee,{className:`h-3.5 w-3.5`})})]}),(0,O.jsxs)(`div`,{className:`p-3 space-y-0.5 overflow-x-hidden w-full max-w-full`,children:[g&&(0,O.jsx)(`div`,{className:`space-y-2 mb-3`,children:s.map(e=>(0,O.jsxs)(`div`,{className:`border border-border/50 rounded-sm overflow-hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 bg-muted/20 border-b border-border/30`,children:[(0,O.jsx)(T,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.name}),(0,O.jsx)(T,{className:v(`text-[10px] px-1.5 py-0`,pt(e.phase)),children:e.phase}),(0,O.jsx)(`span`,{className:v(`text-[10px] font-mono`,e.status===`passed`?`text-emerald-500`:`text-red-500`),children:e.status}),(0,O.jsxs)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:[e.duration,`ms`]})]}),e.stdout&&(0,O.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-foreground/90`,children:e.stdout}),e.stderr&&(0,O.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-red-400/80 border-t border-border/30`,children:e.stderr})]},e.id))}),g&&_&&(0,O.jsx)(`div`,{className:`border-t border-border/30 pt-2 mb-1`,children:(0,O.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wider`,children:`Browser Console`})}),_&&h.map((e,t)=>(0,O.jsxs)(`div`,{className:v(`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:v(`shrink-0 text-[10px]`,ft(e.level)),children:e.level}),(0,O.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0 text-[10px] tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()}),(0,O.jsx)(`span`,{className:`flex-1 min-w-0 break-all whitespace-pre-wrap overflow-hidden`,children:(0,O.jsx)(ht,{text:e.text,query:f})})]},t))]})]})}export{Ye as a,q as c,le as d,E as f,tt as i,K as l,dt as n,We as o,rt as r,G as s,gt as t,ue as u};
@@ -1,9 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{c as t}from"./id-badge-BpTnHwvn.js";import{t as n}from"./monaco-editor-BEWq4fzI.js";import{t as r}from"./file-code-DxVUPin2.js";import{n as i}from"./split-button-CRYV8xU8.js";import{t as a}from"./refresh-cw-D0OwRzvm.js";import{a as o,c as s,i as ee,n as te,o as c,r as ne,s as l,t as re}from"./filename-validation-wKCpNal3.js";import{t as ie}from"./use-page-title-CsUoFrfG.js";import{a as ae,c as u,d as oe,f as d,i as se,l as ce,n as le,o as ue,p as f,r as de,s as fe,t as pe,u as p}from"./test-navbar-ChNg-qki.js";import{a as me,r as he}from"./dist-BsGrTrYb.js";import{i as ge,n as _e,r as ve,t as ye}from"./tabs-BEp-p5jh.js";import{$n as be,At as xe,Bt as Se,Ct as Ce,E as we,Ft as m,Gt as h,H as Te,It as g,Jn as Ee,Lt as De,Mt as _,Nt as v,O as Oe,Ot as ke,P as y,Pn as Ae,Rt as je,Ut as Me,Vn as b,Vt as Ne,Wt as x,Xt as Pe,dr as Fe,dt as Ie,er as S,jt as C,lr as Le,mr as Re,pt as w,r as ze,ur as Be,zt as Ve}from"./index-C3AdCkmj.js";import{n as T,r as He,t as Ue}from"./resizable-ugU12HrY.js";import{t as We}from"./empty-state-BTFWlITi.js";import{t as Ge}from"./use-keyboard-shortcuts-COnAPsDD.js";import{t as Ke}from"./observation-markdown-CIs-5TY2.js";var E=e(Re(),1),D=be();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)(_,{children:[(0,D.jsx)(m,{asChild:!0,children:(0,D.jsx)(`span`,{className:h(`font-mono tabular-nums font-medium cursor-default`,qe(e.trust)),children:e.trust.toFixed(2)})}),(0,D.jsx)(v,{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)(_,{children:[(0,D.jsx)(m,{asChild:!0,children:(0,D.jsx)(`span`,{className:`text-muted-foreground cursor-default`,children:Je(e.created)})}),(0,D.jsx)(v,{side:`top`,className:`text-xs`,children:`First observed on this date`})]}),(0,D.jsxs)(_,{children:[(0,D.jsx)(m,{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)(v,{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)(ae,{children:[(0,D.jsx)(f,{asChild:!0,children:(0,D.jsx)(x,{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)(Ae,{className:`size-3.5`})})}),(0,D.jsxs)(u,{size:`sm`,children:[(0,D.jsxs)(oe,{children:[(0,D.jsx)(d,{children:`Delete observation?`}),(0,D.jsx)(ce,{children:`This observation will be permanently removed. The agent will no longer use it during future runs.`})]}),(0,D.jsxs)(p,{children:[(0,D.jsx)(fe,{children:`Cancel`}),(0,D.jsx)(ue,{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),[ee,te]=(0,E.useState)(null),[c,ne]=(0,E.useState)(null),l=(0,E.useCallback)(()=>{let t=!1;return s(!0),te(null),i([]),w(e).then(e=>{t||(n(e.observations),i(e.invalidFiles),s(!1))}).catch(e=>{t||(n([]),te(e instanceof Error?e.message:`Failed to load observations`),s(!1))}),()=>{t=!0}},[e]);(0,E.useEffect)(()=>l(),[l]);let re=(0,E.useCallback)(async t=>{ne(t);try{await y(e,t),n(e=>e.filter(e=>e.id!==t)),C.success(`Observation deleted`)}catch(e){C.error(`Failed to delete: ${e instanceof Error?e.message:String(e)}`)}finally{ne(null)}},[e]);return o?(0,D.jsxs)(`div`,{className:`space-y-2 px-4 py-2`,children:[(0,D.jsx)(g,{className:`h-16 w-full rounded-md`}),(0,D.jsx)(g,{className:`h-16 w-full rounded-md`}),(0,D.jsx)(g,{className:`h-16 w-full rounded-md`})]}):ee?(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)(x,{variant:`outline`,size:`sm`,onClick:l,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)(Ze,{invalidFiles:r}):null,(0,D.jsx)(We,{icon:Ee,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)(Ze,{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:re,isDeleting:c===e.id},e.id))})]})}function Ze({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 Qe=`name: My Test
2
- test-id: ""
3
- target: ""
4
- context: ""
5
- steps:
6
- - Navigate to the homepage
7
- - Verify the page loads
8
- `;function $e({text:e}){return(0,D.jsxs)(_,{children:[(0,D.jsx)(m,{asChild:!0,children:(0,D.jsx)(b,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,D.jsx)(v,{className:`max-w-[250px] text-[13px]`,children:e})]})}function et(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function tt(e,t,n){if(t===`web`)return n||e?.url||`Configured start URL`;let r=e?.device;return(typeof r?.deviceName==`string`?r.deviceName:typeof r?.name==`string`?r.name:null)||e?.product||e?.bundleId||e?.appPackage||(t===`android`?`Android device`:`iOS device`)}function nt(e){return JSON.stringify({text:e.text,overrides:e.overrides??null})}function rt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function it(e){let t=(0,E.useRef)([]);return(0,E.useMemo)(()=>{let n=t.current,r=new Set,i=e.map((e,t)=>{let i=nt(e),a=n[t];if(a&&a.signature===i)return r.add(a.id),{id:a.id,instruction:e.text,signature:i};let o=n.find(e=>e.signature===i&&!r.has(e.id));return o?(r.add(o.id),{id:o.id,instruction:e.text,signature:i}):a&&!r.has(a.id)?(r.add(a.id),{id:a.id,instruction:e.text,signature:i}):{id:crypto.randomUUID(),instruction:e.text,signature:i}});return t.current=i.map(({id:e,signature:t})=>({id:e,signature:t})),i},[e])}function at(){let{t_id:e}=Be(),a=Le(),[ae]=Fe(),u=Pe(),{defaultRunMode:oe}=i(),{targets:d,globalUse:ce,isLoading:ue}=t(),f=e??``,{suggestions:fe}=te(f||null),p=!e,be=ae.get(`live`)===`1`,m=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(null),Ee=(0,E.useRef)(()=>{}),_=(0,E.useRef)(!1),[v,y]=(0,E.useState)(p?Qe:``),[Ae,b]=(0,E.useState)(``),[x,Re]=(0,E.useState)(``),[w,Ke]=(0,E.useState)(!p),[qe,Je]=(0,E.useState)(!1),[Ye,Ze]=(0,E.useState)(!1),[nt,at]=(0,E.useState)(!1),[ot,st]=(0,E.useState)(!1),[O,ct]=(0,E.useState)(null),[k,A]=(0,E.useState)(null),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(!1),[F,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(null),[lt,z]=(0,E.useState)(`reasoning`),[ut,B]=(0,E.useState)(null),[dt,V]=(0,E.useState)({setup:[],teardown:[]}),[H,ft]=(0,E.useState)(null),[pt,mt]=(0,E.useState)(!1),[ht,gt]=(0,E.useState)(!1),[U,_t]=(0,E.useState)(void 0),[vt,yt]=(0,E.useState)(``),W=!p&&v!==Ae,bt=p&&x?re(x.trim(),U,`testMatch`):null,xt=p&&!!x&&!!bt;(0,E.useEffect)(()=>{if(p)return;let e=!1;return Ke(!0),Ie(f).then(t=>{e||(y(t.content),b(t.content),yt(t.path))}).catch(()=>{e||(Je(!0),C.error(`Failed to load test file`))}).finally(()=>{e||Ke(!1)}),()=>{e=!0}},[f,p]),(0,E.useEffect)(()=>{if(!p)return;let e=!1;return Te().then(t=>{if(e)return;let n=t.config.workspace?.testMatch;_t(Array.isArray(n)?n:[])}).catch(()=>{e||_t([])}),()=>{e=!0}},[p]),(0,E.useEffect)(()=>{if(!p)return;let e=he();y(t=>de(t,[`test-id`],e))},[p]);let G=(0,E.useMemo)(()=>se(v),[v]);G&&(m.current=G);let K=G??m.current,q=it(K?.steps??[]),St=(0,E.useMemo)(()=>q.map(e=>({draftId:e.id,instruction:e.instruction})),[q]),J=(0,E.useMemo)(()=>G?{testName:G.name.trim()||`Untitled Live Draft`,testContext:G.context.trim()||void 0}:null,[G]),Y=ee(k,{steps:St,setupHooks:dt.setup,teardownHooks:dt.teardown,allowReconnect:!1}),X=Y.terminateSession;g.current=k,Ee.current=X;let Ct=K?.target?.trim()??``,wt=Ct?d[Ct]:void 0,Tt=k?Y.platform:wt?.platform??`web`,Et=(0,E.useMemo)(()=>tt(wt,Tt,Y.currentUrl),[wt,Tt,Y.currentUrl]),Dt=G===null?`invalid`:W||p?`unsaved`:`saved`,Ot=(0,E.useMemo)(()=>q.map(e=>e.id),[q]),Z=F?`connecting`:Y.connectionState,Q=k!==null,kt=Q&&G!==null&&!rt(G.setup,dt.setup);ie((0,E.useMemo)(()=>Q&&j!==null?`Live #${j} — ${K?.name?.trim()||f||`Test`}`:p?`New Test`:`Edit Test`,[Q,j,K?.name,f,p]));let At=(0,E.useMemo)(()=>L===`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.`}:L===`disconnected`?{reason:`disconnected`,title:`Live session disconnected`,description:`The connection dropped and the disposable session was terminated. Start a fresh session to reconnect.`}:null,[L]),jt=Q&&Z===`connected`&&G!==null&&G.steps.some(e=>e.text.trim()),Mt=F||Q,Nt=F||Q||ot||O!==null||G===null||!G?.target.trim()||ue,$=(0,E.useCallback)(async()=>{Ze(!0);try{if(p){let e=re(x.trim(),U,`testMatch`);if(e){C.error(e);return}await Oe(x.trim(),v),C.success(`Test file created`),a(S.testView(G?.testId??``))}else await ke(f,v),b(v),C.success(`Saved`)}catch(e){C.error(`Failed to save: ${e instanceof Error?e.message:String(e)}`)}finally{Ze(!1)}},[p,x,U,v,f,a,G]),Pt=(0,E.useCallback)(()=>{o(`page`,`closing live mode`,{liveSessionId:k??void 0,terminalReason:L??void 0}),h.current?.abort(),h.current=null,k&&X(),I(!1),A(null),M(null),R(null),B(null),V({setup:[],teardown:[]}),P(!1)},[k,L,X]),Ft=(0,E.useCallback)(()=>{o(`page`,`ending live session from UI`,{liveSessionId:k??void 0}),h.current?.abort(),h.current=null,k&&X(),I(!1),A(null),M(null),R(`ended`),B(null),V({setup:[],teardown:[]}),P(!0)},[k,X]),It=(0,E.useCallback)(async(e,t)=>{let n=e.target.trim();if(!n){C.error(`Select a target before starting live mode`);return}let r=new AbortController;h.current?.abort(),h.current=r,P(!0),R(null),z(`reasoning`),B(null),I(!0);try{t?.replaceCurrentSession&&k&&(X(),A(null),M(null));let i=ne({content:v,targetName:n,targets:d,globalUse:ce});o(`page`,`requesting live session`,{targetName:n,platform:i.platform,headless:i.headless??void 0,replacingSession:t?.replaceCurrentSession??!1});let a=[...e.setup],s=[...e.teardown],ee=e.testId?.trim()||null,te=ee?{type:`test`,id:ee}:void 0,{sessionId:c,sessionNumber:l}=await we({...i,setupHooks:a,teardownHooks:s,entity:te},r.signal);if(r.signal.aborted)return;V({setup:a,teardown:s}),A(c),M(l),o(`page`,`live session created`,{sessionId:c,targetName:n})}catch(e){et(e)||(o(`page`,`failed to create live session`,{error:e instanceof Error?e.message:String(e),targetName:n}),C.error(e instanceof Error?e.message:`Failed to start live session`)),t?.replaceCurrentSession||P(!1)}finally{h.current===r&&(h.current=null),I(!1)}},[v,ce,k,d,X]),Lt=(0,E.useCallback)(async()=>{if(!Nt){if(!G){C.error(`Fix YAML errors before starting live mode`);return}await It(G)}},[G,It,Nt]),Rt=(0,E.useCallback)(async()=>{if(Q){if(!G){C.error(`Fix YAML errors before restarting live mode`);return}await It(G,{replaceCurrentSession:!0})}},[G,Q,It]),zt=(0,E.useCallback)(e=>{if(e){P(!0);return}Pt()},[Pt]),Bt=async()=>{at(!0);try{let e=await xe(v,vt||x.trim());if(e.valid)C.success(`Valid YAML`);else{let t=e.errors.map(e=>e.line?`Line ${e.line}: ${e.message}`:e.message).join(`
9
- `);C.error(t)}}catch(e){C.error(`Validation error: ${e instanceof Error?e.message:String(e)}`)}finally{at(!1)}},Vt=(0,E.useCallback)(async e=>{if(!ot){try{if(p){let e=re(x.trim(),U,`testMatch`);if(e){C.error(e);return}await Oe(x.trim(),v),a(S.testView(G?.testId??``));return}W&&(await ke(f,v),b(v))}catch(e){C.error(`Failed to save before run: ${e instanceof Error?e.message:String(e)}`);return}st(!0);try{ct((await Ce({file:vt,local:e})).runId),C.success(`Run started`)}catch(e){C.error(`Failed to start run: ${e instanceof Error?e.message:String(e)}`),st(!1)}}},[ot,p,x,U,v,W,f,vt,a,G]),Ht=(0,E.useCallback)(()=>{ct(null),st(!1)},[]),Ut=(0,E.useCallback)(e=>{if(!Q)return;if(!J){C.error(`Fix YAML errors before running live steps. Live mode uses the current valid draft, not the last valid snapshot.`);return}let t=Y.steps[e]?.id;t&&B({type:`step`,stepId:t}),z(`reasoning`),Y.executeStepByIndex(e,J)},[J,Q,Y]),Wt=(0,E.useCallback)(e=>{Y.runningStepIndex===e&&(z(`reasoning`),Y.cancelStep())},[Y]),Gt=(0,E.useCallback)((e,t)=>{if(!Q)return;if(e===`setup`){C.error(`Setup hooks only run when a live session starts`);return}let n=Y.teardownHooks.find(e=>e.id===t);n&&B({type:`hook`,hookId:n.id}),z(`reasoning`),Y.executeHookById(e,t)},[Q,Y]);if((0,E.useEffect)(()=>()=>{h.current?.abort(),g.current&&Ee.current()},[]),(0,E.useEffect)(()=>{k&&Z===`disconnected`&&(o(`page`,`live session moved to terminal state`,{liveSessionId:k,liveConnectionState:Z}),A(null),M(null),I(!1),R(`disconnected`),B(null),V({setup:[],teardown:[]}),P(!0))},[Z,k]),(0,E.useEffect)(()=>{!be||_.current||p||w||qe||F||N||Q||!G||!G.target.trim()||(_.current=!0,a(S.testEdit(f),{replace:!0}),Lt())},[G,Lt,Q,p,F,w,N,a,qe,be,f]),(0,E.useEffect)(()=>{H&&!Ot.includes(H)&&ft(null)},[Ot,H]),(0,E.useEffect)(()=>{if(!N){B(null);return}let e=[...Y.setupHooks,...Y.teardownHooks];if(Y.steps.length===0&&e.length===0){B(null);return}B(t=>t?.type===`hook`&&e.some(e=>e.id===t.hookId)||t&&`stepId`in t&&Y.steps.some(e=>e.id===t.stepId)?t:e.length>0?{type:`hook`,hookId:e[0].id}:{type:`step`,stepId:Y.steps[0].id})},[Y.setupHooks,Y.steps,Y.teardownHooks,N]),Ge((0,E.useMemo)(()=>({r:()=>{p||Vt(oe===`local`)},escape:()=>{O&&Ht()}}),[p,O,Vt,Ht,oe])),(0,E.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),$())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[$]),w)return(0,D.jsx)(ze,{});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(S.tests)});let Kt=(0,D.jsx)(le,{content:v,onChange:y,isCreateMode:p,showLiveStepActions:Q,canRunLiveStep:Z===`connected`&&G!==null,canRunLiveHook:Z===`connected`&&G!==null,liveEditorSteps:Y.steps,draftStepIds:Ot,liveSetupHooks:Y.setupHooks,liveTeardownHooks:Y.teardownHooks,onRunLiveStep:Ut,onCancelLiveStep:Wt,onRunLiveHook:Gt,openStepSettingsId:H,onOpenStepSettingsChange:ft,selection:ut,onSelect:B,variableSuggestions:fe}),qt=(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[p&&(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)(me,{className:`flex items-center gap-1 text-xs font-medium`,children:[`File Path `,(0,D.jsx)($e,{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)(Me,{placeholder:`my-test.yaml`,value:x,onChange:e=>Re(e.target.value),className:`mt-2 max-w-md ${xt?`border-red-500 focus-visible:ring-red-500`:``}`}),xt&&(0,D.jsx)(`p`,{className:`mt-1 text-xs text-red-500`,children:bt})]})}),(0,D.jsxs)(ye,{defaultValue:`builder`,className:`flex-1 flex min-h-0 flex-col`,children:[(0,D.jsxs)(ve,{variant:`line`,className:`px-4`,children:[(0,D.jsx)(ge,{value:`builder`,children:`Builder`}),(0,D.jsx)(ge,{value:`yaml`,children:`YAML`}),!p&&(0,D.jsx)(ge,{value:`memory`,children:`Memory`})]}),(0,D.jsx)(_e,{value:`builder`,className:`mt-2 flex-1 overflow-auto`,children:Kt}),(0,D.jsx)(_e,{value:`yaml`,className:`flex-1 min-h-0 mt-2`,children:(0,D.jsx)(n,{value:v,onChange:y,onSave:$,showErrors:!0,className:`h-full`})}),!p&&(0,D.jsx)(_e,{value:`memory`,className:`mt-2 flex-1 overflow-auto`,children:(0,D.jsx)(Xe,{testId:f})})]})]}),Jt=(0,D.jsx)(c,{connectionState:Y.connectionState,isLaunching:F,targetName:Ct||`Selected Target`,targetLabel:Et,liveSessionNumber:j,platform:Tt,screenshot:Y.screenshot,currentUrl:Y.currentUrl,pendingNavigation:Y.pendingNavigation,steps:Y.steps,setupHooks:Y.setupHooks,teardownHooks:Y.teardownHooks,selection:ut,runningStepId:Y.runningStepId,terminalState:At,draftState:Dt,ariaTree:Y.ariaTree,errorMessage:Y.error,devtoolsTab:lt,canRunAll:jt,isRunningAll:Y.isRunningAll,isStoppingRunAll:Y.isStoppingRunAll,setupHooksStale:kt,onDevtoolsTabChange:z,onRunAll:()=>{if(!J){C.error(`Fix YAML errors before running live steps. Live mode uses the current valid draft, not the last valid snapshot.`);return}Y.runAll(J)},onStopAll:Y.cancelRunAll,onEndSession:Ft,onRestartSession:kt?()=>void Rt():void 0,showEndSessionAction:u,onCloseLiveMode:Pt,onStartFreshSession:()=>void Lt(),onBack:Y.goBack,onForward:Y.goForward,onRefresh:Y.refreshPage,onNavigate:Y.navigate,onRequestAriaTree:Y.requestAriaTree});return(0,D.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,D.jsx)(pe,{testName:p?`New Test`:K?.name??f,testId:K?.testId??``,unsaved:W,isCreateMode:p,mode:p?`view`:`edit`,testHref:p?void 0:S.testView(f),isSaving:Ye,isValidating:nt,isRunning:ot,runDisabled:Mt,hasInvalidFilename:xt,showTestId:!1,hasLiveSession:Q,liveConnectionState:Z,isLiveActionDisabled:Nt,liveSessionNumber:j,onBack:()=>a(p?S.tests:S.testView(f)),onSave:$,onValidate:Bt,onRun:Vt,onLiveConnect:N?void 0:Lt,onLiveEnd:Q?Ft:void 0,onSettingsOpen:()=>mt(!0),shortcutsOpen:ht,onToggleShortcuts:()=>gt(e=>!e)}),O?(0,D.jsxs)(He,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,D.jsx)(T,{defaultSize:60,minSize:30,children:(0,D.jsx)(n,{value:v,onChange:y,onSave:$,className:`h-full`})}),(0,D.jsx)(Ue,{withHandle:!0}),(0,D.jsx)(T,{defaultSize:40,minSize:25,children:(0,D.jsx)(l,{runId:O,onClose:Ht})})]}):N&&!u?(0,D.jsxs)(He,{orientation:`horizontal`,className:`flex-1 rounded-md border border-border`,children:[(0,D.jsx)(T,{defaultSize:42,minSize:34,children:qt}),(0,D.jsx)(Ue,{withHandle:!0}),(0,D.jsx)(T,{defaultSize:58,minSize:38,children:Jt})]}):qt,(0,D.jsx)(De,{open:pt,onOpenChange:mt,children:(0,D.jsxs)(je,{side:`right`,className:`sm:max-w-[400px] overflow-y-auto p-0`,children:[(0,D.jsxs)(Se,{className:`px-4 pt-4 pb-2`,children:[(0,D.jsx)(Ne,{children:`Test Settings`}),(0,D.jsx)(Ve,{children:`Advanced configuration for this test`})]}),(0,D.jsx)(`div`,{className:`px-4 pb-4`,children:(0,D.jsx)(s,{content:v,onChange:y,selectedTarget:K?.target})})]})}),u&&(0,D.jsx)(De,{open:N,onOpenChange:zt,children:(0,D.jsxs)(je,{side:`bottom`,showCloseButton:!1,className:`h-[100dvh] max-h-[100dvh] rounded-none p-0`,children:[(0,D.jsxs)(Se,{className:`sr-only`,children:[(0,D.jsx)(Ne,{children:`Live Session`}),(0,D.jsx)(Ve,{children:`Live execution workspace for the current draft.`})]}),Jt]})})]})}export{at 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-D0GpDfUa.js";import{t as o}from"./circle-alert-D7wbtVU2.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-BpTnHwvn.js";import{n as ne,r as O}from"./monaco-editor-BEWq4fzI.js";import{c as k,t as A}from"./split-button-CRYV8xU8.js";import{t as re}from"./grip-vertical-C5AW4fiD.js";import{n as j,r as M,t as N}from"./shortcut-hints-B8kCurzo.js";import{t as ie}from"./plus-Bf5Mbita.js";import{t as P}from"./refresh-cw-D0OwRzvm.js";import{n as F,t as ae}from"./textarea-BFsDx2mB.js";import{t as oe}from"./square-K8N8Yius.js";import{a as I,r as L}from"./dist-BsGrTrYb.js";import{n as R,r as z,t as se}from"./popover-OAiTzjiL.js";import{t as ce}from"./switch-Dv7aVqt1.js";import{$n as B,Bn as V,Fn as le,Ft as H,Gn as ue,Gt as U,In as de,Ln as fe,Mt as W,Nn as pe,Nt as G,Pn as me,Tn as he,Ut as K,Vn as ge,Wn as q,Wt as J,an as _e,cn as ve,cr as ye,dn as be,fn as xe,in as Se,jn as Ce,ln as we,mr as Te,on as Ee,rn as De,sn as Oe,un as ke,wn as Ae,zn as je}from"./index-C3AdCkmj.js";import{t as Me}from"./badge-ClWCtaXi.js";var Y=e(Te(),1),X=B(),Ne=`AlertDialog`,[Pe,Fe]=he(Ne,[xe]),Z=xe(),Ie=e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,X.jsx)(ve,{...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)(ke,{...i,...r,ref:t})});Re.displayName=Le;var ze=`AlertDialogPortal`,Be=e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,X.jsx)(Oe,{...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)(Ee,{...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=pe(t,o),c=Y.useRef(null);return(0,X.jsx)(be,{contentName:Q,titleName:qe,docsSlug:`alert-dialog`,children:(0,X.jsx)(Ue,{scope:n,cancelRef:c,children:(0,X.jsxs)(Se,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:Ae(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)(we,{...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)(_e,{...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)(De,{...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=pe(t,i);return(0,X.jsx)(De,{...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:U(`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:U(`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:U(`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:U(`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:U(`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:U(`text-sm text-muted-foreground`,e),...t})}function bt({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,X.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,X.jsx)(st,{"data-slot":`alert-dialog-action`,className:U(e),...r})})}function xt({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,X.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,X.jsx)(ct,{"data-slot":`alert-dialog-cancel`,className:U(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)(q,{className:`size-3.5 text-emerald-500`});case`failure`:return(0,X.jsx)(de,{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)(V,{className:`size-3.5 animate-spin text-primary`});case`cancelling`:return(0,X.jsx)(V,{className:`size-3.5 animate-spin text-amber-500`});case`passed`:return(0,X.jsx)(q,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,X.jsx)(de,{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},H=(0,Y.useCallback)(t=>{!b||wt(t)||b(e)},[e,b]);return(0,X.jsxs)(`div`,{ref:O,style:le,onClick:e=>H(e.target),className:U(`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)(fe,{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:U(`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)(J,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>m?.(t),disabled:s||!m,children:[l===`cancelling`?(0,X.jsx)(V,{className:`size-3 animate-spin`}):(0,X.jsx)(oe,{className:`size-3`}),`Cancel`]}):(0,X.jsxs)(J,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>p?.(t),disabled:s||!f||!p,children:[(0,X.jsx)(je,{className:`size-3`}),`Run`]})),(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>ee?.(e),disabled:s,className:U(`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)(fe,{className:`size-3.5`})}),(0,X.jsxs)(dt,{children:[(0,X.jsx)(ft,{asChild:!0,children:(0,X.jsx)(J,{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)(me,{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:U(`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)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsx)(ge,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,X.jsx)(G,{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)(J,{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)(ye,{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)(q,{className:`size-3.5 text-emerald-500`});case`failed`:return(0,X.jsx)(de,{className:`size-3.5 text-destructive`});default:return(0,X.jsx)(le,{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:U(`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)(J,{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)(je,{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)(le,{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)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsx)(ge,{className:`h-3 w-3 text-muted-foreground/40 hover:text-muted-foreground/70 transition-colors cursor-help`})}),(0,X.jsx)(G,{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)(J,{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)(ye,{to:`/tests`,className:`text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:`Tests`}),(0,X.jsx)(ue,{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)(ye,{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)(ue,{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)(J,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(ye,{to:a,children:[`Edit`,(0,X.jsx)(N,{shortcut:`E`})]})}):(0,X.jsxs)(J,{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)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsxs)(J,{size:`sm`,onClick:y,disabled:h||!y,children:[m===`connecting`?(0,X.jsx)(V,{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)(G,{className:`max-w-sm text-[13px]`,children:k})]}),!r&&(0,X.jsxs)(se,{open:d,onOpenChange:e=>{e||S()},children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(J,{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)(G,{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)(J,{variant:`ghost`,size:`sm`,onClick:_,disabled:s||u,children:[(0,X.jsx)(q,{className:`h-3.5 w-3.5`}),s?`Validating...`:`Validate`]}),(0,X.jsxs)(J,{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)(J,{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)(J,{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)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsxs)(J,{size:`sm`,onClick:y,disabled:h||!y,children:[m===`connecting`?(0,X.jsx)(V,{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)(G,{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)(W,{children:[(0,X.jsx)(H,{asChild:!0,children:(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(J,{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)(G,{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};