@capagents/forgeqe 3.3.5 → 3.3.7

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 (111) hide show
  1. package/HOW_TO_USE.md +65 -7
  2. package/dist/docs-site/docs/area-mobile/index.html +33 -7
  3. package/dist/docs-site/docs/area-operations/index.html +50 -7
  4. package/dist/docs-site/docs/area-quality/index.html +15 -2
  5. package/dist/docs-site/docs/area-test-cases/index.html +41 -27
  6. package/dist/docs-site/docs/mobile/index.html +33 -7
  7. package/dist/docs-site/docs/overview/index.html +1 -1
  8. package/dist/docs-site/docs/search.js +1 -1
  9. package/dist/forgeqe.js +3957 -3772
  10. package/dist/web/assets/{3d-force-graph-KUdc_88B.js → 3d-force-graph-Bsispdm1.js} +1 -1
  11. package/dist/web/assets/Agent-39FbaH7G.js +10 -0
  12. package/dist/web/assets/{AgentWork-DmCMV4YL.js → AgentWork-BugEUl60.js} +1 -1
  13. package/dist/web/assets/ApiTests-B9rtwCbe.js +17 -0
  14. package/dist/web/assets/{Browse-BjPPdirz.js → Browse-Dl2Lneca.js} +1 -1
  15. package/dist/web/assets/Chat-DocT7FlH.js +3 -0
  16. package/dist/web/assets/{CommandPalette-BBGtkkz4.js → CommandPalette-B7YPDCOk.js} +1 -1
  17. package/dist/web/assets/{Compare-CVvpgS-7.js → Compare-D6XsFmmb.js} +1 -1
  18. package/dist/web/assets/Cost-DvbuXS6u.js +1 -0
  19. package/dist/web/assets/Data-BmZHJkfj.js +6 -0
  20. package/dist/web/assets/Desktop-DD3F69ih.js +1 -0
  21. package/dist/web/assets/{DesktopReview-Bcs7E_SB.js → DesktopReview-BR0LtVFw.js} +2 -2
  22. package/dist/web/assets/Evidence-OqAiYzrl.js +1 -0
  23. package/dist/web/assets/Explore-QNyusEFo.js +2 -0
  24. package/dist/web/assets/{Features-D-HIDQqF.js → Features-N3_77mz-.js} +1 -1
  25. package/dist/web/assets/Flags-Yv4Ttmmh.js +2 -0
  26. package/dist/web/assets/Flaky-Bg2f2K1U.js +1 -0
  27. package/dist/web/assets/Impact-CpxvVnKj.js +3 -0
  28. package/dist/web/assets/Jobs-_gZTxoaG.js +5 -0
  29. package/dist/web/assets/KindPage-Amr6R7Ym.js +6 -0
  30. package/dist/web/assets/{LiveDevice-jFCQ_zeU.js → LiveDevice-j7NZXIJZ.js} +1 -1
  31. package/dist/web/assets/Migration-DfPYzTfk.js +8 -0
  32. package/dist/web/assets/Mobile-fIhhQPsp.js +1 -0
  33. package/dist/web/assets/Observability-13DkrRp2.js +1 -0
  34. package/dist/web/assets/{OwnItems-CedxNuRy.js → OwnItems-BdiPfdTw.js} +3 -3
  35. package/dist/web/assets/PageAgent-CC8Ha6vu.js +1 -0
  36. package/dist/web/assets/Product-CnXkqwQm.js +6 -0
  37. package/dist/web/assets/Production-5mTIt4sr.js +1 -0
  38. package/dist/web/assets/Quality-DbLcbP1X.js +1 -0
  39. package/dist/web/assets/Readiness-BG1xmC09.js +1 -0
  40. package/dist/web/assets/Record-sFth-2I1.js +1 -0
  41. package/dist/web/assets/Regression-Dd4y8I1z.js +5 -0
  42. package/dist/web/assets/{RelationGraph-CBY9FhUu.js → RelationGraph-Blfs7PhK.js} +1 -1
  43. package/dist/web/assets/Reports-HQkTX4Kr.js +2 -0
  44. package/dist/web/assets/Requirements-DmhUNCIP.js +2 -0
  45. package/dist/web/assets/Responsive-D18eYdCh.js +3 -0
  46. package/dist/web/assets/RunDiff-75a-smeg.js +1 -0
  47. package/dist/web/assets/{Settings-VqVLvH-Z.js → Settings-BaodIliH.js} +15 -15
  48. package/dist/web/assets/{Steps-6x6JVBmk.js → Steps-ZPH_rTJh.js} +1 -1
  49. package/dist/web/assets/TestData-DUlTo5qt.js +2 -0
  50. package/dist/web/assets/TestManagement-DUMGdHDw.js +4 -0
  51. package/dist/web/assets/{WhatsNew-BwV-yle3.js → WhatsNew-BrVNacPl.js} +1 -1
  52. package/dist/web/assets/{agentSettingsSheet-CUOx_y4s.js → agentSettingsSheet-UCqUtdjq.js} +1 -1
  53. package/dist/web/assets/{api-BsiuHmJq.js → api-D8-lxyQi.js} +1 -1
  54. package/dist/web/assets/{dataParts-_X5zGtE9.js → dataParts-C0C67bVQ.js} +3 -3
  55. package/dist/web/assets/{desktopAppPath-D3mGDKPz.js → desktopAppPath-B89LKvjx.js} +1 -1
  56. package/dist/web/assets/{flowTheme-DKuXe5nP.js → flowTheme-BNKwRxun.js} +1 -1
  57. package/dist/web/assets/frame-C8sL1yo-.js +13 -0
  58. package/dist/web/assets/index-BFG13fbg.js +55 -0
  59. package/dist/web/assets/index-DBnWgocz.css +2 -0
  60. package/dist/web/assets/{markdown-CwgDQU8m.js → markdown-CxsWgpYs.js} +1 -1
  61. package/dist/web/assets/{nav-B_68FVw_.js → nav-DYgvAJu-.js} +1 -1
  62. package/dist/web/assets/{pageBack-CbyKfisx.js → pageBack-BefA2rh7.js} +1 -1
  63. package/dist/web/assets/{palette-6YAAmgkD.js → palette-BgJTq_Ot.js} +1 -1
  64. package/dist/web/assets/parts-BNpm4gXC.js +1 -0
  65. package/dist/web/assets/{productParts-CUvTBJkC.js → productParts-ZEi0sPIk.js} +1 -1
  66. package/dist/web/assets/{qualityParts-BFDaQh7A.js → qualityParts-DtsD70Qh.js} +1 -1
  67. package/dist/web/assets/{recordTest-7uIZiqOW.js → recordTest-Bz5ryzpS.js} +1 -1
  68. package/dist/web/assets/{stepper-C6U4inhc.js → stepper-CONWT_tv.js} +1 -1
  69. package/dist/web/assets/{wizardParts-fa6KdWVg.js → wizardParts-CulZqqjz.js} +1 -1
  70. package/dist/web/index.html +8 -8
  71. package/docs/ForgeQE-Static-Analysis-Report-30112026.pdf +0 -0
  72. package/docs/ForgeQE-Static-Analysis-Report-5bbf0da7.html +207 -0
  73. package/docs/MOBILE.md +35 -7
  74. package/docs/user-guide.html +139 -43
  75. package/env.example.yaml +2 -0
  76. package/package.json +1 -1
  77. package/py/forgeqe_engine/persona.py +2 -1
  78. package/py/forgeqe_mobile/service.py +9 -1
  79. package/dist/web/assets/Agent-d4YX63iA.js +0 -10
  80. package/dist/web/assets/ApiTests-C_L2iJ8s.js +0 -17
  81. package/dist/web/assets/Chat-DNiUvy2O.js +0 -3
  82. package/dist/web/assets/Cost-DJnZYyQP.js +0 -1
  83. package/dist/web/assets/Data-DEWYrB9n.js +0 -6
  84. package/dist/web/assets/Desktop-Bm6ObXhU.js +0 -1
  85. package/dist/web/assets/Evidence-D5fORfDF.js +0 -1
  86. package/dist/web/assets/Explore-Dhwu33Xf.js +0 -2
  87. package/dist/web/assets/Flags-DEitGv3r.js +0 -2
  88. package/dist/web/assets/Flaky-F5NHbFgI.js +0 -1
  89. package/dist/web/assets/Impact-eg2nHsiv.js +0 -3
  90. package/dist/web/assets/Jobs-GBUaaYcw.js +0 -5
  91. package/dist/web/assets/KindPage-CaXbIzyO.js +0 -6
  92. package/dist/web/assets/Migration-ZhSPJ6QL.js +0 -8
  93. package/dist/web/assets/Mobile-ClrjICJt.js +0 -1
  94. package/dist/web/assets/Observability-CQ7WAuBH.js +0 -1
  95. package/dist/web/assets/PageAgent-CDYs-i-n.js +0 -1
  96. package/dist/web/assets/Product-DyhX2TYr.js +0 -6
  97. package/dist/web/assets/Production-DSDdBODO.js +0 -1
  98. package/dist/web/assets/Quality-CdrPT4WV.js +0 -1
  99. package/dist/web/assets/Readiness-C9qM2rKO.js +0 -1
  100. package/dist/web/assets/Record-C790-f2w.js +0 -1
  101. package/dist/web/assets/Regression-PDhRTDKs.js +0 -5
  102. package/dist/web/assets/Reports-BBRMV5V8.js +0 -2
  103. package/dist/web/assets/Requirements-DRz1Yudy.js +0 -2
  104. package/dist/web/assets/Responsive-DZXESkT1.js +0 -3
  105. package/dist/web/assets/RunDiff-CsND-A6h.js +0 -1
  106. package/dist/web/assets/TestData-hIJO8oL4.js +0 -2
  107. package/dist/web/assets/TestManagement-SBq56JNZ.js +0 -4
  108. package/dist/web/assets/frame-CgBYYtdw.js +0 -13
  109. package/dist/web/assets/index-D10waU4_.js +0 -55
  110. package/dist/web/assets/index-DVlmTifI.css +0 -2
  111. package/dist/web/assets/parts-ClnDV-6r.js +0 -1
@@ -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-6YAAmgkD.js";import{ct as d,f,v as p,y as m}from"./api-BsiuHmJq.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-CbyKfisx.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 V,yr as Ce,z as we,zn as Te}from"./line-icons-CwCZidXs.js";import{Ct as Ee,Gt as De,It as Oe,Kt as ke,St as H,at as U,bt as W,ft as Ae,gt as G,ht as K,n as je,ot as Me,qt as Ne,s as Pe,ut as Fe,vt as q,xt as Ie,yt as Le}from"./frame-CgBYYtdw.js";import{t as J}from"./when-BuWCTaKm.js";import{t as Re}from"./code-Jek8uWUO.js";import{a as ze}from"./markdown-CwgDQU8m.js";import{H as Be,U as Y,W as Ve,o as He}from"./index-D10waU4_.js";import{_ as Ue,o as We}from"./qualityParts-BFDaQh7A.js";import{t as Ge}from"./AgentWork-DmCMV4YL.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})},Ke={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},qe={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`},Je={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},Ye={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Q=l();function Xe({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)(Ve,{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 Ze({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)(Xe,{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)(Ge,{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 Qe={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},$e={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.`},et=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,tt=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,nt=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,rt=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function it({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)(we,{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 at(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 ot({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=at(a,r=>Z.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Q.jsx)(Ne,{open:!!e,onClose:r,title:e?Qe[e]:``,description:e?$e[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)(V,{"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)(it,{plan:l.plan,outcome:l.outcome})]})})}function st({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[o,s]=(0,X.useState)(``),l=t.tracker?void 0:n.find(e=>tt(e)===(o||(n[0]?tt(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?rt(t.tracker):``,l&&tt(l)]);let f=at(u,e=>Z.suiteTracker(t.id,l,e).then(e=>e.outcome),i),p=t.tracker;return(0,Q.jsx)(Ne,{open:e,onClose:r,title:p?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:p?`It is ${rt(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?tt(l):``,onChange:e=>s(e.target.value),children:n.map(e=>(0,Q.jsx)(`option`,{value:tt(e),children:et(e)},tt(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)(it,{plan:f.plan,outcome:f.outcome}),f.outcome&&!f.outcome.failed.length&&(0,Q.jsx)(b,{tone:`pass`,children:`Done`})]})})}var ct={automated:j,not_automated:M,pending:O,known_defect:F,needs_attention:F},lt={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function ut({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 dt({a:e}){let t=ct[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`)}),Ke[e]]})}function ft({o:e}){return(0,Q.jsx)(b,{tone:lt[e],icon:e!==`not_run`,children:Ye[e]})}function pt({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 mt({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 ht({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 gt({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 _t({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 vt({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)(ut,{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 yt({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)(Ne,{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 bt=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,xt=e=>r(`test-management`,`cases`,encodeURIComponent(e)),St=e=>r(`test-management`,`tests`,encodeURIComponent(e));function Ct({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)(_,{icon:oe,title:`${e} automated test${e===1?``:`s`} found, no test case yet`,action:t,children:[`The automation repository's code has them: see them on `,(0,Q.jsx)(`a`,{href:r(`test-management`,`tests`),children:`Automated`}),`. Add a test plan in Settings › Integrations (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not.`]}):(0,Q.jsx)(_,{icon:L,title:`No test plans connected yet`,action:t,children:`Add a test plan under Test plans in Test management, in your test case system's settings (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest). Its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already.`})}function wt({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=ke(()=>void p(),3e3);return()=>De(e)},[n?.busy]),kt(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=Dt(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 ${J(n.busy.started)}…`:`The mapping agent is at work, started ${J(n.busy.started)}…`:n.discovery?`Discovered ${J(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)(At,{projects:n.discovery.projects}),(0,Q.jsx)(K,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,height:G,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)(ht,{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(W,`w-[45%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Framework`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @3xl:table-cell`),children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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(q,`max-w-0`),children:(0,Q.jsxs)(Et,{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)(Tt,{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(q,`hidden text-body-sm @2xl:table-cell`),children:(0,Q.jsxs)(`span`,{"data-tip":Je[t.via??`runs`],children:[t.framework&&t.framework!==`code`?Ot[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:[`, `,Je[t.via??`runs`]]})]})}),(0,Q.jsx)(`td`,{className:c(q,`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:xt(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(q,`hidden @3xl:table-cell`),children:(0,Q.jsx)(mt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:c(q,`hidden @2xl:table-cell`),"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(pt,{runs:t.runs})}),(0,Q.jsx)(`td`,{className:c(q,`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)(jt,{open:l,onClose:()=>u(!1),onStarted:()=>{u(!1),t(`Discovering tests: each project's framework lists its tests.`),p()}}),(0,Q.jsx)(Mt,{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 Tt({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 Et({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:St(e),className:n,children:t}):(0,Q.jsx)(`span`,{className:n,children:t})}function Dt(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 Ot={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function kt(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function At({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 jt({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)(Ne,{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:[Ot[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 Mt({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)(Ne,{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)(we,{size:14,"aria-hidden":`true`}),o]}),(0,Q.jsx)(K,{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:W,children:`Name`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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(q,`max-w-0`),children:[(0,Q.jsx)(ut,{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(q,`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 Nt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Pt({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=Nt(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)(Ve,{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)(dt,{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?` ${J(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)(V,{"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)(V,{"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)(ot,{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)(K,{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(W,`w-10`),children:`#`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Action`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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(q,`text-body-sm text-muted tabular-nums`),children:t+1}),(0,Q.jsx)(`td`,{className:c(q,`text-body-sm [overflow-wrap:anywhere]`),children:e.action}),(0,Q.jsx)(`td`,{className:c(q,`text-body-sm text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Q.jsx)(Ft,{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)(ft,{o:v.lastRun.outcome}),v.lastRun.at&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[J(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)(mt,{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:J(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})})]})]})]})}function Ft({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:[qe[e.how],e.why&&e.why!==qe[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`?`–`:qe[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)(pt,{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)(Mt,{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 It=[{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:we,test:bt,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}],Lt=``,Rt=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function zt({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)(Lt),[f,p]=(0,X.useState)(Lt),[m,h]=(0,X.useState)(Lt),[g,_]=(0,X.useState)(Lt),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=(0,X.useMemo)(()=>Rt(e.flatMap(e=>e.plans)),[e]),E=(0,X.useMemo)(()=>Rt(e.map(e=>e.suite)),[e]),ee=(0,X.useMemo)(()=>Rt(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=It.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)(K,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,height:G,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)(V,{"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)(V,{"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)(ht,{label:`Show`,items:It.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:Lt,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:Lt,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:Lt,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:Lt,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(W,`w-10`),children:(0,Q.jsx)(Be,{"aria-label":`Select every case shown`,checked:A,onCheckedChange:e=>r(e?Rt([...n,...D.map(e=>e.key)]):n.filter(e=>!D.some(t=>t.key===e)))})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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:q,children:(0,Q.jsx)(Be,{"aria-label":`Select ${e.id}`,checked:O.has(e.key),onCheckedChange:t=>k(e.key,t)})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(`a`,{href:xt(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)(mt,{tags:e.tags,max:2})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 @xl:hidden`,children:[(0,Q.jsx)(dt,{a:e.automation}),(0,Q.jsx)(ft,{o:e.lastRun.outcome})]})]})}),(0,Q.jsx)(`td`,{className:c(q,`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(q,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsxs)(`td`,{className:c(q,`hidden @xl:table-cell`),children:[(0,Q.jsx)(dt,{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(q,`hidden @4xl:table-cell`),"data-sort":e.runs.length?e.runs.filter(e=>e===`p`).length/e.runs.length:-1,children:(0,Q.jsx)(pt,{runs:e.runs})}),(0,Q.jsx)(`td`,{className:c(q,`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?`${J(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:[(0,Q.jsx)(ft,{o:e.lastRun.outcome}),e.lastRun.at&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`, `,J(e.lastRun.at),e.lastRun.by===`tracker`?`, in its system`:``]})]})}),(0,Q.jsx)(`td`,{className:c(q,`text-right whitespace-nowrap`),children:(0,Q.jsx)(T,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":bt(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Q.jsx)(N,{"aria-hidden":`true`})})})]},e.key))}),(0,Q.jsx)(ot,{kind:S,keys:n,onClose:()=>C(null),onDone:e=>o(e)}),(0,Q.jsx)(Bt,{open:v,keys:n,onClose:()=>y(!1),onDone:e=>o(e)}),(0,Q.jsx)(Vt,{open:b,keys:n,onClose:()=>x(!1),onDone:e=>o(e)})]})}function Bt({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)(Ne,{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)(Be,{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 Vt({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)(Ne,{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 Ht=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),Ut=(e,t)=>t?Math.round(e/t*100):0;function Wt(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 ${Ht(a.day)}`}}function Gt({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length)return(0,Q.jsx)(Ct,{tests:n.tests});let i=e.trend;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(Me,{label:`Headline numbers`,children:[(0,Q.jsx)(U,{label:`Test cases`,icon:L,value:n.cases,change:Wt(i,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Q.jsx)(U,{label:`Automated`,icon:j,value:`${n.automated} · ${Ut(n.automated,n.cases)}%`,change:Wt(i,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Q.jsx)(U,{label:`Not automated`,icon:M,value:n.notAutomated,change:Wt(i,e=>e.notAutomated,!1)}),(0,Q.jsx)(U,{label:`Pending`,icon:O,value:n.pending,tone:n.pending?`text-warn`:void 0,change:Wt(i,e=>e.pending,!1),note:`in Design or not ready`}),(0,Q.jsx)(U,{label:`Failing`,icon:we,value:n.failing,tone:n.failing?`text-fail`:void 0,change:Wt(i,e=>e.failing,!1),note:`their last run`}),(0,Q.jsx)(U,{label:`Generated by ForgeQE`,icon:R,value:n.generated,change:Wt(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)(gt,{label:`Automation coverage, latest and its change`,figures:[{label:`Share of test cases automated`,points:i.map(e=>({x:Ht(e.day),y:Ut(e.automated,e.cases)})),format:e=>`${e}%`,delta:e=>`${e} pt${e===1?``:`s`}`,upIsGood:!0},{label:`Automated`,points:i.map(e=>({x:Ht(e.day),y:e.automated})),upIsGood:!0},{label:`Not automated`,points:i.map(e=>({x:Ht(e.day),y:e.notAutomated})),upIsGood:!1},{label:`Failing`,points:i.map(e=>({x:Ht(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)(_t,{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:Ht(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)(vt,{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)(K,{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:W,children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:Ie,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Q.jsxs)(`tr`,{className:Ee,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsx)(`td`,{className:q,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:Le,children:e.cases}),(0,Q.jsx)(`td`,{className:q,"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:J(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:`${q} 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 Kt=e=>e&&/^https:\/\//i.test(e)?e:void 0;function qt({id:e,title:t,url:n}){let r=Kt(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 Jt={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 Yt(e,t){let n={system:e};for(let r of Jt[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 Xt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function Zt({gaps:e,onRead:t}){let[n,r]=(0,X.useState)(e.live?.system??`azure_devops`),[o,l]=(0,X.useState)(Xt(e.live)),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{e.live&&(r(e.live.system),l(Xt(e.live)))},[e.live]);let m=async()=>{d(!0),p(``);try{await Z.readStories(Yt(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`})]})]}),Jt[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||!Jt[n].some(e=>e.key!==`project`&&(o[e.key]??``).trim()),children:[(0,Q.jsx)(Te,{"aria-hidden":`true`}),u?`Reading…`:`Read`]})]}),f&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:f})]})}function Qt({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Q.jsx)(Zt,{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?` ${J(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)(K,{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(W,`w-10`),children:(0,Q.jsx)(Be,{"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(W,`w-[55%]`),children:`Story`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Type`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`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:q,children:(0,Q.jsx)(Be,{"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:q,children:(0,Q.jsx)(qt,{id:e.id,title:e.title,url:e.url})}),(0,Q.jsx)(`td`,{className:c(q,`hidden text-body-sm @2xl:table-cell`),children:e.type||`–`}),(0,Q.jsx)(`td`,{className:q,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(q,`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)(K,{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(W,`w-[55%]`),children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(q,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(qt,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var $t=[{id:`stories`,label:`Stories with no case`,icon:me},{id:`criteria`,label:`Criteria not covered`,icon:L}],en=[{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:we,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 tn({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)(ht,{label:`Gaps to show`,items:[...en.map(t=>({id:t.id,label:t.label,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...$t.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)(Qt,{kind:u,gaps:_,picked:o,onPick:s,onRead:l})]}):u===`no_case`?(0,Q.jsx)(K,{label:`Tests with no test case`,placeholder:`Find a test`,height:G,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(W,`w-[55%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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:q,children:[t.uid?(0,Q.jsx)(`a`,{href:St(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:q,children:(0,Q.jsx)(mt,{tags:t.tags})}),(0,Q.jsx)(`td`,{className:q,"data-sort":t.runs.length?t.runs.filter(e=>e===`p`).length/t.runs.length:-1,children:(0,Q.jsx)(pt,{runs:t.runs})})]},e):null})}):(0,Q.jsx)(K,{label:en.find(e=>e.id===u).label,placeholder:`Find a case`,resetKey:u,height:G,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(W,`w-10`),children:(0,Q.jsx)(Be,{"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:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Priority`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:u===`not_automated`?`Why it matters`:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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:q,children:(0,Q.jsx)(Be,{"aria-label":`Select ${e.id}`,checked:x.has(e.key),onCheckedChange:t=>S(e.key,t)})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsxs)(`a`,{href:xt(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)(mt,{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)(dt,{a:e.automation})})]})}),(0,Q.jsx)(`td`,{className:c(q,`hidden text-body-sm @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Q.jsx)(`td`,{className:c(q,`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)(dt,{a:e.automation})}),(0,Q.jsx)(`td`,{className:c(q,`hidden @2xl:table-cell`),children:(0,Q.jsx)(ft,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:c(q,`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 nn=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)`,rn={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 an({suites:e,onRun:t}){return(0,Q.jsx)(K,{label:`Suites`,placeholder:`Find a suite`,height:G,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(W,`w-[40%]`),children:`Suite`}),(0,Q.jsx)(`th`,{scope:`col`,className:Ie,children:`Cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(Ie,`hidden @xl:table-cell`),children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Q.jsxs)(`tr`,{className:Ee,onClick:()=>location.hash=r(`test-management`,`suites`,e.id),children:[(0,Q.jsxs)(`td`,{className:c(q,`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)(ut,{text:e.name})]}),e.description&&(0,Q.jsx)(ut,{text:e.description,className:`mt-1 text-body-sm text-muted`})]}),(0,Q.jsx)(`td`,{className:Le,children:e.cases}),(0,Q.jsxs)(`td`,{className:c(Le,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Q.jsx)(`td`,{className:q,"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":nn(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:J(e.last.at)})]}):(0,Q.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not run`})}),(0,Q.jsxs)(`td`,{className:c(q,`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 on({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)(Ve,{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`,` `,nt(m.tracker)?(0,Q.jsx)(`a`,{href:nt(m.tracker),target:`_blank`,rel:`noreferrer noopener`,children:rt(m.tracker)}):rt(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)(V,{"aria-hidden":`true`}),m.tracker?`Update`:`Keep`]}),(0,Q.jsxs)(T,{variant:`danger`,onClick:()=>u(!0),children:[(0,Q.jsx)(Ce,{"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)(Me,{label:`The suite`,children:[(0,Q.jsx)(U,{compact:!0,label:`Cases`,value:m.cases,note:`${m.automated} automated`}),(0,Q.jsx)(U,{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 · ${J(m.last.at)}${m.last.from===`report`?``:` · so far`}`:void 0}),(0,Q.jsx)(U,{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)(U,{compact:!0,label:`Built`,value:m.built===`agent`?`Suite agent`:m.built===`rules`?`Rules`:`Picked`,note:`updated ${J(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=>`${rn[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)(K,{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(W,`w-[45%]`),children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`})]}),children:i.members.map(e=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(q,`max-w-0`),children:(0,Q.jsxs)(`a`,{href:xt(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Q.jsx)(ut,{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)(mt,{tags:e.case.tags})]})]})}),(0,Q.jsx)(`td`,{className:c(q,`hidden text-body-sm text-ink-2 @xl:table-cell`),children:e.group}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(dt,{a:e.case.automation})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(ft,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Q.jsx)(st,{open:d,suite:m,targets:i.targets,onClose:()=>f(!1),onDone:()=>void Z.suite(e).then(a,()=>{})}),(0,Q.jsx)(Ne,{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)(Ce,{"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 sn({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)(Xe,{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=>`${rn[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)(ut,{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 cn=[{id:`off`,label:`Off`,icon:M},{id:`hourly`,label:`Every hour`,icon:Te},{id:`daily`,label:`Daily`,icon:ue}];function ln(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function un({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: ${ln(r)}${r?.nextAt?`, next ${Ue(r.nextAt)}`:``}. Set when the plans are synced`,children:(0,Q.jsx)(ue,{"aria-hidden":`true`})}),(0,Q.jsx)(pn,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}var dn=(e,t)=>!!e&&!!t&&e===t.digest&&t.steps.length>0,fn=(e,t,n)=>e!==`off`&&t&&n&&n.steps.length>0?n.digest:void 0;function pn({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(dn(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=fn(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)(Ne,{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:cn.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)(Be,{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 `,Ue(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),u&&(0,Q.jsx)(`p`,{role:`alert`,className:c(h.fail,`m-0`),children:u})]})})}var mn={forgeqe:{label:`ForgeQE`,icon:R},script:{label:`Tests`,icon:oe}},hn=e=>mn[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:k},gn=e=>e!==`forgeqe`&&e!==`script`,_n=[];function vn({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(gn):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)(K,{label:`Tags`,placeholder:`Find a tag`,height:G,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Q.jsx)(ht,{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(gn)).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(W,`w-[28%]`),children:`Tag`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Comes from`}),(0,Q.jsx)(`th`,{scope:`col`,className:Ie,children:`Test cases`}),(0,Q.jsx)(`th`,{scope:`col`,className:Ie,children:`Tests`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @xl:table-cell`),children:`Out of step`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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:q,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:q,children:(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=hn(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:Le,children:e.cases}),(0,Q.jsx)(`td`,{className:Le,children:e.tests}),(0,Q.jsx)(`td`,{className:c(q,`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(q,`hidden text-body-sm text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Q.jsxs)(`td`,{className:c(q,`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)(V,{"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)(ot,{kind:a?.kind??null,keys:a?.keys??_n,tags:a?.tags,onClose:()=>o(null),onDone:e=>n?.(e)})]})}function yn({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`?Ot[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)(Ve,{icon:A,title:y.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[y.last&&(0,Q.jsx)(bn,{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(Re,`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)(K,{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:W,children:`Test case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`hidden @2xl:table-cell`),children:`Automation`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Last run`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,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:q,children:(0,Q.jsxs)(`a`,{href:xt(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(q,`hidden @2xl:table-cell`),children:(0,Q.jsx)(dt,{a:e.automation})}),(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(ft,{o:e.lastRun.outcome})}),(0,Q.jsx)(`td`,{className:c(q,`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:Je[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)(bn,{status:y.last.status}),(0,Q.jsx)(`span`,{className:`text-muted`,children:J(y.last.at)})]}):(0,Q.jsx)(ft,{o:`not_run`})}),(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Last runs`}),(0,Q.jsx)(`dd`,{className:`m-0`,children:(0,Q.jsx)(pt,{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)(mt,{tags:y.tags,max:10}):`–`})]})})})]}),(0,Q.jsx)(Mt,{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 bn({status:e}){return e===`skipped`?(0,Q.jsx)(b,{tone:`neutral`,children:`Skipped`}):(0,Q.jsx)(ft,{o:e})}var xn=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],Sn=e=>xn.some(t=>t.id===e),Cn=e=>e&&ze(e)===`web`?e:void 0,wn=(e,t)=>`${e} ${t}${e===1?``:`s`}`,Tn=e=>`${e.kind}:${e.id}`;function En(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${wn((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function Dn(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 On(){let[e,t]=(0,X.useState)(xn.map(e=>e.id)),[n,r]=(0,X.useState)(``);return(0,X.useEffect)(()=>{f.settings().then(e=>{let n=e.config.sources??{},r=xn.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:xn.filter(t=>e.includes(t.id)),error:n}}function kn({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(Tn(e))),g=async()=>{let t=m.map(e=>Dn(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=Cn(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 `,J(e.changed.when),`.`]})]}),(0,Q.jsx)(Y,{id:`cases`,icon:te,title:`Linked cases`,children:(0,Q.jsx)(K,{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:W,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(W,`text-right`),children:`Steps`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`State`})]}),children:e.cases.map(e=>{let t=Cn(e.url);return(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(q,`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(q,`[overflow-wrap:anywhere]`),children:e.title}),(0,Q.jsx)(`td`,{className:c(q,`text-right tabular-nums`),children:e.steps}),(0,Q.jsx)(`td`,{className:c(q,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 `,J(e.changed)]}):`–`})]},e.id)})})}),(0,Q.jsx)(Y,{id:`criteria`,icon:L,title:`Acceptance criteria`,children:(0,Q.jsx)(K,{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:W,children:`Criterion`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,Q.jsxs)(`tr`,{className:H,children:[(0,Q.jsx)(`td`,{className:c(q,`[overflow-wrap:anywhere]`),children:e.text}),(0,Q.jsx)(`td`,{className:c(q,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)(K,{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 ${wn(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(W,`w-10`),children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Change`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`Existing case`}),(0,Q.jsx)(`th`,{scope:`col`,className:W,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=Tn(e);return(0,Q.jsxs)(`tr`,{className:H,"data-state":r.includes(t)?`selected`:void 0,children:[(0,Q.jsx)(`td`,{className:q,children:(0,Q.jsx)(Be,{"aria-label":`${En(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(q,`whitespace-nowrap font-medium`),children:[En(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(q,`[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(q,`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 `,wn(a.changes.length,`change`),` to `,xn.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 An({sub:e}){let{systems:t,error:a}=On(),o=e?e.indexOf(`/`):-1,s=o>0?e.slice(0,o):e,l=Sn(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)(kn,{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 jn={view:()=>p(`GET`,`/api/testdebt`),refresh:()=>p(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>p(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},Mn=[`untested`,`signal`,`duplicates`,`cases`],Nn={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},Pn={test:`Test`,recording:`Recording`,case:`Test case`},Fn={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},In={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},Ln=e=>`${Math.round(e*100)}%`,Rn=e=>Mn.includes(e)?e:`untested`;function zn({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 Bn({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=Rn(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)(()=>{jn.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":Ue(t.at),children:[`Worked out `,J(t.at)]}),(0,Q.jsxs)(T,{size:`sm`,disabled:l,onClick:()=>void te(jn.refresh,`Worked out again.`),children:[(0,Q.jsx)(Te,{"aria-hidden":`true`}),`Refresh`]})]})}),(0,Q.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: 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.`]}),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)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,Q.jsx)(We,{label:`Untested code`,value:t.graph.state===`ok`?t.areas.length:`–`,tone:t.areas.length?`text-warn`:void 0,sub:t.graph.state===`ok`?`of ${t.graph.checked} areas`:`graph not built`}),(0,Q.jsx)(We,{label:`Untested rules`,value:t.rules.length,tone:t.rules.length?`text-warn`:void 0,sub:`of ${t.graph.rulesChecked} rules`}),(0,Q.jsx)(We,{label:`Never fail`,value:t.quiet.length,sub:`30 passes in a row`}),(0,Q.jsx)(We,{label:`Code gone`,value:t.gone.length,tone:t.gone.length?`text-fail`:void 0,sub:`of ${t.files.count} files listed`}),(0,Q.jsx)(We,{label:`Near-duplicates`,value:t.duplicates.length,sub:`from ${Ln(t.threshold)} alike`}),(0,Q.jsx)(We,{label:`Not automated`,value:A,tone:A?`text-warn`:void 0,sub:`of ${t.cases.length} test cases`})]}),(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)(K,{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:`${Nn[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 tracking-wide whitespace-nowrap text-muted uppercase`,`w-[34%]`),children:`Code`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Kind`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,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:Nn[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,Nn[e.kind].toLowerCase())})]},e.id))}):(0,Q.jsx)(zn,{part:t.graph,what:`product graph`,action:{label:`Product`,to:r(`product`)}}),(0,Q.jsx)(K,{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 tracking-wide whitespace-nowrap text-muted uppercase`,`w-[46%]`),children:`Rule`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`From`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,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} (${Ln(e.nearest.score)})`,tip:`${Ln(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)(K,{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 tracking-wide whitespace-nowrap text-muted uppercase`,`w-[50%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Passes`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Since`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,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?Ue(e.since):void 0,"data-sort":e.since&&new Date(e.since).getTime()||0,children:e.since?J(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)(K,{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 tracking-wide whitespace-nowrap text-muted uppercase`,`w-[40%]`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`File`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,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)(we,{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?Ue(e.last):void 0,"data-sort":e.last&&new Date(e.last).getTime()||0,children:e.last?J(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)(zn,{part:t.history,what:`test history`,action:{label:`Regression`,to:r(`regression`)}})),p===`duplicates`&&(0,Q.jsx)(K,{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 ${Ln(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 tracking-wide whitespace-nowrap text-muted uppercase`,children:`Alike`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[30%]`),children:`First`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[30%]`),children:`Second`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`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 tracking-wide whitespace-nowrap text-muted uppercase`,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`}),Ln(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:`${Pn[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,Q.jsx)(`span`,{className:`block text-body-sm text-muted`,children:Pn[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 ${J(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(()=>jn.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`?In[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)(V,{"aria-hidden":`true`}),`Import`]})]}),t.cases.length?(0,Q.jsx)(K,{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 tracking-wide whitespace-nowrap text-muted uppercase`,children:`Case`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`w-[36%]`),children:`Title`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`Source`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Automated`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Test`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,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:Fn[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 Vn=[`dashboard`,`cases`,`tests`,`gaps`,`debt`,`stories`,`suites`,`tags`],Hn={dashboard:[`dashboard`],inventory:[`cases`,`tests`,`stories`],coverage:[`gaps`,`debt`],organise:[`suites`,`tags`]},Un=e=>Object.keys(Hn).find(t=>Hn[t].includes(e))??`dashboard`;function Wn({sub:e}){let t=(e??``).split(`/`).filter(Boolean),i=Vn.includes(t[0])?t[0]:`dashboard`;He(`test-management`,i,Vn,!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=ke(()=>{Z.job().then(e=>{ee(e.job),e.job?.running||I()},()=>{})},2e3);return()=>De(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:we,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:we,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),V=s?C?.find(e=>e.id===s):void 0,Ce=se??(i===`suites`||(l?.summary.cases??0)>0),Ee=!!l&&!l.plans.length&&!l.summary.cases,H=Un(i),U={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`}},W=(0,Q.jsxs)(`main`,{className:c(je,`@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)(Oe,{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:H,hrefOf:e=>r(`test-management`,Hn[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)(Te,{"aria-hidden":`true`})}),(l.plans.length>0||l.summary.tests>0)&&(0,Q.jsx)(un,{disabled:A}),(i===`cases`||i===`gaps`||i===`suites`)&&!Ce&&(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)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`Every case of the 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 ${Ue(e.at)}`:``}`).join(` · `),children:[l.plans.length,` plan`,l.plans.length===1?``:`s`,l.plans[0]?.at?`, synced ${J(l.plans.map(e=>e.at??``).sort()[0])}.`:`, not synced yet.`]}):(!Ee||i!==`cases`&&i!==`gaps`)&&(0,Q.jsx)(`a`,{href:r(`settings`,`integrations`),children:`Connect a test plan in Settings`})]}),l&&Hn[H].length>1&&!a&&!o&&!s&&(0,Q.jsx)(Ae,{label:H===`inventory`?`Cases`:H===`coverage`?`Coverage`:`Suites and tags`,className:`mb-0`,current:i,onPick:e=>location.hash=r(`test-management`,e),tabs:Hn[H].map(e=>({id:e,...U[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}`,...Hn[H].length>1&&!a&&!o&&!s?{role:`tabpanel`,"aria-labelledby":`tab-${i}`}:{},className:`flex flex-col gap-4`,children:[i===`dashboard`&&(0,Q.jsx)(Gt,{view:l,onRunSuite:L}),Ee&&(i===`cases`||i===`gaps`)&&!a&&(0,Q.jsx)(Ct,{tests:l.summary.tests}),i===`cases`&&(!Ee||a)&&(a?(0,Q.jsx)(Pt,{caseKey:a,onRun:de,onChanged:()=>void I()},a):f&&(0,Q.jsx)(zt,{cases:f.cases,tests:f.tests.length,selected:B,onSelect:j,onRun:de,onChanged:me})),i===`tests`&&f&&(o?(0,Q.jsx)(yn,{uid:o,cases:f.cases,onChanged:()=>void I()},o):(0,Q.jsx)(wt,{cases:f.cases,onChanged:me})),i===`gaps`&&(m&&f?(0,Q.jsx)(tn,{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)(Bn,{sub:t[1]}),i===`stories`&&(0,Q.jsx)(An,{sub:t.slice(1).join(`/`)||void 0}),i===`suites`&&(s?(0,Q.jsx)(on,{id:s,onRun:L,onDeleted:()=>(location.hash=r(`test-management`,`suites`),void I())},s):C&&(0,Q.jsx)(an,{suites:C,onRun:L})),i===`tags`&&(y?(0,Q.jsx)(vn,{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)(yt,{open:!!P,onClose:()=>F(null),title:P?.title??`Run`,preview:(e,t)=>P.go(e,t),onStarted:pe})]}),G=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:W}),l&&Ce&&i===`cases`&&(0,Q.jsx)(Ze,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:G?`Looking at ${G.id}.`:B.length?`Looking at the ${B.length} cases you picked.`:`Looking at ${l.summary.cases} test cases. Pick some in the list.`,context:G?[G.id,...G.plans.slice(0,1)]:B.length?ge(B).slice(0,4):[],suggestions:G?[{intent:G.automation===`automated`?`run`:`automate`,label:G.automation===`automated`?`Run it and explain`:`Automate it`,icon:G.automation===`automated`?N:oe,keys:[G.key]},{intent:`investigate`,label:`Why it fails`,icon:we,keys:[G.key],...[`failed`,`blocked`].includes(G.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:fe,keys:[G.key]}]:ye,keys:G?[G.key]:B,placeholder:`Ask about these cases, or say what to do`,onClose:()=>ce(!1)},a??`list`),l&&Ce&&i===`gaps`&&(0,Q.jsx)(Ze,{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&&Ce&&i===`suites`&&(0,Q.jsx)(sn,{open:V,onSaved:e=>{k(`Saved the suite ${e.name}.`),I(),location.hash=r(`test-management`,`suites`,e.id)}},s??`list`)]})]})}export{Hn as GROUPS,Wn as TestManagement,Un as groupOf};