@capagents/forgeqe 3.3.7 → 3.3.9

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 (132) hide show
  1. package/HOW_TO_USE.md +92 -0
  2. package/dist/a11y-runtime.mjs +3204 -0
  3. package/dist/docs-site/docs/area-quality/index.html +90 -2
  4. package/dist/docs-site/docs/overview/index.html +1 -1
  5. package/dist/docs-site/docs/search.js +1 -1
  6. package/dist/forgeqe.js +2215 -2094
  7. package/dist/template.html +69 -70
  8. package/dist/web/assets/{3d-force-graph-Bsispdm1.js → 3d-force-graph-BPsVSYjw.js} +1 -1
  9. package/dist/web/assets/Agent-DY6pRvcD.js +10 -0
  10. package/dist/web/assets/{AgentWork-BugEUl60.js → AgentWork-Brch_Mn3.js} +1 -1
  11. package/dist/web/assets/ApiTests-BtWKVPw5.js +17 -0
  12. package/dist/web/assets/{Browse-Dl2Lneca.js → Browse-DbIFxsy8.js} +1 -1
  13. package/dist/web/assets/Chat-BWiH0XGV.js +3 -0
  14. package/dist/web/assets/{CommandPalette-B7YPDCOk.js → CommandPalette-DfoEUEL6.js} +1 -1
  15. package/dist/web/assets/{Compare-D6XsFmmb.js → Compare-DTZ_BW1P.js} +1 -1
  16. package/dist/web/assets/Cost-DDghPWch.js +1 -0
  17. package/dist/web/assets/Data-DZlKsTwA.js +6 -0
  18. package/dist/web/assets/Desktop-DTIZ62Pi.js +1 -0
  19. package/dist/web/assets/DesktopReview-B8-dSGJH.js +2 -0
  20. package/dist/web/assets/Evidence-BYw_Q4Ul.js +1 -0
  21. package/dist/web/assets/Explore-BL_c5WK1.js +2 -0
  22. package/dist/web/assets/{Features-N3_77mz-.js → Features-DrFNrvbh.js} +1 -1
  23. package/dist/web/assets/Flags-CHrDwhqG.js +2 -0
  24. package/dist/web/assets/Flaky-DtcLf8h6.js +1 -0
  25. package/dist/web/assets/Impact-CMU_ijo2.js +3 -0
  26. package/dist/web/assets/Jobs-BjybdQb_.js +5 -0
  27. package/dist/web/assets/KindPage-VK-Vgkzv.js +6 -0
  28. package/dist/web/assets/{LiveDevice-j7NZXIJZ.js → LiveDevice-BqL1P33F.js} +1 -1
  29. package/dist/web/assets/Migration-7BI7iXIv.js +8 -0
  30. package/dist/web/assets/Mobile-AgAhvlVL.js +1 -0
  31. package/dist/web/assets/Observability-5r36Xf3d.js +1 -0
  32. package/dist/web/assets/{OwnItems-BdiPfdTw.js → OwnItems-CqCOuvba.js} +4 -4
  33. package/dist/web/assets/PageAgent-00NQxK49.js +1 -0
  34. package/dist/web/assets/Product-B75ztJFn.js +6 -0
  35. package/dist/web/assets/Production-lIUlcjf0.js +1 -0
  36. package/dist/web/assets/Quality-BlRpB6mx.js +1 -0
  37. package/dist/web/assets/Readiness-CesaSDtp.js +1 -0
  38. package/dist/web/assets/Record-CLy9jQ5N.js +1 -0
  39. package/dist/web/assets/Regression-BjpZrkfK.js +5 -0
  40. package/dist/web/assets/{RelationGraph-Blfs7PhK.js → RelationGraph-ClPBGuMw.js} +1 -1
  41. package/dist/web/assets/{Reports-HQkTX4Kr.js → Reports-Du8SNiHM.js} +2 -2
  42. package/dist/web/assets/Requirements-Dr1iLoMc.js +2 -0
  43. package/dist/web/assets/Responsive-DcD6MLzG.js +3 -0
  44. package/dist/web/assets/{RunDiff-75a-smeg.js → RunDiff-cLSFOsfC.js} +1 -1
  45. package/dist/web/assets/{Settings-BaodIliH.js → Settings-CUT5ggDd.js} +16 -16
  46. package/dist/web/assets/SiteScan-iUfWBeLV.js +5 -0
  47. package/dist/web/assets/{Steps-ZPH_rTJh.js → Steps-DJYwIiDu.js} +2 -2
  48. package/dist/web/assets/{TestData-DUlTo5qt.js → TestData-DqEcL5o4.js} +2 -2
  49. package/dist/web/assets/TestManagement-mBcfWTVH.js +4 -0
  50. package/dist/web/assets/{WhatsNew-BrVNacPl.js → WhatsNew-DrPf6l9-.js} +1 -1
  51. package/dist/web/assets/{agentSettingsSheet-UCqUtdjq.js → agentSettingsSheet-DyaVNewv.js} +1 -1
  52. package/dist/web/assets/api-Dr3U7W5w.js +1 -0
  53. package/dist/web/assets/{choice-C4-yW2x9.js → choice-W0qOx_1k.js} +1 -1
  54. package/dist/web/assets/{coverage-pqIlfEP0.js → coverage-DbHm8BUP.js} +3 -3
  55. package/dist/web/assets/{dataParts-C0C67bVQ.js → dataParts-Bdf97ZOD.js} +3 -3
  56. package/dist/web/assets/{desktopAppPath-B89LKvjx.js → desktopAppPath-kQmQOW6a.js} +1 -1
  57. package/dist/web/assets/{flowTheme-BNKwRxun.js → flowTheme-CVnIjV_m.js} +1 -1
  58. package/dist/web/assets/frame-CavkQick.js +13 -0
  59. package/dist/web/assets/index-BaEsXdFc.css +2 -0
  60. package/dist/web/assets/index-C1kXcI0E.js +57 -0
  61. package/dist/web/assets/line-icons-Cwj9OmCz.js +1 -0
  62. package/dist/web/assets/{logos-P2LOMyTK.js → logos-Cf-Wf5ex.js} +1 -1
  63. package/dist/web/assets/{markdown-CxsWgpYs.js → markdown-Bvv6oj4v.js} +3 -3
  64. package/dist/web/assets/{nav-DYgvAJu-.js → nav-DVPiPhOy.js} +1 -1
  65. package/dist/web/assets/pageBack-Blig1Uqs.js +3 -0
  66. package/dist/web/assets/{palette-BgJTq_Ot.js → palette-DwrGI2Fp.js} +1 -1
  67. package/dist/web/assets/{paletteCommands-Isq1rLs-.js → paletteCommands-DOF2o-rv.js} +1 -1
  68. package/dist/web/assets/parts-DgJ2y_ic.js +1 -0
  69. package/dist/web/assets/{productParts-ZEi0sPIk.js → productParts-B78jij3z.js} +1 -1
  70. package/dist/web/assets/qualityParts-t5t9kEKG.js +2 -0
  71. package/dist/web/assets/{recordTest-Bz5ryzpS.js → recordTest-BbXVOuGZ.js} +1 -1
  72. package/dist/web/assets/{route-oDy8sV6H.js → route-9BkoTWUE.js} +1 -1
  73. package/dist/web/assets/{sectionList-B651VPon.js → sectionList-DMyhAqst.js} +1 -1
  74. package/dist/web/assets/{step-mark-CaKf4dAR.js → step-mark-Bu6fNKW8.js} +1 -1
  75. package/dist/web/assets/stepper-CE4yOLqn.js +1 -0
  76. package/dist/web/assets/wizardParts-Bxb9UG5k.js +1 -0
  77. package/dist/web/index.html +11 -11
  78. package/docs/ForgeQE-Static-Analysis-Report-4008e9ee.html +207 -0
  79. package/docs/ForgeQE-Static-Analysis-Report-4008e9ee.pdf +0 -0
  80. package/docs/{ForgeQE-Static-Analysis-Report-5bbf0da7.html → ForgeQE-Static-Analysis-Report-ccbdac00.html} +33 -33
  81. package/docs/ForgeQE-Static-Analysis-Report-ccbdac00.pdf +0 -0
  82. package/docs/user-guide.html +89 -1
  83. package/forgeqe.example.yaml +1 -1
  84. package/package.json +2 -2
  85. package/prompts/brain.md +7 -0
  86. package/py/forgeqe_engine/cli.py +57 -0
  87. package/py/forgeqe_engine/diagnostics.py +32 -2
  88. package/py/forgeqe_engine/logins.py +11 -0
  89. package/py/forgeqe_engine/persona.py +90 -1
  90. package/py/forgeqe_engine/scan.py +202 -0
  91. package/py/forgeqe_engine/seo.py +95 -0
  92. package/py/forgeqe_engine/seo_analytics.mjs +59 -0
  93. package/py/forgeqe_engine/seo_facts.mjs +63 -0
  94. package/py/forgeqe_engine/seo_site.mjs +36 -0
  95. package/py/forgeqe_engine/service.py +3 -2
  96. package/dist/web/assets/Agent-39FbaH7G.js +0 -10
  97. package/dist/web/assets/ApiTests-B9rtwCbe.js +0 -17
  98. package/dist/web/assets/Chat-DocT7FlH.js +0 -3
  99. package/dist/web/assets/Cost-DvbuXS6u.js +0 -1
  100. package/dist/web/assets/Data-BmZHJkfj.js +0 -6
  101. package/dist/web/assets/Desktop-DD3F69ih.js +0 -1
  102. package/dist/web/assets/DesktopReview-BR0LtVFw.js +0 -2
  103. package/dist/web/assets/Evidence-OqAiYzrl.js +0 -1
  104. package/dist/web/assets/Explore-QNyusEFo.js +0 -2
  105. package/dist/web/assets/Flags-Yv4Ttmmh.js +0 -2
  106. package/dist/web/assets/Flaky-Bg2f2K1U.js +0 -1
  107. package/dist/web/assets/Impact-CpxvVnKj.js +0 -3
  108. package/dist/web/assets/Jobs-_gZTxoaG.js +0 -5
  109. package/dist/web/assets/KindPage-Amr6R7Ym.js +0 -6
  110. package/dist/web/assets/Migration-DfPYzTfk.js +0 -8
  111. package/dist/web/assets/Mobile-fIhhQPsp.js +0 -1
  112. package/dist/web/assets/Observability-13DkrRp2.js +0 -1
  113. package/dist/web/assets/PageAgent-CC8Ha6vu.js +0 -1
  114. package/dist/web/assets/Product-CnXkqwQm.js +0 -6
  115. package/dist/web/assets/Production-5mTIt4sr.js +0 -1
  116. package/dist/web/assets/Quality-DbLcbP1X.js +0 -1
  117. package/dist/web/assets/Readiness-BG1xmC09.js +0 -1
  118. package/dist/web/assets/Record-sFth-2I1.js +0 -1
  119. package/dist/web/assets/Regression-Dd4y8I1z.js +0 -5
  120. package/dist/web/assets/Requirements-DmhUNCIP.js +0 -2
  121. package/dist/web/assets/Responsive-D18eYdCh.js +0 -3
  122. package/dist/web/assets/TestManagement-DUMGdHDw.js +0 -4
  123. package/dist/web/assets/api-D8-lxyQi.js +0 -1
  124. package/dist/web/assets/frame-C8sL1yo-.js +0 -13
  125. package/dist/web/assets/index-BFG13fbg.js +0 -55
  126. package/dist/web/assets/index-DBnWgocz.css +0 -2
  127. package/dist/web/assets/line-icons-CwCZidXs.js +0 -1
  128. package/dist/web/assets/pageBack-BefA2rh7.js +0 -3
  129. package/dist/web/assets/parts-BNpm4gXC.js +0 -1
  130. package/dist/web/assets/qualityParts-DtsD70Qh.js +0 -1
  131. package/dist/web/assets/stepper-CONWT_tv.js +0 -1
  132. package/dist/web/assets/wizardParts-CulZqqjz.js +0 -1
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{B as r,F as i,H as a,R as o,c as s,l as c}from"./preload-helper-BupTYkQW.js";import{n as l,t as u}from"./utils-DJRAScIl.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{d as f}from"./sectionList-B651VPon.js";import{v as p}from"./api-D8-lxyQi.js";import{C as m,_ as h,c as g,g as _,n as v,v as ee,x as y}from"./pageBack-BefA2rh7.js";import{Cr as te,Ln as b,Pn as x,Rr as S,V as C,hn as w,in as T,ir as E,o as ne,or as re,rt as ie,vt as D,w as O,zn as k}from"./line-icons-CwCZidXs.js";import{Ct as A,Et as j,Jt as ae,Yt as oe,_t as M,bt as N,ft as P,vt as F}from"./frame-C8sL1yo-.js";import{t as se}from"./when-BuWCTaKm.js";import{u as I}from"./nav-DYgvAJu-.js";import{i as L,r as R,s as z}from"./markdown-CxsWgpYs.js";import{H as B,J as ce,V as le,X as V,l as ue,n as de,t as H}from"./index-BFG13fbg.js";import{t as fe}from"./step-mark-CaKf4dAR.js";import{t as pe}from"./stepper-CONWT_tv.js";import{n as me,r as he}from"./wizardParts-CulZqqjz.js";import{i as ge,t as _e}from"./parts-BNpm4gXC.js";var U=e(t(),1),ve=/^[a-z0-9][a-z0-9-]{0,79}$/,W={overview:()=>p(`GET`,`/api/requirements`),review:e=>p(`GET`,`/api/requirements/review?id=${encodeURIComponent(e)}`),job:()=>p(`GET`,`/api/requirements/job`),report:(e,t)=>p(`GET`,`/api/requirements/report?id=${encodeURIComponent(e)}&doc=${t}`),start:e=>p(`POST`,`/api/requirements/start`,e),stop:()=>p(`POST`,`/api/requirements/stop`,{}),open:(e,t)=>p(`POST`,`/api/requirements/open`,{id:e,file:t})},G=d(),ye=300,be=2e5,xe=`As an operations user I can refund a card payment within 30 days of capture, in part or in full, so that customers get their money back without a support ticket.`;function Se({info:e,onStarted:t}){let[n,r]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,d]=(0,U.useState)([]),[f,p]=(0,U.useState)(!0),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(``),ee=n.trim().length>0&&s.trim().length>=10&&!h&&!e.job?.running,te=async()=>{g(!0),v(``);try{let e=await W.start({op:`review`,title:n.trim(),design:s,personas:l,consolidate:f});e.target&&t(e.target)}catch(e){v(e.message),g(!1)}};return(0,G.jsxs)(`section`,{"aria-labelledby":`rq-new`,className:`flex min-w-0 flex-col gap-6`,children:[(0,G.jsx)(V,{id:`rq-new`,icon:D,title:`Which requirement should be reviewed?`}),_&&(0,G.jsx)(`p`,{role:`alert`,className:u(m.fail,`m-0`),children:_}),e.job?.running&&(0,G.jsx)(`p`,{role:`status`,className:u(m.info,`m-0`),children:`A review is being written. Start this one when it ends.`}),(0,G.jsx)(me,{id:`rq-title`,label:`Title`,help:`What the requirement is called, as in your backlog.`,children:(0,G.jsx)(i,{id:`rq-title`,value:n,maxLength:ye,placeholder:`Card refunds`,onChange:e=>r(e.target.value.replace(/[\r\n]+/g,` `))})}),(0,G.jsx)(me,{id:`rq-design`,label:`The requirement`,help:`Paste the story, its acceptance criteria and any notes. ${s.length}/${be}`,children:(0,G.jsx)(o,{id:`rq-design`,value:s,rows:10,maxLength:be,placeholder:xe,onChange:e=>c(e.target.value)})}),(0,G.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,G.jsxs)(`legend`,{className:`mb-2 p-0 text-body-sm font-medium`,children:[`Business personas who review it (`,l.length,`/`,6,`)`]}),e.personas.map(e=>{let t=l.includes(e.id);return(0,G.jsxs)(`label`,{className:u(a,`items-start gap-2`),children:[(0,G.jsx)(ce,{className:`mt-1`,checked:t,disabled:!t&&l.length>=6,onCheckedChange:t=>d(t?[...l,e.id]:l.filter(t=>t!==e.id))}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsx)(`span`,{className:`text-body-sm`,children:e.name}),(0,G.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e.role,e.builtIn?``:` · this project's`]})]})]},e.id)}),e.notLoaded.length>0&&(0,G.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Not loaded: `,e.notLoaded.join(`; `)]})]}),(0,G.jsxs)(`label`,{className:u(a,`items-start gap-2`),children:[(0,G.jsx)(ce,{className:`mt-1`,checked:f,onCheckedChange:e=>p(!!e)}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsx)(`span`,{className:`text-body-sm`,children:`Write the requirements report too`}),(0,G.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The reviews folded into one report with ids (FR-001, NFR-001) that test cases trace to. Takes longer.`})]})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-4`,children:(0,G.jsxs)(y,{variant:`primary`,disabled:!ee,onClick:()=>void te(),children:[(0,G.jsx)(x,{"aria-hidden":`true`}),h?`Starting…`:`Review`]})})]})}function Ce(e,t){return t?.running&&t.target===e.id?{label:`Working`,tone:`running`}:e.status===`complete`?e.open?{label:`${e.open} open`,tone:`neutral`}:{label:`Ready`,tone:`pass`}:{label:`Not finished`,tone:`warn`}}var we=(e,t)=>t?.running&&t.target===e.id?`working`:e.open||e.status!==`complete`?`open`:`ready`;function Te({rows:e,job:t}){let[r,i]=(0,U.useState)(`all`),a=n=>n===`all`?e.length:e.filter(e=>we(e,t)===n).length,o=e.filter(e=>r===`all`||we(e,t)===r),s=e=>location.hash=n(`requirements`,e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(le,{label:`Reviews by status`,children:[(0,G.jsx)(B,{dot:`neutral`,value:a(`all`),label:`reviews`,onClick:()=>i(`all`),on:r===`all`}),(0,G.jsx)(B,{dot:`running`,value:a(`working`),label:`working`,onClick:()=>i(`working`),on:r===`working`}),(0,G.jsx)(B,{dot:`warn`,value:a(`open`),label:`with open items`,onClick:()=>i(`open`),on:r===`open`}),(0,G.jsx)(B,{dot:`pass`,value:a(`ready`),label:`ready`,onClick:()=>i(`ready`),on:r===`ready`})]}),(0,G.jsx)(M,{label:`Reviews`,placeholder:`Find a review`,empty:r===`all`?`No reviews.`:`None here.`,resetKey:r,height:F,head:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`th`,{scope:`col`,className:A,children:`Requirement`}),(0,G.jsx)(`th`,{scope:`col`,className:A,children:`Score`}),(0,G.jsx)(`th`,{scope:`col`,className:A,children:`Status`}),(0,G.jsx)(`th`,{scope:`col`,className:u(A,`hidden @xl:table-cell`),children:`When`})]}),children:o.map(e=>{let r=Ce(e,t);return(0,G.jsxs)(`tr`,{onClick:()=>s(e.id),className:j,children:[(0,G.jsxs)(`td`,{className:N,children:[(0,G.jsx)(`a`,{href:n(`requirements`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline [overflow-wrap:anywhere] hover:underline`,children:e.title}),(0,G.jsx)(`span`,{className:`block text-body-sm text-muted`,children:e.id})]}),(0,G.jsx)(`td`,{className:u(N,`text-body-sm whitespace-nowrap tabular-nums`),"data-sort":e.score??-1,children:e.score===null?(0,G.jsx)(`span`,{className:`text-muted`,children:`Not scored`}):`${e.score}/100`}),(0,G.jsx)(`td`,{className:u(N,`whitespace-nowrap`),children:(0,G.jsx)(_,{tone:r.tone,children:r.label})}),(0,G.jsx)(`td`,{className:u(N,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-sort":new Date(e.created).getTime()||0,children:e.created?se(e.created):``})]},e.id)})})]})}var Ee=[`Overview`,`Business Analyst`,`Product Manager`,`Product Owner`,`Solution Architect`,`Developer`,`QA`,`Scrum Master`];function De(e){return[`@@ -1,${e.filter(e=>e.op!==`+`).length} +1,${e.filter(e=>e.op!==`-`).length} @@`,...e.map(e=>`${e.op}${e.text.replace(/[\r\n]+/g,` `)}`)].join(`
2
- `)}var K=e=>(e?.lines??[]).filter(e=>!e.startsWith(`{`)&&!e.startsWith(`[`));function Oe(e,t,n){let r=n?K(t):[],i=new Set([...e.reviewers.map(e=>e.heading),...r.flatMap(e=>e.startsWith(`Done: `)?[e.slice(6)]:[])]),a=n?[...r].reverse().map(e=>/^Running (.+?) \(\d+\/\d+\)$/.exec(e)?.[1]).find(Boolean):void 0,o=[...Ee.map(e=>({heading:e,persona:!1})),...e.personas.map(e=>({heading:`Persona review: ${e.name}`,persona:!0}))];for(let t of e.reviewers)o.some(e=>e.heading===t.heading)||o.push({heading:t.heading,persona:t.persona});return o.map(e=>({...e,state:i.has(e.heading)?`done`:a===e.heading?`running`:`pending`}))}var ke=104,Ae=280;function q({className:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)();return(0,U.useLayoutEffect)(()=>{let e=()=>{let e=n.current?.getBoundingClientRect().top;e!==void 0&&i(Math.max(Ae,Math.round(window.innerHeight-e-ke)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,G.jsx)(`div`,{ref:n,className:u(`grid auto-rows-[minmax(0,1fr)] gap-6`,e),style:r?{height:r}:void 0,children:t})}function J({label:e,className:t,children:n}){return(0,G.jsx)(`section`,{...e?{"aria-label":e}:{},className:u(`flex h-full min-h-0 min-w-0 flex-col gap-4 overflow-y-auto`,t),children:n})}function je({review:e}){let t=e.quality,n=t.overall!==null&&e.scoreBefore!==null?t.overall-e.scoreBefore:0;return(0,G.jsxs)(`div`,{className:u(c,`flex flex-wrap items-center gap-x-8 gap-y-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,G.jsx)(g,{value:t.overall,label:`Quality`,size:`lg`}),n!==0&&(0,G.jsx)(`span`,{className:u(`text-body-sm`,n>0?`text-pass`:`text-fail`),children:`${n>0?`+`:``}${n} since the review`})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-4 @3xl:grid-cols-6`,children:t.dimensions.map(e=>(0,G.jsx)(g,{value:e.score,label:e.label},e.key))}),t.rationale&&(0,G.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:t.rationale})]})]})}function Me({review:e,job:t,live:n}){let r=Oe(e,t,n),i=r.filter(e=>e.state===`done`).length,o=r.find(e=>e.state===`running`),l=[{heading:`Score`,done:e.quality.overall!==null},{heading:`Gaps and questions`,done:e.status===`complete`||e.items.length>0},{heading:`Requirements report`,done:e.document===`02-requirements-report.md`}],d=K(t).slice(-40),f=Object.entries(e.context.byProvider),p=Math.round(i/Math.max(1,r.length)*100);return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:u(c,`flex flex-col gap-4`),children:[(0,G.jsx)(ge,{label:n?`Reviewer ${Math.min(i+1,r.length)} of ${r.length}`:`${i} of ${r.length} reviewers`,value:`${p}%`,sub:n?o?.heading??`Starting`:i===r.length?`Every reviewer has written their section`:`The review stopped before every reviewer wrote`}),(0,G.jsx)(_e,{value:p,label:`Reviewers done`})]}),(0,G.jsxs)(q,{className:`grid-cols-[minmax(0,1fr)] @4xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,G.jsxs)(J,{label:`Reviewers`,children:[(0,G.jsx)(V,{icon:T,title:`Reviewers`,level:3,n:`${i} of ${r.length}`}),(0,G.jsxs)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:[r.map((e,t)=>(0,G.jsxs)(`li`,{className:u(a,`items-center gap-4`),...e.state===`running`?{"aria-current":`step`}:{},children:[(0,G.jsx)(fe,{state:e.state,n:t+1}),(0,G.jsx)(`span`,{className:u(`min-w-0 flex-1 text-body-sm`,e.state===`pending`&&`text-muted`),children:e.heading}),e.persona&&(0,G.jsx)(_,{tone:`neutral`,icon:!1,children:`Persona`}),(0,G.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.state===`done`?`Done`:e.state===`running`?`Reviewing`:`Waiting`})]},e.heading)),l.map((e,t)=>(0,G.jsxs)(`li`,{className:u(a,`items-center gap-4`),children:[(0,G.jsx)(fe,{state:e.done?`done`:`pending`,n:r.length+t+1}),(0,G.jsx)(`span`,{className:u(`min-w-0 flex-1 text-body-sm`,!e.done&&`text-muted`),children:e.heading}),(0,G.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.done?`Done`:`Then`})]},e.heading))]})]}),(0,G.jsx)(J,{label:n?`Live activity`:`What the reviewers read`,className:s,children:n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(V,{icon:w,title:`Live activity`,level:3}),(0,G.jsx)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:d.length?d.map((e,t)=>(0,G.jsx)(`li`,{className:u(`text-body-sm`,t===d.length-1?`text-ink`:`text-muted`),children:e},`${t}-${e}`)):(0,G.jsx)(`li`,{className:`text-body-sm text-muted`,children:`Starting…`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(V,{icon:D,title:`What the reviewers read`,level:3}),(0,G.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 text-body-sm`,children:[(0,G.jsx)(`li`,{children:`The requirement as you wrote it`}),f.map(([e,t])=>(0,G.jsxs)(`li`,{children:[t,` from `,e.replace(` (from ForgeQE)`,``)]},e)),!f.length&&(0,G.jsx)(`li`,{className:`text-muted`,children:`No knowledge, search or earlier decisions matched it`})]}),e.personas.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(V,{icon:T,title:`Personas`,level:3,n:e.personas.length}),(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 text-body-sm`,children:e.personas.map(e=>(0,G.jsxs)(`li`,{children:[e.name,` `,(0,G.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.role]})]},e.id))})]})]})})]})]})}function Y(e,t,n){let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(``);return(0,U.useEffect)(()=>{let n=!0;return W.report(e,t).then(e=>n&&(i(e.markdown),o(``)),e=>n&&(i(null),o(e.message))),()=>{n=!1}},[e,t,n]),{text:r,error:a}}var Ne=e=>[...e.matchAll(/^##\s+(.+?)\s*$/gm)].map(e=>e[1].replace(/[*_`]/g,``)).slice(0,40);function Pe({raw:e,label:t}){let n=(0,U.useRef)(null),i=e.replace(/^\s*#\s+[^\n]*\n/,``),o=Ne(i),[s,l]=(0,U.useState)(0),d=e=>{l(e),n.current?.querySelectorAll(`h2`)[e]?.scrollIntoView({behavior:r(),block:`start`})};return(0,G.jsxs)(q,{className:`grid-cols-[minmax(0,1fr)] @4xl:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,G.jsx)(J,{className:`hidden @4xl:flex`,children:(0,G.jsx)(`nav`,{"aria-label":`Sections of the ${t}`,children:(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:o.map((e,t)=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"aria-current":s===t?`true`:void 0,onClick:()=>d(t),className:u(a,`items-start gap-2`),children:[(0,G.jsxs)(`span`,{className:`w-6 flex-none text-muted tabular-nums`,children:[t+1,`.`]}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:e})]})},`${t}-${e}`))})})}),(0,G.jsx)(J,{label:t,className:c,children:(0,G.jsx)(`div`,{ref:n,className:`min-w-0`,children:(0,G.jsx)(R,{text:i,className:u(`text-body-md`,L)})})})]})}function X({text:e,error:t,label:n}){return t?(0,G.jsx)(`p`,{role:`alert`,className:u(m.fail,`m-0`),children:t}):e===null?(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}):(0,G.jsx)(Pe,{raw:e,label:n})}function Fe({review:e,version:t}){let{text:n,error:r}=Y(e.id,`spec`,t);return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,G.jsx)(je,{review:e}),(0,G.jsx)(X,{text:n,error:r,label:`Spec Circuit report`})]})}var Z=e=>e.kind===`gap`?`Gaps`:e.category||`Questions`;function Ie({review:e,locked:t,act:n,open:r,setOpen:i}){let o=[...new Set(e.items.map(Z))],c=e.items.find(e=>e.index===r)??e.items.find(e=>e.status===`open`)??e.items[0],[l,d]=(0,U.useState)(c?Z(c):o[0]??``);(0,U.useEffect)(()=>{c&&Z(c)!==l&&d(Z(c))},[c?.index]);let f=e.items.filter(e=>Z(e)===l),p=e.items.filter(e=>e.status!==`open`).length,m=t=>i(e.items.find(e=>e.status===`open`&&e.index>t)?.index??e.items.find(e=>e.status===`open`&&e.index!==t)?.index??null);return e.items.length?(0,G.jsxs)(q,{className:`grid-cols-[minmax(0,1fr)] @5xl:grid-cols-[220px_280px_minmax(0,1fr)]`,children:[(0,G.jsxs)(J,{className:s,children:[(0,G.jsx)(g,{value:e.quality.overall,label:`Quality`,size:`lg`}),(0,G.jsx)(`span`,{className:`text-center text-body-sm text-muted`,children:`${p} of ${e.items.length} resolved`}),(0,G.jsx)(`nav`,{"aria-label":`Kinds of issue`,children:(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:o.map(t=>{let n=e.items.filter(e=>Z(e)===t).filter(e=>e.status===`open`).length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"aria-current":t===l?`true`:void 0,onClick:()=>d(t),className:u(a,`gap-2`),children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:t}),(0,G.jsx)(_,{tone:n?`warn`:`pass`,icon:!1,children:n?`${n} open`:`Done`})]})},t)})})})]}),(0,G.jsxs)(J,{label:`${l}: issues`,children:[(0,G.jsx)(V,{icon:T,title:l,level:3,n:f.length}),(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:f.map(t=>{let n=t.status===`accepted`?`pass`:t.status===`skipped`?`neutral`:e.proposal?.index===t.index?`warn`:void 0;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"aria-current":c?.index===t.index?`true`:void 0,onClick:()=>i(t.index),className:u(a,`flex-col items-start gap-1`),children:[(0,G.jsxs)(`span`,{className:u(t.status!==`open`&&`text-muted`),children:[t.index,`. `,t.text]}),n&&(0,G.jsx)(_,{tone:n,icon:!1,children:t.status===`accepted`?`Kept`:t.status===`skipped`?`Skipped`:`Change proposed`})]})},t.index)})})]}),c?(0,G.jsx)(Le,{item:c,review:e,locked:t,act:n,onAccepted:()=>m(c.index)},c.index):(0,G.jsx)(J,{label:`Issue`,children:` `})]}):(0,G.jsx)(h,{icon:w,title:`No gaps or questions`,children:`The review listed none: go on to the requirements report.`})}function Le({item:e,review:t,locked:n,act:r,onAccepted:i}){let[a,s]=(0,U.useState)(``),l=`rq-answer-${e.index}`,d=t.proposal?.index===e.index?t.proposal:null,f=t.suggestions[String(e.index)],p=e.status===`open`;return(0,G.jsxs)(J,{label:`Issue ${e.index}`,className:c,children:[(0,G.jsx)(V,{icon:w,level:3,title:e.text,description:`${e.kind===`gap`?`Gap`:`Question · ${e.category}`} · ${e.index} of ${t.items.length}`}),!p&&(0,G.jsx)(`p`,{role:`status`,className:u(e.status===`accepted`?m.pass:m.info,`m-0`),children:e.status===`accepted`?`Kept: the change is in the report and remembered for later reviews.`:`Skipped: left as it is.`}),p&&(0,G.jsxs)(`div`,{className:u(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-col gap-2`),children:[(0,G.jsx)(V,{icon:E,level:3,title:`Suggested answer`,actions:(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>void r({op:`suggest`,id:t.id,index:e.index}),"data-tip":`The agent suggests an answer from the report, the product's knowledge and earlier decisions`,children:[(0,G.jsx)(k,{"aria-hidden":`true`}),f?`Suggest again`:`Suggest`]})}),f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-body-sm whitespace-pre-wrap`,children:f.text}),f.rationale&&(0,G.jsx)(`span`,{className:`text-body-sm text-muted`,children:f.rationale}),(0,G.jsx)(`span`,{children:(0,G.jsxs)(y,{size:`sm`,onClick:()=>s(f.text.slice(0,1200)),"data-tip":`Put this answer in the box below, to edit it`,children:[(0,G.jsx)(O,{"aria-hidden":`true`}),`Use it`]})})]}):(0,G.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Ask for one, or write your own answer below.`})]}),p&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:l,className:`text-body-sm font-medium`,children:`Your answer`}),(0,G.jsx)(o,{id:l,rows:3,value:a,maxLength:1200,placeholder:e.kind===`question`?`Answer the question, or leave it empty to let the agent decide`:`What the report should say, if you know`,onChange:e=>s(e.target.value.replace(/[\r\n]+/g,` `))}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(y,{size:`sm`,disabled:n,onClick:()=>void r({op:`fix`,id:t.id,index:e.index,...a.trim()?{answer:a.trim()}:{}}),"data-tip":`The Requirements Agent proposes a change to the section this is about`,children:d?`Propose again`:`Propose a change`}),!d&&(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>void r({op:`skip`,id:t.id,index:e.index}),"data-tip":`Leave this item as it is; it no longer holds the requirements report back`,children:[(0,G.jsx)(S,{"aria-hidden":`true`}),`Skip`]})]})]}),d&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Proposed change to `,(0,G.jsx)(`span`,{className:`font-medium text-ink`,children:d.section}),d.answer?`, from your answer`:``]}),(0,G.jsx)(z,{diff:De(d.diff)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(y,{variant:`primary`,size:`sm`,disabled:n,onClick:async()=>{await r({op:`accept`,id:t.id,rescore:!0})&&i()},"data-tip":`Keep the change, score the report again, and remember the decision for later reviews`,children:[(0,G.jsx)(O,{"aria-hidden":`true`}),`Accept`]}),(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>void r({op:`skip`,id:t.id,index:e.index}),"data-tip":`Leave this item as it is`,children:[(0,G.jsx)(S,{"aria-hidden":`true`}),`Skip`]}),(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:()=>document.getElementById(l)?.focus(),"data-tip":`Say what you would change, then propose again`,children:[(0,G.jsx)(w,{"aria-hidden":`true`}),`Discuss`]})]})]})]})}function Re({review:e,version:t,locked:n,act:r}){let[i,a]=(0,U.useState)(`brd`),o=e.document===`02-requirements-report.md`,s=Y(e.id,`brd`,o?t:`none`),c=Y(e.id,`spec`,i===`spec`?t:`idle`),d=e.items.filter(e=>e.status===`accepted`).length,f=()=>void r({op:`consolidate`,id:e.id});return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,G.jsxs)(le,{label:`Gaps and questions`,children:[(0,G.jsx)(B,{dot:`warn`,value:e.items.filter(e=>e.status===`open`).length,label:`open`}),(0,G.jsx)(B,{dot:`pass`,value:d,label:`kept`}),(0,G.jsx)(B,{dot:`neutral`,value:e.items.filter(e=>e.status===`skipped`).length,label:`skipped`}),(0,G.jsx)(B,{dot:`neutral`,value:e.quality.overall===null?`–`:`${e.quality.overall}/100`,label:`quality`})]}),(0,G.jsxs)(`div`,{className:u(m.pass,`flex flex-wrap items-center gap-4`),children:[(0,G.jsx)(`span`,{role:`status`,className:`min-w-0 flex-1`,children:`Every gap and question is kept or skipped. The report is ready for test cases (requirements.json).`}),(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:f,"data-tip":`Write the report again from the Spec Circuit report and every decision kept; the current one can be put back with Undo`,children:[(0,G.jsx)(k,{"aria-hidden":`true`}),o?`Write again`:`Write it`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(P,{prefix:`rqtab`,className:`mb-4`,label:`Report`,current:i,onPick:a,tabs:[{id:`brd`,label:`Requirements report`},{id:`decisions`,label:`Decisions`,n:e.decisions.length},{id:`spec`,label:`Spec Circuit report`}]}),(0,G.jsxs)(`div`,{role:`tabpanel`,id:`rqtab-panel-${i}`,"aria-labelledby":`rqtab-${i}`,className:`min-w-0`,children:[i===`brd`&&(o?(0,G.jsx)(X,{text:s.text,error:s.error,label:`requirements report`}):(0,G.jsx)(h,{icon:D,title:`No requirements report yet`,action:(0,G.jsxs)(y,{size:`sm`,disabled:n,onClick:f,"data-tip":`Fold the reviews and your decisions into one report with ids (FR-001, NFR-001)`,children:[(0,G.jsx)(D,{"aria-hidden":`true`}),`Write it`]}),children:`The reviews and your decisions folded into one business requirements document, with ids that test cases trace to.`})),i===`decisions`&&(e.decisions.length?(0,G.jsx)(q,{children:(0,G.jsx)(J,{label:`Decisions`,children:(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.decisions.map((e,t)=>(0,G.jsxs)(`li`,{className:u(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`flex-col items-start gap-1`),children:[(0,G.jsxs)(`span`,{className:`text-body-sm`,children:[e.index,`. `,e.text]}),(0,G.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e.answer?`Decided: ${e.answer}`:`Kept the proposed change`,` · `,e.section]})]},`${e.index}-${t}`))})})}):(0,G.jsx)(h,{icon:O,title:`No decisions yet`,children:`Every item was skipped (${l(e.items.length,`item`)}). Accept a change on Refine to keep a decision here.`})),i===`spec`&&(0,G.jsx)(X,{text:c.text,error:c.error,label:`Spec Circuit report`})]})]})]})}var Q=[{id:`review`,name:`Review`,tip:`The reviewers at work`},{id:`report`,name:`Spec report`,tip:`The Spec Circuit report and its score`},{id:`refine`,name:`Refine`,tip:`Resolve the gaps and questions`},{id:`brd`,name:`Requirements report`,tip:`The BRD with your decisions`}],ze=2e3;function Be({id:e,step:t}){let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),[p,h]=(0,U.useState)(!1),[g,b]=(0,U.useState)(null),x=(0,U.useCallback)(()=>Promise.all([W.review(e),W.job()]).then(([e,t])=>{i(e.review),o(t),c(``)},e=>c(e.message)),[e]);(0,U.useEffect)(()=>void x(),[x]);let S=!!a&&a.target===e,w=S&&a.running,T=w&&a.kind===`requirements-review`,E=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(!w){if(E.current){let e=a?.result?.error;x().then(()=>e&&c(e))}E.current=!1;return}E.current=!0;let e=oe(()=>void x(),ze);return()=>ae(e)},[w,x,a]),(0,U.useEffect)(()=>{r?.proposal&&b(r.proposal.index)},[r?.proposal?.index]);let O=async e=>{h(!0),c(``);try{return o(await W.start(e)),!0}catch(e){return c(e.message),!1}finally{h(!1)}},k=async()=>{h(!0),c(``);try{o(await W.stop()),x()}catch(e){c(e.message)}finally{h(!1)}};if(!r)return s?(0,G.jsx)(`p`,{role:`alert`,className:u(m.fail,`m-0`),children:s}):(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let A=r.files.includes(`01-spec-circuit-report.md`),j=r.items.filter(e=>e.status===`open`).length,M=T||!A?0:j?2:Q.length-1,N=Q.findIndex(e=>e.id===t),P=N>=0&&N<=M?N:M===0?0:1,F=t=>location.hash=n(`requirements`,e,Q[t].id),I=Ce({id:e,status:r.status,open:j},a),L=r.document,R=L?L.replace(`.md`,`.pdf`):null,z=p||!!a?.running,B=[r.status,r.decisions.length,r.canUndo,r.files.join(`,`),r.quality.overall].join(`|`);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{to:{href:n(`requirements`,`reviews`),label:`All reviews`}}),(0,G.jsx)(V,{icon:C,title:r.title||e,description:(0,G.jsxs)(G.Fragment,{children:[r.quality.overall===null?`Not scored yet`:`Scored ${r.quality.overall}/100`,r.personas.length?` · ${l(r.personas.length,`persona`)}`:``,r.created?` · ${se(r.created)}`:``]}),actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_,{tone:I.tone,children:I.label}),w?(0,G.jsxs)(y,{variant:`danger`,disabled:p,onClick:()=>void k(),"data-tip":`Stop now; what was written is kept`,children:[(0,G.jsx)(re,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,G.jsxs)(G.Fragment,{children:[L&&(0,G.jsxs)(y,{size:`sm`,onClick:async()=>f(await ee(L,()=>W.open(e,L))),"data-tip":`Open the report's Markdown in a new tab`,children:[(0,G.jsx)(D,{"aria-hidden":`true`}),`Export Markdown`]}),R&&(r.files.includes(R)?(0,G.jsxs)(y,{size:`sm`,onClick:async()=>f(await ee(R,()=>W.open(e,R))),"data-tip":`Open the report as PDF in a new tab`,children:[(0,G.jsx)(ie,{"aria-hidden":`true`}),`Export PDF`]}):(0,G.jsxs)(y,{size:`sm`,disabled:z,onClick:()=>void O({op:`export`,id:e}),"data-tip":`Write the report as PDF, then open it here`,children:[(0,G.jsx)(ie,{"aria-hidden":`true`}),`Export PDF`]})),(0,G.jsxs)(y,{size:`sm`,disabled:z||!r.canUndo,onClick:()=>void O({op:`undo`,id:e}),"data-tip":r.canUndo?`Put back the version before the last change kept`:`Nothing to undo`,children:[(0,G.jsx)(te,{"aria-hidden":`true`}),`Undo`]})]})]})}),(0,G.jsx)(pe,{steps:Q,at:P,reached:M,onGo:F,label:`Requirement journey`}),w&&!T&&(0,G.jsxs)(`div`,{role:`status`,className:u(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex items-center gap-4`),children:[(0,G.jsx)(_,{tone:`running`,children:`Working`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm`,children:K(a).at(-1)||`Starting…`})]}),s&&(0,G.jsx)(`p`,{role:`alert`,className:u(m.fail,`m-0`),children:s}),d&&(0,G.jsx)(`p`,{role:`status`,className:u(m.warn,`m-0`),children:d}),P===0&&(0,G.jsx)(Me,{review:r,job:S?a:null,live:T}),P===1&&(0,G.jsx)(Fe,{review:r,version:B}),P===2&&(0,G.jsx)(Ie,{review:r,locked:z,act:O,open:g,setOpen:b}),P===3&&(0,G.jsx)(Re,{review:r,version:B,locked:z,act:O}),(0,G.jsx)(he,{busy:p,...P>0?{onBack:()=>F(P-1)}:{},aside:P+1>M&&P<Q.length-1?P===0?`Once the reviewers have written the report`:`Keep or skip every open gap and question first (${j} open).`:void 0,next:P<Q.length-1?(0,G.jsxs)(G.Fragment,{children:[`Next: `,Q[P+1].name,(0,G.jsx)(ne,{"aria-hidden":`true`})]}):`All reviews`,disabled:P<Q.length-1&&P+1>M,onNext:()=>P<Q.length-1?F(P+1):location.hash=n(`requirements`,`reviews`)})]})}var Ve=new Set([H,`reviews`,`new`]);function $({tab:e,wide:t,action:r,children:i}){let a=f(`requirements`);return(0,G.jsx)(de,{title:I(`requirements`),page:a,label:`Requirements`,current:e,tabHref:e=>e===`agent`?n(`requirements`,H):n(`requirements`,`reviews`),onPick:e=>location.hash=e===`agent`?n(`requirements`,H):n(`requirements`,`reviews`),tabs:[{id:`reviews`,label:`Reviews`,icon:C}],below:(0,G.jsx)(ue,{page:a}),...t?{wide:t}:{},...r?{end:r}:{},children:i})}function He({sub:e}){let[t,r]=(e??``).split(`/`),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(``),c=(0,U.useCallback)(()=>{W.overview().then(e=>{a(e),s(``)},e=>s(e.message))},[]);(0,U.useEffect)(c,[c,t]);let l=!!i?.job?.running;(0,U.useEffect)(()=>{if(!l||t!==`reviews`)return;let e=oe(c,3e3);return()=>ae(e)},[l,t,c]);let d=()=>location.hash=n(`requirements`,`new`),f=o&&(0,G.jsx)(`p`,{role:`alert`,className:u(m.fail,`m-0`),children:o}),p=!i&&!o&&(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});return t===`new`?(0,G.jsxs)($,{tab:`reviews`,children:[f,p,i&&(0,G.jsx)(Se,{info:i,onStarted:e=>location.hash=n(`requirements`,e)})]}):t&&ve.test(t)&&!Ve.has(t)?(0,G.jsxs)($,{tab:`reviews`,wide:!0,children:[f,(0,G.jsx)(Be,{id:t,...r?{step:r}:{}},t)]}):t===`reviews`?(0,G.jsxs)($,{tab:`reviews`,action:i&&!i.reviews.length?void 0:(0,G.jsxs)(y,{variant:`accent`,disabled:!i||l,onClick:d,"data-tip":l?`A review is being written: wait for it, or stop it`:`New review`,children:[(0,G.jsx)(b,{"aria-hidden":`true`}),`New`]}),children:[f,p,i&&(i.reviews.length?(0,G.jsx)(Te,{rows:i.reviews,job:i.job}):(0,G.jsx)(h,{page:!0,icon:C,title:`No reviews yet`,action:(0,G.jsxs)(y,{size:`sm`,onClick:d,"data-tip":`New review`,children:[(0,G.jsx)(b,{"aria-hidden":`true`}),`New`]}),children:`Paste a requirement or a story and pick the business personas it is for, and the Requirements Agent reviews it before it is built. It reads it with what ForgeQE knows about your product (its knowledge, documents, requirements search, product graph and the decisions of earlier reviews), scores it, and lists its gaps and questions, each with a change to keep or leave.`}))]}):(0,G.jsx)($,{tab:H})}export{He as Requirements};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{F as r,H as i,L as a,R as o,l as s,o as c}from"./preload-helper-BupTYkQW.js";import{n as l,t as u}from"./utils-DJRAScIl.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{d as f}from"./sectionList-B651VPon.js";import{I as p,v as m}from"./api-D8-lxyQi.js";import{C as h,_ as g,b as _,f as v,g as y,h as b,n as x,x as S}from"./pageBack-BefA2rh7.js";import{Gt as C,Jn as ee,Ln as w,N as T,Ot as E,Pn as D,Qt as O,Rr as k,Sr as A,T as j,V as te,a as M,bn as ne,hn as re,in as ie,mr as ae,nr as N,o as oe,or as se,qt as P,vt as ce,wr as F,yn as le,yr as ue,z as I}from"./line-icons-CwCZidXs.js";import{Ct as L,Et as R,Jt as z,St as de,Tt as fe,Xt as B,Yt as V,_t as H,bt as U,dt as pe,ft as me,vt as he,wt as W}from"./frame-C8sL1yo-.js";import{t as G}from"./when-BuWCTaKm.js";import{u as ge}from"./nav-DYgvAJu-.js";import{H as K,J as _e,V as ve,X as ye,Y as be,l as xe,n as Se,t as Ce}from"./index-BFG13fbg.js";import{t as we}from"./step-mark-CaKf4dAR.js";import{t as Te}from"./stepper-CONWT_tv.js";import{t as Ee}from"./parts-BNpm4gXC.js";var q=e(t(),1),J={browserstack:`BrowserStack`,testmu:`TestMu AI`},De=/^rsp-\d{8}-\d{6}-[0-9a-f]{4}$/,Y={info:()=>m(`GET`,`/api/responsive`),runs:()=>m(`GET`,`/api/responsive/runs`),run:e=>m(`GET`,`/api/responsive/runs/${encodeURIComponent(e)}`),shot:(e,t)=>p(`/api/responsive/runs/${encodeURIComponent(e)}/shots/${encodeURIComponent(t)}`,`image/jpeg`),start:e=>m(`POST`,`/api/responsive/runs`,e),stop:e=>m(`POST`,`/api/responsive/runs/${encodeURIComponent(e)}/stop`,{}),flows:()=>m(`GET`,`/api/responsive/flows`),saveFlow:(e,t,n=!1)=>m(`POST`,`/api/responsive/flows`,{label:e,prompt:t,replace:n}),cloudDevices:(e,t=!1)=>m(`GET`,`/api/responsive/clouds/${e}/devices${t?`?fresh=1`:``}`),cases:e=>m(`GET`,`/api/responsive/cases?q=${encodeURIComponent(e)}`),caseSteps:e=>m(`GET`,`/api/responsive/case?key=${encodeURIComponent(e)}`)};function Oe(e,t=`600px`){let[n,r]=(0,q.useState)(()=>typeof IntersectionObserver>`u`);return(0,q.useEffect)(()=>{let i=e.current;if(n||!i)return;let a=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r(!0),a.disconnect())},{rootMargin:t});return a.observe(i),()=>a.disconnect()},[e,n,t]),n}var X=d(),Z={phone:N,tablet:ae,desktop:le};function ke({devices:e,picked:t,max:n,onChange:r,drawnBy:a,real:o}){let[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(`all`),f=s.trim().toLowerCase(),p=e.filter(e=>(l===`all`||e.category===l)&&(!f||`${e.label} ${e.os??``} ${e.width}x${e.height} ${e.width}×${e.height}`.toLowerCase().includes(f))),m=t.length>=n,h=t=>e.filter(e=>e.category===t).length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(b,{id:`rp-search`,label:`Search devices`,value:s,onChange:c,placeholder:`iPhone, Pixel, 1920…`,className:`flex-none`}),(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which devices to list`,children:(0,X.jsx)(v,{value:l,onChange:d,items:[{id:`all`,label:`All`,n:e.length},{id:`phone`,label:`Phones`,n:h(`phone`)},{id:`tablet`,label:`Tablets`,n:h(`tablet`)},...o?[]:[{id:`desktop`,label:`Desktops`,n:h(`desktop`)}]]})})]}),(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:[t.length,` of `,n,` picked`,m?`: remove one to add another.`:`.`,` `,o?`Real devices on ${o}, as it lists them now: each is its own session of your plan, and a real browser (Safari on iOS, Chrome on Android).`:(0,X.jsxs)(X.Fragment,{children:[`Each is emulated in full (size, pixel ratio, touch, user agent)`,a?` and drawn by ${a}.`:` and drawn by Chromium, so a Safari-only difference does not show.`]})]}),p.length?(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 @3xl:grid-cols-2`,children:p.map(e=>{let n=t.includes(e.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:u(i,`gap-2`,!n&&m&&`cursor-not-allowed text-muted hover:bg-transparent hover:text-muted`),children:[(0,X.jsx)(_e,{checked:n,disabled:!n&&m,onCheckedChange:n=>r(n?[...t,e.id]:t.filter(t=>t!==e.id))}),(0,X.jsx)(_,{icon:Z[e.category],size:16,className:`flex-none text-muted`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,X.jsx)(`span`,{className:`ml-auto flex-none text-body-sm text-muted`,children:e.os??`${e.width}×${e.height} · ${e.scale}x`})]})},e.id)})}):(0,X.jsxs)(g,{children:[`No device matches “`,s,`”.`]})]})}function Ae({results:e}){return(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,"aria-label":`What happened on each device`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsx)(_,{icon:e.skipped?P:e.ok?T:I,size:16,className:u(`mt-1 flex-none`,e.skipped?`text-muted`:e.ok?`text-pass`:`text-fail`)}),(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`strong`,{className:`font-medium`,children:e.label}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.skipped?`nothing to do on this layout`:`${e.done} of ${l(e.of,`step`)}`]}),e.error&&(0,X.jsx)(`span`,{className:`block text-muted`,children:e.error})]})]},e.device))})}var je={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},stopped:{label:`Stopped`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`}},Me=e=>{try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return e}},Ne=e=>e.status===`running`?`running`:e.findings?`findings`:`clean`;function Pe({rows:e}){let[t,r]=(0,q.useState)(`all`),i=t=>t===`all`?e.length:e.filter(e=>Ne(e)===t).length,a=e.filter(e=>t===`all`||Ne(e)===t),o=e=>location.hash=n(`responsive`,e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(ve,{label:`Runs by state`,children:[(0,X.jsx)(K,{dot:`neutral`,value:i(`all`),label:`runs`,onClick:()=>r(`all`),on:t===`all`}),(0,X.jsx)(K,{dot:`running`,value:i(`running`),label:`running`,onClick:()=>r(`running`),on:t===`running`}),(0,X.jsx)(K,{dot:`warn`,value:i(`findings`),label:`with findings`,onClick:()=>r(`findings`),on:t===`findings`}),(0,X.jsx)(K,{dot:`pass`,value:i(`clean`),label:`clean`,onClick:()=>r(`clean`),on:t===`clean`})]}),(0,X.jsx)(H,{label:`Runs`,placeholder:`Find a run`,empty:t===`all`?`No runs.`:`None here.`,resetKey:t,height:he,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Page`}),(0,X.jsx)(`th`,{scope:`col`,className:u(L,`hidden @xl:table-cell`),children:`Devices`}),(0,X.jsx)(`th`,{scope:`col`,className:u(L,`hidden @3xl:table-cell`),children:`How`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Findings`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:u(L,`hidden @xl:table-cell`),children:`When`})]}),children:a.map(e=>{let t=je[e.status];return(0,X.jsxs)(`tr`,{onClick:()=>o(e.id),className:R,children:[(0,X.jsxs)(`td`,{className:U,children:[(0,X.jsx)(`a`,{href:n(`responsive`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline [overflow-wrap:anywhere] hover:underline`,children:Me(e.url)}),(0,X.jsx)(`span`,{className:`block text-body-sm text-muted`,children:e.id})]}),(0,X.jsxs)(`td`,{className:u(U,`hidden text-body-sm text-ink-2 @xl:table-cell`),children:[e.devices,e.on?(0,X.jsxs)(`span`,{className:`block text-muted`,children:[`on `,J[e.on]]}):null]}),(0,X.jsx)(`td`,{className:u(U,`hidden text-body-sm text-ink-2 @3xl:table-cell`),children:e.mode===`guided`?`Guided, ${e.steps} step${e.steps===1?``:`s`}`:`Interactive${e.steps?`, ${e.steps} instruction${e.steps===1?``:`s`}`:``}`}),(0,X.jsx)(`td`,{className:u(U,`text-body-sm whitespace-nowrap`),"data-sort":(e.high||0)*1e3+(e.findings||0),children:e.findings?(0,X.jsxs)(`span`,{className:e.high?`text-fail`:`text-warn`,children:[e.findings,e.high?` · ${e.high} high`:``]}):e.status===`running`?(0,X.jsx)(`span`,{className:`text-muted`,children:`So far none`}):(0,X.jsx)(`span`,{className:`text-pass`,children:`None`})}),(0,X.jsx)(`td`,{className:u(U,`whitespace-nowrap`),children:(0,X.jsx)(y,{tone:t.tone,children:t.label})}),(0,X.jsx)(`td`,{className:u(U,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-sort":new Date(e.endedAt||e.startedAt).getTime()||0,children:G(e.endedAt||e.startedAt)})]},e.id)})})]})}var Fe={high:{label:`High`,tone:`fail`},medium:{label:`Medium`,tone:`warn`},low:{label:`Low`,tone:`neutral`}},Ie=1500,Le={chrome:`Chrome`,edge:`Edge`,firefox:`Firefox`,webkit:`WebKit`};function Re({id:e,file:t,label:n,className:r,onOpen:i,thumb:a}){let[o,s]=(0,q.useState)(``),[l,d]=(0,q.useState)(!1),f=(0,q.useRef)(null),p=Oe(f);(0,q.useEffect)(()=>{if(!p)return;let n=!1;return Y.shot(e,t).then(e=>!n&&s(e),()=>!n&&d(!0)),()=>{n=!0}},[e,t,p]);let m=l?(0,X.jsx)(`span`,{className:`grid min-h-24 place-items-center text-body-sm text-muted`,children:`No picture`}):o?(0,X.jsx)(`img`,{src:o,alt:`${n} screenshot`,className:u(`block w-full object-top`,a?`h-24 object-cover`:`object-contain`)}):(0,X.jsx)(`span`,{className:`block min-h-24`});return i?(0,X.jsx)(`button`,{ref:f,type:`button`,onClick:i,"aria-label":`Show the ${n} screenshot larger`,"data-tip":`Show larger`,className:u(c,`block cursor-zoom-in overflow-hidden border-0 p-0`,r),children:m}):(0,X.jsx)(`div`,{ref:f,className:u(c,`overflow-hidden`,r),children:m})}var ze=[`high`,`medium`,`low`],Be={sideways:`Scrolls sideways`,small_text:`Text under 12px`,small_targets:`Tap targets under 24px`,broken_images:`Broken images`},Q=e=>e.check.startsWith(`custom-`),$=e=>Q(e)?e.title:Be[e.check]??e.title,Ve=e=>{let t=e.steps.filter(e=>e>0);return t.length?`${t.length<e.steps.length?`Start, step`:`Step`}${t.length>1?`s`:``} ${t.join(`, `)}`:`At the start`};function He({run:e,onOpen:t}){let[n,r]=(0,q.useState)(`all`),i=t=>t===`all`?e.findings.length:e.findings.filter(e=>e.severity===t).length;if(!e.findings.length)return(0,X.jsx)(g,{icon:j,title:e.status===`running`?`Nothing found so far`:`Nothing found`,children:e.status===`running`?`Each device is checked after every step; findings show here as they are made.`:`Every device passed the checks at each of the run's ${l(e.steps.length,`step`)}.`});let a=e.findings.filter(e=>n===`all`||e.severity===n).sort((e,t)=>ze.indexOf(e.severity)-ze.indexOf(t.severity)||Math.min(...e.steps)-Math.min(...t.steps));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which findings to show`,children:(0,X.jsx)(v,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:i(`all`)},{id:`high`,label:`High`,n:i(`high`)},{id:`medium`,label:`Medium`,n:i(`medium`)},{id:`low`,label:`Low`,n:i(`low`)}]})}),(0,X.jsx)(H,{label:`Findings`,placeholder:`Find a finding`,empty:`None here.`,resetKey:n,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Finding`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Severity`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Device`}),(0,X.jsx)(`th`,{scope:`col`,className:u(L,`hidden @xl:table-cell`),children:`When`})]}),children:a.map(e=>{let n=Fe[e.severity];return(0,X.jsxs)(`tr`,{onClick:()=>t(e),className:R,children:[(0,X.jsxs)(`td`,{className:U,children:[(0,X.jsx)(S,{variant:`link`,size:`inline`,onClick:n=>(n.stopPropagation(),t(e)),className:`whitespace-normal text-left [overflow-wrap:anywhere]`,children:Q(e)?`“${$(e)}”`:$(e)}),(0,X.jsx)(`span`,{className:`block text-body-sm text-muted [overflow-wrap:anywhere]`,children:Q(e)?`Your check`:e.title===$(e)?e.detail:e.title})]}),(0,X.jsx)(`td`,{className:u(U,`whitespace-nowrap`),"data-sort":{high:3,medium:2,low:1}[e.severity]??0,children:(0,X.jsx)(y,{tone:n.tone,icon:!1,children:n.label})}),(0,X.jsx)(`td`,{className:u(U,`text-body-sm whitespace-nowrap`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(_,{icon:Z[e.layout],size:16,className:`flex-none text-muted`}),e.label]})}),(0,X.jsx)(`td`,{className:u(U,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-sort":e.steps.length?Math.min(...e.steps):0,children:Ve(e)})]},e.id)})})]})}function Ue({f:e,run:t,onOpen:n}){let r=t.findings.filter(t=>t.check===e.check&&t.id!==e.id);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,X.jsx)(y,{tone:Fe[e.severity].tone,icon:!1,children:Fe[e.severity].label}),(0,X.jsx)(_,{icon:Z[e.layout],size:16,className:`flex-none text-muted`}),(0,X.jsx)(`strong`,{className:`font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:Ve(e)})]}),e.title!==$(e)&&(0,X.jsx)(`p`,{className:`m-0 text-body-sm font-medium [overflow-wrap:anywhere]`,children:e.title}),e.detail&&(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.detail}),e.quote&&(0,X.jsxs)(`p`,{className:u(h.info,`m-0`),children:[`On the screen: “`,e.quote,`”`]}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:e.steps.map(e=>(0,X.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e?`Step ${e}: ${t.steps.find(t=>t.n===e)?.instruction??``}`:`When the page opened`},e))}),e.shot?(0,X.jsx)(Re,{id:t.id,file:e.shot,label:e.label},e.shot):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No screenshot for this finding.`}),r.length>0&&(0,X.jsx)(be,{id:`rp-others`,level:3,icon:N,title:(0,X.jsxs)(X.Fragment,{children:[`Also on `,l(new Set(r.map(e=>e.device)).size,`other device`)]}),children:(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:r.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(S,{size:`sm`,onClick:()=>n(e),"data-tip":`Show it on ${e.label}`,children:[(0,X.jsx)(_,{icon:Z[e.layout],size:16,"aria-hidden":`true`}),e.label]})},e.id))})})]})}function We({run:e,onShot:t}){let n=e.spec;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.prompt&&(0,X.jsxs)(be,{id:`rp-prompt`,level:3,icon:re,title:`Your prompt`,className:u(`surface rounded-lg bg-bg p-6 shadow-sm`,`gap-2`),children:[(0,X.jsx)(`p`,{className:u(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 text-body-sm whitespace-pre-wrap [overflow-wrap:anywhere]`),children:n.prompt}),n.attachments&&n.attachments.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Attached: `,n.attachments.join(`, `)]}),(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Read as `,l(n.steps.length,`step`),n.custom.length?`, with ${l(n.custom.length,`check`)} of your own`:``,`: `,n.steps.join(` → `)||`none`]})]}),(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.steps.map(n=>{let r=e.shots.filter(e=>e.step===n.n),i=e.findings.filter(e=>e.steps.includes(n.n)).length;return(0,X.jsxs)(`li`,{className:u(s,`flex min-w-0 flex-col gap-4`),children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(we,{state:`pending`,n:n.n}),(0,X.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-body-lg font-medium [overflow-wrap:anywhere]`,children:n.instruction}),(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[i?`${l(i,`finding`)}`:`No findings`,` · `,G(n.at)]})]}),n.plan.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-muted`,children:n.plan.map(e=>(0,X.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e))}),n.results.length>0&&(0,X.jsx)(Ae,{results:n.results}),!n.results.length&&n.note&&n.by!==`check`&&n.by!==`open`&&(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-warn [overflow-wrap:anywhere]`,children:n.note}),r.length>0&&(0,X.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-2`,"aria-label":`Screenshots after step ${n.n}`,children:r.map(r=>{let i=e.spec.devices.includes(r.device)?r.device:`device`;return(0,X.jsx)(Re,{id:e.id,file:r.file,label:i,className:`w-[120px] flex-none`,onOpen:()=>t(r.file,`${i}, step ${n.n}`)},r.file)})})]},`${n.n}-${n.at}`)})})]})}function Ge({run:e,onShot:t}){let n=[...new Set(e.shots.map(e=>e.step))];return n.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.map(n=>{let r=e.steps.find(e=>e.n===n);return(0,X.jsx)(be,{id:`rp-shots-${n}`,level:3,icon:C,title:n?`Step ${n}: ${r?.instruction??``}`:`When the page opened`,className:`gap-2`,children:(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-2 gap-4 p-0 @3xl:grid-cols-4 @5xl:grid-cols-6`,children:e.shots.filter(e=>e.step===n).map(r=>(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsx)(Re,{id:e.id,file:r.file,label:r.device,onOpen:()=>t(r.file,`${r.device}, ${n?`step ${n}`:`start`}`)}),(0,X.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:r.device})]},r.file))})},n)})}):(0,X.jsx)(g,{children:`No screenshots were kept.`})}function Ke({log:e}){let[t,n]=(0,q.useState)(`all`),r=e.filter(e=>e.level!==`info`),i=t===`all`?e:r;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which lines to show`,children:(0,X.jsx)(v,{value:t,onChange:n,items:[{id:`all`,label:`Everything`,n:e.length},{id:`problems`,label:`Errors and warnings`,n:r.length}]})}),i.length?(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-label":`Log`,children:i.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-line-soft py-2 text-body-sm first:border-t-0`,children:[(0,X.jsx)(_,{icon:e.level===`error`?I:e.level===`warn`?A:P,size:16,className:u(`mt-1 flex-none`,e.level===`error`?`text-fail`:e.level===`warn`?`text-warn`:`text-muted`)}),(0,X.jsx)(`span`,{className:`w-[72px] flex-none text-muted tabular-nums`,children:new Date(e.at).toLocaleTimeString()}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e.text})]},`${e.at}-${t}`))}):(0,X.jsx)(g,{children:t===`all`?`Nothing logged yet.`:`No errors or warnings.`})]})}function qe({run:e}){let t=e.steps.toReversed();return(0,X.jsx)(H,{label:`Devices`,placeholder:`Find a device`,empty:`No devices.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Device`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Last step`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Findings`})]}),children:e.spec.devices.map(n=>{let r=t.find(e=>e.results.some(e=>e.device===n)),i=r?.results.find(e=>e.device===n),a=e.findings.filter(e=>e.device===n).length,o=i?.label||e.spec.labels?.[n]||e.findings.find(e=>e.device===n)?.label||n,s=e.shots.some(e=>e.device===n);return(0,X.jsxs)(`tr`,{className:fe,children:[(0,X.jsx)(`td`,{className:u(U,`font-medium whitespace-nowrap`),children:o}),(0,X.jsx)(`td`,{className:u(U,`text-body-sm`),children:i?(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsx)(_,{icon:i.skipped?P:i.ok?T:I,size:16,className:u(`mt-1 flex-none`,i.skipped?`text-muted`:i.ok?`text-pass`:`text-fail`)}),(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Step `,r.n,`: `,i.skipped?`nothing to do on this layout`:i.ok?`done`:i.error||`did not finish`]})]}):(0,X.jsx)(`span`,{className:`text-muted`,children:s?`Page opened`:`Opening…`})}),(0,X.jsx)(`td`,{className:u(de,`text-body-sm`,a?`text-warn`:`text-muted`),children:a})]},n)})})}function Je({id:e,tab:t}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[g,_]=(0,q.useState)(null),[v,b]=(0,q.useState)(null),C=(0,q.useCallback)(()=>{Y.run(e).then(e=>{i(e.run),o(e.log),c(e.live)},e=>f(e.message))},[e]);(0,q.useEffect)(C,[C]),(0,q.useEffect)(()=>{if(!s)return;let e=V(C,Ie);return()=>z(e)},[s,C]);let ee=async()=>{m(!0),f(``);try{await Y.stop(e),C()}catch(e){f(e.message)}finally{m(!1)}};if(!r)return d?(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:d}):(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let w=je[r.status],T=a.filter(e=>e.level!==`info`).length,E=s?[{id:`findings`,label:`Findings`,n:r.findings.length,tone:r.findings.length?`text-warn`:void 0},{id:`devices`,label:`Devices`,n:r.spec.devices.length},{id:`log`,label:`Log and errors`,n:T||void 0,tone:T?`text-fail`:void 0}]:[{id:`steps`,label:`Steps`,n:r.steps.length},{id:`findings`,label:`Findings`,n:r.findings.length,tone:r.findings.length?`text-warn`:void 0},{id:`shots`,label:`Screenshots`,n:r.shots.length},{id:`log`,label:`Log and errors`,n:T||void 0,tone:T?`text-fail`:void 0}],D=E.find(e=>e.id===t)?.id??E[0].id,O=t=>location.hash=t===E[0].id?n(`responsive`,e):n(`responsive`,e,t),A=r.steps.filter(e=>e.by===`plan`||e.by===`words`).length,j=r.spec.steps.length;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(x,{to:{href:n(`responsive`,`runs`),label:`All runs`}}),(0,X.jsx)(ye,{icon:ne,title:Me(r.spec.url),description:(0,X.jsxs)(X.Fragment,{children:[l(r.spec.devices.length,`device`),r.spec.on?` on ${J[r.spec.on]} (${r.spec.real?`real devices`:Le[r.spec.browser??`chrome`]})`:``,` · `,r.spec.mode===`guided`?`${j?l(j,`step`):`reading the prompt`}${r.spec.source?.label?` from ${r.spec.source.label}`:``}`:`interactive (an earlier kind of run)`,` · started `,G(r.startedAt)]}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y,{tone:w.tone,children:w.label}),s&&(0,X.jsxs)(S,{variant:`danger`,disabled:p,onClick:()=>void ee(),"data-tip":`Stop now; what was done is kept`,children:[(0,X.jsx)(se,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})}),s&&(0,X.jsxs)(`div`,{className:u(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex items-center gap-4`),children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm`,children:j?A<j?`Step ${Math.min(A+1,j)} of ${j}: ${r.spec.steps[A]??``}`:`Last checks…`:`Reading your prompt as steps…`}),(0,X.jsx)(`span`,{className:`w-[160px] flex-none`,children:(0,X.jsx)(Ee,{value:A/Math.max(1,j)*100,label:`Steps done`})})]}),r.error&&(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:r.error}),d&&(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:d}),(0,X.jsx)(me,{prefix:`rtab`,className:`mb-0`,tabs:E,current:D,onPick:O,label:`Run`}),(0,X.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${D}`,"aria-labelledby":`rtab-${D}`,className:`flex min-w-0 flex-col gap-4`,children:[D===`devices`&&s&&(0,X.jsx)(qe,{run:r}),D===`steps`&&(0,X.jsx)(We,{run:r,onShot:(e,t)=>_({file:e,label:t})}),D===`findings`&&(0,X.jsx)(He,{run:r,onOpen:b}),D===`shots`&&(0,X.jsx)(Ge,{run:r,onShot:(e,t)=>_({file:e,label:t})}),D===`log`&&(0,X.jsx)(Ke,{log:a})]}),(0,X.jsx)(B,{open:!!g,onClose:()=>_(null),wide:!0,title:g?.label??`Screenshot`,footer:(0,X.jsxs)(S,{onClick:()=>_(null),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Close`]}),children:g&&(0,X.jsx)(Re,{id:r.id,file:g.file,label:g.label})}),(0,X.jsx)(B,{open:!!v,onClose:()=>b(null),wide:!0,title:v?Q(v)?`“${$(v)}”`:$(v):`Finding`,...v&&Q(v)?{description:`A check of your own`}:{},footer:(0,X.jsxs)(S,{onClick:()=>b(null),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Close`]}),children:v&&(0,X.jsx)(Ue,{f:v,run:r,onOpen:b})})]})}var Ye=[{name:`Page and devices`,tip:`The page and the devices to show it on`},{name:`What to do`,tip:`Your prompt, files or a test case`},{name:`What to check`,tip:`Built-in checks and your own`},{name:`Review`,tip:`Check and start`}],Xe=8,Ze=[`The main menu can be opened`,`Sign in is visible without scrolling`,`The page title is shown`,`Prices show next to each product`],Qe=`forgeqe:responsive`;function $e(){try{let e=JSON.parse(localStorage.getItem(Qe)||`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}function et(e){try{localStorage.setItem(Qe,JSON.stringify({...$e(),...e}))}catch{}}function tt({id:e,label:t,help:n,children:r}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:e,className:`text-body-sm font-medium`,children:t}),r,n&&(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:n})]})}function nt({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,X.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-canvas py-4`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm`,children:a}),t&&(0,X.jsxs)(S,{variant:`ghost`,disabled:e,onClick:t,children:[(0,X.jsx)(M,{"aria-hidden":`true`}),`Back`]}),(0,X.jsx)(S,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}var rt=4e3,it=3,at=5e4,ot=`Search for pliers, open the first result and add it to the cart, then open the cart.
2
- The cart should show 1 item and its total should be visible without scrolling.`;function st({prompt:e,setPrompt:t,files:n,setFiles:i,source:s,setSource:c,flows:d,onFlowsChanged:f,onError:p}){let[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),[v,b]=(0,q.useState)(null),[x,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[D,O]=(0,q.useState)(``),A=(0,q.useRef)(null),j=(e,n)=>{t(e.slice(0,rt)),c(n),p(``)},M=async t=>{try{let n=await Y.saveFlow(x.trim(),e,t);O(``),T(n.flow.label),C(``),f()}catch(e){let n=e.message;!t&&/saved already/.test(n)?O(n):p(n)}},ne=async e=>{let t=[...e??[]];if(!t.length)return;if(n.length+t.length>it)return p(`Attach at most ${it} files.`);let r=[...n];for(let e of t){if(!/\.(txt|md|csv|feature)$/i.test(e.name)||e.size>262144)return p(`Attach .txt, .md, .csv or .feature files of at most 256 KB.`);let t=await e.text();if(t.length>at)return p(`${e.name} is longer than ${at/1e3}k characters.`);r.some(t=>t.name===e.name)||r.push({name:e.name.replace(/[^\w .()-]/g,`_`).slice(-80),text:t})}i(r),p(``)};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(tt,{id:`rp-prompt`,label:`What should ForgeQE do on every device?`,help:`Write it as you would tell a tester: what to do, in order, and what should be true. Attached files are read too. ${e.length}/${rt}`,children:(0,X.jsx)(o,{id:`rp-prompt`,value:e,rows:6,maxLength:rt,placeholder:ot,onChange:e=>t(e.target.value)})}),n.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-2 p-0`,"aria-label":`Attached files`,children:n.map(e=>(0,X.jsx)(`li`,{className:`inline-flex`,children:(0,X.jsxs)(y,{tone:`neutral`,icon:!1,children:[(0,X.jsx)(ce,{size:13,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-w-[240px] truncate`,children:e.name}),(0,X.jsx)(S,{variant:`icon`,size:`icon-xs`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>i(n.filter(t=>t.name!==e.name)),children:(0,X.jsx)(k,{"aria-hidden":`true`})})]})},e.name))}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(S,{size:`sm`,disabled:n.length>=it,onClick:()=>A.current?.click(),"data-tip":`Attach a test case, notes or a feature file (.txt, .md, .csv, .feature), read in this browser`,children:[(0,X.jsx)(F,{"aria-hidden":`true`}),`Attach`]}),(0,X.jsx)(`input`,{ref:A,type:`file`,multiple:!0,accept:`.txt,.md,.csv,.feature,text/plain,text/markdown,text/csv`,className:`hidden`,onChange:e=>{ne(e.target.files),e.target.value=``}}),(0,X.jsxs)(S,{size:`sm`,"aria-expanded":m,onClick:()=>h(!m),"data-tip":`Fill the prompt from a test case of test management`,children:[(0,X.jsx)(te,{"aria-hidden":`true`}),`Test case`]}),(0,X.jsxs)(a,{"aria-label":`A saved prompt`,size:`sm`,value:``,disabled:!d.length,onChange:e=>{let t=d.find(t=>t.name===e.target.value);t&&j(t.prompt,{kind:`flow`,label:t.label})},className:`min-w-0 flex-[0_1_220px]`,children:[(0,X.jsx)(`option`,{value:``,children:d.length?`A saved prompt…`:`No saved prompts yet`}),d.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsx)(r,{"aria-label":`Name for the prompt`,size:`sm`,value:x,maxLength:80,placeholder:`Name to save as`,onChange:e=>C(e.target.value),className:`min-w-0 flex-[0_1_200px]`}),(0,X.jsxs)(S,{size:`sm`,disabled:!x.trim()||!e.trim(),"data-tip":`Save this prompt to use again`,onClick:()=>void M(!1),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Save`]})]}),m&&(0,X.jsxs)(`div`,{className:u(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex flex-col gap-2`),children:[(0,X.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:async e=>{e.preventDefault();try{b((await Y.cases(g)).cases)}catch(e){p(e.message)}},children:[(0,X.jsx)(r,{"aria-label":`Find a test case`,autoFocus:!0,value:g,maxLength:100,placeholder:`checkout, ADO-12…`,onChange:e=>_(e.target.value),className:`min-w-0 flex-[1_1_200px]`}),(0,X.jsxs)(S,{size:`sm`,type:`submit`,"data-tip":`Find test cases from test management`,children:[(0,X.jsx)(ee,{"aria-hidden":`true`}),`Find`]})]}),v&&(v.length?(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:v.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,className:u(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`gap-2`),onClick:async()=>{try{let t=await Y.caseSteps(e.key),n=t.key.split(`:`)[1];j(`Test case ${n}: ${t.title}\n${t.steps.map((e,t)=>`${t+1}. ${e}`).join(`
3
- `)}`,{kind:`case`,label:`${n} ${t.title}`}),h(!1),b(null)}catch(e){p(e.message)}},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,X.jsxs)(`span`,{className:`flex-none text-body-sm text-muted`,children:[e.key.split(`:`)[1],` · `,l(e.steps,`step`)]})]})},e.key))}):(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No test case with steps matches. Test management lists the cases of the plans Settings connects.`}))]}),s.kind!==`typed`&&s.label&&(0,X.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`From `,s.kind===`flow`?`the saved prompt`:`the test case`,` `,(0,X.jsx)(`strong`,{className:`font-medium text-ink-2`,children:s.label}),`; change it as you like.`]}),w&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-pass`,children:[`Saved as “`,w,`”.`]}),(0,X.jsx)(B,{open:!!D,onClose:()=>O(``),title:`Replace the saved prompt?`,description:D,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(S,{onClick:()=>O(``),children:[(0,X.jsx)(k,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(S,{variant:`accent`,onClick:()=>void M(!0),children:[(0,X.jsx)(E,{"aria-hidden":`true`}),`Replace`]})]}),children:(0,X.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`The saved prompt's old text is not kept.`})})]})}function ct({info:e,url:t,named:n,where:r,prompt:i,files:a,checks:o,custom:c}){let d=(e,t)=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft py-4 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),(0,X.jsx)(`div`,{className:`text-body-sm`,children:t})]});return(0,X.jsxs)(`aside`,{"aria-label":`Summary`,className:u(s,`flex flex-col`),children:[d(`Page`,t.trim()?(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:Me(t.trim())}):(0,X.jsx)(`span`,{className:`text-muted`,children:`Not given yet`})),d(`Devices`,n.length?(0,X.jsx)(`span`,{children:n.join(`, `)}):(0,X.jsx)(`span`,{className:`text-muted`,children:`None picked`})),d(`Runs on`,r),d(`What to do`,i.trim()?`Your prompt${a?` and ${l(a,`file`)}`:``}`:(0,X.jsx)(`span`,{className:`text-muted`,children:`No prompt yet`})),d(`Checks`,o.length+c.filter(e=>e.trim()).length?(0,X.jsx)(`span`,{children:[...o.map(t=>e.checks.find(e=>e.id===t)?.label??t),...c.filter(e=>e.trim())].join(` · `)}):(0,X.jsx)(`span`,{className:`text-muted`,children:`None yet`}))]})}function lt({info:e,onStarted:t}){let n=$e(),i=(n.devices??[]).filter(t=>e.devices.some(e=>e.id===t)).slice(0,e.maxPanes),[o,s]=(0,q.useState)(0),[c,l]=(0,q.useState)(0),[d,f]=(0,q.useState)(n.address??e.start),[p,m]=(0,q.useState)(i.length?i:e.defaults),[g,_]=(0,q.useState)(``),[v,y]=(0,q.useState)([]),[b,x]=(0,q.useState)({kind:`typed`}),[C,ee]=(0,q.useState)((n.checks??[]).filter(t=>e.checks.some(e=>e.id===t)).length?n.checks.filter(t=>e.checks.some(e=>e.id===t)):e.checks.map(e=>e.id)),[T,E]=(0,q.useState)([]),[O,k]=(0,q.useState)(n.on&&n.on!==`local`&&e.clouds[n.on]?.ready?n.on:`local`),[A,j]=(0,q.useState)(e.browsers.some(e=>e.id===n.browser)?n.browser:`chrome`),te=e.browsers.find(e=>e.id===A)?.label??A,[M,ae]=(0,q.useState)(n.kind===`browser`?`browser`:`real`),[N,se]=(0,q.useState)(null),[P,ce]=(0,q.useState)(``),[F,le]=(0,q.useState)([]),I=O!==`local`&&M===`real`;(0,q.useEffect)(()=>{if(!I||N?.cloud===O)return;let e=!1;return ce(``),le([]),Y.cloudDevices(O).then(t=>!e&&se({cloud:O,devices:t.devices,max:t.max}),t=>!e&&ce(t.message)),()=>{e=!0}},[I,O,N?.cloud]);let L=N?.cloud===O?N.devices.map(e=>({id:e.id,label:e.name,category:e.category,width:0,height:0,scale:1,os:`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`})):[],R=I?F:p,z=I?F.map(e=>N?.devices.find(t=>t.id===e)?.label??e):p.map(t=>e.devices.find(e=>e.id===t)?.label??t),de=O===`local`?`This computer (Chromium)`:I?`${J[O]}: real devices, one session each`:`${J[O]}: ${te}`,[fe,B]=(0,q.useState)([]),[V,H]=(0,q.useState)(``),[U,me]=(0,q.useState)(!1),he=()=>void Y.flows().then(e=>B(e.flows),()=>{});(0,q.useEffect)(he,[]);let W=e=>{H(``),s(e),l(t=>Math.max(t,e)),window.scrollTo({top:0})},G=T.map(e=>e.trim()).filter(Boolean),ge=/^(https?:\/\/)?[^\s/]+\.[^\s]+|^https?:\/\/(localhost|127\.0\.0\.1)/i.test(d.trim()),K=async()=>{me(!0),H(``);let e={url:d.trim(),devices:R,prompt:g.trim(),attachments:v,source:b,checks:C,custom:G,...O===`local`?{}:I?{on:O,real:!0}:{on:O,browser:A}};try{et({...I?{}:{devices:p},address:d.trim(),checks:C,on:O,browser:A,kind:M}),t((await Y.start(e)).id)}catch(e){H(e.message),me(!1)}};return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsx)(Te,{steps:Ye,at:o,reached:c,onGo:e=>!U&&W(e)}),(0,X.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,X.jsxs)(`section`,{"aria-labelledby":`rp-step`,className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsx)(ye,{id:`rp-step`,icon:[ne,re,ie,D][o],title:[`Which page, on which devices?`,`What should ForgeQE do?`,`What should be checked?`,`Check and start`][o]}),V&&(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:V}),o===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(tt,{id:`rp-url`,label:`Page address`,help:e.start&&d.trim()===e.start?`The active environment's web app, from env.yaml.`:`An http or https address; sign in on the page itself.`,children:(0,X.jsx)(r,{id:`rp-url`,type:`url`,value:d,placeholder:`https://your-app.example.com`,spellCheck:!1,onChange:e=>f(e.target.value)})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`rp-on`,className:`text-body-sm font-medium`,children:`Run on`}),(0,X.jsx)(pe,{labelledBy:`rp-on`,value:O,onChange:k,options:[{id:`local`,label:`This computer`,tip:`ForgeQE's own browser, in the background`},...[`browserstack`,`testmu`].map(t=>({id:t,label:J[t],disabled:!e.clouds[t]?.ready,tip:e.clouds[t]?.ready?`A real browser on ${J[t]}: one session for every device`:`Not signed in: ${e.clouds[t]?.missing??`no sign-in`}. Save it in Settings › Secrets.`}))]}),O!==`local`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{id:`rp-kind`,className:`text-body-sm font-medium`,children:[`Devices on `,J[O]]}),(0,X.jsx)(pe,{labelledBy:`rp-kind`,value:M,onChange:ae,options:[{id:`real`,label:`Real devices`,tip:`Phones and tablets ${J[O]} lists now, each its own session`},{id:`browser`,label:`Emulated in a browser`,tip:`The device list emulated in one desktop browser on the cloud`}]})]}),O!==`local`&&!I&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,X.jsxs)(`label`,{htmlFor:`rp-browser`,className:`text-body-sm font-medium`,children:[`Browser on `,J[O]]}),(0,X.jsx)(a,{id:`rp-browser`,value:A,onChange:e=>j(e.target.value),className:`max-w-[360px]`,children:e.browsers.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`One `,J[O],` session for the whole run, each device in its own window of it. It takes longer to start than this computer, and counts against your `,J[O],` plan. A page on this computer or your own network cannot be reached from there.`]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Devices`}),I?P?(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:P}):N?.cloud===O?(0,X.jsx)(ke,{devices:L,picked:F,max:N.max,onChange:le,real:J[O]}):(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:[`Asking `,J[O],` for its devices…`]}):(0,X.jsx)(ke,{devices:e.devices,picked:p,max:e.maxPanes,onChange:m,...O===`local`?{}:{drawnBy:`${te} on ${J[O]}`}})]}),(0,X.jsx)(nt,{busy:U,next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oe,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(1),disabled:!ge||!R.length,aside:ge?void 0:(0,X.jsx)(`span`,{className:`text-muted`,children:`Enter the page's address.`})})]}),o===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`ForgeQE reads your prompt as steps and does each on every device in its own browser in the background, planned for each layout from what its screen shows (a phone's menu is often behind a button). After every step it checks every device and keeps a screenshot of each. What the prompt asks to verify becomes a check. It goes on if you leave the page.`,e.planner?``:` No model is set up, so the prompt is read line by line and only plain steps work (click …, scroll down, go back, press Enter).`]}),(0,X.jsx)(st,{prompt:g,setPrompt:_,files:v,setFiles:y,source:b,setSource:x,flows:fe,onFlowsChanged:he,onError:H}),(0,X.jsx)(nt,{busy:U,onBack:()=>W(0),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oe,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(2),disabled:!g.trim(),aside:g.trim()?void 0:(0,X.jsx)(`span`,{className:`text-muted`,children:`Say what to do.`})})]}),o===2&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,X.jsx)(`legend`,{className:`mb-2 p-0 text-body-sm font-medium`,children:`Checked by ForgeQE on every device`}),e.checks.map(e=>(0,X.jsxs)(`label`,{className:u(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start gap-2`),children:[(0,X.jsx)(_e,{className:`mt-1`,checked:C.includes(e.id),onCheckedChange:t=>ee(t?[...C,e.id]:C.filter(t=>t!==e.id))}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-body-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.about})]})]},e.id))]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Your own checks`}),(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`In plain words, judged on each layout from what its screen shows; a finding always quotes the screen.`,e.planner?``:` No model is set up, so these are not judged.`]}),T.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(r,{"aria-label":`Your check ${t+1}`,value:e,maxLength:300,placeholder:`The cart total shows without scrolling`,onChange:e=>E(T.map((n,r)=>r===t?e.target.value:n)),className:`min-w-0 flex-1`}),(0,X.jsx)(S,{variant:`icon`,size:`icon`,"aria-label":`Remove your check ${t+1}`,"data-tip":`Remove`,onClick:()=>E(T.filter((e,n)=>n!==t)),children:(0,X.jsx)(ue,{"aria-hidden":`true`})})]},t)),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(S,{size:`sm`,disabled:T.length>=Xe,onClick:()=>E([...T,``]),children:[(0,X.jsx)(w,{"aria-hidden":`true`}),`Add a check`]}),Ze.map(e=>(0,X.jsxs)(S,{size:`sm`,disabled:T.includes(e)||T.length>=Xe,onClick:()=>E([...T.filter(e=>e.trim()),e]),children:[(0,X.jsx)(w,{"aria-hidden":`true`}),e]},e))]})]}),(0,X.jsx)(nt,{busy:U,onBack:()=>W(1),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oe,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(3),aside:!C.length&&!G.length?(0,X.jsx)(`span`,{className:`text-muted`,children:`Only what your prompt asks to verify will be checked.`}):void 0})]}),o===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[minmax(0,1fr)] gap-4 @xl:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,X.jsx)(`dt`,{className:`text-body-sm font-medium text-muted`,children:`Page`}),(0,X.jsx)(`dd`,{className:`m-0 text-body-sm [overflow-wrap:anywhere]`,children:d.trim()}),(0,X.jsx)(`dt`,{className:`text-body-sm font-medium text-muted`,children:`Devices`}),(0,X.jsx)(`dd`,{className:`m-0 text-body-sm`,children:z.join(`, `)}),(0,X.jsx)(`dt`,{className:`text-body-sm font-medium text-muted`,children:`Runs on`}),(0,X.jsx)(`dd`,{className:`m-0 text-body-sm`,children:de}),(0,X.jsx)(`dt`,{className:`text-body-sm font-medium text-muted`,children:`What to do`}),(0,X.jsx)(`dd`,{className:`m-0 text-body-sm`,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:u(`panel rounded-md bg-(--page-surface-strong) p-6`,`whitespace-pre-wrap [overflow-wrap:anywhere]`),children:g.trim()}),v.length>0&&(0,X.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Attached: `,v.map(e=>e.name).join(`, `)]}),(0,X.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Read as steps and checks when the run starts; the run's page shows how.`})]})}),(0,X.jsx)(`dt`,{className:`text-body-sm font-medium text-muted`,children:`Checks`}),(0,X.jsxs)(`dd`,{className:`m-0 flex flex-col gap-1 text-body-sm`,children:[C.map(t=>(0,X.jsx)(`span`,{children:e.checks.find(e=>e.id===t)?.label},t)),G.map(t=>(0,X.jsxs)(`span`,{className:u(!e.planner&&`text-muted`),children:[`“`,t,`”`,e.planner?``:` (not judged: no model)`]},t))]})]}),(0,X.jsx)(nt,{busy:U,onBack:()=>W(2),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{"aria-hidden":`true`}),U?`Starting…`:`Start`]}),onNext:()=>void K(),aside:(0,X.jsx)(`span`,{className:`text-muted`,children:`Opens in ForgeQE's own browser on this computer; screenshots and findings are kept with the run.`})})]})]}),(0,X.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,X.jsx)(ct,{info:e,url:d,named:z,where:de,prompt:g,files:v.length,checks:C,custom:T})})]})]})}function ut({tab:e,wide:t,action:r,runs:i,children:a}){let o=f(`responsive`);return(0,X.jsx)(Se,{title:ge(`responsive`),page:o,label:`Responsive`,current:e,tabHref:e=>e===`agent`?n(`responsive`,Ce):n(`responsive`,`runs`),onPick:e=>location.hash=e===`agent`?n(`responsive`,Ce):n(`responsive`,`runs`),tabs:[{id:`runs`,label:`Runs`,icon:D,...i===void 0?{}:{n:i}}],below:(0,X.jsx)(xe,{page:o}),...t?{wide:t}:{},...r?{end:r}:{},children:a})}function dt({sub:e}){let[t,r]=(e??``).split(`/`),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(``),d=(0,q.useCallback)(()=>{Promise.all([Y.info(),Y.runs()]).then(([e,t])=>{a(e),s(t.runs),l(``)},e=>l(e.message))},[]);(0,q.useEffect)(d,[d,t]);let f=!!o?.some(e=>e.status===`running`);(0,q.useEffect)(()=>{if(!f||t!==`runs`)return;let e=V(d,3e3);return()=>z(e)},[f,t,d]);let p=()=>location.hash=n(`responsive`,`new`),m=c&&(0,X.jsx)(`p`,{role:`alert`,className:u(h.fail,`m-0`),children:c}),_=!i&&!c&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});if(t===`new`)return(0,X.jsxs)(ut,{tab:`runs`,children:[m,_,i&&(0,X.jsx)(lt,{info:i,onStarted:e=>location.hash=n(`responsive`,e)})]});if(t&&De.test(t))return(0,X.jsxs)(ut,{tab:`runs`,wide:!0,children:[m,_,(0,X.jsx)(Je,{id:t,tab:r},t)]});if(t!==`runs`)return(0,X.jsx)(ut,{tab:Ce});let v=o?.find(e=>e.status===`running`);return(0,X.jsxs)(ut,{tab:`runs`,...o?{runs:o.length}:{},action:o&&!o.length?void 0:(0,X.jsxs)(S,{variant:`accent`,disabled:!i||!!v,onClick:p,"data-tip":v?`A run is going: finish or stop it first`:`New run`,children:[(0,X.jsx)(w,{"aria-hidden":`true`}),`New`]}),children:[m,_,i&&o&&(o.length?(0,X.jsx)(Pe,{rows:o}):(0,X.jsx)(g,{page:!0,icon:O,title:`No runs yet`,action:(0,X.jsxs)(S,{size:`sm`,onClick:p,"data-tip":`New run`,children:[(0,X.jsx)(w,{"aria-hidden":`true`}),`New`]}),children:`Start a run to see one page on phones, tablets and desktops at once. Say in a prompt what to do (or start from a test case or a saved prompt) and what to check; each device is checked after every step, with a screenshot of each.`}))]})}export{dt as Responsive};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-oDy8sV6H.js";import{F as i,L as a,R as o,l as s}from"./preload-helper-BupTYkQW.js";import{t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{L as u}from"./palette-BgJTq_Ot.js";import{ct as d,f,v as p,y as m}from"./api-D8-lxyQi.js";import{C as h,S as g,_,d as v,f as y,g as b,i as x,n as S,s as C,u as w,x as T,y as E}from"./pageBack-BefA2rh7.js";import{$ as ee,B as te,Bt as ne,C as D,F as O,Fr as k,G as A,Hn as re,Jn as ie,N as j,P as M,Pn as N,Qt as ae,Rr as P,Sr as F,W as oe,X as se,Xn as ce,Zt as le,at as I,b as ue,dr as de,hr as fe,in as L,ir as R,lr as pe,m as me,mt as z,o as B,or as he,ot as ge,qn as _e,qt as ve,rn as ye,st as be,ut as xe,w as Se,wr as Ce,yr as we,z as Te,zn as Ee}from"./line-icons-CwCZidXs.js";import{Ct as V,Et as De,Jt as Oe,St as ke,Tt as H,Xt as U,Yt as Ae,_t as W,bt as G,ct as je,ft as Me,n as Ne,s as Pe,st as K,ut as Fe,vt as Ie,wt as Le,zt as Re}from"./frame-C8sL1yo-.js";import{t as q}from"./when-BuWCTaKm.js";import{t as ze}from"./code-Jek8uWUO.js";import{a as Be}from"./markdown-CxsWgpYs.js";import{H as Ve,J,U as He,V as Ue,X as We,Y,o as Ge}from"./index-BFG13fbg.js";import{g as Ke}from"./qualityParts-DtsD70Qh.js";import{t as qe}from"./AgentWork-BugEUl60.js";var X=e(t(),1),Z={view:()=>p(`GET`,`/api/testmgmt`),cases:()=>p(`GET`,`/api/testmgmt/cases`),case:e=>p(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>p(`POST`,`/api/testmgmt/sync`),schedule:()=>p(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>p(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>p(`GET`,`/api/testmgmt/gaps`),tags:()=>p(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>p(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>p(`GET`,`/api/testmgmt/suites`),suite:e=>p(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>p(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>p(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>p(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>p(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>p(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>p(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>p(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>p(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>p(`POST`,`/api/testmgmt/stop`),tests:()=>p(`GET`,`/api/testmgmt/tests`),test:e=>p(`GET`,`/api/testmgmt/test/${encodeURIComponent(e)}`),discoveryPlan:()=>p(`GET`,`/api/testmgmt/discover`),discover:e=>p(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>p(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>p(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>p(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>p(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>p(`POST`,`/api/testmgmt/stories`,{scope:e})},Je={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},Ye={mapping:`ForgeQE's mapping`,manual:`Linked by a person`,attribute:`Its marker or attribute names the case`,tracker:`The case's system names it`,agent:`Linked by the mapping agent`,name:`The case's id is in its name or tags`},Xe={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},Ze={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Q=l();function Qe({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Q.jsxs)(`aside`,{"aria-label":e,className:`flex w-full flex-none flex-col border-t border-line-soft bg-surface-muted xl:sticky xl:top-0 xl:h-(--screen) xl:w-[320px] 2xl:w-[380px] xl:border-t-0 xl:border-l`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,Q.jsx)(We,{icon:R,title:e,description:t})}),n&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Q.jsx)(P,{"aria-hidden":`true`})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function $e({title:e,about:t,looking:n,context:i,suggestions:a,placeholder:s,onClose:l,keys:u}){let[d,f]=(0,X.useState)(null),[p,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1),[y,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(!1),w=async(e,t,n,r,i)=>{v(!0),x(``);try{let{request:a}=await Z.ask(e,t,r,i),{id:o}=await m.start(a,{});f({id:o,said:n}),C(!1),g(``)}catch(e){x(e.message)}finally{v(!1)}};return(0,Q.jsxs)(Qe,{title:e,about:t,onClose:l,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,Q.jsxs)(T,{size:`sm`,disabled:_||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void w(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),p.trim()&&w(`ask`,(u??a[0]?.keys??[]).slice(0,50),p.trim(),p.trim())},children:[(0,Q.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Q.jsx)(o,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:p,placeholder:s,onChange:e=>g(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(T,{size:`icon`,variant:`primary`,type:`submit`,disabled:_||!p.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(ce,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Q.jsx)(E,{state:_||d&&!S?`thinking`:`working`,px:96,label:_?`Starting`:d&&!S?`Working`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:d?S?`Done. Ask again, or open the chat.`:`Working on it…`:n}),i.length>0&&(0,Q.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:i.map(e=>(0,Q.jsx)(b,{tone:`neutral`,icon:!1,children:e},e))}),d&&(0,Q.jsx)(`p`,{className:`m-0 text-body-lg leading-relaxed text-ink-2`,children:d.said})]}),y&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:y}),d?(0,Q.jsx)(qe,{id:d.id,label:`The ${e} at work`,onEnd:()=>C(!0)},d.id):(0,Q.jsxs)(`p`,{className:c(`m-0 text-center text-body-sm text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Q.jsx)(`a`,{href:r(`chats`),children:`All chats`}),`.`]})]})}var et={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},tt={automation:`Each case's tracker records its automated test: Azure DevOps' Associated Automation, or the automated label on a Jira or Xray test. Only cases whose test ForgeQE knows, from its mapping or a link, are marked.`,tags:`ForgeQE's own tags are added to each case's tags in Azure DevOps, or its labels in Jira. Tags the case already has stay; nothing is taken away.`,untag:`ForgeQE's own tags are taken off each case's tags in Azure DevOps, or its labels in Jira. Only a tag ForgeQE keeps for the case is taken off; the tracker's other tags stay.`},nt=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,rt=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,it=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,at=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function ot({plan:e,outcome:t}){let n=new Map((t?.failed??[]).map(e=>[e.key,e.error])),r=new Set((t?.done??[]).map(e=>e.key)),i=(e,t,i=!1)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Q.jsx)(j,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Q.jsx)(Te,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Q.jsx)(`span`,{className:i?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Q.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>i(e,t))}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Q.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col p-0`,children:e.skipped.map((e,t)=>i(e,t,!0))})]})]})}function st(e,t,n){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{if(e&&d.current||(d.current=!1,i(null),o(null),c(``),!e))return;let t=!0;return e().then(e=>t&&i(e??null),e=>t&&c(e.message)),()=>{t=!1}},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(d.current=!0,o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function ct({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,X.useState)(null),s=`${t.join(`
2
- `)}|${(n??[]).join(`
3
- `)}`;(0,X.useEffect)(()=>o(e?()=>()=>Z.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,s]);let l=st(a,r=>Z.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Q.jsx)(U,{open:!!e,onClose:r,title:e?et[e]:``,description:e?tt[e]:``,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:r,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),l.outcome?`Close`:`Cancel`]}),!l.outcome&&(0,Q.jsxs)(T,{busy:l.busy,variant:`primary`,disabled:l.busy||!l.plan?.changes.length,onClick:()=>void l.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Q.jsx)(I,{"aria-hidden":`true`}):(0,Q.jsx)(Ce,{"aria-hidden":`true`}),l.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${l.plan?.changes.length??``}`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!l.plan&&!l.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Working out what would change…`}),l.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:l.error}),l.plan&&(0,Q.jsx)(ot,{plan:l.plan,outcome:l.outcome})]})})}function lt({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[o,s]=(0,X.useState)(``),l=t.tracker?void 0:n.find(e=>rt(e)===(o||(n[0]?rt(n[0]):``))),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>d(e&&(t.tracker||l)?()=>()=>Z.suiteTracker(t.id,l).then(e=>e.plan):null),[e,t.id,t.tracker?at(t.tracker):``,l&&rt(l)]);let f=st(u,e=>Z.suiteTracker(t.id,l,e).then(e=>e.outcome),i),p=t.tracker;return(0,Q.jsx)(U,{open:e,onClose:r,title:p?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:p?`It is ${at(p)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:r,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),f.outcome?`Close`:`Cancel`]}),!f.outcome&&(0,Q.jsxs)(T,{busy:f.busy,variant:`primary`,disabled:f.busy||!f.plan?.changes.length,onClick:()=>void f.go(),children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),f.busy?`Writing…`:p?`Keep in step`:`Make it there`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[!p&&(n.length?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Q.jsx)(a,{value:l?rt(l):``,onChange:e=>s(e.target.value),children:n.map(e=>(0,Q.jsx)(`option`,{value:rt(e),children:nt(e)},rt(e)))})]}):(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This suite's cases are in no connected Azure DevOps plan or Xray project. Connect one in Settings › Integrations.`})),(p||l)&&!f.plan&&!f.error&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),f.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:f.error}),f.plan&&(0,Q.jsx)(ot,{plan:f.plan,outcome:f.outcome}),f.outcome&&!f.outcome.failed.length&&(0,Q.jsx)(b,{tone:`pass`,children:`Done`})]})})}var ut={automated:j,not_automated:M,pending:O,known_defect:F,needs_attention:F},dt={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function ft({text:e,tip:t,className:n}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:c(`line-clamp-2 [overflow-wrap:anywhere]`,n),children:e})}function pt({a:e}){let t=ut[e];return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-sm whitespace-nowrap`,children:[(0,Q.jsx)(t,{size:15,"aria-hidden":`true`,className:c(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),Je[e]]})}function mt({o:e}){return(0,Q.jsx)(b,{tone:dt[e],icon:e!==`not_run`,children:Ze[e]})}function ht({runs:e}){return e.length?(0,Q.jsx)(C,{label:`Last runs: ${e.map(e=>e===`p`?`passed`:`failed`).join(`, `)}`,runs:e.map(e=>e===`p`?{tone:`pass`,title:`Passed`}:{tone:`fail`,title:`Failed`})}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}function gt({tags:e,max:t=3}){return e.length?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Q.jsxs)(b,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(fe,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.slice(t).join(`, `)]})]})]}):null}function _t({label:e,items:t,value:n,onChange:r}){let i=t.find(e=>e.id===n);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{size:`sm`,"aria-label":e,value:n,onChange:e=>r(e.target.value),className:c(`w-auto`,i?.alert&&i.n?`text-fail`:void 0),children:t.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.n===void 0?e.label:`${e.label} (${e.n})`},e.id))}),i?.tip&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:i.tip})]})}function vt({figures:e,label:t}){let n=e.filter(e=>e.points.length>=2);return n.length?(0,Q.jsx)(`ul`,{"aria-label":t,className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.map(e=>{let t=e.format??(e=>String(e)),n=e.delta??(e=>String(e)),r=e.points.at(-1),i=e.points.at(-2),a=r.y-i.y,o=e.upIsGood===void 0||a===0?void 0:a>0===e.upIsGood,s=a>0?`up`:a<0?`down`:`no change`;return(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.label}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-headline-sm text-ink tabular-nums`,children:t(r.y)}),(0,Q.jsxs)(`span`,{className:c(`text-body-sm font-medium tabular-nums`,o===void 0?`text-muted`:o?`text-pass`:`text-fail`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:a>0?`↗ `:a<0?`↘ `:`→ `}),a===0?`${s} since ${i.x}`:`${s} ${n(Math.abs(a))} since ${i.x}`]})]})]},e.label)})}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The trend starts after a second day of numbers: each visit of Test management keeps the day's.`})}function yt({items:e,series:t,label:n,empty:r}){return r&&!e.some(e=>e.values.some(e=>e>0))?(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:r}):(0,Q.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-4 text-body-sm text-ink-2`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:c(`inline-block size-[10px] rounded-sm`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Q.jsx)(x,{series:t.map((t,n)=>({values:e.map(e=>e.values[n]??0),tone:t.className.includes(`accent-line`)?`soft`:`accent`,glow:!t.className.includes(`accent-line`)})),lead:Math.max(0,t.findIndex(e=>!e.className.includes(`accent-line`))),label:`${n}: ${e.map(e=>`${e.x} ${e.values.join(` and `)}`).join(`; `)}`,className:`h-[140px]`}),(0,Q.jsxs)(`span`,{className:`flex justify-between text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{children:e[0]?.x}),(0,Q.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function bt({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-body-sm`,children:[(0,Q.jsx)(ft,{text:e,className:`text-ink-2`}),(0,Q.jsx)(`span`,{role:`img`,"aria-label":`${e}: ${t} of ${n}`,className:`min-w-0`,children:(0,Q.jsx)(v,{share:n?t/n:0,lead:r===`bg-accent`,tone:r.includes(`fail`)?`fail`:r.includes(`pass`)?`pass`:void 0,text:`${i}%`})}),(0,Q.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function xt({open:e,onClose:t,title:n,preview:r,onStarted:i}){let[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``),[g,_]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(f(null),m(``),Z.suites().then(e=>{s({list:e.environments,...e.active?{active:e.active}:{}}),u(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>m(e.message)))},[e]),(0,X.useEffect)(()=>{if(!e||o===null)return;let t=!0;return f(null),m(``),r(l||void 0,!1).then(e=>{t&&f(e.preview??null)},e=>t&&m(e.message)),()=>{t=!1}},[e,l,o]);let v=async()=>{_(!0);try{await r(l||void 0,!0),i(),t()}catch(e){m(e.message)}finally{_(!1)}};return(0,Q.jsx)(U,{open:e,onClose:t,title:n,description:`ForgeQE runs these with forgeqe suite, on the environment you pick here. Results go to Runs and back to each case's system, as your settings say.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:t,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:g||!d,onClick:()=>void v(),"data-tip":`Start the run`,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Run `,d?d.cases:``]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[o&&o.list.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Q.jsx)(a,{value:l,onChange:e=>u(e.target.value),children:o.list.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),d&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[d.cases,` test case`,d.cases===1?``:`s`,` on `,d.env??`the active environment`,`.`]}),p&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:p})]})})}var St=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,Ct=e=>r(`test-management`,`cases`,encodeURIComponent(e)),wt=e=>r(`test-management`,`tests`,encodeURIComponent(e));function Tt({tests:e}){let t=(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:r(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Connect a test plan`]});return e?(0,Q.jsxs)(_,{page:!0,icon:oe,title:`${e} automated test${e===1?``:`s`} found, no test case yet`,action:t,children:[`Your automation repository's code has them: see them on `,(0,Q.jsx)(`a`,{href:r(`test-management`,`tests`),children:`Automated`}),`. Connect a test plan (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not. It goes in Settings › Integrations.`]}):(0,Q.jsx)(_,{page:!0,icon:L,title:`No test plans connected yet`,action:t,children:`Connect a test plan from your test case system (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) and its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already. In Settings, add it under your system's Test management, Test plans.`})}function Et({cases:e,onChanged:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(`all`),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),p=()=>Z.tests().then(e=>{r(e),a(``)},e=>a(e.message));(0,X.useEffect)(()=>{p()},[]),(0,X.useEffect)(()=>{if(!n?.busy)return;let e=Ae(()=>void p(),3e3);return()=>Oe(e)},[n?.busy]),jt(n?.busy??null,()=>t(`Done: the tests and their links are up to date.`));let m=(0,X.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(i)return(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:i});if(!n)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let g=n.tests,_={all:g.length,unlinked:g.filter(e=>!e.cases.length).length,linked:g.filter(e=>e.cases.length).length,code:g.filter(e=>e.via===`code`).length},v=g.filter(e=>o===`all`||(o===`unlinked`?!e.cases.length:o===`linked`?e.cases.length>0:e.via===`code`)),y=kt(v.map(e=>e.file).filter(e=>!!e)),x=async()=>{try{t(`The mapping agent is looking at ${(await Z.proposeLinks()).cases} cases with no test.`),p()}catch(e){t(e.message)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(T,{variant:`primary`,onClick:()=>u(!0),disabled:!!n.busy,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`Discover`]}),(0,Q.jsxs)(T,{onClick:()=>void x(),disabled:!!n.busy||!g.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Q.jsx)(R,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[n.busy?n.busy.what===`discover`?`Discovering tests, started ${q(n.busy.started)}…`:`The mapping agent is at work, started ${q(n.busy.started)}…`:n.discovery?`Discovered ${q(n.discovery.at)}.`:`Not discovered yet: these are read from the code.`,n.proposed>0&&` ${n.proposed} link${n.proposed===1?``:`s`} proposed, waiting on the cases' pages.`]})]}),n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:n.error}),n.discovery&&n.discovery.projects.length>0&&(0,Q.jsx)(Mt,{projects:n.discovery.projects}),(0,Q.jsx)(W,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,height:Ie,resetKey:o,empty:g.length?`No test matches.`:`No automated test found yet. Discover asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests; set the automation repository in Settings › Code first.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(_t,{label:`Tests to show`,items:[{id:`all`,label:`All tests`,n:_.all},{id:`unlinked`,label:`No test case`,n:_.unlinked},{id:`linked`,label:`Linked`,n:_.linked},{id:`code`,label:`Read from the code`,n:_.code,tip:`Their framework was not asked, or could not list them`}],value:o,onChange:s}),y&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Files in `,(0,Q.jsx)(`span`,{className:`font-mono`,children:y})]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[45%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Framework`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @3xl:table-cell`),children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:v.map(t=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(G,`max-w-0`),children:(0,Q.jsxs)(Ot,{uid:t.uid,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-x-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:t.uid??`No id yet`}),t.file&&(0,Q.jsx)(Dt,{path:t.file.slice(y.length),line:t.line}),t.flaky&&(0,Q.jsx)(b,{tone:`warn`,children:`Flaky`})]})]})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm @2xl:table-cell`),children:(0,Q.jsxs)(`span`,{"data-tip":Xe[t.via??`runs`],children:[t.framework&&t.framework!==`code`?At[t.framework]:(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not known yet`}),t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,Xe[t.via??`runs`]]})]})}),(0,Q.jsx)(`td`,{className:c(G,`text-body-sm`),"data-sort":t.cases.length,children:t.cases.length?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Q.jsx)(`a`,{href:Ct(e),className:`font-mono`,"data-tip":m.get(e)?.title,children:m.get(e)?.id??e},e)),t.cases.length>4&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Q.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Q.jsx)(`td`,{className:c(G,`hidden @3xl:table-cell`),children:(0,Q.jsx)(gt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:c(G,`hidden @2xl:table-cell`),"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(ht,{runs:t.runs})}),(0,Q.jsx)(`td`,{className:c(G,`text-right`),children:(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>f(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length||!t.uid,"data-tip":t.uid?`Link to a test case`:`Known from runs only: Discover gives it an id to link`,children:(0,Q.jsx)(ye,{"aria-hidden":`true`})})})]},t.uid??t.key))}),(0,Q.jsx)(Nt,{open:l,onClose:()=>u(!1),onStarted:()=>{u(!1),t(`Discovering tests: each project's framework lists its tests.`),p()}}),(0,Q.jsx)(Pt,{open:!!d,title:`Link to a test case`,description:d?`Pick the test case ${d.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!d?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>f(null),onPick:async e=>{d?.uid&&(await Z.link([{case:e,test:d.uid,action:`link`}]),f(null),t(`Linked ${d.uid} to ${m.get(e)?.id??e}.`),p())}})]})}function Dt({path:e,line:t}){let n=e.lastIndexOf(`/`)+1;return(0,Q.jsxs)(`span`,{className:`flex min-w-0 font-mono whitespace-nowrap`,children:[n>0&&(0,Q.jsx)(`span`,{className:`min-w-0 shrink-[999] truncate`,children:e.slice(0,n)}),(0,Q.jsx)(`span`,{className:`min-w-[10ch] truncate`,children:e.slice(n)}),t?`:${t}`:``]})}function Ot({uid:e,children:t}){let n=`flex min-w-0 flex-col gap-1 text-ink no-underline`;return e?(0,Q.jsx)(`a`,{href:wt(e),className:n,children:t}):(0,Q.jsx)(`span`,{className:n,children:t})}function kt(e){if(!e.length)return``;let t=e[0].split(`/`).slice(0,-1);for(let n of e.slice(1)){let e=n.split(`/`).slice(0,-1),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;t=t.slice(0,r)}return t.length?`${t.join(`/`)}/`:``}var At={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function jt(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Mt({projects:e}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Q.jsx)(j,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Q.jsx)(F,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Q.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.dir}):`the repository's root`,`: `,e.ok?`${e.tests} test${e.tests===1?``:`s`}`:`not listed by its framework, read from the code`,e.error&&(0,Q.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function Nt({open:e,onClose:t,onStarted:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(i(null),o(``),Z.discoveryPlan().then(i,e=>o(e.message)))},[e]);let u=async()=>{if(r){l(!0);try{await Z.discover(r.digest),n()}catch(e){o(e.message)}finally{l(!1)}}};return(0,Q.jsx)(U,{open:e,onClose:t,title:`Discover tests`,description:`Each test project's framework lists its tests, as a test explorer asks it. This runs the repository's code (pytest imports conftest.py, .NET builds the project) with no secret of ForgeQE's, so look at what will run first.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{onClick:t,children:`Cancel`}),(0,Q.jsxs)(T,{variant:`primary`,onClick:()=>void u(),disabled:!r||s,children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 text-body-sm`,children:[a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Q.jsx)(`p`,{className:`m-0 text-ink-2`,children:`No test project was found whose framework can be asked. Gherkin features and the code are still read.`}),r&&r.steps.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{children:[At[e.project.framework],` in `,e.project.dir?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Pt({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){let[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(``);(0,X.useEffect)(()=>s(``),[e]);let d=async e=>{u(e),s(``);try{await a(e)}catch(e){s(e.message)}finally{u(``)}};return(0,Q.jsx)(U,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Q.jsx)(T,{onClick:i,children:`Close`}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&(0,Q.jsxs)(`p`,{role:`alert`,className:c(h.fail,`m-0 flex items-center gap-2`),children:[(0,Q.jsx)(Te,{size:14,"aria-hidden":`true`}),o]}),(0,Q.jsx)(W,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Name`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsxs)(`td`,{className:c(G,`max-w-0`),children:[(0,Q.jsx)(ft,{text:e.label}),e.sub&&(0,Q.jsx)(`span`,{className:`block truncate font-mono text-body-sm text-muted`,children:e.sub})]}),(0,Q.jsx)(`td`,{className:c(G,`w-24 text-right`),children:(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void d(e.id),disabled:!!l,"aria-label":`Link ${e.label}`,"data-tip":`Link`,children:(0,Q.jsx)(ye,{"aria-hidden":`true`})})})]},e.id))})]})})}var Ft=e=>e&&/^https:\/\//i.test(e)?e:void 0;function It({caseKey:e,onRun:t,onChanged:n=()=>{}}){let[i,a]=(0,X.useState)(null),[o,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{let t=!0;return a(null),l(``),p(``),Z.case(e).then(e=>{t&&(a(e),l(``))},e=>t&&l(e.message)),()=>{t=!1}},[e]);let m=t=>{p(t),n(),Z.case(e).then(a,e=>p(`${t} Reading the case again failed: ${e.message}`))},_=(0,Q.jsx)(S,{to:{href:r(`test-management`,`cases`),label:`Test cases`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_,(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let v=i.case,y=[v.key],x=Ft(v.url);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[_,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:v.id}),` · `,v.plans.join(`, `)||`Not in a synced plan`]}),(0,Q.jsx)(We,{icon:te,title:v.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[v.priority&&(0,Q.jsxs)(b,{tone:v.priority===1?`fail`:v.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,v.priority]}),v.state&&(0,Q.jsx)(b,{tone:`neutral`,children:v.state}),(0,Q.jsx)(pt,{a:v.automation}),v.origin===`forgeqe`&&(0,Q.jsxs)(b,{tone:`running`,icon:!1,children:[(0,Q.jsx)(R,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,v.createdAt?` ${q(v.createdAt)}`:``]})]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[x&&(0,Q.jsxs)(`a`,{className:g(),href:x,target:`_blank`,rel:`noreferrer noopener`,"data-tip":`Open in its system`,children:[(0,Q.jsx)(ge,{"aria-hidden":`true`}),`Open`]}),v.how!==`none`&&v.how!==`tracker`&&!!v.test?.file&&v.trackerAutomated!==!0&&(0,Q.jsxs)(T,{onClick:()=>d(`automation`),"data-tip":`Mark it automated in its system`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),`Mark automated`]}),v.ownTags.some(e=>!v.trackerTags.includes(e))&&(0,Q.jsxs)(T,{onClick:()=>d(`tags`),"data-tip":`Write ForgeQE's tags to its system`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),`Write tags`]}),v.ownTags.some(e=>v.trackerTags.includes(e))&&(0,Q.jsxs)(T,{onClick:()=>d(`untag`),"data-tip":`Take ForgeQE's tags off in its system`,children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Untag`]}),(0,Q.jsxs)(T,{variant:`primary`,onClick:()=>t([v.key]),children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsx)(ct,{kind:u,keys:y,onClose:()=>d(null),onDone:m}),f&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:f}),(v.stale||v.drift)&&(0,Q.jsxs)(`p`,{role:`status`,className:c(h.warn,`m-0 flex items-start gap-2`),children:[(0,Q.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Q.jsxs)(`span`,{children:[v.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,v.drift&&(v.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(W,{label:`Steps`,search:!1,sortable:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-10`),children:`#`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Action`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Expected result`})]}),children:i.steps.map((e,t)=>(0,Q.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Q.jsx)(`td`,{className:c(G,`text-body-sm text-muted tabular-nums`),children:t+1}),(0,Q.jsx)(`td`,{className:c(G,`text-body-sm [overflow-wrap:anywhere]`),children:e.action}),(0,Q.jsx)(`td`,{className:c(G,`text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Q.jsx)(Lt,{detail:i,onChanged:m})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsx)(Y,{level:3,icon:ve,title:`Details`,className:c(s,`text-body-sm`),children:(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Q.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(mt,{o:v.lastRun.outcome}),v.lastRun.at&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[q(v.lastRun.at),v.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:v.suite??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:v.group??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:v.stories.join(`, `)||`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:v.tags.length?(0,Q.jsx)(gt,{tags:v.tags,max:10}):`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:v.steps})]})}),(0,Q.jsx)(Y,{level:3,icon:le,title:`In suites and packs`,className:c(s,`text-body-sm`),children:i.suites.length||v.packs.length?(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[i.suites.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`a`,{href:r(`test-management`,`suites`,e.id),children:e.name})},e.id)),v.packs.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:r(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})}),i.changes.length>0&&(0,Q.jsx)(Y,{level:3,icon:_e,title:`What ForgeQE did`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:i.changes.map((e,t)=>(0,Q.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})})]})]})]})}function Lt({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``);(0,X.useEffect)(()=>{(n.proposed.length||a)&&Z.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let d=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),f=async(e,r,i)=>{u(``);try{await Z.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){u(e.message)}},p=async e=>{u(``);try{t(`${e} is the main test now${(await Z.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){u(e.message)}},m=async()=>{u(``);try{await Z.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){u(e.message)}};return(0,Q.jsxs)(Y,{level:3,icon:A,title:`Automated tests`,className:s,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{size:`sm`,onClick:()=>o(!0),"data-tip":`Link a test`,children:[(0,Q.jsx)(ye,{"aria-hidden":`true`}),`Link`]}),(0,Q.jsxs)(T,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Q.jsx)(R,{"aria-hidden":`true`}),`Ask`]})]}),children:[l&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:l}),n.tests.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-body-sm`,children:n.tests.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Q.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Q.jsx)(b,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-body-sm text-muted`,children:[e.uid&&(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Q.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[Ye[e.how],e.why&&e.why!==Ye[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Make main: its tracker records this one as the case's automated test`,children:(0,Q.jsx)(de,{"aria-hidden":`true`})}),e.uid&&e.how!==`mapping`&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,"data-tip":`Unlink`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})})]},e.uid??e.key))}):n.test?(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-body-sm`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:Ye[n.how]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No automated test is linked. Link one, ask the agent, or ask the agent on the right to automate it.`}),(n.tests.length>0||n.test)&&(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[`Last runs `,(0,Q.jsx)(ht,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Q.jsxs)(`div`,{className:c(`rounded-base bg-surface-muted p-4`,`flex flex-col gap-2 text-body-sm`),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=d.get(e.test);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Q.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.test,`accept`,`Linked ${e.test}.`),"aria-label":`Accept ${t?.name??e.test}`,"data-tip":`Accept`,children:(0,Q.jsx)(Se,{"aria-hidden":`true`})}),(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void f(e.test,`refuse`,`Refused ${e.test}.`),"aria-label":`Refuse ${t?.name??e.test}`,"data-tip":`Refuse`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})})]},e.test)})]}),(0,Q.jsx)(Pt,{open:a,title:`Link a test`,description:`Pick a test that checks ${n.id}. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:(r??[]).filter(e=>e.uid&&!n.tests.some(t=>t.uid===e.uid)).map(e=>({id:e.uid,label:e.name,sub:`${e.uid}${e.file?` · ${e.file}`:``}`})),onClose:()=>o(!1),onPick:async e=>{await Z.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var Rt=[{id:`all`,label:`All cases`,icon:L,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:M,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:Te,test:St,alert:!0},{id:`pending`,label:`Pending`,icon:O,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:R,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:F,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:F,test:e=>e.drift}],zt=``,Bt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function Vt({cases:e,tests:t=0,selected:n,onSelect:r,onRun:i,onChanged:o}){let[s,l]=(0,X.useState)(`all`),[u,d]=(0,X.useState)(zt),[f,p]=(0,X.useState)(zt),[m,h]=(0,X.useState)(zt),[g,_]=(0,X.useState)(zt),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=(0,X.useMemo)(()=>Bt(e.flatMap(e=>e.plans)),[e]),E=(0,X.useMemo)(()=>Bt(e.map(e=>e.suite)),[e]),ee=(0,X.useMemo)(()=>Bt(e.flatMap(e=>e.tags)),[e]),te=e.filter(e=>(!u||e.plans.includes(u))&&(!f||e.suite===f)&&(!m||String(e.priority??``)===m)&&(!g||e.tags.includes(g))),ne=Rt.find(e=>e.id===s),D=te.filter(ne.test),O=new Set(n),k=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e)),A=D.length>0&&D.every(e=>O.has(e.key));return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(W,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,height:Ie,selection:{count:n.length,onClear:()=>r([]),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{size:`sm`,onClick:()=>y(!0),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),`Tag`]}),(0,Q.jsxs)(T,{size:`sm`,onClick:()=>x(!0),"data-tip":`Make a suite of the picked cases`,children:[(0,Q.jsx)(le,{"aria-hidden":`true`}),`Suite`]}),(0,Q.jsxs)(T,{size:`sm`,onClick:()=>C(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),`Mark automated`]}),(0,Q.jsxs)(T,{size:`sm`,onClick:()=>C(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),`Write tags`]}),(0,Q.jsxs)(T,{size:`sm`,variant:`primary`,onClick:()=>i(n),children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Run`]})]})},resetKey:`${s}|${u}|${f}|${m}|${g}`,empty:e.length?`Nothing matches.`:t?`No test cases yet. The repository's ${t} automated test${t===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(_t,{label:`Show`,items:Rt.map(e=>({id:e.id,label:e.label,n:te.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:s,onChange:l}),w.length>1&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Plan`,value:u,onChange:e=>d(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:zt,children:`Every plan`}),w.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),E.length>0&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Suite`,value:f,onChange:e=>p(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:zt,children:`Every suite`}),E.map(e=>(0,Q.jsx)(`option`,{children:e},e))]}),(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Priority`,value:m,onChange:e=>h(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:zt,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Q.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),ee.length>0&&(0,Q.jsxs)(a,{size:`sm`,"aria-label":`Tag`,value:g,onChange:e=>_(e.target.value),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:zt,children:`Any tag`}),ee.map(e=>(0,Q.jsx)(`option`,{children:e},e))]})]}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-10`),children:(0,Q.jsx)(J,{"aria-label":`Select every case shown`,checked:A,onCheckedChange:e=>r(e?Bt([...n,...D.map(e=>e.key)]):n.filter(e=>!D.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:D.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":O.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(J,{"aria-label":`Select ${e.id}`,checked:O.has(e.key),onCheckedChange:t=>k(e.key,t)})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsxs)(`a`,{href:Ct(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Q.jsx)(R,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Q.jsx)(`span`,{children:e.stories[0]}),(0,Q.jsx)(gt,{tags:e.tags,max:2})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 @xl:hidden`,children:[(0,Q.jsx)(pt,{a:e.automation}),(0,Q.jsx)(mt,{o:e.lastRun.outcome})]})]})}),(0,Q.jsx)(`td`,{className:c(G,`hidden min-w-[120px] max-w-[220px] text-body-sm text-ink-2 [overflow-wrap:anywhere] @2xl:table-cell`),children:e.suite??e.plans[0]??`–`}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsxs)(`td`,{className:c(G,`hidden @xl:table-cell`),children:[(0,Q.jsx)(pt,{a:e.automation}),e.stale&&(0,Q.jsx)(`span`,{className:`mt-1 block text-body-sm text-warn`,children:`Steps changed`})]}),(0,Q.jsx)(`td`,{className:c(G,`hidden @4xl:table-cell`),"data-sort":e.runs.length?e.runs.filter(e=>e===`p`).length/e.runs.length:-1,children:(0,Q.jsx)(ht,{runs:e.runs})}),(0,Q.jsx)(`td`,{className:c(G,`hidden @xl:table-cell`),"data-sort":e.lastRun.at&&Date.parse(e.lastRun.at)||0,children:(0,Q.jsxs)(`span`,{"data-tip":e.lastRun.at?`${q(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:[(0,Q.jsx)(mt,{o:e.lastRun.outcome}),e.lastRun.at&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,q(e.lastRun.at),e.lastRun.by===`tracker`?`, in its system`:``]})]})}),(0,Q.jsx)(`td`,{className:c(G,`text-right whitespace-nowrap`),children:(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":St(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Q.jsx)(N,{"aria-hidden":`true`})})})]},e.key))}),(0,Q.jsx)(ct,{kind:S,keys:n,onClose:()=>C(null),onDone:e=>o(e)}),(0,Q.jsx)(Ht,{open:v,keys:n,onClose:()=>y(!1),onDone:e=>o(e)}),(0,Q.jsx)(Ut,{open:b,keys:n,onClose:()=>x(!1),onDone:e=>o(e)})]})}function Ht({open:e,keys:t,onClose:n,onDone:r}){let[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,g]=(0,X.useState)(null),_=`${s?`-`:`+`}${a.trim()}|${t.join(`
4
- `)}`,v=m?.asked===_?m:null;(0,X.useEffect)(()=>{e||g(null)},[e]);let y=async()=>{p(!0),d(``);try{let e={[s?`remove`:`add`]:[a.trim()],cases:t};if(!v){let t=await Z.tag(e);g({asked:_,items:t.preview?.items??0});return}let i=await Z.tag(e,!0);g(null),r(`${s?`Removed`:`Added`} the tag ${a.trim()} ${s?`from`:`on`} ${i.changed??0} case${i.changed===1?``:`s`}.`),o(``),n()}catch(e){d(e.message)}finally{p(!1)}};return(0,Q.jsx)(U,{open:e,onClose:n,title:`Tag ${t.length} test case${t.length===1?``:`s`}`,description:`ForgeQE keeps its tags in .forgeqe/testmgmt/tags.json, shared with the team through the repository. The case's own tags in its system do not change.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:n,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:f||!a.trim()||!!v&&v.items===0,onClick:()=>void y(),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),v?`${s?`Remove from`:`Add to`} ${v.items}`:`Preview`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Q.jsx)(i,{value:a,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>o(e.target.value)})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(J,{checked:s,onCheckedChange:l}),`Remove it instead`]}),v&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:v.items===0?`No case would change.`:`${v.items} case${v.items===1?``:`s`} would change. ${s?`Remove`:`Add`} to confirm.`}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:u})]})})}function Ut({open:e,keys:t,onClose:n,onDone:a}){let[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1),p=async()=>{f(!0),u(``);try{let{suite:e}=await Z.saveSuite({name:o.trim(),groups:[],exclude:[],picked:t});a(`Made the suite ${e.name}.`),s(``),n(),location.hash=r(`test-management`,`suites`,e.id)}catch(e){u(e.message)}finally{f(!1)}};return(0,Q.jsx)(U,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:n,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:d||!o.trim(),onClick:()=>void p(),children:[(0,Q.jsx)(le,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Q.jsx)(i,{value:o,maxLength:80,placeholder:`Saved cards`,onChange:e=>s(e.target.value)})]}),l&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:l})]})})}var Wt=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),Gt=(e,t)=>t?Math.round(e/t*100):0;function Kt(e,t,n){if(e.length<2)return;let r=e.at(-1),i=new Date(`${r.day}T00:00:00Z`).getTime()-6048e5,a=e.findLast(e=>new Date(`${e.day}T00:00:00Z`).getTime()<=i)??e[0],o=t(r)-t(a);return{text:`${o>0?`+`:``}${o}`,dir:o>0?`up`:o<0?`down`:`same`,...n===void 0||o===0?{}:{good:o>0===n},against:`since ${Wt(a.day)}`}}function qt({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length)return(0,Q.jsx)(Tt,{tests:n.tests});let i=e.trend;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(je,{label:`Headline numbers`,children:[(0,Q.jsx)(K,{label:`Test cases`,icon:L,value:n.cases,change:Kt(i,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Q.jsx)(K,{label:`Automated`,icon:j,value:`${n.automated} · ${Gt(n.automated,n.cases)}%`,change:Kt(i,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Q.jsx)(K,{label:`Not automated`,icon:M,value:n.notAutomated,change:Kt(i,e=>e.notAutomated,!1)}),(0,Q.jsx)(K,{label:`Pending`,icon:O,value:n.pending,tone:n.pending?`text-warn`:void 0,change:Kt(i,e=>e.pending,!1),note:`in Design or not ready`}),(0,Q.jsx)(K,{label:`Failing`,icon:Te,value:n.failing,tone:n.failing?`text-fail`:void 0,change:Kt(i,e=>e.failing,!1),note:`their last run`}),(0,Q.jsx)(K,{label:`Generated by ForgeQE`,icon:R,value:n.generated,change:Kt(i,e=>e.generated,!0)})]}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Q.jsx)(Y,{icon:ee,title:`Automation coverage`,divider:!1,className:s,children:(0,Q.jsx)(vt,{label:`Automation coverage, latest and its change`,figures:[{label:`Share of test cases automated`,points:i.map(e=>({x:Wt(e.day),y:Gt(e.automated,e.cases)})),format:e=>`${e}%`,delta:e=>`${e} pt${e===1?``:`s`}`,upIsGood:!0},{label:`Automated`,points:i.map(e=>({x:Wt(e.day),y:e.automated})),upIsGood:!0},{label:`Not automated`,points:i.map(e=>({x:Wt(e.day),y:e.notAutomated})),upIsGood:!1},{label:`Failing`,points:i.map(e=>({x:Wt(e.day),y:e.failing})),upIsGood:!1}]})}),(0,Q.jsx)(Y,{icon:D,title:`Generated and automated, by week`,divider:!1,className:s,children:(0,Q.jsx)(yt,{label:`Test cases generated and automated each week`,empty:`Nothing generated or automated in these weeks yet.`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:Wt(e.week),values:[e.generated,e.automated]}))})}),(0,Q.jsxs)(Y,{icon:N,title:`Last run of every case`,divider:!1,className:s,children:[(0,Q.jsx)(w,{label:`Passed ${n.cases-n.failing-n.neverRun}, failing ${n.failing}, not run ${n.neverRun}`,parts:[{key:`passed`,value:n.cases-n.failing-n.neverRun,className:`bg-pass`},{key:`failing`,value:n.failing,className:`bg-fail`},{key:`not-run`,value:n.neverRun,className:`bg-muted`}]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-body-sm`,children:[(0,Q.jsx)(`a`,{href:r(`test-management`,`cases`),className:`no-underline`,children:(0,Q.jsxs)(b,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(b,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`no-underline`,children:(0,Q.jsxs)(b,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Q.jsx)(Y,{icon:le,title:`Automated, by suite`,divider:!1,className:s,actions:(0,Q.jsx)(`a`,{href:r(`test-management`,`gaps`),className:`text-body-sm`,children:`Find gaps`}),children:e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Q.jsx)(bt,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No suites yet.`})})]}),(0,Q.jsx)(W,{label:`Suites`,placeholder:`Find a suite`,empty:`No suites yet: ask the Suite agent for one on Suites.`,search:e.suites.length>8,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:Le,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Q.jsxs)(`tr`,{className:De,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(`a`,{href:r(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Q.jsx)(`td`,{className:ke,children:e.cases}),(0,Q.jsx)(`td`,{className:G,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,Q.jsxs)(b,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:`${G} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(re,{"aria-hidden":`true`})}),(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(N,{"aria-hidden":`true`})})]})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(oe,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var Jt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Yt({id:e,title:t,url:n}){let r=Jt(n);return(0,Q.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Q.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-body-sm text-accent-fg`,children:e}):(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-accent-fg`,children:e})]})}var Xt={azure_devops:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`iteration`,label:`Iteration path`,placeholder:`Shop\\Release 3`},{key:`area`,label:`Area path`,placeholder:`Shop\\Checkout`},{key:`parent`,label:`Epic or feature`,placeholder:`1234`,number:!0},{key:`ids`,label:`Work item ids`,placeholder:`101, 102`,list:`numbers`},{key:`project`,label:`Project`,placeholder:`When Settings names none`}],jira:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`fixVersion`,label:`Fix version`,placeholder:`2.4.0`},{key:`epic`,label:`Epic`,placeholder:`SHOP-12`},{key:`keys`,label:`Story keys`,placeholder:`SHOP-101, SHOP-102`,list:`keys`},{key:`project`,label:`Project key`,placeholder:`SHOP`}],qtest:[{key:`module`,label:`Requirements module`,placeholder:`Module id, e.g. 1203`,number:!0},{key:`ids`,label:`Requirement ids`,placeholder:`5101, 5102`,list:`numbers`}]};function Zt(e,t){let n={system:e};for(let r of Xt[e]){let i=(t[r.key]??``).trim();i&&(r.list===`numbers`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(Number):r.list===`keys`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(e=>e.toUpperCase()):r.number?n[r.key]=Number(i):n[r.key]=r.key===`project`&&e===`jira`?i.toUpperCase():i)}return n}var Qt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function $t({gaps:e,onRead:t}){let[n,r]=(0,X.useState)(e.live?.system??`azure_devops`),[o,l]=(0,X.useState)(Qt(e.live)),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{e.live&&(r(e.live.system),l(Qt(e.live)))},[e.live]);let m=async()=>{d(!0),p(``);try{await Z.readStories(Zt(n,o)),t()}catch(e){p(e.message)}finally{d(!1)}};return(0,Q.jsxs)(`form`,{className:c(s,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),m()},children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Q.jsxs)(a,{size:`sm`,value:n,onChange:e=>(r(e.target.value),l({})),className:`w-auto`,children:[(0,Q.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Q.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Q.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),Xt[n].map(e=>(0,Q.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Q.jsx)(i,{size:`sm`,value:o[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>l({...o,[e.key]:t.target.value})})]},e.key)),(0,Q.jsxs)(T,{busy:u,size:`sm`,variant:`primary`,type:`submit`,disabled:u||!Xt[n].some(e=>e.key!==`project`&&(o[e.key]??``).trim()),children:[(0,Q.jsx)(Ee,{"aria-hidden":`true`}),u?`Reading…`:`Read`]})]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:f})]})}function en({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Q.jsx)($t,{gaps:t,onRead:i});if(!t.report)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Q.jsx)(_,{icon:me,title:`No stories read yet`,children:`Say which stories to read: a sprint, an iteration, an area, an epic or the ids. ForgeQE reads each story with its test cases and acceptance criteria from the tracker, as Release readiness does, and reads them again with every sync.`})]});let o=(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${q(t.report.at)}`:``}: ${t.report.scope}`:`From the readiness report of ${t.report.scope||t.report.id}`,` (`,t.stories,` stor`,t.stories===1?`y`:`ies`,`).`,e===`stories`&&n.length>0&&` ${n.length} picked for the Gap agent's "Cases for stories".`]}),s=new Set(t.noCase.map(e=>e.id)),l=new Set(n.filter(e=>s.has(e)));return e===`stories`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(W,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,selection:{count:l.size,onClear:()=>r([])},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-10`),children:(0,Q.jsx)(J,{"aria-label":`Pick every story shown`,checked:t.noCase.length>0&&t.noCase.every(e=>l.has(e.id)),onCheckedChange:e=>r(e?t.noCase.map(e=>e.id).slice(0,50):[])})}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[55%]`),children:`Story`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Type`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`State`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":l.has(e.id)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(J,{"aria-label":`Pick ${e.id}`,checked:l.has(e.id),onCheckedChange:t=>r(t?[...l,e.id].slice(0,50):[...l].filter(t=>t!==e.id))})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(Yt,{id:e.id,title:e.title,url:e.url})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm @2xl:table-cell`),children:e.type||`–`}),(0,Q.jsx)(`td`,{className:G,children:e.state?(0,Q.jsx)(b,{tone:`neutral`,icon:!1,children:e.state}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Q.jsx)(W,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[55%]`),children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(G,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(Yt,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var tn=[{id:`stories`,label:`Stories with no case`,icon:me},{id:`criteria`,label:`Criteria not covered`,icon:L}],nn=[{id:`not_automated`,label:`Not automated`,icon:M},{id:`pending`,label:`Pending`,icon:O},{id:`never_run`,label:`Never run`,icon:M},{id:`failing`,label:`Failing`,icon:Te,alert:!0},{id:`stale`,label:`Steps changed`,icon:F},{id:`drift`,label:`Tracker disagrees`,icon:F},{id:`no_case`,label:`Tests with no case`,icon:oe}];function rn({gaps:e,cases:t,tests:n,selected:r,onSelect:i,onRun:a,pickedStories:o=[],onPickStories:s=()=>{},onStoriesRead:l=()=>{}}){let[u,d]=(0,X.useState)(t.length||!n.length?`not_automated`:`no_case`),f=new Map(t.map(e=>[e.key,e])),p=new Map(e.ranked.map(e=>[e.key,e.why])),m=e.ranked.map(e=>e.key),h=new Set(m),g=u===`no_case`||u===`stories`||u===`criteria`?[]:u===`not_automated`?[...m,...e.lists.not_automated.filter(e=>!h.has(e))]:e.lists[u],_=e.stories??{stories:0,noCase:[],criteria:[]},v={stories:_.noCase.length,criteria:_.criteria.length},y=g.map(e=>f.get(e)).filter(e=>!!e),x=new Set(r),S=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e)),C=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(_t,{label:`Gaps to show`,items:[...nn.map(t=>({id:t.id,label:t.label,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...tn.map(e=>({id:e.id,label:e.label,n:v[e.id],tip:_.report?_.report.id===`live`?`Read from the tracker: ${_.report.scope}`:`From the readiness report of ${_.report.scope||_.report.id}`:`Read the release's stories from the tracker first`}))],value:u,onChange:e=>d(e)}),u===`not_automated`&&y.length>0&&(0,Q.jsxs)(T,{size:`sm`,onClick:()=>i(y.slice(0,20).map(e=>e.key)),"data-tip":`Pick the 20 that matter most: priority, failing when run, in a pack, tagged smoke`,children:[(0,Q.jsx)(L,{"aria-hidden":`true`}),`Top 20`]})]});return(0,Q.jsx)(`div`,{className:`flex flex-col gap-6`,children:u===`stories`||u===`criteria`?(0,Q.jsxs)(Q.Fragment,{children:[C,(0,Q.jsx)(en,{kind:u,gaps:_,picked:o,onPick:s,onRead:l})]}):u===`no_case`?(0,Q.jsx)(W,{label:`Tests with no test case`,placeholder:`Find a test`,height:Ie,empty:`Every test ForgeQE knows has a test case behind it.`,tools:C,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[55%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsxs)(`td`,{className:G,children:[t.uid?(0,Q.jsx)(`a`,{href:wt(t.uid),className:`font-medium [overflow-wrap:anywhere]`,children:t.name}):(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),t.file&&(0,Q.jsx)(`span`,{className:`block font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.file}),t.flaky&&(0,Q.jsx)(b,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(gt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:G,"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(ht,{runs:t.runs})})]},e):null})}):(0,Q.jsx)(W,{label:nn.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,height:Ie,selection:{count:r.length,onClear:()=>i([])},empty:`No gap of this kind.`,tools:C,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-10`),children:(0,Q.jsx)(J,{"aria-label":`Select every case shown`,checked:y.length>0&&y.every(e=>x.has(e.key)),onCheckedChange:e=>i(e?[...new Set([...r,...y.map(e=>e.key)])]:r.filter(e=>!y.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:u===`not_automated`?`Why it matters`:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:y.map(e=>(0,Q.jsxs)(`tr`,{className:H,"data-state":x.has(e.key)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(J,{"aria-label":`Select ${e.id}`,checked:x.has(e.key),onCheckedChange:t=>S(e.key,t)})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsxs)(`a`,{href:Ct(e.key),className:`flex min-w-[160px] flex-col gap-1 text-ink no-underline @xl:min-w-[220px]`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Q.jsx)(`span`,{children:e.suite}),(0,Q.jsx)(gt,{tags:e.tags,max:2})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1 @xl:hidden`,children:u===`not_automated`?(p.get(e.key)??[]).map(e=>(0,Q.jsx)(b,{tone:`running`,icon:!1,children:e},e)):(0,Q.jsx)(pt,{a:e.automation})})]})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsx)(`td`,{className:c(G,`hidden @xl:table-cell`),children:u===`not_automated`?(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(p.get(e.key)??[]).map(e=>(0,Q.jsx)(b,{tone:`running`,icon:!1,children:e},e)),!(p.get(e.key)??[]).length&&(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})]}):(0,Q.jsx)(pt,{a:e.automation})}),(0,Q.jsx)(`td`,{className:c(G,`hidden @2xl:table-cell`),children:(0,Q.jsx)(mt,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:c(G,`text-right`),children:(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>a([e.key]),children:(0,Q.jsx)(N,{"aria-hidden":`true`})})})]},e.key))})})}var an=e=>e.from===`report`?`From the run's own report`:`From each case's latest result since the run started (its report is not written yet)`,on={system:`system`,plan:`plan`,suite:`suite`,priority:`priority`,state:`state`,automation:`automation`,tag:`tag`,last_run:`last run`,origin:`origin`,stale:`steps changed`,in_pack:`in pack`};function sn({suites:e,onRun:t}){return(0,Q.jsx)(W,{label:`Suites`,placeholder:`Find a suite`,height:Ie,empty:e.length?`Nothing matches.`:`No suites yet. Tell the Suite agent what a suite is for, such as “regression for the payments suite, P1 and anything failing lately”: it picks the cases from your plans, tags and runs.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[40%]`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:Le,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(Le,`hidden @xl:table-cell`),children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Q.jsxs)(`tr`,{className:De,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsxs)(`td`,{className:c(G,`max-w-0`),children:[(0,Q.jsxs)(`a`,{href:r(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Q.jsx)(R,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Q.jsx)(le,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Q.jsx)(ft,{text:e.name})]}),e.description&&(0,Q.jsx)(ft,{text:e.description,className:`mt-1 text-body-sm text-muted`})]}),(0,Q.jsx)(`td`,{className:ke,children:e.cases}),(0,Q.jsxs)(`td`,{className:c(ke,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Q.jsx)(`td`,{className:G,"data-sort":e.last&&Date.parse(e.last.at)||0,children:e.last?(0,Q.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-body-sm`,"data-tip":an(e.last),children:[(0,Q.jsxs)(b,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:c(G,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Q.jsx)(re,{"aria-hidden":`true`})}),(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Q.jsx)(N,{"aria-hidden":`true`})})]})]},e.id))})}function cn({id:e,onRun:t,onDeleted:n}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{a(null),Z.suite(e).then(e=>{a(e),s(``)},e=>s(e.message))},[e]);let p=(0,Q.jsx)(S,{to:{href:r(`test-management`,`suites`),label:`All suites`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[p,(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let m=i.suite,g=i.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Q.jsx)(We,{icon:le,title:m.name}),m.description&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:m.description}),m.tracker&&(0,Q.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Kept as`,` `,it(m.tracker)?(0,Q.jsx)(`a`,{href:it(m.tracker),target:`_blank`,rel:`noreferrer noopener`,children:at(m.tracker)}):at(m.tracker)]})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(m.tracker||i.targets.length>0)&&(0,Q.jsxs)(T,{onClick:()=>f(!0),"data-tip":m.tracker?`Keep it in step with its tracker`:`Keep it in a tracker`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),m.tracker?`Update`:`Keep`]}),(0,Q.jsxs)(T,{variant:`danger`,onClick:()=>u(!0),children:[(0,Q.jsx)(we,{"aria-hidden":`true`}),`Delete`]}),g>0&&(0,Q.jsxs)(T,{onClick:()=>t(m.id,`failed`),children:[(0,Q.jsx)(re,{"aria-hidden":`true`}),`Rerun `,g,` failed`]}),(0,Q.jsxs)(T,{variant:`primary`,onClick:()=>t(m.id),children:[(0,Q.jsx)(N,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Q.jsxs)(je,{label:`The suite`,children:[(0,Q.jsx)(K,{compact:!0,label:`Cases`,value:m.cases,note:`${m.automated} automated`}),(0,Q.jsx)(K,{compact:!0,label:`Last run`,value:m.last?`${m.last.passed} passed`:`Not run`,tone:m.last?.failed?`text-fail`:void 0,note:m.last?`${m.last.failed} failed · ${q(m.last.at)}${m.last.from===`report`?``:` · so far`}`:void 0}),(0,Q.jsx)(K,{compact:!0,label:`Runs on`,value:m.env??`Active`,note:m.runs.length?`${m.runs.length} run${m.runs.length===1?``:`s`}`:`never run`}),(0,Q.jsx)(K,{compact:!0,label:`Built`,value:m.built===`agent`?`Suite agent`:m.built===`rules`?`Rules`:`Picked`,note:`updated ${q(m.updatedAt)}`})]}),m.groupsCount.length>0&&(0,Q.jsx)(Y,{level:3,icon:xe,title:`Why these cases`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`text-body-sm`),children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:m.groupsCount.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-muted`,children:m.groups[t]?.rules.map(e=>`${on[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})}),(0,Q.jsx)(W,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[45%]`),children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Last run`})]}),children:i.members.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(G,`max-w-0`),children:(0,Q.jsxs)(`a`,{href:Ct(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(ft,{text:e.case.title,className:`font-medium`}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(gt,{tags:e.case.tags})]})]})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm text-ink-2 @xl:table-cell`),children:e.group}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(pt,{a:e.case.automation})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(mt,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Q.jsx)(lt,{open:d,suite:m,targets:i.targets,onClose:()=>f(!1),onDone:()=>void Z.suite(e).then(a,()=>{})}),(0,Q.jsx)(U,{open:l,onClose:()=>u(!1),title:`Delete ${m.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:()=>u(!1),children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(T,{variant:`destructive`,onClick:()=>void Z.deleteSuite(m.id).then(()=>{u(!1),n()},e=>s(e.message)),children:[(0,Q.jsx)(we,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Q.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function ln({open:e,onSaved:t}){let[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``),p=n.findLast(e=>`built`in e)?.built,m=n.filter(e=>`you`in e).map(e=>e.you).join(`. `),g=async t=>{let n=t.trim();if(n){u(!0),f(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Z.buildSuite(m?`${m}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){f(e.message)}finally{u(!1)}}},_=async n=>{if(p){u(!0);try{let{suite:i}=await Z.saveSuite({...n&&e?{id:e.id}:{},name:n&&e?e.name:p.name,description:p.summary,groups:p.groups,exclude:p.exclude,built:`agent`});r([]),t(i)}catch(e){f(e.message)}finally{u(!1)}}};return(0,Q.jsxs)(Qe,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(e?[`Leave out cases that are not automated`,`Add everything failing lately`,`Only priority 1 and 2`]:[`Smoke suite`,`P1 cases that failed lately`,`Everything not automated in one suite`]).map(e=>(0,Q.jsxs)(T,{size:`sm`,disabled:l,onClick:()=>void g(e),children:[(0,Q.jsx)(R,{"aria-hidden":`true`}),e]},e))}),(0,Q.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),g(i)},children:[(0,Q.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Q.jsx)(o,{id:`tm-suite-words`,rows:2,maxLength:1e3,value:i,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>a(e.target.value),className:`min-h-11 flex-1 resize-none`}),(0,Q.jsx)(T,{size:`icon`,variant:`primary`,type:`submit`,disabled:l||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Q.jsx)(ce,{"aria-hidden":`true`})})]})]}),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Q.jsx)(E,{state:l?`thinking`:`working`,px:96,label:l?`Building the suite`:`Ready`}),(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:l?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),n.map((e,t)=>`you`in e?(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-lg leading-relaxed text-ink-2`,children:e.you},t):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-center text-headline-sm`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-ink-2`,children:e.built.summary}),e.built.note&&(0,Q.jsx)(`p`,{className:`m-0 text-center text-body-sm text-muted`,children:e.built.note}),(0,Q.jsxs)(`div`,{className:c(s,`flex flex-col gap-2 text-body-sm`),children:[e.built.perGroup.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${on[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Q.jsxs)(`div`,{className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 text-body-sm`),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Q.jsx)(T,{size:`sm`,disabled:l,onClick:()=>void g(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.built.sample.slice(0,5).map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Q.jsx)(ft,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),d&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:d}),p&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Q.jsxs)(T,{disabled:l,onClick:()=>void _(!0),children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:l,onClick:()=>void _(!1),"data-tip":e?`Save as a new suite`:`Save the suite`,children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),e?`Save new`:`Save`]})]})]})}var un=[{id:`off`,label:`Off`,icon:M},{id:`hourly`,label:`Every hour`,icon:Ee},{id:`daily`,label:`Daily`,icon:ue}];function dn(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function fn({disabled:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null);return(0,X.useEffect)(()=>{Z.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{size:`icon`,"aria-label":`Schedule`,disabled:e,onClick:()=>n(!0),"data-tip":`Schedule: ${dn(r)}${r?.nextAt?`, next ${Ke(r.nextAt)}`:``}. Set when the plans are synced`,children:(0,Q.jsx)(ue,{"aria-hidden":`true`})}),(0,Q.jsx)(hn,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}var pn=(e,t)=>!!e&&!!t&&e===t.digest&&t.steps.length>0,mn=(e,t,n)=>e!==`off`&&t&&n&&n.steps.length>0?n.digest:void 0;function hn({open:e,onClose:t,now:n,onSaved:r}){let[a,o]=(0,X.useState)(`off`),[s,l]=(0,X.useState)(`06:00`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(`loading`),[b,x]=(0,X.useState)(!1),S=n&&n.every!==`off`&&n.every!==`custom`?n.discover:void 0;(0,X.useEffect)(()=>{e&&(d(``),x(!1),g(null),v(`loading`),Z.discoveryPlan().then(e=>{g(e),v(`ready`),x(pn(S,e))},()=>v(`failed`)),o(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&l(n.at))},[e,n]);let C=async()=>{p(!0);try{let e=mn(a,b,m),n=e?{discover:e}:{};r((await Z.setSchedule(a===`daily`?{every:a,at:s,...n}:a===`hourly`?{every:a,...n}:{every:a})).schedule),t()}catch(e){d(e.message)}finally{p(!1)}};return(0,Q.jsx)(U,{open:e,onClose:t,title:`Sync on a schedule`,description:`ForgeQE reads every case of the connected test plans again, as Sync does, and the stories Gaps read, in the jobs service (forgeqe testmgmt sync). It can also discover the tests first. It runs while this computer is on.`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(T,{onClick:t,children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]}),(0,Q.jsxs)(T,{variant:`primary`,disabled:f||_===`loading`||a===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s),onClick:()=>void C(),children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-body-sm`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:un.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:a,onChange:o})}),a===`daily`&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Q.jsx)(i,{type:`time`,step:60,value:s,onChange:e=>l(e.target.value)})]}),a!==`off`&&m&&m.steps.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(J,{checked:b,onCheckedChange:e=>x(e===!0),"aria-label":`Also discover the tests`}),(0,Q.jsx)(`span`,{children:`Also discover the tests first. This runs the repository's code with these commands, with no secret of ForgeQE's. If the test projects change, the schedule stops discovering until you confirm again.`})]}),!!S&&S!==m.digest&&!b&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The test projects changed since discovery was agreed to: tick the box to agree to these commands, or the schedule only syncs.`}),b&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:m.steps.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`font-mono text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.command})},t))})]}),a!==`off`&&_===`loading`&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Reading what discovery would run…`}),a!==`off`&&_===`failed`&&!!S&&(0,Q.jsx)(`p`,{role:`alert`,className:`m-0 text-warn`,children:`What discovery would run could not be read, so saving here turns scheduled discovery off. Close and open this again to try once more.`}),n?.every===`custom`&&(0,Q.jsxs)(`p`,{className:`m-0 text-warn`,children:[`The sync job was changed outside this page (`,n.text,`). Saving here replaces it.`]}),n?.enabled===!1&&(0,Q.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Q.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,Ke(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:u})]})})}var gn={forgeqe:{label:`ForgeQE`,icon:R},script:{label:`Tests`,icon:oe}},_n=e=>gn[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:k},vn=e=>e!==`forgeqe`&&e!==`script`,yn=[];function bn({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,X.useState)(`all`),[a,o]=(0,X.useState)(null),s=e=>e.system===`azure_devops`||e.system===`jira`,l=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&s(t)).map(e=>e.key),u=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&s(t)).map(e=>e.key),d=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(vn):e.from.includes(r))),f=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.tags.length}),` tag`,e.tags.length===1?``:`s`,` in use`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:f(e.casesTagged,e.cases)}),` of test cases tagged (`,e.casesTagged,` of `,e.cases,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:`text-ink tabular-nums`,children:f(e.testsTagged,e.tests)}),` of tests tagged (`,e.testsTagged,` of `,e.tests,`)`]}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`b`,{className:c(`tabular-nums`,e.tags.some(e=>e.outOfStep)?`text-warn`:`text-ink`),children:e.tags.filter(e=>e.outOfStep).length}),` out of step (a case's tag its test lacks)`]})]}),(0,Q.jsx)(W,{label:`Tags`,placeholder:`Find a tag`,height:Ie,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Q.jsx)(_t,{label:`Tags to show`,items:[{id:`all`,label:`All tags`,n:e.tags.length},{id:`tracker`,label:`From their systems`,n:e.tags.filter(e=>e.from.some(vn)).length},{id:`script`,label:`From tests`,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-[28%]`),children:`Tag`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Comes from`}),(0,Q.jsx)(`th`,{scope:`col`,className:Le,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:Le,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Out of step`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:d.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsxs)(b,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(fe,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=_n(e);return(0,Q.jsxs)(b,{tone:`neutral`,icon:!1,children:[(0,Q.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Q.jsx)(`td`,{className:ke,children:e.cases}),(0,Q.jsx)(`td`,{className:ke,children:e.tests}),(0,Q.jsx)(`td`,{className:c(G,`hidden @xl:table-cell`),"data-sort":e.outOfStep||0,children:e.outOfStep?(0,Q.jsx)(b,{tone:`warn`,children:e.outOfStep}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`–`})}),(0,Q.jsx)(`td`,{className:c(G,`hidden text-body-sm text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Q.jsxs)(`td`,{className:c(G,`text-right`),children:[l(e.name).length>0&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${l(e.name).length} cases`,"data-tip":`Write to the trackers of ${l(e.name).length} cases`,onClick:()=>o({kind:`tags`,keys:l(e.name)}),children:(0,Q.jsx)(Ce,{"aria-hidden":`true`})}),u(e.name).length>0&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${u(e.name).length} cases`,"data-tip":`Take off in the trackers of ${u(e.name).length} cases`,onClick:()=>o({kind:`untag`,keys:u(e.name),tags:[e.name]}),children:(0,Q.jsx)(I,{"aria-hidden":`true`})})]})]},e.name))}),(0,Q.jsx)(ct,{kind:a?.kind??null,keys:a?.keys??yn,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}function xn({uid:e,cases:t,onChanged:n}){let[i,a]=(0,X.useState)(null),[o,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),[m,g]=(0,X.useState)(``),_=(0,X.useCallback)(()=>Z.test(e).then(e=>{a(e),l(``)},e=>l(e.message)),[e]);(0,X.useEffect)(()=>{a(null),_()},[_]);let v=(0,Q.jsx)(S,{to:{href:r(`test-management`,`tests`),label:`Automated tests`}});if(o)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[v,(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:o})]});if(!i)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`});let y=i.test,x=y.framework&&y.framework!==`code`?At[y.framework]:`Not known yet`,C=e=>{g(``),p(e),n(e),_()},w=async(t,n)=>{try{await Z.link([{case:t,test:e,action:`unlink`}]),C(`Unlinked ${e} from ${n}. It is not linked again by itself.`)}catch(e){g(e.message)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[v,(0,Q.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-accent-fg`,children:y.uid}),` · `,x]}),(0,Q.jsx)(We,{icon:A,title:y.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[y.last&&(0,Q.jsx)(Sn,{status:y.last.status}),y.flaky&&(0,Q.jsx)(b,{tone:`warn`,children:`Flaky`}),y.quarantined&&(0,Q.jsx)(b,{tone:`neutral`,children:`Quarantined`})]})]}),(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsxs)(T,{onClick:()=>d(!0),disabled:!t.length,"data-tip":`Link to a test case`,children:[(0,Q.jsx)(ye,{"aria-hidden":`true`}),`Link`]})})]}),f&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:f}),m&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:m}),(0,Q.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(Y,{level:3,icon:A,title:`Code`,className:c(s,`text-body-sm`),children:[y.file&&(0,Q.jsxs)(`span`,{className:`font-mono text-muted [overflow-wrap:anywhere]`,children:[y.file,y.line?`:${y.line}`:``]}),i.source?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`Code of ${y.name}`,className:c(ze,`m-0 max-h-[560px] whitespace-pre focus-visible:outline-offset-[-2px]`),children:i.source.lines.map((e,t)=>{let n=i.source.from+t;return(0,Q.jsxs)(`span`,{className:c(`flex`,n===y.line&&`bg-accent-soft`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-12 flex-none pr-4 text-right text-muted tabular-nums select-none`,children:n}),(0,Q.jsx)(`span`,{className:`pr-4 whitespace-pre`,children:e})]},n)})}),i.source.more&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`Lines `,i.source.from,`–`,i.source.from+i.source.lines.length-1,` of `,i.source.total,`.`]})]}):(0,Q.jsx)(`p`,{className:`m-0 text-muted`,children:y.file?`Its file could not be read from the repository.`:`Known from runs only: no file is known for it.`})]}),(0,Q.jsx)(W,{label:`Linked test cases`,search:!1,empty:`Linked to no test case yet. Link it to the case it checks.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:i.cases.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsxs)(`a`,{href:Ct(e.key),className:`flex flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-accent-fg`,children:e.id})]})}),(0,Q.jsx)(`td`,{className:c(G,`hidden @2xl:table-cell`),children:(0,Q.jsx)(pt,{a:e.automation})}),(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(mt,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:c(G,`text-right`),children:e.how!==`mapping`&&(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,onClick:()=>void w(e.key,e.id),"aria-label":`Unlink ${e.id}`,"data-tip":`Unlink`,children:(0,Q.jsx)(P,{"aria-hidden":`true`})})})]},e.key))})]}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,Q.jsx)(Y,{level:3,icon:ve,title:`Details`,className:c(s,`text-body-sm`),children:(0,Q.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Framework`}),(0,Q.jsxs)(`dd`,{className:`m-0`,children:[x,y.framework===`gherkin`?`, ${y.runner??`no runner found`}`:``]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Found`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:Xe[y.via??`runs`]}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Its own id`}),(0,Q.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:y.nativeId??`–`}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Q.jsx)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:y.last?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Sn,{status:y.last.status}),(0,Q.jsx)(`span`,{className:`text-muted`,children:q(y.last.at)})]}):(0,Q.jsx)(mt,{o:`not_run`})}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last runs`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:(0,Q.jsx)(ht,{runs:y.runs})}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:y.tags.length?(0,Q.jsx)(gt,{tags:y.tags,max:10}):`–`})]})})})]}),(0,Q.jsx)(Pt,{open:u,title:`Link to a test case`,description:`Pick the test case ${y.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:t.filter(e=>!y.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>d(!1),onPick:async n=>{await Z.link([{case:n,test:e,action:`link`}]),d(!1),C(`Linked ${e} to ${t.find(e=>e.key===n)?.id??n}.`)}})]})}function Sn({status:e}){return e===`skipped`?(0,Q.jsx)(b,{tone:`neutral`,children:`Skipped`}):(0,Q.jsx)(mt,{o:e})}var Cn=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],wn=e=>Cn.some(t=>t.id===e),Tn=e=>e&&Be(e)===`web`?e:void 0,En=(e,t)=>`${e} ${t}${e===1?``:`s`}`,Dn=e=>`${e.kind}:${e.id}`;function On(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${En((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function kn(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function An(){let[e,t]=(0,X.useState)(Cn.map(e=>e.id)),[n,r]=(0,X.useState)(``);return(0,X.useEffect)(()=>{f.settings().then(e=>{let n=e.config.sources??{},r=Cn.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:Cn.filter(t=>e.includes(t.id)),error:n}}function jn({view:e,onApplied:t,onError:n}){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[u,f]=(0,X.useState)(null),p=e.story.id,m=e.proposals.filter(e=>r.includes(Dn(e))),g=async()=>{let t=m.map(e=>kn(e,p));l(!0);try{let r=await d.preview(e.system,p,t);o({lines:r.lines,changes:t}),n(``)}catch(e){n(e.message)}finally{l(!1)}},_=async()=>{if(a){l(!0);try{let r=await d.apply(e.system,p,a.changes);f({applied:r.applied,failed:r.failed}),o(null),i([]),n(``),t()}catch(e){n(e.message)}finally{l(!1)}}},v=Tn(e.story.url);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-headline-sm [overflow-wrap:anywhere]`,children:[v?(0,Q.jsxs)(`a`,{href:v,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[p,(0,Q.jsx)(ge,{size:14,"aria-hidden":`true`})]}):(0,Q.jsx)(`span`,{children:p}),e.story.title&&(0,Q.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,q(e.changed.when),`.`]})]}),(0,Q.jsx)(Y,{id:`cases`,icon:te,title:`Linked cases`,children:(0,Q.jsx)(W,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`text-right`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`State`})]}),children:e.cases.map(e=>{let t=Tn(e.url);return(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(G,`whitespace-nowrap`),children:t?(0,Q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,Q.jsx)(ge,{size:12,"aria-hidden":`true`})]}):e.id}),(0,Q.jsx)(`td`,{className:c(G,`[overflow-wrap:anywhere]`),children:e.title}),(0,Q.jsx)(`td`,{className:c(G,`text-right tabular-nums`),children:e.steps}),(0,Q.jsx)(`td`,{className:c(G,e.stale?`text-warn`:`text-muted`),"data-sort":e.changed&&Date.parse(e.changed)||0,children:e.stale?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(F,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,Q.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,q(e.changed)]}):`–`})]},e.id)})})}),(0,Q.jsx)(Y,{id:`criteria`,icon:L,title:`Acceptance criteria`,children:(0,Q.jsx)(W,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(G,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:c(G,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,Q.jsxs)(Y,{id:`proposals`,icon:z,title:`Proposed changes`,children:[(0,Q.jsx)(W,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,selection:{count:m.length,onClear:()=>i([]),actions:(0,Q.jsxs)(T,{size:`sm`,variant:`primary`,disabled:s||!m.length||!!a,"data-tip":`Review ${En(m.length,`change`)}`,onClick:()=>void g(),children:[(0,Q.jsx)(be,{"aria-hidden":`true`}),`Review`]})},head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Change`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Existing case`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=Dn(e);return(0,Q.jsxs)(`tr`,{className:H,"data-state":r.includes(t)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:G,children:(0,Q.jsx)(J,{"aria-label":`${On(e)}: ${e.id} ${e.title}`,checked:r.includes(t),disabled:s||!!a,onCheckedChange:e=>i(e?[...r,t]:r.filter(e=>e!==t))})}),(0,Q.jsxs)(`td`,{className:c(G,`whitespace-nowrap font-medium`),children:[On(e),e.link&&e.kind!==`link`&&(0,Q.jsx)(`span`,{className:`block text-body-sm font-normal text-muted`,children:`and link it`})]}),(0,Q.jsxs)(`td`,{className:c(G,`[overflow-wrap:anywhere]`),children:[(0,Q.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:e.id}),` `,e.title]}),(0,Q.jsx)(`td`,{className:c(G,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),a&&(0,Q.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:c(h.info,`flex flex-col gap-2`),children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,En(a.changes.length,`change`),` to `,Cn.find(t=>t.id===e.system)?.label,`?`]}),(0,Q.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:a.lines.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(T,{size:`sm`,variant:`primary`,disabled:s,onClick:()=>void _(),children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),`Apply`]}),(0,Q.jsxs)(T,{size:`sm`,disabled:s,onClick:()=>o(null),children:[(0,Q.jsx)(P,{"aria-hidden":`true`}),`Cancel`]})]})]}),u&&u.applied.length>0&&(0,Q.jsxs)(`p`,{role:`status`,className:`m-0 text-body-sm text-pass`,children:[`Applied: `,u.applied.join(`, `)]}),u&&u.failed.length>0&&(0,Q.jsxs)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:[`Not applied: `,u.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,Q.jsx)(Y,{id:`changes`,icon:ne,title:`Recent changes`,children:e.changes.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm text-ink-2`,children:e.changes.map((e,t)=>(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function Mn({sub:e}){let{systems:t,error:a}=An(),o=e?e.indexOf(`/`):-1,s=o>0?e.slice(0,o):e,l=wn(s)?s:void 0,u=l&&o>0?n(e.slice(o+1)):``,[f,p]=(0,X.useState)(l??`azure_devops`),[m,g]=(0,X.useState)(u),[v,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(!1);(0,X.useEffect)(()=>{l&&p(l),g(u)},[l,u]),(0,X.useEffect)(()=>{!l&&t.length&&!t.some(e=>e.id===f)&&p(t[0].id)},[t,f,l]);let E=(0,X.useCallback)(()=>{!l||!u?b(null):(w(!0),d.view(l,u).then(e=>{b(e),S(``),w(!1)},e=>{S(e.message),w(!1)}))},[l,u]);return(0,X.useEffect)(()=>b(null),[l,u]),(0,X.useEffect)(E,[E]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,Q.jsx)(`a`,{href:r(`regression`),children:`Regression`}),`; their results on `,(0,Q.jsx)(`a`,{href:r(`runs`),children:`Runs`}),`.`]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=m.trim();if(!t)return;let n=r(`test-management`,`stories`,f,encodeURIComponent(t));location.hash===n?E():location.hash=n},className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:t,value:f,onChange:p})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-body-sm font-medium`,children:[`Story`,(0,Q.jsx)(i,{value:m,maxLength:120,spellCheck:!1,placeholder:f===`azure_devops`?`1234`:f===`qtest`?`5678`:f===`testrail`?`R12`:`SHOP-12`,onChange:e=>g(e.target.value)})]}),(0,Q.jsxs)(T,{type:`submit`,variant:`primary`,disabled:!m.trim()||C,"data-tip":`Open the story's test cases`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Open`]})]})]}),[a,x].filter(Boolean).map(e=>(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:e},e)),C&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),v&&(0,Q.jsx)(jn,{view:v,onApplied:E,onError:S},`${v.system}:${v.story.id}`),!u&&!v&&(0,Q.jsx)(_,{icon:L,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})}var Nn={view:()=>p(`GET`,`/api/testdebt`),refresh:()=>p(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>p(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},Pn=[`untested`,`signal`,`duplicates`,`cases`],Fn={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},In={test:`Test`,recording:`Recording`,case:`Test case`},Ln={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},Rn={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},zn=e=>`${Math.round(e*100)}%`,Bn=e=>Pn.includes(e)?e:`untested`;function Vn({part:e,what:t,action:n}){return(0,Q.jsxs)(_,{icon:F,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function $({text:e,tip:t}){return(0,Q.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function Hn({sub:e}){let[t,n]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``),p=Bn(e),[v,b]=(0,X.useState)(`all`),[x,S]=(0,X.useState)(`manual`),[C,w]=(0,X.useState)(``),[E,ee]=(0,X.useState)(``);(0,X.useEffect)(()=>{Nn.view().then(e=>{n(e),s(``)},e=>s(e.message))},[]);let te=(0,X.useCallback)(async(e,t)=>{u(!0),f(``);try{n(await e()),s(``),t&&f(t)}catch(e){s(e.message)}finally{u(!1)}},[]),ne=async e=>{if(e){u(!0);try{let{id:t}=await m.start(e,{});location.hash=r(`chats`,t)}catch(e){s(e.message),u(!1)}}},D=(e,t)=>(0,Q.jsx)(T,{size:`icon`,variant:`icon`,className:`size-8`,disabled:l||!e,onClick:()=>void ne(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,Q.jsx)(pe,{"aria-hidden":`true`})}),O=t?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],k=C||O[0]?.id||``,A=t?.cases.filter(e=>!e.automated).length??0,re=t?.areas.filter(e=>v===`all`||e.kind===v)??[],ie=t?.cases.filter(e=>x===`all`||(x===`manual`?!e.automated:e.automated))??[],N={untested:(t?.areas.length??0)+(t?.rules.length??0),signal:(t?.quiet.length??0)+(t?.gone.length??0),duplicates:t?.duplicates.length??0,cases:A};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-4`,children:t&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-body-sm text-muted`,children:[(0,Q.jsxs)(`span`,{"data-tip":Ke(t.at),children:[`Worked out `,q(t.at)]}),(0,Q.jsxs)(T,{size:`sm`,disabled:l,onClick:()=>void te(Nn.refresh,`Worked out again.`),children:[(0,Q.jsx)(Ee,{"aria-hidden":`true`}),`Refresh`]})]})}),(0,Q.jsx)(He,{more:(0,Q.jsxs)(Q.Fragment,{children:[`Code and business rules no test reaches in the `,(0,Q.jsx)(`a`,{href:r(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,t?.repo&&t.repo!==`.`?(0,Q.jsx)(`code`,{className:`font-mono text-body-sm`,children:t.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),children:`What no test checks yet, and tests that tell you little.`}),o&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:o}),!t&&!o&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),d&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:d}),t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ue,{label:`Test debt`,children:[(0,Q.jsx)(Ve,{tip:t.graph.state===`ok`?`Of ${t.graph.checked} areas`:`The product graph is not built`,dot:t.graph.state===`ok`?t.areas.length?`warn`:`pass`:`neutral`,value:t.graph.state===`ok`?t.areas.length:`–`,label:`untested code areas`}),(0,Q.jsx)(Ve,{tip:`Of ${t.graph.rulesChecked} rules`,dot:t.rules.length?`warn`:`pass`,value:t.rules.length,label:`untested rules`}),(0,Q.jsx)(Ve,{tip:`30 passes in a row`,dot:`neutral`,value:t.quiet.length,label:`never fail`}),(0,Q.jsx)(Ve,{tip:`Of ${t.files.count} files listed`,dot:t.gone.length?`fail`:`pass`,value:t.gone.length,label:`with their code gone`}),(0,Q.jsx)(Ve,{tip:`From ${zn(t.threshold)} alike`,dot:`neutral`,value:t.duplicates.length,label:`near-duplicates`}),(0,Q.jsx)(Ve,{dot:A?`warn`:`pass`,value:A,label:`of ${t.cases.length} test cases not automated`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`untested`,label:`Untested code and rules`,n:N.untested},{id:`signal`,label:`Low-signal tests`,n:N.signal},{id:`duplicates`,label:`Near-duplicates`,n:N.duplicates},{id:`cases`,label:`Test cases`,n:N.cases}],value:p,onChange:e=>location.hash=r(`test-management`,`debt`,e)})}),t.notes.map(e=>(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e},e)),p===`untested`&&(0,Q.jsxs)(Q.Fragment,{children:[t.graph.state===`ok`?(0,Q.jsx)(W,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:v,empty:t.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`all`,label:`All`,n:t.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${Fn[e]}s`,n:t.areas.filter(t=>t.kind===e).length}))],value:v,onChange:b})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:re.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(M,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:Fn[e.kind]}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:D(e.draft,Fn[e.kind].toLowerCase())})]},e.id))}):(0,Q.jsx)(Vn,{part:t.graph,what:`product graph`,action:{label:`Product`,to:r(`product`)}}),(0,Q.jsx)(W,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:t.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.rules.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(M,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,Q.jsx)($,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 font-mono text-body-sm text-ink-2 @xl:table-cell`),children:(0,Q.jsx)($,{text:e.where})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.nearest?(0,Q.jsx)($,{text:`${e.nearest.name} (${zn(e.nearest.score)})`,tip:`${zn(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:D(e.draft,`rule`)})]},e.id))})]}),p===`signal`&&(t.history.state===`ok`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.quiet.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(j,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,Q.jsx)($,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`text-muted`),children:e.runs}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?Ke(e.since):void 0,"data-sort":e.since&&new Date(e.since).getTime()||0,children:e.since?q(e.since):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:D(e.draft,`test`)})]},e.key))}),(0,Q.jsx)(W,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${t.files.count} files, listed by ${t.files.by===`git`?`git`:`walking the folder`}).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.gone.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Te,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,Q.jsx)($,{text:e.name})]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0 font-mono text-body-sm text-ink-2`),children:(0,Q.jsx)($,{text:e.file})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?Ke(e.last):void 0,"data-sort":e.last&&new Date(e.last).getTime()||0,children:e.last?q(e.last):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:D(e.draft,`test`)})]},e.key))})]}):(0,Q.jsx)(Vn,{part:t.history,what:`test history`,action:{label:`Regression`,to:r(`regression`)}})),p===`duplicates`&&(0,Q.jsx)(W,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,height:`max(320px, calc(var(--screen) - 288px))`,empty:`No two tests, recordings or test cases share ${zn(t.threshold)} of their words (${t.compared} pairs compared).`,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.duplicates.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.score>=.85?`text-warn`:`text-muted`),"data-sort":e.score,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(se,{size:14,"aria-hidden":`true`}),zn(e.score)]})}),[e.a,e.b].map((e,t)=>(0,Q.jsxs)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:[(0,Q.jsx)($,{text:e.name,tip:`${In[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,Q.jsx)(`span`,{className:`block text-body-sm text-muted`,children:In[e.kind]})]},t)),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:(0,Q.jsx)($,{text:e.shared.join(`, `)})}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:D(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),p===`cases`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Test management`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.sources.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,Q.jsx)(j,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,Q.jsx)(M,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${q(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),O.length>0&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),k&&te(()=>Nn.readCases(k,E.trim()),`Test cases read.`)},children:[(0,Q.jsx)(a,{size:`sm`,"aria-label":`Source`,value:k,onChange:e=>w(e.target.value),children:O.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Q.jsx)(i,{size:`sm`,"aria-label":`Scope`,placeholder:k&&k!==`jira`?Rn[k]:``,value:E,maxLength:80,onChange:e=>ee(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,Q.jsxs)(T,{size:`sm`,type:`submit`,disabled:l||!E.trim(),"data-tip":`Read the test cases`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),`Import`]})]}),t.cases.length?(0,Q.jsx)(W,{label:`Test cases`,placeholder:`Find a test case by id or title`,height:`max(320px, calc(var(--screen) - 288px))`,resetKey:x,empty:`Nothing matches.`,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`manual`,label:`Not automated`,n:A,alert:!0},{id:`automated`,label:`Automated`,n:t.cases.length-A},{id:`all`,label:`All`,n:t.cases.length}],value:x,onChange:S})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ie.map(e=>(0,Q.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`font-mono text-body-sm whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`max-w-0`),children:(0,Q.jsx)($,{text:e.title||`–`})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden text-body-sm whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:Ln[e.source]}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`text-body-sm whitespace-nowrap`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,Q.jsx)(j,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,Q.jsx)(M,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,Q.jsx)(`td`,{className:c(`px-4 py-2`,`hidden max-w-0 text-body-sm text-ink-2 @2xl:table-cell`),children:e.test?(0,Q.jsx)($,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&D(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,Q.jsx)(_,{icon:L,title:`No test cases yet`,action:(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:r(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Q.jsx)(B,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})}var Un=[`dashboard`,`cases`,`tests`,`gaps`,`debt`,`stories`,`suites`,`tags`],Wn={dashboard:[`dashboard`],inventory:[`cases`,`tests`,`stories`],coverage:[`gaps`,`debt`],organise:[`suites`,`tags`]},Gn=e=>Object.keys(Wn).find(t=>Wn[t].includes(e))??`dashboard`;function Kn({sub:e}){let t=(e??``).split(`/`).filter(Boolean),i=Un.includes(t[0])?t[0]:`dashboard`;Ge(`test-management`,i,Un,!t[0],e=>location.replace(r(`test-management`,e)));let a=i===`cases`&&t[1]?n(t[1]):void 0,o=i===`tests`&&t[1]?n(t[1]):void 0,s=i===`suites`&&t[1]?n(t[1]):void 0,[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[m,g]=(0,X.useState)(null),[_,v]=(0,X.useState)([]),[y,x]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[E,ee]=(0,X.useState)(null),[ne,D]=(0,X.useState)(``),[O,k]=(0,X.useState)(``),[A,re]=(0,X.useState)(!1),[ie,j]=(0,X.useState)([]),[P,F]=(0,X.useState)(null),[se,ce]=(0,X.useState)(null),I=(0,X.useCallback)(async()=>{try{let[e,t]=await Promise.all([Z.view(),Z.cases()]);d(e),p(t),w(e.suites),ee(e.job),D(``)}catch(e){D(e.message)}},[]);(0,X.useEffect)(()=>{I()},[I]),(0,X.useEffect)(()=>{i===`gaps`&&Z.gaps().then(g,e=>D(e.message)),i===`tags`&&Z.tags().then(x,e=>D(e.message)),i===`suites`&&Z.suites().then(e=>w(e.suites),e=>D(e.message))},[i,l]),(0,X.useEffect)(()=>{if(!E?.running)return;let e=Ae(()=>{Z.job().then(e=>{ee(e.job),e.job?.running||I()},()=>{})},2e3);return()=>Oe(e)},[E?.running,I]);let ue=async()=>{re(!0),k(``);try{let e=await Z.sync(),t=e.plans.filter(e=>e.error),n=t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`;k(e.storiesError?`${n} The release's stories were not read again: ${e.storiesError}`:n),await I()}catch(e){D(e.message)}finally{re(!1)}},de=e=>F({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Z.run(e,t,n)}),L=(e,t)=>{let n=C?.find(t=>t.id===e)??l?.suites.find(t=>t.id===e);F({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Z.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},pe=()=>{k(`The run started: it shows here while it runs, and in Runs.`),Z.job().then(e=>ee(e.job),()=>{})},me=e=>{k(e),j([]),I()},z=new Map((f?.cases??[]).map(e=>[e.key,e])),B=ie.filter(e=>z.has(e)),ge=e=>e.map(e=>z.get(e).id),_e=B.filter(e=>[`failed`,`blocked`].includes(z.get(e).lastRun.outcome)),ve=B.filter(e=>z.get(e).automation!==`automated`),ye=[{intent:`automate`,label:ve.length?`Automate ${ve.length}`:`Automate`,icon:oe,keys:ve.slice(0,50),...ve.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:_e.length?`Why ${_e.length} fail`:`Why they fail`,icon:Te,keys:_e.slice(0,50),..._e.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:fe,keys:B.slice(0,50),...B.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:oe,keys:B.filter(e=>z.get(e).tests.length>0&&z.get(e).tags.length>0).slice(0,50),...B.filter(e=>z.get(e).tests.length>0&&z.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],be=(m?.ranked??[]).slice(0,20).map(e=>e.key),xe=[{intent:`automate`,label:B.length?`Automate ${B.length}`:`Automate the top ${be.length}`,icon:oe,keys:(B.length?B:be).slice(0,50),...B.length||be.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:Te,keys:(m?.lists.failing??[]).slice(0,50),...m?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:_.length?`Cases for ${_.length} stor${_.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:R,keys:[],stories:(_.length?_:(m?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),..._.length||m?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],Se=f?f.cases.filter(e=>e.automation===`not_automated`||e.automation===`pending`||e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`).length:(l?.summary.notAutomated??0)+(l?.summary.pending??0),Ce=s?C?.find(e=>e.id===s):void 0,we=se??(i===`suites`||(l?.summary.cases??0)>0),V=!!l&&!l.plans.length&&!l.summary.cases,De=Gn(i),ke={dashboard:{label:`Dashboard`},cases:{label:`Test cases`,n:l?.summary.cases},tests:{label:`Automated`,n:l?.summary.tests},stories:{label:`Stories`},gaps:{label:`Gaps`,n:Se},debt:{label:`Test debt`},suites:{label:`Suites`,n:l?.suites.length},tags:{label:`Tags`}},H=(0,Q.jsxs)(`main`,{className:c(Ne,`@container flex-auto gap-4`),children:[!a&&!o&&!s&&(0,Q.jsx)(S,{}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(Re,{pixel:u[`test-management`],size:`lg`}),(0,Q.jsx)(`h1`,{className:`m-0 text-headline-lg`,children:`Test management`}),l&&(0,Q.jsx)(`div`,{className:`order-last flex min-w-0 basis-full @[74rem]:order-none @[74rem]:basis-auto`,children:(0,Q.jsx)(Fe,{label:`Test management`,className:`mb-0 max-w-full`,current:De,hrefOf:e=>r(`test-management`,Wn[e][0]),tabs:[{id:`dashboard`,label:`Dashboard`,icon:ae},{id:`inventory`,label:`Cases`,n:l.summary.cases,icon:te},{id:`coverage`,label:`Coverage`,n:Se,icon:M},{id:`organise`,label:`Suites and tags`,icon:le}]})}),l&&(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[l.plans.length>0&&(0,Q.jsx)(T,{busy:A,size:`icon`,disabled:A,onClick:()=>void ue(),"aria-label":A?`Syncing`:`Sync`,"data-tip":A?`Syncing…`:`Sync: read every case of the connected plans again`,children:(0,Q.jsx)(Ee,{"aria-hidden":`true`})}),(l.plans.length>0||l.summary.tests>0)&&(0,Q.jsx)(fn,{disabled:A}),(i===`cases`||i===`gaps`||i===`suites`)&&!we&&(0,Q.jsx)(T,{size:`icon`,onClick:()=>ce(!0),"aria-label":i===`suites`?`Open the Suite agent`:`Open the agent`,"data-tip":i===`suites`?`Open the Suite agent`:`Open the agent`,children:(0,Q.jsx)(R,{"aria-hidden":`true`})})]})]}),l&&!a&&!o&&!s&&(0,Q.jsxs)(He,{children:[`Every case of your connected test plans: which are automated and by what, what ran, and what is left.`,` `,l.plans.length>0?(0,Q.jsxs)(`span`,{"data-tip":l.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${Ke(e.at)}`:``}`).join(` · `),children:[l.plans.length,` plan`,l.plans.length===1?``:`s`,l.plans[0]?.at?`, synced ${q(l.plans.map(e=>e.at??``).sort()[0])}.`:`, not synced yet.`]}):(!V||i!==`dashboard`&&i!==`cases`&&i!==`gaps`)&&(0,Q.jsx)(`a`,{href:r(`settings`,`integrations`),children:`Connect a test plan in Settings`})]}),l&&Wn[De].length>1&&!a&&!o&&!s&&(0,Q.jsx)(Me,{label:De===`inventory`?`Cases`:De===`coverage`?`Coverage`:`Suites and tags`,className:`mb-0`,current:i,onPick:e=>location.hash=r(`test-management`,e),tabs:Wn[De].map(e=>({id:e,...ke[e]}))}),ne&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:ne}),!l&&!ne&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}),O&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:O}),l&&l.refused.length>0&&(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`Not read, as their system does not write a plan that way: `,l.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),E&&(0,Q.jsxs)(`div`,{role:`status`,className:c(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-2 text-body-sm`),children:[(0,Q.jsx)(b,{tone:E.running?`running`:E.exitCode===0?`pass`:`fail`,children:E.running?`Running`:E.exitCode===0?`Finished`:`Stopped`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":E.command,children:E.lines.at(-1)??E.command}),E.running?(0,Q.jsxs)(T,{size:`sm`,variant:`danger`,onClick:()=>void Z.stop().then(e=>ee(e.job),e=>D(e.message)),children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),`Stop`]}):(0,Q.jsx)(`a`,{href:r(`runs`),className:`text-body-sm`,children:`Runs`})]}),l&&(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{id:`panel-${i}`,...Wn[De].length>1&&!a&&!o&&!s?{role:`tabpanel`,"aria-labelledby":`tab-${i}`}:{},className:`flex flex-col gap-4`,children:[i===`dashboard`&&(0,Q.jsx)(qt,{view:l,onRunSuite:L}),V&&(i===`cases`||i===`gaps`)&&!a&&(0,Q.jsx)(Tt,{tests:l.summary.tests}),i===`cases`&&(!V||a)&&(a?(0,Q.jsx)(It,{caseKey:a,onRun:de,onChanged:()=>void I()},a):f&&(0,Q.jsx)(Vt,{cases:f.cases,tests:f.tests.length,selected:B,onSelect:j,onRun:de,onChanged:me})),i===`tests`&&f&&(o?(0,Q.jsx)(xn,{uid:o,cases:f.cases,onChanged:()=>void I()},o):(0,Q.jsx)(Et,{cases:f.cases,onChanged:me})),i===`gaps`&&(m&&f?(0,Q.jsx)(rn,{gaps:m,cases:f.cases,tests:f.tests,selected:B,onSelect:j,onRun:de,pickedStories:_,onPickStories:v,onStoriesRead:()=>(v([]),void I())}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`})),i===`debt`&&(0,Q.jsx)(Hn,{sub:t[1]}),i===`stories`&&(0,Q.jsx)(Mn,{sub:t.slice(1).join(`/`)||void 0}),i===`suites`&&(s?(0,Q.jsx)(cn,{id:s,onRun:L,onDeleted:()=>(location.hash=r(`test-management`,`suites`),void I())},s):C&&(0,Q.jsx)(sn,{suites:C,onRun:L})),i===`tags`&&(y?(0,Q.jsx)(bn,{tags:y,cases:f?.cases,onChanged:me}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading…`}))]})}),(0,Q.jsx)(xt,{open:!!P,onClose:()=>F(null),title:P?.title??`Run`,preview:(e,t)=>P.go(e,t),onStarted:pe})]}),U=a?z.get(a):void 0;return(0,Q.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Q.jsx)(Pe,{}),(0,Q.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:H}),l&&we&&i===`cases`&&(0,Q.jsx)($e,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:U?`Looking at ${U.id}.`:B.length?`Looking at the ${B.length} cases you picked.`:`Looking at ${l.summary.cases} test cases. Pick some in the list.`,context:U?[U.id,...U.plans.slice(0,1)]:B.length?ge(B).slice(0,4):[],suggestions:U?[{intent:U.automation===`automated`?`run`:`automate`,label:U.automation===`automated`?`Run it and explain`:`Automate it`,icon:U.automation===`automated`?N:oe,keys:[U.key]},{intent:`investigate`,label:`Why it fails`,icon:Te,keys:[U.key],...[`failed`,`blocked`].includes(U.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:fe,keys:[U.key]}]:ye,keys:U?[U.key]:B,placeholder:`Ask about these cases, or say what to do`,onClose:()=>ce(!1)},a??`list`),l&&we&&i===`gaps`&&(0,Q.jsx)($e,{title:`Gap agent`,about:`Finds what to close first and closes it with you.`,looking:`Looking at ${l.summary.notAutomated} cases not automated, ${l.summary.pending} pending and ${l.summary.failing} failing.`,context:B.length?ge(B).slice(0,4):[],suggestions:xe,keys:B.length?B:be,placeholder:`What should we close first?`,onClose:()=>ce(!1)}),l&&we&&i===`suites`&&(0,Q.jsx)(ln,{open:Ce,onSaved:e=>{k(`Saved the suite ${e.name}.`),I(),location.hash=r(`test-management`,`suites`,e.id)}},s??`list`)]})]})}export{Wn as GROUPS,Kn as TestManagement,Gn as groupOf};