@capagents/forgeqe 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/HOW_TO_USE.md +12 -1
  2. package/dist/docs-site/docs/index.html +20 -1
  3. package/dist/docs-site/docs/mobile/index.html +8 -0
  4. package/dist/docs-site/docs/search.js +1 -1
  5. package/dist/forgeqe.js +1702 -1701
  6. package/dist/web/assets/{Agent-DISh0THc.js → Agent-BqVEwTVC.js} +4 -4
  7. package/dist/web/assets/{ApiTests-CK0HqEH4.js → ApiTests-DCatslaV.js} +3 -3
  8. package/dist/web/assets/Browse-Bl8Qmv19.js +2 -0
  9. package/dist/web/assets/Chat-CclDgwrO.js +5 -0
  10. package/dist/web/assets/{CommandPalette-CkreEJ8R.js → CommandPalette-yhEQVq1q.js} +1 -1
  11. package/dist/web/assets/{Compare-CgOfZofk.js → Compare-y9bBCySM.js} +1 -1
  12. package/dist/web/assets/{Cost-Dl5-viu4.js → Cost-DJ3HO9gf.js} +1 -1
  13. package/dist/web/assets/{Data-Bv2S5wkW.js → Data-HZP8SHLn.js} +1 -1
  14. package/dist/web/assets/{Desktop-CifPwy5u.js → Desktop-CI6C43R3.js} +1 -1
  15. package/dist/web/assets/{DesktopReview-fpGdtU4r.js → DesktopReview-CGDj4Ujf.js} +1 -1
  16. package/dist/web/assets/{Evidence-hOZDzfKt.js → Evidence-C1Vyg39z.js} +1 -1
  17. package/dist/web/assets/{Explore-c85VGE9Q.js → Explore-BPWjMsOz.js} +2 -2
  18. package/dist/web/assets/{Features-DXL_vSjn.js → Features-BXBE6r6G.js} +1 -1
  19. package/dist/web/assets/{Flags-B7x2pDud.js → Flags-gDtVVBId.js} +2 -2
  20. package/dist/web/assets/{Flaky-BM3syqCt.js → Flaky-h8C09CFf.js} +1 -1
  21. package/dist/web/assets/Impact-BT55F8b-.js +3 -0
  22. package/dist/web/assets/Jobs-BZJxI0NN.js +5 -0
  23. package/dist/web/assets/{KindPage-yVmpQm7L.js → KindPage-DtUCsf9W.js} +4 -4
  24. package/dist/web/assets/Migration-DTauoKTG.js +2 -0
  25. package/dist/web/assets/{Product-C0FeEaJg.js → Product-CvKbCdHY.js} +2 -2
  26. package/dist/web/assets/{Production-BSMQyWKd.js → Production-CJQsBg05.js} +1 -1
  27. package/dist/web/assets/{Quality-DsM9gWZb.js → Quality-CjipajoK.js} +1 -1
  28. package/dist/web/assets/{Readiness-BhqkAJYN.js → Readiness-LaLczR5L.js} +1 -1
  29. package/dist/web/assets/{Record-CPx-lK53.js → Record-TQ_WSnsE.js} +2 -2
  30. package/dist/web/assets/Regression-CrjROhTU.js +5 -0
  31. package/dist/web/assets/{Reports-36YQzVhA.js → Reports-BTF2tHQN.js} +2 -2
  32. package/dist/web/assets/{Response-DplUOsue.js → Response-Dm1See-Y.js} +3 -3
  33. package/dist/web/assets/{RunDiff-D0fDhRmK.js → RunDiff-B6t56dwu.js} +1 -1
  34. package/dist/web/assets/{Runs-Bv1Ef8zq.js → Runs-Oj-NO8Vl.js} +2 -2
  35. package/dist/web/assets/{TestCases-B9x9W3zJ.js → TestCases-SL9YqWlm.js} +1 -1
  36. package/dist/web/assets/{TestData-DsJ6Z2YI.js → TestData-C6j4ZbaF.js} +2 -2
  37. package/dist/web/assets/{TestDebt-B_FUbMOb.js → TestDebt-CISwXKl-.js} +1 -1
  38. package/dist/web/assets/{Tosca-nxVCubA5.js → Tosca-DTVz50ex.js} +3 -3
  39. package/dist/web/assets/{WhatsNew-CdnbMvrr.js → WhatsNew-2AgkrdMk.js} +1 -1
  40. package/dist/web/assets/agentLink-DfJdkmLQ.js +1 -0
  41. package/dist/web/assets/{dataParts-Bn-tzbKg.js → dataParts-BwxK_p1D.js} +1 -1
  42. package/dist/web/assets/{fold-BhRpA0sy.js → fold-BD-sox6G.js} +1 -1
  43. package/dist/web/assets/frame-B428t9gN.js +18 -0
  44. package/dist/web/assets/index-BtYlZE0c.js +67 -0
  45. package/dist/web/assets/{index-CIw5WfL8.css → index-DUWIa2Tp.css} +1 -1
  46. package/dist/web/assets/{logos-839CfoKx.js → logos-DCsyIKX5.js} +1 -1
  47. package/dist/web/assets/{paletteCommands-CZFdKGhh.js → paletteCommands-3NG1WPGZ.js} +1 -1
  48. package/dist/web/assets/{qualityParts-PGN65yfI.js → qualityParts-BA-1cidT.js} +1 -1
  49. package/dist/web/assets/{rows-uLoguIo5.js → rows-BOGSBviK.js} +1 -1
  50. package/dist/web/assets/{usePageChat-DqEwGcyO.js → usePageChat-Zg7SGziM.js} +1 -1
  51. package/dist/web/index.html +3 -3
  52. package/docs/MOBILE.md +9 -0
  53. package/docs/user-guide.html +20 -1
  54. package/forgeqe.example.yaml +2 -0
  55. package/package.json +1 -1
  56. package/prompts/brain.md +3 -2
  57. package/prompts/talk-summary.md +1 -1
  58. package/prompts/talk.md +17 -3
  59. package/prompts/test-agent.md +1 -1
  60. package/dist/web/assets/Browse-WylAQZvD.js +0 -2
  61. package/dist/web/assets/Chat-B7IOg3I3.js +0 -5
  62. package/dist/web/assets/Impact-BUCh8OAI.js +0 -3
  63. package/dist/web/assets/Jobs-B8sBDYRI.js +0 -5
  64. package/dist/web/assets/Migration-BOLN1duU.js +0 -2
  65. package/dist/web/assets/Regression-BXbX46nO.js +0 -5
  66. package/dist/web/assets/agentLink-BGKAF6xd.js +0 -1
  67. package/dist/web/assets/frame-D_TPoUTD.js +0 -16
  68. package/dist/web/assets/index-BRB-oAMd.js +0 -67
@@ -1,2 +1,2 @@
1
- import{$t as e,C as t,Cr as n,D as r,E as i,En as a,F as o,Ft as s,In as c,It as l,L as u,Lr as d,N as f,Nn as p,On as m,Pr as h,Qn as g,T as _,Tn as v,Tr as y,Vn as b,Wt as x,Xn as S,_n as C,_r as w,a as T,ct as E,d as D,er as ee,et as te,fr as O,gn as ne,i as re,it as ie,j as k,jn as A,jr as j,jt as ae,kn as oe,kr as se,mn as ce,mr as le,o as M,or as ue,ot as de,pn as fe,pt as N,rr as pe,s as me,tn as he,vr as ge,yr as _e}from"./line-icons-DBwNPSmu.js";import{Ft as P,H as F,V as I,a as L,c as R,ct as ve,en as ye,g as z,h as be,i as xe,l as Se,o as B,p as Ce,pt as we,s as Te,t as Ee,tn as De,u as V,z as H}from"./filters-Bj5K1WaL.js";import{B as Oe,G as ke,H as Ae,J as je,K as Me,Mt as Ne,U as Pe,V as Fe,W as Ie,jt as Le,lt as U,q as Re,r as ze,t as Be,tt as Ve,un as He,ut as W,z as Ue}from"./frame-D_TPoUTD.js";import{n as We,r as Ge}from"./markdown-6z0km3hN.js";import{D as Ke,O as G,k as qe,r as Je,s as K}from"./index-BRB-oAMd.js";import{i as Ye,r as Xe}from"./segmented-DphDskQz.js";import{n as Ze,r as Qe,t as $e}from"./recordTest-EkxSMWbe.js";import{n as et,r as tt,t as nt}from"./DesktopReview-fpGdtU4r.js";var rt=d(De(),1),q=d(h(),1),J=ye(),it=e=>new Promise(t=>setTimeout(t,e));function at({id:e,onEnd:n,label:r=`The agent at work`,done:i=`Done.`,failed:a=`It could not finish.`}){let[o,s]=(0,q.useState)([]),[c,l]=(0,q.useState)(`starting`);(0,q.useEffect)(()=>{let t=!1,n=0,r=[];return(async()=>{for(;!t;)try{let i=await ve.events(e,n,!0);if(t||(i.events.length&&(r.push(...i.events),n=i.events.at(-1).n,s([...r])),l(i.state),i.state===`closed`||i.state===`failed`))return}catch{await it(2e3)}})(),()=>{t=!0}},[e]);let u=W(o),d=u.turns.at(-1),f=!!d?.outcome||c===`failed`||c===`closed`,p=d&&!f?U(d):null,m=d?.outcome===`done`,h=f&&!m&&(d?.error||u.fatal||u.ended?.message)||``;return(0,q.useEffect)(()=>{f&&n?.()},[f]),(0,J.jsxs)(`section`,{"aria-label":r,className:`flex flex-col gap-2 border-t border-line-soft pt-4 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p||!f?(0,J.jsx)(be,{state:p?.orb??`thinking`,px:16}):m?(0,J.jsx)(t,{size:16,"aria-hidden":`true`,className:`text-pass`}):(0,J.jsx)(j,{size:16,"aria-hidden":`true`,className:`text-fail`}),(0,J.jsx)(`span`,{className:I(`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,f&&!m&&`text-fail`),children:p?p.text:f?m?i:d?.outcome===`stopped`?`It was stopped.`:a:`Starting…`}),(0,J.jsx)(`a`,{href:Ce(`chats`,e),className:`text-[13px]`,children:`Open the chat`})]}),h&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:h.split(`
2
- `).slice(0,3).join(` `)}),d&&d.steps.length>0&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-muted`,children:d.steps.slice(-6).map(e=>(0,J.jsxs)(`li`,{className:I(`[overflow-wrap:anywhere]`,e.status===`fail`&&`text-fail`),children:[e.status===`running`?`… `:e.status===`fail`?`✗ `:`✓ `,e.label,e.arg?`: ${e.arg}`:``]},e.key))}),d&&d.changes.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-[13px] [overflow-wrap:anywhere]`,children:[`Changed: `,d.changes.map(e=>`${e.path} (+${e.added} −${e.removed})`).join(`, `)]}),d&&d.asks.some(e=>e.answer===void 0)&&(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`It is asking something: `,(0,J.jsx)(`a`,{href:Ce(`chats`,e),children:`answer it in the chat`}),`.`]}),d?.reply&&f&&(0,J.jsx)(Ge,{text:d.reply,className:`text-[13px]`})]})}var ot={test_id:`Its test id`,id:`Its id`,role:`What it is and its name`,role_pattern:`What it is and part of its name`,name:`Its name attribute`,label:`Its label`,placeholder:`Its placeholder`,alt:`Its alt text`,href:`Where it links to`,title:`Its title`,text:`Its text`,text_pattern:`Part of its text`,css:`Its tag and class`,within:`The card or row it sits in`,xpath:`Its place in the page`},st={generated:{found:`a value the page's framework made, which is different on the next load`,alone:`It is a value the page's framework made, so it is different on the next load.`},live_data:{found:`data that changes between runs (a price, a date, an order number)`,alone:`It holds data that changes between runs (a price, a date, an order number).`},varies:{found:`a value the page gave this element only on that load`,alone:`The page gave this element another value when the recording loaded the same page again.`}},ct=e=>`${ot[e.type]||e.type}: ${e.value}`,lt=[{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 ut({runDir:e,onClose:n,onRecordMore:r,notices:i}){let[l,u]=(0,q.useState)(null),[d,p]=(0,q.useState)(``),[h,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`steps`),[S,C]=(0,q.useState)(``),[te,O]=(0,q.useState)(!1),[ne,re]=(0,q.useState)(null),[ae,oe]=(0,q.useState)(null),[se,ce]=(0,q.useState)(null),[M,ue]=(0,q.useState)(new Set),de=e=>ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[N,me]=(0,q.useState)({}),he=e=>N[e.n]??(!e.ok&&!e.skipped),[ge,_e]=(0,q.useState)(null),[ve,ye]=(0,q.useState)(``),[be,Ce]=(0,q.useState)(`all`),[we,De]=(0,q.useState)(null),[V,Oe]=(0,q.useState)(!1),[ke,Ae]=(0,q.useState)(``),[je,Me]=(0,q.useState)(``),[Pe,Fe]=(0,q.useState)([]),[Ie,Le]=(0,q.useState)(void 0),[U,Re]=(0,q.useState)({from:0,to:0,name:``}),[ze,Be]=(0,q.useState)({block:``,after:0}),[Ve,He]=(0,q.useState)(``),[W,Ue]=(0,q.useState)(null),[We,Ge]=(0,q.useState)(``),[G,qe]=(0,q.useState)({}),[K,Ze]=(0,q.useState)(``),[et,tt]=(0,q.useState)(``),[nt,rt]=(0,q.useState)(null),[it,ot]=(0,q.useState)(!1),[ct,ut]=(0,q.useState)(!1),[yt,bt]=(0,q.useState)(``),[xt,St]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let t=!1;return P.review(e).then(e=>{t||(u(e),C(e.name),Me(e.instructions))},e=>!t&&p(e.message)),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{P.blocks().then(e=>{Fe(e.blocks),Le(e.shared)},()=>Fe([]))},[]),(0,q.useEffect)(()=>{let t=!1;return P.tryView(e).then(e=>{t||(Ue(e),qe(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]??e.value]))))},()=>{}),()=>{t=!0}},[e,l]);let Ct=()=>P.review(e).then(e=>u(t=>t&&{...t,test:e.test}),()=>{}),Et=l?.test?.state===`writing`||l?.test?.state===`checking`;(0,q.useEffect)(()=>{if(!Et)return;let e=setInterval(()=>void Ct(),2500);return()=>clearInterval(e)},[Et,e]);let Y=W?.running===e,Dt=W?.result?`${W.result.ms??0}-${W.result.env??``}-${W.result.steps.length}-${W.result.ok}`:``;(0,q.useEffect)(()=>me({}),[Dt]),(0,q.useEffect)(()=>{if(!Y)return;let t=setInterval(()=>{P.tryView(e).then(Ue,()=>{})},1500);return()=>clearInterval(t)},[Y,e]);let Ot=()=>K.startsWith(`file:`)?{file:K.slice(5),...et.trim()&&/\.xls[xm]$/i.test(K)?{sheet:et.trim()}:{}}:K.startsWith(`request:`)?{request:K.slice(8)}:void 0,kt=async t=>{p(``),ot(!0);try{let n=await P.write(e,{check:t,env:We,data:G,each:Ot()});u(e=>e&&{...e,test:n.test}),Ue(n.try),t&&rt(l)}catch(e){p(e.message)}finally{ot(!1)}},At=async()=>{p(``);try{let t=await P.tryRun(e,We,G,Ot());rt(l),Ue(t)}catch(e){p(e.message)}},jt=async()=>{p(``);try{Ue(await P.tryStop(e)),Ct()}catch(e){p(e.message)}},Mt=async()=>{p(``),St(!0);try{let t=await P.stopWrite(e);u(e=>e&&{...e,test:t.test})}catch(e){p(e.message)}finally{St(!1)}},Nt=async()=>{v(!0),p(``),He(``);try{let t=await P.saveBlock(e,U.name.trim(),U.from,U.to);Fe(t.blocks),He(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.`),Re({...U,name:``})}catch(e){p(e.message)}finally{v(!1)}},X=async t=>{v(!0),p(``);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);u(n),C(n.name),Me(n.instructions)}catch(e){p(e.message)}finally{v(!1)}},Pt=async()=>{Oe(!0),Ae(``);try{let t=await P.suggest(e);De(t.picks),Ae(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Ae(e.message)}finally{Oe(!1)}},Ft=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},It=async e=>{for(let t of e)await X(Ft(t));De(t=>(t||[]).filter(t=>!e.includes(t)))};if(!l)return d?(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:d}):(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Reading the recording…`});let Lt=l.steps.filter(e=>e.value),Rt=l.steps.filter(e=>e.op===`expect`).length,Z=Y?void 0:W?.result,zt=new Map((Z?.steps??[]).map(e=>[e.n-1,e])),Q=Z?.steps.find(e=>!e.ok),Bt=Q?Q.n-1:-1,Vt=Bt>=0?l.steps[Bt]:void 0,Ht=!!Z&&!!nt&&nt!==l,Ut=(Z?.steps??[]).filter(e=>!e.ok).length,Wt=ve.toLowerCase().split(/\s+/).filter(Boolean),Gt=l.steps.filter(e=>Wt.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(be===`all`||(be===`checks`?e.op===`expect`:zt.get(e.index)?.ok===!1))),Kt=e=>{x(`steps`),Ce(`all`),ye(``),requestAnimationFrame(()=>document.getElementById(`step-${e}`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},qt=!!W?.running&&!Y,$=Qe(l.test),Jt=()=>void kt(!(Z?.ok&&nt===l)),Yt=Y&&!!W?.stopping,Xt=it||$.writing,Zt=[{id:`steps`,label:`Steps`,n:l.steps.length},{id:`data`,label:`Test data`,n:Lt.length},{id:`run`,label:`Runs`,...W?.runs?.length?{n:W.runs.length}:{}},{id:`instructions`,label:`Instructions`},{id:`blocks`,label:`Blocks`},{id:`history`,label:`Versions`,n:l.history.length}];return(0,J.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-4 border-b border-line bg-bg px-1 py-4`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:n&&(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,onClick:n,className:`-ml-2 text-ink-2`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Recordings`]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[te?(0,J.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),O(!1),S.trim()&&S.trim()!==l.name&&X({name:S.trim()})},children:[(0,J.jsx)(L,{"aria-label":`Name of the recording`,value:S,maxLength:200,autoFocus:!0,onChange:e=>C(e.target.value),className:`min-w-0 flex-1`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Save`]}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,onClick:()=>{C(l.name),O(!1)},children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]})]}):(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h2`,{id:`review-title`,className:`m-0 min-w-0 truncate text-lg font-semibold`,"data-tip":l.name,children:l.name}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>O(!0),className:`size-8 flex-none`,children:(0,J.jsx)(a,{"aria-hidden":`true`})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,J.jsxs)(`span`,{children:[F(l.steps.length,`step`),` · `,F(Rt,`check`)]}),Y?(0,J.jsx)(R,{tone:`running`,children:Yt?`Stopping…`:`Running the steps…`}):Z?.stopped?(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Last run stopped`}):Z?(0,J.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,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Not run yet`}),Ht&&(0,J.jsx)(`span`,{children:`· you changed it since`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[13px]`,"aria-label":`The test written from this recording`,children:[(0,J.jsx)(R,{tone:$.tone,icon:$.tone!==`neutral`,children:$.label}),l.test?.testFile&&$.hasTest&&(0,J.jsxs)(`button`,{type:`button`,onClick:async()=>bt(await $e(l.test.testFile)),"data-tip":`Open ${l.test.testFile}${l.test.repo?` in ${l.test.repo}`:``}`,className:`inline-flex min-w-0 cursor-pointer items-center gap-1 border-0 bg-transparent p-0 font-mono text-[13px] text-accent-fg hover:text-accent-fg-hover`,children:[(0,J.jsx)(E,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,J.jsx)(`span`,{className:`truncate`,children:l.test.testFile})]}),l.test&&!$.writing&&(0,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Je(l.test.at)]}),(0,J.jsx)(`span`,{className:`basis-full text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:$.detail}),yt&&(0,J.jsx)(`span`,{className:`basis-full text-[13px] text-fail [overflow-wrap:anywhere]`,children:yt})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Y?(0,J.jsxs)(H,{variant:`destructive`,disabled:Yt,onClick:()=>void jt(),"data-tip":`Stop the run and close its browser`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),Yt?`Stopping…`:`Stop`]}):(0,J.jsxs)(H,{disabled:qt||Xt,onClick:()=>void At(),"data-tip":qt?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,J.jsx)(m,{"aria-hidden":`true`}),`Re-run`]}),l.test?.state===`writing`?(0,J.jsxs)(H,{variant:`destructive`,disabled:xt,onClick:()=>void Mt(),"data-tip":`Stop the Coding agent: what it changed so far is kept, and Write carries on from there`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),xt?`Stopping…`:`Stop writing`]}):(0,J.jsxs)(H,{variant:$.hasTest&&!$.writing?`outline`:`primary`,disabled:h||Y||qt||Xt||$.writing,onClick:()=>$.hasTest?ut(!0):Jt(),"data-tip":$.writing?`A test is being written from this recording`:$.hasTest?`Update ${l.test?.testFile}: the steps are run first; when they work, the Coding agent changes that test to match the recording`:`Write the test: the steps are run first; when they work, the Coding agent writes the test in your repository's style`,children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),l.test?.state===`checking`?`Checking…`:it||$.writing?$.hasTest?`Updating…`:`Writing…`:$.hasTest?`Update the test`:`Write the test`]})]})]})]}),i,d&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}),Z&&!Z.ok&&(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 rounded-[12px] border border-fail/30 bg-fail-soft px-4 py-4 text-sm`,children:[(0,J.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}`:``}`,Ht&&(0,J.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),Vt&&(0,J.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:Vt.line}),(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Vt&&(0,J.jsxs)(H,{size:`sm`,onClick:()=>Kt(Bt),"data-tip":`Show the failed step`,children:[(0,J.jsx)(ie,{"aria-hidden":`true`}),`Show`]}),Vt&&r&&Bt>0&&(0,J.jsxs)(H,{size:`sm`,onClick:()=>r(Bt),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),Vt&&!Vt.fixed&&(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void X({remove:[Bt]}),"data-tip":`Drop the failed step`,children:[(0,J.jsx)(le,{"aria-hidden":`true`}),`Remove`]}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,disabled:Xt,onClick:()=>void kt(!1),"data-tip":`Write the test anyway`,children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),`Write`]})]})]}),l.test?.chat&&(0,J.jsx)(at,{id:l.test.chat,onEnd:()=>void Ct(),label:$.hasTest?`The Coding agent updating the test`:`The Coding agent writing the test`,done:$.hasTest?`The test is updated.`:`The test is written.`,failed:$.hasTest?`The test could not be updated.`:`The test could not be written.`},l.test.chat),ct&&l.test?.testFile&&(0,J.jsx)(Ne,{open:!0,onClose:()=>ut(!1),title:`Update the test?`,description:`A test was already written from this recording: ${l.test.testFile}. The Coding agent updates that test so it matches the recording as it is now. No second test is added.`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(H,{variant:`ghost`,onClick:()=>ut(!1),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]}),(0,J.jsxs)(H,{variant:`primary`,onClick:()=>{ut(!1),Jt()},children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),`Update the test`]})]}),children:(0,J.jsx)(`p`,{className:`m-0 pt-4 text-sm text-ink-2`,children:`The steps are played first; the test is changed only when they work.`})}),l.blocksFound?.map(e=>(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,J.jsx)(z,{icon:D,size:16,className:`flex-none`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:e.name}),`: the test can call its helper instead.`]}),(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void X({useBlock:{block:e.block,from:e.from}}),"data-tip":`Use the block: the test calls its helper instead`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Use`]})]},`${e.block}-${e.from}`)),(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`This recording`,className:Xe,children:Zt.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,id:`rev-tab-${e.id}`,"aria-selected":b===e.id,"aria-controls":`rev-panel-${e.id}`,onClick:()=>x(e.id),className:Ye(b===e.id),children:[e.label,e.n!==void 0&&(0,J.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:e.n}),e.id===`run`&&Z&&(0,J.jsx)(`span`,{"aria-label":Z.ok?`passed`:`failed`,className:I(`size-2 rounded-full`,Z.ok?`bg-pass`:`bg-fail`)})]},e.id))}),(0,J.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${b}`,"aria-labelledby":`rev-tab-${b}`,className:`flex min-w-0 flex-col gap-4`,children:[b===`steps`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(xe,{id:`rev-step-search`,label:`Find a step`,value:ve,onChange:ye}),(0,J.jsx)(Ee,{items:[{id:`all`,label:`All`,n:l.steps.length},{id:`checks`,label:`Checks`,n:Rt},...Ut?[{id:`failed`,label:`Failed`,n:Ut,alert:!0}]:[]],value:be,onChange:Ce}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,disabled:V||h,onClick:()=>void Pt(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,J.jsx)(y,{"aria-hidden":`true`}),V?`Asking…`:`Suggest`]})]}),(l.videos?.includes(`recording`)||l.log)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.videos?.includes(`recording`)&&(0,J.jsx)(ft,{runDir:e,kind:`recording`}),l.log&&(0,J.jsx)(pt,{runDir:e,which:`recording`,label:`Recording log`})]}),ke&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:ke}),we&&we.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{icon:g,size:14}),(0,J.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void It(we),"data-tip":`Add all the suggestions`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add all`]}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>De(null),className:`size-8`,children:(0,J.jsx)(j,{"aria-hidden":`true`})})]}),(0,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:we.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,J.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,J.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void It([e]),className:`size-8`,children:(0,J.jsx)(A,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),Gt.length===0?(0,J.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-4 text-sm text-muted`,children:`No step matches.`}):(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:Gt.map((n,i)=>{let s=zt.get(n.index),c=n.op===`expect`;return(0,J.jsxs)(`li`,{id:`step-${n.index}`,className:I(`flex scroll-mt-48 flex-col`,i>0&&`border-t border-line-soft`,s&&!s.ok&&`bg-fail-soft`),children:[(0,J.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-4 px-4 py-2`,children:[(0,J.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right font-mono text-[13px] text-muted tabular-nums`,children:n.index+1}),(0,J.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:s?s.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):s.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):c?(0,J.jsx)(k,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[c&&(0,J.jsx)(R,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-[13px]`,children:`Check`}),(0,J.jsx)(`span`,{className:`min-w-0 text-[13px] text-ink [overflow-wrap:anywhere]`,children:n.line}),n.block&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-px text-[13px] text-ink-2`,children:[(0,J.jsx)(z,{icon:D,size:11}),Pe.find(e=>e.id===n.block)?.name||n.block]})]}),n.note&&(0,J.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Note: `,n.note]}),(e=>{if(!e?.risk)return null;let t=(n.locators?.length??0)>1&&!!n.detail?.length,r=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(z,{icon:w,size:12,className:`mt-px flex-none`}),(0,J.jsxs)(`span`,{children:[`This step is found by `,st[e.risk].found,`.`,t?` Pick another way to find it.`:``]})]});return t?(0,J.jsx)(`button`,{type:`button`,"aria-expanded":M.has(n.index),onClick:()=>de(n.index),className:`inline-flex cursor-pointer items-start gap-1 self-start border-0 bg-transparent p-0 text-left text-[13px] text-warn hover:underline`,children:r}):(0,J.jsx)(`span`,{className:`inline-flex items-start gap-1 self-start text-[13px] text-warn`,children:r})})(n.locators?.find(e=>e.chosen)),s&&!s.ok&&s.error&&(0,J.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-fail [overflow-wrap:anywhere]`,"data-tip":s.error,children:s.error}),n.suggest&&n.suggest.length>0&&(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":ge===n.index,onClick:()=>_e(ge===n.index?null:n.index),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-accent-fg hover:text-accent-fg-hover`,children:[(0,J.jsx)(z,{icon:g,size:12}),ge===n.index?`Hide the suggested checks`:`${F(n.suggest.length,`suggested check`)}`]})]}),(0,J.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-haspopup":`menu`,"aria-expanded":ne===n.index,"aria-label":`Add a check, step or note after step ${n.index+1}`,"data-tip":`Add a check, step or note after step ${n.index+1}`,onClick:()=>re(ne===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(A,{"aria-hidden":`true`})}),(0,J.jsx)(Ke,{open:ne===n.index,onClose:()=>re(null),label:`Add after step ${n.index+1}`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,J.jsx)(Tt,{step:n,...r?{onRecordMore:()=>{re(null),r(n.index)}}:{},onAdd:e=>{re(null),X(e)}})}),n.check&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-haspopup":`dialog`,"aria-expanded":se===n.index,"aria-label":`Change how check ${n.index+1} compares`,"data-tip":`Change how check ${n.index+1} compares`,onClick:()=>ce(se===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(a,{"aria-hidden":`true`})}),(0,J.jsx)(Ke,{open:se===n.index,onClose:()=>ce(null),label:`How check ${n.index+1} compares`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,J.jsx)(wt,{check:n.check,onSave:e=>{ce(null),X({matches:[{index:n.index,...e}]})}})})]}),n.detail&&n.detail.length>0&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`What was recorded for step ${n.index+1}`,"aria-expanded":M.has(n.index),"data-tip":`What was recorded for step ${n.index+1}`,onClick:()=>de(n.index),className:`size-8`,children:(0,J.jsx)(_,{"aria-hidden":`true`,className:I(`transition-transform`,M.has(n.index)&&`rotate-180`)})}),n.shot&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${n.index+1}`,"aria-expanded":ae===n.index,"data-tip":`See the page after step ${n.index+1}`,onClick:()=>oe(ae===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})}),!n.fixed&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-label":`Drop step ${n.index+1}`,"data-tip":`Drop step ${n.index+1}`,onClick:()=>void X({remove:[n.index]}),className:`size-8`,children:(0,J.jsx)(le,{"aria-hidden":`true`})})]})]}),ge===n.index&&n.suggest&&n.suggest.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pr-4 pb-2 pl-4 sm:pl-20`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Add a check that`}),n.suggest.map(e=>(0,J.jsxs)(H,{size:`sm`,disabled:h,"data-tip":`Add this check after the step`,onClick:()=>void X({checks:[{after:n.index,kind:e.kind,text:e.text,...e.frame===void 0?{}:{frame:e.frame}}]}),className:`h-7 min-h-7 max-w-full rounded-full px-2 text-[13px]`,children:[(0,J.jsx)(o,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),M.has(n.index)&&n.detail&&(0,J.jsx)(_t,{rows:n.detail,n:n.index+1,locators:n.locators,busy:h,onPick:e=>void X({locator:[{index:n.index,pick:e}]})}),ae===n.index&&n.shot&&n.snap&&(0,J.jsx)(vt,{runDir:e,step:n,busy:h,onPick:(e,t,r)=>void X({checks:[{after:n.index,kind:e,text:t,...r===void 0?{}:{frame:r}}]})})]},`${n.index}-${n.line}`)})})]}),b===`data`&&(Lt.length===0?(0,J.jsx)(Se,{className:`py-4`,children:`Nothing was typed or chosen in this recording, so it has no test data.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.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,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:Lt.map((e,t)=>{let n=e.value,r=lt.filter(t=>e.op!==`select`||t.id===`typed`||t.id===`data`);return(0,J.jsxs)(`li`,{className:I(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.index+1}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:lt.find(e=>e.id===n.as)?.note})]}),(0,J.jsx)(B,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:h,onChange:t=>void X({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:r.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.label},e.id))})]},e.index)})})]})),b===`run`&&W&&(0,J.jsxs)(J.Fragment,{children:[(0,J.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,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-4 rounded-[12px] card border p-4`,onSubmit:e=>{e.preventDefault(),At()},children:[W.environments.length>0&&(0,J.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Environment`,(0,J.jsxs)(B,{value:We,onChange:e=>Ge(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`Where it was recorded`}),W.environments.map(e=>(0,J.jsxs)(`option`,{value:e,children:[e,e===W.environment?` (active)`:``]},e))]})]}),W.data.length>0&&!!(W.sources?.files.length||W.sources?.requests.length)&&(0,J.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Test data`,(0,J.jsxs)(B,{value:K,onChange:e=>Ze(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`The values typed here`}),!!W.sources?.files.length&&(0,J.jsx)(`optgroup`,{label:`Each row of a data file`,children:W.sources.files.map(e=>(0,J.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!W.sources?.requests.length&&(0,J.jsx)(`optgroup`,{label:`Each row of a kept request`,children:W.sources.requests.map(e=>(0,J.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(K)&&(0,J.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Sheet`,(0,J.jsx)(L,{value:et,maxLength:100,placeholder:`The first sheet`,onChange:e=>tt(e.target.value)})]}),!K&&W.data.map(e=>(0,J.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[e.name,(0,J.jsx)(L,{value:G[e.name]??``,maxLength:300,onChange:t=>qe({...G,[e.name]:t.target.value})})]},e.name)),(0,J.jsxs)(H,{type:`submit`,disabled:Y||qt||Xt,"data-tip":qt?`Another run is going`:void 0,children:[(0,J.jsx)(m,{"aria-hidden":`true`}),Y?`Running…`:`Re-run`]})]}),K&&(0,J.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 (`,W.data.map(e=>e.name).join(`, `),`) gives its value; other columns are left out.`]}),Y&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(R,{tone:`running`,children:Yt?`Stopping: closing the browser…`:`Playing the steps in a new browser…`}),(0,J.jsxs)(H,{variant:`destructive`,disabled:Yt,onClick:()=>void jt(),"data-tip":`Stop the run and close its browser`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),Yt?`Stopping…`:`Stop`]})]}),!Y&&!Z&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Not run yet.`}),Z&&(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`p`,{className:I(`m-0 text-sm font-semibold [overflow-wrap:anywhere]`,Z.ok?`text-pass`:Z.stopped?`text-ink-2`:`text-fail`),children:Z.stopped?Z.rows?`Stopped after ${F(Z.rows.length,`row`)}${Z.env?` on ${Z.env}`:``}.`:`Stopped after ${F(Z.steps.filter(e=>!e.skipped).length,`step`)}${Z.env?` on ${Z.env}`:``}.`: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,J.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-[13px]`,children:Z.rows.map((e,n)=>(0,J.jsxs)(`li`,{className:I(`flex items-start gap-2 px-4 py-2`,n>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.label||`Row ${e.n}`}),!e.ok&&e.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))}),Z.steps.length>0&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:Z.steps.map((n,r)=>(0,J.jsxs)(`li`,{className:I(`flex flex-col`,r>0&&`border-t border-line-soft`,!n.ok&&`bg-fail-soft`),children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2 px-4 py-2`,children:[n.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):n.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:n.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[n.action,n.skipped?(0,J.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!n.ok&&n.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:n.error})]}),(0,J.jsx)(`span`,{className:`flex-1`}),n.shot&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${n.n} of the run`,"aria-expanded":he(n),"data-tip":`See the page after step ${n.n} of the run`,onClick:()=>me({...N,[n.n]:!he(n)}),className:`size-8 flex-none`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})})]}),n.shot&&he(n)&&(0,J.jsx)(gt,{runDir:e,n:n.n,failed:!n.ok},`${Z.ms??0}-${n.n}`)]},n.n))})]}),Z&&(Z.video||Z.trace||Z.network||W.runs?.[0]?.log)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Z.video&&(0,J.jsx)(ft,{runDir:e,kind:`try`}),W.runs?.[0]?.log&&(0,J.jsx)(pt,{runDir:e,which:W.runs[0].log,label:`Re-run log`}),Z.trace&&(0,J.jsx)(ht,{runDir:e}),Z.network&&(0,J.jsx)(mt,{runDir:e})]}),(W.runs?.length??0)>1&&(0,J.jsx)(dt,{runDir:e,runs:W.runs.slice(1)})]}),b===`instructions`&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-semibold text-ink`,children:[`Instructions for the Coding agent`,(0,J.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,J.jsx)(Te,{value:je,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>Me(e.target.value),onBlur:()=>je.trim()!==l.instructions&&void X({instructions:je.trim()}),className:`font-normal`})]}),b===`blocks`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.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.`}),Ie===!0&&(0,J.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.`}),Ie===!1&&(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-4 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,J.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,J.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),U.name.trim()&&Nt()},children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Keep steps`,(0,J.jsx)(B,{"aria-label":`The first step of the block`,value:U.from,onChange:e=>Re({...U,from:Number(e.target.value),to:Math.max(U.to,Number(e.target.value))}),className:`w-[84px]`,children:l.steps.map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`to`,(0,J.jsx)(B,{"aria-label":`The last step of the block`,value:U.to,onChange:e=>Re({...U,to:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.filter(e=>e.index>=U.from).map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.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,J.jsx)(L,{value:U.name,maxLength:80,placeholder:`Sign in`,onChange:e=>Re({...U,name:e.target.value})})]}),(0,J.jsxs)(H,{type:`submit`,disabled:h||!U.name.trim(),"data-tip":`Keep as a block`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Keep`]})]}),Ve&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:Ve}),Pe.length>0&&(0,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 border-t border-line-soft pt-4`,onSubmit:e=>{e.preventDefault();let t=ze.block||Pe[0].id;X({insert:{after:ze.after,block:t}})},children:[(0,J.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,J.jsx)(B,{"aria-label":`The block to put in`,value:ze.block||Pe[0].id,onChange:e=>Be({...ze,block:e.target.value}),children:Pe.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`after step`,(0,J.jsx)(B,{"aria-label":`The step the block goes after`,value:ze.after,onChange:e=>Be({...ze,after:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.jsxs)(H,{type:`submit`,disabled:h,"data-tip":`Put the block in after the step`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]})]}),b===`history`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-ink-2`,children:[(0,J.jsx)(z,{icon:s,size:15}),`Each change you make to the steps here is a version: go back to any one, and you can come back from it too. The runs are under Runs.`]}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:[...l.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,J.jsxs)(`li`,{className:I(`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,J.jsxs)(`span`,{className:`w-8 flex-none font-mono text-[13px] text-muted tabular-nums`,children:[`v`,e.n]}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,J.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[Je(e.at),` · `,F(e.steps,`step`)]})]}),t===0?(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Now`}):(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"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,J.jsx)(c,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function dt({runDir:e,runs:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),c=e=>{let t=e.steps.find(e=>!e.ok&&!e.skipped);return e.stopped?`Stopped before the end`:e.rows?e.ok?`All ${e.rows.length} rows passed`:`${e.rows.filter(e=>!e.ok).length} of ${e.rows.length} rows failed`:e.ok?`All ${e.steps.length} steps passed`:t?`Step ${t.n} failed: ${t.error||t.action}`:e.error||`It did not get through`};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-ink-2`,children:[(0,J.jsx)(z,{icon:s,size:15}),`Earlier runs, newest first. Only the latest run keeps its pictures, video and trace; each keeps its log.`]}),a&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:a}),(0,J.jsx)(`ol`,{"aria-label":`Earlier runs`,className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:n.map((n,a)=>(0,J.jsxs)(`li`,{className:I(`flex flex-col`,a>0&&`border-t border-line-soft`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,children:[n.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`flex-none text-pass`}):n.stopped?(0,J.jsx)(fe,{size:14,"aria-label":`Stopped`,className:`flex-none text-muted`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`flex-none text-fail`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,J.jsx)(`span`,{className:I(`text-[13px] [overflow-wrap:anywhere]`,n.ok||n.stopped?`text-ink`:`text-fail`),children:c(n)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[Je(n.at),n.env?` · on ${n.env}`:``,n.ms?` · ${Math.round(n.ms/1e3)}s`:``,n.why===`write`?` · before writing the test`:``]})]}),n.log&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Open the log of the run ${Je(n.at)} in a new tab`,"data-tip":`Open the log of the run ${Je(n.at)} in a new tab`,onClick:async()=>o(await V(n.log,()=>P.openLog(e,n.log))),className:`size-8 flex-none`,children:(0,J.jsx)(b,{"aria-hidden":`true`})}),n.steps.length>0&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the steps of the run ${Je(n.at)}`,"aria-expanded":r===n.at,"data-tip":`See the steps of the run ${Je(n.at)}`,onClick:()=>i(r===n.at?null:n.at),className:`size-8 flex-none`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})})]}),r===n.at&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0 text-[13px]`,children:n.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:I(`flex items-start gap-2 px-4 py-2`,n>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):e.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,J.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]},n.at))})]})}function ft({runDir:e,kind:t}){let[n,r]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Open the video of ${t===`try`?`the re-run`:`the recording`} in a new tab`,onClick:async()=>r(await V(t,()=>P.openVideo(e,t))),children:[(0,J.jsx)(m,{"aria-hidden":`true`}),t===`try`?`Re-run video`:`Recording video`]}),n&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function pt({runDir:e,which:t,label:n}){let[r,i]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Open the ${n.toLowerCase()} in a new tab`,onClick:async()=>i(await V(t,()=>P.openLog(e,t))),children:[(0,J.jsx)(b,{"aria-hidden":`true`}),n]}),r&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})}function mt({runDir:e}){let t=e.split(/[\\/]/).filter(Boolean).pop()||``;return t?(0,J.jsxs)(H,{"data-tip":`Make API tests from the calls the app made in this re-run, with their payloads and answers`,onClick:()=>location.hash=Ce(`api-tests`,encodeURIComponent(`new:${t}/tries`)),children:[(0,J.jsx)(oe,{"aria-hidden":`true`}),`API tests from its calls`]}):null}function ht({runDir:e}){let[t,n]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Download Playwright's trace of the re-run: open it at trace.playwright.dev to see each step's page, actions and network`,onClick:async()=>n(await V(`trace.zip`,()=>P.openTrace(e))),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),`Trace`]}),t&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:t})]})}function gt({runDir:e,n:t,failed:n}){let[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let n=!1;return P.tryShot(e,t).then(e=>!n&&i(e),()=>!n&&o(!0)),()=>{n=!0}},[e,t]);let s=n?`The page when step ${t} of the run failed`:`The page after step ${t} of the run`;return(0,J.jsx)(`div`,{className:`px-4 pb-4 sm:pl-14`,children:a?(0,J.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):r?(0,J.jsx)(`img`,{src:r,alt:s,className:`max-h-[420px] w-full max-w-[720px] rounded-[12px] border border-line-soft object-contain object-top`}):(0,J.jsx)(`div`,{className:`min-h-24 max-w-[720px] rounded-[12px] bg-surface-muted`})})}function _t({rows:e,n:t,locators:n,busy:r,onPick:i}){let a=n?.find(e=>e.chosen);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[n&&n.length>1&&i&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`How step `,t,` finds its element`,(0,J.jsx)(B,{value:String(a?.pick??n[0].pick),disabled:r,onChange:e=>i(Number(e.target.value)),"aria-describedby":a?.risk?`step-${t}-locator-risk`:void 0,className:`max-w-[560px]`,children:n.map(e=>(0,J.jsxs)(`option`,{value:e.pick,children:[ct(e),e.risk===`varies`?` — another value when the page loaded again`:e.risk?` — unique on this run only`:e.verified?` — unique on the page`:``,e.confidence===void 0?``:` (${e.confidence}%)`]},e.pick))})]}),a?.risk&&(0,J.jsx)(`span`,{id:`step-${t}-locator-risk`,className:`text-[13px] text-warn`,children:st[a.risk].alone})]}),(0,J.jsx)(`dl`,{"aria-label":`What was recorded for step ${t}`,className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 rounded-[12px] bg-surface-muted px-4 py-2 text-[13px] sm:grid-cols-[170px_minmax(0,1fr)] sm:gap-y-2`,children:e.map((e,t)=>(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted`,children:e.label}),(0,J.jsx)(`dd`,{className:I(`m-0 text-ink [overflow-wrap:anywhere]`,e.code&&`font-mono text-[13px]`),children:e.value})]},`${t}-${e.label}`))})]})}function vt({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``);(0,q.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,J.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:o}),!i&&!o&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading the picture…`}),i&&(0,J.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,J.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,J.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t,e.f),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}`)})]})]})}var yt=[[`contains`,`Contains`],[`equals`,`Is exactly`],[`starts`,`Starts with`],[`ends`,`Ends with`],[`not_contains`,`Does not contain`],[`regex`,`Matches a pattern`],[`number`,`A number in it is`]],bt=[[`eq`,`=`],[`gt`,`>`],[`gte`,`≥`],[`lt`,`<`],[`lte`,`≤`],[`between`,`between`]],xt=[[`text`,`Its text`],[`value`,`Its value`],[`visible`,`It shows`],[`hidden`,`It is gone`],[`enabled`,`It is enabled`],[`disabled`,`It is disabled`],[`count`,`How many there are`],[`attribute`,`An attribute's value`]],St=/^[A-Za-z_][\w:.-]{0,60}$/,Ct=e=>{let t=e.replace(/\u00a0/g,` `).match(/-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?/);return t?t[0].replace(/,/g,``):``};function wt({check:e,onSave:n}){let r=e.match,i=e.was??e.kind,[a,o]=(0,q.useState)(e.kind),[s,l]=(0,q.useState)(e.attr??``),[u,d]=(0,q.useState)(r?.how??(e.kind===`count`?`number`:`contains`)),[f,p]=(0,q.useState)(r?.text??(e.kind===`attribute`?``:e.text)),[m,h]=(0,q.useState)(!!r?.ci),[g,_]=(0,q.useState)(r?.op??(e.kind===`count`?`gte`:`eq`)),[v,y]=(0,q.useState)(r?.min===void 0?e.kind===`count`?`1`:Ct(e.text):String(r.min)),[b,x]=(0,q.useState)(r?.max===void 0?``:String(r.max)),S=e=>e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,C=(()=>{try{return new RegExp(f),!0}catch{return!1}})(),w=a===`count`?`number`:[`text`,`value`,`attribute`,`url`,`title`].includes(a)?`text`:`none`,T=w===`number`?`number`:u,E=a!==`attribute`||St.test(s),D=T===`number`?S(v)===void 0||g===`between`&&(S(b)===void 0||S(b)<S(v))?void 0:{how:T,op:g,min:S(v),...g===`between`?{max:S(b)}:{}}:!f.trim()||T===`regex`&&(!C||f.length>200)?void 0:{how:T,text:f.trim(),...m?{ci:!0}:{}},ee=E&&(w===`none`||D!==void 0&&(a!==`attribute`||D.how!==`number`)),te=e.element&&a!==e.kind,O=e.kind===`value`?`The field's value`:e.kind===`url`?`The page address`:e.kind===`title`?`The page title`:`The text`;return(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:t=>{if(t.preventDefault(),!ee)return;let r=w===`none`?null:D;if(!te&&a===i&&(a===`text`||a===`value`)&&r&&r.how===`contains`&&!r.ci&&r.text===e.text)return n({match:null});n(e.element?{match:r,kind:a,...a===`attribute`?{attr:s}:{}}:{match:r})},children:[e.element&&(0,J.jsx)(B,{value:a,"aria-label":`What to check`,onChange:t=>{let n=t.target.value;if(o(n),n===`count`?(d(`number`),a!==`count`&&(_(`gte`),y(`1`))):u===`number`&&n===`attribute`&&d(`equals`),n===`attribute`&&a!==`attribute`&&p(e.kind===`attribute`?r?.text??``:``),(n===`text`||n===`value`)&&a!==n){let t=e.kind===`text`||e.kind===`value`?r:void 0;d(t?.how??`contains`),p(t?.text??e.text),h(!!t?.ci),_(t?.op??`eq`),y(t?.min===void 0?Ct(e.text):String(t.min)),x(t?.max===void 0?``:String(t.max))}},children:xt.filter(([e])=>e===`text`||e===`value`?e===i:!0).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),a===`attribute`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{value:s,maxLength:61,"aria-label":`The attribute`,placeholder:`e.g. aria-expanded or data-state`,onChange:e=>l(e.target.value)}),s!==``&&!E&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:`An attribute's name starts with a letter or _, then letters, digits and - _ : . only.`})]}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:a===`attribute`?`The attribute's value, compared as text.`:w===`number`?`How many elements this check's locator finds on the page.`:w===`none`?a===`visible`?`The replay checks it shows.`:a===`hidden`?`The replay checks it is gone.`:`The replay checks it is ${a}.`:`${O} was “${e.text}” when you recorded.`}),w===`text`&&(0,J.jsx)(B,{value:u,"aria-label":`How to compare`,onChange:e=>d(e.target.value),children:yt.filter(([e])=>a!==`attribute`||e!==`number`).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),w===`none`?null:T===`number`?(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(B,{value:g,"aria-label":`Compared with`,onChange:e=>_(e.target.value),className:`flex-none`,children:bt.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),(0,J.jsx)(L,{value:v,inputMode:`decimal`,maxLength:20,"aria-label":g===`between`?`Lowest value`:`Value`,onChange:e=>y(e.target.value),className:`min-w-0 flex-1`}),g===`between`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`and`}),(0,J.jsx)(L,{value:b,inputMode:`decimal`,maxLength:20,"aria-label":`Highest value`,onChange:e=>x(e.target.value),className:`min-w-0 flex-1`})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{value:f,maxLength:u===`regex`?200:300,"aria-label":u===`regex`?`The pattern`:`The text`,placeholder:u===`regex`?`e.g. ^Order \\d+ placed$`:void 0,onChange:e=>p(e.target.value)}),u===`regex`&&!C&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:`That is not a valid pattern.`}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,J.jsx)(K,{checked:m,onCheckedChange:h}),`Any case (capital or small letters)`]})]}),w===`text`&&(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:u===`number`?`The first number in it is read, with any thousands separators and currency sign.`:`Spaces and line breaks count as one space.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!ee,"data-tip":`Save this check`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Save`]}),r&&(e.kind===`text`||e.kind===`value`||!e.element)&&(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({match:null}),"data-tip":`Compare by contains, as recorded`,children:[(0,J.jsx)(c,{"aria-hidden":`true`}),`Back to contains “`,e.text,`”`]})]})}function Tt({step:e,onAdd:n,onRecordMore:r}){let[i,a]=(0,q.useState)(`check`),[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(``),[d,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(`2`),[g,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(e.note||``),b=e.index,x=[[`check`,`Check`],[`step`,`Step`],[`wait`,`Wait`],[`note`,`Note`]],S=Number(m),C=Number.isInteger(S)&&S>=1&&S<=60;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`What to add`,className:`flex gap-1 rounded-[9px] bg-surface-strong p-1`,children:x.map(([e,t])=>(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e,onClick:()=>a(e),className:I(`flex-1 cursor-pointer rounded-[6px] border-0 px-2 py-1 text-[13px] font-medium`,i===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),i===`check`&&(0,J.jsxs)(J.Fragment,{children:[e.page&&(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({checks:[{after:b,kind:`url`}]}),children:[`The page is `,e.page]}),(0,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&n({checks:[{after:b,kind:`intent`,text:o.trim()}]})},children:[(0,J.jsx)(L,{value:o,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>s(e.target.value)}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!o.trim(),"data-tip":`Add the check`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]}),i===`step`&&(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,J.jsxs)(H,{size:`sm`,onClick:r,"data-tip":`Record more from here`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),(0,J.jsx)(`span`,{className:`text-[13px] 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,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&n({steps:[{after:b,kind:`do`,text:o.trim()}]})},children:[(0,J.jsx)(L,{value:o,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>s(e.target.value)}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The Coding agent finds the control on the page and does it here.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!o.trim(),"data-tip":`Add the step`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(g.trim())&&n({steps:[{after:b,kind:`open`,url:g.trim()}]})},children:[(0,J.jsx)(L,{value:g,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>_(e.target.value),className:`min-w-0 flex-1`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(g.trim()),"data-tip":`Add a step that opens this page`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({steps:[{after:b,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Go back`]})]}),i===`wait`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each step already waits for the page to load, its calls to finish and its spinners to go. Add a wait for what the page does later or slowly.`}),(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({steps:[{after:b,kind:`wait_load`}]}),"data-tip":`Wait until the page has loaded, its calls have finished and its spinners have gone`,children:[(0,J.jsx)(l,{"aria-hidden":`true`}),`Until the page has loaded`]}),(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),c.trim()&&n({steps:[{after:b,kind:`wait_text`,text:c.trim(),...d?{gone:!0}:{}}]})},children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(B,{value:d?`gone`:`shows`,"aria-label":`Wait until the text`,onChange:e=>p(e.target.value===`gone`),className:`flex-none`,children:[(0,J.jsx)(`option`,{value:`shows`,children:`Until it shows`}),(0,J.jsx)(`option`,{value:`gone`,children:`Until it is gone`})]}),(0,J.jsx)(L,{value:c,maxLength:120,placeholder:d?`e.g. Loading`:`e.g. Order placed`,"aria-label":`The text to wait for`,onChange:e=>u(e.target.value),className:`min-w-0 flex-1`})]}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!c.trim(),"data-tip":`Add the wait`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(`form`,{className:`flex items-center gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),C&&n({steps:[{after:b,kind:`wait_seconds`,seconds:S}]})},children:[(0,J.jsx)(L,{value:m,type:`number`,min:1,max:60,step:1,maxLength:2,"aria-label":`Seconds to wait`,onChange:e=>h(e.target.value),className:`w-20 flex-none`}),(0,J.jsx)(`span`,{className:`flex-1 text-[13px] text-ink-2`,children:`seconds`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,disabled:!C,"data-tip":`Add a pause of this many seconds`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]}),i===`note`&&(0,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),n({notes:[{index:b,text:v.trim()}]})},children:[(0,J.jsx)(L,{value:v,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>y(e.target.value)}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:v.trim()===(e.note||``),"data-tip":v.trim()||!e.note?`Save the note`:`Remove the note`,children:[v.trim()||!e.note?(0,J.jsx)(t,{"aria-hidden":`true`}):(0,J.jsx)(le,{"aria-hidden":`true`}),v.trim()||!e.note?`Save`:`Remove`]})]})]})}var Et={navigate:ae,back:T,click:C,dblclick:C,input:x,press:x,select:e,upload:_e,expect:k,wait_for:l,capture:n,note:ue,launch:m,double_click:C,type:x,keys:x,tap:C,double_tap:C,long_press:C,swipe:M,scroll:re,hide_keyboard:x,wait:O,dismiss:u},Y=e=>Et[e]||(e.startsWith(`expect`)?k:te),Dt=new Set([`starting`,`recording`,`paused`,`stopping`]);function Ot(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 kt(e){await P.write(e,{check:!0})}async function At(e,t=`desktop`){let n=t===`mobile`?`mobile_replay`:`desktop_replay`,{id:r}=await ve.start(`Replay the ${t} workflow ${e}: call ${n} with workflow ${e}, and tell me how each step went.`,{});location.hash=Ce(`chats`,r)}function jt({s:e,live:t,onDelete:n}){let r=Y(e.op);return(0,J.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-4 border-t border-line-soft py-2 first:border-t-0`,children:[(0,J.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right text-[13px] text-muted tabular-nums`,children:e.n||`–`}),(0,J.jsx)(r,{size:16,"aria-hidden":`true`,className:I(`mt-1 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,J.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.case_step?(0,J.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,J.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,J.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,J.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,J.jsx)(H,{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,J.jsx)(le,{"aria-hidden":`true`})})]})}var Mt=[[`tap`,`Tap`],[`check`,`Check`],[`long_press`,`Long-press`],[`wait_for`,`Wait for`]],Nt={tap:`Tap`,check:`Check`,long_press:`Long-press`,wait_for:`Wait for`};function X({s:e,send:t,busy:n,secrets:a}){let o=e.screen,[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(`tap`),[d,f]=(0,q.useState)(null),[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(``),v=o?.seq??0,y=o?.frame??v;(0,q.useEffect)(()=>{if(!y||!o?.image)return;let e=!1;return P.screen().then(t=>!e&&c(t),()=>{}),()=>{e=!0}},[y,o?.image]),(0,q.useEffect)(()=>{d&&d.seq!==v&&f(null)},[v,d]);let b=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,C=o&&o.width>0?(o.elements||[]).map((e,t)=>({c:e,i:t})).filter(e=>e.c.usable).sort((e,t)=>t.c.box[2]*t.c.box[3]-e.c.box[2]*e.c.box[3]):[],w=e=>e.label?`“${e.label}”`:`the ${e.kind||`control`}`,E=(e,n)=>{l===`tap`&&n.field?(f({el:e,seq:v,c:n}),h(``),_(n.secure&&a.length?a[0]:``)):t({cmd:l,seq:v,el:e})},D=!n&&e.state===`recording`&&!!o;return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-device`,className:`flex min-w-0 flex-[1_1_320px] flex-col gap-4 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-device`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:S,size:18,className:`text-accent-fg`}),e.device||`Device`,(0,J.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.platform===`ios`?`iOS`:`Android`})]}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`What a click on the screen does`,className:Xe,children:Mt.map(([e,t])=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":l===e,onClick:()=>u(e),className:Ye(l===e),children:t},e))}),o?(0,J.jsxs)(`div`,{className:`relative w-full max-w-[360px] self-center overflow-hidden rounded-[10px] border border-line-soft bg-surface-muted`,style:{aspectRatio:`${o.width} / ${o.height}`},children:[s&&(0,J.jsx)(`img`,{src:s,alt:`The screen of ${e.app} now`,className:`absolute inset-0 size-full object-fill`}),C.map(({c:e,i:t})=>{let n=l===`tap`&&e.field?`Type into ${w(e)}`:`${Nt[l]} ${w(e)}${e.prompt?` (a system prompt: kept to answer whenever a replay is asked)`:``}`;return(0,J.jsx)(`button`,{type:`button`,disabled:!D,"aria-label":n,"data-tip":n,onClick:()=>E(t,e),className:`absolute cursor-pointer rounded-[3px] border-0 bg-transparent p-0 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 disabled:cursor-wait`,style:{left:b(e.box[0],o.width),top:b(e.box[1],o.height),width:b(e.box[2],o.width),height:b(e.box[3],o.height)}},`${v}-${t}`)})]}):(0,J.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:e.state===`starting`?`Starting ${e.app} on ${e.device||`the device`}: a device cloud can take a minute or two…`:`Waiting for the screen…`}),d&&(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,onSubmit:e=>{if(e.preventDefault(),g)t({cmd:`type`,seq:d.seq,el:d.el,secret:g});else if(m)t({cmd:`type`,seq:d.seq,el:d.el,text:m});else return;f(null)},children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium [overflow-wrap:anywhere]`,children:[`Type into `,w(d.c)]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:[(a.length>0||d.c.secure)&&(0,J.jsxs)(B,{"aria-label":`What to type`,value:g,onChange:e=>_(e.target.value),className:`min-w-0 flex-[1_1_160px] bg-bg`,children:[!d.c.secure&&(0,J.jsx)(`option`,{value:``,children:`Text I type`}),a.map(e=>(0,J.jsxs)(`option`,{value:e,children:[`Secret `,e]},e))]}),!g&&(0,J.jsx)(L,{"aria-label":`Text to type`,autoFocus:!0,value:m,maxLength:2e3,spellCheck:!1,onChange:e=>h(e.target.value),className:`min-w-0 flex-[2_1_180px] bg-bg`}),(0,J.jsxs)(H,{type:`submit`,variant:`primary`,disabled:!D||!g&&!m,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Type`]})]}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 text-[13px] text-muted`,children:[d.c.secure?a.length?`A password field: only a saved secret goes in, by its name, never its value.`:`A password field takes a saved secret: add one to mobile.secrets in Settings first.`:`A secret is typed from the credential store; the test keeps only its name.`,(0,J.jsx)(`button`,{type:`button`,onClick:()=>(t({cmd:`tap`,seq:d.seq,el:d.el}),f(null)),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Only tap it`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>f(null),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:`Cancel`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"aria-label":`Gestures and keys`,role:`group`,children:[[[`Scroll up`,me,{cmd:`scroll`,direction:`up`}],[`Scroll down`,re,{cmd:`scroll`,direction:`down`}],[`Swipe left`,i,{cmd:`swipe`,direction:`left`}],[`Swipe right`,r,{cmd:`swipe`,direction:`right`}]].map(([e,n,r])=>(0,J.jsx)(H,{variant:`icon`,size:`icon`,"aria-label":e,"data-tip":e,disabled:!D,onClick:()=>t(r),children:(0,J.jsx)(n,{"aria-hidden":`true`})},e)),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`back`}),"data-tip":`The device's Back`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Back`]}),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`keys`,key:`enter`}),"data-tip":`Press Enter on the keyboard`,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Enter`]}),(0,J.jsx)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`hide_keyboard`}),"data-tip":`Hide the keyboard`,children:`Hide keyboard`}),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`wait`,seconds:2}),"data-tip":`Record a wait of 2 seconds`,children:[(0,J.jsx)(O,{"aria-hidden":`true`}),`Wait 2 s`]}),(0,J.jsx)(H,{variant:`icon`,size:`icon`,"aria-label":`Read the screen again`,"data-tip":`Read the screen again`,disabled:!D,onClick:()=>t({cmd:`refresh`}),children:(0,J.jsx)(p,{"aria-hidden":`true`})})]}),e.notice&&(0,J.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn [overflow-wrap:anywhere]`,children:e.notice.text})]})}function Pt({s:t,send:n,busy:r,secrets:i=[]}){let[,a]=(0,q.useState)(0);(0,q.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]);let o=(0,q.useRef)(null),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t.log.length]),(0,q.useEffect)(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[t.steps.length]);let c=t.kind===`desktop`,l=t.kind===`mobile`,u=t.kind===`web`,d=t.state===`paused`,f=t.log.at(-1)?.level===`warn`&&/press Stop again/i.test(t.log.at(-1).text),p=Math.max(0,...t.steps.map(e=>e.case_step||0));return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4 rounded-[14px] card border px-4 py-4`,children:[d?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,J.jsx)(be,{state:t.state===`starting`?`waiting`:t.state===`stopping`?`working`:`recording`,px:20}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,J.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[t.state===`starting`?l?`Starting ${t.app} on ${t.device||`the device`}…`:c?`Starting ${t.app}…`:`Opening the browser…`:t.state===`stopping`?`Saving the workflow…`:d?`Paused: what you do now is not recorded`:`Recording`,` · `,Ot(t.startedAt),` ·`,` `,l?`${t.app} on ${t.device||`the device`}`:c?`${t.app}, a desktop app`:t.url]}),t.block&&(0,J.jsx)(`span`,{className:I(`text-[13px] [overflow-wrap:anywhere]`,t.block.state===`stopped`?`text-warn`:`text-muted`),children:t.block.kind===`recording`?t.block.state===`waiting`?`The recording's steps up to step ${t.block.total+1} play when the page is open.`:t.block.state===`playing`?`Doing the recording's steps up to step ${t.block.total+1}: wait for it.`:t.block.state===`done`?`At step ${t.block.total+1}: record what comes next, then Stop and save.`:`Step ${t.block.done+2} could not be done${t.block.note?` (${t.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${t.block.done+2} to ${t.block.total+1}.`:t.block.state===`waiting`?`The block "${t.block.name}" plays when the page is open.`:t.block.state===`playing`?`Doing the block "${t.block.name}" (${t.block.total} steps): wait for it.`:t.block.state===`done`?`The block "${t.block.name}" is done: carry on.`:`The block "${t.block.name}" stopped after ${t.block.done} of ${t.block.total} steps${t.block.note?` (${t.block.note})`:``}: do the rest by hand.`})]}),u&&(0,J.jsxs)(H,{disabled:r||t.state===`starting`,onClick:()=>n({cmd:`pause`}),children:[d?(0,J.jsx)(m,{"aria-hidden":`true`}):(0,J.jsx)(v,{"aria-hidden":`true`}),d?`Resume`:`Pause`]}),!c&&(0,J.jsxs)(H,{disabled:r||t.state===`starting`||!t.steps.length,onClick:()=>n({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,J.jsx)(ge,{"aria-hidden":`true`}),`Undo`]}),(0,J.jsxs)(H,{variant:`destructive`,disabled:r||t.state===`stopping`,onClick:()=>n({cmd:`stop`,...f?{force:!0}:{}}),"data-tip":f?`Stop anyway`:`Stop and save`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),l?(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[`Do the steps on the screen below: a click is done on the device and becomes a step, found again by the control's id or text. Pick `,(0,J.jsx)(`strong`,{children:`Check`}),` and click what shows the outcome to add a check. A password field takes only a saved secret, by its name.`]}):c?(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[t.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,J.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,J.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 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, `,t.leader,` then `,(0,J.jsx)(`strong`,{children:`P`}),` pauses, `,(0,J.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,J.jsx)(`strong`,{children:`S`}),` stops.`]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-6`,children:[l&&(0,J.jsx)(X,{s:t,busy:r,secrets:i,send:n}),(0,J.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-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:e,size:18,className:`text-accent-fg`}),`Steps`,(0,J.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:t.summary})]}),t.steps.length?(0,J.jsx)(`div`,{ref:s,className:`max-h-[60vh] overflow-y-auto`,children:(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:t.steps.map(e=>(0,J.jsx)(jt,{s:e,live:!c,onDelete:()=>n({cmd:`delete`,n:e.n})},`${e.n}-${e.op}-${e.text}`))})}):(0,J.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:t.state===`starting`?c||l?`Starting ${t.app}…`:`Opening the browser…`:`Nothing yet: do the first step ${l?`on the screen`:`in ${c?t.app:`the browser`}`}.`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-6`,children:[t.case&&(0,J.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:e,size:18,className:`text-accent-fg`}),t.case.id]}),(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:t.case.steps.map(e=>{let i=t.steps.some(t=>t.case_step===e.n);return(0,J.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,J.jsxs)(`button`,{type:`button`,disabled:r,"aria-current":e.n===p?`step`:void 0,onClick:()=>n({cmd:`case_step`,n:e.n}),className:I(`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===p&&`bg-accent-soft`),children:[i?(0,J.jsx)(k,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(`span`,{className:`mt-1 w-4 flex-none text-center text-[13px] text-muted`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.action}),e.expected&&(0,J.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,e.expected]})]})]})},e.n)})}),(0,J.jsxs)(H,{disabled:r,onClick:()=>n({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,J.jsx)(M,{"aria-hidden":`true`}),`Next`]})]}),(0,J.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,J.jsx)(`div`,{ref:o,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-[13px]`,"aria-live":`polite`,children:t.log.length?t.log.map((e,t)=>(0,J.jsx)(`p`,{className:I(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,J.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,l?`the device`:c?`the app`:`the browser`,`…`]})})]})]})]})]})}function Ft({s:e}){let t=e.result,[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(!1);if(!t)return null;let o=e.kind!==`web`;return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,J.jsx)(R,{tone:t.ok?`pass`:`fail`,children:t.ok?`Recorded`:`Not recorded`})]}),(0,J.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,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Ot(e.startedAt,e.endedAt)]})]}),t.ok&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:F(e.steps.length,`step`)}),(0,J.jsxs)(R,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,J.jsxs)(R,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,J.jsxs)(R,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!o&&t.secrets.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?`, `:``,(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-warn`,children:t.caseGaps.map(e=>(0,J.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-ink-2`,children:t.notes.map((e,t)=>(0,J.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-muted`,children:t.skipped.map((e,t)=>(0,J.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[o&&t.workflow&&(0,J.jsxs)(H,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await At(t.workflow,e.kind===`mobile`?`mobile`:`desktop`)}catch(e){r(e.message),a(!1)}},children:[(0,J.jsx)(m,{"aria-hidden":`true`}),`Replay`]}),o&&t.report&&(0,J.jsxs)(H,{onClick:async()=>r(await V(t.report)),"data-tip":`Open the report`,children:[(0,J.jsx)(de,{"aria-hidden":`true`}),`Report`]}),!o&&t.ok&&(0,J.jsxs)(H,{onClick:async()=>r(await V(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,J.jsx)(he,{"aria-hidden":`true`}),`Steps`]}),(0,J.jsx)(`span`,{className:`text-sm`,children:(0,J.jsx)(We,{path:o&&t.workflow?t.workflow:e.runDir})}),n&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})]})}function It(e){try{let t=decodeURIComponent(e);return t&&t.length<=500&&!/[\0\r\n]/.test(t)?t:null}catch{return null}}function Lt(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function Rt({view:e,busy:t,onStart:n,start:r}){let i=Lt(r),a=e.mobile.apps.length>0,[o,s]=(0,q.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:e.session?.kind===`mobile`&&a?`mobile`:`web`),[c,l]=(0,q.useState)(e.mobile.apps[0]?.name??``),u=e.mobile.devices.filter(t=>t.platform===(e.mobile.apps.find(e=>e.name===c)?.platform??t.platform)),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(e.desktop.apps[0]??``),[g,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(``),[x,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[ee,te]=(0,q.useState)(``),[O,ne]=(0,q.useState)(i?``:e.apps[0]?.name??``),[re,ie]=(0,q.useState)(i),[k,A]=(0,q.useState)(``),[j,oe]=(0,q.useState)(e.environment??``),[se,le]=(0,q.useState)(!1),[M,ue]=(0,q.useState)(!1),[de,fe]=(0,q.useState)(``),N=o===`web`?e.blocks.find(e=>e.id===de):void 0,pe=o===`mobile`?a&&!!c:o===`desktop`?e.desktop.available&&(!!m||!!g.trim()&&!!y.trim()):N||O?!0:/^https?:\/\/\S+$/i.test(re.trim()),me=o===`web`||e.environments.length>1;return(0,J.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,onSubmit:t=>{if(t.preventDefault(),pe){if(o===`mobile`)return n({kind:`mobile`,app:c,...d&&u.some(e=>e.name===d)?{device:d}:{},...j&&j!==e.environment?{env:j}:{}});if(o===`desktop`&&m)return n({kind:`desktop`,app:m,...j&&j!==e.environment?{env:j}:{}});if(o===`desktop`)D(!0),te(``),we.addApp({name:y.trim(),path:g.trim(),...x.trim()?{args:x.trim()}:{},...j?{env:j}:{}}).then(t=>n({kind:`desktop`,app:t.name,...j&&j!==e.environment?{env:j}:{}}),e=>te(e.message)).finally(()=>D(!1));else{if(N)return n({block:N.id,...j&&j!==e.environment?{env:j}:{},signedIn:se});n({...O?{app:O}:{url:re.trim()},...k.trim()?{case:k.trim()}:{},...j&&j!==e.environment?{env:j}:{},signedIn:se})}}},children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,ae,!0],[`desktop`,`Desktop app`,ce,e.desktop.available],[`mobile`,`Mobile app`,S,a]].map(([t,n,r,i])=>(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":o===t,disabled:!i,"data-tip":i?void 0:t===`mobile`?`Add a mobile app in Settings → Mobile first.`:e.desktop.reason||`Windows only.`,onClick:()=>s(t),className:I(`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[7px] border-0 px-4 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50`,o===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,J.jsx)(r,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,J.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1fr)_auto]`,children:[o===`mobile`?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:[(0,J.jsx)(B,{"aria-label":`App`,value:c,onChange:e=>l(e.target.value),className:`min-w-0 flex-[2_1_180px]`,children:e.mobile.apps.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.platform===`ios`?`iOS`:`Android`]},e.name))}),u.length>0&&(0,J.jsx)(B,{"aria-label":`Device`,value:d,onChange:e=>p(e.target.value),className:`min-w-0 flex-[1_1_160px]`,children:u.map((e,t)=>(0,J.jsxs)(`option`,{value:t===0?``:e.name,children:[e.name,` · `,e.where]},e.name))})]}):o===`desktop`?(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.desktop.apps.length>0&&(0,J.jsxs)(B,{"aria-label":`App`,value:m,onChange:e=>h(e.target.value),className:I(m?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.desktop.apps.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e)),(0,J.jsx)(`option`,{value:``,children:`Another app…`})]}),!m&&(0,J.jsx)(et,{value:g,onChange:e=>{v(e),w||b(e.trim()?tt(e):``)},onPicked:(e,t)=>{w||b(t)},onError:te,className:`flex-1`})]}):N?(0,J.jsxs)(`p`,{className:`m-0 self-center text-sm [overflow-wrap:anywhere]`,children:[`Opens `,N.startUrl,`, does the block `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:N.name}),` (`,N.steps,` `,N.steps===1?`step`:`steps`,`), then you carry on.`]}):(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,J.jsxs)(B,{"aria-label":`Start on`,value:O,onChange:e=>ne(e.target.value),className:I(O?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,J.jsx)(`option`,{value:``,children:`Another page…`})]}),!O&&(0,J.jsx)(L,{"aria-label":`Page address`,type:`url`,value:re,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>ie(e.target.value),className:`min-w-0 flex-1`})]}),(0,J.jsxs)(H,{type:`submit`,variant:`primary`,disabled:t||E||!pe,"data-tip":`Start recording`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),E?`Adding…`:t?o===`web`?`Opening…`:`Starting…`:`Record`]})]}),o===`desktop`&&!m&&(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-[12px] bg-surface-muted p-4 @2xl:grid-cols-[minmax(0,220px)_minmax(0,1fr)]`,children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Save it as`,(0,J.jsx)(L,{"aria-label":`The app's name`,value:y,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{T(!0),b(e.target.value)},className:`bg-bg`})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Arguments `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Optional: what the app starts with. Quotes keep spaces together; no shell.`}),(0,J.jsx)(L,{"aria-label":`The app's arguments`,value:x,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>C(e.target.value),className:`bg-bg font-mono text-[13px]`})]}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted @2xl:col-span-2`,children:[`Added to the apps of `,j||e.environment?`the ${j||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]}),ee&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:ee}),me&&(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":M,onClick:()=>ue(!M),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,J.jsx)(_,{size:14,"aria-hidden":`true`,className:I(`transition-transform`,M&&`rotate-180`)}),`More options`,!M&&(k||se||N||j&&j!==e.environment)?(0,J.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,J.jsx)(Le,{open:M,children:(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-[12px] bg-surface-muted p-4 @2xl:grid-cols-2`,children:[o===`web`&&e.blocks.length>0&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Start from a block `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Its steps are done for you first, then you record the rest.`}),(0,J.jsxs)(B,{value:de,onChange:e=>fe(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`No block: start on the page`}),e.blocks.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),o===`web`&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Test case `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,J.jsx)(L,{value:k,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>A(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(o!==`web`||!!O)&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Environment`,(0,J.jsx)(B,{value:j,onChange:e=>oe(e.target.value),children:e.environments.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})]}),o===`web`&&e.logins.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-4 @2xl:col-span-2`,children:[(0,J.jsx)(je,{checked:se,onChange:le,label:`Start signed in`}),(0,J.jsxs)(`span`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,J.jsxs)(`span`,{className:`text-[13px] 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,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:o===`mobile`?`The app starts on the device through Appium, here or on a device cloud, and its screen is shown on this page: do the steps there. It is saved as a workflow that replays with no model.`:o===`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 Z=5;function zt(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function Q({view:e}){let t=e.recordings,n=t.filter(e=>e.seconds!==void 0),r=n.reduce((e,t)=>e+(t.seconds??0),0),i=t.filter(e=>e.kind===`web`&&Qe(e.test).hasTest).length,a=Math.round(r/60),o=Math.floor(a/60),s=a%60;return(0,J.jsxs)(Re,{label:`Recordings in numbers`,children:[(0,J.jsx)(Me,{compact:!0,icon:m,label:`Recordings`,value:String(t.length),note:t.some(e=>e.kind!==`web`)?[[`web`,`web`],[`desktop`,`desktop`],[`mobile`,`mobile`]].map(([e,n])=>[t.filter(t=>t.kind===e).length,n]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `):`web pages`}),(0,J.jsx)(Me,{compact:!0,icon:E,label:`Tests written`,value:String(i),note:`from these recordings`}),(0,J.jsx)(Me,{compact:!0,icon:D,label:`Reusable flows`,value:String(e.blocks.length),note:`blocks kept to use again`}),(0,J.jsx)(Me,{compact:!0,icon:O,label:`Total duration`,value:n.length?o?`${o}h ${s}m`:`${s}m`:`—`,note:n.length?`${F(n.length,`recording`)} timed`:`kept from now on`})]})}function Bt(){return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-how`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,J.jsx)(`h2`,{id:`rec-how`,className:`m-0 text-base font-semibold`,children:`How it works`}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:[{icon:f,title:`Record your journey`,text:`Each click, entry and choice in the browser or app is recorded in order.`},{icon:e,title:`Define checks`,text:`Choose what each step must show, and where typed values come from.`},{icon:E,title:`Generate the test`,text:`Write turns it into a test in your repository; Re-run plays it on any environment.`}].map((e,t)=>(0,J.jsxs)(`li`,{className:`flex items-start gap-4`,children:[(0,J.jsx)(z,{icon:e.icon,size:16,className:`mt-1 flex-none text-accent-fg`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium`,children:[t+1,`. `,e.title]}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.text})]})]},e.title))})]})}function Vt({anchor:e,open:t,onClose:n,label:r,align:i,children:a}){let o=(0,q.useRef)(null),[s,c]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!t||!e)return;let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(document.documentElement).getPropertyValue(`--ui-zoom`))||1;c({top:n.bottom/r,left:(i===`right`?n.right:n.left)/r,up:window.innerHeight-n.bottom<280&&n.top>window.innerHeight-n.bottom,h:n.height/r})},[t,e,i]),(0,q.useEffect)(()=>{if(!t)return;let e=()=>n();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,n]),(0,q.useEffect)(()=>{if(!t||!s)return;(o.current?.querySelector(`[role^="menuitem"]`))?.focus();let n=o.current;return()=>{let t=document.activeElement;setTimeout(()=>{let r=document.activeElement;(!r||r===document.body||r===t&&n?.contains(r))&&e?.querySelector(`button`)?.focus()},0)}},[t,s,e]),s?(0,rt.createPortal)((0,J.jsx)(`div`,{ref:o,className:`fixed z-50`,style:{top:s.up?s.top-s.h:s.top,left:s.left},onKeyDown:e=>{let t=[...o.current?.querySelectorAll(`[role^="menuitem"]`)??[]],r=t.indexOf(document.activeElement);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),t[(r+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()):e.key===`Tab`&&n()},children:(0,J.jsx)(Ke,{open:t,onClose:n,label:r,className:I(`w-[230px] text-left`,i===`right`?`right-0`:`left-0`,s.up?`top-auto bottom-1`:`top-1 bottom-auto`),children:a})}),document.body):null}function Ht(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(0);return[e,(0,q.useCallback)(e=>{e||(n.current=Date.now()),t(e)},[]),(0,q.useCallback)(()=>{Date.now()-n.current<300||t(e=>!e)},[])]}function Ut({r:e,onReview:t,onWrite:n,onDelete:r,onNote:i}){let[a,o,s]=Ht(),c=(0,q.useRef)(null),l=Qe(e.test),u=e=>()=>{o(!1),e()};return(0,J.jsxs)(`span`,{ref:c,className:`relative inline-block`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`More for ${e.name}`,"data-tip":`More for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":a,onClick:s,children:(0,J.jsx)(ne,{"aria-hidden":`true`})}),(0,J.jsxs)(Vt,{anchor:c.current,open:a,onClose:()=>o(!1),label:`More for ${e.name}`,align:`right`,children:[(e.kind===`web`&&e.ok||e.kind!==`web`&&e.workflow)&&(0,J.jsx)(G,{onClick:u(t),children:`Open the recording`}),e.kind!==`web`&&e.workflow&&(0,J.jsx)(G,{onClick:u(()=>At(e.workflow,e.kind===`mobile`?`mobile`:`desktop`).catch(e=>i(e.message))),children:`Replay`}),e.kind===`web`&&e.ok&&l.hasTest&&e.test?.testFile&&(0,J.jsx)(G,{onClick:u(()=>void $e(e.test.testFile).then(i)),children:`Open the test`}),e.kind===`web`&&e.ok&&!l.hasTest&&!l.writing&&(0,J.jsx)(G,{onClick:u(n),children:`Write the test`}),e.test?.chat&&(0,J.jsx)(G,{onClick:u(()=>location.hash=Ce(`chats`,e.test.chat)),children:`Open the chat`}),e.trace&&(0,J.jsx)(G,{onClick:u(()=>void V(e.trace).then(i)),children:`Read the steps`}),e.report&&(0,J.jsx)(G,{onClick:u(()=>void V(e.report).then(i)),children:`Open the report`}),(0,J.jsx)(G,{onClick:u(r),children:(0,J.jsx)(`span`,{className:`text-fail`,children:`Delete`})})]})]})}function Wt({r:e,onNote:t}){let n=Qe(e.test);return(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,onClick:e=>e.stopPropagation(),children:[e.kind===`web`&&e.ok&&(0,J.jsx)(`span`,{"data-tip":`${n.detail}${e.test?.testFile?` (${e.test.testFile})`:``}`,children:(0,J.jsx)(R,{tone:n.tone,icon:n.tone!==`neutral`,className:`min-h-5 px-2 text-[13px]`,children:n.label})}),n.hasTest&&e.test?.testFile&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the test of ${e.name}`,"data-tip":`Open ${e.test.testFile}`,onClick:async()=>t(await $e(e.test.testFile)),children:(0,J.jsx)(E,{"aria-hidden":`true`})}),(e.yaml||e.kind===`mobile`&&e.workflow)&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the workflow of ${e.name}`,"data-tip":`Open the YAML workflow`,onClick:async()=>t(await V(e.yaml||e.workflow)),children:(0,J.jsx)(se,{"aria-hidden":`true`})}),e.trace&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>t(await V(e.trace)),children:(0,J.jsx)(he,{"aria-hidden":`true`})}),e.report&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>t(await V(e.report)),children:(0,J.jsx)(de,{"aria-hidden":`true`})})]})}function Gt({rows:e,limit:t,onReview:n,onReviewDesktop:r,onDeleted:i,onChanged:a,onViewAll:o}){let s=t===void 0,[c,l]=(0,q.useState)(``),[d,f]=(0,q.useState)([]),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[v,y,b]=Ht(),x=(0,q.useRef)(null),[C,w]=(0,q.useState)(`any`),[T,E]=(0,q.useState)(``),[D,ee]=(0,q.useState)(`all`);(0,q.useEffect)(()=>f(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let te=async()=>{g(!0),l(``);try{let e=d.length;i(await P.deleteRecordings(d)),f([]),l(`Deleted ${F(e,`recording`)}.`)}catch(e){l(e.message)}finally{g(!1),m(!1)}},O=e=>e.kind===`web`&&Qe(e.test).hasTest,ne=D===`all`?e:e.filter(e=>e.kind===D),re=T.toLowerCase().split(/\s+/).filter(Boolean),ie=re.length?ne.filter(e=>re.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl} ${e.browser||``} ${e.test?.testFile||``} ${e.kind===`web`?Qe(e.test).label:``}`.toLowerCase().includes(t))):ne,k=C===`any`?ie:ie.filter(e=>e.kind===`web`&&C===`written`===O(e)),A=t?k.slice(0,t):k,oe=new Set(e.map(e=>e.kind)).size>1,se=C!==`any`||D!==`all`,ue=e=>{f([e]),m(!0)},de=e=>kt(e).then(()=>a(),e=>l(e.message)),fe=(0,J.jsxs)(`span`,{ref:x,className:`relative inline-block`,children:[(0,J.jsxs)(H,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":v,onClick:b,"data-tip":`Show only some recordings`,children:[`Filter`,se?` · on`:``,(0,J.jsx)(_,{"aria-hidden":`true`})]}),(0,J.jsxs)(Vt,{anchor:x.current,open:v,onClose:()=>y(!1),label:`Show only`,align:`left`,children:[[[`any`,`Any test`],[`written`,`Test written (${e.filter(O).length})`],[`none`,`No test yet (${e.filter(e=>e.kind===`web`&&!O(e)).length})`]].map(([e,t])=>(0,J.jsx)(qe,{role:`menuitemradio`,checked:C===e,onSelect:()=>w(e),children:(0,J.jsx)(`span`,{className:`flex-1`,children:t})},e)),oe&&[[`all`,`Every kind`],[`web`,`Web pages`],[`desktop`,`Desktop apps`],[`mobile`,`Mobile apps`]].map(([e,t],n)=>(0,J.jsx)(`span`,{className:I(`block`,n===0&&`mt-1 border-t border-line-soft pt-1`),children:(0,J.jsx)(qe,{role:`menuitemradio`,checked:D===e,onSelect:()=>ee(e),children:(0,J.jsx)(`span`,{className:`flex-1`,children:t})})},e))]})]});return(0,J.jsxs)(`section`,{"aria-labelledby":s?`rec-all`:`rec-recent`,className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h2`,{id:s?`rec-all`:`rec-recent`,className:`m-0 flex-1 text-base font-semibold`,children:[s?`All recordings`:`Recent recordings`,` `,(0,J.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:s?`(${k.length})`:k.length>A.length?`· latest ${A.length} of ${k.length}`:``})]}),s&&(0,J.jsxs)(H,{size:`sm`,variant:`danger`,disabled:!d.length||h,"data-tip":`Delete the selected recordings`,onClick:()=>m(!0),children:[(0,J.jsx)(le,{"aria-hidden":`true`}),`Delete`,d.length?` (${d.length})`:``]}),o&&(0,J.jsxs)(H,{size:`sm`,onClick:o,"data-tip":`Every recording, with search, filters and delete`,children:[`View all`,(0,J.jsx)(M,{"aria-hidden":`true`})]})]}),c&&(0,J.jsx)(`p`,{role:`status`,className:I(`m-0 text-[13px]`,c.startsWith(`Deleted`)?`text-muted`:`text-fail`),children:c}),(0,J.jsx)(Ue,{label:`Recordings`,resetKey:`${C}-${D}-${T}`,search:!1,size:t??25,tools:(0,J.jsxs)(J.Fragment,{children:[s&&(0,J.jsx)(xe,{id:`rec-search`,label:`Search recordings`,placeholder:`Search recordings`,value:T,onChange:E}),fe]}),empty:re.length||se?`Nothing matches.`:`No recordings yet.`,head:(0,J.jsxs)(J.Fragment,{children:[s&&(0,J.jsx)(`th`,{className:I(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-9`),children:(0,J.jsx)(K,{"aria-label":`Select all ${F(A.length,`recording`)}`,"data-tip":`Select all ${F(A.length,`recording`)} the search and filter keep`,checked:A.length>0&&A.every(e=>d.includes(e.runDir)),onCheckedChange:e=>f(e?[...new Set([...d,...A.map(e=>e.runDir)])]:d.filter(e=>!A.some(t=>t.runDir===e)))})}),(0,J.jsx)(`th`,{className:Ae,children:`Recording`}),(0,J.jsx)(`th`,{className:I(Ae,`hidden @3xl:table-cell`),children:`Test case`}),(0,J.jsx)(`th`,{className:I(Ae,`hidden @4xl:table-cell`),children:`Browser`}),(0,J.jsx)(`th`,{className:I(Pe,`hidden @4xl:table-cell`),children:`Duration`}),(0,J.jsx)(`th`,{className:I(Ae,`hidden @xl:table-cell`),children:`Outputs`}),(0,J.jsx)(`th`,{className:I(Ae,`hidden @2xl:table-cell`),children:`Created`}),(0,J.jsx)(`th`,{className:I(Ae,`w-10`),children:(0,J.jsx)(`span`,{className:`sr-only`,children:`More`})})]}),children:A.map(e=>{let t=e.kind!==`web`&&!!e.workflow,i=e.kind===`web`&&e.ok||t,a=()=>t?r(e.workflow):n(e.runDir);return(0,J.jsxs)(`tr`,{onClick:i?a:void 0,className:i?ke:Ie,children:[s&&(0,J.jsx)(`td`,{className:`px-4 py-2`,onClick:e=>e.stopPropagation(),children:(0,J.jsx)(K,{"aria-label":`Select ${e.name}`,checked:d.includes(e.runDir),onCheckedChange:t=>f(t?[...d,e.runDir]:d.filter(t=>t!==e.runDir))})}),(0,J.jsx)(`td`,{className:Oe,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[e.ok?e.kind===`desktop`?(0,J.jsx)(z,{icon:ce,size:16,className:`mt-1 flex-none text-muted`,label:`Desktop app`}):e.kind===`mobile`?(0,J.jsx)(z,{icon:S,size:16,className:`mt-1 flex-none text-muted`,label:`Mobile app`}):(0,J.jsx)(z,{icon:ae,size:16,className:`mt-1 flex-none text-muted`,label:`Web page`}):(0,J.jsx)(u,{size:16,"aria-label":`Not recorded`,className:`mt-1 flex-none text-fail`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[i?(0,J.jsx)(`a`,{href:t?Ce(`record`):Ze(e.runDir),onClick:e=>{e.stopPropagation(),(t||!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.button===0)&&(e.preventDefault(),a())},className:`truncate font-medium text-ink no-underline hover:underline`,"data-tip":e.name,children:e.name}):(0,J.jsx)(`span`,{className:`truncate font-medium text-ink`,"data-tip":e.name,children:e.name}),(0,J.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.kind===`web`?e.startUrl:e.app}),e.kind===`web`&&e.ok&&(0,J.jsx)(`span`,{className:`mt-1 @xl:hidden`,"data-tip":Qe(e.test).detail,children:(0,J.jsx)(R,{tone:Qe(e.test).tone,icon:Qe(e.test).tone!==`neutral`,className:`min-h-5 px-2 text-[13px]`,children:Qe(e.test).label})})]})]})}),(0,J.jsx)(`td`,{className:I(Oe,`hidden @3xl:table-cell`),children:e.caseId?(0,J.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.caseId}):(0,J.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,J.jsx)(`td`,{className:I(Oe,`hidden text-ink-2 @4xl:table-cell`),children:e.browser??(0,J.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,J.jsx)(`td`,{className:I(Fe,`hidden text-ink-2 @4xl:table-cell`),children:e.seconds===void 0?(0,J.jsx)(`span`,{className:`text-muted`,children:`—`}):zt(e.seconds)}),(0,J.jsx)(`td`,{className:I(Oe,`hidden @xl:table-cell`),children:(0,J.jsx)(Wt,{r:e,onNote:l})}),(0,J.jsx)(`td`,{className:I(Oe,`hidden whitespace-nowrap text-ink-2 @2xl:table-cell`),"data-tip":new Date(e.startedAt).toLocaleString(),children:Je(e.startedAt)}),(0,J.jsx)(`td`,{className:I(Oe,`text-right`),children:(0,J.jsx)(Ut,{r:e,onReview:a,onWrite:()=>void de(e.runDir),onDelete:()=>ue(e.runDir),onNote:l})})]},e.runDir)})}),p&&(0,J.jsx)(Ne,{open:!0,onClose:()=>m(!1),title:`Delete ${F(d.length,`recording`)}`,description:`Their steps, screenshots, tries and reports are removed from this computer. Tests already written from them stay.`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(H,{variant:`ghost`,disabled:h,onClick:()=>m(!1),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]}),(0,J.jsxs)(H,{variant:`destructive`,disabled:h,onClick:()=>void te(),children:[(0,J.jsx)(le,{"aria-hidden":`true`}),h?`Deleting…`:`Delete`]})]}),children:(0,J.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=>d.includes(e.runDir)).map(e=>(0,J.jsxs)(`li`,{className:`truncate`,children:[e.name,` `,(0,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Je(e.startedAt)]})]},e.runDir))})})]})}function Kt({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length)?null:(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-sm text-ink`,children:[(0,J.jsx)(`p`,{className:`m-0 font-semibold`,children:`Just recorded: worth knowing`}),t.secrets.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?`, `:``,(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.caseGaps.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.notes.map((e,t)=>(0,J.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.skipped.map((e,t)=>(0,J.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function qt({sub:t}={}){let[n,r]=(0,q.useState)(null),i=t?.startsWith(`recording/`)?It(t.slice(10)):null,[a,o]=(0,q.useState)(i);(0,q.useEffect)(()=>{i&&o(i)},[i]);let[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(`new`),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),g=(0,q.useCallback)(()=>{P.get().then(e=>{r(e),p(``)},e=>p(e.message))},[]);(0,q.useEffect)(g,[g]);let _=!!n?.session&&Dt.has(n.session.state);(0,q.useEffect)(()=>{if(!_)return;let e=setInterval(g,800);return()=>clearInterval(e)},[_,g]);let v=!!n?.recordings.some(e=>e.test?.state===`writing`||e.test?.state===`checking`);(0,q.useEffect)(()=>{if(!v||_)return;let e=setInterval(g,4e3);return()=>clearInterval(e)},[v,_,g]);let y=(0,q.useRef)(!1),b=n?.session;(0,q.useEffect)(()=>{_?y.current=!0:y.current&&b&&(y.current=!1,b.result?.ok&&b.kind===`web`&&o(b.runDir),b.result?.ok&&b.kind!==`web`&&b.result.workflow&&c(b.result.workflow))},[_,b]);let x=async e=>{h(!0),p(``);try{r(await e())}catch(e){p(e.message)}finally{h(!1)}},S=(e,t)=>{o(null),window.scrollTo({top:0,behavior:`smooth`}),x(()=>P.start({more:{run:e,after:t}}))},C=e=>{o(e),window.scrollTo({top:0})},w=!!b?.result&&!b.result.ok,T=!!a||!!s,E=e=>{c(e),window.scrollTo({top:0})};return(0,J.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,J.jsx)(ze,{}),(0,J.jsxs)(`main`,{className:I(Be,`@container flex-auto gap-4`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(Ve,{pixel:He.record,size:`lg`}),(0,J.jsx)(`h1`,{className:`m-0 flex-1 text-[25px] font-semibold tracking-[-0.01em]`,children:`Record`}),n&&!_&&!T&&(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`Record`,className:`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`new`,`New recording`,f],[`recordings`,`Recordings${n.recordings.length?` (${n.recordings.length})`:``}`,e]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,id:`rec-tab-${e}`,"aria-selected":l===e,"aria-controls":`rec-panel`,tabIndex:l===e?0:-1,onClick:()=>u(e),onKeyDown:t=>{if(t.key!==`ArrowRight`&&t.key!==`ArrowLeft`)return;let n=e===`new`?`recordings`:`new`;u(n),document.getElementById(`rec-tab-${n}`)?.focus()},className:Ye(l===e),children:[(0,J.jsx)(n,{size:14,"aria-hidden":`true`}),t]},e))})]}),!T&&(0,J.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`Do a test's steps yourself in a browser, a Windows app or a mobile app ForgeQE opens; each click, entry and choice is recorded in order, and you choose the checks after.`}),d&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}),!n&&!d&&(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&b&&_&&(0,J.jsx)(Pt,{s:b,busy:m,secrets:n.mobile.secrets,send:e=>void x(()=>P.command(e))}),n&&!_&&a&&(0,J.jsx)(ut,{runDir:a,notices:b&&b.runDir===a?(0,J.jsx)(Kt,{s:b}):void 0,onRecordMore:e=>S(a,e),onClose:()=>{o(null),u(`recordings`),i&&(location.hash=Ce(`record`)),g()}},a),n&&!_&&s&&(0,J.jsx)(nt,{workflow:s,backLabel:`Recordings`,notices:b&&b.kind===`desktop`&&b.result?.workflow===s?(0,J.jsx)(Kt,{s:b}):void 0,onClose:()=>{c(null),u(`recordings`),g()}},s),n&&!_&&!T&&(0,J.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel`,"aria-labelledby":`rec-tab-${l}`,className:`flex min-w-0 flex-col gap-4`,children:[l===`new`&&(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsx)(Ft,{s:b}),b?.result?.ok&&(b.kind===`web`||!!b.result.workflow)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-[12px] card border px-4 py-4 text-sm`,children:[(0,J.jsx)(k,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:b.name}),(0,J.jsxs)(`span`,{className:`text-muted`,children:[` · `,F(b.steps.length,`step`)]})]}),(0,J.jsxs)(H,{size:`sm`,onClick:()=>b.kind===`desktop`?E(b.result.workflow):C(b.runDir),"data-tip":`Open the recording`,children:[(0,J.jsx)(ie,{"aria-hidden":`true`}),`Open`]})]}),(0,J.jsx)(Q,{view:n}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-[999_1_560px]`,children:(0,J.jsx)(Rt,{view:n,busy:m,start:t,onStart:e=>void x(()=>P.start(e))})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-[1_1_260px]`,children:(0,J.jsx)(Bt,{})})]}),n.recordings.length>0&&(0,J.jsx)(Gt,{rows:n.recordings,limit:Z,onReview:C,onReviewDesktop:E,onDeleted:r,onChanged:g,onViewAll:()=>u(`recordings`)})]}),l===`recordings`&&(n.recordings.length?(0,J.jsx)(Gt,{rows:n.recordings,onReview:C,onReviewDesktop:E,onDeleted:r,onChanged:g}):(0,J.jsx)(Se,{className:`py-4`,action:(0,J.jsxs)(H,{size:`sm`,onClick:()=>u(`new`),"data-tip":`New recording`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),children:`No recordings yet.`}))]})]})]})}export{qt as Record,Lt as givenStart};
1
+ import{$t as e,C as t,Cr as n,D as r,E as i,En as a,F as o,Ft as s,In as c,It as l,L as u,Lr as d,N as f,Nn as p,On as m,Pr as h,Qn as g,T as _,Tn as v,Tr as y,Vn as b,Wt as x,Xn as S,_n as C,_r as w,a as T,ct as E,d as D,er as ee,et as te,fr as O,gn as ne,i as re,it as ie,j as k,jn as A,jr as j,jt as ae,kn as oe,kr as se,mn as ce,mr as le,o as M,or as ue,ot as de,pn as fe,pt as N,rr as pe,s as me,tn as he,vr as ge,yr as _e}from"./line-icons-DBwNPSmu.js";import{Ft as P,H as F,V as I,a as L,c as R,ct as ve,en as ye,g as z,h as be,i as xe,l as Se,o as B,p as Ce,pt as we,s as Te,t as Ee,tn as De,u as V,z as H}from"./filters-Bj5K1WaL.js";import{At as Oe,B as ke,G as Ae,H as je,J as Me,K as Ne,U as Pe,V as Fe,W as Ie,jt as Le,ln as U,lt as Re,q as ze,r as Be,t as Ve,tt as He,ut as W,z as Ue}from"./frame-B428t9gN.js";import{n as We,r as Ge}from"./markdown-6z0km3hN.js";import{D as Ke,O as G,k as qe,r as Je,s as K}from"./index-BtYlZE0c.js";import{i as Ye,r as Xe}from"./segmented-DphDskQz.js";import{n as Ze,r as Qe,t as $e}from"./recordTest-EkxSMWbe.js";import{n as et,r as tt,t as nt}from"./DesktopReview-CGDj4Ujf.js";var rt=d(De(),1),q=d(h(),1),J=ye(),it=e=>new Promise(t=>setTimeout(t,e));function at({id:e,onEnd:n,label:r=`The agent at work`,done:i=`Done.`,failed:a=`It could not finish.`}){let[o,s]=(0,q.useState)([]),[c,l]=(0,q.useState)(`starting`);(0,q.useEffect)(()=>{let t=!1,n=0,r=[];return(async()=>{for(;!t;)try{let i=await ve.events(e,n,!0);if(t||(i.events.length&&(r.push(...i.events),n=i.events.at(-1).n,s([...r])),l(i.state),i.state===`closed`||i.state===`failed`))return}catch{await it(2e3)}})(),()=>{t=!0}},[e]);let u=W(o),d=u.turns.at(-1),f=!!d?.outcome||c===`failed`||c===`closed`,p=d&&!f?Re(d):null,m=d?.outcome===`done`,h=f&&!m&&(d?.error||u.fatal||u.ended?.message)||``;return(0,q.useEffect)(()=>{f&&n?.()},[f]),(0,J.jsxs)(`section`,{"aria-label":r,className:`flex flex-col gap-2 border-t border-line-soft pt-4 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p||!f?(0,J.jsx)(be,{state:p?.orb??`thinking`,px:16}):m?(0,J.jsx)(t,{size:16,"aria-hidden":`true`,className:`text-pass`}):(0,J.jsx)(j,{size:16,"aria-hidden":`true`,className:`text-fail`}),(0,J.jsx)(`span`,{className:I(`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,f&&!m&&`text-fail`),children:p?p.text:f?m?i:d?.outcome===`stopped`?`It was stopped.`:a:`Starting…`}),(0,J.jsx)(`a`,{href:Ce(`chats`,e),className:`text-[13px]`,children:`Open the chat`})]}),h&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:h.split(`
2
+ `).slice(0,3).join(` `)}),d&&d.steps.length>0&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-muted`,children:d.steps.slice(-6).map(e=>(0,J.jsxs)(`li`,{className:I(`[overflow-wrap:anywhere]`,e.status===`fail`&&`text-fail`),children:[e.status===`running`?`… `:e.status===`fail`?`✗ `:`✓ `,e.label,e.arg?`: ${e.arg}`:``]},e.key))}),d&&d.changes.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-[13px] [overflow-wrap:anywhere]`,children:[`Changed: `,d.changes.map(e=>`${e.path} (+${e.added} −${e.removed})`).join(`, `)]}),d&&d.asks.some(e=>e.answer===void 0)&&(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`It is asking something: `,(0,J.jsx)(`a`,{href:Ce(`chats`,e),children:`answer it in the chat`}),`.`]}),d?.reply&&f&&(0,J.jsx)(Ge,{text:d.reply,className:`text-[13px]`})]})}var ot={test_id:`Its test id`,id:`Its id`,role:`What it is and its name`,role_pattern:`What it is and part of its name`,name:`Its name attribute`,label:`Its label`,placeholder:`Its placeholder`,alt:`Its alt text`,href:`Where it links to`,title:`Its title`,text:`Its text`,text_pattern:`Part of its text`,css:`Its tag and class`,within:`The card or row it sits in`,xpath:`Its place in the page`},st={generated:{found:`a value the page's framework made, which is different on the next load`,alone:`It is a value the page's framework made, so it is different on the next load.`},live_data:{found:`data that changes between runs (a price, a date, an order number)`,alone:`It holds data that changes between runs (a price, a date, an order number).`},varies:{found:`a value the page gave this element only on that load`,alone:`The page gave this element another value when the recording loaded the same page again.`}},ct=e=>`${ot[e.type]||e.type}: ${e.value}`,lt=[{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 ut({runDir:e,onClose:n,onRecordMore:r,notices:i}){let[l,u]=(0,q.useState)(null),[d,p]=(0,q.useState)(``),[h,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`steps`),[S,C]=(0,q.useState)(``),[te,O]=(0,q.useState)(!1),[ne,re]=(0,q.useState)(null),[ae,oe]=(0,q.useState)(null),[se,ce]=(0,q.useState)(null),[M,ue]=(0,q.useState)(new Set),de=e=>ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[N,me]=(0,q.useState)({}),he=e=>N[e.n]??(!e.ok&&!e.skipped),[ge,_e]=(0,q.useState)(null),[ve,ye]=(0,q.useState)(``),[be,Ce]=(0,q.useState)(`all`),[we,De]=(0,q.useState)(null),[V,Oe]=(0,q.useState)(!1),[ke,Ae]=(0,q.useState)(``),[je,Me]=(0,q.useState)(``),[Ne,Pe]=(0,q.useState)([]),[Fe,Ie]=(0,q.useState)(void 0),[U,Re]=(0,q.useState)({from:0,to:0,name:``}),[ze,Be]=(0,q.useState)({block:``,after:0}),[Ve,He]=(0,q.useState)(``),[W,Ue]=(0,q.useState)(null),[We,Ge]=(0,q.useState)(``),[G,qe]=(0,q.useState)({}),[K,Ze]=(0,q.useState)(``),[et,tt]=(0,q.useState)(``),[nt,rt]=(0,q.useState)(null),[it,ot]=(0,q.useState)(!1),[ct,ut]=(0,q.useState)(!1),[yt,bt]=(0,q.useState)(``),[xt,St]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let t=!1;return P.review(e).then(e=>{t||(u(e),C(e.name),Me(e.instructions))},e=>!t&&p(e.message)),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{P.blocks().then(e=>{Pe(e.blocks),Ie(e.shared)},()=>Pe([]))},[]),(0,q.useEffect)(()=>{let t=!1;return P.tryView(e).then(e=>{t||(Ue(e),qe(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]??e.value]))))},()=>{}),()=>{t=!0}},[e,l]);let Ct=()=>P.review(e).then(e=>u(t=>t&&{...t,test:e.test}),()=>{}),Et=l?.test?.state===`writing`||l?.test?.state===`checking`;(0,q.useEffect)(()=>{if(!Et)return;let e=setInterval(()=>void Ct(),2500);return()=>clearInterval(e)},[Et,e]);let Y=W?.running===e,Dt=W?.result?`${W.result.ms??0}-${W.result.env??``}-${W.result.steps.length}-${W.result.ok}`:``;(0,q.useEffect)(()=>me({}),[Dt]),(0,q.useEffect)(()=>{if(!Y)return;let t=setInterval(()=>{P.tryView(e).then(Ue,()=>{})},1500);return()=>clearInterval(t)},[Y,e]);let Ot=()=>K.startsWith(`file:`)?{file:K.slice(5),...et.trim()&&/\.xls[xm]$/i.test(K)?{sheet:et.trim()}:{}}:K.startsWith(`request:`)?{request:K.slice(8)}:void 0,kt=async t=>{p(``),ot(!0);try{let n=await P.write(e,{check:t,env:We,data:G,each:Ot()});u(e=>e&&{...e,test:n.test}),Ue(n.try),t&&rt(l)}catch(e){p(e.message)}finally{ot(!1)}},At=async()=>{p(``);try{let t=await P.tryRun(e,We,G,Ot());rt(l),Ue(t)}catch(e){p(e.message)}},jt=async()=>{p(``);try{Ue(await P.tryStop(e)),Ct()}catch(e){p(e.message)}},Mt=async()=>{p(``),St(!0);try{let t=await P.stopWrite(e);u(e=>e&&{...e,test:t.test})}catch(e){p(e.message)}finally{St(!1)}},Nt=async()=>{v(!0),p(``),He(``);try{let t=await P.saveBlock(e,U.name.trim(),U.from,U.to);Pe(t.blocks),He(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.`),Re({...U,name:``})}catch(e){p(e.message)}finally{v(!1)}},X=async t=>{v(!0),p(``);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);u(n),C(n.name),Me(n.instructions)}catch(e){p(e.message)}finally{v(!1)}},Pt=async()=>{Oe(!0),Ae(``);try{let t=await P.suggest(e);De(t.picks),Ae(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Ae(e.message)}finally{Oe(!1)}},Ft=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},It=async e=>{for(let t of e)await X(Ft(t));De(t=>(t||[]).filter(t=>!e.includes(t)))};if(!l)return d?(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:d}):(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Reading the recording…`});let Lt=l.steps.filter(e=>e.value),Rt=l.steps.filter(e=>e.op===`expect`).length,Z=Y?void 0:W?.result,zt=new Map((Z?.steps??[]).map(e=>[e.n-1,e])),Q=Z?.steps.find(e=>!e.ok),Bt=Q?Q.n-1:-1,Vt=Bt>=0?l.steps[Bt]:void 0,Ht=!!Z&&!!nt&&nt!==l,Ut=(Z?.steps??[]).filter(e=>!e.ok).length,Wt=ve.toLowerCase().split(/\s+/).filter(Boolean),Gt=l.steps.filter(e=>Wt.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(be===`all`||(be===`checks`?e.op===`expect`:zt.get(e.index)?.ok===!1))),Kt=e=>{x(`steps`),Ce(`all`),ye(``),requestAnimationFrame(()=>document.getElementById(`step-${e}`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},qt=!!W?.running&&!Y,$=Qe(l.test),Jt=()=>void kt(!(Z?.ok&&nt===l)),Yt=Y&&!!W?.stopping,Xt=it||$.writing,Zt=[{id:`steps`,label:`Steps`,n:l.steps.length},{id:`data`,label:`Test data`,n:Lt.length},{id:`run`,label:`Runs`,...W?.runs?.length?{n:W.runs.length}:{}},{id:`instructions`,label:`Instructions`},{id:`blocks`,label:`Blocks`},{id:`history`,label:`Versions`,n:l.history.length}];return(0,J.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-4 border-b border-line bg-bg px-1 py-4`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:n&&(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,onClick:n,className:`-ml-2 text-ink-2`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Recordings`]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[te?(0,J.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),O(!1),S.trim()&&S.trim()!==l.name&&X({name:S.trim()})},children:[(0,J.jsx)(L,{"aria-label":`Name of the recording`,value:S,maxLength:200,autoFocus:!0,onChange:e=>C(e.target.value),className:`min-w-0 flex-1`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Save`]}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,onClick:()=>{C(l.name),O(!1)},children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]})]}):(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,J.jsx)(`h2`,{id:`review-title`,className:`m-0 min-w-0 truncate text-lg font-semibold`,"data-tip":l.name,children:l.name}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>O(!0),className:`size-8 flex-none`,children:(0,J.jsx)(a,{"aria-hidden":`true`})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,J.jsxs)(`span`,{children:[F(l.steps.length,`step`),` · `,F(Rt,`check`)]}),Y?(0,J.jsx)(R,{tone:`running`,children:Yt?`Stopping…`:`Running the steps…`}):Z?.stopped?(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Last run stopped`}):Z?(0,J.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,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Not run yet`}),Ht&&(0,J.jsx)(`span`,{children:`· you changed it since`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[13px]`,"aria-label":`The test written from this recording`,children:[(0,J.jsx)(R,{tone:$.tone,icon:$.tone!==`neutral`,children:$.label}),l.test?.testFile&&$.hasTest&&(0,J.jsxs)(`button`,{type:`button`,onClick:async()=>bt(await $e(l.test.testFile)),"data-tip":`Open ${l.test.testFile}${l.test.repo?` in ${l.test.repo}`:``}`,className:`inline-flex min-w-0 cursor-pointer items-center gap-1 border-0 bg-transparent p-0 font-mono text-[13px] text-accent-fg hover:text-accent-fg-hover`,children:[(0,J.jsx)(E,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,J.jsx)(`span`,{className:`truncate`,children:l.test.testFile})]}),l.test&&!$.writing&&(0,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Je(l.test.at)]}),(0,J.jsx)(`span`,{className:`basis-full text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:$.detail}),yt&&(0,J.jsx)(`span`,{className:`basis-full text-[13px] text-fail [overflow-wrap:anywhere]`,children:yt})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Y?(0,J.jsxs)(H,{variant:`destructive`,disabled:Yt,onClick:()=>void jt(),"data-tip":`Stop the run and close its browser`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),Yt?`Stopping…`:`Stop`]}):(0,J.jsxs)(H,{disabled:qt||Xt,onClick:()=>void At(),"data-tip":qt?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,J.jsx)(m,{"aria-hidden":`true`}),`Re-run`]}),l.test?.state===`writing`?(0,J.jsxs)(H,{variant:`destructive`,disabled:xt,onClick:()=>void Mt(),"data-tip":`Stop the Coding agent: what it changed so far is kept, and Write carries on from there`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),xt?`Stopping…`:`Stop writing`]}):(0,J.jsxs)(H,{variant:$.hasTest&&!$.writing?`outline`:`primary`,disabled:h||Y||qt||Xt||$.writing,onClick:()=>$.hasTest?ut(!0):Jt(),"data-tip":$.writing?`A test is being written from this recording`:$.hasTest?`Update ${l.test?.testFile}: the steps are run first; when they work, the Coding agent changes that test to match the recording`:`Write the test: the steps are run first; when they work, the Coding agent writes the test in your repository's style`,children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),l.test?.state===`checking`?`Checking…`:it||$.writing?$.hasTest?`Updating…`:`Writing…`:$.hasTest?`Update the test`:`Write the test`]})]})]})]}),i,d&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}),Z&&!Z.ok&&(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 rounded-[12px] border border-fail/30 bg-fail-soft px-4 py-4 text-sm`,children:[(0,J.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}`:``}`,Ht&&(0,J.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),Vt&&(0,J.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:Vt.line}),(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Vt&&(0,J.jsxs)(H,{size:`sm`,onClick:()=>Kt(Bt),"data-tip":`Show the failed step`,children:[(0,J.jsx)(ie,{"aria-hidden":`true`}),`Show`]}),Vt&&r&&Bt>0&&(0,J.jsxs)(H,{size:`sm`,onClick:()=>r(Bt),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),Vt&&!Vt.fixed&&(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void X({remove:[Bt]}),"data-tip":`Drop the failed step`,children:[(0,J.jsx)(le,{"aria-hidden":`true`}),`Remove`]}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,disabled:Xt,onClick:()=>void kt(!1),"data-tip":`Write the test anyway`,children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),`Write`]})]})]}),l.test?.chat&&(0,J.jsx)(at,{id:l.test.chat,onEnd:()=>void Ct(),label:$.hasTest?`The Coding agent updating the test`:`The Coding agent writing the test`,done:$.hasTest?`The test is updated.`:`The test is written.`,failed:$.hasTest?`The test could not be updated.`:`The test could not be written.`},l.test.chat),ct&&l.test?.testFile&&(0,J.jsx)(Le,{open:!0,onClose:()=>ut(!1),title:`Update the test?`,description:`A test was already written from this recording: ${l.test.testFile}. The Coding agent updates that test so it matches the recording as it is now. No second test is added.`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(H,{variant:`ghost`,onClick:()=>ut(!1),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]}),(0,J.jsxs)(H,{variant:`primary`,onClick:()=>{ut(!1),Jt()},children:[(0,J.jsx)(pe,{"aria-hidden":`true`}),`Update the test`]})]}),children:(0,J.jsx)(`p`,{className:`m-0 pt-4 text-sm text-ink-2`,children:`The steps are played first; the test is changed only when they work.`})}),l.blocksFound?.map(e=>(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[12px] bg-accent-soft px-4 py-2 text-sm text-ink`,children:[(0,J.jsx)(z,{icon:D,size:16,className:`flex-none`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:e.name}),`: the test can call its helper instead.`]}),(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void X({useBlock:{block:e.block,from:e.from}}),"data-tip":`Use the block: the test calls its helper instead`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Use`]})]},`${e.block}-${e.from}`)),(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`This recording`,className:Xe,children:Zt.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,id:`rev-tab-${e.id}`,"aria-selected":b===e.id,"aria-controls":`rev-panel-${e.id}`,onClick:()=>x(e.id),className:Ye(b===e.id),children:[e.label,e.n!==void 0&&(0,J.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:e.n}),e.id===`run`&&Z&&(0,J.jsx)(`span`,{"aria-label":Z.ok?`passed`:`failed`,className:I(`size-2 rounded-full`,Z.ok?`bg-pass`:`bg-fail`)})]},e.id))}),(0,J.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${b}`,"aria-labelledby":`rev-tab-${b}`,className:`flex min-w-0 flex-col gap-4`,children:[b===`steps`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(xe,{id:`rev-step-search`,label:`Find a step`,value:ve,onChange:ye}),(0,J.jsx)(Ee,{items:[{id:`all`,label:`All`,n:l.steps.length},{id:`checks`,label:`Checks`,n:Rt},...Ut?[{id:`failed`,label:`Failed`,n:Ut,alert:!0}]:[]],value:be,onChange:Ce}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsxs)(H,{size:`sm`,variant:`ghost`,disabled:V||h,onClick:()=>void Pt(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,J.jsx)(y,{"aria-hidden":`true`}),V?`Asking…`:`Suggest`]})]}),(l.videos?.includes(`recording`)||l.log)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.videos?.includes(`recording`)&&(0,J.jsx)(ft,{runDir:e,kind:`recording`}),l.log&&(0,J.jsx)(pt,{runDir:e,which:`recording`,label:`Recording log`})]}),ke&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:ke}),we&&we.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-accent-line bg-accent-soft px-4 py-2 text-ink`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{icon:g,size:14}),(0,J.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,J.jsxs)(H,{size:`sm`,disabled:h,onClick:()=>void It(we),"data-tip":`Add all the suggestions`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add all`]}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>De(null),className:`size-8`,children:(0,J.jsx)(j,{"aria-hidden":`true`})})]}),(0,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:we.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]`,children:[(0,J.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,J.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void It([e]),className:`size-8`,children:(0,J.jsx)(A,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),Gt.length===0?(0,J.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-4 text-sm text-muted`,children:`No step matches.`}):(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:Gt.map((n,i)=>{let s=zt.get(n.index),c=n.op===`expect`;return(0,J.jsxs)(`li`,{id:`step-${n.index}`,className:I(`flex scroll-mt-48 flex-col`,i>0&&`border-t border-line-soft`,s&&!s.ok&&`bg-fail-soft`),children:[(0,J.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-4 px-4 py-2`,children:[(0,J.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right font-mono text-[13px] text-muted tabular-nums`,children:n.index+1}),(0,J.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:s?s.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):s.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):c?(0,J.jsx)(k,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[c&&(0,J.jsx)(R,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-[13px]`,children:`Check`}),(0,J.jsx)(`span`,{className:`min-w-0 text-[13px] text-ink [overflow-wrap:anywhere]`,children:n.line}),n.block&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-px text-[13px] text-ink-2`,children:[(0,J.jsx)(z,{icon:D,size:11}),Ne.find(e=>e.id===n.block)?.name||n.block]})]}),n.note&&(0,J.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Note: `,n.note]}),(e=>{if(!e?.risk)return null;let t=(n.locators?.length??0)>1&&!!n.detail?.length,r=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(z,{icon:w,size:12,className:`mt-px flex-none`}),(0,J.jsxs)(`span`,{children:[`This step is found by `,st[e.risk].found,`.`,t?` Pick another way to find it.`:``]})]});return t?(0,J.jsx)(`button`,{type:`button`,"aria-expanded":M.has(n.index),onClick:()=>de(n.index),className:`inline-flex cursor-pointer items-start gap-1 self-start border-0 bg-transparent p-0 text-left text-[13px] text-warn hover:underline`,children:r}):(0,J.jsx)(`span`,{className:`inline-flex items-start gap-1 self-start text-[13px] text-warn`,children:r})})(n.locators?.find(e=>e.chosen)),s&&!s.ok&&s.error&&(0,J.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-fail [overflow-wrap:anywhere]`,"data-tip":s.error,children:s.error}),n.suggest&&n.suggest.length>0&&(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":ge===n.index,onClick:()=>_e(ge===n.index?null:n.index),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-accent-fg hover:text-accent-fg-hover`,children:[(0,J.jsx)(z,{icon:g,size:12}),ge===n.index?`Hide the suggested checks`:`${F(n.suggest.length,`suggested check`)}`]})]}),(0,J.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-haspopup":`menu`,"aria-expanded":ne===n.index,"aria-label":`Add a check, step or note after step ${n.index+1}`,"data-tip":`Add a check, step or note after step ${n.index+1}`,onClick:()=>re(ne===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(A,{"aria-hidden":`true`})}),(0,J.jsx)(Ke,{open:ne===n.index,onClose:()=>re(null),label:`Add after step ${n.index+1}`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,J.jsx)(Tt,{step:n,...r?{onRecordMore:()=>{re(null),r(n.index)}}:{},onAdd:e=>{re(null),X(e)}})}),n.check&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-haspopup":`dialog`,"aria-expanded":se===n.index,"aria-label":`Change how check ${n.index+1} compares`,"data-tip":`Change how check ${n.index+1} compares`,onClick:()=>ce(se===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(a,{"aria-hidden":`true`})}),(0,J.jsx)(Ke,{open:se===n.index,onClose:()=>ce(null),label:`How check ${n.index+1} compares`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,J.jsx)(wt,{check:n.check,onSave:e=>{ce(null),X({matches:[{index:n.index,...e}]})}})})]}),n.detail&&n.detail.length>0&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`What was recorded for step ${n.index+1}`,"aria-expanded":M.has(n.index),"data-tip":`What was recorded for step ${n.index+1}`,onClick:()=>de(n.index),className:`size-8`,children:(0,J.jsx)(_,{"aria-hidden":`true`,className:I(`transition-transform`,M.has(n.index)&&`rotate-180`)})}),n.shot&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${n.index+1}`,"aria-expanded":ae===n.index,"data-tip":`See the page after step ${n.index+1}`,onClick:()=>oe(ae===n.index?null:n.index),className:`size-8`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})}),!n.fixed&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"aria-label":`Drop step ${n.index+1}`,"data-tip":`Drop step ${n.index+1}`,onClick:()=>void X({remove:[n.index]}),className:`size-8`,children:(0,J.jsx)(le,{"aria-hidden":`true`})})]})]}),ge===n.index&&n.suggest&&n.suggest.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pr-4 pb-2 pl-4 sm:pl-20`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Add a check that`}),n.suggest.map(e=>(0,J.jsxs)(H,{size:`sm`,disabled:h,"data-tip":`Add this check after the step`,onClick:()=>void X({checks:[{after:n.index,kind:e.kind,text:e.text,...e.frame===void 0?{}:{frame:e.frame}}]}),className:`h-7 min-h-7 max-w-full rounded-full px-2 text-[13px]`,children:[(0,J.jsx)(o,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),M.has(n.index)&&n.detail&&(0,J.jsx)(_t,{rows:n.detail,n:n.index+1,locators:n.locators,busy:h,onPick:e=>void X({locator:[{index:n.index,pick:e}]})}),ae===n.index&&n.shot&&n.snap&&(0,J.jsx)(vt,{runDir:e,step:n,busy:h,onPick:(e,t,r)=>void X({checks:[{after:n.index,kind:e,text:t,...r===void 0?{}:{frame:r}}]})})]},`${n.index}-${n.line}`)})})]}),b===`data`&&(Lt.length===0?(0,J.jsx)(Se,{className:`py-4`,children:`Nothing was typed or chosen in this recording, so it has no test data.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.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,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:Lt.map((e,t)=>{let n=e.value,r=lt.filter(t=>e.op!==`select`||t.id===`typed`||t.id===`data`);return(0,J.jsxs)(`li`,{className:I(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.index+1}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:lt.find(e=>e.id===n.as)?.note})]}),(0,J.jsx)(B,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:h,onChange:t=>void X({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:r.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.label},e.id))})]},e.index)})})]})),b===`run`&&W&&(0,J.jsxs)(J.Fragment,{children:[(0,J.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,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-4 rounded-[12px] card border p-4`,onSubmit:e=>{e.preventDefault(),At()},children:[W.environments.length>0&&(0,J.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Environment`,(0,J.jsxs)(B,{value:We,onChange:e=>Ge(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`Where it was recorded`}),W.environments.map(e=>(0,J.jsxs)(`option`,{value:e,children:[e,e===W.environment?` (active)`:``]},e))]})]}),W.data.length>0&&!!(W.sources?.files.length||W.sources?.requests.length)&&(0,J.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Test data`,(0,J.jsxs)(B,{value:K,onChange:e=>Ze(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`The values typed here`}),!!W.sources?.files.length&&(0,J.jsx)(`optgroup`,{label:`Each row of a data file`,children:W.sources.files.map(e=>(0,J.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!W.sources?.requests.length&&(0,J.jsx)(`optgroup`,{label:`Each row of a kept request`,children:W.sources.requests.map(e=>(0,J.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(K)&&(0,J.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Sheet`,(0,J.jsx)(L,{value:et,maxLength:100,placeholder:`The first sheet`,onChange:e=>tt(e.target.value)})]}),!K&&W.data.map(e=>(0,J.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[e.name,(0,J.jsx)(L,{value:G[e.name]??``,maxLength:300,onChange:t=>qe({...G,[e.name]:t.target.value})})]},e.name)),(0,J.jsxs)(H,{type:`submit`,disabled:Y||qt||Xt,"data-tip":qt?`Another run is going`:void 0,children:[(0,J.jsx)(m,{"aria-hidden":`true`}),Y?`Running…`:`Re-run`]})]}),K&&(0,J.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 (`,W.data.map(e=>e.name).join(`, `),`) gives its value; other columns are left out.`]}),Y&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(R,{tone:`running`,children:Yt?`Stopping: closing the browser…`:`Playing the steps in a new browser…`}),(0,J.jsxs)(H,{variant:`destructive`,disabled:Yt,onClick:()=>void jt(),"data-tip":`Stop the run and close its browser`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),Yt?`Stopping…`:`Stop`]})]}),!Y&&!Z&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Not run yet.`}),Z&&(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`p`,{className:I(`m-0 text-sm font-semibold [overflow-wrap:anywhere]`,Z.ok?`text-pass`:Z.stopped?`text-ink-2`:`text-fail`),children:Z.stopped?Z.rows?`Stopped after ${F(Z.rows.length,`row`)}${Z.env?` on ${Z.env}`:``}.`:`Stopped after ${F(Z.steps.filter(e=>!e.skipped).length,`step`)}${Z.env?` on ${Z.env}`:``}.`: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,J.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-[13px]`,children:Z.rows.map((e,n)=>(0,J.jsxs)(`li`,{className:I(`flex items-start gap-2 px-4 py-2`,n>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.label||`Row ${e.n}`}),!e.ok&&e.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))}),Z.steps.length>0&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:Z.steps.map((n,r)=>(0,J.jsxs)(`li`,{className:I(`flex flex-col`,r>0&&`border-t border-line-soft`,!n.ok&&`bg-fail-soft`),children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2 px-4 py-2`,children:[n.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):n.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:n.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[n.action,n.skipped?(0,J.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!n.ok&&n.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:n.error})]}),(0,J.jsx)(`span`,{className:`flex-1`}),n.shot&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${n.n} of the run`,"aria-expanded":he(n),"data-tip":`See the page after step ${n.n} of the run`,onClick:()=>me({...N,[n.n]:!he(n)}),className:`size-8 flex-none`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})})]}),n.shot&&he(n)&&(0,J.jsx)(gt,{runDir:e,n:n.n,failed:!n.ok},`${Z.ms??0}-${n.n}`)]},n.n))})]}),Z&&(Z.video||Z.trace||Z.network||W.runs?.[0]?.log)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Z.video&&(0,J.jsx)(ft,{runDir:e,kind:`try`}),W.runs?.[0]?.log&&(0,J.jsx)(pt,{runDir:e,which:W.runs[0].log,label:`Re-run log`}),Z.trace&&(0,J.jsx)(ht,{runDir:e}),Z.network&&(0,J.jsx)(mt,{runDir:e})]}),(W.runs?.length??0)>1&&(0,J.jsx)(dt,{runDir:e,runs:W.runs.slice(1)})]}),b===`instructions`&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-semibold text-ink`,children:[`Instructions for the Coding agent`,(0,J.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,J.jsx)(Te,{value:je,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>Me(e.target.value),onBlur:()=>je.trim()!==l.instructions&&void X({instructions:je.trim()}),className:`font-normal`})]}),b===`blocks`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.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.`}),Fe===!0&&(0,J.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.`}),Fe===!1&&(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-4 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,J.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,J.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),U.name.trim()&&Nt()},children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Keep steps`,(0,J.jsx)(B,{"aria-label":`The first step of the block`,value:U.from,onChange:e=>Re({...U,from:Number(e.target.value),to:Math.max(U.to,Number(e.target.value))}),className:`w-[84px]`,children:l.steps.map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`to`,(0,J.jsx)(B,{"aria-label":`The last step of the block`,value:U.to,onChange:e=>Re({...U,to:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.filter(e=>e.index>=U.from).map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.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,J.jsx)(L,{value:U.name,maxLength:80,placeholder:`Sign in`,onChange:e=>Re({...U,name:e.target.value})})]}),(0,J.jsxs)(H,{type:`submit`,disabled:h||!U.name.trim(),"data-tip":`Keep as a block`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Keep`]})]}),Ve&&(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:Ve}),Ne.length>0&&(0,J.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 border-t border-line-soft pt-4`,onSubmit:e=>{e.preventDefault();let t=ze.block||Ne[0].id;X({insert:{after:ze.after,block:t}})},children:[(0,J.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,J.jsx)(B,{"aria-label":`The block to put in`,value:ze.block||Ne[0].id,onChange:e=>Be({...ze,block:e.target.value}),children:Ne.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`after step`,(0,J.jsx)(B,{"aria-label":`The step the block goes after`,value:ze.after,onChange:e=>Be({...ze,after:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.map(e=>(0,J.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,J.jsxs)(H,{type:`submit`,disabled:h,"data-tip":`Put the block in after the step`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]})]}),b===`history`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-ink-2`,children:[(0,J.jsx)(z,{icon:s,size:15}),`Each change you make to the steps here is a version: go back to any one, and you can come back from it too. The runs are under Runs.`]}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:[...l.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,J.jsxs)(`li`,{className:I(`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,J.jsxs)(`span`,{className:`w-8 flex-none font-mono text-[13px] text-muted tabular-nums`,children:[`v`,e.n]}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,J.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[Je(e.at),` · `,F(e.steps,`step`)]})]}),t===0?(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:`Now`}):(0,J.jsx)(H,{size:`icon`,variant:`icon`,disabled:h,"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,J.jsx)(c,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function dt({runDir:e,runs:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),c=e=>{let t=e.steps.find(e=>!e.ok&&!e.skipped);return e.stopped?`Stopped before the end`:e.rows?e.ok?`All ${e.rows.length} rows passed`:`${e.rows.filter(e=>!e.ok).length} of ${e.rows.length} rows failed`:e.ok?`All ${e.steps.length} steps passed`:t?`Step ${t.n} failed: ${t.error||t.action}`:e.error||`It did not get through`};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-ink-2`,children:[(0,J.jsx)(z,{icon:s,size:15}),`Earlier runs, newest first. Only the latest run keeps its pictures, video and trace; each keeps its log.`]}),a&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:a}),(0,J.jsx)(`ol`,{"aria-label":`Earlier runs`,className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:n.map((n,a)=>(0,J.jsxs)(`li`,{className:I(`flex flex-col`,a>0&&`border-t border-line-soft`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,children:[n.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`flex-none text-pass`}):n.stopped?(0,J.jsx)(fe,{size:14,"aria-label":`Stopped`,className:`flex-none text-muted`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`flex-none text-fail`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,J.jsx)(`span`,{className:I(`text-[13px] [overflow-wrap:anywhere]`,n.ok||n.stopped?`text-ink`:`text-fail`),children:c(n)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[Je(n.at),n.env?` · on ${n.env}`:``,n.ms?` · ${Math.round(n.ms/1e3)}s`:``,n.why===`write`?` · before writing the test`:``]})]}),n.log&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`Open the log of the run ${Je(n.at)} in a new tab`,"data-tip":`Open the log of the run ${Je(n.at)} in a new tab`,onClick:async()=>o(await V(n.log,()=>P.openLog(e,n.log))),className:`size-8 flex-none`,children:(0,J.jsx)(b,{"aria-hidden":`true`})}),n.steps.length>0&&(0,J.jsx)(H,{size:`icon`,variant:`icon`,"aria-label":`See the steps of the run ${Je(n.at)}`,"aria-expanded":r===n.at,"data-tip":`See the steps of the run ${Je(n.at)}`,onClick:()=>i(r===n.at?null:n.at),className:`size-8 flex-none`,children:(0,J.jsx)(ie,{"aria-hidden":`true`})})]}),r===n.at&&(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0 text-[13px]`,children:n.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:I(`flex items-start gap-2 px-4 py-2`,n>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,J.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):e.ok?(0,J.jsx)(t,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(j,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,J.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[13px] text-muted tabular-nums`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,J.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]},n.at))})]})}function ft({runDir:e,kind:t}){let[n,r]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Open the video of ${t===`try`?`the re-run`:`the recording`} in a new tab`,onClick:async()=>r(await V(t,()=>P.openVideo(e,t))),children:[(0,J.jsx)(m,{"aria-hidden":`true`}),t===`try`?`Re-run video`:`Recording video`]}),n&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function pt({runDir:e,which:t,label:n}){let[r,i]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Open the ${n.toLowerCase()} in a new tab`,onClick:async()=>i(await V(t,()=>P.openLog(e,t))),children:[(0,J.jsx)(b,{"aria-hidden":`true`}),n]}),r&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})}function mt({runDir:e}){let t=e.split(/[\\/]/).filter(Boolean).pop()||``;return t?(0,J.jsxs)(H,{"data-tip":`Make API tests from the calls the app made in this re-run, with their payloads and answers`,onClick:()=>location.hash=Ce(`api-tests`,encodeURIComponent(`new:${t}/tries`)),children:[(0,J.jsx)(oe,{"aria-hidden":`true`}),`API tests from its calls`]}):null}function ht({runDir:e}){let[t,n]=(0,q.useState)(``);return(0,J.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{"data-tip":`Download Playwright's trace of the re-run: open it at trace.playwright.dev to see each step's page, actions and network`,onClick:async()=>n(await V(`trace.zip`,()=>P.openTrace(e))),children:[(0,J.jsx)(N,{"aria-hidden":`true`}),`Trace`]}),t&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:t})]})}function gt({runDir:e,n:t,failed:n}){let[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let n=!1;return P.tryShot(e,t).then(e=>!n&&i(e),()=>!n&&o(!0)),()=>{n=!0}},[e,t]);let s=n?`The page when step ${t} of the run failed`:`The page after step ${t} of the run`;return(0,J.jsx)(`div`,{className:`px-4 pb-4 sm:pl-14`,children:a?(0,J.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):r?(0,J.jsx)(`img`,{src:r,alt:s,className:`max-h-[420px] w-full max-w-[720px] rounded-[12px] border border-line-soft object-contain object-top`}):(0,J.jsx)(`div`,{className:`min-h-24 max-w-[720px] rounded-[12px] bg-surface-muted`})})}function _t({rows:e,n:t,locators:n,busy:r,onPick:i}){let a=n?.find(e=>e.chosen);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[n&&n.length>1&&i&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`How step `,t,` finds its element`,(0,J.jsx)(B,{value:String(a?.pick??n[0].pick),disabled:r,onChange:e=>i(Number(e.target.value)),"aria-describedby":a?.risk?`step-${t}-locator-risk`:void 0,className:`max-w-[560px]`,children:n.map(e=>(0,J.jsxs)(`option`,{value:e.pick,children:[ct(e),e.risk===`varies`?` — another value when the page loaded again`:e.risk?` — unique on this run only`:e.verified?` — unique on the page`:``,e.confidence===void 0?``:` (${e.confidence}%)`]},e.pick))})]}),a?.risk&&(0,J.jsx)(`span`,{id:`step-${t}-locator-risk`,className:`text-[13px] text-warn`,children:st[a.risk].alone})]}),(0,J.jsx)(`dl`,{"aria-label":`What was recorded for step ${t}`,className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 rounded-[12px] bg-surface-muted px-4 py-2 text-[13px] sm:grid-cols-[170px_minmax(0,1fr)] sm:gap-y-2`,children:e.map((e,t)=>(0,J.jsxs)(`div`,{className:`contents`,children:[(0,J.jsx)(`dt`,{className:`text-muted`,children:e.label}),(0,J.jsx)(`dd`,{className:I(`m-0 text-ink [overflow-wrap:anywhere]`,e.code&&`font-mono text-[13px]`),children:e.value})]},`${t}-${e.label}`))})]})}function vt({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``);(0,q.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,J.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[(0,J.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:o}),!i&&!o&&(0,J.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading the picture…`}),i&&(0,J.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,J.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,J.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t,e.f),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}`)})]})]})}var yt=[[`contains`,`Contains`],[`equals`,`Is exactly`],[`starts`,`Starts with`],[`ends`,`Ends with`],[`not_contains`,`Does not contain`],[`regex`,`Matches a pattern`],[`number`,`A number in it is`]],bt=[[`eq`,`=`],[`gt`,`>`],[`gte`,`≥`],[`lt`,`<`],[`lte`,`≤`],[`between`,`between`]],xt=[[`text`,`Its text`],[`value`,`Its value`],[`visible`,`It shows`],[`hidden`,`It is gone`],[`enabled`,`It is enabled`],[`disabled`,`It is disabled`],[`count`,`How many there are`],[`attribute`,`An attribute's value`]],St=/^[A-Za-z_][\w:.-]{0,60}$/,Ct=e=>{let t=e.replace(/\u00a0/g,` `).match(/-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?/);return t?t[0].replace(/,/g,``):``};function wt({check:e,onSave:n}){let r=e.match,i=e.was??e.kind,[a,o]=(0,q.useState)(e.kind),[s,l]=(0,q.useState)(e.attr??``),[u,d]=(0,q.useState)(r?.how??(e.kind===`count`?`number`:`contains`)),[f,p]=(0,q.useState)(r?.text??(e.kind===`attribute`?``:e.text)),[m,h]=(0,q.useState)(!!r?.ci),[g,_]=(0,q.useState)(r?.op??(e.kind===`count`?`gte`:`eq`)),[v,y]=(0,q.useState)(r?.min===void 0?e.kind===`count`?`1`:Ct(e.text):String(r.min)),[b,x]=(0,q.useState)(r?.max===void 0?``:String(r.max)),S=e=>e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,C=(()=>{try{return new RegExp(f),!0}catch{return!1}})(),w=a===`count`?`number`:[`text`,`value`,`attribute`,`url`,`title`].includes(a)?`text`:`none`,T=w===`number`?`number`:u,E=a!==`attribute`||St.test(s),D=T===`number`?S(v)===void 0||g===`between`&&(S(b)===void 0||S(b)<S(v))?void 0:{how:T,op:g,min:S(v),...g===`between`?{max:S(b)}:{}}:!f.trim()||T===`regex`&&(!C||f.length>200)?void 0:{how:T,text:f.trim(),...m?{ci:!0}:{}},ee=E&&(w===`none`||D!==void 0&&(a!==`attribute`||D.how!==`number`)),te=e.element&&a!==e.kind,O=e.kind===`value`?`The field's value`:e.kind===`url`?`The page address`:e.kind===`title`?`The page title`:`The text`;return(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:t=>{if(t.preventDefault(),!ee)return;let r=w===`none`?null:D;if(!te&&a===i&&(a===`text`||a===`value`)&&r&&r.how===`contains`&&!r.ci&&r.text===e.text)return n({match:null});n(e.element?{match:r,kind:a,...a===`attribute`?{attr:s}:{}}:{match:r})},children:[e.element&&(0,J.jsx)(B,{value:a,"aria-label":`What to check`,onChange:t=>{let n=t.target.value;if(o(n),n===`count`?(d(`number`),a!==`count`&&(_(`gte`),y(`1`))):u===`number`&&n===`attribute`&&d(`equals`),n===`attribute`&&a!==`attribute`&&p(e.kind===`attribute`?r?.text??``:``),(n===`text`||n===`value`)&&a!==n){let t=e.kind===`text`||e.kind===`value`?r:void 0;d(t?.how??`contains`),p(t?.text??e.text),h(!!t?.ci),_(t?.op??`eq`),y(t?.min===void 0?Ct(e.text):String(t.min)),x(t?.max===void 0?``:String(t.max))}},children:xt.filter(([e])=>e===`text`||e===`value`?e===i:!0).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),a===`attribute`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{value:s,maxLength:61,"aria-label":`The attribute`,placeholder:`e.g. aria-expanded or data-state`,onChange:e=>l(e.target.value)}),s!==``&&!E&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:`An attribute's name starts with a letter or _, then letters, digits and - _ : . only.`})]}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:a===`attribute`?`The attribute's value, compared as text.`:w===`number`?`How many elements this check's locator finds on the page.`:w===`none`?a===`visible`?`The replay checks it shows.`:a===`hidden`?`The replay checks it is gone.`:`The replay checks it is ${a}.`:`${O} was “${e.text}” when you recorded.`}),w===`text`&&(0,J.jsx)(B,{value:u,"aria-label":`How to compare`,onChange:e=>d(e.target.value),children:yt.filter(([e])=>a!==`attribute`||e!==`number`).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),w===`none`?null:T===`number`?(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(B,{value:g,"aria-label":`Compared with`,onChange:e=>_(e.target.value),className:`flex-none`,children:bt.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))}),(0,J.jsx)(L,{value:v,inputMode:`decimal`,maxLength:20,"aria-label":g===`between`?`Lowest value`:`Value`,onChange:e=>y(e.target.value),className:`min-w-0 flex-1`}),g===`between`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`and`}),(0,J.jsx)(L,{value:b,inputMode:`decimal`,maxLength:20,"aria-label":`Highest value`,onChange:e=>x(e.target.value),className:`min-w-0 flex-1`})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{value:f,maxLength:u===`regex`?200:300,"aria-label":u===`regex`?`The pattern`:`The text`,placeholder:u===`regex`?`e.g. ^Order \\d+ placed$`:void 0,onChange:e=>p(e.target.value)}),u===`regex`&&!C&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:`That is not a valid pattern.`}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px] text-ink-2`,children:[(0,J.jsx)(K,{checked:m,onCheckedChange:h}),`Any case (capital or small letters)`]})]}),w===`text`&&(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:u===`number`?`The first number in it is read, with any thousands separators and currency sign.`:`Spaces and line breaks count as one space.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!ee,"data-tip":`Save this check`,children:[(0,J.jsx)(t,{"aria-hidden":`true`}),`Save`]}),r&&(e.kind===`text`||e.kind===`value`||!e.element)&&(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({match:null}),"data-tip":`Compare by contains, as recorded`,children:[(0,J.jsx)(c,{"aria-hidden":`true`}),`Back to contains “`,e.text,`”`]})]})}function Tt({step:e,onAdd:n,onRecordMore:r}){let[i,a]=(0,q.useState)(`check`),[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(``),[d,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(`2`),[g,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(e.note||``),b=e.index,x=[[`check`,`Check`],[`step`,`Step`],[`wait`,`Wait`],[`note`,`Note`]],S=Number(m),C=Number.isInteger(S)&&S>=1&&S<=60;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`What to add`,className:`flex gap-1 rounded-[9px] bg-surface-strong p-1`,children:x.map(([e,t])=>(0,J.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e,onClick:()=>a(e),className:I(`flex-1 cursor-pointer rounded-[6px] border-0 px-2 py-1 text-[13px] font-medium`,i===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),i===`check`&&(0,J.jsxs)(J.Fragment,{children:[e.page&&(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({checks:[{after:b,kind:`url`}]}),children:[`The page is `,e.page]}),(0,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&n({checks:[{after:b,kind:`intent`,text:o.trim()}]})},children:[(0,J.jsx)(L,{value:o,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>s(e.target.value)}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!o.trim(),"data-tip":`Add the check`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]}),i===`step`&&(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,J.jsxs)(H,{size:`sm`,onClick:r,"data-tip":`Record more from here`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),(0,J.jsx)(`span`,{className:`text-[13px] 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,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&n({steps:[{after:b,kind:`do`,text:o.trim()}]})},children:[(0,J.jsx)(L,{value:o,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>s(e.target.value)}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The Coding agent finds the control on the page and does it here.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!o.trim(),"data-tip":`Add the step`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(g.trim())&&n({steps:[{after:b,kind:`open`,url:g.trim()}]})},children:[(0,J.jsx)(L,{value:g,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>_(e.target.value),className:`min-w-0 flex-1`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(g.trim()),"data-tip":`Add a step that opens this page`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({steps:[{after:b,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Go back`]})]}),i===`wait`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each step already waits for the page to load, its calls to finish and its spinners to go. Add a wait for what the page does later or slowly.`}),(0,J.jsxs)(H,{size:`sm`,className:`justify-start`,onClick:()=>n({steps:[{after:b,kind:`wait_load`}]}),"data-tip":`Wait until the page has loaded, its calls have finished and its spinners have gone`,children:[(0,J.jsx)(l,{"aria-hidden":`true`}),`Until the page has loaded`]}),(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),c.trim()&&n({steps:[{after:b,kind:`wait_text`,text:c.trim(),...d?{gone:!0}:{}}]})},children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(B,{value:d?`gone`:`shows`,"aria-label":`Wait until the text`,onChange:e=>p(e.target.value===`gone`),className:`flex-none`,children:[(0,J.jsx)(`option`,{value:`shows`,children:`Until it shows`}),(0,J.jsx)(`option`,{value:`gone`,children:`Until it is gone`})]}),(0,J.jsx)(L,{value:c,maxLength:120,placeholder:d?`e.g. Loading`:`e.g. Order placed`,"aria-label":`The text to wait for`,onChange:e=>u(e.target.value),className:`min-w-0 flex-1`})]}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:!c.trim(),"data-tip":`Add the wait`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]}),(0,J.jsxs)(`form`,{className:`flex items-center gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),C&&n({steps:[{after:b,kind:`wait_seconds`,seconds:S}]})},children:[(0,J.jsx)(L,{value:m,type:`number`,min:1,max:60,step:1,maxLength:2,"aria-label":`Seconds to wait`,onChange:e=>h(e.target.value),className:`w-20 flex-none`}),(0,J.jsx)(`span`,{className:`flex-1 text-[13px] text-ink-2`,children:`seconds`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,disabled:!C,"data-tip":`Add a pause of this many seconds`,children:[(0,J.jsx)(A,{"aria-hidden":`true`}),`Add`]})]})]}),i===`note`&&(0,J.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),n({notes:[{index:b,text:v.trim()}]})},children:[(0,J.jsx)(L,{value:v,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>y(e.target.value)}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,J.jsxs)(H,{type:`submit`,size:`sm`,variant:`primary`,disabled:v.trim()===(e.note||``),"data-tip":v.trim()||!e.note?`Save the note`:`Remove the note`,children:[v.trim()||!e.note?(0,J.jsx)(t,{"aria-hidden":`true`}):(0,J.jsx)(le,{"aria-hidden":`true`}),v.trim()||!e.note?`Save`:`Remove`]})]})]})}var Et={navigate:ae,back:T,click:C,dblclick:C,input:x,press:x,select:e,upload:_e,expect:k,wait_for:l,capture:n,note:ue,launch:m,double_click:C,type:x,keys:x,tap:C,double_tap:C,long_press:C,swipe:M,scroll:re,hide_keyboard:x,wait:O,dismiss:u},Y=e=>Et[e]||(e.startsWith(`expect`)?k:te),Dt=new Set([`starting`,`recording`,`paused`,`stopping`]);function Ot(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 kt(e){await P.write(e,{check:!0})}async function At(e,t=`desktop`){let n=t===`mobile`?`mobile_replay`:`desktop_replay`,{id:r}=await ve.start(`Replay the ${t} workflow ${e}: call ${n} with workflow ${e}, and tell me how each step went.`,{});location.hash=Ce(`chats`,r)}function jt({s:e,live:t,onDelete:n}){let r=Y(e.op);return(0,J.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-4 border-t border-line-soft py-2 first:border-t-0`,children:[(0,J.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right text-[13px] text-muted tabular-nums`,children:e.n||`–`}),(0,J.jsx)(r,{size:16,"aria-hidden":`true`,className:I(`mt-1 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,J.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.case_step?(0,J.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,J.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,J.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,J.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,J.jsx)(H,{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,J.jsx)(le,{"aria-hidden":`true`})})]})}var Mt=[[`tap`,`Tap`],[`check`,`Check`],[`long_press`,`Long-press`],[`wait_for`,`Wait for`]],Nt={tap:`Tap`,check:`Check`,long_press:`Long-press`,wait_for:`Wait for`};function X({s:e,send:t,busy:n,secrets:a}){let o=e.screen,[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(`tap`),[d,f]=(0,q.useState)(null),[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(``),v=o?.seq??0,y=o?.frame??v;(0,q.useEffect)(()=>{if(!y||!o?.image)return;let e=!1;return P.screen().then(t=>!e&&c(t),()=>{}),()=>{e=!0}},[y,o?.image]),(0,q.useEffect)(()=>{d&&d.seq!==v&&f(null)},[v,d]);let b=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,C=o&&o.width>0?(o.elements||[]).map((e,t)=>({c:e,i:t})).filter(e=>e.c.usable).sort((e,t)=>t.c.box[2]*t.c.box[3]-e.c.box[2]*e.c.box[3]):[],w=e=>e.label?`“${e.label}”`:`the ${e.kind||`control`}`,E=(e,n)=>{l===`tap`&&n.field?(f({el:e,seq:v,c:n}),h(``),_(n.secure&&a.length?a[0]:``)):t({cmd:l,seq:v,el:e})},D=!n&&e.state===`recording`&&!!o;return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-device`,className:`flex min-w-0 flex-[1_1_320px] flex-col gap-4 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-device`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:S,size:18,className:`text-accent-fg`}),e.device||`Device`,(0,J.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.platform===`ios`?`iOS`:`Android`})]}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`What a click on the screen does`,className:Xe,children:Mt.map(([e,t])=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":l===e,onClick:()=>u(e),className:Ye(l===e),children:t},e))}),o?(0,J.jsxs)(`div`,{className:`relative w-full max-w-[360px] self-center overflow-hidden rounded-[10px] border border-line-soft bg-surface-muted`,style:{aspectRatio:`${o.width} / ${o.height}`},children:[s&&(0,J.jsx)(`img`,{src:s,alt:`The screen of ${e.app} now`,className:`absolute inset-0 size-full object-fill`}),C.map(({c:e,i:t})=>{let n=l===`tap`&&e.field?`Type into ${w(e)}`:`${Nt[l]} ${w(e)}${e.prompt?` (a system prompt: kept to answer whenever a replay is asked)`:``}`;return(0,J.jsx)(`button`,{type:`button`,disabled:!D,"aria-label":n,"data-tip":n,onClick:()=>E(t,e),className:`absolute cursor-pointer rounded-[3px] border-0 bg-transparent p-0 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 disabled:cursor-wait`,style:{left:b(e.box[0],o.width),top:b(e.box[1],o.height),width:b(e.box[2],o.width),height:b(e.box[3],o.height)}},`${v}-${t}`)})]}):(0,J.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:e.state===`starting`?`Starting ${e.app} on ${e.device||`the device`}: a device cloud can take a minute or two…`:`Waiting for the screen…`}),d&&(0,J.jsxs)(`form`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,onSubmit:e=>{if(e.preventDefault(),g)t({cmd:`type`,seq:d.seq,el:d.el,secret:g});else if(m)t({cmd:`type`,seq:d.seq,el:d.el,text:m});else return;f(null)},children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium [overflow-wrap:anywhere]`,children:[`Type into `,w(d.c)]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:[(a.length>0||d.c.secure)&&(0,J.jsxs)(B,{"aria-label":`What to type`,value:g,onChange:e=>_(e.target.value),className:`min-w-0 flex-[1_1_160px] bg-bg`,children:[!d.c.secure&&(0,J.jsx)(`option`,{value:``,children:`Text I type`}),a.map(e=>(0,J.jsxs)(`option`,{value:e,children:[`Secret `,e]},e))]}),!g&&(0,J.jsx)(L,{"aria-label":`Text to type`,autoFocus:!0,value:m,maxLength:2e3,spellCheck:!1,onChange:e=>h(e.target.value),className:`min-w-0 flex-[2_1_180px] bg-bg`}),(0,J.jsxs)(H,{type:`submit`,variant:`primary`,disabled:!D||!g&&!m,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Type`]})]}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 text-[13px] text-muted`,children:[d.c.secure?a.length?`A password field: only a saved secret goes in, by its name, never its value.`:`A password field takes a saved secret: add one to mobile.secrets in Settings first.`:`A secret is typed from the credential store; the test keeps only its name.`,(0,J.jsx)(`button`,{type:`button`,onClick:()=>(t({cmd:`tap`,seq:d.seq,el:d.el}),f(null)),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`Only tap it`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>f(null),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:`Cancel`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"aria-label":`Gestures and keys`,role:`group`,children:[[[`Scroll up`,me,{cmd:`scroll`,direction:`up`}],[`Scroll down`,re,{cmd:`scroll`,direction:`down`}],[`Swipe left`,i,{cmd:`swipe`,direction:`left`}],[`Swipe right`,r,{cmd:`swipe`,direction:`right`}]].map(([e,n,r])=>(0,J.jsx)(H,{variant:`icon`,size:`icon`,"aria-label":e,"data-tip":e,disabled:!D,onClick:()=>t(r),children:(0,J.jsx)(n,{"aria-hidden":`true`})},e)),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`back`}),"data-tip":`The device's Back`,children:[(0,J.jsx)(T,{"aria-hidden":`true`}),`Back`]}),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`keys`,key:`enter`}),"data-tip":`Press Enter on the keyboard`,children:[(0,J.jsx)(x,{"aria-hidden":`true`}),`Enter`]}),(0,J.jsx)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`hide_keyboard`}),"data-tip":`Hide the keyboard`,children:`Hide keyboard`}),(0,J.jsxs)(H,{size:`sm`,disabled:!D,onClick:()=>t({cmd:`wait`,seconds:2}),"data-tip":`Record a wait of 2 seconds`,children:[(0,J.jsx)(O,{"aria-hidden":`true`}),`Wait 2 s`]}),(0,J.jsx)(H,{variant:`icon`,size:`icon`,"aria-label":`Read the screen again`,"data-tip":`Read the screen again`,disabled:!D,onClick:()=>t({cmd:`refresh`}),children:(0,J.jsx)(p,{"aria-hidden":`true`})})]}),e.notice&&(0,J.jsx)(`p`,{role:`status`,className:`m-0 rounded-[10px] bg-warn-soft px-4 py-2 text-[13px] text-warn [overflow-wrap:anywhere]`,children:e.notice.text})]})}function Pt({s:t,send:n,busy:r,secrets:i=[]}){let[,a]=(0,q.useState)(0);(0,q.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]);let o=(0,q.useRef)(null),s=(0,q.useRef)(null);(0,q.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[t.log.length]),(0,q.useEffect)(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[t.steps.length]);let c=t.kind===`desktop`,l=t.kind===`mobile`,u=t.kind===`web`,d=t.state===`paused`,f=t.log.at(-1)?.level===`warn`&&/press Stop again/i.test(t.log.at(-1).text),p=Math.max(0,...t.steps.map(e=>e.case_step||0));return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4 rounded-[14px] card border px-4 py-4`,children:[d?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,J.jsx)(be,{state:t.state===`starting`?`waiting`:t.state===`stopping`?`working`:`recording`,px:20}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t.name}),(0,J.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[t.state===`starting`?l?`Starting ${t.app} on ${t.device||`the device`}…`:c?`Starting ${t.app}…`:`Opening the browser…`:t.state===`stopping`?`Saving the workflow…`:d?`Paused: what you do now is not recorded`:`Recording`,` · `,Ot(t.startedAt),` ·`,` `,l?`${t.app} on ${t.device||`the device`}`:c?`${t.app}, a desktop app`:t.url]}),t.block&&(0,J.jsx)(`span`,{className:I(`text-[13px] [overflow-wrap:anywhere]`,t.block.state===`stopped`?`text-warn`:`text-muted`),children:t.block.kind===`recording`?t.block.state===`waiting`?`The recording's steps up to step ${t.block.total+1} play when the page is open.`:t.block.state===`playing`?`Doing the recording's steps up to step ${t.block.total+1}: wait for it.`:t.block.state===`done`?`At step ${t.block.total+1}: record what comes next, then Stop and save.`:`Step ${t.block.done+2} could not be done${t.block.note?` (${t.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${t.block.done+2} to ${t.block.total+1}.`:t.block.state===`waiting`?`The block "${t.block.name}" plays when the page is open.`:t.block.state===`playing`?`Doing the block "${t.block.name}" (${t.block.total} steps): wait for it.`:t.block.state===`done`?`The block "${t.block.name}" is done: carry on.`:`The block "${t.block.name}" stopped after ${t.block.done} of ${t.block.total} steps${t.block.note?` (${t.block.note})`:``}: do the rest by hand.`})]}),u&&(0,J.jsxs)(H,{disabled:r||t.state===`starting`,onClick:()=>n({cmd:`pause`}),children:[d?(0,J.jsx)(m,{"aria-hidden":`true`}):(0,J.jsx)(v,{"aria-hidden":`true`}),d?`Resume`:`Pause`]}),!c&&(0,J.jsxs)(H,{disabled:r||t.state===`starting`||!t.steps.length,onClick:()=>n({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,J.jsx)(ge,{"aria-hidden":`true`}),`Undo`]}),(0,J.jsxs)(H,{variant:`destructive`,disabled:r||t.state===`stopping`,onClick:()=>n({cmd:`stop`,...f?{force:!0}:{}}),"data-tip":f?`Stop anyway`:`Stop and save`,children:[(0,J.jsx)(ee,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),l?(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[`Do the steps on the screen below: a click is done on the device and becomes a step, found again by the control's id or text. Pick `,(0,J.jsx)(`strong`,{children:`Check`}),` and click what shows the outcome to add a check. A password field takes only a saved secret, by its name.`]}):c?(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[t.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,J.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,J.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,J.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-4 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, `,t.leader,` then `,(0,J.jsx)(`strong`,{children:`P`}),` pauses, `,(0,J.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,J.jsx)(`strong`,{children:`S`}),` stops.`]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-6`,children:[l&&(0,J.jsx)(X,{s:t,busy:r,secrets:i,send:n}),(0,J.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-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:e,size:18,className:`text-accent-fg`}),`Steps`,(0,J.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:t.summary})]}),t.steps.length?(0,J.jsx)(`div`,{ref:s,className:`max-h-[60vh] overflow-y-auto`,children:(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:t.steps.map(e=>(0,J.jsx)(jt,{s:e,live:!c,onDelete:()=>n({cmd:`delete`,n:e.n})},`${e.n}-${e.op}-${e.text}`))})}):(0,J.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:t.state===`starting`?c||l?`Starting ${t.app}…`:`Opening the browser…`:`Nothing yet: do the first step ${l?`on the screen`:`in ${c?t.app:`the browser`}`}.`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-6`,children:[t.case&&(0,J.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,J.jsx)(z,{icon:e,size:18,className:`text-accent-fg`}),t.case.id]}),(0,J.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:t.case.steps.map(e=>{let i=t.steps.some(t=>t.case_step===e.n);return(0,J.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,J.jsxs)(`button`,{type:`button`,disabled:r,"aria-current":e.n===p?`step`:void 0,onClick:()=>n({cmd:`case_step`,n:e.n}),className:I(`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===p&&`bg-accent-soft`),children:[i?(0,J.jsx)(k,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,J.jsx)(`span`,{className:`mt-1 w-4 flex-none text-center text-[13px] text-muted`,children:e.n}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.action}),e.expected&&(0,J.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,e.expected]})]})]})},e.n)})}),(0,J.jsxs)(H,{disabled:r,onClick:()=>n({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,J.jsx)(M,{"aria-hidden":`true`}),`Next`]})]}),(0,J.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,J.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,J.jsx)(`div`,{ref:o,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-[13px]`,"aria-live":`polite`,children:t.log.length?t.log.map((e,t)=>(0,J.jsx)(`p`,{className:I(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,J.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,l?`the device`:c?`the app`:`the browser`,`…`]})})]})]})]})]})}function Ft({s:e}){let t=e.result,[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(!1);if(!t)return null;let o=e.kind!==`web`;return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,J.jsx)(R,{tone:t.ok?`pass`:`fail`,children:t.ok?`Recorded`:`Not recorded`})]}),(0,J.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,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Ot(e.startedAt,e.endedAt)]})]}),t.ok&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,J.jsx)(R,{tone:`neutral`,icon:!1,children:F(e.steps.length,`step`)}),(0,J.jsxs)(R,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,J.jsxs)(R,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,J.jsxs)(R,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!o&&t.secrets.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?`, `:``,(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-warn`,children:t.caseGaps.map(e=>(0,J.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-ink-2`,children:t.notes.map((e,t)=>(0,J.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-sm text-muted`,children:t.skipped.map((e,t)=>(0,J.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[o&&t.workflow&&(0,J.jsxs)(H,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await At(t.workflow,e.kind===`mobile`?`mobile`:`desktop`)}catch(e){r(e.message),a(!1)}},children:[(0,J.jsx)(m,{"aria-hidden":`true`}),`Replay`]}),o&&t.report&&(0,J.jsxs)(H,{onClick:async()=>r(await V(t.report)),"data-tip":`Open the report`,children:[(0,J.jsx)(de,{"aria-hidden":`true`}),`Report`]}),!o&&t.ok&&(0,J.jsxs)(H,{onClick:async()=>r(await V(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,J.jsx)(he,{"aria-hidden":`true`}),`Steps`]}),(0,J.jsx)(`span`,{className:`text-sm`,children:(0,J.jsx)(We,{path:o&&t.workflow?t.workflow:e.runDir})}),n&&(0,J.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})]})}function It(e){try{let t=decodeURIComponent(e);return t&&t.length<=500&&!/[\0\r\n]/.test(t)?t:null}catch{return null}}function Lt(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function Rt({view:e,busy:t,onStart:n,start:r}){let i=Lt(r),a=e.mobile.apps.length>0,[o,s]=(0,q.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:e.session?.kind===`mobile`&&a?`mobile`:`web`),[c,l]=(0,q.useState)(e.mobile.apps[0]?.name??``),u=e.mobile.devices.filter(t=>t.platform===(e.mobile.apps.find(e=>e.name===c)?.platform??t.platform)),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(e.desktop.apps[0]??``),[g,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(``),[x,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[ee,te]=(0,q.useState)(``),[O,ne]=(0,q.useState)(i?``:e.apps[0]?.name??``),[re,ie]=(0,q.useState)(i),[k,A]=(0,q.useState)(``),[j,oe]=(0,q.useState)(e.environment??``),[se,le]=(0,q.useState)(!1),[M,ue]=(0,q.useState)(!1),[de,fe]=(0,q.useState)(``),N=o===`web`?e.blocks.find(e=>e.id===de):void 0,pe=o===`mobile`?a&&!!c:o===`desktop`?e.desktop.available&&(!!m||!!g.trim()&&!!y.trim()):N||O?!0:/^https?:\/\/\S+$/i.test(re.trim()),me=o===`web`||e.environments.length>1;return(0,J.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,onSubmit:t=>{if(t.preventDefault(),pe){if(o===`mobile`)return n({kind:`mobile`,app:c,...d&&u.some(e=>e.name===d)?{device:d}:{},...j&&j!==e.environment?{env:j}:{}});if(o===`desktop`&&m)return n({kind:`desktop`,app:m,...j&&j!==e.environment?{env:j}:{}});if(o===`desktop`)D(!0),te(``),we.addApp({name:y.trim(),path:g.trim(),...x.trim()?{args:x.trim()}:{},...j?{env:j}:{}}).then(t=>n({kind:`desktop`,app:t.name,...j&&j!==e.environment?{env:j}:{}}),e=>te(e.message)).finally(()=>D(!1));else{if(N)return n({block:N.id,...j&&j!==e.environment?{env:j}:{},signedIn:se});n({...O?{app:O}:{url:re.trim()},...k.trim()?{case:k.trim()}:{},...j&&j!==e.environment?{env:j}:{},signedIn:se})}}},children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,ae,!0],[`desktop`,`Desktop app`,ce,e.desktop.available],[`mobile`,`Mobile app`,S,a]].map(([t,n,r,i])=>(0,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":o===t,disabled:!i,"data-tip":i?void 0:t===`mobile`?`Add a mobile app in Settings → Mobile first.`:e.desktop.reason||`Windows only.`,onClick:()=>s(t),className:I(`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[7px] border-0 px-4 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50`,o===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,J.jsx)(r,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,J.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1fr)_auto]`,children:[o===`mobile`?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:[(0,J.jsx)(B,{"aria-label":`App`,value:c,onChange:e=>l(e.target.value),className:`min-w-0 flex-[2_1_180px]`,children:e.mobile.apps.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.platform===`ios`?`iOS`:`Android`]},e.name))}),u.length>0&&(0,J.jsx)(B,{"aria-label":`Device`,value:d,onChange:e=>p(e.target.value),className:`min-w-0 flex-[1_1_160px]`,children:u.map((e,t)=>(0,J.jsxs)(`option`,{value:t===0?``:e.name,children:[e.name,` · `,e.where]},e.name))})]}):o===`desktop`?(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.desktop.apps.length>0&&(0,J.jsxs)(B,{"aria-label":`App`,value:m,onChange:e=>h(e.target.value),className:I(m?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.desktop.apps.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e)),(0,J.jsx)(`option`,{value:``,children:`Another app…`})]}),!m&&(0,J.jsx)(et,{value:g,onChange:e=>{v(e),w||b(e.trim()?tt(e):``)},onPicked:(e,t)=>{w||b(t)},onError:te,className:`flex-1`})]}):N?(0,J.jsxs)(`p`,{className:`m-0 self-center text-sm [overflow-wrap:anywhere]`,children:[`Opens `,N.startUrl,`, does the block `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:N.name}),` (`,N.steps,` `,N.steps===1?`step`:`steps`,`), then you carry on.`]}):(0,J.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,J.jsxs)(B,{"aria-label":`Start on`,value:O,onChange:e=>ne(e.target.value),className:I(O?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,J.jsx)(`option`,{value:``,children:`Another page…`})]}),!O&&(0,J.jsx)(L,{"aria-label":`Page address`,type:`url`,value:re,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>ie(e.target.value),className:`min-w-0 flex-1`})]}),(0,J.jsxs)(H,{type:`submit`,variant:`primary`,disabled:t||E||!pe,"data-tip":`Start recording`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),E?`Adding…`:t?o===`web`?`Opening…`:`Starting…`:`Record`]})]}),o===`desktop`&&!m&&(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-[12px] bg-surface-muted p-4 @2xl:grid-cols-[minmax(0,220px)_minmax(0,1fr)]`,children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Save it as`,(0,J.jsx)(L,{"aria-label":`The app's name`,value:y,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{T(!0),b(e.target.value)},className:`bg-bg`})]}),(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Arguments `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Optional: what the app starts with. Quotes keep spaces together; no shell.`}),(0,J.jsx)(L,{"aria-label":`The app's arguments`,value:x,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>C(e.target.value),className:`bg-bg font-mono text-[13px]`})]}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted @2xl:col-span-2`,children:[`Added to the apps of `,j||e.environment?`the ${j||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]}),ee&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:ee}),me&&(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":M,onClick:()=>ue(!M),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,J.jsx)(_,{size:14,"aria-hidden":`true`,className:I(`transition-transform`,M&&`rotate-180`)}),`More options`,!M&&(k||se||N||j&&j!==e.environment)?(0,J.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,J.jsx)(Oe,{open:M,children:(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-[12px] bg-surface-muted p-4 @2xl:grid-cols-2`,children:[o===`web`&&e.blocks.length>0&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Start from a block `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Its steps are done for you first, then you record the rest.`}),(0,J.jsxs)(B,{value:de,onChange:e=>fe(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`No block: start on the page`}),e.blocks.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),o===`web`&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Test case `,(0,J.jsx)(`span`,{className:`-mt-1 text-[13px] font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,J.jsx)(L,{value:k,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>A(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(o!==`web`||!!O)&&(0,J.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm font-medium`,children:[`Environment`,(0,J.jsx)(B,{value:j,onChange:e=>oe(e.target.value),children:e.environments.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})]}),o===`web`&&e.logins.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-4 @2xl:col-span-2`,children:[(0,J.jsx)(Me,{checked:se,onChange:le,label:`Start signed in`}),(0,J.jsxs)(`span`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,J.jsxs)(`span`,{className:`text-[13px] 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,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:o===`mobile`?`The app starts on the device through Appium, here or on a device cloud, and its screen is shown on this page: do the steps there. It is saved as a workflow that replays with no model.`:o===`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 Z=5;function zt(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function Q({view:e}){let t=e.recordings,n=t.filter(e=>e.seconds!==void 0),r=n.reduce((e,t)=>e+(t.seconds??0),0),i=t.filter(e=>e.kind===`web`&&Qe(e.test).hasTest).length,a=Math.round(r/60),o=Math.floor(a/60),s=a%60;return(0,J.jsxs)(ze,{label:`Recordings in numbers`,children:[(0,J.jsx)(Ne,{compact:!0,icon:m,label:`Recordings`,value:String(t.length),note:t.some(e=>e.kind!==`web`)?[[`web`,`web`],[`desktop`,`desktop`],[`mobile`,`mobile`]].map(([e,n])=>[t.filter(t=>t.kind===e).length,n]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `):`web pages`}),(0,J.jsx)(Ne,{compact:!0,icon:E,label:`Tests written`,value:String(i),note:`from these recordings`}),(0,J.jsx)(Ne,{compact:!0,icon:D,label:`Reusable flows`,value:String(e.blocks.length),note:`blocks kept to use again`}),(0,J.jsx)(Ne,{compact:!0,icon:O,label:`Total duration`,value:n.length?o?`${o}h ${s}m`:`${s}m`:`—`,note:n.length?`${F(n.length,`recording`)} timed`:`kept from now on`})]})}function Bt(){return(0,J.jsxs)(`section`,{"aria-labelledby":`rec-how`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,J.jsx)(`h2`,{id:`rec-how`,className:`m-0 text-base font-semibold`,children:`How it works`}),(0,J.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:[{icon:f,title:`Record your journey`,text:`Each click, entry and choice in the browser or app is recorded in order.`},{icon:e,title:`Define checks`,text:`Choose what each step must show, and where typed values come from.`},{icon:E,title:`Generate the test`,text:`Write turns it into a test in your repository; Re-run plays it on any environment.`}].map((e,t)=>(0,J.jsxs)(`li`,{className:`flex items-start gap-4`,children:[(0,J.jsx)(z,{icon:e.icon,size:16,className:`mt-1 flex-none text-accent-fg`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium`,children:[t+1,`. `,e.title]}),(0,J.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.text})]})]},e.title))})]})}function Vt({anchor:e,open:t,onClose:n,label:r,align:i,children:a}){let o=(0,q.useRef)(null),[s,c]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!t||!e)return;let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(document.documentElement).getPropertyValue(`--ui-zoom`))||1;c({top:n.bottom/r,left:(i===`right`?n.right:n.left)/r,up:window.innerHeight-n.bottom<280&&n.top>window.innerHeight-n.bottom,h:n.height/r})},[t,e,i]),(0,q.useEffect)(()=>{if(!t)return;let e=()=>n();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,n]),(0,q.useEffect)(()=>{if(!t||!s)return;(o.current?.querySelector(`[role^="menuitem"]`))?.focus();let n=o.current;return()=>{let t=document.activeElement;setTimeout(()=>{let r=document.activeElement;(!r||r===document.body||r===t&&n?.contains(r))&&e?.querySelector(`button`)?.focus()},0)}},[t,s,e]),s?(0,rt.createPortal)((0,J.jsx)(`div`,{ref:o,className:`fixed z-50`,style:{top:s.up?s.top-s.h:s.top,left:s.left},onKeyDown:e=>{let t=[...o.current?.querySelectorAll(`[role^="menuitem"]`)??[]],r=t.indexOf(document.activeElement);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),t[(r+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()):e.key===`Tab`&&n()},children:(0,J.jsx)(Ke,{open:t,onClose:n,label:r,className:I(`w-[230px] text-left`,i===`right`?`right-0`:`left-0`,s.up?`top-auto bottom-1`:`top-1 bottom-auto`),children:a})}),document.body):null}function Ht(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(0);return[e,(0,q.useCallback)(e=>{e||(n.current=Date.now()),t(e)},[]),(0,q.useCallback)(()=>{Date.now()-n.current<300||t(e=>!e)},[])]}function Ut({r:e,onReview:t,onWrite:n,onDelete:r,onNote:i}){let[a,o,s]=Ht(),c=(0,q.useRef)(null),l=Qe(e.test),u=e=>()=>{o(!1),e()};return(0,J.jsxs)(`span`,{ref:c,className:`relative inline-block`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`More for ${e.name}`,"data-tip":`More for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":a,onClick:s,children:(0,J.jsx)(ne,{"aria-hidden":`true`})}),(0,J.jsxs)(Vt,{anchor:c.current,open:a,onClose:()=>o(!1),label:`More for ${e.name}`,align:`right`,children:[(e.kind===`web`&&e.ok||e.kind!==`web`&&e.workflow)&&(0,J.jsx)(G,{onClick:u(t),children:`Open the recording`}),e.kind!==`web`&&e.workflow&&(0,J.jsx)(G,{onClick:u(()=>At(e.workflow,e.kind===`mobile`?`mobile`:`desktop`).catch(e=>i(e.message))),children:`Replay`}),e.kind===`web`&&e.ok&&l.hasTest&&e.test?.testFile&&(0,J.jsx)(G,{onClick:u(()=>void $e(e.test.testFile).then(i)),children:`Open the test`}),e.kind===`web`&&e.ok&&!l.hasTest&&!l.writing&&(0,J.jsx)(G,{onClick:u(n),children:`Write the test`}),e.test?.chat&&(0,J.jsx)(G,{onClick:u(()=>location.hash=Ce(`chats`,e.test.chat)),children:`Open the chat`}),e.trace&&(0,J.jsx)(G,{onClick:u(()=>void V(e.trace).then(i)),children:`Read the steps`}),e.report&&(0,J.jsx)(G,{onClick:u(()=>void V(e.report).then(i)),children:`Open the report`}),(0,J.jsx)(G,{onClick:u(r),children:(0,J.jsx)(`span`,{className:`text-fail`,children:`Delete`})})]})]})}function Wt({r:e,onNote:t}){let n=Qe(e.test);return(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,onClick:e=>e.stopPropagation(),children:[e.kind===`web`&&e.ok&&(0,J.jsx)(`span`,{"data-tip":`${n.detail}${e.test?.testFile?` (${e.test.testFile})`:``}`,children:(0,J.jsx)(R,{tone:n.tone,icon:n.tone!==`neutral`,className:`min-h-5 px-2 text-[13px]`,children:n.label})}),n.hasTest&&e.test?.testFile&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the test of ${e.name}`,"data-tip":`Open ${e.test.testFile}`,onClick:async()=>t(await $e(e.test.testFile)),children:(0,J.jsx)(E,{"aria-hidden":`true`})}),(e.yaml||e.kind===`mobile`&&e.workflow)&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the workflow of ${e.name}`,"data-tip":`Open the YAML workflow`,onClick:async()=>t(await V(e.yaml||e.workflow)),children:(0,J.jsx)(se,{"aria-hidden":`true`})}),e.trace&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>t(await V(e.trace)),children:(0,J.jsx)(he,{"aria-hidden":`true`})}),e.report&&(0,J.jsx)(H,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>t(await V(e.report)),children:(0,J.jsx)(de,{"aria-hidden":`true`})})]})}function Gt({rows:e,limit:t,onReview:n,onReviewDesktop:r,onDeleted:i,onChanged:a,onViewAll:o}){let s=t===void 0,[c,l]=(0,q.useState)(``),[d,f]=(0,q.useState)([]),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[v,y,b]=Ht(),x=(0,q.useRef)(null),[C,w]=(0,q.useState)(`any`),[T,E]=(0,q.useState)(``),[D,ee]=(0,q.useState)(`all`);(0,q.useEffect)(()=>f(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let te=async()=>{g(!0),l(``);try{let e=d.length;i(await P.deleteRecordings(d)),f([]),l(`Deleted ${F(e,`recording`)}.`)}catch(e){l(e.message)}finally{g(!1),m(!1)}},O=e=>e.kind===`web`&&Qe(e.test).hasTest,ne=D===`all`?e:e.filter(e=>e.kind===D),re=T.toLowerCase().split(/\s+/).filter(Boolean),ie=re.length?ne.filter(e=>re.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl} ${e.browser||``} ${e.test?.testFile||``} ${e.kind===`web`?Qe(e.test).label:``}`.toLowerCase().includes(t))):ne,k=C===`any`?ie:ie.filter(e=>e.kind===`web`&&C===`written`===O(e)),A=t?k.slice(0,t):k,oe=new Set(e.map(e=>e.kind)).size>1,se=C!==`any`||D!==`all`,ue=e=>{f([e]),m(!0)},de=e=>kt(e).then(()=>a(),e=>l(e.message)),fe=(0,J.jsxs)(`span`,{ref:x,className:`relative inline-block`,children:[(0,J.jsxs)(H,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":v,onClick:b,"data-tip":`Show only some recordings`,children:[`Filter`,se?` · on`:``,(0,J.jsx)(_,{"aria-hidden":`true`})]}),(0,J.jsxs)(Vt,{anchor:x.current,open:v,onClose:()=>y(!1),label:`Show only`,align:`left`,children:[[[`any`,`Any test`],[`written`,`Test written (${e.filter(O).length})`],[`none`,`No test yet (${e.filter(e=>e.kind===`web`&&!O(e)).length})`]].map(([e,t])=>(0,J.jsx)(qe,{role:`menuitemradio`,checked:C===e,onSelect:()=>w(e),children:(0,J.jsx)(`span`,{className:`flex-1`,children:t})},e)),oe&&[[`all`,`Every kind`],[`web`,`Web pages`],[`desktop`,`Desktop apps`],[`mobile`,`Mobile apps`]].map(([e,t],n)=>(0,J.jsx)(`span`,{className:I(`block`,n===0&&`mt-1 border-t border-line-soft pt-1`),children:(0,J.jsx)(qe,{role:`menuitemradio`,checked:D===e,onSelect:()=>ee(e),children:(0,J.jsx)(`span`,{className:`flex-1`,children:t})})},e))]})]});return(0,J.jsxs)(`section`,{"aria-labelledby":s?`rec-all`:`rec-recent`,className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h2`,{id:s?`rec-all`:`rec-recent`,className:`m-0 flex-1 text-base font-semibold`,children:[s?`All recordings`:`Recent recordings`,` `,(0,J.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:s?`(${k.length})`:k.length>A.length?`· latest ${A.length} of ${k.length}`:``})]}),s&&(0,J.jsxs)(H,{size:`sm`,variant:`danger`,disabled:!d.length||h,"data-tip":`Delete the selected recordings`,onClick:()=>m(!0),children:[(0,J.jsx)(le,{"aria-hidden":`true`}),`Delete`,d.length?` (${d.length})`:``]}),o&&(0,J.jsxs)(H,{size:`sm`,onClick:o,"data-tip":`Every recording, with search, filters and delete`,children:[`View all`,(0,J.jsx)(M,{"aria-hidden":`true`})]})]}),c&&(0,J.jsx)(`p`,{role:`status`,className:I(`m-0 text-[13px]`,c.startsWith(`Deleted`)?`text-muted`:`text-fail`),children:c}),(0,J.jsx)(Ue,{label:`Recordings`,resetKey:`${C}-${D}-${T}`,search:!1,size:t??25,tools:(0,J.jsxs)(J.Fragment,{children:[s&&(0,J.jsx)(xe,{id:`rec-search`,label:`Search recordings`,placeholder:`Search recordings`,value:T,onChange:E}),fe]}),empty:re.length||se?`Nothing matches.`:`No recordings yet.`,head:(0,J.jsxs)(J.Fragment,{children:[s&&(0,J.jsx)(`th`,{className:I(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-9`),children:(0,J.jsx)(K,{"aria-label":`Select all ${F(A.length,`recording`)}`,"data-tip":`Select all ${F(A.length,`recording`)} the search and filter keep`,checked:A.length>0&&A.every(e=>d.includes(e.runDir)),onCheckedChange:e=>f(e?[...new Set([...d,...A.map(e=>e.runDir)])]:d.filter(e=>!A.some(t=>t.runDir===e)))})}),(0,J.jsx)(`th`,{className:je,children:`Recording`}),(0,J.jsx)(`th`,{className:I(je,`hidden @3xl:table-cell`),children:`Test case`}),(0,J.jsx)(`th`,{className:I(je,`hidden @4xl:table-cell`),children:`Browser`}),(0,J.jsx)(`th`,{className:I(Pe,`hidden @4xl:table-cell`),children:`Duration`}),(0,J.jsx)(`th`,{className:I(je,`hidden @xl:table-cell`),children:`Outputs`}),(0,J.jsx)(`th`,{className:I(je,`hidden @2xl:table-cell`),children:`Created`}),(0,J.jsx)(`th`,{className:I(je,`w-10`),children:(0,J.jsx)(`span`,{className:`sr-only`,children:`More`})})]}),children:A.map(e=>{let t=e.kind!==`web`&&!!e.workflow,i=e.kind===`web`&&e.ok||t,a=()=>t?r(e.workflow):n(e.runDir);return(0,J.jsxs)(`tr`,{onClick:i?a:void 0,className:i?Ae:Ie,children:[s&&(0,J.jsx)(`td`,{className:`px-4 py-2`,onClick:e=>e.stopPropagation(),children:(0,J.jsx)(K,{"aria-label":`Select ${e.name}`,checked:d.includes(e.runDir),onCheckedChange:t=>f(t?[...d,e.runDir]:d.filter(t=>t!==e.runDir))})}),(0,J.jsx)(`td`,{className:ke,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[e.ok?e.kind===`desktop`?(0,J.jsx)(z,{icon:ce,size:16,className:`mt-1 flex-none text-muted`,label:`Desktop app`}):e.kind===`mobile`?(0,J.jsx)(z,{icon:S,size:16,className:`mt-1 flex-none text-muted`,label:`Mobile app`}):(0,J.jsx)(z,{icon:ae,size:16,className:`mt-1 flex-none text-muted`,label:`Web page`}):(0,J.jsx)(u,{size:16,"aria-label":`Not recorded`,className:`mt-1 flex-none text-fail`}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[i?(0,J.jsx)(`a`,{href:t?Ce(`record`):Ze(e.runDir),onClick:e=>{e.stopPropagation(),(t||!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.button===0)&&(e.preventDefault(),a())},className:`truncate font-medium text-ink no-underline hover:underline`,"data-tip":e.name,children:e.name}):(0,J.jsx)(`span`,{className:`truncate font-medium text-ink`,"data-tip":e.name,children:e.name}),(0,J.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.kind===`web`?e.startUrl:e.app}),e.kind===`web`&&e.ok&&(0,J.jsx)(`span`,{className:`mt-1 @xl:hidden`,"data-tip":Qe(e.test).detail,children:(0,J.jsx)(R,{tone:Qe(e.test).tone,icon:Qe(e.test).tone!==`neutral`,className:`min-h-5 px-2 text-[13px]`,children:Qe(e.test).label})})]})]})}),(0,J.jsx)(`td`,{className:I(ke,`hidden @3xl:table-cell`),children:e.caseId?(0,J.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.caseId}):(0,J.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,J.jsx)(`td`,{className:I(ke,`hidden text-ink-2 @4xl:table-cell`),children:e.browser??(0,J.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,J.jsx)(`td`,{className:I(Fe,`hidden text-ink-2 @4xl:table-cell`),children:e.seconds===void 0?(0,J.jsx)(`span`,{className:`text-muted`,children:`—`}):zt(e.seconds)}),(0,J.jsx)(`td`,{className:I(ke,`hidden @xl:table-cell`),children:(0,J.jsx)(Wt,{r:e,onNote:l})}),(0,J.jsx)(`td`,{className:I(ke,`hidden whitespace-nowrap text-ink-2 @2xl:table-cell`),"data-tip":new Date(e.startedAt).toLocaleString(),children:Je(e.startedAt)}),(0,J.jsx)(`td`,{className:I(ke,`text-right`),children:(0,J.jsx)(Ut,{r:e,onReview:a,onWrite:()=>void de(e.runDir),onDelete:()=>ue(e.runDir),onNote:l})})]},e.runDir)})}),p&&(0,J.jsx)(Le,{open:!0,onClose:()=>m(!1),title:`Delete ${F(d.length,`recording`)}`,description:`Their steps, screenshots, tries and reports are removed from this computer. Tests already written from them stay.`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(H,{variant:`ghost`,disabled:h,onClick:()=>m(!1),children:[(0,J.jsx)(j,{"aria-hidden":`true`}),`Cancel`]}),(0,J.jsxs)(H,{variant:`destructive`,disabled:h,onClick:()=>void te(),children:[(0,J.jsx)(le,{"aria-hidden":`true`}),h?`Deleting…`:`Delete`]})]}),children:(0,J.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=>d.includes(e.runDir)).map(e=>(0,J.jsxs)(`li`,{className:`truncate`,children:[e.name,` `,(0,J.jsxs)(`span`,{className:`text-muted`,children:[`· `,Je(e.startedAt)]})]},e.runDir))})})]})}function Kt({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length)?null:(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-sm text-ink`,children:[(0,J.jsx)(`p`,{className:`m-0 font-semibold`,children:`Just recorded: worth knowing`}),t.secrets.length>0&&(0,J.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?`, `:``,(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.caseGaps.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.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,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.notes.map((e,t)=>(0,J.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,J.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.skipped.map((e,t)=>(0,J.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function qt({sub:t}={}){let[n,r]=(0,q.useState)(null),i=t?.startsWith(`recording/`)?It(t.slice(10)):null,[a,o]=(0,q.useState)(i);(0,q.useEffect)(()=>{i&&o(i)},[i]);let[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(`new`),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),g=(0,q.useCallback)(()=>{P.get().then(e=>{r(e),p(``)},e=>p(e.message))},[]);(0,q.useEffect)(g,[g]);let _=!!n?.session&&Dt.has(n.session.state);(0,q.useEffect)(()=>{if(!_)return;let e=setInterval(g,800);return()=>clearInterval(e)},[_,g]);let v=!!n?.recordings.some(e=>e.test?.state===`writing`||e.test?.state===`checking`);(0,q.useEffect)(()=>{if(!v||_)return;let e=setInterval(g,4e3);return()=>clearInterval(e)},[v,_,g]);let y=(0,q.useRef)(!1),b=n?.session;(0,q.useEffect)(()=>{_?y.current=!0:y.current&&b&&(y.current=!1,b.result?.ok&&b.kind===`web`&&o(b.runDir),b.result?.ok&&b.kind!==`web`&&b.result.workflow&&c(b.result.workflow))},[_,b]);let x=async e=>{h(!0),p(``);try{r(await e())}catch(e){p(e.message)}finally{h(!1)}},S=(e,t)=>{o(null),window.scrollTo({top:0,behavior:`smooth`}),x(()=>P.start({more:{run:e,after:t}}))},C=e=>{o(e),window.scrollTo({top:0})},w=!!b?.result&&!b.result.ok,T=!!a||!!s,E=e=>{c(e),window.scrollTo({top:0})};return(0,J.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,J.jsx)(Be,{}),(0,J.jsxs)(`main`,{className:I(Ve,`@container flex-auto gap-4`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(He,{pixel:U.record,size:`lg`}),(0,J.jsx)(`h1`,{className:`m-0 flex-1 text-[25px] font-semibold tracking-[-0.01em]`,children:`Record`}),n&&!_&&!T&&(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`Record`,className:`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`new`,`New recording`,f],[`recordings`,`Recordings${n.recordings.length?` (${n.recordings.length})`:``}`,e]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,role:`tab`,id:`rec-tab-${e}`,"aria-selected":l===e,"aria-controls":`rec-panel`,tabIndex:l===e?0:-1,onClick:()=>u(e),onKeyDown:t=>{if(t.key!==`ArrowRight`&&t.key!==`ArrowLeft`)return;let n=e===`new`?`recordings`:`new`;u(n),document.getElementById(`rec-tab-${n}`)?.focus()},className:Ye(l===e),children:[(0,J.jsx)(n,{size:14,"aria-hidden":`true`}),t]},e))})]}),!T&&(0,J.jsx)(`p`,{className:`m-0 max-w-measure text-sm leading-relaxed text-ink-2`,children:`Do a test's steps yourself in a browser, a Windows app or a mobile app ForgeQE opens; each click, entry and choice is recorded in order, and you choose the checks after.`}),d&&(0,J.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}),!n&&!d&&(0,J.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&b&&_&&(0,J.jsx)(Pt,{s:b,busy:m,secrets:n.mobile.secrets,send:e=>void x(()=>P.command(e))}),n&&!_&&a&&(0,J.jsx)(ut,{runDir:a,notices:b&&b.runDir===a?(0,J.jsx)(Kt,{s:b}):void 0,onRecordMore:e=>S(a,e),onClose:()=>{o(null),u(`recordings`),i&&(location.hash=Ce(`record`)),g()}},a),n&&!_&&s&&(0,J.jsx)(nt,{workflow:s,backLabel:`Recordings`,notices:b&&b.kind===`desktop`&&b.result?.workflow===s?(0,J.jsx)(Kt,{s:b}):void 0,onClose:()=>{c(null),u(`recordings`),g()}},s),n&&!_&&!T&&(0,J.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel`,"aria-labelledby":`rec-tab-${l}`,className:`flex min-w-0 flex-col gap-4`,children:[l===`new`&&(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsx)(Ft,{s:b}),b?.result?.ok&&(b.kind===`web`||!!b.result.workflow)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-[12px] card border px-4 py-4 text-sm`,children:[(0,J.jsx)(k,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,J.jsx)(`strong`,{className:`font-semibold`,children:b.name}),(0,J.jsxs)(`span`,{className:`text-muted`,children:[` · `,F(b.steps.length,`step`)]})]}),(0,J.jsxs)(H,{size:`sm`,onClick:()=>b.kind===`desktop`?E(b.result.workflow):C(b.runDir),"data-tip":`Open the recording`,children:[(0,J.jsx)(ie,{"aria-hidden":`true`}),`Open`]})]}),(0,J.jsx)(Q,{view:n}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-[999_1_560px]`,children:(0,J.jsx)(Rt,{view:n,busy:m,start:t,onStart:e=>void x(()=>P.start(e))})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-[1_1_260px]`,children:(0,J.jsx)(Bt,{})})]}),n.recordings.length>0&&(0,J.jsx)(Gt,{rows:n.recordings,limit:Z,onReview:C,onReviewDesktop:E,onDeleted:r,onChanged:g,onViewAll:()=>u(`recordings`)})]}),l===`recordings`&&(n.recordings.length?(0,J.jsx)(Gt,{rows:n.recordings,onReview:C,onReviewDesktop:E,onDeleted:r,onChanged:g}):(0,J.jsx)(Se,{className:`py-4`,action:(0,J.jsxs)(H,{size:`sm`,onClick:()=>u(`new`),"data-tip":`New recording`,children:[(0,J.jsx)(f,{"aria-hidden":`true`}),`Record`]}),children:`No recordings yet.`}))]})]})]})}export{qt as Record,Lt as givenStart};