@capagents/forgeqe 2.9.8 → 2.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/HOW_TO_USE.md +90 -33
  2. package/dist/docs-site/docs/index.html +53 -4
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/forgeqe.js +1982 -1891
  5. package/dist/web/assets/Agent-B0R4tnqF.js +8 -0
  6. package/dist/web/assets/ApiTests-CqWPHWCs.js +10 -0
  7. package/dist/web/assets/Browse-DlbTQPA8.js +2 -0
  8. package/dist/web/assets/{Chat-DSlBwNAI.js → Chat-DtI3dgGs.js} +3 -3
  9. package/dist/web/assets/CommandPalette-BTI3Q3sc.js +1 -0
  10. package/dist/web/assets/{Compare-BI8IMq49.js → Compare-BMcHYq3I.js} +1 -1
  11. package/dist/web/assets/Cost-BcZ6gC9M.js +1 -0
  12. package/dist/web/assets/{Data-CjnqjcAx.js → Data-Cbl35RTK.js} +4 -4
  13. package/dist/web/assets/Desktop-D4JLSUnE.js +1 -0
  14. package/dist/web/assets/DesktopReview-vyosGOyC.js +1 -0
  15. package/dist/web/assets/Evidence-MDaV4ttv.js +1 -0
  16. package/dist/web/assets/{Explore-Cc-1cTwG.js → Explore-yjmJHnzH.js} +2 -2
  17. package/dist/web/assets/Features-kXt6Um2p.js +1 -0
  18. package/dist/web/assets/{Flags-CICcBCkH.js → Flags-CdLXiacX.js} +2 -2
  19. package/dist/web/assets/Flaky-BZx54uo3.js +1 -0
  20. package/dist/web/assets/Impact-_t7bwCwP.js +3 -0
  21. package/dist/web/assets/Jobs-D4PIAcdO.js +5 -0
  22. package/dist/web/assets/KindPage-CGfjoezZ.js +6 -0
  23. package/dist/web/assets/Migration-OGOnRmUX.js +2 -0
  24. package/dist/web/assets/Product-DycPE2MI.js +7 -0
  25. package/dist/web/assets/Production-DqnrcSfn.js +1 -0
  26. package/dist/web/assets/Quality-C__pEYpt.js +1 -0
  27. package/dist/web/assets/Readiness-j22NEcwR.js +1 -0
  28. package/dist/web/assets/Record-D7h6g_aw.js +2 -0
  29. package/dist/web/assets/Regression-ByBOHx96.js +5 -0
  30. package/dist/web/assets/RelationGraph-D_ZVeOBh.js +1 -0
  31. package/dist/web/assets/Reports-BGs_YnwI.js +2 -0
  32. package/dist/web/assets/{Response-CaWPiZyx.js → Response-DWF22-5i.js} +2 -2
  33. package/dist/web/assets/{RunDiff-BQKwTCbM.js → RunDiff-YxrBVtxF.js} +1 -1
  34. package/dist/web/assets/Runs-CP3CgO6s.js +2 -0
  35. package/dist/web/assets/Steps-BDSeIznj.js +2 -0
  36. package/dist/web/assets/TestCases-BzuM4M4t.js +1 -0
  37. package/dist/web/assets/TestData-CRmYpEgE.js +2 -0
  38. package/dist/web/assets/TestDebt-D3I2zyGE.js +1 -0
  39. package/dist/web/assets/Tosca-jVIQnyZv.js +3 -0
  40. package/dist/web/assets/{WhatsNew-CznfTEFM.js → WhatsNew-EKniIJ6W.js} +1 -1
  41. package/dist/web/assets/dataParts-DRO6c2Kb.js +3 -0
  42. package/dist/web/assets/{families-B0QIuAe3.js → families-zlLgApNV.js} +1 -1
  43. package/dist/web/assets/filters-CflRmNDz.js +1 -0
  44. package/dist/web/assets/flowLayout-cXVJhLpH.js +1 -0
  45. package/dist/web/assets/{fold-HnodvJWj.js → fold-D9yUIbTt.js} +1 -1
  46. package/dist/web/assets/frame--ur6lpMR.js +4 -0
  47. package/dist/web/assets/index-DwUumNPZ.css +2 -0
  48. package/dist/web/assets/index-GLMqsotN.js +66 -0
  49. package/dist/web/assets/{logos-CNarWSPL.js → logos-CdIbTq_J.js} +1 -1
  50. package/dist/web/assets/markdown-nTIj9lyp.js +10 -0
  51. package/dist/web/assets/{palette-B2YywN1k.js → palette-D5_w8xup.js} +1 -1
  52. package/dist/web/assets/{parts-z_AE9U-M.js → parts-C53RxMcR.js} +1 -1
  53. package/dist/web/assets/{productParts-C4vc_bLJ.js → productParts-DK3ULNpv.js} +1 -1
  54. package/dist/web/assets/qualityParts-BPBFzuHH.js +1 -0
  55. package/dist/web/assets/{recordTest-GvGQjhR4.js → recordTest-CqxnF953.js} +1 -1
  56. package/dist/web/assets/{rows-7zDrF-Yp.js → rows-BVHC-HKz.js} +1 -1
  57. package/dist/web/assets/{segmented-DANusepM.js → segmented-CAf_qz5Z.js} +1 -1
  58. package/dist/web/assets/{thread-BUBgX0xW.js → thread-B4g66SWA.js} +2 -2
  59. package/dist/web/assets/{usePageChat-DnOXyd_B.js → usePageChat-BU6VEv0K.js} +1 -1
  60. package/dist/web/index.html +5 -4
  61. package/docs/BUSINESS_ASSURANCE.md +105 -0
  62. package/docs/user-guide.html +53 -4
  63. package/package.json +1 -1
  64. package/prompts/README.md +3 -0
  65. package/prompts/brain.md +11 -0
  66. package/prompts/business-interview.md +43 -0
  67. package/prompts/business-persona.md +3 -1
  68. package/prompts/business-strategist.md +44 -0
  69. package/prompts/persona-own.md +47 -0
  70. package/py/forgeqe_engine/cli.py +5 -0
  71. package/py/forgeqe_engine/recordsession.py +134 -9
  72. package/py/forgeqe_engine/webrecord_page.py +18 -9
  73. package/dist/web/assets/Agent-D0jovbz1.js +0 -6
  74. package/dist/web/assets/ApiTests-CMMMApBR.js +0 -10
  75. package/dist/web/assets/Browse-Bimy9-t0.js +0 -2
  76. package/dist/web/assets/CommandPalette-D7NWAtOU.js +0 -1
  77. package/dist/web/assets/Cost-BV0JavsG.js +0 -1
  78. package/dist/web/assets/Desktop-Bu72INy4.js +0 -1
  79. package/dist/web/assets/DesktopReview-jDnb5Gfn.js +0 -1
  80. package/dist/web/assets/Evidence-CIlcAy5n.js +0 -1
  81. package/dist/web/assets/Features-CewFSOSI.js +0 -1
  82. package/dist/web/assets/Flaky-BrWbRajc.js +0 -1
  83. package/dist/web/assets/ForceGraph-BLYMwmyj.js +0 -1
  84. package/dist/web/assets/Impact-D7seby-G.js +0 -3
  85. package/dist/web/assets/Jobs-D7yPretO.js +0 -5
  86. package/dist/web/assets/KindPage-Cjt1s7Vd.js +0 -6
  87. package/dist/web/assets/Migration-CbCqOsJI.js +0 -2
  88. package/dist/web/assets/Product-CxXVrpoD.js +0 -7
  89. package/dist/web/assets/Production-D5jIe328.js +0 -1
  90. package/dist/web/assets/Quality-D3G8IKLZ.js +0 -1
  91. package/dist/web/assets/Readiness-B4Fy4Vln.js +0 -1
  92. package/dist/web/assets/Record-DLfODYjy.js +0 -2
  93. package/dist/web/assets/Regression-Daoc9Qvx.js +0 -5
  94. package/dist/web/assets/Reports-DEzDDoGF.js +0 -2
  95. package/dist/web/assets/Runs-BIUnN08h.js +0 -2
  96. package/dist/web/assets/Steps-DjR_K32c.js +0 -2
  97. package/dist/web/assets/TestCases-BZWiTLjC.js +0 -1
  98. package/dist/web/assets/TestData-D6YiouU4.js +0 -2
  99. package/dist/web/assets/TestDebt-COFagfQU.js +0 -1
  100. package/dist/web/assets/Tosca-B3sZ9uqe.js +0 -3
  101. package/dist/web/assets/dataParts-DpVitZdm.js +0 -3
  102. package/dist/web/assets/filters-mFECJpMB.js +0 -1
  103. package/dist/web/assets/frame-DiKY0GWx.js +0 -4
  104. package/dist/web/assets/index-HjX2EOmp.js +0 -75
  105. package/dist/web/assets/index-VgSzQGK8.css +0 -2
  106. package/dist/web/assets/qualityParts-jsPhayON.js +0 -1
@@ -1,2 +0,0 @@
1
- import{$n as e,Ar as t,D as n,Dt as r,Fn as i,Ir as a,L as o,M as s,Mt as c,Nn as l,Nr as u,O as d,T as f,U as p,Vn as m,Xt as h,Zn as g,_,_t as v,a as ee,at as y,f as b,j as x,kr as S,ln as C,lr as w,nr as T,ot as E,rn as D,rr as te,y as O,yt as k}from"./line-icons-CQ-3V8ax.js";import{B as A,Pt as j,R as M,V as N,c as P,d as ne,f as F,h as I,i as re,l as ie,n as ae,o as oe,qt as se,rt as ce,t as le,u as ue,z as de}from"./filters-mFECJpMB.js";import{Dt as fe,Et as pe,Ut as me,gt as he,r as ge,t as _e,wt as ve,z as L}from"./frame-DiKY0GWx.js";import{i as ye,l as R,r as be,u as z}from"./index-HjX2EOmp.js";import{r as xe,t as Se}from"./Response-CaWPiZyx.js";import{i as Ce,r as we,t as Te}from"./segmented-DANusepM.js";import{a as Ee,c as De}from"./thread-BUBgX0xW.js";import{r as Oe}from"./families-B0QIuAe3.js";var B=a(u(),1),V=se(),H={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},ke={execution:k,report:y,coding:p,chat:C};function Ae({kind:e}){let t=ke[e];return(0,V.jsx)(I,{icon:t,size:14,className:`flex-none text-muted`})}var je={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},U=e=>je[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Me={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ne=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function W({title:e,icon:t,children:n,aside:r}){return(0,V.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,V.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Pe({path:e,label:t=`Report`}){let[n,r]=(0,B.useState)(``);return(0,V.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(M,{"data-tip":`Open the report`,onClick:async()=>r(await ue(e)),children:[(0,V.jsx)(E,{"aria-hidden":`true`}),t]}),n&&(0,V.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Fe({items:e,first:t,render:n}){let[r,i]=(0,B.useState)(!1);return(0,V.jsxs)(V.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[r?(0,V.jsx)(d,{size:14,"aria-hidden":`true`}):(0,V.jsx)(f,{size:14,"aria-hidden":`true`}),r?`Less`:`All (${e.length})`]})]})}function Ie({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,V.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,V.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,V.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,V.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function Le({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Me[e.scope]||e.scope,Ne(e.ms),e.tokens?`${L(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,V.jsx)(Pe,{path:e.report})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,V.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,V.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,V.jsxs)(P,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,V.jsxs)(P,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,V.jsxs)(P,{tone:`warn`,children:[e.counts.other,` other`]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,V.jsx)(Ie,{c:e.counts}),e.cases.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,V.jsx)(Fe,{items:[...e.cases].sort((e,t)=>Number(U(t.status).tone===`fail`)-Number(U(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,V.jsx)(P,{tone:U(e.status).tone,children:U(e.status).label})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,V.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,V.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,V.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,V.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Ne(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,V.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,V.jsx)(R,{path:e.folder})]})]})}function Re({list:e}){let t=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,V.jsx)(W,{title:`Execution summary`,icon:(0,V.jsx)(I,{icon:k,size:18}),aside:e.length>1?(0,V.jsxs)(`span`,{className:`text-sm text-muted`,children:[N(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,V.jsx)(Le,{e},`${e.folder||e.title}-${t}`)):(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function ze({list:e}){return(0,V.jsxs)(W,{title:`Report summary`,icon:(0,V.jsx)(I,{icon:y,size:18}),children:[e.length===0&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,V.jsx)(Pe,{path:e.path})]}),e.stats&&(0,V.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,V.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,V.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,V.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,V.jsx)(Be,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Be({text:e,height:t=220}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!0),[o,s]=(0,B.useState)(t),c=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:A(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,o!==void 0&&`relative overflow-hidden`),children:[(0,V.jsx)(z,{text:e,className:`text-sm`}),!n&&i&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),ve())return s(n?t:void 0);s(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>s(t)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[n?(0,V.jsx)(d,{size:14,"aria-hidden":`true`}):(0,V.jsx)(f,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ve(e){let t=e.join(`
2
- `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function He({e}){let[t,r]=(0,B.useState)(!1),i=e.action===`write`?`New`:`Edited`;return(0,V.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,V.jsx)(n,{size:16,"aria-hidden":`true`,className:A(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,V.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:i}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(R,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,V.jsx)(fe,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,V.jsx)(z,{text:Ve(e.diffs)}):null})]})}var Ue={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function G({label:e,children:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function We({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,V.jsxs)(W,{title:`Code changes`,icon:(0,V.jsx)(I,{icon:p,size:18}),aside:e.edits.length?(0,V.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[N(e.edits.length,`file`),` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:N(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(k,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,V.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:U(t.status).label}),(0,V.jsx)(P,{tone:r?`pass`:o?`fail`:`warn`,children:U(t.status).label}),e.tests.length>0&&(0,V.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[N(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${N(e.reviews.length,`review`)}`:``]})]}),(0,V.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,V.jsx)(G,{label:`Test`,children:(0,V.jsx)(R,{path:t.testFile})}),t.command&&(0,V.jsx)(G,{label:`Run it`,children:(0,V.jsx)(xe,{text:t.command})}),(t.review||a)&&(0,V.jsx)(G,{label:`Review`,children:(0,V.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{children:(0,V.jsx)(P,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,V.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,V.jsx)(G,{label:`Notes`,children:(0,V.jsx)(z,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,V.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,V.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,V.jsx)(Fe,{items:e.edits,first:8,render:e=>(0,V.jsx)(He,{e},e.path)})})]}),o.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,V.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>(0,V.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,V.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Ue[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(R,{path:e.path})})]},e.path))}),(0,V.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.length&&!e.results.length&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,V.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Ge({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,V.jsxs)(W,{title:`Final message`,icon:(0,V.jsx)(v,{size:18,"aria-hidden":`true`}),aside:(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,V.jsx)(Be,{text:r?`${a}text\n${e.text}\n${a}`:De(e.text),height:420}),n.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,V.jsx)(R,{path:e},e))]})]})}var Ke={rule:{icon:b,label:`Rulebook`},decision:{icon:r,label:`Test decisions`},memory:{icon:_,label:`Page memory`},replay:{icon:l,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:c,label:`Skills`}};function qe({list:e}){let t=Object.keys(Ke).filter(t=>e.some(e=>e.kind===t));return(0,V.jsx)(W,{title:`Learnings`,icon:(0,V.jsx)(I,{icon:h,size:18}),aside:e.length?(0,V.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Ke[t];return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,V.jsx)(I,{icon:n,size:14}),r]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Je({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,V.jsx)(Re,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,V.jsx)(ze,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,V.jsx)(We,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,V.jsx)(V.Fragment,{children:t.map(e=>e.node)})}var Ye={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},Xe={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},Ze=e=>Xe[e]||e.charAt(0).toUpperCase()+e.slice(1),K=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function Qe(e){let[t,n]=(0,B.useState)(Date.now());return(0,B.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function $e({r:e}){return e.origin.kind===`web`?(0,V.jsxs)(`a`,{href:F(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(I,{icon:C,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,V.jsxs)(`a`,{href:F(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(I,{icon:O,size:14}),`Job`]}):(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,V.jsx)(I,{icon:w,size:14}),`Terminal`]})}function et({status:e}){let t=Ye[e].label;return e===`running`?(0,V.jsx)(D,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,V.jsx)(x,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,V.jsx)(o,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,V.jsx)(s,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function tt(e){return/^forgeqe(-|$)|^engine$/.test(e)?me(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,V.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,V.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,V.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var nt={rerun:i,write_test:T,investigate:m,fix_test:S},rt={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function it({actions:e}){let[t,n]=(0,B.useState)(``),[r,i]=(0,B.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await ce.start(e.prompt,{});location.hash=F(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,V.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,V.jsxs)(M,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,V.jsx)(I,{icon:nt[e.kind],size:16,className:`flex-none`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:rt[e.kind]}),e.note&&(0,V.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,V.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var at=e=>`\`${e.replace(/`/g,``)}\``,ot=[`summary`,`conversation`,`activity`,`details`],st=e=>ot.find(t=>t===e)??`summary`;function ct({name:n,tab:r}){let[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),u=st(r),d=e=>location.hash=e===`summary`?F(`runs`,encodeURIComponent(n)):F(`runs`,encodeURIComponent(n),e),f=(0,B.useCallback)(()=>{j.detail(n).then(e=>{a(e),s(``)},e=>s(e.message))},[n]);(0,B.useEffect)(f,[f]);let p=i?.status===`running`;(0,B.useEffect)(()=>{if(!p)return;let e=setInterval(f,2e3);return()=>clearInterval(e)},[f,p]);let m=Qe(p),h=(0,B.useMemo)(()=>(i?.events??[]).map(Ee).filter(e=>!!e),[i?.events]),g=async()=>{l(!0),s(``);try{await j.cancel(n),f()}catch(e){s(e.message)}finally{l(!1)}},_=(0,V.jsxs)(`a`,{href:F(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,V.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!i)return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,o?(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o}):(0,V.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=Ye[i.status],y=!i.replies.length,b=!!i.final||i.executions.length>0||i.reports.length>0||!!(i.coding&&(i.coding.edits.length||i.coding.results.length))||i.learnings.length>0||i.outputs.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:i.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...i.reports.map(e=>e.path),...i.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=i.outputs.filter(e=>!S.has(e.path)),w=i.context?.limit?Math.round(i.context.tokens/i.context.limit*100):null;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[_,(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,V.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:i.title}),(0,V.jsx)(P,{tone:v.tone,children:v.label})]}),(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(Ae,{kind:i.kind}),H[i.kind]]}),`· `,(0,V.jsx)($e,{r:i}),`· `,K(i.startedAt),` · `,p?`running for `:`took `,J(q(i,m)),` · `,L(Y(i)),` tokens`,i.profile?.model?` · ${i.profile.model}`:``]})]}),i.cancel&&(0,V.jsxs)(M,{variant:`danger`,disabled:c,"data-tip":i.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[i.cancel===`chat`?(0,V.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}):(0,V.jsx)(t,{"aria-hidden":`true`}),c?`Stopping…`:i.cancel===`chat`?`Stop`:`Cancel`]})]}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),i.error&&(0,V.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`strong`,{children:`What went wrong:`}),` `,i.error]}),!p&&(0,V.jsx)(it,{actions:i.actions??[]}),(0,V.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:we,children:x.map(e=>(0,V.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":u===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>d(e.id),className:Ce(u===e.id),children:[e.label,e.n!==void 0&&(0,V.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,V.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${u}`,"aria-labelledby":`run-tab-${u}`,className:`flex min-w-0 flex-col gap-6`,children:[u===`summary`&&(0,V.jsxs)(V.Fragment,{children:[i.final&&(0,V.jsx)(Ge,{final:i.final,answer:i.answer}),(0,V.jsx)(Je,{run:i}),C.length>0&&(0,V.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,V.jsx)(Z,{label:e.label,children:(0,V.jsx)(R,{path:e.path})},e.path))}),i.learnings.length>0&&(0,V.jsx)(qe,{list:i.learnings}),!b&&(0,V.jsx)(ie,{className:`py-4`,children:p?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),u===`conversation`&&(y?(0,V.jsx)(z,{text:at(i.prompt),className:`text-sm [&_p]:my-0`}):(0,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:i.replies.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,V.jsx)(z,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,V.jsx)(z,{text:De(e.text),className:`text-sm`}),e.error&&(0,V.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),u===`activity`&&(i.archived?(0,V.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,V.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,V.jsx)(Se,{timeline:!0,lines:h,start:i.startedAt,live:p,name:`forgeqe-run-${i.name.replace(/\.log$/,``)}.md`}):(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),u===`details`&&(0,V.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,V.jsxs)(Q,{title:`Numbers`,children:[(0,V.jsx)(Z,{label:p?`Running for`:`Took`,children:J(q(i,m))}),(0,V.jsx)(Z,{label:`Tokens`,children:(0,V.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`span`,{children:[L(Y(i)),` `,(0,V.jsxs)(`span`,{className:`text-muted`,children:[`· `,L(i.usage.input),` read · `,L(i.usage.output),` written`,i.usage.cached?` · ${L(i.usage.cached)} cached`:``]})]}),(i.byAgent?.length??0)>1&&(0,V.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:i.byAgent.map(e=>(0,V.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:tt(e.agent)}),(0,V.jsx)(`span`,{className:`text-muted tabular-nums`,children:L(e.input+e.output)})]},e.agent))})]})}),(0,V.jsxs)(Z,{label:`Context`,children:[i.context?L(i.context.tokens):`–`,w!==null&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[` of `,L(i.context.limit),` (`,w,`%)`]})]}),(0,V.jsxs)(Z,{label:`Tool calls`,children:[i.tools,` `,(0,V.jsxs)(`span`,{className:`text-muted`,children:[`in `,N(i.turns,`turn`)]})]})]}),(0,V.jsxs)(Q,{title:`Session`,children:[(0,V.jsx)(Z,{label:`Started by`,children:(0,V.jsx)($e,{r:i})}),(0,V.jsx)(Z,{label:`Command`,children:Ze(i.command)}),(0,V.jsx)(Z,{label:`Model`,children:i.profile?[i.profile.name,i.profile.model].filter(Boolean).join(` · `):`–`}),(0,V.jsx)(Z,{label:`Agents`,children:i.agents.length?(0,V.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:i.agents.map(e=>(0,V.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:tt(e.name)}),(0,V.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:N(e.calls,`call`)})]},e.name))}):(0,V.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,V.jsxs)(Z,{label:`Log`,children:[i.archived?(0,V.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,V.jsx)(R,{path:`.forgeqe/logs/${i.name}`}),i.truncated&&(0,V.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),i.job&&(0,V.jsxs)(Q,{title:`Job`,children:[(0,V.jsx)(Z,{label:`Job`,children:(0,V.jsx)(`a`,{href:F(`jobs`,encodeURIComponent(i.origin.kind===`job`?i.origin.job:i.job.name)),children:i.job.name})}),(0,V.jsx)(Z,{label:`Runs`,children:(0,V.jsx)(z,{text:at(i.job.command),className:`text-sm [&_p]:my-0`})}),(0,V.jsxs)(Z,{label:`Schedule`,children:[i.job.schedule,!i.job.enabled&&` (disabled)`,i.job.nextAt&&i.job.enabled?` · next ${K(i.job.nextAt)}`:``]}),i.job.run&&(0,V.jsxs)(Z,{label:`This run`,children:[i.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,i.job.run.status.replace(`_`,` `),i.job.run.exitCode!==void 0&&i.job.run.exitCode!==null?`, exit ${i.job.run.exitCode}`:``]})]}),(0,V.jsx)(Q,{title:`Files worked on (${i.files.length})`,children:i.files.length?[...i.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,V.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,V.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,V.jsx)(R,{path:e.path})},e.path)):(0,V.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,V.jsx)(Q,{title:`Notifications`,children:i.notifications.length?i.notifications.map(e=>(0,V.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,V.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,V.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:i.origin.kind===`terminal`||i.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function lt({runs:e}){let t=Qe(e.some(e=>e.status===`running`)),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(`all`),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(0);(0,B.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),ee=Math.max(1,Math.ceil(v.length/$)),y=Math.min(f,ee-1),b=v.slice(y*$,y*$+$),x=e.filter(e=>e.status!==`running`&&!X(e)),S=x.filter(e=>e.status===`failed`).length,w=x.length?x.reduce((e,n)=>e+q(n,t),0)/x.length:NaN,T=e.reduce((e,t)=>e+Y(t),0),E=[...new Set(e.map(e=>e.kind))],D=[...new Set(e.map(e=>e.origin.kind))],O={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,V.jsx)(ie,{icon:te,title:`No runs yet`,action:(0,V.jsxs)(`a`,{className:de({size:`sm`}),href:F(),"data-tip":`Start a chat`,children:[(0,V.jsx)(C,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:A(`tabular-nums`,S?`text-fail`:`text-ink`),children:S}),` failed`,x.length?` (${Math.round(S/x.length*100)}%)`:``]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:L(T)}),` tokens`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(w))}),` on average`]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(re,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,V.jsx)(le,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),E.length>1&&(0,V.jsxs)(oe,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,V.jsx)(`option`,{value:``,children:`Any kind`}),E.map(e=>(0,V.jsx)(`option`,{value:e,children:H[e]},e))]}),D.length>1&&(0,V.jsxs)(oe,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,V.jsx)(`option`,{value:``,children:`Started anywhere`}),D.map(e=>(0,V.jsx)(`option`,{value:e,children:O[e]||e},e))]})]}),(0,V.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,V.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,V.jsx)(`span`,{className:`w-4`}),(0,V.jsx)(`span`,{children:`Run`}),(0,V.jsx)(`span`,{children:`Kind`}),(0,V.jsx)(`span`,{children:`Started by`}),(0,V.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,V.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,V.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,V.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[b.length===0&&(0,V.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),b.map((e,n)=>{let r=ye(e.startedAt);return(0,V.jsxs)(`li`,{className:`contents`,children:[(n===0||ye(b[n-1].startedAt)!==r)&&(0,V.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,V.jsxs)(`a`,{href:F(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,V.jsx)(et,{status:e.status}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,V.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,V.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[H[e.kind],O[e.origin.kind],J(q(e,t)),`${L(Y(e))} tokens`].join(` · `)})]}),(0,V.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,V.jsx)(Ae,{kind:e.kind}),H[e.kind]]}),(0,V.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:O[e.origin.kind]||e.origin.kind}),(0,V.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,t))}),(0,V.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:L(Y(e))}),(0,V.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":K(e.startedAt),children:be(e.startedAt)})]})]},e.name)})]}),(0,V.jsx)(ae,{page:y,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${N(m,`empty session`)}`:`${N(m,`empty session`)} hidden`})]})})]})]})}function ut({sub:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),a=(0,B.useCallback)(()=>{j.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,B.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,B.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ne(s):``;return(0,V.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,V.jsx)(ge,{}),(0,V.jsx)(`main`,{className:A(_e,`@container flex-auto gap-4`),children:l?(0,V.jsx)(ct,{name:l,tab:c},l):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(pe,{pixel:he.runs,size:`lg`}),(0,V.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,V.jsx)(Te,{label:`Runs and reports`,links:Oe,current:`runs`})]}),(0,V.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,V.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,V.jsx)(lt,{runs:t})]})})]})}export{ut as Runs,et as StatusIcon,st as runTab};
@@ -1,2 +0,0 @@
1
- import{Ar as e,C as t,Ir as n,Nr as r,nn as i,rt as a}from"./line-icons-CQ-3V8ax.js";import{B as o,Ut as s,c,f as l,i as u,l as d,n as f,qt as p,z as m}from"./filters-mFECJpMB.js";import{c as h,f as g}from"./index-HjX2EOmp.js";import{d as _}from"./parts-z_AE9U-M.js";var v=n(r(),1),y=p();function b({error:e}){return e?(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}var x=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,S={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},C={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},w={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},T={setup:`Set-up`,page:`Page`,test:`Test`},E=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:T[e.kind],D={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},O=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function k(e){if(e.workflow&&e.workflow.steps>0)return`${e.workflow.engine===`mobile`?`Mobile`:`Desktop`} workflow${e.workflow.skipped?` + notes`:``}`;let t=e.route===`web`||(e.routes?.web??0)>0,n=e.route===`api`||(e.routes?.api??0)>0,r=(e.unsupported??0)>0||(e.routes?.unsupported??0)>0;return`${t&&n?`Web and API`:n?`API`:`Web`}${r?` + notes`:``}`}var A={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},j={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},M=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function N(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function P(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?_(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running · ${_(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done · ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function F({states:n}){return(0,y.jsx)(`ol`,{"aria-label":`Stages`,className:`m-0 flex w-full min-w-0 list-none items-center gap-1 p-0 @xl:gap-2`,children:M.map((r,a)=>{let s=n?.[r],c=s?.status||`pending`,l=c===`done`||c===`skipped`,u=c===`running`||c===`failed`,d=P(s);return(0,y.jsxs)(`li`,{"data-tip":`${j[r]}: ${d}`,className:o(`relative flex items-center gap-1 @xl:gap-2`,a<M.length-1&&`flex-1`),"aria-current":c===`running`?`step`:void 0,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums @xl:size-6`,l?`bg-pass text-white`:c===`running`?`border-2 border-accent bg-accent-soft text-accent-fg`:c===`failed`?`bg-fail text-white`:`border border-line bg-bg text-muted`),children:l?(0,y.jsx)(t,{size:12,strokeWidth:3}):c===`failed`?(0,y.jsx)(e,{size:12,strokeWidth:3}):c===`running`?(0,y.jsx)(i,{size:12,strokeWidth:2.5,className:`animate-spin`}):a+1}),(0,y.jsxs)(`span`,{className:o(`flex-none text-[13px] whitespace-nowrap`,u?`inline`:`hidden @xl:inline`,c===`running`?`font-medium text-accent-fg`:c===`failed`?`font-medium text-fail`:c===`pending`?`text-muted`:`text-ink`),children:[j[r],u&&(0,y.jsx)(`span`,{className:`ml-1.5 hidden font-normal text-muted @3xl:inline`,children:d})]}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[j[r],`: `,d]}),a<M.length-1&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,y.jsx)(`span`,{className:o(`block h-full rounded-full bg-pass transition-[width] duration-500`,l?`w-full`:`w-0`)})})]},r)})})}function I(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(I).join(` + `):``:``}var L={exact:`is`,contains:`contains`,not:`is not`,gt:`is more than`,gte:`is at least`,lt:`is less than`,lte:`is at most`,exists:`is there`,absent:`is not there`},R=new Set([`gt`,`gte`,`lt`,`lte`]);function z(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(R.has(e.match||``)||e.op===`api_status`)?String(t.literal):I(t)}function B(e,t,n){return e===`api_status`||t===`status`?`the status`:e===`api_header`||t===`header`?`the header ${n}`:e===`api_body`||t===`body`?`the body`:`the JSON value ${n}`}function V(e){if(e.op===`api_request`){let t=e.method&&`literal`in e.method?String(e.method.literal):``,n=[e.endpoint,e.resource].filter(Boolean).map(e=>I(e)).join(` + `),r=(e,t,n)=>{let r=e?Object.keys(e).length:0;return r?`${r} ${r===1?t:n}`:``},i=[e.payload?.fields?.length?`${e.payload.fields.length} body ${e.payload.fields.length===1?`field`:`fields`}`:e.payload?.raw?`a body`:``,r(e.pathParams,`path parameter`,`path parameters`),r(e.query,`query parameter`,`query parameters`),r(e.headers,`header`,`headers`)].filter(Boolean);return`Call ${t?`${t} `:e.method?`(method ${I(e.method)}) `:``}${n||`with no address`}${i.length?`, with ${i.join(`, `)}`:``}`}if(e.kind===`assert`&&(e.op===`api_status`||e.op===`api_header`||e.op===`api_json`||e.op===`api_body`)){let t=B(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${L[n]||`is`}${n===`exists`||n===`absent`?``:` ${z(e)}`}`}return e.op===`api_store`?`Read ${B(void 0,e.property,e.target)} of the response into ${e.var}`:null}function H(e){let t=V(e);if(t!==null)return t;let n=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let t=e.op===`navigate`?`Open ${I(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${I(e.value)}`:e.op===`press`?`Press ${e.key} on ${n}`:e.op===`select`?`Select in ${n}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${n}`;return e.optional?`${t} (if it is there)`:t}return e.kind===`assert`?`Check ${n} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${I(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${I(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var U=(e,t)=>t?l(`tosca`,e,`compare`,encodeURIComponent(t)):l(`tosca`,e,`compare`),W=50,G={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function K({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,y.jsx)(`ul`,{className:o(`m-0 flex list-none flex-col p-0`,i>0&&`ml-3 border-l border-line-soft pl-3`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[G[e.role||`folder`]||`Folder`,`: `,(0,y.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,y.jsx)(K,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,y.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,y.jsx)(`span`,{className:`ml-3 text-[12px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,y.jsx)(K,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let s=e.id?t.get(e.id):void 0,c=s?D[s]:void 0;return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:o(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":c?.label||`Not converted yet`,"data-tip":c?.label||`Not converted yet`,className:o(`mt-1.5 size-2 flex-none rounded-full`,c?.dot||`bg-line`)}),(0,y.jsx)(`span`,{className:`w-9 flex-none font-mono text-[12px] text-muted`,children:e.id}),(0,y.jsxs)(`span`,{className:o(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[H(e),e.tosca?.step&&(0,y.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function q(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&q(n[e],t);if(r)return r}}}function J({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,a=i.split(`
2
- `),s=(0,v.useMemo)(()=>i?g(i,r?.lang||`plaintext`):null,[i,r?.lang]),c=(0,v.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),l=(0,v.useRef)(null);(0,v.useEffect)(()=>{l.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,c.size]);let u=Math.min(...c);return(0,y.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?E({kind:`test`,engine:n}):`Converted test`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,y.jsx)(h,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,y.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,y.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-3 text-right text-muted select-none`,children:a.map((e,t)=>(0,y.jsx)(`span`,{ref:t===u?l:void 0,className:o(`block px-3`,c.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,y.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-3 py-3`,children:(0,y.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,y.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-3 py-2 text-[12.5px] text-muted`,children:c.size?`${t} is done on line ${[...c].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function Y({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,y.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`w-14 flex-none text-[12px] text-muted`,children:e.strategy}),(0,y.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,y.jsx)(c,{tone:`warn`,children:`Fragile`})]},t))}):(0,y.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function X({id:e,plan:t,result:n,initial:r,full:i,onPick:c}){let l=t.cases.filter(e=>e.included),[p,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(r||l[0]?.id||``),[b,S]=(0,v.useState)(null),[C,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``);(0,v.useEffect)(()=>{g&&(D(``),s.case(e,g).then(S,e=>D(e.message)))},[e,g,n?.units.length,n?.status]),(0,v.useEffect)(()=>{T(``),g&&c?.(g)},[g]);let O=new Map((b?.fidelity||[]).map(e=>[e.id,e.status])),k=l.filter(e=>!p||e.name.toLowerCase().includes(p.toLowerCase())),[j,M]=(0,v.useState)(0);(0,v.useEffect)(()=>M(0),[p]),(0,v.useEffect)(()=>{let e=k.findIndex(e=>e.id===g);e>=0&&Math.floor(e/W)!==j&&M(Math.floor(e/W))},[g]);let N=k.slice(j*W,j*W+W),P=e=>n?.units.find(t=>t.kind===`test`&&t.case===e);if(!l.length)return(0,y.jsx)(d,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let F=(0,y.jsxs)(`div`,{className:o(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,i?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,y.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-3 @5xl:max-h-none`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,y.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[l.filter(e=>P(e.id)?.status===`converted`).length,` converted · `,l.some(e=>P(e.id)?.status===`written`)?`${l.filter(e=>P(e.id)?.status===`written`).length} written · `:``,l.filter(e=>[`failed`,`blocked`].includes(P(e.id)?.status||``)).length,` failed · `,x(l.length,`test case`)]})]}),(0,y.jsx)(u,{id:`find-a-case`,label:`Find a test case`,value:p,onChange:h,className:`max-w-none flex-none`}),(0,y.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-0.5 overflow-y-auto p-0`,children:[N.map(e=>{let t=P(e.id);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":g===e.id,onClick:()=>_(e.id),className:o(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,g===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":t?w[t.status].label:`Waiting`,className:o(`mt-1.5 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,y.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[x(e.steps,`step`),` · `,x(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!N.length&&(0,y.jsx)(`li`,{className:`px-2 py-3 text-[13px] text-muted`,children:`No test case matches.`})]}),k.length>W&&(0,y.jsx)(f,{page:j,size:W,total:k.length,onPage:M,label:`Test case pages`})]}),(0,y.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-3 overflow-hidden`,children:[E&&(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E}),(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-3 py-1.5`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:b?.name}),b&&t.cases.find(e=>e.id===g)&&(0,y.jsx)(`span`,{className:`text-[12px] text-muted`,children:A[t.cases.find(e=>e.id===g).route]||``})]}),(0,y.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:b?(0,y.jsx)(K,{nodes:b.body,status:O,pick:C,onPick:e=>T(e.id||``)}):E?(0,y.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,y.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},b?.case||``),b&&(b.env.length>0||b.warnings.length>0)&&(0,y.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-3 py-2 text-[12.5px] text-ink-2`,children:[b.env.length>0&&(0,y.jsxs)(`span`,{children:[`Environment variables: `,b.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),b.warnings.slice(0,3).map(e=>(0,y.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),b&&(0,y.jsx)(Y,{view:b,node:q(b.body,C)})]}),b?(0,y.jsx)(J,{view:b,pick:C,engine:t.units.find(e=>e.kind===`test`&&e.case===b.case)?.engine},b.case):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:E?`Nothing to show.`:`Loading…`})]});return i?F:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`flex justify-end`,children:(0,y.jsxs)(`a`,{href:U(e,g),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:m({variant:`ghost`,size:`sm`}),children:[(0,y.jsx)(a,{"aria-hidden":`true`}),`Open in a new tab`]})}),F]})}export{C as a,j as c,S as d,k as f,N as g,E as h,b as i,F as l,x as m,U as n,A as o,O as p,D as r,M as s,X as t,w as u};
@@ -1 +0,0 @@
1
- import{$t as e,Ar as t,C as n,Ft as r,Ir as i,Nr as a,R as o,en as s,gr as c,it as l,o as u,rt as d}from"./line-icons-CQ-3V8ax.js";import{B as f,R as p,Vt as m,Z as h,a as g,d as _,f as v,h as y,l as b,qt as x,t as S}from"./filters-mFECJpMB.js";import{Et as C,at as w,et as T,gt as E,r as D,rt as O,t as k,tt as A}from"./frame-DiKY0GWx.js";import{p as j,r as M,s as N}from"./index-HjX2EOmp.js";var P=i(a(),1),F=x(),I=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],L=e=>I.some(t=>t.id===e),R=e=>e&&j(e)===`web`?e:void 0,z=(e,t)=>`${e} ${t}${e===1?``:`s`}`,B=e=>`${e.kind}:${e.id}`;function V(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${z((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function H(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 U(){let[e,t]=(0,P.useState)(I.map(e=>e.id)),[n,r]=(0,P.useState)(``);return(0,P.useEffect)(()=>{h.settings().then(e=>{let n=e.config.sources??{},r=I.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:I.filter(t=>e.includes(t.id)),error:n}}function W({id:e,icon:t,title:n,children:r}){return(0,F.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,F.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,F.jsx)(y,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function G({view:i,onApplied:a,onError:u}){let[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),C=i.story.id,E=i.proposals.filter(e=>h.includes(B(e))),D=async()=>{let e=E.map(e=>H(e,C));b(!0);try{let t=await m.preview(i.system,C,e);v({lines:t.lines,changes:e}),u(``)}catch(e){u(e.message)}finally{b(!1)}},k=async()=>{if(_){b(!0);try{let e=await m.apply(i.system,C,_.changes);S({applied:e.applied,failed:e.failed}),v(null),g([]),u(``),a()}catch(e){u(e.message)}finally{b(!1)}}},j=R(i.story.url);return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,F.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,F.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,F.jsx)(d,{size:14,"aria-hidden":`true`})]}):(0,F.jsx)(`span`,{children:C}),i.story.title&&(0,F.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,F.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,M(i.changed.when),`.`]})]}),(0,F.jsx)(W,{id:`cases-h`,icon:e,title:`Linked cases`,children:(0,F.jsx)(T,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:O,children:`Case`}),(0,F.jsx)(`th`,{className:O,children:`Title`}),(0,F.jsx)(`th`,{className:f(O,`text-right`),children:`Steps`}),(0,F.jsx)(`th`,{className:O,children:`State`})]}),children:i.cases.map(e=>{let t=R(e.url);return(0,F.jsxs)(`tr`,{className:w,children:[(0,F.jsx)(`td`,{className:f(A,`whitespace-nowrap`),children:t?(0,F.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,F.jsx)(d,{size:12,"aria-hidden":`true`})]}):e.id}),(0,F.jsx)(`td`,{className:f(A,`[overflow-wrap:anywhere]`),children:e.title}),(0,F.jsx)(`td`,{className:f(A,`text-right tabular-nums`),children:e.steps}),(0,F.jsx)(`td`,{className:f(A,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(c,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,F.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,M(e.changed)]}):`–`})]},e.id)})})}),(0,F.jsx)(W,{id:`criteria-h`,icon:o,title:`Acceptance criteria`,children:(0,F.jsx)(T,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:O,children:`Criterion`}),(0,F.jsx)(`th`,{className:O,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,F.jsxs)(`tr`,{className:w,children:[(0,F.jsx)(`td`,{className:f(A,`[overflow-wrap:anywhere]`),children:e.text}),(0,F.jsx)(`td`,{className:f(A,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,F.jsxs)(W,{id:`proposals-h`,icon:s,title:`Proposed changes`,children:[(0,F.jsx)(T,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,F.jsxs)(p,{size:`sm`,variant:`primary`,disabled:y||!E.length||!!_,"data-tip":`Review ${z(E.length,`change`)}`,onClick:()=>void D(),children:[(0,F.jsx)(l,{"aria-hidden":`true`}),`Review (`,E.length,`)`]}),head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:f(O,`w-10`),children:(0,F.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,F.jsx)(`th`,{className:O,children:`Change`}),(0,F.jsx)(`th`,{className:O,children:`Existing case`}),(0,F.jsx)(`th`,{className:O,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=B(e);return(0,F.jsxs)(`tr`,{className:w,children:[(0,F.jsx)(`td`,{className:A,children:(0,F.jsx)(N,{"aria-label":`${V(e)}: ${e.id} ${e.title}`,checked:h.includes(t),disabled:y||!!_,onCheckedChange:e=>g(e?[...h,t]:h.filter(e=>e!==t))})}),(0,F.jsxs)(`td`,{className:f(A,`whitespace-nowrap font-medium`),children:[V(e),e.link&&e.kind!==`link`&&(0,F.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,F.jsxs)(`td`,{className:f(A,`[overflow-wrap:anywhere]`),children:[(0,F.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,F.jsx)(`td`,{className:f(A,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),_&&(0,F.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,F.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,z(_.changes.length,`change`),` to `,I.find(e=>e.id===i.system)?.label,`?`]}),(0,F.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:_.lines.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(p,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void k(),children:[(0,F.jsx)(n,{"aria-hidden":`true`}),`Apply`]}),(0,F.jsxs)(p,{size:`sm`,disabled:y,onClick:()=>v(null),children:[(0,F.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]})]}),x&&x.applied.length>0&&(0,F.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,x.applied.join(`, `)]}),x&&x.failed.length>0&&(0,F.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,x.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,F.jsx)(W,{id:`changes-h`,icon:r,title:`Recent changes`,children:i.changes.length?(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function K({sub:t}){let{systems:n,error:r}=U(),i=t?t.indexOf(`/`):-1,a=i>0?t.slice(0,i):t,o=L(a)?a:void 0,s=o&&i>0?_(t.slice(i+1)):``,[c,l]=(0,P.useState)(o??`azure_devops`),[d,h]=(0,P.useState)(s),[y,x]=(0,P.useState)(null),[w,T]=(0,P.useState)(``),[O,A]=(0,P.useState)(!1);(0,P.useEffect)(()=>{o&&l(o),h(s)},[o,s]),(0,P.useEffect)(()=>{!o&&n.length&&!n.some(e=>e.id===c)&&l(n[0].id)},[n,c,o]);let j=(0,P.useCallback)(()=>{!o||!s?x(null):(A(!0),m.view(o,s).then(e=>{x(e),T(``),A(!1)},e=>{T(e.message),A(!1)}))},[o,s]);return(0,P.useEffect)(()=>x(null),[o,s]),(0,P.useEffect)(j,[j]),(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(D,{}),(0,F.jsxs)(`main`,{className:f(k,`@container flex-auto gap-4`),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(C,{pixel:E[`test-cases`],size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,F.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] 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,F.jsx)(`a`,{href:v(`regression`),children:`Regression`}),`; their results on `,(0,F.jsx)(`a`,{href:v(`runs`),children:`Runs`}),`.`]}),(0,F.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=v(`test-cases`,c,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,F.jsx)(S,{items:n,value:c,onChange:l})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,F.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,F.jsx)(g,{value:d,maxLength:120,spellCheck:!1,placeholder:c===`azure_devops`?`1234`:c===`qtest`?`5678`:c===`testrail`?`R12`:`SHOP-12`,onChange:e=>h(e.target.value)})]}),(0,F.jsxs)(p,{type:`submit`,variant:`primary`,disabled:!d.trim()||O,"data-tip":`Open the story's test cases`,children:[(0,F.jsx)(u,{"aria-hidden":`true`}),`Open`]})]})]}),[r,w].filter(Boolean).map(e=>(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),O&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),y&&(0,F.jsx)(G,{view:y,onApplied:j,onError:T},`${y.system}:${y.story.id}`),!s&&!y&&(0,F.jsx)(b,{icon:e,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.`})]})]})}export{K as TestCases};
@@ -1,2 +0,0 @@
1
- import{Ar as e,C as t,D as n,Fr as r,Ir as i,Mn as a,Nr as o,Q as s,Qn as c,T as l,a as u,it as d,ln as f,pr as p,tt as m,yt as h}from"./line-icons-CQ-3V8ax.js";import{B as g,R as _,V as v,a as y,c as b,f as x,h as S,l as C,o as w,qt as T,rt as E,st as D,t as O,z as k}from"./filters-mFECJpMB.js";import{Et as A,et as j,gt as M,it as N,nt as P,ot as ee,r as te,rt as F,t as I,tt as L}from"./frame-DiKY0GWx.js";import{r as R}from"./index-HjX2EOmp.js";import{n as z}from"./segmented-DANusepM.js";import{a as B,c as V,f as H,i as U,n as W,o as G,r as K,s as q,t as J,u as ne}from"./dataParts-DpVitZdm.js";var re=r({Requests:()=>$,TestData:()=>le}),Y=i(o(),1),X=T(),Z=[`requests`,`kept`,`specs`,`batches`],Q={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},ie=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function ae({e,kept:t,busy:n,act:r}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,X.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,X.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked the DB agent for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,X.jsxs)(X.Fragment,{children:[` · `,(0,X.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.name})]}):null]}),e.why&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,X.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,X.jsx)(V,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,X.jsx)(ne,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,X.jsx)(W,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,X.jsx)(W,{label:`INSERT script`,children:e.script_preview.join(`
2
- `)})]}):null,t&&e.name&&(0,X.jsx)(`div`,{children:(0,X.jsxs)(_,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,X.jsx)(a,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:t,busy:r,act:i}){let[a,o]=(0,Y.useState)(`all`),[s,c]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),_=t??[],v=(0,Y.useMemo)(()=>[...new Set(_.map(e=>e.requester))].sort(),[t]),y=(0,Y.useMemo)(()=>[...new Set(_.map(e=>e.database).filter(Boolean))].sort(),[t]),S=_.filter(e=>!e.ok).length,T=_.filter(e=>(a===`all`||a===`ok`===e.ok)&&(!s||e.requester===s)&&(!u||e.database===u)),E=new Set(e.requests.map(e=>e.name));return t===null?(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):_.length?(0,X.jsx)(j,{label:`Requests`,resetKey:`${a}|${s}|${u}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{value:a,onChange:o,items:[{id:`all`,label:`All`,n:_.length},{id:`ok`,label:`Answered`,n:_.length-S},{id:`failed`,label:`Failed`,n:S,alert:!0}]}),v.length>1&&(0,X.jsxs)(w,{size:`sm`,"aria-label":`Who asked`,value:s,onChange:e=>c(e.target.value),className:`w-[180px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Anyone`}),v.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),y.length>1&&(0,X.jsxs)(w,{size:`sm`,"aria-label":`Database`,value:u,onChange:e=>d(e.target.value),className:`w-[160px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Any database`}),y.map(e=>(0,X.jsx)(`option`,{children:e},e))]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:g(F,`w-9`),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,X.jsx)(`th`,{className:g(F,`w-[110px]`),children:`When`}),(0,X.jsx)(`th`,{className:g(F,`w-[150px]`),children:`Who asked`}),(0,X.jsx)(`th`,{className:F,children:`What for`}),(0,X.jsx)(`th`,{className:g(F,`w-[110px]`),children:`Database`}),(0,X.jsx)(`th`,{className:g(F,`w-[140px]`),children:`Answer`}),(0,X.jsx)(`th`,{className:g(N,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:T.map(e=>{let t=p===e.id;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`tr`,{className:g(ee,t&&`bg-surface-muted`),onClick:()=>m(t?``:e.id),children:[(0,X.jsx)(`td`,{className:g(L,`pr-0`),children:(0,X.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Close the request`:`Open the request`,onClick:n=>(n.stopPropagation(),m(t?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:t?(0,X.jsx)(l,{size:16,"aria-hidden":`true`}):(0,X.jsx)(n,{size:16,"aria-hidden":`true`})})}),(0,X.jsx)(`td`,{className:g(L,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:R(e.at)}),(0,X.jsx)(`td`,{className:g(L,`truncate`),"data-tip":e.requester,children:e.requester}),(0,X.jsxs)(`td`,{className:g(L,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,X.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,X.jsx)(`td`,{className:g(L,`truncate`),"data-tip":e.database,children:e.database||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:g(L,`whitespace-nowrap`),children:(0,X.jsx)(b,{tone:e.ok?`pass`:`fail`,children:e.ok?G[e.kind||``]||`Answered`:`Failed`})}),(0,X.jsx)(`td`,{className:P,children:e.ok?ie(e):``})]}),t&&(0,X.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,X.jsx)(`td`,{colSpan:7,className:`max-w-0 px-4 py-2`,children:(0,X.jsx)(ae,{e,kept:!!e.name&&E.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,X.jsx)(C,{icon:h,title:`No test data asked for yet`,action:(0,X.jsxs)(`a`,{href:x(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(k({size:`sm`}),`no-underline`),children:[(0,X.jsx)(f,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function oe({view:e,job:t,busy:n,act:r,onNote:i}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,X.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,X.jsx)(V,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,X.jsx)(J,{r:s,onNote:i})]}),e.requests.length===0?(0,X.jsxs)(C,{className:`py-3`,children:[`No kept requests yet. Each request the DB agent answers is kept here; `,(0,X.jsx)(`a`,{href:x(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,X.jsx)(q,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,G[e.kind],e.rows?` · ${v(e.rows,`row`)}`:``,e.created?` · ${R(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,X.jsx)(_,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,X.jsx)(a,{"aria-hidden":`true`})})]},e.name)})]})}function se({view:t,job:n,busy:r,act:i,onNote:a}){let[o,c]=(0,Y.useState)(t.specs[0]??``),[l,u]=(0,Y.useState)(``),[p,g]=(0,Y.useState)(``),[v,b]=(0,Y.useState)(`csv`),[T,D]=(0,Y.useState)(!1),O={spec:o,...l?{db:l}:{},...p?{seed:p}:{}},k=n&&!n.running?n:null,A=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===o?k.result:void 0,j=t.databases.find(e=>e.name===l),M=async()=>{try{let{id:e}=await E.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=x(`chats`,e)}catch(e){a(e.message)}};return(0,X.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(S,{icon:h,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,X.jsxs)(_,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,X.jsx)(f,{"aria-hidden":`true`}),`Chat`]})]}),(0,X.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),t.specs.length===0?(0,X.jsx)(C,{className:`py-3`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1.5 text-sm font-medium`,children:[`Spec`,(0,X.jsx)(w,{value:o,onChange:e=>c(e.target.value),children:t.specs.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,X.jsxs)(w,{value:l,onChange:e=>u(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`The spec's own`}),t.databases.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,X.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-1.5 text-sm font-medium`,children:[`Seed`,(0,X.jsx)(y,{value:p,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(_,{variant:T?void 0:`primary`,disabled:r||!o,onClick:()=>i(`gen`,O),children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Preview`]}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsxs)(_,{disabled:r||!o,onClick:()=>i(`gen`,{...O,mode:`files`,format:v}),"data-tip":`Write files (${v})`,children:[(0,X.jsx)(m,{"aria-hidden":`true`}),`Export`]}),(0,X.jsx)(w,{"aria-label":`File format`,value:v,onChange:e=>b(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(_,{disabled:r||!o||!j?.writable,"data-tip":j?.writable?`Insert into ${j.name}`:`Pick a writable database to insert into`,onClick:()=>D(!0),children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Insert`]})]}),T&&j&&(0,X.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-3 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,o,` into `,j.name,`?`]}),(0,X.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(_,{variant:`primary`,onClick:()=>{D(!1),i(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Insert`]}),(0,X.jsxs)(_,{onClick:()=>D(!1),"data-tip":`Don't insert`,children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Cancel`]})]})]}),A&&!A.ok&&(0,X.jsx)(V,{text:A.error||`It did not make the data.`}),A?.ok&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A.batch&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:A.batch}),`.`]}),A.files?.length?(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,A.files.map(e=>(0,X.jsx)(K,{file:e,onNote:a},e))]}):null,(0,X.jsx)(U,{r:A})]})]})]})}function ce({view:e,job:n,busy:r,act:i}){let a=e.databases.filter(e=>e.writable),[o,s]=(0,Y.useState)(a[0]?.name??``),[l,u]=(0,Y.useState)(``),f=n&&!n.running?n:null,m=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,X.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(S,{icon:c,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,X.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),a.length===0?(0,X.jsx)(C,{className:`py-3`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(w,{"aria-label":`Database`,value:o,onChange:e=>s(e.target.value),className:`w-[220px]`,children:a.map(e=>(0,X.jsx)(`option`,{children:e.name},e.name))}),(0,X.jsxs)(_,{disabled:r||!o,onClick:()=>i(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Show`]})]}),m&&m.length===0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),m&&m.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:m.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,X.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[(0,X.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:R(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),l===e.batch?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,X.jsxs)(_,{variant:`danger`,size:`sm`,onClick:()=>{u(``),i(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:[(0,X.jsx)(p,{"aria-hidden":`true`}),`Remove`]}),(0,X.jsxs)(_,{size:`sm`,onClick:()=>u(``),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),`Keep`]})]}):(0,X.jsx)(_,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,X.jsx)(p,{"aria-hidden":`true`})})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function le({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=H(),[s,c]=(0,Y.useState)(null),[l,d]=(0,Y.useState)(``),p=Z.includes(e)?e:`requests`,m=o&&!o.running?o.endedAt:``;(0,Y.useEffect)(()=>{D.log().then(c,e=>d(e.message))},[m]);let h=(s||[]).filter(e=>!e.ok).length,_=new Set((s||[]).map(e=>e.requester)).size,y={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,X.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,X.jsx)(te,{}),(0,X.jsxs)(`main`,{className:g(I,`@container flex-auto gap-4`),children:[(0,X.jsxs)(`a`,{href:x(`data`,`databases`),className:`inline-flex w-fit items-center gap-1.5 text-sm`,children:[(0,X.jsx)(u,{size:16,"aria-hidden":`true`}),`All databases`]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(A,{pixel:M[`test-data`],size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test data`}),(0,X.jsxs)(`a`,{href:x(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(k(),`no-underline`),children:[(0,X.jsx)(f,{"aria-hidden":`true`}),`Ask`]})]}),(0,X.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what the DB agent sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[v(s.length,`request`),` · `,v(_,`asker`),` · `,(0,X.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||l)&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||l}),!t&&!n&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{label:`Test data`,current:p,onPick:e=>location.hash=x(`test-data`,e),tabs:Z.map(e=>({id:e,label:y[e]}))}),o&&(o.running?Q[o.kind]!==void 0:Q[o.kind]===p)&&(0,X.jsx)(B,{job:o,onStop:a}),(0,X.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,children:[p===`requests`&&(0,X.jsx)($,{view:t,log:s,busy:r,act:i}),p===`kept`&&(0,X.jsx)(oe,{view:t,job:o,busy:r,act:i,onNote:d}),p===`specs`&&(0,X.jsx)(se,{view:t,job:o,busy:r,act:i,onNote:d}),p===`batches`&&(0,X.jsx)(ce,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{re as n,$ as t};
@@ -1 +0,0 @@
1
- import{$t as e,Ir as t,J as n,L as r,M as i,Mn as ee,Nr as a,gr as o,j as s,nr as te,o as c,vr as ne}from"./line-icons-CQ-3V8ax.js";import{B as l,R as u,a as re,f as d,l as f,nt as p,o as m,qt as h,rt as g,t as _,z as v}from"./filters-mFECJpMB.js";import{Et as ie,et as y,gt as ae,r as oe,t as b}from"./frame-DiKY0GWx.js";import{r as x}from"./index-HjX2EOmp.js";import{_ as S,o as C}from"./qualityParts-jsPhayON.js";var w=t(a(),1),T={view:()=>p(`GET`,`/api/testdebt`),refresh:()=>p(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>p(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},E=h(),D=[`untested`,`signal`,`duplicates`,`cases`],O={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},k={test:`Test`,recording:`Recording`,case:`Test case`},se={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},A={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},j=e=>`${Math.round(e*100)}%`,M=e=>D.includes(e)?e:`untested`;function N({part:e,what:t,action:n}){return(0,E.jsxs)(f,{icon:o,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,E.jsx)(c,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function P({text:e,tip:t}){return(0,E.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function F({sub:t}){let[a,o]=(0,w.useState)(null),[p,h]=(0,w.useState)(``),[D,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(``),R=M(t),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(`manual`),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(``);(0,w.useEffect)(()=>{T.view().then(e=>{o(e),h(``)},e=>h(e.message))},[]);let q=(0,w.useCallback)(async(e,t)=>{F(!0),L(``);try{o(await e()),h(``),t&&L(t)}catch(e){h(e.message)}finally{F(!1)}},[]),ce=async e=>{if(e){F(!0);try{let{id:t}=await g.start(e,{});location.hash=d(`chats`,t)}catch(e){h(e.message),F(!1)}}},J=(e,t)=>(0,E.jsx)(u,{size:`icon`,variant:`icon`,className:`size-8`,disabled:D||!e,onClick:()=>void ce(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,E.jsx)(te,{"aria-hidden":`true`})}),Y=a?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=U||Y[0]?.id||``,Z=a?.cases.filter(e=>!e.automated).length??0,le=a?.areas.filter(e=>z===`all`||e.kind===z)??[],ue=a?.cases.filter(e=>V===`all`||(V===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-3 text-right tabular-nums`,$={untested:(a?.areas.length??0)+(a?.rules.length??0),signal:(a?.quiet.length??0)+(a?.gone.length??0),duplicates:a?.duplicates.length??0,cases:Z};return(0,E.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,E.jsx)(oe,{}),(0,E.jsxs)(`main`,{className:l(b,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(ie,{pixel:ae[`test-debt`],size:`lg`}),(0,E.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),a&&(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,E.jsxs)(`span`,{"data-tip":S(a.at),children:[`Worked out `,x(a.at)]}),(0,E.jsxs)(u,{size:`sm`,disabled:D,onClick:()=>void q(T.refresh,`Worked out again.`),children:[(0,E.jsx)(ee,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,E.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] 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,E.jsx)(`a`,{href:d(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,a?.repo&&a.repo!==`.`?(0,E.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:a.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.`]}),p&&(0,E.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),!a&&!p&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),I&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:I}),a&&(0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.jsx)(C,{label:`Untested code`,value:a.graph.state===`ok`?a.areas.length:`–`,tone:a.areas.length?`text-warn`:void 0,sub:a.graph.state===`ok`?`of ${a.graph.checked} areas`:`graph not built`}),(0,E.jsx)(C,{label:`Untested rules`,value:a.rules.length,tone:a.rules.length?`text-warn`:void 0,sub:`of ${a.graph.rulesChecked} rules`}),(0,E.jsx)(C,{label:`Never fail`,value:a.quiet.length,sub:`30 passes in a row`}),(0,E.jsx)(C,{label:`Code gone`,value:a.gone.length,tone:a.gone.length?`text-fail`:void 0,sub:`of ${a.files.count} files listed`}),(0,E.jsx)(C,{label:`Near-duplicates`,value:a.duplicates.length,sub:`from ${j(a.threshold)} alike`}),(0,E.jsx)(C,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${a.cases.length} test cases`})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:R,onChange:e=>location.hash=d(`test-debt`,e)})}),a.notes.map(e=>(0,E.jsx)(`p`,{className:`m-0 text-[12.5px] text-ink-2`,children:e},e)),R===`untested`&&(0,E.jsxs)(E.Fragment,{children:[a.graph.state===`ok`?(0,E.jsx)(y,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:z,empty:a.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`all`,label:`All`,n:a.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${O[e]}s`,n:a.areas.filter(t=>t.kind===e).length}))],value:z,onChange:B})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[34%] py-1.5 pr-3 pl-3 font-medium`,children:`Code`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Kind`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Used by`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:le.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:O[e.kind]}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:l(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,O[e.kind].toLowerCase())})]},e.id))}):(0,E.jsx)(N,{part:a.graph,what:`product graph`,action:{label:`Product`,to:d(`product`)}}),(0,E.jsx)(y,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:a.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Rule`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`From`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Where`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Closest test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.rules.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(i,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,E.jsx)(P,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] 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,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2 @xl:table-cell`,children:(0,E.jsx)(P,{text:e.where})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.nearest?(0,E.jsx)(P,{text:`${e.nearest.name} (${j(e.nearest.score)})`,tip:`${j(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`rule`)})]},e.id))})]}),R===`signal`&&(a.history.state===`ok`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[50%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Passes`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Since`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.quiet.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(s,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,E.jsx)(P,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,E.jsx)(`td`,{className:l(Q,`text-muted`),children:e.runs}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.since?S(e.since):void 0,children:e.since?x(e.since):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))}),(0,E.jsx)(y,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${a.files.count} files, listed by ${a.files.by===`git`?`git`:`walking the folder`}).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`w-[40%] py-1.5 pr-3 pl-3 font-medium`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`File`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Last run`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.gone.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,E.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(r,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,E.jsx)(P,{text:e.name})]})}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3 font-mono text-[12px] text-ink-2`,children:(0,E.jsx)(P,{text:e.file})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`,"data-tip":e.last?S(e.last):void 0,children:e.last?x(e.last):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`test`)})]},e.key))})]}):(0,E.jsx)(N,{part:a.history,what:`test history`,action:{label:`Regression`,to:d(`regression`)}})),R===`duplicates`&&(0,E.jsx)(y,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${j(a.threshold)} of their words (${a.compared} pairs compared).`,head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 text-right font-medium`,children:`Alike`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`First`}),(0,E.jsx)(`th`,{className:`w-[30%] py-1.5 pr-3 font-medium`,children:`Second`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Shared words`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:a.duplicates.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:l(Q,`pl-3`,e.score>=.85?`text-warn`:`text-muted`),children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,E.jsx)(n,{size:14,"aria-hidden":`true`}),j(e.score)]})}),[e.a,e.b].map((e,t)=>(0,E.jsxs)(`td`,{className:`max-w-0 py-2 pr-3`,children:[(0,E.jsx)(P,{text:e.name,tip:`${k[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,E.jsx)(`span`,{className:`block text-[12px] text-muted`,children:k[e.kind]})]},t)),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:(0,E.jsx)(P,{text:e.shared.join(`, `)})}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),R===`cases`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,E.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:a.sources.map(e=>(0,E.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,E.jsx)(s,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,E.jsx)(i,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,E.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,E.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${x(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))})]}),Y.length>0&&(0,E.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>T.readCases(X,G.trim()),`Test cases read.`)},children:[(0,E.jsx)(m,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>W(e.target.value),children:Y.map(e=>(0,E.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,E.jsx)(re,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?A[X]:``,value:G,maxLength:80,onChange:e=>K(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,E.jsxs)(u,{size:`sm`,type:`submit`,disabled:D||!G.trim(),"data-tip":`Read the test cases`,children:[(0,E.jsx)(ne,{"aria-hidden":`true`}),`Import`]})]}),a.cases.length?(0,E.jsx)(y,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:V,empty:`Nothing matches.`,tools:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,E.jsx)(_,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:a.cases.length-Z},{id:`all`,label:`All`,n:a.cases.length}],value:V,onChange:H})}),head:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Case`}),(0,E.jsx)(`th`,{className:`w-[36%] py-1.5 pr-3 font-medium`,children:`Title`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Source`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Automated`}),(0,E.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Test`}),(0,E.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,E.jsx)(`td`,{className:`py-2 pr-3 pl-3 font-mono text-[12.5px] whitespace-nowrap`,children:/^https?:\/\//i.test(e.url)?(0,E.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,E.jsx)(`td`,{className:`max-w-0 py-2 pr-3`,children:(0,E.jsx)(P,{text:e.title||`–`})}),(0,E.jsx)(`td`,{className:`hidden py-2 pr-3 text-[12.5px] whitespace-nowrap @xl:table-cell`,"data-tip":`From ${e.scope}`,children:se[e.source]}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-[12.5px] whitespace-nowrap`,children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,"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,E.jsx)(s,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,E.jsx)(i,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,E.jsx)(`td`,{className:`hidden max-w-0 py-2 pr-3 text-[12.5px] text-ink-2 @2xl:table-cell`,children:e.test?(0,E.jsx)(P,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,E.jsx)(`td`,{className:`py-2 pr-3 text-right whitespace-nowrap`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,E.jsx)(f,{icon:e,title:`No test cases yet`,action:(0,E.jsxs)(`a`,{className:v({size:`sm`}),href:d(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,E.jsx)(c,{"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.`})]})]})]})]})}export{F as TestDebt};
@@ -1,3 +0,0 @@
1
- import{$n as e,$t as t,A as n,An as r,Ar as i,At as a,Bn as o,C as s,Dn as c,Dt as l,Fn as u,Gn as d,Ht as f,Ir as p,Kt as m,L as h,Mn as g,Nr as _,Or as v,T as y,Un as b,Zn as x,a as S,gr as C,gt as w,hn as T,j as E,kr as D,lt as O,m as k,o as ee,ot as te,pr as ne,rt as re,tn as A,tt as j,wr as ie,wt as ae}from"./line-icons-CQ-3V8ax.js";import{B as M,R as N,Ut as P,Wt as F,Z as oe,_ as se,a as I,c as L,d as R,f as z,h as B,i as V,l as H,m as ce,n as U,o as W,qt as le,r as G,s as ue,t as de}from"./filters-mFECJpMB.js";import{Dt as fe,Et as pe,L as me,N as he,Ot as ge,at as _e,et as ve,gt as ye,it as be,nt as xe,ot as Se,r as Ce,rt as K,t as we,tt as q,z as Te}from"./frame-DiKY0GWx.js";import{B as Ee,M as De,N as Oe,c as ke,r as Ae,s as J,z as je}from"./index-HjX2EOmp.js";import{n as Me,t as Ne}from"./segmented-DANusepM.js";import{n as Pe}from"./families-B0QIuAe3.js";import{t as Fe}from"./fold-HnodvJWj.js";import{r as Ie,s as Le,t as Re}from"./logos-CNarWSPL.js";import{d as ze,o as Be,p as Ve,r as He,s as Ue,t as We}from"./parts-z_AE9U-M.js";import{a as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,l as Qe,m as Y,o as $e,p as et,r as tt,s as nt,t as rt,u as it}from"./Steps-DjR_K32c.js";var X=p(_(),1),Z=le(),at=500,ot=10;function st({plan:e,acceptLimits:t,next:n,again:r,onClose:a,onStarted:o}){let s=e.units.filter(e=>e.kind===`test`).length,[l,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!!n),[m,h]=(0,X.useState)(String(n?.size||ot)),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=Number(m),x=Number.isInteger(b)&&b>=1&&b<=at,S=async()=>{_(!0),y(``);try{o((await P.start(e.id,l,t,f?b:void 0)).detail)}catch(e){y(e.message),_(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:a,title:n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,description:n?`${(b||n.size)>=n.left?`The last ${n.left===1?`test case`:`${n.left} test cases`} not tried yet ${n.left===1?`is`:`are`}`:`The next ${b||n.size} of the ${n.left} test cases not tried yet are`} written as ${e.target.title} tests in ${e.target.dir}. What is done is kept; a failed test stays for you to fix.`:r?`ForgeQE picks up where the conversion stopped: what is done and unchanged is kept, the rest is written as ${e.target.title} tests in ${e.target.dir}. It runs in the background.`:`The Tosca test cases are written as ${e.target.title} tests in ${e.target.dir}, and ForgeQE runs each one. It runs in the background; the Tosca export is not changed.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:a,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,disabled:g||l!==e.id||f&&!x,onClick:()=>void S(),"data-tip":n?`Continue with the next batch`:r?`Start the conversion again`:`Start the conversion`,children:[r?(0,Z.jsx)(u,{"aria-hidden":`true`}):(0,Z.jsx)(c,{"aria-hidden":`true`}),n?`Continue`:r?`Start again`:`Start`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&s>1&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:f,onCheckedChange:p}),(0,Z.jsxs)(`span`,{children:[`Convert in batches`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`A few test cases at a time, stopping after each batch so you can check them before the next.`})]})]}),f&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{children:`Test cases per batch`}),(0,Z.jsx)(I,{type:`number`,min:1,max:at,step:1,inputMode:`numeric`,value:m,"aria-invalid":!x,"aria-describedby":x?void 0:`batch-size-error`,onChange:e=>h(e.target.value),className:`w-24`}),!x&&(0,Z.jsxs)(`p`,{id:`batch-size-error`,role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:[`A whole number from 1 to `,at,`.`]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(I,{value:l,onChange:e=>d(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(Ze,{error:v})]})})}function ct(e){if(e.job?.running)return{label:e.job.kind===`fix`?`Fixing`:e.job.kind===`verify`?`Running tests`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:`Running`,tone:`running`}:t?Ge[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:qe[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function lt({d:e,onClose:t}){let n=(e.plan.sources||[]).some(e=>e.workspace),[r,i]=(0,X.useState)(n),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),l=async()=>{o(!0),c(``);try{let t=await P.reimport(e.plan.id,n&&r);location.hash=z(`tosca`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:t,title:`Read the exports again`,description:`A new plan from the same exports, into the same folder. Test cases unchanged in Tosca keep their tests; changed and new ones are converted; ones no longer there are listed. Nothing is written until you start it.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Z.jsx)(N,{variant:`primary`,disabled:a,onClick:()=>void l(),children:a?`Reading…`:`Make the new plan`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[n&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2`,children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:r,onCheckedChange:i}),(0,Z.jsxs)(`span`,{children:[`Get the newest commit of the cloned repositories`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Each is cloned again, as before; the old copy stays for this plan.`})]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s})]})})}var ut=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function dt({id:e,onClose:t}){let[n,r]=(0,X.useState)(`github`),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let t=!0;return a(null),p(!1),s(``),l(``),P.ci(e,n).then(e=>t&&a(e),e=>t&&s(e.message)),()=>{t=!1}},[e,n]);let m=i?i.file.slice(i.file.lastIndexOf(`/`)+1):``,h=()=>{if(!i)return;let e=URL.createObjectURL(new Blob([i.text],{type:`text/yaml;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=m,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},g=async()=>{d(!0),s(``);try{let t=await P.writeCi(e,n);p(!0),l(`Added ${t.file}.${n===`github`?` GitHub runs a workflow only from ${t.path}: move it there.`:` Create a pipeline from it in Azure DevOps.`}`)}catch(e){s(e.message)}finally{d(!1)}};return(0,Z.jsxs)(ge,{open:!0,wide:!0,onClose:t,title:`CI pipeline`,description:`Runs the converted tests in your CI, one job per Tosca execution list. Review it before you commit it.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:`Close`}),(0,Z.jsxs)(N,{disabled:!i,onClick:h,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Z.jsx)(N,{variant:`primary`,disabled:!i||u,onClick:()=>void g(),"data-tip":`Into the target folder's ci/, so a pull request of the conversion carries it.`,children:u?`Adding…`:`Add to the target folder`})]}),children:[(0,Z.jsx)(he,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:ut}),(0,Z.jsxs)(`div`,{id:`panel-ci-${n}`,role:`tabpanel`,"aria-labelledby":`tab-ci-${n}`,className:`flex flex-col gap-4 text-sm`,children:[!i&&!o&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Making the pipeline…`}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),c&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:c}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Jobs`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:[...i.tests?[i.suites.length?`One per Tosca execution list: ${i.suites.join(`, `)}`:`One for every test: the export has no execution lists`]:[],...i.workflows?[`One per kind of app (desktop, mobile), replaying ${Y(i.workflows,`workflow`)}`]:[]].join(`; `)}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Goes in`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.path}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To set`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[i.tests&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`BASE_URL`}),` as a variable`]}),i.secrets.length?(0,Z.jsxs)(Z.Fragment,{children:[i.tests?`; as `:`As `,n===`github`?`secrets`:`secret variables`,`: `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:i.secrets.join(`, `)})]}):null,!i.tests&&!i.secrets.length?`None`:null,i.skipped.length?(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Not passed, not a name the CI takes: `,i.skipped.join(`, `)]}):null]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px] text-muted`,children:m}),(0,Z.jsx)(ke,{text:i.text,label:`Copy ${m}`})]}),(0,Z.jsx)(`pre`,{"aria-label":m,tabIndex:0,className:`m-0 max-h-[420px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre text-ink-2`,children:i.text})]})]})]})]})}function ft({id:e,onClose:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),g=(t=``)=>P.pr(e,t).then(e=>{r(e),h(``),e.preview&&(a(e.preview),s(t=>t||e.preview.base),l(t=>t||e.preview.title))},e=>h(e.message));(0,X.useEffect)(()=>{g()},[e]),(0,X.useEffect)(()=>{if(n?.job?.state!==`running`)return;let e=setTimeout(()=>void g(o),1e3);return()=>clearTimeout(e)},[n]);let _=async()=>{p(!0),h(``);try{let t=await P.openPr(e,{base:o.trim(),title:c.trim(),draft:u});r(e=>e&&{...e,job:t.job})}catch(e){h(e.message)}finally{p(!1)}},v=i,y=n?.job,b=y?.state===`running`,x=y?.state===`done`?y.result:void 0,S=m||(y?.state===`failed`?y.error:``)||(n&&!n.preview?n.problem:``)||``,C=e=>/^https:\/\//.test(e)?e:void 0,w=(e,t)=>(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 text-accent-fg`,children:[t,(0,Z.jsx)(re,{size:11,"aria-hidden":`true`})]});return(0,Z.jsx)(ge,{open:!0,wide:!0,onClose:t,title:`Open a pull request`,description:`The converted tests on a branch of their own, for your team to review. ForgeQE commits in a separate copy of the repository, so your own branch and edits stay as they are, and merges nothing.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Z.jsx)(N,{variant:`primary`,disabled:!v||!n?.preview||f||b||!o.trim(),onClick:()=>void _(),children:f?`Starting…`:b?`Pushing…`:`Push and open the pull request`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-sm`,children:[!n&&!m&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Checking the repository…`}),S&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:S}),x&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-ink [overflow-wrap:anywhere]`,children:[x.existing?`Nothing new to push: this is the pull request.`:`Pushed ${Y(x.files,`file`)} on ${x.branch}.`,` `,C(x.url)?w(C(x.url),`Open the pull request`):`It is open on ${x.branch}; the host gave no https address to link to.`]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1.5`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Repository`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[v.platform===`github`?`GitHub`:`Azure DevOps`,` `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.repository}),` (`,v.remote,`)`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Branch`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:v.branch}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[Y(v.files.length,`file`),` of `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:v.folder})]})]}),v.last&&C(v.last.url)&&!x&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Opened before: `,w(C(v.last.url),`the pull request`),`. Pushing again updates its branch.`]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Merge into`}),(0,Z.jsx)(I,{value:o,spellCheck:!1,maxLength:200,placeholder:`main`,"aria-invalid":!(!n||n.preview),onChange:e=>s(e.target.value),onBlur:()=>o.trim()&&o.trim()!==n?.preview?.base&&void g(o.trim()),disabled:b,className:`font-mono`})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Title`}),(0,Z.jsx)(I,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Z.jsxs)(`label`,{className:M(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Z.jsx)(J,{className:`mt-0.5`,checked:u,onCheckedChange:d,disabled:b}),(0,Z.jsxs)(`span`,{children:[`Open it as a draft`,(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Reviewers are not asked yet.`})]})]}),(0,Z.jsx)(Fe,{title:`Files (${v.files.length})`,children:(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 font-mono text-[12.5px]`,children:[v.files.slice(0,200).map(e=>(0,Z.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e)),v.files.length>200&&(0,Z.jsxs)(`li`,{className:`text-muted`,children:[`and `,v.files.length-200,` more`]})]})}),v.skipped.length>0&&(0,Z.jsx)(Fe,{title:`Left out (${v.skipped.length})`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[12.5px]`,children:v.skipped.slice(0,100).map(e=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),`: `,(0,Z.jsx)(`span`,{className:`text-muted`,children:e.why})]},e.path))})})]})]})})}function pt({id:e,title:t,targetDir:n,onClose:r}){let[i,a]=(0,X.useState)(``),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{await P.delete(e,i),location.hash=z(`tosca`,`conversions`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(ge,{open:!0,onClose:r,title:`Delete this conversion`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`}),`Keep`]}),(0,Z.jsxs)(N,{variant:`danger`,disabled:o||i!==e,onClick:()=>void d(),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Z.jsx)(I,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function mt({d:e,unit:t,onClose:n,onSend:r}){let[a,o]=(0,X.useState)(``),s=e.plan.units.find(e=>e.id===t),c=e.result?.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,title:`Fix ${s?Q(s.target):t}`,description:`The Tosca agent works on this file again, with ForgeQE's last check and your note. It runs in the background.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,onClick:()=>r(a.trim()),"data-tip":`Send to the agent`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Send`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c.problems[0]}):null,(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`What should change? (optional)`}),(0,Z.jsx)(ue,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function ht({d:e,unit:t,onClose:n}){let r=e.result?.units.find(e=>e.id===t),a=e.plan.units.find(e=>e.id===t);return(0,Z.jsx)(ge,{open:!0,onClose:n,wide:!0,title:`Output of ${a?Q(a.target):t}`,description:r?.checkedAt?`Run again ${Ve(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Z.jsxs)(N,{onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Close`]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r?.problems?.length?(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.problems.join(` `)}):r?.status===`converted`?(0,Z.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`Passes, with every Tosca step in the test.`}):null,r?.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,r.command]}),(0,Z.jsx)(`pre`,{className:`m-0 max-h-[60vh] overflow-auto rounded-[12px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r?.output||`No output.`})]})})}function gt(e){let t=Object.fromEntries(nt.map(e=>[e,{status:e===`prepare`?`running`:`pending`,...e===`prepare`?{startedAt:new Date().toISOString()}:{}}]));return{status:`running`,plan:e.plan.id,target:e.plan.target,units:[],reverted:[],model:``,startedAt:e.job?.last?.startedAt||new Date().toISOString(),ms:0,stage:`prepare`,stages:t,notes:``}}function _t({label:e,children:t}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`dt`,{className:`text-[11.5px] text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`m-0 text-[13px] text-ink [overflow-wrap:anywhere] tabular-nums`,children:t})]})}function vt({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:s,onNext:l}){let u=e.result||(e.job?.running?gt(e):null);if(!u)return(0,Z.jsx)(Z.Fragment,{children:t});let d=new Map(u.units.map(e=>[e.id,e])),f=e.plan.units.filter(e=>e.kind===`test`&&!e.engine),p=e.plan.units.filter(e=>e.kind===`test`&&e.engine),m=new Set(f.map(e=>e.id)),h=new Set(p.map(e=>e.id)),g=u.units.filter(e=>m.has(e.id)&&e.status===`converted`).length,_=u.units.filter(e=>h.has(e.id)&&e.status===`written`).length,v=u.units.reduce((e,t)=>t.fidelity?{m:e.m+t.fidelity.matched,n:e.n+t.fidelity.required}:e,{m:0,n:0}),y=u.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,b=e=>u.units.filter(t=>(m.has(t.id)||h.has(t.id))&&t.status===e).length,x=f.length+p.length,S=[{label:`Failed`,n:b(`failed`),bar:`bg-fail`},{label:`Needs a look`,n:b(`blocked`),bar:`bg-warn`},{label:`Passing`,n:g,bar:`bg-pass`},{label:p.length===1?`Workflow written`:`Workflows written`,n:_,bar:`bg-line-strong`},{label:p.length?`Not done yet`:`Not run yet`,n:Math.max(0,x-u.units.filter(e=>m.has(e.id)||h.has(e.id)).length),bar:`bg-line`}],[C,...w]=e.plan.target.id.split(`-`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:f.length?`${g} of ${f.length} passing`:`${_} of ${Y(p.length,`workflow`)} written`}),S.filter(e=>e.n>0).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,Z.jsx)(`span`,{className:M(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:M(`tabular-nums`,e.label===`Failed`?`text-fail`:``),children:e.n})]},e.label))]}),(0,Z.jsx)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-surface-strong`,"aria-hidden":`true`,children:S.map(e=>e.n?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${e.n/Math.max(1,x)*100}%`}},e.label):null)}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-x-6 gap-y-2 @3xl:grid-cols-4`,children:[(0,Z.jsx)(_t,{label:u.status===`running`?`Running for`:`Took`,children:ze(u.status===`running`?Date.now()-Date.parse(u.startedAt):u.ms)}),(0,Z.jsx)(_t,{label:`Tosca steps in the tests`,children:(0,Z.jsx)(`span`,{className:v.n&&v.m===v.n?`text-pass`:void 0,children:v.n?`${v.m} of ${v.n}`:`–`})}),(0,Z.jsx)(_t,{label:`Need attention`,children:(0,Z.jsx)(`span`,{className:y?`text-fail`:void 0,children:y})}),(0,Z.jsx)(_t,{label:`Pages`,children:Y(e.plan.units.filter(e=>e.kind===`page`).length,`page object`)})]})]}),u.notes&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u.notes}),u.batch&&u.batch.left>0&&u.status!==`running`&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2 text-sm text-ink`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Batch `,u.batch.runs,` is done. Check its tests, then continue: `,Y(u.batch.left,`test case`),` not tried yet.`]}),(0,Z.jsxs)(N,{size:`sm`,disabled:n,onClick:l,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Continue with the next batch`]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(`div`,{className:`@container min-w-0`,children:(0,Z.jsx)(ve,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,height:`min(58vh, 580px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:K,children:`File`}),(0,Z.jsx)(`th`,{className:K,children:`Status`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @3xl:table-cell`),children:`Note`}),(0,Z.jsx)(`th`,{className:K,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let s=d.get(t.id),c=s?it[s.status]:null,l=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsxs)(`td`,{className:q,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:Q(t.target)}),(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[l?t.engine?`${Xe(t)} · ${l.name}`:l.name:`${Xe(t)} · ${t.target}`,l?.suites?.length?` · ${l.suites.join(`, `)}`:``]})]}),(0,Z.jsxs)(`td`,{className:M(q,`whitespace-nowrap`),children:[c?(0,Z.jsx)(L,{tone:c.tone,children:c.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`}),s?.checkedAt&&(0,Z.jsxs)(`span`,{className:`block pt-1 text-[12px] text-muted`,children:[`Run again `,Ae(s.checkedAt)]})]}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] whitespace-nowrap @2xl:table-cell`),children:s?.fidelity?(0,Z.jsxs)(`span`,{className:s.fidelity.missing.length?`text-fail`:`text-ink-2`,children:[s.fidelity.matched,` of `,s.fidelity.required]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:s?.problems?.[0]||s?.reason||``})}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap text-right`),children:(0,Z.jsxs)(`span`,{className:`inline-flex gap-1`,children:[t.kind===`test`&&(s?.output||s?.problems?.length)&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Output of ${Q(t.target)}`,"data-tip":`Output of ${Q(t.target)}`,onClick:()=>a(t.id),children:(0,Z.jsx)(o,{"aria-hidden":`true`})}),t.case&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,"aria-label":`Steps of ${Q(t.target)}`,"data-tip":`Steps of ${Q(t.target)}`,onClick:()=>i(t.case),children:(0,Z.jsx)(A,{"aria-hidden":`true`})}),s&&(s.status===`failed`||s.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Fix ${Q(t.target)}`,"data-tip":`Fix ${Q(t.target)}`,onClick:()=>r(t.id),children:(0,Z.jsx)(D,{"aria-hidden":`true`})})]})})]},t.id)})})}),(0,Z.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm @5xl:sticky @5xl:top-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`Tricentis Tosca`,e.plan.source.project?` · ${e.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.plan.source.file})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:C,language:w.join(`-`)}),e.plan.target.title]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(e.plan.suites||[]).length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Suites`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.plan.suites.map(e=>{let t=new Set(e.cases),r=u.units.filter(e=>e.kind===`test`&&e.case&&t.has(e.case)&&e.status===`converted`).length;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Z.jsxs)(`span`,{className:M(`text-[12px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Y(e.cases.length,`test`),` pass · @`,e.tag]})]}),(0,Z.jsx)(N,{variant:`icon`,size:`icon-sm`,disabled:n,"aria-label":`Run the ${e.name} suite`,"data-tip":`Run the ${e.name} suite`,onClick:()=>s(e.name),children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]},e.name)})})]}),e.plan.env.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Environment variables`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.plan.env.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[e.name,e.secret?(0,Z.jsx)(`span`,{className:`font-sans text-muted`,children:` · secret`}):null]}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.from})]},e.name))})]}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Z.jsx)(`dd`,{className:`m-0 text-right`,children:Ve(u.startedAt)}),u.model&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Z.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":u.model,children:u.model})]}),u.reverted.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Z.jsxs)(`dd`,{className:`m-0 text-right`,children:[u.reverted.length,` edits outside the target`]})]})]})]})]})]})}var yt={fail:{icon:h,cls:`text-fail`,label:`Failed`},ok:{icon:E,cls:`text-pass`,label:`Done`},info:{icon:f,cls:`text-muted`,label:`Info`},agent:{icon:k,cls:`text-accent-fg`,label:`Agent`},tool:{icon:D,cls:`text-muted`,label:`Tool`}};function bt(e,t){let n=new Map;for(let r of e){let e=r.unit?`u:${r.unit}`:`s:${r.stage}`,i=n.get(e);if(!i){let a=r.unit?t.plan.units.find(e=>e.id===r.unit):void 0,o=a?.case?t.plan.cases.find(e=>e.id===a.case):void 0;i=a?{key:e,title:a.kind===`test`?o?.name||a.case||a.id:a.kind===`page`?`Page object ${a.page||``}`.trim():`Set-up`,sub:`${a.id} · ${Xe(a)} · ${a.target}`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:Ke[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var xt=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function St({d:e,events:t,running:n}){let r=(0,X.useRef)(null),i=(0,X.useRef)(!0),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(`all`),[l,u]=(0,X.useState)({}),d=bt(t,e),f=a.trim().toLowerCase(),p=e=>(s===`all`||e.kind===s)&&(!f||e.text.toLowerCase().includes(f)),m=s!==`all`||!!f,h=d.map(e=>({...e,lines:e.events.filter(p),matchTitle:!!f&&`${e.title} ${e.sub}`.toLowerCase().includes(f)})).map(e=>({...e,lines:e.matchTitle?e.events.filter(e=>s===`all`||e.kind===s):e.lines})).filter(e=>e.lines.length),g=e=>t.filter(t=>t.kind===e).length,_=d[d.length-1]?.key;return(0,X.useEffect)(()=>{n&&!m&&i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t.length,n,m]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,Z.jsx)(de,{items:[{id:`all`,label:`All`,n:t.length},{id:`fail`,label:`Failed`,n:g(`fail`),alert:!0},{id:`ok`,label:`Done`,n:g(`ok`)},{id:`info`,label:`Info`,n:g(`info`)},{id:`agent`,label:`Agent`,n:g(`agent`)},{id:`tool`,label:`Tools`,n:g(`tool`)}],value:s,onChange:c})]}),(0,Z.jsxs)(`div`,{ref:r,role:`log`,"aria-live":n?`polite`:void 0,"aria-label":`Activity`,onScroll:e=>{let t=e.currentTarget;i.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`flex max-h-[60vh] flex-col overflow-y-auto rounded-[12px] card border`,children:[h.map(e=>{let t=e.events.filter(e=>e.kind===`fail`).length,r=l[e.key]??(m||t>0||n&&e.key===_),i=`act-${e.key.replace(/[^A-Za-z0-9_-]/g,`-`)}`,a=e.status?it[e.status]:void 0;return(0,Z.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":i,onClick:()=>u(t=>({...t,[e.key]:!r})),className:`flex w-full min-w-0 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 py-2.5 text-left hover:bg-surface-muted`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`flex-none text-muted transition-transform`,r&&`rotate-180`)}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[12px] text-muted`,children:e.sub})]}),(0,Z.jsxs)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:[m&&e.lines.length!==e.events.length?`${e.lines.length} of ${Y(e.events.length,`line`)}`:Y(e.events.length,`line`),t>0&&(0,Z.jsxs)(`span`,{className:`text-fail`,children:[` · `,t,` failed`]})]}),a&&(0,Z.jsx)(L,{tone:a.tone,children:a.label})]}),(0,Z.jsx)(fe,{open:r,id:i,children:(0,Z.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0`,children:e.lines.map((e,t)=>{let n=yt[e.kind];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft py-2 pr-4 pl-11 text-[13px] last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-[76px] flex-none text-[12px] whitespace-nowrap text-muted tabular-nums`,children:xt(e.ts)}),(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:M(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsx)(`span`,{className:M(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:e.kind===`tool`?`font-mono text-[12px] text-muted`:`text-ink-2`),children:e.text})]},t)})})})]},e.key)}),!h.length&&(0,Z.jsx)(`p`,{className:`m-0 px-4 py-8 text-center text-sm text-muted`,children:t.length?`No line matches.`:`Nothing yet.`})]})]})}function Ct({id:t,plan:n}){let[r,i]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[l,d]=(0,X.useState)(`overview`),[f,p]=(0,X.useState)(),[m,h]=(0,X.useState)(null),[_,b]=(0,X.useState)(null),[x,C]=(0,X.useState)([]),[w,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,re]=(0,X.useState)(!1),[A,j]=(0,X.useState)(!1),[ie,ae]=(0,X.useState)(!1),[M,F]=(0,X.useState)(!1),[oe,se]=(0,X.useState)(!1),[I,R]=(0,X.useState)(!1),B=(0,X.useRef)(0),V=(0,X.useCallback)(()=>{P.detail(t).then(e=>{i(e),s(``)},e=>s(e.message));let e=B.current;P.events(t,e).then(e=>{if(e.next<B.current){B.current=0,C([]);return}let t=B.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));B.current=e.next,n.length&&C(e=>[...e,...n].slice(-2e3))},()=>{})},[t]);(0,X.useEffect)(V,[V]);let H=!!(r?.job?.running||r?.result?.status===`running`);(0,X.useEffect)(()=>{if(!H)return;let e=setInterval(V,1500);return()=>clearInterval(e)},[H,V]);let ce=(0,X.useCallback)(e=>{i(e),s(``),d(`overview`),setTimeout(V,800)},[V]),U=async e=>{E(!0),s(``);try{i(await e()),setTimeout(V,800)}catch(e){s(e.message)}finally{E(!1)}};if(!r)return o?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let W=ct(r),le=Ye(r.plan,r.result),G=r.result,ue=(G?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,de=r.plan.cases.filter(e=>e.included).length,fe=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:de?String(de):void 0,tone:ue?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,`conversions`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversions`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:Q(r.plan.source.file)}),(0,Z.jsx)(ee,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Le,{framework:r.plan.target.id.split(`-`)[0],language:r.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),r.plan.target.title]})]}),(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Tricentis Tosca`,r.plan.source.project?` · ${r.plan.source.project}`:``]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{children:[`into `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:r.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{tone:W.tone,children:W.label}),H?(0,Z.jsxs)(N,{variant:`danger`,disabled:w,onClick:()=>void U(()=>P.stop(t)),children:[(0,Z.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,Z.jsxs)(Z.Fragment,{children:[G&&(G.status===`stopped`||G.status===`failed`)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>R(!0),"data-tip":`Start this conversion again. Tests it already wrote are kept.`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Start again`]}),G&&(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>location.hash=z(`tosca`,t,`report`),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Report`]}),G&&r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Z.jsxs)(N,{disabled:w,onClick:()=>void U(()=>P.verify(t)),"data-tip":`Run every converted test again, no agent`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Run`]}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsxs)(N,{variant:`ghost`,disabled:w,"aria-haspopup":`menu`,"aria-expanded":M,onClick:()=>F(!M),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`More`,(0,Z.jsx)(y,{"aria-hidden":`true`})]}),(0,Z.jsxs)(De,{open:M,onClose:()=>F(!1),label:`More for this conversion`,side:`auto`,className:`right-0 w-[240px]`,children:[G&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),re(!0)),children:[(0,Z.jsx)(g,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Re-import`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),ae(!0)),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`CI`]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),j(!0)),children:[(0,Z.jsx)(a,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-muted`}),`Pull request`]}),(0,Z.jsx)(`div`,{role:`separator`,className:`mx-2 my-1 border-t border-line-soft`})]}),(0,Z.jsxs)(Oe,{onClick:()=>(F(!1),O(!0)),children:[(0,Z.jsx)(ne,{size:16,"aria-hidden":`true`,className:`mr-2.5 flex-none text-fail`}),(0,Z.jsx)(`span`,{className:`text-fail`,children:`Delete`})]})]})]})]})]})]}),k&&(0,Z.jsx)(lt,{d:r,onClose:()=>re(!1)}),A&&(0,Z.jsx)(ft,{id:t,onClose:()=>j(!1)}),ie&&(0,Z.jsx)(dt,{id:t,onClose:()=>ae(!1)}),I&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>R(!1),onStarted:e=>{R(!1),i(e)}}),oe&&r.result?.batch&&(0,Z.jsx)(st,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>se(!1),onStarted:e=>{se(!1),i(e)}}),D&&(0,Z.jsx)(pt,{id:t,title:`${Q(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>O(!1)}),G&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Qe,{states:G.stages})}),H&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(le)}% done`,children:[Math.round(le),`%`]})]}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Z.jsx)(Ue,{tabs:fe,tab:l,onTab:d,label:`Tosca conversion`}),(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${l}`,"aria-labelledby":`mtab-${l}`,className:`pane-swap flex min-w-0 flex-col gap-4`,children:[l===`overview`&&(0,Z.jsx)(vt,{d:r,planView:n(r,ce),busy:w||H,onFix:h,onSteps:e=>(p(e),d(`steps`)),onOutput:b,onRun:e=>void U(()=>P.verify(t,e)),onNext:()=>se(!0)}),l===`steps`&&(0,Z.jsx)(rt,{id:t,plan:r.plan,result:G,initial:f}),l===`activity`&&(0,Z.jsx)(St,{d:r,events:x,running:H})]},l),_&&(0,Z.jsx)(ht,{d:r,unit:_,onClose:()=>b(null)}),m&&(0,Z.jsx)(mt,{d:r,unit:m,onClose:()=>h(null),onSend:e=>{h(null),U(()=>P.fix(t,[m],e))}})]})}var wt=e=>e.slice(e.lastIndexOf(`/`)+1),Tt=50,Et=[{id:`failed`,label:`Failed`,bar:`bg-fail`,open:!0},{id:`attention`,label:`Needs a look`,bar:`bg-warn`,open:!0},{id:`passed`,label:`Passed`,bar:`bg-pass`,open:!1},{id:`notrun`,label:`Not run`,bar:`bg-line-strong`,open:!1},{id:`leftout`,label:`Left out`,bar:`bg-line`,open:!1}];function Dt(e){return e===`converted`?it.converted:e===`failed`?it.failed:e===`blocked`?it.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?it.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Ot(e){for(let t of nt){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function kt({planId:e,unit:t,file:n}){let r=/\.(webm|mp4)$/i.test(n),[i,a]=(0,X.useState)(!r),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(!i)return;let r=!1;return s(``),u(!1),P.evidence(e,t,n).then(e=>!r&&s(e),()=>!r&&u(!0)),()=>{r=!0}},[e,t,n,i]),(0,Z.jsxs)(`li`,{className:`flex w-[260px] max-w-full flex-col gap-1`,children:[o?r?(0,Z.jsx)(`video`,{controls:!0,autoPlay:!0,src:o,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,Z.jsx)(`img`,{src:o,alt:`Screenshot ${n}`,className:`max-h-[200px] w-full rounded-[10px] border border-line-soft object-contain`}):r&&!i?(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>a(!0),className:`h-[120px] w-full rounded-[10px] border border-line-soft bg-surface-muted`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Play video`]}):(0,Z.jsx)(`span`,{role:`status`,className:`flex h-[120px] items-center justify-center rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:l?`Not available`:`Loading…`}),(0,Z.jsx)(`span`,{className:`font-mono text-[11px] text-muted`,children:n})]})}function At({planId:e,pick:t,video:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``);(0,X.useEffect)(()=>{let n=!1;return i(null),o(``),P.reportCase(e,t.case).then(e=>!n&&i(e),e=>!n&&o(e.message)),()=>{n=!0}},[e,t.case]);let s=Dt(t.status),c=t.group===`failed`||t.group===`attention`;return(0,Z.jsxs)(`section`,{"aria-label":`Test case ${t.name}`,className:`flex min-w-0 flex-col gap-3 rounded-[12px] card border p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-1`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold [overflow-wrap:anywhere]`,children:t.name}),(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[t.file?(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:t.file}):`No file`,t.suites.length?` · ${t.suites.join(`, `)}`:``,t.folders.length?` · ${t.folders.join(` / `)}`:``]}),(t.uid||t.change)&&(0,Z.jsxs)(`p`,{className:`m-0 pt-0.5 text-[12px] text-muted [overflow-wrap:anywhere]`,children:[t.uid?(0,Z.jsxs)(`span`,{children:[`Tosca id `,(0,Z.jsx)(`span`,{className:`font-mono`,children:t.uid})]}):null,t.uid&&t.change?` · `:``,t.change?jt[t.change]:``]})]}),(0,Z.jsx)(L,{tone:s.tone,children:s.label}),t.ms>0&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:ze(t.ms)})]}),a&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),!r&&!a&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Z.jsxs)(Z.Fragment,{children:[(r.problems?.length||r.reason)&&(0,Z.jsx)(`div`,{className:M(`flex flex-col gap-1 rounded-[10px] px-3 py-2 text-[13px] [overflow-wrap:anywhere]`,c?`bg-fail-soft text-fail`:`bg-surface-muted text-ink-2`),children:(r.problems?.length?r.problems:[r.reason]).map((e,t)=>(0,Z.jsx)(`span`,{children:e},t))}),r.media.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:n?`Video and failure screenshots`:`Failure screenshots`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-3 p-0`,children:r.media.map(t=>(0,Z.jsx)(kt,{planId:e,unit:r.unit,file:t},t))})]}):r.unit&&r.group!==`notrun`?(0,Z.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:c?`No screenshot${n?` or video`:``} was kept for this failure.`:n?`No video was kept for this run.`:`No screenshot: the test passed.`}):null,r.fidelity&&r.fidelity.rows.length>0&&(0,Z.jsx)(Fe,{title:`Tosca steps (${r.fidelity.matched} of ${r.fidelity.required} in the test)`,defaultOpen:!!(r.fidelity.missing.length||r.personSteps.length),children:(0,Z.jsx)(ve,{label:`Tosca steps`,placeholder:`Find a step`,height:`min(40vh, 360px)`,resetKey:t.case,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`w-14`),children:`Step`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`What it does`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`In the test`})]}),children:r.fidelity.rows.map(e=>{let t=tt[e.status]||tt.matched;return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`font-mono text-[12px] text-muted`),children:e.id}),(0,Z.jsxs)(`td`,{className:M(`px-3 py-2`,`[overflow-wrap:anywhere]`),children:[e.kind===`assert`?`check ${e.op}`:e.op,` on `,e.element||`—`,e.step&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca “`,e.step,`”`]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:M(`size-2 flex-none rounded-full`,t.dot)}),t.label]})})]},e.id)})})}),r.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`$ `,r.command]}),r.output&&(0,Z.jsx)(Fe,{title:`Test output`,defaultOpen:c,children:(0,Z.jsx)(`pre`,{className:`m-0 max-h-[40vh] overflow-auto rounded-[10px] bg-surface-muted px-3 py-2 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:r.output})})]})]})}var jt={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},Mt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function Nt(e){let t=[`Tosca id`,`Test case`,`Tosca path`,`Status`,`Test file`,`Steps in the test`,`Change`,`Execution lists`],n=e.tests.map(t=>[t.uid||``,t.name,[...t.folders,t.name].join(` / `),Dt(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?jt[t.change]:``,t.suites.join(`; `)]);for(let t of e.removed)n.push([t.uid||``,t.name,t.name,`Removed from Tosca`,t.file||``,``,``,``]);let r=[t,...n].map(e=>e.map(Mt).join(`,`)).join(`\r
2
- `),i=URL.createObjectURL(new Blob([`${r}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=`tosca-${e.id}-traceability.csv`,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function Pt({g:e,rows:t,open:n,onToggle:r,pick:i,onPick:a}){let o=()=>Math.max(0,Math.floor(t.findIndex(e=>e.case===i)/Tt)),[s,c]=(0,X.useState)(o),l=(0,X.useId)();(0,X.useEffect)(()=>c(o()),[t.length]);let u=t.slice(s*Tt,s*Tt+Tt);return(0,Z.jsxs)(`div`,{className:`border-b border-line-soft last:border-b-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":l,onClick:r,className:`flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 py-2 text-left hover:bg-surface-muted`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`flex-none text-muted transition-transform`,n&&`rotate-180`)}),(0,Z.jsx)(`span`,{className:M(`size-2 flex-none rounded-full`,e.bar),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:t.length})]}),(0,Z.jsxs)(fe,{open:n,id:l,children:[(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":i===e.case,onClick:()=>a(e),className:M(`flex w-full min-w-0 cursor-pointer flex-col gap-0.5 border-0 px-3 py-1.5 pl-[38px] text-left`,i===e.case?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.name}),e.ms>0&&(0,Z.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:ze(e.ms)})]}),e.note&&(0,Z.jsx)(`span`,{className:M(`truncate text-[12px]`,e.group===`failed`?`text-fail`:`text-muted`),children:e.note}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 gap-2 text-[11.5px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.file||`No file`}),e.fidelity&&(0,Z.jsxs)(`span`,{className:`flex-none tabular-nums`,children:[e.fidelity.matched,`/`,e.fidelity.required,` steps`]}),e.media>0&&(0,Z.jsx)(`span`,{className:`flex-none tabular-nums`,children:Y(e.media,`file`)})]})]})},e.case))}),t.length>Tt&&(0,Z.jsx)(U,{page:s,size:Tt,total:t.length,onPage:c,label:`${e.label} pages`})]})]})}function Ft({label:e,children:t,wide:n}){return(0,Z.jsxs)(`div`,{className:M(`flex min-w-0 flex-col gap-0.5`,n&&`@3xl:col-span-2`),children:[(0,Z.jsx)(`dt`,{className:`text-[11.5px] text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`m-0 text-[13px] text-ink [overflow-wrap:anywhere]`,children:t})]})}function It({id:e,caseId:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(`all`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)({}),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``);(0,X.useEffect)(()=>{s(!0),P.report(e).then(e=>{if(r(e.report),a(e.report?``:`No report yet. Start the conversion first.`),s(!1),e.report){let n=t&&e.report.tests.find(e=>e.case===t)||e.report.tests.find(e=>e.group===`failed`||e.group===`attention`)||e.report.tests.find(e=>e.group!==`leftout`);p(n?n.case:``)}},e=>{a(e.message),s(!1)})},[e]),(0,X.useEffect)(()=>{f&&history.replaceState(null,``,z(`tosca`,e,`report`,encodeURIComponent(f)))},[e,f]);let b=u.trim().toLowerCase(),x=(0,X.useMemo)(()=>{let e={failed:[],attention:[],passed:[],notrun:[],leftout:[]};for(let t of n?.tests||[])c!==`all`&&t.group!==c||b&&!`${t.name} ${t.file} ${t.case} ${t.note||``} ${t.suites.join(` `)} ${t.folders.join(` `)}`.toLowerCase().includes(b)||e[t.group].push(t);return e},[n,c,b]),C=async t=>{_(t),y(``);try{let n=await(t===`zip`?P.reportZip(e):P.reportHtml(e)),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`tosca-${e}.${t}`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){y(e.message)}finally{_(``)}};if(o)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading report…`});if(i||!n)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversion`]}),(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i||`No report.`})]});let w=Ge[n.status]||{label:n.status,tone:`neutral`},[T,...E]=n.target.id.split(`-`),D=Ot(n.stages),O=n.tests.length-n.counts.leftout,k=n.tests.find(e=>e.case===f)||null,te=Et.reduce((e,t)=>e+x[t.id].length,0),ne=Math.max(1,n.tests.length);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),`Conversion`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-[12px] font-medium tracking-wide text-muted uppercase`,children:`Conversion report`}),(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:wt(n.source.file)}),(0,Z.jsx)(ee,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(Le,{framework:T,language:E.join(`-`),size:20}),n.target.title]})]})]}),(0,Z.jsx)(L,{tone:w.tone,children:w.label}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(N,{size:`sm`,onClick:()=>void C(`html`),disabled:!!g,"data-tip":`ForgeQE's HTML report of this conversion: one file with the failure screenshots inside. The zip has the videos too.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),g===`html`?`Making the HTML report…`:`HTML report`]}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:()=>Nt(n),"data-tip":`Every Tosca test case by its unique id and path, with what became of it: its test file, outcome and steps.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Traceability CSV`]}),(0,Z.jsxs)(N,{size:`sm`,onClick:()=>void C(`zip`),disabled:!!g||n.status===`running`,"data-tip":n.status===`running`?`The zip is made when the run ends.`:`The HTML report with every screenshot and video: unzip it and open report.html.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),g===`zip`?`Making the zip…`:`Zip with videos`]})]})]}),v&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:v}),(0,Z.jsxs)(`section`,{"aria-label":`Summary`,className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[n.counts.passed,` of `,O,` passed`]}),Et.filter(e=>n.counts[e.id]>0).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-ink-2`,children:[(0,Z.jsx)(`span`,{className:M(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:M(`tabular-nums`,e.id===`failed`?`text-fail`:``),children:n.counts[e.id]})]},e.id))]}),(0,Z.jsx)(`div`,{className:`flex h-1.5 overflow-hidden rounded-full bg-surface-strong`,"aria-hidden":`true`,children:Et.map(e=>n.counts[e.id]?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${n.counts[e.id]/ne*100}%`}},e.id):null)}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-2 gap-x-6 gap-y-2 @3xl:grid-cols-4 @5xl:grid-cols-6`,children:[(0,Z.jsxs)(Ft,{label:`Time`,children:[ze(n.ms),` · started `,Ve(n.startedAt)]}),(0,Z.jsxs)(Ft,{label:`Tosca steps in the tests`,children:[n.steps.required?`${n.steps.matched} of ${n.steps.required}`:`–`,n.personSteps?(0,Z.jsxs)(`span`,{className:`text-warn`,children:[` · `,n.personSteps,` for a person`]}):null]}),(0,Z.jsx)(Ft,{label:`Media`,children:n.media?Y(n.media,`file`):n.target.video?`Videos and failure screenshots`:`Failure screenshots`}),(0,Z.jsxs)(Ft,{label:`LLM`,children:[n.model||`–`,n.usage.input||n.usage.output?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,Te(n.usage.input+n.usage.output),` tokens`,n.cost?` · ${n.cost.estimate?`≈`:``}${me(n.cost.amount,n.cost.currency)}`:``]}):null]}),(0,Z.jsxs)(Ft,{label:`From`,children:[`Tosca`,n.source.project?` · ${n.source.project}`:``,` · `,(0,Z.jsx)(`span`,{className:`font-mono text-[12px]`,children:n.source.file}),n.source.baseUrl&&(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:n.source.baseUrl})]}),(0,Z.jsxs)(Ft,{label:`To`,children:[n.target.title,` · `,(0,Z.jsxs)(`span`,{className:`font-mono text-[12px]`,children:[n.target.dir,`/`]}),n.reverted.length>0&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[Y(n.reverted.length,`edit`),` outside it put back`]})]})]}),(n.previous||n.removed.length>0)&&(0,Z.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-surface-muted px-3 py-2 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[n.previous?(0,Z.jsxs)(Z.Fragment,{children:[`Re-imported from `,(0,Z.jsx)(`a`,{href:z(`tosca`,n.previous,`report`),children:n.previous}),`: `,n.tests.filter(e=>e.change===`same`).length,` unchanged (their tests kept), `,n.tests.filter(e=>e.change===`changed`).length,` changed, `,n.tests.filter(e=>e.change===`new`).length,` new.`,` `]}):null,n.removed.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[Y(n.removed.length,`test case`),` no longer in the exports; their tests are left as they are: `,n.removed.slice(0,5).map(e=>`${e.name}${e.file?` (${e.file})`:``}`).join(`; `),n.removed.length>5?`; …`:``,`.`]})]}),D&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[`Failed in `,Ke[D.id],D.note?`: ${D.note}`:``]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-4 @5xl:grid-cols-[minmax(320px,400px)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(V,{id:`tosca-report-search`,label:`Find a test case`,value:u,onChange:d,placeholder:`Find a test case, file or problem`,className:`max-w-none flex-none`}),(0,Z.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex flex-wrap gap-1`,children:(0,Z.jsx)(de,{items:[{id:`all`,label:`All`,n:n.tests.length},...Et.filter(e=>n.counts[e.id]>0).map(e=>({id:e.id,label:e.label,n:n.counts[e.id],alert:e.id===`failed`}))],value:c,onChange:l})}),(0,Z.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex flex-col overflow-hidden overscroll-contain rounded-[12px] card border @5xl:max-h-[min(70vh,760px)] @5xl:overflow-y-auto`,children:[Et.filter(e=>x[e.id].length).map(e=>(0,Z.jsx)(Pt,{g:e,rows:x[e.id],open:m[e.id]??(e.open||c===e.id||!!b||x[e.id].some(e=>e.case===f)),onToggle:()=>h(t=>({...t,[e.id]:!(t[e.id]??(e.open||c===e.id||!!b||x[e.id].some(e=>e.case===f)))})),pick:f,onPick:e=>p(e.case)},e.id)),!te&&(0,Z.jsx)(`p`,{className:`m-0 px-4 py-6 text-center text-sm text-muted`,children:`No test case matches.`})]})]}),(0,Z.jsx)(`div`,{className:`min-w-0 @5xl:sticky @5xl:top-4`,children:k?(0,Z.jsx)(`div`,{className:`pane-swap`,children:(0,Z.jsx)(At,{planId:n.id,pick:k,video:n.target.video})},k.case):(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-6 text-center text-sm text-muted`,children:`Pick a test case to see its steps, output and media.`})})]})]})}var Lt={converted:{icon:E,cls:`text-pass`,label:`Converted`},partly:{icon:n,cls:`text-warn`,label:`Converted, with steps for a person`},not:{icon:h,cls:`text-muted`,label:`Not converted`}},Rt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function zt(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(Rt).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,Lt[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(Rt).join(`,`));let i=URL.createObjectURL(new Blob([`${r.join(`\r
3
- `)}\r\n`],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=n,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function Bt({coverage:e,names:t,file:n,folded:r=!1}){let i=e.converted+e.partly,[a,o]=(0,X.useState)(!r),s=(0,X.useId)();return(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-coverage`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h3`,{id:`tsc-coverage`,className:`m-0 text-sm font-semibold`,children:`What can be migrated`}),(0,Z.jsxs)(`span`,{className:`flex-1 text-[13px] text-ink-2`,children:[i,` of `,e.total,` test case`,e.total===1?``:`s`,e.partly?`, ${e.partly} of them with steps for a person`:``,`; `,e.not,` not`]}),r&&(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[(0,Z.jsx)(y,{"aria-hidden":`true`,className:M(`transition-transform`,a&&`rotate-180`)}),a?`Hide the breakdown`:`Show the breakdown`]}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:()=>zt(e,t,n),"data-tip":`Every test case with its kind and what happens to it, for a spreadsheet.`,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`CSV`]})]}),(0,Z.jsx)(fe,{open:a,id:s,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.rows.map(e=>{let t=Lt[e.outcome];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2.5 last:border-b-0`,children:[(0,Z.jsx)(t.icon,{size:16,role:`img`,"aria-label":t.label,className:M(`mt-0.5 flex-none`,t.cls)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-ink`,children:e.label}),(0,Z.jsx)(`span`,{className:`tabular-nums text-ink-2`,children:e.cases.length===1?`1 test case`:`${e.cases.length} test cases`})]}),(0,Z.jsx)(`span`,{className:`text-ink-2`,children:e.becomes}),e.modules.length>0&&(0,Z.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Because of: `,e.modules.slice(0,4).map(e=>`${e.name}${e.engine?` (${e.engine})`:``} in ${e.cases}`).join(` · `),e.modules.length>4?` · and ${e.modules.length-4} more`:``]}),e.reasons&&e.reasons.length>0&&(0,Z.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Steps left: `,e.reasons.slice(0,3).map(e=>`${e.count}× ${e.reason}`).join(` · `),e.reasons.length>3?` · and ${e.reasons.length-3} more`:``]})]})]},e.kind)})})})]})}var Vt={ok:{icon:E,cls:`text-pass`,label:`Ready`},answer:{icon:n,cls:`text-warn`,label:`Needs an answer`},blocker:{icon:h,cls:`text-fail`,label:`Blocks the start`}};function Ht({planId:e,stamp:t,busy:n,open:r,onChanged:i,onAccept:a,acceptTip:o}){let[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``);(0,X.useEffect)(()=>{P.data(e).then(e=>{c(e),g(``)},e=>g(e.message))},[e,t]);let _=async t=>{m(!0),g(``);try{c(await P.setData(e,t)),u(``),f(``),i()}catch(e){g(e.message)}finally{m(!1)}},v=n||p,y=s?[...new Set(s.cases.flatMap(e=>e.missing))]:[];return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[s&&s.sources.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[12.5px] text-ink-2`,children:s.sources.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.file}),e.sheet?` (sheet ${e.sheet})`:``,`: `,Y(e.rows,`row`),e.transposed?`, attributes down the first column`:``]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.file}${e.sheet?`, sheet ${e.sheet}`:``}`,disabled:v,onClick:()=>void _({remove:t}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Remove`})]},`${e.file}\u0000${e.sheet||``}`))}),s&&y.length>0&&(0,Z.jsxs)(`span`,{className:`text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[`Not found yet: `,(0,Z.jsx)(`span`,{className:`font-mono`,children:y.slice(0,12).join(`, `)}),y.length>12?` and ${y.length-12} more`:``]}),r&&(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),l&&_({file:l,...d.trim()?{sheet:d.trim()}:{}})},children:[(0,Z.jsxs)(W,{size:`sm`,"aria-label":`A data file of the project`,value:l,disabled:v||!s,onChange:e=>u(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:s&&!s.files.length?`No CSV, TSV, Excel or JSON file in the project`:`A data file of the project…`}),(s?.files||[]).map(e=>(0,Z.jsx)(`option`,{value:e.path,children:e.path},e.path))]}),/\.xls[xm]$/i.test(l)&&(0,Z.jsx)(I,{size:`sm`,"aria-label":`Sheet, the first if empty`,placeholder:`Sheet, the first if empty`,value:d,onChange:e=>f(e.target.value),disabled:v,className:`min-w-0 flex-[1_1_160px]`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:v||!l,children:`Use it`}),a&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:v,onClick:a,"data-tip":o,children:`Leave them for a person`})]}),h&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:h})]})}function Ut({r:e,busy:t,onAnswer:n}){let[r,i]=(0,X.useState)(``),a=String(e.environments.findIndex(t=>t.environment===e.answers.environment&&t.app===e.answers.app));return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[e.environments.length>0&&(0,Z.jsxs)(W,{size:`sm`,"aria-label":`An app of env.yaml`,value:a,disabled:t,onChange:t=>{let r=e.environments[Number(t.target.value)];r&&n({environment:r.environment,app:r.app})},className:`w-auto max-w-[320px]`,children:[(0,Z.jsx)(`option`,{value:`-1`,children:`An app of env.yaml…`}),e.environments.map((e,t)=>(0,Z.jsxs)(`option`,{value:String(t),children:[e.environment,` · `,e.app,` · `,e.url]},`${e.environment}\u0000${e.app}`))]}),(0,Z.jsxs)(`form`,{className:`flex min-w-0 flex-[1_1_280px] gap-2`,onSubmit:e=>{e.preventDefault(),r.trim()&&n({baseUrl:r.trim()})},children:[(0,Z.jsx)(I,{size:`sm`,type:`url`,"aria-label":`Or the address the tests start at`,placeholder:`Or the address, https://…`,value:r,onChange:e=>i(e.target.value),disabled:t,className:`min-w-0 flex-1`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function Wt({item:e,picked:t,busy:n,onPick:r}){let i=e.apps||[];return i.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:(0,Z.jsxs)(W,{size:`sm`,"aria-label":e.engine===`database`?`A database`:e.engine===`mobile`?`A mobile app`:`A desktop app`,value:t&&i.includes(t)?t:``,disabled:n,onChange:e=>e.target.value&&r(e.target.value),className:`w-auto max-w-[320px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:e.engine===`database`?`A database…`:e.engine===`mobile`?`A mobile app…`:`A desktop app…`}),i.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}):(0,Z.jsxs)(`p`,{className:`m-0 pt-1 text-[13px] text-muted`,children:[e.engine===`database`?`No databases yet: add one in `:`No ${e.engine} apps yet: add one in `,(0,Z.jsx)(`a`,{href:z(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function Gt({item:e,busy:t,secrets:n,onSaved:r,onAccept:i,onUse:a}){let[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),m=async()=>{d(!0),p(``);try{await oe.saveSecrets({[e.name]:o}),s(``),r()}catch(e){p(e.message)}finally{d(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 pt-1`,children:[(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&m()},children:[(0,Z.jsx)(I,{size:`sm`,type:e.secret?`password`:`text`,autoComplete:`off`,spellCheck:!1,"aria-label":`Value of ${e.name}`,placeholder:e.secret?`Its value, kept in the credential store`:`Its value`,value:o,onChange:e=>s(e.target.value),disabled:t||u,className:`min-w-0 flex-[1_1_220px]`}),(0,Z.jsx)(N,{size:`sm`,type:`submit`,disabled:t||u||!o,children:`Save`}),e.accept&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:t||u,onClick:i,"data-tip":e.accept,children:`Convert without it`})]}),n.length>0&&!e.uses&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`use-${e.name}`,className:`text-[12.5px] text-muted`,children:`Or use a saved secret`}),(0,Z.jsxs)(W,{id:`use-${e.name}`,size:`sm`,value:c,disabled:t||u,onChange:e=>l(e.target.value),className:`w-auto min-w-[200px] font-mono`,children:[(0,Z.jsx)(`option`,{value:``,children:`A saved secret…`}),n.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),(0,Z.jsx)(N,{size:`sm`,disabled:t||u||!c,onClick:()=>a(c),children:`Use it`})]}),f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[12.5px] text-fail`,children:f})]})}function Kt({planId:e,onReady:t,onCoverage:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),l=(0,X.useCallback)(e=>{i(e.readiness),t?.(e.readiness.ready),n?.(e.coverage)},[t,n]),u=(0,X.useCallback)(()=>{P.ready(e).then(l,e=>c(e.message))},[e,l]);(0,X.useEffect)(()=>{i(null),c(``),t?.(!1)},[e]),(0,X.useEffect)(u,[u]);let d=async t=>{o(!0),c(``);try{l(await P.answer(e,t))}catch(e){c(e.message)}finally{o(!1)}};return(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-ready`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Z.jsx)(`h3`,{id:`tsc-ready`,className:`m-0 text-sm font-semibold`,children:`Before it runs`}),(0,Z.jsx)(`span`,{role:`status`,className:M(`flex-1 text-[13px]`,r?r.ready?`text-pass`:`text-ink-2`:`text-muted`),children:r?r.ready?`Everything the tests need is in place.`:`${r.blockers?`${r.blockers} to fix`:``}${r.blockers&&r.open?`, `:``}${r.open?`${r.open} to answer`:``} before it can start.`:`Checking…`}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:u,disabled:a,"data-tip":`Check again, after installing a program or setting a variable.`,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Check again`]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),r&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:r.items.map(t=>{let n=Vt[t.level];return(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2.5 last:border-b-0`,children:[(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:M(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:M(`font-medium text-ink`,t.kind===`env`||t.kind===`tool`?`font-mono text-[12.5px]`:``),children:t.title}),(0,Z.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:t.text}),t.accepted&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-warn`,children:[`Accepted: `,t.accept,(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({unaccept:[t.id]}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Undo`})]}),t.kind===`url`&&(0,Z.jsx)(Ut,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,Z.jsx)(Wt,{item:t,picked:t.engine===`desktop`?r.answers.desktopApp:t.engine===`mobile`?r.answers.mobileApp:r.answers.database,busy:a,onPick:e=>void d(t.engine===`desktop`?{desktopApp:e}:t.engine===`mobile`?{mobileApp:e}:{database:e})}),t.kind===`env`&&t.level===`answer`&&(0,Z.jsx)(Gt,{item:t,busy:a,secrets:r.secrets||[],onSaved:u,onAccept:()=>void d({accept:[t.id]}),onUse:e=>void d({use:{name:t.name,secret:e}})}),t.kind===`env`&&t.uses&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-muted`,children:[(0,Z.jsxs)(`span`,{children:[`Uses the saved secret `,(0,Z.jsx)(`span`,{className:`font-mono`,children:t.uses}),`.`]}),(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void d({use:{name:t.name,secret:``}}),className:`cursor-pointer border-0 bg-transparent p-0 text-[12.5px] text-accent-fg hover:underline`,children:`Stop using it`})]}),t.kind===`data`&&(0,Z.jsx)(Ht,{planId:e,stamp:r,busy:a,open:t.level===`answer`,onChanged:u,onAccept:t.accept&&t.level===`answer`?()=>void d({accept:[t.id]}):void 0,acceptTip:t.accept})]})]},t.id)})})]})}var qt=/^[a-f0-9]{16}$/,Jt=`forgeqe.tosca.assistant`;function Yt(){try{let e=localStorage.getItem(Jt)||``;return qt.test(e)?e:``}catch{return``}}function Xt(e){try{e?localStorage.setItem(Jt,e):localStorage.removeItem(Jt)}catch{}}var Zt=[/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/,/\bgithub_pat_[A-Za-z0-9_]{20,}/,/\bglpat-[A-Za-z0-9_-]{20,}/,/\bATBB[A-Za-z0-9_-]{20,}/,/\b[a-z2-7]{52}\b/,/\bsk-[A-Za-z0-9_-]{16,}/,/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{16,}/i,/\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*\S{6,}/i],Qt=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function $t(e){let t=e.exports[0]?.path||e.clones[0]?.exports[0]?.path,n=e.exports.length+e.clones.reduce((e,t)=>e+t.exports.length,0),r=[];return n>1&&r.push({icon:m,title:`All ${n} exports to Playwright`,hint:`Every export in one plan, in TypeScript`,text:`Migrate all the exports to Playwright in TypeScript`}),t&&r.push({icon:O,title:`${Qt(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${Qt(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:ie,title:`${Qt(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${Qt(t)} to Cypress in TypeScript, into e2e/tosca`}),r.push({icon:x,title:`Help me choose`,hint:`The assistant asks one thing at a time`,text:`I want to migrate our Tosca tests. Help me choose.`}),r.slice(0,4)}function en({view:e,sid:t,onSid:n}){let[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),f=(0,X.useRef)(null);(0,X.useEffect)(()=>{t&&r?.id!==t&&F.view(t).then(i,()=>{n(``),Xt(``)})},[t]),(0,X.useEffect)(()=>{if(!r?.thinking&&!r?.checking)return;let e=setTimeout(()=>F.view(r.id).then(i,e=>c(e.message)),1200);return()=>clearTimeout(e)},[r]);let p=r?.messages.length??0;(0,X.useEffect)(()=>{p&&f.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[p,r?.thinking]);let m=e=>{o(e),setTimeout(()=>document.getElementById(`tosca-agent-box`)?.focus(),0)},h=async e=>{u(!0),c(``);try{let r=await e();return i(r),r.id!==t&&(n(r.id),Xt(r.id)),!0}catch(e){return c(e.message),!1}finally{u(!1)}},g=async e=>{!e.trim()||l||r?.thinking||(Zt.some(t=>t.test(e))?(o(``),c(`That looks like a token or a password, so it was not sent and the box was cleared. Use the token field of the clone question: it keeps it in your credential store.`)):await h(()=>r?F.say(r.id,e):F.start(e))&&o(``))},_=()=>{r&&F.end(r.id).catch(()=>{}),i(null),o(``),c(``),n(``),Xt(``)},v=()=>r?.prefill&&(location.hash=z(`tosca`,`new`,r.id)),y=!r,b=l||!!r?.thinking;return(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-agent`,"aria-labelledby":`tab-agent`,className:`mx-auto flex w-full max-w-[1080px] flex-auto flex-col gap-6`,children:[y?(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col items-center gap-4 pt-2 text-center short:gap-3 short:pt-0`,children:[(0,Z.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-full bg-accent-soft`,children:(0,Z.jsx)(se,{name:ye.tosca,px:24})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:`What do you want to migrate from Tosca?`}),(0,Z.jsx)(`p`,{className:`m-0 max-w-[62ch] text-[14.5px] text-muted`,children:`Say it in your words: the exports, the framework and where the tests run. I ask only what I still need, then open the wizard with every stage filled in for you to check.`})]}),(0,Z.jsx)(on,{view:e,onGit:()=>m(`Clone the Tosca exports from https://`)}),(0,Z.jsx)(`div`,{className:`grid w-full gap-2 text-left sm:grid-cols-2`,children:$t(e).map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>m(e.text),className:`flex cursor-pointer items-start gap-3 rounded-[12px] card border px-3 py-2.5 text-left hover:border-line-strong hover:bg-surface-muted`,children:[(0,Z.jsx)(B,{icon:e.icon,size:18,className:`mt-0.5 text-accent-fg`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-ink [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:e.hint})]})]},e.title))}),(0,Z.jsxs)(`a`,{href:z(`tosca`,`new`),className:`inline-flex items-center gap-1.5 text-[13px]`,children:[(0,Z.jsx)(d,{size:14,"aria-hidden":`true`}),`Or set every option yourself`]})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-label":`Conversation with the Tosca assistant`,className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] text-muted`,children:r.model?`Worked out by ForgeQE's model from what you said and what your project has.`:`Worked out by ForgeQE's rules: no model is set up.`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:_,disabled:l,children:`New conversation`})]}),(0,Z.jsxs)(`ol`,{"aria-live":`polite`,className:`m-0 flex list-none flex-col gap-5 p-0`,children:[r.messages.map((e,t)=>(0,Z.jsx)(`li`,{className:`fade-quick`,children:e.role===`person`?(0,Z.jsx)(Ee,{text:e.text}):(0,Z.jsx)(tn,{text:e.text})},t)),r.thinking&&(0,Z.jsx)(`li`,{className:`fade-quick`,children:(0,Z.jsx)(tn,{text:r.working===`cloning`?`Cloning the repository and looking for Tosca exports…`:`Reading what you said…`,working:r.working===`cloning`?`cloning`:`reading`})})]}),!r.thinking&&r.question?.id===`clone`&&r.clone&&(0,Z.jsx)(rn,{c:r.clone,disabled:l,onToken:e=>h(()=>F.token(r.id,e)),onPick:e=>void h(()=>F.pick(r.id,`clone`,[e]))},`clone-${p}`),!r.thinking&&r.question&&r.question.id!==`clone`&&r.question.options.length>0&&(0,Z.jsx)(nn,{q:r.question,disabled:l,onPick:e=>void h(()=>F.pick(r.id,r.question.id,e)).then(()=>document.getElementById(`tosca-agent-box`)?.focus())},`${r.question.id}-${p}`),!r.thinking&&r.prefill&&(0,Z.jsxs)(`div`,{className:`fade-quick flex flex-wrap items-center gap-3 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[14px] text-ink`,children:r.question?`The wizard can open now; the rest is optional.`:`Everything is ready.`}),(0,Z.jsxs)(N,{variant:`primary`,onClick:v,children:[`Open the prefilled wizard`,(0,Z.jsx)(ee,{"aria-hidden":`true`})]})]}),(0,Z.jsx)(`div`,{ref:f})]}),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(an,{v:r})})]}),(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-col bg-gradient-to-t from-bg from-85% to-transparent pt-5 pb-4`,children:[s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 bg-bg pb-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),(0,Z.jsx)(je,{id:`tosca-agent-box`,label:`Tell the Tosca assistant`,value:a,onChange:e=>{o(e),c(``)},onSend:()=>void g(a),busy:l,disabled:b,placeholder:y?`Migrate checkout.tsu to Playwright in TypeScript, on QA…`:`Answer, or change anything you said…`})]})]})}function tn({text:e,working:t}){return(0,Z.jsxs)(`div`,{className:`flex max-w-[72ch] items-start gap-3`,children:[(0,Z.jsx)(ce,{state:t?`working`:`idle`,px:28,label:t?`The Tosca assistant is ${t}`:`Tosca assistant`,className:`mt-0.5 flex-none`}),(0,Z.jsx)(`p`,{className:M(`m-0 text-[15px] leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function nn({q:e,disabled:t,onPick:n}){let[r,i]=(0,X.useState)([]);return(0,Z.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`sr-only`,children:e.text}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.multi?(0,Z.jsx)(G,{items:e.options.filter(e=>!e.action).map(e=>({id:e.id,label:e.label})),value:r,onChange:e=>{let t=e.includes(`all`)&&!r.includes(`all`);i(t?[`all`]:e.filter(e=>e!==`all`))}}):e.options.map(e=>(0,Z.jsxs)(N,{size:`sm`,variant:e.id===`skip`?`ghost`:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.label,e.hint&&(0,Z.jsx)(`span`,{className:`text-[11.5px] font-normal text-muted`,children:e.hint})]},e.id))}),e.multi&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e.options.some(e=>!e.action)&&(0,Z.jsxs)(N,{size:`sm`,variant:`primary`,disabled:t||!r.length,onClick:()=>n(r),children:[`Use `,r.includes(`all`)?`all`:r.length>1?`these ${r.length}`:`this`]}),e.options.filter(e=>e.action).map(e=>(0,Z.jsxs)(N,{size:`sm`,variant:`outline`,disabled:t,onClick:()=>n([e.id]),children:[e.id===`git`&&(0,Z.jsx)(l,{"aria-hidden":`true`}),e.label]},e.id)),e.typed&&e.options.some(e=>!e.action)&&(0,Z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Or type the names below.`})]})]})}function rn({c:e,disabled:t,onToken:n,onPick:r}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(``),d=[...new Set([...e.credentials,...e.tokenVar?[e.tokenVar]:[]])].sort(),f=async()=>{if(i){s(!0),u(``);try{await oe.saveSecrets({[i.name]:i.value}),a(null),await n(i.name)}catch(e){u(e.message)}finally{s(!1)}}},p=t||o;return(0,Z.jsxs)(`fieldset`,{className:`fade-quick m-0 ml-10 flex min-w-0 flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Z.jsxs)(`legend`,{className:`sr-only`,children:[`Clone `,e.url]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`label`,{htmlFor:`tsa-token`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Access token`,(0,Z.jsxs)(W,{id:`tsa-token`,size:`sm`,value:e.tokenVar??``,disabled:p,onChange:e=>void n(e.target.value),className:`min-w-[220px]`,children:[(0,Z.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),d.map(t=>(0,Z.jsxs)(`option`,{value:t,children:[t,t===e.tokenVar&&!e.tokenSaved?` (not saved yet)`:``]},t))]})]}),!i&&(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>a({name:e.tokenVar&&!e.tokenSaved?e.tokenVar:e.suggested,value:``}),children:`Add a token`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>void n(e.tokenVar??``),children:`Check again`})]}),!i&&(0,Z.jsxs)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:[`Or save it in`,` `,(0,Z.jsx)(`a`,{href:z(`settings`,`repo-tokens`),target:`_blank`,rel:`noopener`,children:`Settings › Secrets › Repository tokens`}),`, then press Check again.`]}),i&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,Z.jsxs)(`label`,{htmlFor:`tsa-token-name`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Name`,(0,Z.jsx)(I,{id:`tsa-token-name`,size:`sm`,value:i.name,spellCheck:!1,maxLength:64,onChange:e=>a({...i,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})]}),(0,Z.jsxs)(`label`,{htmlFor:`tsa-token-value`,className:`flex flex-col gap-1 text-[12px] font-medium text-muted`,children:[`Token`,(0,Z.jsx)(I,{id:`tsa-token-value`,size:`sm`,type:`password`,autoComplete:`off`,value:i.value,onChange:e=>a({...i,value:e.target.value}),className:`w-[260px] max-w-full`})]}),(0,Z.jsx)(N,{size:`sm`,disabled:p||!i.name||!i.value,onClick:()=>void f(),children:o?`Saving…`:`Save`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(null),children:`Cancel`}),(0,Z.jsx)(`span`,{className:`w-full text-[12.5px] text-muted`,children:`Kept in ForgeQE's credential store, never in the chat, the address or this page. Give it read access to the repository only.`})]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(N,{size:`sm`,variant:`primary`,disabled:p||!(!e.tokenVar||e.tokenSaved),onClick:()=>r(`yes`),children:[(0,Z.jsx)(l,{"aria-hidden":`true`}),`Clone it`]}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>r(`no`),children:`No`}),(0,Z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:e.tokenVar&&!e.tokenSaved?`Save a token as ${e.tokenVar} first, or pick None.`:e.tokenVar?`Signs in with ${e.tokenVar}.`:`Nothing is cloned until you say so.`})]})]})}function an({v:e}){let t=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm [overflow-wrap:anywhere]`,children:t})]}),n=(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`}),r=e.have;return(0,Z.jsxs)(`aside`,{"aria-label":`What the assistant has so far`,className:`flex flex-col rounded-[14px] card border p-5`,children:[t(r.exports.length>1?`Exports (${r.exports.length})`:`Export`,r.exports.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:[r.exports.slice(0,6).map(e=>(0,Z.jsx)(`li`,{className:`font-mono text-[12.5px]`,children:e},e)),r.exports.length>6&&(0,Z.jsxs)(`li`,{className:`text-[12.5px] text-muted`,children:[`and `,r.exports.length-6,` more`]})]}):n),t(`Target`,r.targetId?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:r.targetId.split(`-`)[0],language:r.targetId.split(`-`).slice(1).join(`-`)}),r.target]}):n),t(`Tests start at`,r.start||(0,Z.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`})),r.needs.map(e=>(0,Z.jsx)(X.Fragment,{children:t(e.need===`database`?`Database`:e.need===`mobile`?`Mobile app`:`Desktop app`,e.picked?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.picked}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Asked on Review when not given`}))},e.need)),t(`Folder`,r.into?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:r.into}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`tosca-<target>`})),t(`Saved secrets`,r.uses.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.uses.map(e=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px]`,children:[e.variable,` uses `,e.secret]},e.variable))}):(0,Z.jsx)(`span`,{className:`text-muted`,children:e.checking?`Reading which variables the tests need…`:`None`})),t(`Instructions`,r.instructions?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:r.instructions}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function on({view:e,onGit:t}){let n=`inline-flex min-h-7 items-center gap-1 rounded-full border px-2.5 no-underline`,r=e.clones.reduce((e,t)=>e+t.exports.length,0);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-1.5 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`mr-1 text-muted`,children:`Exports`}),e.exports.slice(0,5).map(e=>(0,Z.jsxs)(`span`,{className:M(n,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Z.jsx)(ae,{size:12,"aria-hidden":`true`}),Qt(e.path)]},e.path)),e.clones.map(e=>(0,Z.jsxs)(`span`,{className:M(n,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Z.jsx)(l,{size:12,"aria-hidden":`true`}),e.label.replace(/^.*\//,``).replace(/\.git$/,``)]},e.id)),(0,Z.jsxs)(`button`,{type:`button`,onClick:t,className:M(n,`cursor-pointer border-dashed border-line-strong bg-transparent text-muted hover:text-ink`),children:[(0,Z.jsx)(l,{size:12,"aria-hidden":`true`}),`Clone a git repository`]}),(0,Z.jsx)(`span`,{className:`ml-1 text-muted`,children:e.exports.length+r?`${e.exports.length+r} found`:`none in this project yet`})]})}var sn=[`Export`,`Target`,`Instructions`,`Review`],cn=[`The Tosca export and its test cases`,`Framework and language`,`Your rules, optional`,`Check and start`],ln=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],un={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function dn({at:e,reached:t,onGo:n}){return(0,Z.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Z.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:sn.map((r,i)=>{let a=i<=t,o=i===e,c=i<t&&!o;return(0,Z.jsxs)(`li`,{className:M(`flex items-center gap-2`,i<sn.length-1&&`flex-1`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:!a,"aria-current":o?`step`:void 0,onClick:()=>n(i),"aria-label":r,"data-tip":cn[i],className:M(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,a&&!o?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:M(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums`,c?`bg-pass text-white`:o?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,Z.jsx)(s,{size:13,strokeWidth:3}):i+1}),(0,Z.jsx)(`span`,{className:M(o?`font-medium text-ink`:a?`text-ink-2`:`text-muted`,!o&&`hidden @xl:inline`),children:r})]}),i<sn.length-1&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,Z.jsx)(`span`,{className:M(`block h-full rounded-full bg-pass transition-[width] duration-500`,i<t?`w-full`:`w-0`)})})]},r)})})})}function fn({id:e,label:t,help:n,children:r}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function pn({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Z.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-3 border-t border-line-soft bg-bg py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Z.jsxs)(N,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Z.jsx)(S,{"aria-hidden":`true`}),`Back`]}),(0,Z.jsx)(N,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function mn({on:e,onPick:t,logo:n,title:r,sub:i,label:a,multi:o}){return(0,Z.jsxs)(`button`,{type:`button`,role:o?`checkbox`:`radio`,"aria-checked":e,"aria-label":a,onClick:t,className:M(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-3 rounded-[12px] border px-3.5 py-3 text-left transition-colors`,e?`border-accent bg-accent-soft ring-1 ring-accent`:`border-line-soft bg-bg hover:border-line hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{className:`inline-flex size-9 flex-none items-center justify-center rounded-[10px] bg-surface-muted`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:i})]})]})}var hn=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function gn({s:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.project||e.file}),(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[Y(e.test_cases.length,`test case`),` · `,Y(e.pages.length,`module`),` · `,Y(e.totals.steps,`step`),` · `,Y(e.totals.asserts,`check`)]}),e.suites.length>0&&(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,Y(e.suites.length,`execution list`)]}),e.totals.unsupported>0&&(0,Z.jsxs)(`span`,{className:`text-warn`,children:[`· `,e.totals.unsupported===1?`1 step value cannot`:`${e.totals.unsupported} step values cannot`,` be converted`]}),e.duplicates?(0,Z.jsxs)(`span`,{className:`text-ink-2`,children:[`· `,Y(e.duplicates,`test case`),` in more than one export, converted once`]}):null]})}var $=e=>`${e.workspace||``}\u0000${e.file}`;function _n({busy:e,onClone:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``);return(0,Z.jsxs)(`form`,{className:`flex flex-col gap-3 rounded-[12px] card border px-4 py-3`,onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),i.trim(),o.trim())},children:[(0,Z.jsx)(fn,{id:`tsc-git-url`,label:`Repository`,help:`https:// or git@ address. A shallow copy is made under ForgeQE's home, with no hooks run; the project is not changed.`,children:(0,Z.jsx)(I,{id:`tsc-git-url`,value:n,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/tosca-exports.git`,onChange:e=>r(e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-3 @xl:grid-cols-2`,children:[(0,Z.jsx)(fn,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,Z.jsx)(I,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,Z.jsx)(fn,{id:`tsc-git-token`,label:`Credential variable`,help:`For a private repository: the name of the variable that holds its token (saved in Settings), never the token.`,children:(0,Z.jsx)(I,{id:`tsc-git-token`,value:o,spellCheck:!1,maxLength:80,placeholder:`GITHUB_TOKEN`,onChange:e=>s(e.target.value)})})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(N,{type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function vn({view:e,onView:t,picked:n,setPicked:r,found:i,setFound:a,only:o,setOnly:s}){let[c,l]=(0,X.useState)(i?`tsc-cases`:`tsc-exports`),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(e.clones.length>0&&e.exports.length===0),[v,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(``),C=new Set(n.map($)),T=[...e.exports.map(e=>({p:{file:e.path},bytes:e.bytes,from:`This project`})),...e.clones.flatMap(e=>e.exports.map(t=>({p:{file:t.path,workspace:e.id},bytes:t.bytes,from:`${e.label.replace(/^.*\//,``).replace(/\.git$/,``)}${e.branch?` (${e.branch})`:``}`})))],E=async(e,t)=>{if(r(e),a(null),S(``),e.length){p(!0);try{let t=await P.inspectSources(e);a(t),s(new Set(t.test_cases.filter(et).map(e=>e.id))),l(`tsc-cases`)}catch(e){t&&r(t),S(e.message)}finally{p(!1)}}},D=e=>{a(null),S(``),r(t=>t.some(t=>$(t)===$(e))?t.filter(t=>$(t)!==$(e)):[...t,e])},k=T.length>0&&T.every(e=>C.has($(e.p))),ee=async(e,n,r)=>{h(!0),S(``);try{t?.(await P.clone(e,n||void 0,r||void 0))}catch(e){S(e.message)}finally{h(!1)}},te=async e=>{S(``),b(``);try{t?.(await P.removeClone(e)),r(t=>t.filter(t=>t.workspace!==e)),a(null)}catch(e){S(e.message)}},ne=e=>{let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(t)},re=e=>et(e),A=i?i.test_cases.filter(re):[],j=x&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:x});return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(he,{label:`Export`,tabs:[{id:`tsc-exports`,label:n.length?`Exports · ${n.length} picked`:`Exports`},{id:`tsc-cases`,label:i?`Test cases · ${o.size} of ${i.test_cases.length}`:`Test cases`}],current:c,onPick:e=>{e===`tsc-cases`&&!i?n.length?E(n):S(`Pick at least one export first.`):l(e)}}),c===`tsc-exports`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-tsc-exports`,"aria-labelledby":`tab-tsc-exports`,className:`pane-swap flex flex-col gap-5`,children:[T.length>0?(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Tosca exports`,placeholder:`Find an export`,height:`min(44vh, 400px)`,tools:(0,Z.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(J,{checked:k,onCheckedChange:e=>{a(null),S(``),r(e?T.map(e=>e.p):[])}}),`Pick all `,T.length]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(K,`w-10`),children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Z.jsx)(`th`,{className:K,children:`Export`}),(0,Z.jsx)(`th`,{className:M(K,`hidden @xl:table-cell`),children:`Folder`}),(0,Z.jsx)(`th`,{className:K,children:`From`}),(0,Z.jsx)(`th`,{className:be,children:`Size`})]}),children:T.map(e=>{let t=$(e.p),n=e.p.file.slice(e.p.file.lastIndexOf(`/`)+1);return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsx)(J,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:C.has(t),onCheckedChange:()=>D(e.p)})}),(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(O,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n})]})}),(0,Z.jsx)(`td`,{className:M(q,`hidden font-mono text-[12px] text-muted @xl:table-cell`),children:e.p.file.includes(`/`)?e.p.file.slice(0,e.p.file.lastIndexOf(`/`)):`.`}),(0,Z.jsx)(`td`,{className:M(q,`text-ink-2`),children:e.from}),(0,Z.jsx)(`td`,{className:xe,children:hn(e.bytes)})]},t)})})}):(0,Z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`No Tosca export (.tsu) in this project yet. Export the test cases from Tosca Commander and put the files inside the project, for example `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:`tosca/checkout.tsu`}),`, or clone the repository that holds them below.`]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsx)(N,{variant:`primary`,disabled:f||!n.length,onClick:()=>void E(n),children:f?`Reading…`:n.length>1?`Read ${n.length} exports`:`Read the export`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n.length?n.length>1?`Their test cases become one plan; a module they share becomes one page object.`:`Tick more to convert several exports in one plan.`:`Tick one or more exports.`})]}),f&&!x&&(0,Z.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Z.jsxs)(`span`,{children:[`Reading `,n.length===1?`the export`:`${n.length} exports`,`…`]})}),j,(0,Z.jsx)(fn,{id:`tsc-path`,label:`Add by its path`,help:`A .tsu, or a folder of them, inside the project. Secrets in an export stay encrypted: they become environment variables.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(I,{id:`tsc-path`,value:u,spellCheck:!1,maxLength:300,placeholder:`tosca/checkout.tsu or tosca/`,onChange:e=>d(e.target.value),className:`min-w-0 flex-[1_1_300px]`}),(0,Z.jsxs)(N,{disabled:f||!u.trim(),onClick:()=>void E([...n.filter(e=>$(e)!==$({file:u.trim()})),{file:u.trim()}],n),"data-tip":`Add the export at this path and read it`,children:[(0,Z.jsx)(w,{"aria-hidden":`true`}),`Add`]})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":g,onClick:()=>_(!g),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:M(`transition-transform`,g&&`rotate-180`)}),`From a git repository`,e.clones.length?` (${e.clones.length} cloned)`:``]}),g&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.clones.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.clones.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.label,(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.branch?`${e.branch} · `:``,e.commit?`@${e.commit} · `:``,Y(e.exports.length,`export`),` · cloned `,new Date(e.createdAt).toLocaleDateString()]})]}),v===e.id?(0,Z.jsxs)(`span`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-ink-2`,children:[`Remove this copy? Plans made from it can no longer run.`,(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>void te(e.id),children:`Remove it`}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>b(``),children:`Keep it`})]}):(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>b(e.id),children:`Remove`})]},e.id))}),(0,Z.jsx)(_n,{busy:m,onClone:(e,t,n)=>void ee(e,t,n)})]})]})]}):(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-tsc-cases`,"aria-labelledby":`tab-tsc-cases`,className:`pane-swap flex flex-col gap-5`,children:[j,!i&&!f&&(0,Z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Pick exports and read them first.`}),f&&(0,Z.jsx)(`p`,{role:`status`,className:`shimmer m-0 text-[13px]`,children:(0,Z.jsx)(`span`,{children:`Reading…`})}),i&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-ink-2`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[`From `,n.length===1?(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:n[0].file}):Y(n.length,`export`)]}),(0,Z.jsx)(N,{size:`sm`,variant:`ghost`,onClick:()=>l(`tsc-exports`),children:`Change exports`})]}),(0,Z.jsx)(gn,{s:i}),i.coverage&&(0,Z.jsx)(Bt,{coverage:i.coverage,names:new Map(i.test_cases.map(e=>[e.id,e.name])),file:`${n.length===1?n[0].file.replace(/^.*\//,``).replace(/\.tsu$/i,``):`tosca-exports`}-coverage.csv`,folded:!0}),(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Test cases to convert`,placeholder:`Find a test case`,height:`min(52vh, 520px)`,tools:(0,Z.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(J,{checked:A.length>0&&A.every(e=>o.has(e.id)),onCheckedChange:e=>s(new Set(e?A.map(e=>e.id):[]))}),`Pick all `,A.length,` test cases ForgeQE can convert`]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`w-10`),children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Test case`}),(0,Z.jsx)(`th`,{className:M(`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Folder`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Steps · checks`}),(0,Z.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Kind`})]}),children:i.test_cases.map(e=>{let t=re(e);return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:`px-3 py-2`,children:(0,Z.jsx)(J,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&o.has(e.id),onCheckedChange:()=>ne(e.id)})}),(0,Z.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:M(`font-medium [overflow-wrap:anywhere]`,t?`text-ink`:`text-muted`),children:e.name}),(e.unsupported>0||e.suites.length>0)&&(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.unsupported?`${e.unsupported} not convertible`:``,e.unsupported&&e.suites.length?` · `:``,e.suites.length?`in ${e.suites.join(`, `)}`:``]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`hidden text-muted @2xl:table-cell [overflow-wrap:anywhere]`),children:e.folders.join(` / `)||`–`}),(0,Z.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:[e.steps,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.asserts]})]}),(0,Z.jsx)(`td`,{className:M(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsx)(L,{tone:t?`neutral`:`warn`,children:t?Je(e):`${$e[e.route]||e.route}: later`})})]},e.id)})})}),i.env.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Environment variables`}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[i.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`. Their values are never in the export; you set them before the tests run.`]})]})]})]})]})}function yn({view:e,to:t,setTo:n,fw:r,setFw:i,into:a,setInto:o,attr:s,setAttr:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r||(t?l(t):``),p=e.targets.filter(e=>l(e.id)===f);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Framework`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:d.map(([e,t])=>{let r=Re[e];return(0,Z.jsx)(mn,{on:f===e,onPick:()=>{e!==f&&(i(e),n(``))},logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:t,sub:un[e],label:t},e)})})]}),(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Language`}),!f&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick a framework first.`}),f&&!t&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Pick its language.`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`pane-swap grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:p.map(e=>{let r=Ie[u(e.id)];return(0,Z.jsx)(mn,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,label:e.language},e.id)})},f)]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Z.jsx)(fn,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,Z.jsx)(I,{id:`tsc-into`,value:a,spellCheck:!1,maxLength:300,placeholder:t?`tosca-${t}`:`Named after the target`,onChange:e=>o(e.target.value)})}),(0,Z.jsx)(fn,{id:`tsc-attr`,label:`Test id attribute (optional)`,help:`When the app's is not data-test-id, data-testid, data-test, data-cy or data-qa.`,children:(0,Z.jsx)(I,{id:`tsc-attr`,value:s,spellCheck:!1,maxLength:40,placeholder:`data-automation-id`,onChange:e=>c(e.target.value.replace(/[^A-Za-z0-9_-]/g,``))})})]})]})}function bn({view:e,picked:t,found:n,only:r,to:i,instructions:a}){let o=e.targets.find(e=>e.id===i),s=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,Z.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-5`,children:[s(t.length>1?`Exports (${t.length})`:`Export`,t.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:[t.slice(0,6).map(t=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px] [overflow-wrap:anywhere]`,children:[t.workspace?`${e.clones.find(e=>e.id===t.workspace)?.label.replace(/^.*\//,``)||`git`}: `:``,t.file]},$(t))),t.length>6&&(0,Z.jsxs)(`li`,{className:`text-[12.5px] text-muted`,children:[`and `,t.length-6,` more`]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),s(`Test cases`,n?(0,Z.jsxs)(`span`,{children:[r.size,` of `,n.test_cases.length,` picked`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})),s(`Target`,o?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(Le,{framework:o.id.split(`-`)[0],language:o.id.split(`-`).slice(1).join(`-`)}),o.title]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),s(`Instructions`,a.trim()?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:a.trim()}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function xn({view:e,onView:n,review:i,onStart:a,from:o}){let[s,l]=(0,X.useState)(0),[u,d]=(0,X.useState)(0),[f,p]=(0,X.useState)([]),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(new Set),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(``),[w,T]=(0,X.useState)(``),[E,D]=(0,X.useState)(``),[O,k]=(0,X.useState)(null),[te,ne]=(0,X.useState)(!1),[re,A]=(0,X.useState)(!1),[j,ie]=(0,X.useState)(!1),[ae,N]=(0,X.useState)(``),oe=[...g].sort().join(`,`);(0,X.useEffect)(()=>{k(null),ne(!1),d(e=>Math.min(e,2))},[f.map($).join(`|`),oe,v,S,w,E]);let[se,I]=(0,X.useState)(`next`),L=(0,X.useRef)(null),R=e=>{I(e<s?`back`:`next`),l(e);let t=L.current;t&&t.getBoundingClientRect().top<0&&t.scrollIntoView({block:`start`,behavior:`smooth`})},B=e=>{R(e),d(t=>Math.max(t,e)),N(``)},[V,H]=(0,X.useState)(o?`filling`:``);(0,X.useEffect)(()=>{if(!o)return;let e=!0;return(async()=>{ie(!0);try{let t=(await F.view(o)).prefill;if(!t)throw Error(`The assistant does not have the exports and the target yet: go back to it, or pick them here.`);if(!e)return;p(t.sources),x(t.to.split(`-`)[0]),y(t.to),C(t.into??``),D(t.instructions??``);let n=await P.inspectSources(t.sources);if(!e)return;let r=n.test_cases.filter(et).map(e=>e.id);if(h(n),_(new Set(r)),!r.length)throw Error(`These exports hold no web or API test case to convert.`);let i=await P.plan({sources:t.sources,to:t.to,...t.into?{into:t.into}:{},...t.instructions?{instructions:t.instructions}:{}});(t.app||t.baseUrl)&&await P.answer(i.plan.id,t.app?{environment:t.app.environment,app:t.app.app}:{baseUrl:t.baseUrl}).catch(()=>{});for(let[e,n]of Object.entries(t.uses||{}))await P.answer(i.plan.id,{use:{name:e,secret:n}}).catch(()=>{});if((t.desktopApp||t.mobileApp||t.database)&&await P.answer(i.plan.id,{...t.desktopApp?{desktopApp:t.desktopApp}:{},...t.mobileApp?{mobileApp:t.mobileApp}:{},...t.database?{database:t.database}:{}}).catch(()=>{}),!e)return;k(i),d(3),R(3),H(`done`)}catch(t){if(!e)return;N(t.message),H(``)}finally{e&&ie(!1)}})(),()=>{e=!1}},[o]);let ce=async()=>{ie(!0),N(``);try{let e=!m||m.test_cases.filter(et).every(e=>g.has(e.id)),t=await P.plan({sources:f,to:v,...S.trim()?{into:S.trim()}:{},...e?{}:{only:[...g]},...E.trim()?{instructions:E.trim()}:{},...w?{testAttributes:[w]}:{}});k(t),B(3)}catch(e){let t=e.message;N(t);let n=S.trim().replace(/\\/g,`/`).replace(/\/+$/,``);n&&t.includes(n)&&R(1)}finally{ie(!1)}},U=O?.plan,W=U?.feasibility.findings.some(e=>e.level===`limit`),le=U?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o&&V&&(0,Z.jsxs)(`p`,{role:`status`,className:`fade-quick m-0 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-2.5 text-sm text-ink`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:V===`filling`?`Filling in every stage from your conversation with the assistant…`:`Filled in from your conversation with the assistant. Check each stage before you start.`}),(0,Z.jsx)(`a`,{href:z(`tosca`),className:`text-[13px]`,children:`Back to the assistant`})]}),(0,Z.jsx)(`div`,{ref:L,className:`scroll-mt-4`,children:(0,Z.jsx)(dn,{at:s,reached:u,onGo:e=>!j&&(e<3||O)&&R(e)})}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-step`,className:M(`flex min-w-0 flex-col gap-5`,se===`next`?`pane-next`:`pane-back`),children:[(0,Z.jsx)(`h2`,{id:`tsc-step`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:[`Which Tosca export?`,`What should the tests become?`,`Anything the agent should know?`,`Review and start`][s]}),ae&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:ae}),s===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vn,{view:e,onView:n,picked:f,setPicked:p,found:m,setFound:h,only:g,setOnly:_}),(0,Z.jsx)(pn,{busy:j,next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>B(1),disabled:!m||!g.size,aside:m&&!g.size?(0,Z.jsx)(`span`,{className:`text-muted`,children:`Pick at least one web or API test case.`}):void 0})]}),s===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yn,{view:e,to:v,setTo:y,fw:b,setFw:x,into:S,setInto:C,attr:w,setAttr:T}),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(0),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>B(2),disabled:!v})]}),s===2&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fn,{id:`tsc-instructions`,label:`Instructions (optional)`,help:`Style and structure for the new code. Every Tosca step and check is kept either way.`,children:(0,Z.jsx)(ue,{id:`tsc-instructions`,value:E,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per Tosca module.`,onChange:e=>D(e.target.value)})}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ln.map(e=>(0,Z.jsxs)(`button`,{type:`button`,disabled:E.includes(e),onClick:()=>D(E.trim()?`${E.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-2.5 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Z.jsx)(r,{size:13,"aria-hidden":`true`}),e]},e))}),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(1),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),j?`Checking…`:`Check`]}),onNext:()=>void ce(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),s===3&&U&&(0,Z.jsxs)(Z.Fragment,{children:[i(U,te,ne,A),(0,Z.jsx)(pn,{busy:j,onBack:()=>R(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Start`]}),disabled:le||!re||W&&!te,onNext:()=>a(O,!!W&&te),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:le?`Change what is not possible first.`:re?W&&!te?`Accept the limits to start.`:`Runs in the background.`:`Answer what the tests need first.`})})]})]},s),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(bn,{view:e,picked:f,found:m,only:g,to:v,instructions:E})})]})]})}function Sn({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(Ce,{}),(0,Z.jsx)(`main`,{className:M(we,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function Cn({action:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(pe,{pixel:ye.tosca,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Tosca`})]}),(0,Z.jsx)(Ne,{label:`Migration`,links:Pe,current:`tosca`}),(0,Z.jsx)(`span`,{className:`flex-1`}),e]})}function wn({planId:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{let t=!0;return n(null),i(!1),P.estimate(e).then(e=>t&&n(e),()=>t&&i(!0)),()=>{t=!1}},[e]),r?(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not known`}):t?t.files.setup+t.files.pages+t.files.tests?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{children:[`About `,Te(t.tokens.mid),` tokens`,t.cost?`, about ${me(t.cost.mid,t.cost.currency)}`:``,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,Te(t.tokens.low),` to `,Te(t.tokens.high),t.cost?`, ${me(t.cost.low,t.cost.currency)} to ${me(t.cost.high,t.cost.currency)}`:``,`)`]})]}),(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[t.model&&t.model!==`none`?`With ${t.model}. `:`No model is set up for the Tosca agent yet. `,t.basis.from===`history`?`From ${t.basis.files} files written by earlier conversions here.`:`From defaults: no conversion has run here yet.`,t.cost||!t.model||t.model===`none`?``:` No price is set for this model.`]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing left to write`}):(0,Z.jsx)(`span`,{role:`status`,className:`text-muted`,children:`Working it out…`})}function Tn({plan:e,accepted:t,onAccept:n,onReady:r}){let[i,a]=(0,X.useState)(null),o=(0,X.useMemo)(()=>new Map(e.cases.map(e=>[e.id,e.name])),[e]),s=e.feasibility.findings.filter(e=>e.level===`blocker`),c=e.feasibility.findings.filter(e=>e.level===`limit`),l=e.cases.filter(e=>e.included),u=e.units.filter(e=>e.kind===`page`).length,d=l.filter(e=>e.workflow).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2.5 rounded-[14px] card border px-5 py-4 text-sm @xl:grid-cols-[auto_1fr]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[`Tricentis Tosca`,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[e.sources&&e.sources.length>1?` · ${e.sources.length} exports`:(0,Z.jsxs)(Z.Fragment,{children:[` `,`· `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.source.file})]}),e.source.project?` · ${e.source.project}`:``]}),e.sources&&e.sources.length>1&&(0,Z.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-0.5 p-0`,children:e.sources.map((t,n)=>(0,Z.jsxs)(`li`,{className:`font-mono text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.label,(0,Z.jsxs)(`span`,{className:`font-sans text-muted`,children:[` · `,(e=>e?Y(e,`test case`):`its test cases are all in another export`)(e.cases.filter(e=>e.source===n).length)]})]},n))})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.target.dir]})]}),e.previous&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Since`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[(0,Z.jsx)(`a`,{href:z(`tosca`,e.previous.id),children:e.previous.id}),(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,Y(e.cases.filter(e=>e.change===`same`).length,`test case`),` unchanged (their tests kept), `,e.cases.filter(e=>e.change===`changed`).length,` changed, `,e.cases.filter(e=>e.change===`new`).length,` new, `,(e.removed||[]).length,` removed`]})]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[l.length-d,` test`,l.length-d===1?``:`s`,d?`, ${d} desktop or mobile workflow${d===1?``:`s`}`:``,` of `,e.cases.length,` test case`,e.cases.length===1?``:`s`,`, `,u,` page object`,u===1?``:`s`]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Estimate`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:(0,Z.jsx)(wn,{planId:e.id})}),(e.suites||[]).length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Suites`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.suites.map(e=>`${e.name} (${Y(e.cases.length,`test`)})`).join(`, `),(0,Z.jsxs)(`span`,{className:`block text-[12.5px] text-muted`,children:[`Tosca's execution lists, as tags on the tests: `,e.suites.map(e=>`@${e.tag}`).join(`, `),`.`]})]})]}),e.env.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Environment variables`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),(0,Z.jsx)(`span`,{className:`block text-[12.5px] text-muted`,children:`Never in the export: you set them before the tests run.`})]})]}),e.instructions&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Z.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]}),i&&(0,Z.jsx)(Bt,{coverage:i,names:o,file:`tosca-${e.id}-coverage.csv`}),s.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`tsc-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5 text-sm text-ink`,children:s.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))})]}),c.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`tsc-limits`,className:`flex flex-col gap-3 rounded-[14px] bg-warn-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`tsc-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1.5 pl-5 text-sm text-ink`,children:c.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))}),n&&!s.length&&(0,Z.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Z.jsx)(J,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Z.jsx)(Kt,{planId:e.id,onReady:r,onCoverage:a}),(0,Z.jsx)(Fe,{title:`Test cases (${e.cases.length})`,children:(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ve,{label:`Test cases of the plan`,placeholder:`Find a test case`,height:`min(48vh, 440px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:K,children:`Test case`}),(0,Z.jsx)(`th`,{className:K,children:`In the plan`}),(0,Z.jsx)(`th`,{className:M(be,`hidden @xl:table-cell`),children:`Steps · checks`}),(0,Z.jsx)(`th`,{className:K,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsx)(`td`,{className:M(q,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,Z.jsxs)(`td`,{className:M(q,`text-ink-2`),children:[e.included?`Converted`:e.why?e.why[0].toUpperCase()+e.why.slice(1):`Left out`,t?(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:{same:`Unchanged: its test kept`,changed:`Changed in Tosca`,new:`New in Tosca`}[t]}):null]}),(0,Z.jsxs)(`td`,{className:M(xe,`hidden @xl:table-cell`),children:[e.steps,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.asserts]})]}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap text-muted`),children:$e[e.route]||e.route})]},e.id)})})})}),(0,Z.jsx)(Fe,{title:`Files, in order (${e.units.length})`,children:(0,Z.jsx)(ve,{label:`Files, in order`,placeholder:`Find a file`,height:`min(40vh, 360px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:M(K,`w-24`),children:`Kind`}),(0,Z.jsx)(`th`,{className:K,children:`File`})]}),children:e.units.map(e=>(0,Z.jsxs)(`tr`,{className:_e,children:[(0,Z.jsx)(`td`,{className:M(q,`text-muted`),children:Xe(e)}),(0,Z.jsx)(`td`,{className:M(q,`font-mono text-[12px] [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function En({d:e,onStarted:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1),l=e.plan.feasibility.findings.some(e=>e.level===`limit`),u=e.plan.feasibility.verdict===`blocked`,d=!!e.job?.running;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.job?.last&&!d&&(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Z.jsx)(Tn,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r,onReady:a}),!u&&!d&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(N,{variant:`primary`,disabled:!i||!e.confirmed&&l&&!n,onClick:()=>s(!0),"data-tip":`Start the conversion`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Start`]}),!i&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Answer what the tests need first.`})]}),o&&(0,Z.jsx)(st,{plan:e.plan,acceptLimits:l&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}function Dn(e){return e.result?.status===`running`?`running`:e.result?.status===`converted`?`done`:e.result?`review`:`planned`}function On(e){return e.result?Ge[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:qe[e.verdict]}var kn=e=>e.slice(e.lastIndexOf(`/`)+1);function An({view:e}){let[t,n]=(0,X.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>Dn(e)===t).length,i=e.plans.filter(e=>t===`all`||Dn(e)===t),a=e=>location.hash=z(`tosca`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(He,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Z.jsx)(He,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Z.jsx)(He,{label:`Converted`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Z.jsx)(He,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Z.jsx)(ve,{label:`Conversions`,placeholder:`Find a conversion`,empty:t===`all`?`No conversions.`:`None here.`,resetKey:t,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Conversion`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Tests`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Updated`})]}),children:i.map(e=>{let t=On(e),n=e.result?e.result.status===`converted`||e.result.endedAt?100:Math.min(99,Math.round(e.result.done/Math.max(1,e.units||e.tests+1)*95)):0;return(0,Z.jsxs)(`tr`,{onClick:()=>a(e.id),className:Se,children:[(0,Z.jsx)(`td`,{className:q,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:(0,Z.jsx)(Le,{framework:e.targetId.split(`-`)[0],language:e.targetId.split(`-`).slice(1).join(`-`),size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`a`,{href:z(`tosca`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[kn(e.file),` to `,e.target]}),(0,Z.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[e.project?`${e.project} · `:``,e.into]})]})]})}),(0,Z.jsx)(`td`,{className:M(q,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(We,{value:n,label:`${kn(e.file)} to ${e.target}: progress`}),(0,Z.jsxs)(`span`,{className:`w-9 flex-none text-right text-[12px] text-muted tabular-nums`,children:[n,`%`]})]}):e.result?(0,Z.jsxs)(`span`,{className:e.result.converted===e.tests?`text-pass`:`text-ink-2`,children:[e.result.converted,` of `,e.tests,` pass`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Z.jsx)(`td`,{className:M(q,`whitespace-nowrap`),children:(0,Z.jsx)(L,{tone:t.tone,children:t.label})}),(0,Z.jsx)(`td`,{className:M(q,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:Ae(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function jn({sub:e}){let[t,n]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(Yt),u=(0,X.useCallback)(()=>{P.list().then(e=>{n(e),a(``)},e=>a(e.message))},[]);(0,X.useEffect)(u,[u,e]);let d=t?.plans.some(e=>e.result?.status===`running`);(0,X.useEffect)(()=>{if(!d||e&&e!==`conversions`)return;let t=setInterval(u,3e3);return()=>clearInterval(t)},[d,e,u]);let f=e?.match(/^(tsc-\d{8}-\d{6}-[0-9a-f]{4})\/report(?:\/([^/]+))?$/),p=e&&/^tsc-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:f?.[1]||``,h=!!f,g;try{g=f?.[2]?R(f[2]):void 0}catch{}let _=()=>location.hash=z(`tosca`,`new`),v=!t&&!i&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),y=e?.match(/^new\/([a-f0-9]{16})$/)?.[1];if(e===`new`||y)return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(Ze,{error:i}),v,t&&(0,Z.jsx)(xn,{view:t,onView:n,from:y,review:(e,t,n,r)=>(0,Z.jsx)(Tn,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>s({d:e,accept:t})},y||`new`),o&&(0,Z.jsx)(st,{plan:o.d.plan,acceptLimits:o.accept,onClose:()=>s(null),onStarted:e=>{s(null),location.hash=z(`tosca`,e.plan.id)}})]});if(p&&h)return(0,Z.jsxs)(Sn,{wide:!0,children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(It,{id:p,caseId:g},p)]});if(p)return(0,Z.jsxs)(Sn,{wide:!0,children:[(0,Z.jsx)(Cn,{}),(0,Z.jsx)(Ze,{error:i}),v,t&&(0,Z.jsx)(Ct,{id:p,plan:(e,t)=>(0,Z.jsx)(En,{d:e,onStarted:t})},p)]});let b=e===`conversions`?`conversions`:`agent`;return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Cn,{action:b===`agent`?void 0:(0,Z.jsxs)(N,{variant:`primary`,disabled:!t,onClick:_,"data-tip":`New conversion`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`New`]})}),(0,Z.jsx)(Ze,{error:i}),(0,Z.jsx)(Me,{label:`Tosca`,className:`mb-0`,current:b,onPick:e=>location.hash=e===`agent`?z(`tosca`):z(`tosca`,`conversions`),tabs:[{id:`agent`,label:`Agent`},{id:`conversions`,label:`Conversions`,...t?{n:t.plans.length}:{}}]}),v,t&&b===`agent`&&(0,Z.jsx)(en,{view:t,sid:c,onSid:l}),t&&b===`conversions`&&(0,Z.jsx)(`div`,{role:`tabpanel`,id:`panel-conversions`,"aria-labelledby":`tab-conversions`,className:`flex flex-col gap-5`,children:t.plans.length?(0,Z.jsx)(An,{view:t}):(0,Z.jsx)(H,{icon:m,title:`No Tosca conversions yet`,action:(0,Z.jsxs)(N,{size:`sm`,onClick:()=>location.hash=z(`tosca`),"data-tip":`Start with the assistant`,children:[(0,Z.jsx)(k,{"aria-hidden":`true`}),`Assistant`]}),children:`Tell the assistant what to migrate, or pick a Tosca export (.tsu) and its framework yourself with New. Every Tosca step and check is kept, and nothing starts until you confirm.`})})]})}export{jn as Tosca};