@capagents/forgeqe 2.9.2 → 2.9.3
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.
- package/dist/docs-site/docs/architecture/index.html +6 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +12 -1
- package/dist/forgeqe.js +1717 -1677
- package/dist/web/assets/{Agent-BFwkMMHm.js → Agent-B6xfobJ9.js} +3 -3
- package/dist/web/assets/{ApiTests-Bgt4R_yB.js → ApiTests-BwgezlYi.js} +3 -3
- package/dist/web/assets/Browse-DDzk_KTh.js +2 -0
- package/dist/web/assets/Chat-BdlfK2ra.js +3 -0
- package/dist/web/assets/{CommandPalette-nmLCmEsp.js → CommandPalette-Cla7m818.js} +1 -1
- package/dist/web/assets/{Compare-CGcGp9qD.js → Compare-BxUfo0rI.js} +1 -1
- package/dist/web/assets/{Cost-BvCShgln.js → Cost-Dpa8aWQG.js} +1 -1
- package/dist/web/assets/{Data-3EEe7vIz.js → Data-D_7m2GL6.js} +2 -2
- package/dist/web/assets/Desktop-CgslBkAr.js +1 -0
- package/dist/web/assets/DesktopReview-CsW65QZz.js +1 -0
- package/dist/web/assets/{Evidence-D1HiXQK6.js → Evidence-SYt-mbDx.js} +1 -1
- package/dist/web/assets/{Explore-2M7wI0Sf.js → Explore--B18Jvg9.js} +1 -1
- package/dist/web/assets/{Features-DmQ5JiMI.js → Features-BerYifH7.js} +1 -1
- package/dist/web/assets/{Flags-Bg-l5HxL.js → Flags-ABMq---p.js} +1 -1
- package/dist/web/assets/{Flaky-DJlkxmHT.js → Flaky-DKeceXsa.js} +1 -1
- package/dist/web/assets/{ForceGraph-B5i3Ewd5.js → ForceGraph-C9HFjZX3.js} +1 -1
- package/dist/web/assets/{Impact-huKs-mOc.js → Impact-DQ2c0dTT.js} +1 -1
- package/dist/web/assets/{Jobs-BwK79TQ8.js → Jobs-Dy_C2x36.js} +2 -2
- package/dist/web/assets/{KindPage-C0MoC9da.js → KindPage-DQzstMyM.js} +4 -4
- package/dist/web/assets/{Migration-CTVyQeqW.js → Migration-B4GWsCLR.js} +1 -1
- package/dist/web/assets/{Product-BHqJVCMn.js → Product-CgVhHMMY.js} +1 -1
- package/dist/web/assets/{Production-GL8lbwxD.js → Production-OdB4gZ3T.js} +1 -1
- package/dist/web/assets/{Quality-jI3YgvqZ.js → Quality-DOV4suvD.js} +1 -1
- package/dist/web/assets/{Readiness-B3OZ51FG.js → Readiness-DawfUUHc.js} +1 -1
- package/dist/web/assets/Record-C9uAKGYM.js +2 -0
- package/dist/web/assets/{Regression-v2dpbgs4.js → Regression-DZdddPfI.js} +2 -2
- package/dist/web/assets/{Reports-BAat71wo.js → Reports-BHOS6af1.js} +1 -1
- package/dist/web/assets/{Response-DjqmewrL.js → Response-qfMk4Nrh.js} +1 -1
- package/dist/web/assets/{RunDiff-BbBom2fJ.js → RunDiff-BNywFV7t.js} +1 -1
- package/dist/web/assets/{Runs-CIQWWRl3.js → Runs-BJPYXRiB.js} +1 -1
- package/dist/web/assets/{Steps-DfNHCe8N.js → Steps-Cdzyueit.js} +1 -1
- package/dist/web/assets/{TestCases-8BBW6RSi.js → TestCases-DcYY2l9q.js} +1 -1
- package/dist/web/assets/{TestData-BFkACDve.js → TestData-CrzKA3xh.js} +1 -1
- package/dist/web/assets/{TestDebt-CUcklHEN.js → TestDebt-CVDJT511.js} +1 -1
- package/dist/web/assets/Tosca-CBwGCrbL.js +3 -0
- package/dist/web/assets/{WhatsNew-CBS7kmGu.js → WhatsNew-CIOTidx-.js} +1 -1
- package/dist/web/assets/{dataParts-B3Fz4S59.js → dataParts-CUb0Q0IZ.js} +1 -1
- package/dist/web/assets/{families-BiqSaqoO.js → families-C9MndVzT.js} +1 -1
- package/dist/web/assets/filters-Bk7ovF3M.js +1 -0
- package/dist/web/assets/{fold-b2g0_ndv.js → fold-97yBCSav.js} +1 -1
- package/dist/web/assets/frame-CqWJMIHh.js +4 -0
- package/dist/web/assets/index-ASvNRLI7.js +73 -0
- package/dist/web/assets/index-B5o9vY-v.css +2 -0
- package/dist/web/assets/{logos-DSveGjIW.js → logos-CbNeXLAM.js} +1 -1
- package/dist/web/assets/{palette-CF8GLAVN.js → palette-Dg3RS-ff.js} +1 -1
- package/dist/web/assets/{parts-D7OvxdrL.js → parts-CPAyV15O.js} +1 -1
- package/dist/web/assets/{productParts-BDM3LIjp.js → productParts-BpXw1jMa.js} +1 -1
- package/dist/web/assets/{qualityParts-DP09bVel.js → qualityParts-8TPKphgl.js} +1 -1
- package/dist/web/assets/recordTest-DvnpHsd2.js +1 -0
- package/dist/web/assets/{rows-B0vZ5x5N.js → rows-BdYJLCRD.js} +1 -1
- package/dist/web/assets/{segmented-BfWimTC0.js → segmented-DlF5rvSR.js} +1 -1
- package/dist/web/assets/{thread-DASfqw-f.js → thread-DlyX7xQt.js} +1 -1
- package/dist/web/assets/{usePageChat-BLEUldCJ.js → usePageChat-Dhu3upXA.js} +1 -1
- package/dist/web/index.html +4 -4
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/WEB_APP.md +17 -1
- package/forgeqe.example.yaml +1 -0
- package/package.json +1 -1
- package/py/forgeqe_desktop/agentdesktop_driver.py +69 -0
- package/py/forgeqe_desktop/boxes.py +32 -0
- package/py/forgeqe_desktop/handhooks.py +55 -5
- package/py/forgeqe_desktop/pywinauto_driver.py +25 -0
- package/py/forgeqe_desktop/service.py +85 -3
- package/py/forgeqe_engine/brand.py +3 -0
- package/py/forgeqe_engine/browser.py +46 -6
- package/py/forgeqe_engine/cli.py +10 -1
- package/py/forgeqe_engine/recordsession.py +92 -2
- package/py/forgeqe_engine/video.py +423 -0
- package/py/forgeqe_mobile/hyperexecute.py +1 -1
- package/py/forgeqe_mobile/maestro.py +1 -1
- package/py/forgeqe_tosca/vendored.py +3 -2
- package/dist/web/assets/Browse-B3YI1MeV.js +0 -2
- package/dist/web/assets/Chat-K3kp-ji2.js +0 -3
- package/dist/web/assets/Desktop-Drj-7jBV.js +0 -1
- package/dist/web/assets/Record-Yw-SGwQ9.js +0 -2
- package/dist/web/assets/Tosca-DTWwUJBW.js +0 -3
- package/dist/web/assets/desktopAppPath-CMac6aJ0.js +0 -1
- package/dist/web/assets/filters-B4VDnWbr.js +0 -1
- package/dist/web/assets/frame-D-hqu7Oi.js +0 -4
- package/dist/web/assets/index-CtX74khE.js +0 -45
- package/dist/web/assets/index-DUf5ddb0.css +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$n as e,$t as t,An as n,Ar as r,C as i,Dn as a,F as o,Fn as s,Ft as c,Ir as l,It as u,L as d,N as f,Nr as p,Sr as m,T as h,Tn as g,Wt as _,Zn as v,_r as y,a as b,ar as x,d as S,et as C,fn as w,gn as T,it as ee,j as E,jt as D,nr as te,o as ne,ot as O,pn as re,pr as k,tn as A,vr as j,wn as ie,wr as M}from"./line-icons-CQ-3V8ax.js";import{B as N,Dt as P,R as F,V as I,Wt as ae,a as L,c as R,f as oe,h as z,i as se,l as ce,m as le,n as ue,o as B,ot as de,s as fe,t as pe,tt as me,u as he}from"./filters-B4VDnWbr.js";import{Dt as ge,Et as _e,Ot as ve,_t as ye,gt as be,r as xe,t as Se}from"./frame-D-hqu7Oi.js";import{M as Ce,i as we,l as V,r as Te,s as Ee,u as De}from"./index-CtX74khE.js";import{i as Oe,r as ke}from"./segmented-BfWimTC0.js";import{n as Ae,t as H}from"./thread-DASfqw-f.js";import{n as je,t as U}from"./desktopAppPath-CMac6aJ0.js";var W=l(p(),1),G=ae(),Me=e=>new Promise(t=>setTimeout(t,e));function Ne({id:e,onEnd:t,label:n=`The agent at work`,done:a=`Done.`,failed:o=`It could not finish.`}){let[s,c]=(0,W.useState)([]),[l,u]=(0,W.useState)(`starting`);(0,W.useEffect)(()=>{let t=!1,n=0,r=[];return(async()=>{for(;!t;)try{let i=await me.events(e,n,!0);if(t||(i.events.length&&(r.push(...i.events),n=i.events.at(-1).n,c([...r])),u(i.state),i.state===`closed`||i.state===`failed`))return}catch{await Me(2e3)}})(),()=>{t=!0}},[e]);let d=Ae(s),f=d.turns.at(-1),p=!!f?.outcome||l===`failed`||l===`closed`,m=f&&!p?H(f):null,h=f?.outcome===`done`,g=p&&!h&&(f?.error||d.fatal||d.ended?.message)||``;return(0,W.useEffect)(()=>{p&&t?.()},[p]),(0,G.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2 border-t border-line-soft pt-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m||!p?(0,G.jsx)(le,{state:m?.orb??`thinking`,px:16}):h?(0,G.jsx)(i,{size:16,"aria-hidden":`true`,className:`text-pass`}):(0,G.jsx)(r,{size:16,"aria-hidden":`true`,className:`text-fail`}),(0,G.jsx)(`span`,{className:N(`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,p&&!h&&`text-fail`),children:m?m.text:p?h?a:f?.outcome===`stopped`?`It was stopped.`:o:`Starting…`}),(0,G.jsx)(`a`,{href:oe(`chats`,e),className:`text-[13px]`,children:`Open the chat`})]}),g&&(0,G.jsx)(`p`,{className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:g.split(`
|
|
2
|
-
`).slice(0,3).join(` `)}),f&&f.steps.length>0&&(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[13px] text-muted`,children:f.steps.slice(-6).map(e=>(0,G.jsxs)(`li`,{className:N(`[overflow-wrap:anywhere]`,e.status===`fail`&&`text-fail`),children:[e.status===`running`?`… `:e.status===`fail`?`✗ `:`✓ `,e.label,e.arg?`: ${e.arg}`:``]},e.key))}),f&&f.changes.length>0&&(0,G.jsxs)(`p`,{className:`m-0 text-[13px] [overflow-wrap:anywhere]`,children:[`Changed: `,f.changes.map(e=>`${e.path} (+${e.added} −${e.removed})`).join(`, `)]}),f&&f.asks.some(e=>e.answer===void 0)&&(0,G.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`It is asking something: `,(0,G.jsx)(`a`,{href:oe(`chats`,e),children:`answer it in the chat`}),`.`]}),f?.reply&&p&&(0,G.jsx)(De,{text:f.reply,className:`text-[14px]`})]})}var Pe=[{id:`typed`,label:`As typed`,note:`The test types exactly this.`},{id:`data`,label:`Test data`,note:`A named value the test reads from its data, one per environment.`},{id:`unique`,label:`New on each run`,note:`A fresh value each time, like this one: for an email or a name that must not repeat.`},{id:`secret`,label:`Secret`,note:`Read from the environment when the test runs; what was typed is removed from the recording.`}];function Fe({runDir:e,onClose:t,onRecordMore:l,notices:u}){let[d,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(``),[_,y]=(0,W.useState)(!1),[x,C]=(0,W.useState)(`steps`),[T,D]=(0,W.useState)(``),[ne,O]=(0,W.useState)(!1),[re,A]=(0,W.useState)(null),[j,ie]=(0,W.useState)(null),[ae,oe]=(0,W.useState)(null),[le,ue]=(0,W.useState)(``),[de,he]=(0,W.useState)(`all`),[ge,_e]=(0,W.useState)(null),[ve,ye]=(0,W.useState)(!1),[be,xe]=(0,W.useState)(``),[Se,we]=(0,W.useState)(``),[V,Ee]=(0,W.useState)([]),[De,Ae]=(0,W.useState)(void 0),[H,je]=(0,W.useState)({from:0,to:0,name:``}),[U,Me]=(0,W.useState)({block:``,after:0}),[Fe,Re]=(0,W.useState)(``),[K,ze]=(0,W.useState)(null),[Be,Ve]=(0,W.useState)(``),[He,Ue]=(0,W.useState)({}),[q,We]=(0,W.useState)(``),[Ge,Ke]=(0,W.useState)(``),[J,qe]=(0,W.useState)(null),[Je,Ye]=(0,W.useState)(null),[Xe,Ze]=(0,W.useState)(null),[Qe,$e]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let t=!1;return P.review(e).then(e=>{t||(p(e),D(e.name),we(e.instructions))},e=>!t&&h(e.message)),()=>{t=!0}},[e]),(0,W.useEffect)(()=>{P.blocks().then(e=>{Ee(e.blocks),Ae(e.shared)},()=>Ee([]))},[]),(0,W.useEffect)(()=>{let t=!1;return P.tryView(e).then(e=>{t||(ze(e),Ue(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]??e.value]))))},()=>{}),()=>{t=!0}},[e,d]);let Y=K?.running===e;(0,W.useEffect)(()=>{if(!Y)return;let t=setInterval(()=>{P.tryView(e).then(ze,()=>{})},1500);return()=>clearInterval(t)},[Y,e]);let et=async()=>{h(``),$e(!0);try{let{id:t}=await me.start(`Turn the reviewed recording in ${e} into a test: call write_test with run_dir ${e} and unattended true.`,{});Ze(t)}catch(e){h(e.message),$e(!1)}};(0,W.useEffect)(()=>{Je&&!Y&&K&&(Ye(null),J===d&&K.result?.ok&&et())},[Je,Y,K,J,d]);let tt=async t=>{h(``),Ze(null);try{let n=q.startsWith(`file:`)?{file:q.slice(5),...Ge.trim()&&/\.xls[xm]$/i.test(q)?{sheet:Ge.trim()}:{}}:q.startsWith(`request:`)?{request:q.slice(8)}:void 0,r=await P.tryRun(e,Be,He,n);qe(d),Ye(t),ze(r)}catch(e){h(e.message)}},nt=async()=>{y(!0),h(``),Re(``);try{let t=await P.saveBlock(e,H.name.trim(),H.from,H.to);Ee(t.blocks),Re(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.`),je({...H,name:``})}catch(e){h(e.message)}finally{y(!1)}},X=async t=>{y(!0),h(``);try{let n=`restore`in t?await P.restoreReview(e,t.restore):`insert`in t?await P.insertBlock(e,t.insert.after,t.insert.block):`useBlock`in t?await P.useBlock(e,t.useBlock.block,t.useBlock.from):await P.saveReview(e,t);p(n),D(n.name),we(n.instructions)}catch(e){h(e.message)}finally{y(!1)}},rt=async()=>{ye(!0),xe(``);try{let t=await P.suggest(e);_e(t.picks),xe(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){xe(e.message)}finally{ye(!1)}},it=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},at=async e=>{for(let t of e)await X(it(t));_e(t=>(t||[]).filter(t=>!e.includes(t)))};if(!d)return m?(0,G.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:m}):(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Reading the recording…`});let ot=d.steps.filter(e=>e.value),st=d.steps.filter(e=>e.op===`expect`).length,Z=Y?void 0:K?.result,ct=new Map((Z?.steps??[]).map(e=>[e.n-1,e])),Q=Z?.steps.find(e=>!e.ok),lt=Q?Q.n-1:-1,$=lt>=0?d.steps[lt]:void 0,ut=!!Z&&!!J&&J!==d,dt=(Z?.steps??[]).filter(e=>!e.ok).length,ft=le.toLowerCase().split(/\s+/).filter(Boolean),pt=d.steps.filter(e=>ft.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(de===`all`||(de===`checks`?e.op===`expect`:ct.get(e.index)?.ok===!1))),mt=e=>{C(`steps`),he(`all`),ue(``),requestAnimationFrame(()=>document.getElementById(`step-${e}`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},ht=!!K?.running&&!Y,gt=Qe||Je===`write`&&Y,_t=[{id:`steps`,label:`Steps`,n:d.steps.length},{id:`data`,label:`Test data`,n:ot.length},{id:`run`,label:`Last run`},{id:`instructions`,label:`Instructions`},{id:`blocks`,label:`Blocks`},{id:`history`,label:`History`,n:d.history.length}];return(0,G.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-3 border-b border-line bg-bg px-1 py-3`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:t&&(0,G.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:t,className:`-ml-2 text-ink-2`,children:[(0,G.jsx)(b,{"aria-hidden":`true`}),`Recordings`]})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[ne?(0,G.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),O(!1),T.trim()&&T.trim()!==d.name&&X({name:T.trim()})},children:[(0,G.jsx)(L,{"aria-label":`Name of the recording`,value:T,maxLength:200,autoFocus:!0,onChange:e=>D(e.target.value),className:`min-w-0 flex-1`}),(0,G.jsxs)(F,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,G.jsx)(i,{"aria-hidden":`true`}),`Save`]}),(0,G.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>{D(d.name),O(!1)},children:[(0,G.jsx)(r,{"aria-hidden":`true`}),`Cancel`]})]}):(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,G.jsx)(`h2`,{id:`review-title`,className:`m-0 min-w-0 truncate text-lg font-semibold`,"data-tip":d.name,children:d.name}),(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>O(!0),className:`size-8 flex-none`,children:(0,G.jsx)(g,{"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,G.jsxs)(`span`,{children:[I(d.steps.length,`step`),` · `,I(st,`check`)]}),Y?(0,G.jsx)(R,{tone:`running`,children:`Running the steps…`}):Z?(0,G.jsx)(R,{tone:Z.ok?`pass`:`fail`,children:Z.ok?`Last run passed${Z.env?` on ${Z.env}`:``}`:Q?`Last run failed at step ${Q.n}`:`Last run did not get through`}):(0,G.jsx)(R,{tone:`neutral`,icon:!1,children:`Not run yet`}),ut&&(0,G.jsx)(`span`,{children:`· you changed it since`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(F,{disabled:Y||ht||gt,onClick:()=>void tt(null),"data-tip":ht?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,G.jsx)(a,{"aria-hidden":`true`}),Y&&!Je?`Running…`:`Re-run`]}),(0,G.jsxs)(F,{variant:`primary`,disabled:_||Y||ht||gt,onClick:()=>void(Z?.ok&&J===d?et():tt(`write`)),"data-tip":`${Xe?`Write the test again`:`Write the test`}: the steps are run first; when they work, the Coding agent writes the test in your repository's style`,children:[(0,G.jsx)(te,{"aria-hidden":`true`}),Je===`write`&&Y?`Checking…`:Qe?`Writing…`:`Write`]})]})]})]}),u,m&&(0,G.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:m}),Z&&!Z.ok&&(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 rounded-[12px] border border-fail/30 bg-fail-soft px-4 py-3 text-sm`,children:[(0,G.jsxs)(`p`,{className:`m-0 font-semibold text-fail [overflow-wrap:anywhere]`,children:[Q?`Step ${Q.n} failed${Z.env?` on ${Z.env}`:``}`:`The run did not get through${Z.env?` on ${Z.env}`:``}`,ut&&(0,G.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),$&&(0,G.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:$.line}),(0,G.jsx)(`p`,{className:`m-0 line-clamp-3 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,"data-tip":(Q?Q.error:Z.error)||void 0,children:(Q?Q.error:Z.error)||(Q?`It failed.`:`The last page was not the recorded one.`)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[$&&(0,G.jsxs)(F,{size:`sm`,onClick:()=>mt(lt),"data-tip":`Show the failed step`,children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Show`]}),$&&l&<>0&&(0,G.jsxs)(F,{size:`sm`,onClick:()=>l(lt),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,G.jsx)(f,{"aria-hidden":`true`}),`Record`]}),$&&!$.fixed&&(0,G.jsxs)(F,{size:`sm`,disabled:_,onClick:()=>void X({remove:[lt]}),"data-tip":`Drop the failed step`,children:[(0,G.jsx)(k,{"aria-hidden":`true`}),`Remove`]}),(0,G.jsxs)(F,{size:`sm`,variant:`ghost`,disabled:gt,onClick:()=>void et(),"data-tip":`Write the test anyway`,children:[(0,G.jsx)(te,{"aria-hidden":`true`}),`Write`]})]})]}),Xe&&(0,G.jsx)(Ne,{id:Xe,onEnd:()=>$e(!1),label:`The Coding agent writing the test`,done:`The test is written.`,failed:`The test could not be written.`},Xe),d.blocksFound?.map(e=>(0,G.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-[12px] bg-accent-soft px-3 py-2.5 text-sm text-ink`,children:[(0,G.jsx)(z,{icon:S,size:16,className:`flex-none`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,G.jsx)(`strong`,{className:`font-semibold`,children:e.name}),`: the test can call its helper instead.`]}),(0,G.jsxs)(F,{size:`sm`,disabled:_,onClick:()=>void X({useBlock:{block:e.block,from:e.from}}),"data-tip":`Use the block: the test calls its helper instead`,children:[(0,G.jsx)(i,{"aria-hidden":`true`}),`Use`]})]},`${e.block}-${e.from}`)),(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`This recording`,className:ke,children:_t.map(e=>(0,G.jsxs)(`button`,{type:`button`,role:`tab`,id:`rev-tab-${e.id}`,"aria-selected":x===e.id,"aria-controls":`rev-panel-${e.id}`,onClick:()=>C(e.id),className:Oe(x===e.id),children:[e.label,e.n!==void 0&&(0,G.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n}),e.id===`run`&&Z&&(0,G.jsx)(`span`,{"aria-label":Z.ok?`passed`:`failed`,className:N(`size-2 rounded-full`,Z.ok?`bg-pass`:`bg-fail`)})]},e.id))}),(0,G.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${x}`,"aria-labelledby":`rev-tab-${x}`,className:`flex min-w-0 flex-col gap-4`,children:[x===`steps`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(se,{id:`rev-step-search`,label:`Find a step`,value:le,onChange:ue}),(0,G.jsx)(pe,{items:[{id:`all`,label:`All`,n:d.steps.length},{id:`checks`,label:`Checks`,n:st},...dt?[{id:`failed`,label:`Failed`,n:dt,alert:!0}]:[]],value:de,onChange:he}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(F,{size:`sm`,variant:`ghost`,disabled:ve||_,onClick:()=>void rt(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,G.jsx)(M,{"aria-hidden":`true`}),ve?`Asking…`:`Suggest`]})]}),be&&(0,G.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:be}),ge&&ge.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2.5 text-ink`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(z,{icon:v,size:14}),(0,G.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,G.jsxs)(F,{size:`sm`,disabled:_,onClick:()=>void at(ge),"data-tip":`Add all the suggestions`,children:[(0,G.jsx)(n,{"aria-hidden":`true`}),`Add all`]}),(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>_e(null),className:`size-8`,children:(0,G.jsx)(r,{"aria-hidden":`true`})})]}),(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:ge.map(e=>(0,G.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[13.5px]`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[e.kind===`data`||e.kind===`unique`?e.label:`After step ${e.after+1}: ${e.label}`,e.why&&(0,G.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,G.jsx)(F,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void at([e]),className:`size-8`,children:(0,G.jsx)(n,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),pt.length===0?(0,G.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-4 text-sm text-muted`,children:`No step matches.`}):(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:pt.map((t,a)=>{let s=ct.get(t.index),c=t.op===`expect`;return(0,G.jsxs)(`li`,{id:`step-${t.index}`,className:N(`flex scroll-mt-48 flex-col`,a>0&&`border-t border-line-soft`,s&&!s.ok&&`bg-fail-soft`),children:[(0,G.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-3 px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right font-mono text-[12px] text-muted tabular-nums`,children:t.index+1}),(0,G.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:s?s.skipped?(0,G.jsx)(w,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):s.ok?(0,G.jsx)(i,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,G.jsx)(r,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):c?(0,G.jsx)(E,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[c&&(0,G.jsx)(R,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-[11px]`,children:`Check`}),(0,G.jsx)(`span`,{className:`min-w-0 text-[14px] text-ink [overflow-wrap:anywhere]`,children:t.line}),t.block&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-px text-[11.5px] text-ink-2`,children:[(0,G.jsx)(z,{icon:S,size:11}),V.find(e=>e.id===t.block)?.name||t.block]})]}),t.note&&(0,G.jsxs)(`span`,{className:`text-[12.5px] text-ink-2`,children:[`Note: `,t.note]}),s&&!s.ok&&s.error&&(0,G.jsx)(`span`,{className:`line-clamp-2 text-[12.5px] text-fail [overflow-wrap:anywhere]`,"data-tip":s.error,children:s.error}),t.suggest&&t.suggest.length>0&&(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":ae===t.index,onClick:()=>oe(ae===t.index?null:t.index),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[12.5px] font-medium text-accent-fg hover:text-accent-fg-hover`,children:[(0,G.jsx)(z,{icon:v,size:12}),ae===t.index?`Hide the suggested checks`:`${I(t.suggest.length,`suggested check`)}`]})]}),(0,G.jsxs)(`span`,{className:`relative flex flex-none items-center gap-0.5`,children:[(0,G.jsx)(F,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`menu`,"aria-expanded":re===t.index,"aria-label":`Add a check, step or note after step ${t.index+1}`,"data-tip":`Add a check, step or note after step ${t.index+1}`,onClick:()=>A(re===t.index?null:t.index),className:`size-8`,children:(0,G.jsx)(n,{"aria-hidden":`true`})}),(0,G.jsx)(Ce,{open:re===t.index,onClose:()=>A(null),label:`Add after step ${t.index+1}`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,G.jsx)(Le,{step:t,...l?{onRecordMore:()=>{A(null),l(t.index)}}:{},onAdd:e=>{A(null),X(e)}})}),t.shot&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.index+1}`,"aria-expanded":j===t.index,"data-tip":`See the page after step ${t.index+1}`,onClick:()=>ie(j===t.index?null:t.index),className:`size-8`,children:(0,G.jsx)(ee,{"aria-hidden":`true`})}),!t.fixed&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Drop step ${t.index+1}`,"data-tip":`Drop step ${t.index+1}`,onClick:()=>void X({remove:[t.index]}),className:`size-8`,children:(0,G.jsx)(k,{"aria-hidden":`true`})})]})]}),ae===t.index&&t.suggest&&t.suggest.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pr-3 pb-2.5 pl-3 sm:pl-[76px]`,children:[(0,G.jsx)(`span`,{className:`text-[12.5px] text-ink-2`,children:`Add a check that`}),t.suggest.map(e=>(0,G.jsxs)(F,{size:`sm`,disabled:_,"data-tip":`Add this check after the step`,onClick:()=>void X({checks:[{after:t.index,kind:e.kind,text:e.text}]}),className:`h-7 min-h-7 max-w-full rounded-full px-2.5 text-[12.5px]`,children:[(0,G.jsx)(o,{"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),j===t.index&&t.shot&&t.snap&&(0,G.jsx)(Ie,{runDir:e,step:t,busy:_,onPick:(e,n)=>void X({checks:[{after:t.index,kind:e,text:n}]})})]},`${t.index}-${t.line}`)})})]}),x===`data`&&(ot.length===0?(0,G.jsx)(ce,{className:`py-4`,children:`Nothing was typed or chosen in this recording, so it has no test data.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Where each value you typed or chose comes from when the test runs.`}),(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:ot.map((e,t)=>{let n=e.value,r=Pe.filter(t=>e.op!==`select`||t.id===`typed`||t.id===`data`);return(0,G.jsxs)(`li`,{className:N(`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-2.5`,t>0&&`border-t border-line-soft`),children:[(0,G.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[12px] text-muted tabular-nums`,children:e.index+1}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[14px] text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,G.jsx)(`span`,{className:`text-[12.5px] text-ink-2`,children:Pe.find(e=>e.id===n.as)?.note})]}),(0,G.jsx)(B,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:_,onChange:t=>void X({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:r.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]},e.index)})})]})),x===`run`&&K&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Re-run plays the steps in a new browser, as the test will, so you know they work before the test is written. Choose where it runs and the values it types.`}),(0,G.jsxs)(`form`,{className:`flex flex-wrap items-end gap-3 rounded-[12px] card border p-3`,onSubmit:e=>{e.preventDefault(),tt(null)},children:[K.environments.length>0&&(0,G.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Environment`,(0,G.jsxs)(B,{value:Be,onChange:e=>Ve(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`Where it was recorded`}),K.environments.map(e=>(0,G.jsxs)(`option`,{value:e,children:[e,e===K.environment?` (active)`:``]},e))]})]}),K.data.length>0&&!!(K.sources?.files.length||K.sources?.requests.length)&&(0,G.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Test data`,(0,G.jsxs)(B,{value:q,onChange:e=>We(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`The values typed here`}),!!K.sources?.files.length&&(0,G.jsx)(`optgroup`,{label:`Each row of a data file`,children:K.sources.files.map(e=>(0,G.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!K.sources?.requests.length&&(0,G.jsx)(`optgroup`,{label:`Each row of a kept request`,children:K.sources.requests.map(e=>(0,G.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(q)&&(0,G.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Sheet`,(0,G.jsx)(L,{value:Ge,maxLength:100,placeholder:`The first sheet`,onChange:e=>Ke(e.target.value)})]}),!q&&K.data.map(e=>(0,G.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[e.name,(0,G.jsx)(L,{value:He[e.name]??``,maxLength:300,onChange:t=>Ue({...He,[e.name]:t.target.value})})]},e.name)),(0,G.jsxs)(F,{type:`submit`,disabled:Y||ht||gt,"data-tip":ht?`Another run is going`:void 0,children:[(0,G.jsx)(a,{"aria-hidden":`true`}),Y?`Running…`:`Re-run`]})]}),q&&(0,G.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`The steps play once for each row (up to 20), one after another. A column named like the test data (`,K.data.map(e=>e.name).join(`, `),`) gives its value; other columns are left out.`]}),Y&&(0,G.jsx)(R,{tone:`running`,children:`Playing the steps in a new browser…`}),!Y&&!Z&&(0,G.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Not run yet.`}),Z&&(0,G.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:N(`m-0 text-sm font-semibold [overflow-wrap:anywhere]`,Z.ok?`text-pass`:`text-fail`),children:Z.rows?Z.ok?`All ${Z.rows.length} rows passed${Z.env?` on ${Z.env}`:``}${Z.ms?` in ${Math.round(Z.ms/1e3)}s`:``}. The steps below are row ${Z.rows.at(-1)?.n}'s.`:Z.rows.some(e=>!e.ok)?`${Z.rows.filter(e=>!e.ok).length} of ${Z.rows.length} rows failed${Z.env?` on ${Z.env}`:``}. The steps below are row ${Z.rows.find(e=>!e.ok)?.n}'s.`:`It did not get through${Z.env?` on ${Z.env}`:``}: ${Z.error||`no row was played`}`:Z.ok?`All ${Z.steps.length} steps passed${Z.env?` on ${Z.env}`:``}${Z.ms?` in ${Math.round(Z.ms/1e3)}s`:``}.`:Q?`Step ${Q.n} failed${Z.env?` on ${Z.env}`:``}.`:`It did not get through${Z.env?` on ${Z.env}`:``}: ${Z.error||`the last page was not the recorded one`}`}),Z.rows&&(0,G.jsx)(`ol`,{"aria-label":`Rows of ${Z.from||`the test data`}`,className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13.5px]`,children:Z.rows.map((e,t)=>(0,G.jsxs)(`li`,{className:N(`flex items-start gap-2 px-3 py-1.5`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.ok?(0,G.jsx)(i,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-0.5 flex-none text-pass`}):(0,G.jsx)(r,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-0.5 flex-none text-fail`}),(0,G.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[12px] text-muted tabular-nums`,children:e.n}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.label||`Row ${e.n}`}),!e.ok&&e.error&&(0,G.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))}),Z.steps.length>0&&(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13.5px]`,children:Z.steps.map((e,t)=>(0,G.jsxs)(`li`,{className:N(`flex items-start gap-2 px-3 py-1.5`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,G.jsx)(w,{size:14,"aria-label":`Not replayed`,className:`mt-0.5 flex-none text-muted`}):e.ok?(0,G.jsx)(i,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-0.5 flex-none text-pass`}):(0,G.jsx)(r,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-0.5 flex-none text-fail`}),(0,G.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[12px] text-muted tabular-nums`,children:e.n}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,G.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,G.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]})]}),x===`instructions`&&(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-semibold text-ink`,children:[`Instructions for the Coding agent`,(0,G.jsx)(`span`,{className:`text-[13px] font-normal text-ink-2`,children:`Anything else about the test, in your words: where it goes, the page objects to use, its tags, what to leave out. Saved when you leave the box.`}),(0,G.jsx)(fe,{value:Se,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>we(e.target.value),onBlur:()=>Se.trim()!==d.instructions&&void X({instructions:Se.trim()}),className:`font-normal`})]}),x===`blocks`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Steps you do in many tests, like signing in, kept under a name: put them into other recordings, or start a new one from them. The Coding agent writes each block once, as a helper every test calls.`}),De===!0&&(0,G.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`They are kept in .forgeqe/blocks/ and go into the repository with your next commit, so the team shares them.`}),De===!1&&(0,G.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-3 py-2 text-[13px] text-ink`,children:[`Your .gitignore leaves .forgeqe/blocks/ out of the repository, so only you have these blocks. To share them with the team, ignore only `,(0,G.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,G.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[12px] card border p-3`,children:[(0,G.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),H.name.trim()&&nt()},children:[(0,G.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Keep steps`,(0,G.jsx)(B,{"aria-label":`The first step of the block`,value:H.from,onChange:e=>je({...H,from:Number(e.target.value),to:Math.max(H.to,Number(e.target.value))}),className:`w-[84px]`,children:d.steps.map(e=>(0,G.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,G.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`to`,(0,G.jsx)(B,{"aria-label":`The last step of the block`,value:H.to,onChange:e=>je({...H,to:Number(e.target.value)}),className:`w-[84px]`,children:d.steps.filter(e=>e.index>=H.from).map(e=>(0,G.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,G.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`as the block`,(0,G.jsx)(L,{value:H.name,maxLength:80,placeholder:`Sign in`,onChange:e=>je({...H,name:e.target.value})})]}),(0,G.jsxs)(F,{type:`submit`,disabled:_||!H.name.trim(),"data-tip":`Keep as a block`,children:[(0,G.jsx)(i,{"aria-hidden":`true`}),`Keep`]})]}),Fe&&(0,G.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:Fe}),V.length>0&&(0,G.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 border-t border-line-soft pt-3`,onSubmit:e=>{e.preventDefault();let t=U.block||V[0].id;X({insert:{after:U.after,block:t}})},children:[(0,G.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Put in the block`,(0,G.jsx)(B,{"aria-label":`The block to put in`,value:U.block||V[0].id,onChange:e=>Me({...U,block:e.target.value}),children:V.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,G.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`after step`,(0,G.jsx)(B,{"aria-label":`The step the block goes after`,value:U.after,onChange:e=>Me({...U,after:Number(e.target.value)}),className:`w-[84px]`,children:d.steps.map(e=>(0,G.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,G.jsxs)(F,{type:`submit`,disabled:_,"data-tip":`Put the block in after the step`,children:[(0,G.jsx)(n,{"aria-hidden":`true`}),`Add`]})]})]})]}),x===`history`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`m-0 flex items-center gap-1.5 text-sm text-ink-2`,children:[(0,G.jsx)(z,{icon:c,size:15}),`Every change is kept: go back to any version, and you can come back from it too.`]}),(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:[...d.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,G.jsxs)(`li`,{className:N(`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2`,t>0&&`border-t border-line-soft`),children:[(0,G.jsxs)(`span`,{className:`w-8 flex-none font-mono text-[12px] text-muted tabular-nums`,children:[`v`,e.n]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[14px] text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,G.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[Te(e.at),` · `,I(e.steps,`step`)]})]}),t===0?(0,G.jsx)(R,{tone:`neutral`,icon:!1,children:`Now`}):(0,G.jsx)(F,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Go back to v${e.n}`,"data-tip":`Go back to v${e.n}`,onClick:()=>void X({restore:e.n}),className:`size-8`,children:(0,G.jsx)(s,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function Ie({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(``);(0,W.useEffect)(()=>{let n=!1;return P.shot(e,t.shot).then(e=>!n&&a(e),e=>!n&&s(e.message)),()=>{n=!0}},[e,t.shot]);let c=t.snap,l=[...c.texts.map(e=>({...e,kind:`text`})),...c.fields.filter(e=>e.value).map(e=>({...e,kind:`value`}))].filter(e=>e.w>0&&e.h>0&&c.w>0&&c.h>0).sort((e,t)=>t.w*t.h-e.w*e.h),u=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 pr-3 pb-3 pl-3 sm:pl-[76px]`,children:[(0,G.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,G.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:o}),!i&&!o&&(0,G.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading the picture…`}),i&&(0,G.jsxs)(`div`,{className:`relative w-full max-w-[720px] overflow-hidden rounded-[10px] border border-line-soft`,style:{aspectRatio:`${c.w} / ${c.h}`},children:[(0,G.jsx)(`img`,{src:i,alt:`The page after step ${t.index+1}`,className:`absolute inset-0 size-full object-cover object-top`}),l.map((e,t)=>{let i=e.kind===`value`?`Check ${e.t} has the value "${e.value}"`:`Check the page shows "${e.t}"`;return(0,G.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t),className:`absolute rounded-[3px] outline-none hover:bg-accent/15 hover:ring-2 hover:ring-accent focus-visible:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent`,style:{left:u(e.x,c.w),top:u(e.y,c.h),width:u(e.w,c.w),height:u(e.h,c.h)}},`${t}-${e.t}`)})]})]})}function Le({step:e,onAdd:t,onRecordMore:r}){let[a,o]=(0,W.useState)(`check`),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),[d,p]=(0,W.useState)(e.note||``),m=e.index;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`What to add`,className:`flex gap-1 rounded-[9px] bg-surface-strong p-1`,children:[[`check`,`Check`],[`step`,`Step`],[`note`,`Note`]].map(([e,t])=>(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===e,onClick:()=>o(e),className:N(`flex-1 cursor-pointer rounded-[6px] border-0 px-2 py-1 text-[13px] font-medium`,a===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),a===`check`&&(0,G.jsxs)(G.Fragment,{children:[e.page&&(0,G.jsxs)(F,{size:`sm`,className:`justify-start`,onClick:()=>t({checks:[{after:m,kind:`url`}]}),children:[`The page is `,e.page]}),(0,G.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),s.trim()&&t({checks:[{after:m,kind:`intent`,text:s.trim()}]})},children:[(0,G.jsx)(L,{value:s,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>c(e.target.value)}),(0,G.jsxs)(F,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),"data-tip":`Add the check`,children:[(0,G.jsx)(n,{"aria-hidden":`true`}),`Add`]})]})]}),a===`step`&&(0,G.jsxs)(G.Fragment,{children:[r&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,G.jsxs)(F,{size:`sm`,onClick:r,"data-tip":`Record more from here`,children:[(0,G.jsx)(f,{"aria-hidden":`true`}),`Record`]}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted`,children:`The browser opens, does the steps up to here, and you record what comes next. A step that cannot be done, you redo by hand.`})]}),(0,G.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),s.trim()&&t({steps:[{after:m,kind:`do`,text:s.trim()}]})},children:[(0,G.jsx)(L,{value:s,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>c(e.target.value)}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted`,children:`The Coding agent finds the control on the page and does it here.`}),(0,G.jsxs)(F,{type:`submit`,size:`sm`,variant:`primary`,disabled:!s.trim(),"data-tip":`Add the step`,children:[(0,G.jsx)(n,{"aria-hidden":`true`}),`Add`]})]}),(0,G.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(l.trim())&&t({steps:[{after:m,kind:`open`,url:l.trim()}]})},children:[(0,G.jsx)(L,{value:l,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>u(e.target.value),className:`min-w-0 flex-1`}),(0,G.jsxs)(F,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(l.trim()),"data-tip":`Add a step that opens this page`,children:[(0,G.jsx)(n,{"aria-hidden":`true`}),`Add`]})]}),(0,G.jsxs)(F,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:m,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,G.jsx)(b,{"aria-hidden":`true`}),`Go back`]})]}),a===`note`&&(0,G.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),t({notes:[{index:m,text:d.trim()}]})},children:[(0,G.jsx)(L,{value:d,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>p(e.target.value)}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,G.jsxs)(F,{type:`submit`,size:`sm`,variant:`primary`,disabled:d.trim()===(e.note||``),"data-tip":d.trim()||!e.note?`Save the note`:`Remove the note`,children:[d.trim()||!e.note?(0,G.jsx)(i,{"aria-hidden":`true`}):(0,G.jsx)(k,{"aria-hidden":`true`}),d.trim()||!e.note?`Save`:`Remove`]})]})]})}var Re={navigate:D,back:b,click:T,dblclick:T,input:_,press:_,select:t,upload:j,expect:E,wait_for:u,capture:m,note:x,launch:a,double_click:T,type:_,keys:_},K=e=>Re[e]||(e.startsWith(`expect`)?E:C),ze=new Set([`starting`,`recording`,`paused`,`stopping`]);function Be(e,t){let n=Math.max(0,Math.round(((t?Date.parse(t):Date.now())-Date.parse(e))/1e3));return n<3600?`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`}async function Ve(e){let{id:t}=await me.start(`Turn the recording in ${e} into a test: call write_test with run_dir ${e} and unattended true.`,{});location.hash=oe(`chats`,t)}async function He(e){let{id:t}=await me.start(`Replay the desktop workflow ${e}: call desktop_replay with workflow ${e}, and tell me how each step went.`,{});location.hash=oe(`chats`,t)}function Ue({s:e,live:t,onDelete:n}){let r=K(e.op);return(0,G.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-3 border-t border-line-soft py-2 first:border-t-0`,children:[(0,G.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right text-[13px] text-muted tabular-nums`,children:e.n}),(0,G.jsx)(r,{size:16,"aria-hidden":`true`,className:N(`mt-0.5 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,G.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[12px] text-muted`,children:[e.case_step?(0,G.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,G.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,G.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,G.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,G.jsx)(F,{variant:`icon`,size:`icon`,"aria-label":`Delete step ${e.n}`,"data-tip":`Delete step ${e.n}`,onClick:n,className:`size-8 flex-none opacity-60 group-hover:opacity-100`,children:(0,G.jsx)(k,{"aria-hidden":`true`})})]})}function q({s:n,send:r,busy:i}){let[,o]=(0,W.useState)(0);(0,W.useEffect)(()=>{let e=setInterval(()=>o(e=>e+1),1e3);return()=>clearInterval(e)},[]);let s=(0,W.useRef)(null),c=(0,W.useRef)(null);(0,W.useEffect)(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[n.log.length]),(0,W.useEffect)(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[n.steps.length]);let l=n.kind===`desktop`,u=n.state===`paused`,d=n.log.at(-1)?.level===`warn`&&/press Stop again/i.test(n.log.at(-1).text),f=Math.max(0,...n.steps.map(e=>e.case_step||0));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] card border px-4 py-3`,children:[u?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,G.jsx)(le,{state:n.state===`starting`?`waiting`:n.state===`stopping`?`working`:`recording`,px:20}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n.name}),(0,G.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[n.state===`starting`?l?`Starting ${n.app}…`:`Opening the browser…`:n.state===`stopping`?`Saving the workflow…`:u?`Paused: what you do now is not recorded`:`Recording`,` · `,Be(n.startedAt),` ·`,` `,l?`${n.app}, a desktop app`:n.url]}),n.block&&(0,G.jsx)(`span`,{className:N(`text-[13px] [overflow-wrap:anywhere]`,n.block.state===`stopped`?`text-warn`:`text-muted`),children:n.block.kind===`recording`?n.block.state===`waiting`?`The recording's steps up to step ${n.block.total+1} play when the page is open.`:n.block.state===`playing`?`Doing the recording's steps up to step ${n.block.total+1}: wait for it.`:n.block.state===`done`?`At step ${n.block.total+1}: record what comes next, then Stop and save.`:`Step ${n.block.done+2} could not be done${n.block.note?` (${n.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${n.block.done+2} to ${n.block.total+1}.`:n.block.state===`waiting`?`The block "${n.block.name}" plays when the page is open.`:n.block.state===`playing`?`Doing the block "${n.block.name}" (${n.block.total} steps): wait for it.`:n.block.state===`done`?`The block "${n.block.name}" is done: carry on.`:`The block "${n.block.name}" stopped after ${n.block.done} of ${n.block.total} steps${n.block.note?` (${n.block.note})`:``}: do the rest by hand.`})]}),!l&&(0,G.jsxs)(F,{disabled:i||n.state===`starting`,onClick:()=>r({cmd:`pause`}),children:[u?(0,G.jsx)(a,{"aria-hidden":`true`}):(0,G.jsx)(ie,{"aria-hidden":`true`}),u?`Resume`:`Pause`]}),!l&&(0,G.jsxs)(F,{disabled:i||n.state===`starting`||!n.steps.length,onClick:()=>r({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,G.jsx)(y,{"aria-hidden":`true`}),`Undo`]}),(0,G.jsxs)(F,{variant:`destructive`,disabled:i||n.state===`stopping`,onClick:()=>r({cmd:`stop`,...d?{force:!0}:{}}),"data-tip":d?`Stop anyway`:`Stop and save`,children:[(0,G.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),l?(0,G.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-3 text-sm leading-relaxed text-ink-2`,children:[n.app,` is open on this computer: do the steps in it. Only clicks and keys in its own windows are recorded; password fields are saved as secret names, never as what you type. In the app, `,(0,G.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,G.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,G.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-3 text-sm leading-relaxed text-ink-2`,children:[`Do the steps in the browser on this computer: each click, entry and choice is recorded. When you stop, you choose the checks and the test data here. In the page, `,n.leader,` then `,(0,G.jsx)(`strong`,{children:`P`}),` pauses, `,(0,G.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,G.jsx)(`strong`,{children:`S`}),` stops.`]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-5`,children:[(0,G.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:`flex min-w-0 flex-[999_1_420px] flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,G.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,G.jsx)(z,{icon:t,size:18,className:`text-accent-fg`}),`Steps`,(0,G.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:n.summary})]}),n.steps.length?(0,G.jsx)(`div`,{ref:c,className:`max-h-[60vh] overflow-y-auto`,children:(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:n.steps.map(e=>(0,G.jsx)(Ue,{s:e,live:!l,onDelete:()=>r({cmd:`delete`,n:e.n})},`${e.n}-${e.text}`))})}):(0,G.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:n.state===`starting`?l?`Starting ${n.app}…`:`Opening the browser…`:`Nothing yet: do the first step in ${l?n.app:`the browser`}.`})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-5`,children:[n.case&&(0,G.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,G.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,G.jsx)(z,{icon:t,size:18,className:`text-accent-fg`}),n.case.id]}),(0,G.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[n.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,G.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:n.case.steps.map(e=>{let t=n.steps.some(t=>t.case_step===e.n);return(0,G.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,G.jsxs)(`button`,{type:`button`,disabled:i,"aria-current":e.n===f?`step`:void 0,onClick:()=>r({cmd:`case_step`,n:e.n}),className:N(`flex w-full cursor-pointer items-start gap-2 rounded-[10px] border-0 bg-transparent px-2 py-2 text-left text-sm text-ink hover:bg-surface-muted`,e.n===f&&`bg-accent-soft`),children:[t?(0,G.jsx)(E,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-pass`}):(0,G.jsx)(`span`,{className:`mt-0.5 w-4 flex-none text-center text-[12px] text-muted`,children:e.n}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.action}),e.expected&&(0,G.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,e.expected]})]})]})},e.n)})}),(0,G.jsxs)(F,{disabled:i,onClick:()=>r({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,G.jsx)(ne,{"aria-hidden":`true`}),`Next`]})]}),(0,G.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,G.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,G.jsx)(`div`,{ref:s,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-[13px]`,"aria-live":`polite`,children:n.log.length?n.log.map((e,t)=>(0,G.jsx)(`p`,{className:N(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,G.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,l?`the app`:`the browser`,`…`]})})]})]})]})]})}function We({s:e}){let t=e.result,[n,r]=(0,W.useState)(``),[i,o]=(0,W.useState)(!1);if(!t)return null;let s=e.kind===`desktop`;return(0,G.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,G.jsx)(R,{tone:t.ok?`pass`:`fail`,children:t.ok?`Recorded`:`Not recorded`})]}),(0,G.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[t.ok?t.summary||e.summary:t.error||`Nothing was recorded.`,` `,e.endedAt&&(0,G.jsxs)(`span`,{className:`text-muted`,children:[`· `,Be(e.startedAt,e.endedAt)]})]}),t.ok&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,G.jsx)(R,{tone:`neutral`,icon:!1,children:I(e.steps.length,`step`)}),(0,G.jsxs)(R,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,G.jsxs)(R,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,G.jsxs)(R,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!s&&t.secrets.length>0&&(0,G.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,G.jsxs)(`span`,{children:[t?`, `:``,(0,G.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-warn`,children:t.caseGaps.map(e=>(0,G.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-ink-2`,children:t.notes.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-muted`,children:t.skipped.map((e,t)=>(0,G.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s&&t.workflow&&(0,G.jsxs)(F,{variant:`primary`,disabled:i,onClick:async()=>{o(!0);try{await He(t.workflow)}catch(e){r(e.message),o(!1)}},children:[(0,G.jsx)(a,{"aria-hidden":`true`}),`Replay`]}),s&&t.report&&(0,G.jsxs)(F,{onClick:async()=>r(await he(t.report)),"data-tip":`Open the report`,children:[(0,G.jsx)(O,{"aria-hidden":`true`}),`Report`]}),!s&&t.ok&&(0,G.jsxs)(F,{onClick:async()=>r(await he(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,G.jsx)(A,{"aria-hidden":`true`}),`Steps`]}),(0,G.jsx)(`span`,{className:`text-sm`,children:(0,G.jsx)(V,{path:s&&t.workflow?t.workflow:e.runDir})}),n&&(0,G.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})]})}function Ge(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function Ke({view:e,busy:t,onStart:n,start:r}){let i=Ge(r),[a,o]=(0,W.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:`web`),[s,c]=(0,W.useState)(e.desktop.apps[0]??``),[l,u]=(0,W.useState)(``),[d,p]=(0,W.useState)(``),[m,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(!1),[y,b]=(0,W.useState)(``),[x,S]=(0,W.useState)(i?``:e.apps[0]?.name??``),[C,w]=(0,W.useState)(i),[T,ee]=(0,W.useState)(``),[E,te]=(0,W.useState)(e.environment??``),[ne,O]=(0,W.useState)(!1),[k,A]=(0,W.useState)(!1),[j,ie]=(0,W.useState)(``),M=a===`web`?e.blocks.find(e=>e.id===j):void 0,P=a===`desktop`?e.desktop.available&&(!!s||!!l.trim()&&!!d.trim()):M||x?!0:/^https?:\/\/\S+$/i.test(C.trim()),I=a===`web`||e.environments.length>1;return(0,G.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,onSubmit:t=>{if(t.preventDefault(),P){if(a===`desktop`&&s)return n({kind:`desktop`,app:s,...E&&E!==e.environment?{env:E}:{}});if(a===`desktop`)v(!0),b(``),de.addApp({name:d.trim(),path:l.trim(),...E?{env:E}:{}}).then(t=>n({kind:`desktop`,app:t.name,...E&&E!==e.environment?{env:E}:{}}),e=>b(e.message)).finally(()=>v(!1));else{if(M)return n({block:M.id,...E&&E!==e.environment?{env:E}:{},signedIn:ne});n({...x?{app:x}:{url:C.trim()},...T.trim()?{case:T.trim()}:{},...E&&E!==e.environment?{env:E}:{},signedIn:ne})}}},children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,D,!0],[`desktop`,`Desktop app`,re,e.desktop.available]].map(([t,n,r,i])=>(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a===t,disabled:!i,"data-tip":i?void 0:e.desktop.reason||`Windows only.`,onClick:()=>o(t),className:N(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50`,a===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,G.jsx)(r,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,G.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1fr)_auto]`,children:[a===`desktop`?(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.desktop.apps.length>0&&(0,G.jsxs)(B,{"aria-label":`App`,value:s,onChange:e=>c(e.target.value),className:N(s?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.desktop.apps.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e)),(0,G.jsx)(`option`,{value:``,children:`Another app…`})]}),!s&&(0,G.jsx)(U,{value:l,onChange:e=>{u(e),m||p(e.trim()?je(e):``)},onPicked:(e,t)=>{m||p(t)},onError:b,className:`flex-1`})]}):M?(0,G.jsxs)(`p`,{className:`m-0 self-center text-sm [overflow-wrap:anywhere]`,children:[`Opens `,M.startUrl,`, does the block `,(0,G.jsx)(`strong`,{className:`font-semibold`,children:M.name}),` (`,M.steps,` `,M.steps===1?`step`:`steps`,`), then you carry on.`]}):(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,G.jsxs)(B,{"aria-label":`Start on`,value:x,onChange:e=>S(e.target.value),className:N(x?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,G.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,G.jsx)(`option`,{value:``,children:`Another page…`})]}),!x&&(0,G.jsx)(L,{"aria-label":`Page address`,type:`url`,value:C,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>w(e.target.value),className:`min-w-0 flex-1`})]}),(0,G.jsxs)(F,{type:`submit`,variant:`primary`,disabled:t||_||!P,"data-tip":`Start recording`,children:[(0,G.jsx)(f,{"aria-hidden":`true`}),_?`Adding…`:t?a===`desktop`?`Starting…`:`Opening…`:`Record`]})]}),a===`desktop`&&!s&&(0,G.jsxs)(`label`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-sm font-medium`,children:[`Save it as`,(0,G.jsx)(L,{"aria-label":`The app's name`,value:d,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{g(!0),p(e.target.value)},className:`w-[220px]`}),(0,G.jsxs)(`span`,{className:`text-[12.5px] font-normal text-muted`,children:[`Added to the apps of `,E||e.environment?`the ${E||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]}),y&&(0,G.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:y}),I&&(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":k,onClick:()=>A(!k),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:[(0,G.jsx)(h,{size:14,"aria-hidden":`true`,className:N(`transition-transform`,k&&`rotate-180`)}),`More options`,!k&&(T||ne||M||E&&E!==e.environment)?(0,G.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,G.jsx)(ge,{open:k,children:(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-[12px] bg-surface-muted p-3 @2xl:grid-cols-2`,children:[a===`web`&&e.blocks.length>0&&(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Start from a block `,(0,G.jsx)(`span`,{className:`-mt-1 text-[12.5px] font-normal text-muted`,children:`Its steps are done for you first, then you record the rest.`}),(0,G.jsxs)(B,{value:j,onChange:e=>ie(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`No block: start on the page`}),e.blocks.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),a===`web`&&(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Test case `,(0,G.jsx)(`span`,{className:`-mt-1 text-[12.5px] font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,G.jsx)(L,{value:T,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>ee(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(a===`desktop`||!!x)&&(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,G.jsx)(B,{value:E,onChange:e=>te(e.target.value),children:e.environments.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]}),a===`web`&&e.logins.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 @2xl:col-span-2`,children:[(0,G.jsx)(ye,{checked:ne,onChange:O,label:`Start signed in`}),(0,G.jsxs)(`span`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,G.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`With the saved sign-ins (`,e.logins.join(`, `),`). Off: the sign-in is recorded too, its password saved as a variable name, never as typed.`]})]})]})]})}),(0,G.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:a===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:`A browser opens on this computer: do the steps, then choose the checks and the test data here, and the Coding agent writes the test.`})]})}var J=20;function qe({rows:e,onReview:t,onDeleted:n}){let[i,o]=(0,W.useState)(``),[s,c]=(0,W.useState)([]),[l,u]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1);(0,W.useEffect)(()=>c(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let m=async()=>{p(!0),o(``);try{let e=s.length;n(await P.deleteRecordings(s)),c([]),o(`Deleted ${I(e,`recording`)}.`)}catch(e){o(e.message)}finally{p(!1),u(!1)}},[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(`all`),[y,b]=(0,W.useState)(0);if((0,W.useEffect)(()=>b(0),[h,_]),!e.length)return null;let x=h.toLowerCase().split(/\s+/).filter(Boolean),S=e.filter(e=>x.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),C=_===`all`?S:S.filter(e=>e.kind===_),w=C.slice(y*J,y*J+J),T=e.some(e=>e.kind===`desktop`)&&e.some(e=>e.kind===`web`);return(0,G.jsxs)(`section`,{"aria-labelledby":`rec-list`,className:`flex min-w-0 flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h2`,{id:`rec-list`,className:`sr-only`,children:`Recordings`}),(0,G.jsx)(se,{id:`rec-search`,label:`Find a recording`,value:h,onChange:g}),T&&(0,G.jsx)(pe,{items:[{id:`all`,label:`All`,n:S.length},{id:`web`,label:`Web`,n:S.filter(e=>e.kind===`web`).length},{id:`desktop`,label:`Desktop`,n:S.filter(e=>e.kind===`desktop`).length}],value:_,onChange:v}),(0,G.jsxs)(`span`,{className:`ml-auto flex items-center gap-3`,children:[w.length>0&&(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,G.jsx)(Ee,{checked:w.every(e=>s.includes(e.runDir)),onCheckedChange:e=>c(e?[...new Set([...s,...w.map(e=>e.runDir)])]:s.filter(e=>!w.some(t=>t.runDir===e)))}),`Select all shown`]}),(0,G.jsxs)(F,{size:`sm`,variant:`danger`,disabled:!s.length||f,"data-tip":`Delete the selected recordings`,onClick:()=>u(!0),children:[(0,G.jsx)(k,{"aria-hidden":`true`}),`Delete`,s.length?` (${s.length})`:``]})]})]}),i&&(0,G.jsx)(`p`,{role:`status`,className:N(`m-0 text-[13px]`,i.startsWith(`Deleted`)?`text-muted`:`text-fail`),children:i}),(0,G.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,G.jsxs)(`ul`,{className:`m-0 list-none p-1.5`,children:[w.length===0&&(0,G.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),w.map((e,n)=>{let r=we(e.startedAt);return(0,G.jsxs)(`li`,{className:`contents`,children:[(n===0||we(w[n-1].startedAt)!==r)&&(0,G.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,G.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted`,children:[(0,G.jsx)(Ee,{"aria-label":`Select ${e.name}`,checked:s.includes(e.runDir),onCheckedChange:t=>c(t?[...s,e.runDir]:s.filter(t=>t!==e.runDir))}),e.ok?(0,G.jsx)(E,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,G.jsx)(d,{size:16,"aria-label":`Not recorded`,className:`text-fail`}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.kind===`desktop`?(0,G.jsx)(z,{icon:re,size:13,className:`flex-none text-muted`,label:`Desktop app`}):(0,G.jsx)(z,{icon:D,size:13,className:`flex-none text-muted`,label:`Web page`}),(0,G.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.name,children:e.name})]}),(0,G.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[I(e.steps,`step`),I(e.checks,`check`),e.caseId,e.app,Te(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,G.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[e.trace&&e.kind===`desktop`&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps of ${e.name}`,onClick:async()=>o(await he(e.trace)),className:`size-8`,children:(0,G.jsx)(A,{"aria-hidden":`true`})}),e.report&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report of ${e.name}`,onClick:async()=>o(await he(e.report)),className:`size-8`,children:(0,G.jsx)(O,{"aria-hidden":`true`})}),e.kind===`desktop`&&e.workflow&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Replay ${e.name}`,"data-tip":`Replay ${e.name}`,onClick:()=>He(e.workflow).catch(e=>o(e.message)),className:`size-8`,children:(0,G.jsx)(a,{"aria-hidden":`true`})}),e.kind===`web`&&e.ok&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Open ${e.name}`,"data-tip":`Open ${e.name}`,onClick:()=>t(e.runDir),className:`size-8`,children:(0,G.jsx)(ee,{"aria-hidden":`true`})}),e.kind===`web`&&e.ok&&(0,G.jsx)(F,{size:`icon`,variant:`icon`,"aria-label":`Write a test from ${e.name}`,"data-tip":`Write a test from ${e.name}`,onClick:()=>Ve(e.runDir).catch(e=>o(e.message)),className:`size-8`,children:(0,G.jsx)(te,{"aria-hidden":`true`})})]})]})]},e.runDir)})]}),(0,G.jsx)(ue,{page:y,size:J,total:C.length,onPage:b,label:`Pages of recordings`})]}),l&&(0,G.jsx)(ve,{open:!0,onClose:()=>u(!1),title:`Delete ${I(s.length,`recording`)}`,description:`Their steps, screenshots, tries and reports are removed from this computer. Tests already written from them stay.`,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(F,{variant:`ghost`,disabled:f,onClick:()=>u(!1),children:[(0,G.jsx)(r,{"aria-hidden":`true`}),`Cancel`]}),(0,G.jsxs)(F,{variant:`destructive`,disabled:f,onClick:()=>void m(),children:[(0,G.jsx)(k,{"aria-hidden":`true`}),f?`Deleting…`:`Delete`]})]}),children:(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 pt-4 text-sm text-ink-2`,children:e.filter(e=>s.includes(e.runDir)).map(e=>(0,G.jsxs)(`li`,{className:`truncate`,children:[e.name,` `,(0,G.jsxs)(`span`,{className:`text-muted`,children:[`· `,Te(e.startedAt)]})]},e.runDir))})})]})}function Je({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length)?null:(0,G.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-3 text-sm text-ink`,children:[(0,G.jsx)(`p`,{className:`m-0 font-semibold`,children:`Just recorded: worth knowing`}),t.secrets.length>0&&(0,G.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,G.jsxs)(`span`,{children:[t?`, `:``,(0,G.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.caseGaps.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`span`,{className:`font-medium text-warn`,children:[`No check for case step `,e.n]}),`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.notes.map((e,t)=>(0,G.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,G.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.skipped.map((e,t)=>(0,G.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function Ye({sub:e}={}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(`new`),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(!1),p=(0,W.useCallback)(()=>{P.get().then(e=>{r(e),l(``)},e=>l(e.message))},[]);(0,W.useEffect)(p,[p]);let m=!!n?.session&&ze.has(n.session.state);(0,W.useEffect)(()=>{if(!m)return;let e=setInterval(p,800);return()=>clearInterval(e)},[m,p]);let h=(0,W.useRef)(!1),g=n?.session;(0,W.useEffect)(()=>{m?h.current=!0:h.current&&g&&(h.current=!1,g.result?.ok&&g.kind===`web`&&a(g.runDir))},[m,g]);let _=async e=>{d(!0),l(``);try{r(await e())}catch(e){l(e.message)}finally{d(!1)}},v=(e,t)=>{a(null),window.scrollTo({top:0,behavior:`smooth`}),_(()=>P.start({more:{run:e,after:t}}))},y=e=>{a(e),window.scrollTo({top:0})},b=!!g?.result&&(g.kind===`desktop`||!g.result.ok);return(0,G.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,G.jsx)(xe,{}),(0,G.jsxs)(`main`,{className:N(Se,`@container flex-auto gap-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(_e,{pixel:be.record,size:`lg`}),(0,G.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Record`}),n&&!m&&!i&&(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`new`,`New recording`,f],[`recordings`,`Recordings${n.recordings.length?` (${n.recordings.length})`:``}`,t]].map(([e,t,n])=>(0,G.jsxs)(`button`,{type:`button`,role:`tab`,id:`rec-tab-${e}`,"aria-selected":o===e,"aria-controls":`rec-panel`,onClick:()=>s(e),className:N(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,o===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,G.jsx)(n,{size:14,"aria-hidden":`true`}),t]},e))})]}),!i&&(0,G.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and choice is recorded in order, and you choose the checks after.`}),c&&(0,G.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c}),!n&&!c&&(0,G.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&g&&m&&(0,G.jsx)(q,{s:g,busy:u,send:e=>void _(()=>P.command(e))}),n&&!m&&i&&(0,G.jsx)(Fe,{runDir:i,notices:g&&g.runDir===i?(0,G.jsx)(Je,{s:g}):void 0,onRecordMore:e=>v(i,e),onClose:()=>{a(null),s(`recordings`),p()}},i),n&&!m&&!i&&(0,G.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel`,"aria-labelledby":`rec-tab-${o}`,className:`flex min-w-0 flex-col gap-4`,children:[o===`new`&&(0,G.jsxs)(G.Fragment,{children:[b&&(0,G.jsx)(We,{s:g}),g?.result?.ok&&g.kind===`web`&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[12px] card border px-4 py-3 text-sm`,children:[(0,G.jsx)(E,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,G.jsx)(`strong`,{className:`font-semibold`,children:g.name}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[` · `,I(g.steps.length,`step`)]})]}),(0,G.jsxs)(F,{size:`sm`,onClick:()=>y(g.runDir),"data-tip":`Open the recording`,children:[(0,G.jsx)(ee,{"aria-hidden":`true`}),`Open`]})]}),(0,G.jsx)(Ke,{view:n,busy:u,start:e,onStart:e=>void _(()=>P.start(e))})]}),o===`recordings`&&(n.recordings.length?(0,G.jsx)(qe,{rows:n.recordings,onReview:y,onDeleted:r}):(0,G.jsx)(ce,{className:`py-4`,action:(0,G.jsxs)(F,{size:`sm`,onClick:()=>s(`new`),"data-tip":`New recording`,children:[(0,G.jsx)(f,{"aria-hidden":`true`}),`Record`]}),children:`No recordings yet.`}))]})]})]})}export{Ye as Record,Ge as givenStart};
|
|
@@ -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,j as T,kr as E,lt as D,m as O,o as ee,ot as k,pr as A,rt as te,tn as ne,tt as j,wr as M,wt as re}from"./line-icons-CQ-3V8ax.js";import{B as N,Bt as P,R as F,Vt as I,Wt as L,Y as R,_ as z,a as B,c as V,d as H,f as U,h as W,i as ie,l as ae,m as G,n as oe,o as K,r as se,s as ce,t as le}from"./filters-B4VDnWbr.js";import{Dt as ue,Et as de,L as fe,N as pe,Ot as me,at as he,et as ge,gt as _e,it as ve,nt as ye,ot as be,r as xe,rt as q,t as Se,tt as J,z as Ce}from"./frame-D-hqu7Oi.js";import{R as we,c as Te,r as Ee,s as De,z as Oe}from"./index-CtX74khE.js";import{n as ke,t as Ae}from"./segmented-BfWimTC0.js";import{n as je}from"./families-BiqSaqoO.js";import{t as Me}from"./fold-b2g0_ndv.js";import{r as Ne,s as Pe,t as Fe}from"./logos-DSveGjIW.js";import{d as Ie,o as Le,p as Re,r as ze,s as Be,t as Ve}from"./parts-D7OvxdrL.js";import{a as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,l as Ye,m as Y,o as Xe,p as Ze,r as Qe,s as $e,t as et,u as tt}from"./Steps-DfNHCe8N.js";var X=p(_(),1),Z=L(),nt=500,rt=10;function it({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||rt)),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=Number(m),x=Number.isInteger(b)&&b>=1&&b<=nt,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)(me,{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)(F,{variant:`ghost`,onClick:a,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{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)(De,{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)(B,{type:`number`,min:1,max:nt,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 `,nt,`.`]})]}),(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)(B,{value:l,onChange:e=>d(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(Je,{error:v})]})})}function at(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?He[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:We[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function ot({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=U(`tosca`,t.plan.id)}catch(e){c(e.message),o(!1)}};return(0,Z.jsx)(me,{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)(F,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,Z.jsx)(F,{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)(De,{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 st=[{id:`ci-github`,label:`GitHub Actions`},{id:`ci-azure`,label:`Azure Pipelines`}];function ct({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)(me,{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)(F,{variant:`ghost`,onClick:t,children:`Close`}),(0,Z.jsxs)(F,{disabled:!i,onClick:h,children:[(0,Z.jsx)(j,{"aria-hidden":`true`}),`Download`]}),!f&&(0,Z.jsx)(F,{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)(pe,{label:`CI`,current:`ci-${n}`,onPick:e=>!u&&r(e.slice(3)),tabs:st}),(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)(Te,{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 lt({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)(te,{size:11,"aria-hidden":`true`})]});return(0,Z.jsx)(me,{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)(F,{variant:`ghost`,onClick:t,children:x?`Close`:`Cancel`}),!x&&(0,Z.jsx)(F,{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)(B,{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)(B,{value:c,maxLength:200,onChange:e=>l(e.target.value),disabled:b})]}),(0,Z.jsxs)(`label`,{className:N(`flex items-start gap-2`,b?`cursor-default`:`cursor-pointer`),children:[(0,Z.jsx)(De,{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)(Me,{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)(Me,{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 ut({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=U(`tosca`,`conversions`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(me,{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)(F,{variant:`ghost`,onClick:r,"data-tip":`Keep it`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`}),`Keep`]}),(0,Z.jsxs)(F,{variant:`danger`,disabled:o||i!==e,onClick:()=>void d(),children:[(0,Z.jsx)(A,{"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)(B,{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 dt({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)(me,{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)(F,{variant:`ghost`,onClick:n,children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(F,{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)(ce,{value:a,rows:4,maxLength:2e3,placeholder:`The cart badge is a span now, not a button.`,onChange:e=>o(e.target.value)})]})]})})}function ft({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)(me,{open:!0,onClose:n,wide:!0,title:`Output of ${a?Q(a.target):t}`,description:r?.checkedAt?`Run again ${Re(r.checkedAt)}`:`From the conversion's own run`,footer:(0,Z.jsxs)(F,{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 pt(e){let t=Object.fromEntries($e.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 mt({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 ht({d:e,planView:t,busy:n,onFix:r,onSteps:i,onOutput:a,onRun:s,onNext:l}){let u=e.result||(e.job?.running?pt(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:N(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:N(`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)(mt,{label:u.status===`running`?`Running for`:`Took`,children:Ie(u.status===`running`?Date.now()-Date.parse(u.startedAt):u.ms)}),(0,Z.jsx)(mt,{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)(mt,{label:`Need attention`,children:(0,Z.jsx)(`span`,{className:y?`text-fail`:void 0,children:y})}),(0,Z.jsx)(mt,{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)(F,{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)(ge,{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:q,children:`File`}),(0,Z.jsx)(`th`,{className:q,children:`Status`}),(0,Z.jsx)(`th`,{className:N(q,`hidden @2xl:table-cell`),children:`Tosca steps`}),(0,Z.jsx)(`th`,{className:N(q,`hidden @3xl:table-cell`),children:`Note`}),(0,Z.jsx)(`th`,{className:q,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.plan.units.map(t=>{let s=d.get(t.id),c=s?tt[s.status]:null,l=t.case?e.plan.cases.find(e=>e.id===t.case):void 0;return(0,Z.jsxs)(`tr`,{className:he,children:[(0,Z.jsxs)(`td`,{className:J,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?`${qe(t)} · ${l.name}`:l.name:`${qe(t)} · ${t.target}`,l?.suites?.length?` · ${l.suites.join(`, `)}`:``]})]}),(0,Z.jsxs)(`td`,{className:N(J,`whitespace-nowrap`),children:[c?(0,Z.jsx)(V,{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 `,Ee(s.checkedAt)]})]}),(0,Z.jsx)(`td`,{className:N(J,`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:N(J,`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:N(J,`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)(F,{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)(F,{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)(ne,{"aria-hidden":`true`})}),s&&(s.status===`failed`||s.status===`blocked`)&&t.kind!==`setup`&&!t.engine&&(0,Z.jsx)(F,{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)(E,{"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)(Pe,{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:N(`text-[12px]`,r===e.cases.length?`text-pass`:`text-muted`),children:[r,` of `,Y(e.cases.length,`test`),` pass · @`,e.tag]})]}),(0,Z.jsx)(F,{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:Re(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 gt={fail:{icon:h,cls:`text-fail`,label:`Failed`},ok:{icon:T,cls:`text-pass`,label:`Done`},info:{icon:f,cls:`text-muted`,label:`Info`},agent:{icon:O,cls:`text-accent-fg`,label:`Agent`},tool:{icon:E,cls:`text-muted`,label:`Tool`}};function _t(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} · ${qe(a)} · ${a.target}`,status:t.result?.units.find(e=>e.id===a.id)?.status,events:[]}:{key:e,title:Ue[r.stage]||r.stage,sub:`Stage`,events:[]},n.set(e,i)}i.events.push(r)}return[...n.values()]}var vt=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function yt({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=_t(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)(ie,{id:`tosca-activity-search`,label:`Find a line`,value:a,onChange:o,placeholder:`Find a line, test case or file`}),(0,Z.jsx)(le,{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?tt[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:N(`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)(V,{tone:a.tone,children:a.label})]}),(0,Z.jsx)(ue,{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=gt[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:vt(e.ts)}),(0,Z.jsx)(n.icon,{size:16,role:`img`,"aria-label":n.label,className:N(`mt-0.5 flex-none`,n.cls)}),(0,Z.jsx)(`span`,{className:N(`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 bt({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),[_,y]=(0,X.useState)(null),[b,x]=(0,X.useState)([]),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[te,ne]=(0,X.useState)(!1),[j,M]=(0,X.useState)(!1),[re,N]=(0,X.useState)(!1),[I,L]=(0,X.useState)(!1),R=(0,X.useRef)(0),z=(0,X.useCallback)(()=>{P.detail(t).then(e=>{i(e),s(``)},e=>s(e.message));let e=R.current;P.events(t,e).then(e=>{if(e.next<R.current){R.current=0,x([]);return}let t=R.current;if(e.next<=t)return;let n=e.events.slice(Math.max(0,e.events.length-(e.next-t)));R.current=e.next,n.length&&x(e=>[...e,...n].slice(-2e3))},()=>{})},[t]);(0,X.useEffect)(z,[z]);let B=!!(r?.job?.running||r?.result?.status===`running`);(0,X.useEffect)(()=>{if(!B)return;let e=setInterval(z,1500);return()=>clearInterval(e)},[B,z]);let H=(0,X.useCallback)(e=>{i(e),s(``),d(`overview`),setTimeout(z,800)},[z]),W=async e=>{w(!0),s(``);try{i(await e()),setTimeout(z,800)}catch(e){s(e.message)}finally{w(!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 ie=at(r),ae=Ke(r.plan,r.result),G=r.result,oe=(G?.units||[]).filter(e=>e.kind===`test`&&(e.status===`failed`||e.status===`blocked`)).length,K=r.plan.cases.filter(e=>e.included).length,se=[{id:`overview`,label:`Overview`},{id:`steps`,label:`Steps`,n:K?String(K):void 0,tone:oe?`text-fail`:void 0},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:U(`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)(Pe,{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)(V,{tone:ie.tone,children:ie.label}),B?(0,Z.jsxs)(F,{variant:`danger`,disabled:C,onClick:()=>void W(()=>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)(F,{disabled:C,onClick:()=>L(!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)(Z.Fragment,{children:[(0,Z.jsxs)(F,{variant:`ghost`,onClick:()=>location.hash=U(`tosca`,t,`report`),children:[(0,Z.jsx)(k,{"aria-hidden":`true`}),`Report`]}),r.plan.units.some(e=>e.kind===`test`&&!e.engine)&&(0,Z.jsxs)(F,{disabled:C,onClick:()=>void W(()=>P.verify(t)),"data-tip":`Run every converted test again, no agent`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Run`]}),(0,Z.jsxs)(F,{variant:`ghost`,disabled:C,onClick:()=>O(!0),"data-tip":`Tosca changed? A new plan from the same exports that converts only what changed.`,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),`Re-import`]}),(0,Z.jsxs)(F,{variant:`ghost`,disabled:C,onClick:()=>M(!0),"data-tip":`A GitHub Actions or Azure Pipelines file that runs the converted tests and workflows.`,children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`CI`]}),(0,Z.jsxs)(F,{variant:`ghost`,disabled:C,onClick:()=>ne(!0),"data-tip":`Put the converted tests on a branch and open a pull request for review.`,children:[(0,Z.jsx)(a,{"aria-hidden":`true`}),`Pull request`]})]}):null,(0,Z.jsxs)(F,{variant:`ghost`,disabled:C,onClick:()=>E(!0),"data-tip":`Remove this plan from the list. Converted tests stay.`,children:[(0,Z.jsx)(A,{"aria-hidden":`true`}),`Delete`]})]})]})]}),D&&(0,Z.jsx)(ot,{d:r,onClose:()=>O(!1)}),te&&(0,Z.jsx)(lt,{id:t,onClose:()=>ne(!1)}),j&&(0,Z.jsx)(ct,{id:t,onClose:()=>M(!1)}),I&&(0,Z.jsx)(it,{plan:r.plan,acceptLimits:!1,again:!0,onClose:()=>L(!1),onStarted:e=>{L(!1),i(e)}}),re&&r.result?.batch&&(0,Z.jsx)(it,{plan:r.plan,acceptLimits:!1,next:r.result.batch,onClose:()=>N(!1),onStarted:e=>{N(!1),i(e)}}),T&&(0,Z.jsx)(ut,{id:t,title:`${Q(r.plan.source.file)} → ${r.plan.target.title}`,targetDir:r.plan.target.dir,onClose:()=>E(!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)(Ye,{states:G.stages})}),B&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(ae)}% done`,children:[Math.round(ae),`%`]})]}),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)(Be,{tabs:se,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)(ht,{d:r,planView:n(r,H),busy:C||B,onFix:h,onSteps:e=>(p(e),d(`steps`)),onOutput:y,onRun:e=>void W(()=>P.verify(t,e)),onNext:()=>N(!0)}),l===`steps`&&(0,Z.jsx)(et,{id:t,plan:r.plan,result:G,initial:f}),l===`activity`&&(0,Z.jsx)(yt,{d:r,events:b,running:B})]},l),_&&(0,Z.jsx)(ft,{d:r,unit:_,onClose:()=>y(null)}),m&&(0,Z.jsx)(dt,{d:r,unit:m,onClose:()=>h(null),onSend:e=>{h(null),W(()=>P.fix(t,[m],e))}})]})}var xt=e=>e.slice(e.lastIndexOf(`/`)+1),St=50,Ct=[{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 wt(e){return e===`converted`?tt.converted:e===`failed`?tt.failed:e===`blocked`?tt.blocked:e===`left out`?{label:`Left out`,tone:`neutral`}:e===`written`?tt.written:e===`not run`||e===`skipped`?{label:`Not run`,tone:`neutral`}:{label:e,tone:`neutral`}}function Tt(e){for(let t of $e){let n=e[t];if(n?.status===`failed`)return{id:t,...n.note?{note:n.note}:{}}}return null}function Et({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)(F,{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 Dt({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=wt(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?Ot[t.change]:``]})]}),(0,Z.jsx)(V,{tone:s.tone,children:s.label}),t.ms>0&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:Ie(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:N(`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)(Et,{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)(Me,{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)(ge,{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:N(`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=Qe[e.status]||Qe.matched;return(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:N(`px-3 py-2`,`font-mono text-[12px] text-muted`),children:e.id}),(0,Z.jsxs)(`td`,{className:N(`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:N(`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:N(`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)(Me,{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 Ot={same:`Unchanged in Tosca: its earlier test kept`,changed:`Changed in Tosca: converted again`,new:`New in Tosca`},kt=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function At(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(` / `),wt(t.status).label,t.file?`${e.target.dir}/${t.file}`:``,t.fidelity?`${t.fidelity.matched}/${t.fidelity.required}`:``,t.change?Ot[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(kt).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 jt({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)/St)),[s,c]=(0,X.useState)(o),l=(0,X.useId)();(0,X.useEffect)(()=>c(o()),[t.length]);let u=t.slice(s*St,s*St+St);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:N(`flex-none text-muted transition-transform`,n&&`rotate-180`)}),(0,Z.jsx)(`span`,{className:N(`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)(ue,{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:N(`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:Ie(e.ms)})]}),e.note&&(0,Z.jsx)(`span`,{className:N(`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>St&&(0,Z.jsx)(oe,{page:s,size:St,total:t.length,onPage:c,label:`${e.label} pages`})]})]})}function Mt({label:e,children:t,wide:n}){return(0,Z.jsxs)(`div`,{className:N(`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 Nt({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,``,U(`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:U(`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=He[n.status]||{label:n.status,tone:`neutral`},[T,...E]=n.target.id.split(`-`),D=Tt(n.stages),O=n.tests.length-n.counts.leftout,k=n.tests.find(e=>e.case===f)||null,A=Ct.reduce((e,t)=>e+x[t.id].length,0),te=Math.max(1,n.tests.length);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:U(`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:xt(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)(Pe,{framework:T,language:E.join(`-`),size:20}),n.target.title]})]})]}),(0,Z.jsx)(V,{tone:w.tone,children:w.label}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(F,{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)(F,{size:`sm`,variant:`ghost`,onClick:()=>At(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)(F,{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`]}),Ct.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:N(`size-2 rounded-full`,e.bar),"aria-hidden":`true`}),e.label,` `,(0,Z.jsx)(`span`,{className:N(`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:Ct.map(e=>n.counts[e.id]?(0,Z.jsx)(`span`,{className:e.bar,style:{width:`${n.counts[e.id]/te*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)(Mt,{label:`Time`,children:[Ie(n.ms),` · started `,Re(n.startedAt)]}),(0,Z.jsxs)(Mt,{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)(Mt,{label:`Media`,children:n.media?Y(n.media,`file`):n.target.video?`Videos and failure screenshots`:`Failure screenshots`}),(0,Z.jsxs)(Mt,{label:`LLM`,children:[n.model||`–`,n.usage.input||n.usage.output?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,Ce(n.usage.input+n.usage.output),` tokens`,n.cost?` · ${n.cost.estimate?`≈`:``}${fe(n.cost.amount,n.cost.currency)}`:``]}):null]}),(0,Z.jsxs)(Mt,{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)(Mt,{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:U(`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 `,Ue[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)(ie,{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)(le,{items:[{id:`all`,label:`All`,n:n.tests.length},...Ct.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:[Ct.filter(e=>x[e.id].length).map(e=>(0,Z.jsx)(jt,{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)),!A&&(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)(Dt,{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 Pt={converted:{icon:T,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`}},Ft=e=>`"${(/^[=+\-@\t\r]/.test(e)?`'${e}`:e).replace(/"/g,`""`)}"`;function It(e,t,n){let r=[[`Test case id`,`Test case`,`Kind`,`What happens`,`Modules behind it`].map(Ft).join(`,`)];for(let n of e.rows)for(let e of n.cases)r.push([e,t.get(e)||e,n.label,Pt[n.outcome].label,n.modules.map(e=>e.name).join(`; `)].map(Ft).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 Lt({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)(F,{size:`sm`,variant:`ghost`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[(0,Z.jsx)(y,{"aria-hidden":`true`,className:N(`transition-transform`,a&&`rotate-180`)}),a?`Hide the breakdown`:`Show the breakdown`]}),(0,Z.jsxs)(F,{size:`sm`,variant:`ghost`,onClick:()=>It(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)(ue,{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=Pt[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:N(`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 Rt={ok:{icon:T,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 zt({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)(K,{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)(B,{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)(F,{size:`sm`,type:`submit`,disabled:v||!l,children:`Use it`}),a&&(0,Z.jsx)(F,{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 Bt({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)(K,{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)(B,{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)(F,{size:`sm`,type:`submit`,disabled:t||!r.trim(),children:`Use it`})]})]})}function Vt({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)(K,{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:U(`settings`,e.engine===`database`?`databases`:`environments`),children:e.engine===`database`?`Settings, Databases`:`Settings, Environments`}),`.`]})}function Ht({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 R.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)(B,{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)(F,{size:`sm`,type:`submit`,disabled:t||u||!o,children:`Save`}),e.accept&&(0,Z.jsx)(F,{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)(K,{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)(F,{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 Ut({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:N(`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)(F,{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=Rt[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:N(`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:N(`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)(Bt,{r,busy:a,onAnswer:e=>void d(e)}),t.kind===`app`&&t.engine&&(0,Z.jsx)(Vt,{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)(Ht,{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)(zt,{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 Wt=/^[a-f0-9]{16}$/,Gt=`forgeqe.tosca.assistant`;function Kt(){try{let e=localStorage.getItem(Gt)||``;return Wt.test(e)?e:``}catch{return``}}function qt(e){try{e?localStorage.setItem(Gt,e):localStorage.removeItem(Gt)}catch{}}var Jt=[/\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],Yt=e=>e.replace(/^.*\//,``).replace(/\.tsu$/i,``);function Xt(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:D,title:`${Yt(t)} to Selenium`,hint:`One export, in Java, with page objects`,text:`Migrate ${Yt(t)} to Selenium in Java, with page objects`}),t&&r.push({icon:M,title:`${Yt(t)} to Cypress`,hint:`Into a folder of its own`,text:`Migrate ${Yt(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 Zt({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&&I.view(t).then(i,()=>{n(``),qt(``)})},[t]),(0,X.useEffect)(()=>{if(!r?.thinking&&!r?.checking)return;let e=setTimeout(()=>I.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),qt(r.id)),!0}catch(e){return c(e.message),!1}finally{u(!1)}},g=async e=>{!e.trim()||l||r?.thinking||(Jt.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?I.say(r.id,e):I.start(e))&&o(``))},_=()=>{r&&I.end(r.id).catch(()=>{}),i(null),o(``),c(``),n(``),qt(``)},v=()=>r?.prefill&&(location.hash=U(`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)(z,{name:_e.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)(nn,{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:Xt(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)(W,{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:U(`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)(F,{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)(Oe,{text:e.text}):(0,Z.jsx)(Qt,{text:e.text})},t)),r.thinking&&(0,Z.jsx)(`li`,{className:`fade-quick`,children:(0,Z.jsx)(Qt,{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)(en,{c:r.clone,disabled:l,onToken:e=>h(()=>I.token(r.id,e)),onPick:e=>void h(()=>I.pick(r.id,`clone`,[e]))},`clone-${p}`),!r.thinking&&r.question&&r.question.id!==`clone`&&r.question.options.length>0&&(0,Z.jsx)($t,{q:r.question,disabled:l,onPick:e=>void h(()=>I.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)(F,{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)(tn,{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)(we,{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 Qt({text:e,working:t}){return(0,Z.jsxs)(`div`,{className:`flex max-w-[72ch] items-start gap-3`,children:[(0,Z.jsx)(G,{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:N(`m-0 text-[15px] leading-relaxed whitespace-pre-line [overflow-wrap:anywhere]`,t?`text-muted`:`text-ink-2`),children:e})]})}function $t({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)(se,{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)(F,{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)(F,{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)(F,{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 en({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 R.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)(K,{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)(F,{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)(F,{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:U(`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)(B,{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)(B,{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)(F,{size:`sm`,disabled:p||!i.name||!i.value,onClick:()=>void f(),children:o?`Saving…`:`Save`}),(0,Z.jsx)(F,{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)(F,{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)(F,{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 tn({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)(Pe,{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 nn({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:N(n,`border-transparent bg-surface-strong text-ink-2`),children:[(0,Z.jsx)(re,{size:12,"aria-hidden":`true`}),Yt(e.path)]},e.path)),e.clones.map(e=>(0,Z.jsxs)(`span`,{className:N(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:N(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 rn=[`Export`,`Target`,`Instructions`,`Review`],an=[`The Tosca export and its test cases`,`Framework and language`,`Your rules, optional`,`Check and start`],on=[`Keep one page object per Tosca module, in pages/.`,`Name each test after its Tosca test case.`,`Read the base URL from BASE_URL.`],sn={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function cn({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:rn.map((r,i)=>{let a=i<=t,o=i===e,c=i<t&&!o;return(0,Z.jsxs)(`li`,{className:N(`flex items-center gap-2`,i<rn.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":an[i],className:N(`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:N(`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:N(o?`font-medium text-ink`:a?`text-ink-2`:`text-muted`,!o&&`hidden @xl:inline`),children:r})]}),i<rn.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:N(`block h-full rounded-full bg-pass transition-[width] duration-500`,i<t?`w-full`:`w-0`)})})]},r)})})})}function ln({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 un({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)(F,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Z.jsx)(S,{"aria-hidden":`true`}),`Back`]}),(0,Z.jsx)(F,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function dn({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:N(`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 fn=e=>e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`;function pn({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 mn({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)(ln,{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)(B,{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)(ln,{id:`tsc-git-branch`,label:`Branch`,help:`The default branch when empty.`,children:(0,Z.jsx)(B,{id:`tsc-git-branch`,value:i,spellCheck:!1,maxLength:200,placeholder:`main`,onChange:e=>a(e.target.value)})}),(0,Z.jsx)(ln,{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)(B,{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)(F,{type:`submit`,disabled:e||!n.trim(),children:e?`Cloning…`:`Clone it`})})]})}function hn({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(Ze).map(e=>e.id))),l(`tsc-cases`)}catch(e){t&&r(t),S(e.message)}finally{p(!1)}}},O=e=>{a(null),S(``),r(t=>t.some(t=>$(t)===$(e))?t.filter(t=>$(t)!==$(e)):[...t,e])},ee=T.length>0&&T.every(e=>C.has($(e.p))),k=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)}},A=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)}},te=e=>{let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(t)},ne=e=>Ze(e),j=i?i.test_cases.filter(ne):[],M=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)(pe,{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)(ge,{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)(De,{checked:ee,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:N(q,`w-10`),children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,Z.jsx)(`th`,{className:q,children:`Export`}),(0,Z.jsx)(`th`,{className:N(q,`hidden @xl:table-cell`),children:`Folder`}),(0,Z.jsx)(`th`,{className:q,children:`From`}),(0,Z.jsx)(`th`,{className:ve,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:J,children:(0,Z.jsx)(De,{"aria-label":`Pick ${e.p.file}${e.p.workspace?` of ${e.from}`:``}`,checked:C.has(t),onCheckedChange:()=>O(e.p)})}),(0,Z.jsx)(`td`,{className:J,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(D,{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:N(J,`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:N(J,`text-ink-2`),children:e.from}),(0,Z.jsx)(`td`,{className:ye,children:fn(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)(F,{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`,`…`]})}),M,(0,Z.jsx)(ln,{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)(B,{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)(F,{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:N(`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)(F,{size:`sm`,variant:`ghost`,onClick:()=>void A(e.id),children:`Remove it`}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>b(``),children:`Keep it`})]}):(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,"aria-label":`Remove the copy of ${e.label}`,onClick:()=>b(e.id),children:`Remove`})]},e.id))}),(0,Z.jsx)(mn,{busy:m,onClone:(e,t,n)=>void k(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:[M,!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)(F,{size:`sm`,variant:`ghost`,onClick:()=>l(`tsc-exports`),children:`Change exports`})]}),(0,Z.jsx)(pn,{s:i}),i.coverage&&(0,Z.jsx)(Lt,{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)(ge,{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)(De,{checked:j.length>0&&j.every(e=>o.has(e.id)),onCheckedChange:e=>s(new Set(e?j.map(e=>e.id):[]))}),`Pick all `,j.length,` test cases ForgeQE can convert`]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:N(`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:N(`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=ne(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)(De,{"aria-label":`Pick ${e.name}`,disabled:!t,checked:t&&o.has(e.id),onCheckedChange:()=>te(e.id)})}),(0,Z.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:N(`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:N(`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:N(`px-3 py-2`,`whitespace-nowrap`),children:(0,Z.jsx)(V,{tone:t?`neutral`:`warn`,children:t?Ge(e):`${Xe[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 gn({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=Fe[e];return(0,Z.jsx)(dn,{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:sn[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=Ne[u(e.id)];return(0,Z.jsx)(dn,{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)(ln,{id:`tsc-into`,label:`Output folder`,help:`A new folder. Empty: named after the target.`,children:(0,Z.jsx)(B,{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)(ln,{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)(B,{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 _n({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)(Pe,{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 vn({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),[A,te]=(0,X.useState)(!1),[ne,j]=(0,X.useState)(!1),[M,re]=(0,X.useState)(!1),[F,L]=(0,X.useState)(``),R=[...g].sort().join(`,`);(0,X.useEffect)(()=>{k(null),te(!1),d(e=>Math.min(e,2))},[f.map($).join(`|`),R,v,S,w,E]);let[z,B]=(0,X.useState)(`next`),V=(0,X.useRef)(null),H=e=>{B(e<s?`back`:`next`),l(e);let t=V.current;t&&t.getBoundingClientRect().top<0&&t.scrollIntoView({block:`start`,behavior:`smooth`})},W=e=>{H(e),d(t=>Math.max(t,e)),L(``)},[ie,ae]=(0,X.useState)(o?`filling`:``);(0,X.useEffect)(()=>{if(!o)return;let e=!0;return(async()=>{re(!0);try{let t=(await I.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(Ze).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),H(3),ae(`done`)}catch(t){if(!e)return;L(t.message),ae(``)}finally{e&&re(!1)}})(),()=>{e=!1}},[o]);let G=async()=>{re(!0),L(``);try{let e=!m||m.test_cases.filter(Ze).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),W(3)}catch(e){let t=e.message;L(t);let n=S.trim().replace(/\\/g,`/`).replace(/\/+$/,``);n&&t.includes(n)&&H(1)}finally{re(!1)}},oe=O?.plan,K=oe?.feasibility.findings.some(e=>e.level===`limit`),se=oe?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[o&&ie&&(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:ie===`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:U(`tosca`),className:`text-[13px]`,children:`Back to the assistant`})]}),(0,Z.jsx)(`div`,{ref:V,className:`scroll-mt-4`,children:(0,Z.jsx)(cn,{at:s,reached:u,onGo:e=>!M&&(e<3||O)&&H(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:N(`flex min-w-0 flex-col gap-5`,z===`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]}),F&&(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:F}),s===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hn,{view:e,onView:n,picked:f,setPicked:p,found:m,setFound:h,only:g,setOnly:_}),(0,Z.jsx)(un,{busy:M,next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(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)(gn,{view:e,to:v,setTo:y,fw:b,setFw:x,into:S,setInto:C,attr:w,setAttr:T}),(0,Z.jsx)(un,{busy:M,onBack:()=>H(0),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(2),disabled:!v})]}),s===2&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ln,{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)(ce,{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:on.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)(un,{busy:M,onBack:()=>H(1),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),M?`Checking…`:`Check`]}),onNext:()=>void G(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),s===3&&oe&&(0,Z.jsxs)(Z.Fragment,{children:[i(oe,A,te,j),(0,Z.jsx)(un,{busy:M,onBack:()=>H(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Start`]}),disabled:se||!ne||K&&!A,onNext:()=>a(O,!!K&&A),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:se?`Change what is not possible first.`:ne?K&&!A?`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)(_n,{view:e,picked:f,found:m,only:g,to:v,instructions:E})})]})]})}function yn({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(xe,{}),(0,Z.jsx)(`main`,{className:N(Se,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function bn({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)(de,{pixel:_e.tosca,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Tosca`})]}),(0,Z.jsx)(Ae,{label:`Migration`,links:je,current:`tosca`}),(0,Z.jsx)(`span`,{className:`flex-1`}),e]})}function xn({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 `,Ce(t.tokens.mid),` tokens`,t.cost?`, about ${fe(t.cost.mid,t.cost.currency)}`:``,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`(`,Ce(t.tokens.low),` to `,Ce(t.tokens.high),t.cost?`, ${fe(t.cost.low,t.cost.currency)} to ${fe(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 Sn({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:U(`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)(xn,{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)(Lt,{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)(De,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Z.jsx)(Ut,{planId:e.id,onReady:r,onCoverage:a}),(0,Z.jsx)(Me,{title:`Test cases (${e.cases.length})`,children:(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(ge,{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:q,children:`Test case`}),(0,Z.jsx)(`th`,{className:q,children:`In the plan`}),(0,Z.jsx)(`th`,{className:N(ve,`hidden @xl:table-cell`),children:`Steps · checks`}),(0,Z.jsx)(`th`,{className:q,children:`Kind`})]}),children:e.cases.map(e=>{let t=e.change;return(0,Z.jsxs)(`tr`,{className:he,children:[(0,Z.jsx)(`td`,{className:N(J,`[overflow-wrap:anywhere]`,e.included?`text-ink`:`text-muted`),children:e.name}),(0,Z.jsxs)(`td`,{className:N(J,`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:N(ye,`hidden @xl:table-cell`),children:[e.steps,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.asserts]})]}),(0,Z.jsx)(`td`,{className:N(J,`whitespace-nowrap text-muted`),children:Xe[e.route]||e.route})]},e.id)})})})}),(0,Z.jsx)(Me,{title:`Files, in order (${e.units.length})`,children:(0,Z.jsx)(ge,{label:`Files, in order`,placeholder:`Find a file`,height:`min(40vh, 360px)`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:N(q,`w-24`),children:`Kind`}),(0,Z.jsx)(`th`,{className:q,children:`File`})]}),children:e.units.map(e=>(0,Z.jsxs)(`tr`,{className:he,children:[(0,Z.jsx)(`td`,{className:N(J,`text-muted`),children:qe(e)}),(0,Z.jsx)(`td`,{className:N(J,`font-mono text-[12px] [overflow-wrap:anywhere]`),children:e.target})]},e.id))})})]})}function Cn({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)(Sn,{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)(F,{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)(it,{plan:e.plan,acceptLimits:l&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}function wn(e){return e.result?.status===`running`?`running`:e.result?.status===`converted`?`done`:e.result?`review`:`planned`}function Tn(e){return e.result?He[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:We[e.verdict]}var En=e=>e.slice(e.lastIndexOf(`/`)+1);function Dn({view:e}){let[t,n]=(0,X.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>wn(e)===t).length,i=e.plans.filter(e=>t===`all`||wn(e)===t),a=e=>location.hash=U(`tosca`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(ze,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Z.jsx)(ze,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Z.jsx)(ze,{label:`Converted`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Z.jsx)(ze,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Z.jsx)(ge,{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=Tn(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:be,children:[(0,Z.jsx)(`td`,{className:J,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)(Pe,{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:U(`tosca`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[En(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:N(J,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ve,{value:n,label:`${En(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:N(J,`whitespace-nowrap`),children:(0,Z.jsx)(V,{tone:t.tone,children:t.label})}),(0,Z.jsx)(`td`,{className:N(J,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:Ee(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function On({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)(Kt),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]?H(f[2]):void 0}catch{}let _=()=>location.hash=U(`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)(yn,{children:[(0,Z.jsx)(bn,{}),(0,Z.jsx)(Je,{error:i}),v,t&&(0,Z.jsx)(vn,{view:t,onView:n,from:y,review:(e,t,n,r)=>(0,Z.jsx)(Sn,{plan:e,accepted:t,onAccept:n,onReady:r}),onStart:(e,t)=>s({d:e,accept:t})},y||`new`),o&&(0,Z.jsx)(it,{plan:o.d.plan,acceptLimits:o.accept,onClose:()=>s(null),onStarted:e=>{s(null),location.hash=U(`tosca`,e.plan.id)}})]});if(p&&h)return(0,Z.jsxs)(yn,{wide:!0,children:[(0,Z.jsx)(bn,{}),(0,Z.jsx)(Nt,{id:p,caseId:g},p)]});if(p)return(0,Z.jsxs)(yn,{wide:!0,children:[(0,Z.jsx)(bn,{}),(0,Z.jsx)(Je,{error:i}),v,t&&(0,Z.jsx)(bt,{id:p,plan:(e,t)=>(0,Z.jsx)(Cn,{d:e,onStarted:t})},p)]});let b=e===`conversions`?`conversions`:`agent`;return(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(bn,{action:b===`agent`?void 0:(0,Z.jsxs)(F,{variant:`primary`,disabled:!t,onClick:_,"data-tip":`New conversion`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`New`]})}),(0,Z.jsx)(Je,{error:i}),(0,Z.jsx)(ke,{label:`Tosca`,className:`mb-0`,current:b,onPick:e=>location.hash=e===`agent`?U(`tosca`):U(`tosca`,`conversions`),tabs:[{id:`agent`,label:`Agent`},{id:`conversions`,label:`Conversions`,...t?{n:t.plans.length}:{}}]}),v,t&&b===`agent`&&(0,Z.jsx)(Zt,{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)(Dn,{view:t}):(0,Z.jsx)(ae,{icon:m,title:`No Tosca conversions yet`,action:(0,Z.jsxs)(F,{size:`sm`,onClick:()=>location.hash=U(`tosca`),"data-tip":`Start with the assistant`,children:[(0,Z.jsx)(O,{"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{On as Tosca};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ir as e,Nr as t,wt as n}from"./line-icons-CQ-3V8ax.js";import{B as r,R as i,Wt as a,a as o,ot as s}from"./filters-B4VDnWbr.js";var c=e(t(),1),l=a();function u(e){return(e.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||``).replace(/\.(exe|app)$/i,``).toLowerCase().replace(/[^a-z0-9_.-]+/g,`-`).replace(/^[^a-z]+/,``).replace(/-+$/,``).slice(0,40)||`app`}function d({value:e,onChange:t,onPicked:a,onError:u,className:d}){let[f,p]=(0,c.useState)(!1),m=async()=>{p(!0),u(``);try{let e=await s.browse();`path`in e?(t(e.path),a?.(e.path,e.name)):`unavailable`in e&&u(e.unavailable)}catch(e){u(e.message)}finally{p(!1)}};return(0,l.jsxs)(`div`,{className:r(`flex min-w-0 gap-2`,d),children:[(0,l.jsx)(o,{"aria-label":`App's path`,value:e,spellCheck:!1,placeholder:`C:\\Program Files\\Contoso\\Billing.exe`,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 font-mono text-[13px]`}),(0,l.jsxs)(i,{type:`button`,disabled:f,onClick:()=>void m(),"data-tip":`Choose the app's .exe on this computer`,children:[(0,l.jsx)(n,{"aria-hidden":`true`}),f?`Choosing…`:`Browse…`]})]})}export{u as n,d as t};
|