@capagents/forgeqe 3.4.3 → 3.4.4

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 (70) hide show
  1. package/dist/forgeqe.js +1979 -1971
  2. package/dist/web/assets/{3d-force-graph-ChNz5Yhx.js → 3d-force-graph-DwblDu4y.js} +1 -1
  3. package/dist/web/assets/{Agent-CTRFDu9M.js → Agent-C8WdS1HB.js} +1 -1
  4. package/dist/web/assets/{AgentWork-D1c_w9rM.js → AgentWork-C1Qa_Ftb.js} +1 -1
  5. package/dist/web/assets/{ApiTests-CHKwMgxN.js → ApiTests-u4tzlJaD.js} +1 -1
  6. package/dist/web/assets/{Browse-CcKh43L5.js → Browse-B0ZTvpo2.js} +1 -1
  7. package/dist/web/assets/{Chat-CooI13qi.js → Chat-B73XMxdf.js} +1 -1
  8. package/dist/web/assets/{CommandPalette-D8AtIocY.js → CommandPalette-D7ld-tbJ.js} +1 -1
  9. package/dist/web/assets/{Compare-DPX2G5oF.js → Compare-CxGjAZW0.js} +1 -1
  10. package/dist/web/assets/{Cost-CBGk_xKN.js → Cost-BeVu3Z6g.js} +1 -1
  11. package/dist/web/assets/{Data-CW95KX9u.js → Data-BPyCT0eP.js} +1 -1
  12. package/dist/web/assets/{Desktop-C6-h0ExO.js → Desktop-qPGc2OWb.js} +1 -1
  13. package/dist/web/assets/{DesktopReview-C02n70Wx.js → DesktopReview-CVoC6bQY.js} +1 -1
  14. package/dist/web/assets/{Evidence-DqTx1TS1.js → Evidence-CtUiUCa6.js} +1 -1
  15. package/dist/web/assets/{Explore-DgaugrDO.js → Explore-BvjAhqyo.js} +1 -1
  16. package/dist/web/assets/{Features-DYr-izEt.js → Features-CmQCxEJX.js} +1 -1
  17. package/dist/web/assets/{Flags-DL-G7YWK.js → Flags-asj8tiKy.js} +1 -1
  18. package/dist/web/assets/{Flaky-DOxneo4i.js → Flaky-ChYK151U.js} +1 -1
  19. package/dist/web/assets/{Impact-BuHHY2_3.js → Impact-B1-B2oHr.js} +1 -1
  20. package/dist/web/assets/{Jobs-DEc49gwq.js → Jobs-CZ2k5hGk.js} +1 -1
  21. package/dist/web/assets/{KindPage-DuLav-l5.js → KindPage-CDfvpDXP.js} +1 -1
  22. package/dist/web/assets/{LiveDevice-PsN5gnXw.js → LiveDevice-B33XU61P.js} +1 -1
  23. package/dist/web/assets/{Migration-BcxL5Okw.js → Migration-BBM_Sce0.js} +1 -1
  24. package/dist/web/assets/{Mobile-CBDmyoL5.js → Mobile-BzufjlBb.js} +1 -1
  25. package/dist/web/assets/{Observability-Cqjko62E.js → Observability-qcx5vrNO.js} +1 -1
  26. package/dist/web/assets/{OwnItems-DXS-CMiC.js → OwnItems-BkoHG_xw.js} +1 -1
  27. package/dist/web/assets/{PageAgent-BzDuRR-t.js → PageAgent-Do62EBze.js} +1 -1
  28. package/dist/web/assets/{Product-BKIKhNp3.js → Product-9ImZUA2B.js} +2 -2
  29. package/dist/web/assets/{Production-DKKynWrp.js → Production-B6uigaYJ.js} +1 -1
  30. package/dist/web/assets/{Quality-Dsh07yXp.js → Quality-Cw6qhXyl.js} +1 -1
  31. package/dist/web/assets/{Readiness-BbjzvgVB.js → Readiness-D8WMgQmd.js} +1 -1
  32. package/dist/web/assets/Record-DCcHfH7u.js +1 -0
  33. package/dist/web/assets/{Regression-DeQnXoZ4.js → Regression-BLlXnCW2.js} +1 -1
  34. package/dist/web/assets/{RelationGraph-C7M_Zcx-.js → RelationGraph-BxJgWpp6.js} +1 -1
  35. package/dist/web/assets/{Reports-DsWA9Q7H.js → Reports-ZNS4Vjz8.js} +1 -1
  36. package/dist/web/assets/{Requirements-B-8D5JFY.js → Requirements-CtQLSXK2.js} +1 -1
  37. package/dist/web/assets/{Responsive-Dl4CLUoF.js → Responsive-KaTTxiwX.js} +1 -1
  38. package/dist/web/assets/{RunDiff-C2knd045.js → RunDiff-CpvrxBX1.js} +1 -1
  39. package/dist/web/assets/{Settings-Cmac0LZa.js → Settings-C5CTbhlT.js} +3 -3
  40. package/dist/web/assets/{SiteScan-D2WMUVcw.js → SiteScan-CUMCTEY9.js} +1 -1
  41. package/dist/web/assets/{Steps-DeZhIdc1.js → Steps-C440M1Y_.js} +1 -1
  42. package/dist/web/assets/{TestData-CDOvUmVT.js → TestData-7rivojlz.js} +1 -1
  43. package/dist/web/assets/{TestManagement-9CTQonHe.js → TestManagement-Dj5JHPIU.js} +1 -1
  44. package/dist/web/assets/{WhatsNew-BotUU9UF.js → WhatsNew-xAi2Rzo3.js} +1 -1
  45. package/dist/web/assets/{agentSettingsSheet-BEVtvrGk.js → agentSettingsSheet-D12LwTAe.js} +1 -1
  46. package/dist/web/assets/api-CorvgyDj.js +1 -0
  47. package/dist/web/assets/{dataParts-C5w2uvJZ.js → dataParts-CVXmPBpU.js} +1 -1
  48. package/dist/web/assets/{desktopAppPath-BN4vYVi4.js → desktopAppPath-D_PfQisd.js} +1 -1
  49. package/dist/web/assets/{flowTheme-dXvSLQHO.js → flowTheme-bdKXfQiL.js} +1 -1
  50. package/dist/web/assets/{frame-BANehQdX.js → frame-BC1vOowF.js} +3 -3
  51. package/dist/web/assets/{index-Db_tsLSf.js → index-BoFziUZw.js} +4 -4
  52. package/dist/web/assets/{nav-f8SqayfG.js → nav--1SY7-OO.js} +1 -1
  53. package/dist/web/assets/{pageBack-DU3mApVL.js → pageBack-DDAAmq4R.js} +1 -1
  54. package/dist/web/assets/{palette-D8aKJo_q.js → palette-C8W4Fd5n.js} +1 -1
  55. package/dist/web/assets/{parts-B0PK7ewd.js → parts-uc6us_OU.js} +1 -1
  56. package/dist/web/assets/{productParts-bcAIT4Ca.js → productParts-CAgJEF8_.js} +1 -1
  57. package/dist/web/assets/{qualityParts-C2Y38oFp.js → qualityParts-BF3Yb7Zl.js} +1 -1
  58. package/dist/web/assets/{recordTest-Cn4qoyRB.js → recordTest-KjXCSP7c.js} +1 -1
  59. package/dist/web/assets/{stepper-CEFz82T4.js → stepper-CZL9ueYn.js} +1 -1
  60. package/dist/web/assets/{wizardParts-CGHmp8or.js → wizardParts-Pzx0nTZ0.js} +1 -1
  61. package/dist/web/index.html +6 -6
  62. package/package.json +1 -1
  63. package/py/forgeqe_engine/capture.py +36 -8
  64. package/py/forgeqe_engine/d365.py +263 -3
  65. package/py/forgeqe_engine/recordsession.py +2 -1
  66. package/py/forgeqe_engine/webrecord.py +3 -0
  67. package/py/forgeqe_engine/webrecord_page.py +34 -5
  68. package/skills/dynamics-365-automation/SKILL.md +12 -0
  69. package/dist/web/assets/Record-BIa-SPuU.js +0 -1
  70. package/dist/web/assets/api-DS8XP38R.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,L as i,P as a,a as o,c as s,s as c,z as l}from"./surface-c1kG1KPS.js";import{n as u,t as d}from"./utils-DJRAScIl.js";import{t as f}from"./jsx-runtime-LKYXHABd.js";import{G as p,K as m,W as h}from"./palette-D8aKJo_q.js";import{d as g}from"./sectionList-B6NF3ZMb.js";import{T as _,X as v,b as y}from"./api-DS8XP38R.js";import{A as b,F as x,L as S,M as C,O as w,P as T,T as E,g as D,i as O,j as k,k as A}from"./pageBack-DU3mApVL.js";import{$t as j,B as ee,Cn as M,Cr as N,D as te,E as ne,En as P,Er as F,F as I,Fn as L,Gr as R,Gt as z,Hr as B,I as re,In as ie,Kn as ae,L as oe,Lr as se,N as ce,O as le,Or as ue,Pr as de,Rn as fe,Rt as pe,Sn as me,Sr as he,Tn as ge,U as _e,Un as V,Vn as ve,Wr as ye,Wt as be,Zn as xe,Zt as Se,a as Ce,cn as we,cr as Te,f as Ee,fn as De,ft as Oe,gr as ke,hn as Ae,i as je,kr as Me,ln as Ne,lt as Pe,mt as Fe,o as Ie,or as Le,pr as Re,rt as ze,s as Be,tt as Ve,un as He,ur as Ue,vr as We,w as H,wn as Ge,yn as Ke,yt as qe,z as Je,zn as Ye}from"./line-icons-Cwj9OmCz.js";import{G as Xe,Ht as U,J as Ze,On as Qe,Vt as $e,W as et,Y as tt,Z as nt,Zt as rt,ct as it,dt as at,ft as ot,it as W,lt as st,ot as G,rt as ct,ut as lt,v as ut}from"./frame-BANehQdX.js";import{u as dt}from"./nav-f8SqayfG.js";import{J as ft,K,V as pt,Y as mt,l as ht,n as gt,t as _t}from"./index-Db_tsLSf.js";import{t as vt}from"./step-mark-Bu6fNKW8.js";import{n as yt,r as bt,t as xt}from"./recordTest-Cn4qoyRB.js";import{t as St}from"./DeviceScreen-DDERg3YQ.js";import{n as Ct,t as wt}from"./desktopAppPath-BN4vYVi4.js";import{a as Tt,i as Et,n as Dt,o as Ot,r as kt,t as q}from"./DesktopReview-C02n70Wx.js";import{t as At}from"./radio-BLI4Ubhk.js";import{t as jt}from"./AgentWork-D1c_w9rM.js";var J=e(t(),1),Mt=.85;function Nt(e){return!!e&&e.width>0&&e.height>0&&e.width>=e.height*.8}function Pt(e){if(!e||!(e.width>0)||!(e.height>0))return[];let t=e.width*e.height*Mt;return(e.elements||[]).map((e,t)=>({c:e,i:t})).filter(({c:e})=>e.usable&&e.box.length===4&&e.box[2]>0&&e.box[3]>0&&e.box[2]*e.box[3]<t).sort((e,t)=>t.c.box[2]*t.c.box[3]-e.c.box[2]*e.c.box[3])}function Ft(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function It(e,t){return t===`mobile`&&/INVALID_APP_ID|app_id\b.*\binvalid|upload app API/i.test(e)?`The device cloud cannot install a build file from this computer. Upload it first (forgeqe mobile upload <file>), then set the app's build to the lt:// or bs:// id it gives, in Settings → Mobile.`:t===`mobile`&&/ECONNREFUSED|ECONNRESET|could not connect|not reachable|timed? ?out/i.test(e)?`Appium or the device cloud did not answer. Check that it is running (forgeqe mobile setup) or that the cloud's sign-in is saved, then try again.`:t===`mobile`&&/\b40[13]\b|unauthori[sz]ed|forbidden|access key/i.test(e)?`The device cloud refused the sign-in. Check its user name and key in Settings → Mobile.`:null}function Lt(e,t,n){if(!Number.isInteger(t)||!Number.isInteger(n)||t===n||t<1||n<1||t>=e.length||n>=e.length||e[t].fixed||e[t].block)return!1;let r=e.filter((e,n)=>n!==t);r.splice(n,0,e[t]);let i=r[n-1]?.block;return!(i&&i===r[n+1]?.block)}var Y=f(),Rt={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`},zt={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.`}},Bt=e=>`${Rt[e.type]||e.type}: ${e.value}`,Vt=[{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.`},{id:`date`,label:`A date from today`,note:`The same number of days ahead on each run, so a date that has passed is never used.`},{id:`any`,label:`Any free one`,note:`Each run takes the first free one (an open slot, or a list's first option that is not disabled); later checks compare with what it picked.`}],Ht=new Set([`data`,`date`,`any`]),Ut={label:`As clicked`,note:`The test clicks exactly this one.`},Wt=(e,t)=>e.op===`click`&&t===`typed`?Ut.label:Vt.find(e=>e.id===t)?.label,Gt=(e,t)=>e.op===`click`&&t===`typed`?Ut.note:Vt.find(e=>e.id===t)?.note,Kt=e=>{let t=e.value;return Vt.filter(n=>t.choices?t.choices.includes(n.id):e.op===`select`?n.id===`typed`||n.id===`data`:n.id!==`date`&&n.id!==`any`)},qt=[`steps`,`data`,`run`,`instructions`,`blocks`,`history`];function Jt({runDir:e,onClose:t,onRecordMore:n,notices:o,tab:s,onTab:c}){let[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(!1),[C,D]=(0,J.useState)(`steps`),O=c?qt.includes(s??``)?s:`steps`:C,k=e=>c?c(e):D(e),[j,ee]=(0,J.useState)(``),[M,te]=(0,J.useState)(!1),[P,L]=(0,J.useState)(null);(0,J.useEffect)(()=>L(null),[O,f]);let[z,B]=(0,J.useState)(null),[re,le]=(0,J.useState)(!1),[ue,de]=(0,J.useState)(null),[pe,he]=(0,J.useState)(null),[ge,_e]=(0,J.useState)(null),[V,xe]=(0,J.useState)(new Set),Se=e=>xe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[we,De]=(0,J.useState)({}),Oe=e=>we[e.n]??(!e.ok&&!e.skipped),[ke,Ae]=(0,J.useState)(null),[Me,Ie]=(0,J.useState)(``),[Le,ze]=(0,J.useState)(`all`),[He,We]=(0,J.useState)(null),[Ge,qe]=(0,J.useState)(!1),[Ye,Xe]=(0,J.useState)(``),[Ze,Qe]=(0,J.useState)(``),[et,it]=(0,J.useState)([]),[at,ot]=(0,J.useState)(void 0),[W,st]=(0,J.useState)({from:0,to:0,name:``,section:``}),[G,ct]=(0,J.useState)({block:``,after:0}),[lt,ut]=(0,J.useState)({values:{},secrets:{}}),[dt,ft]=(0,J.useState)([]),[K,pt]=(0,J.useState)(null),[ht,gt]=(0,J.useState)(null),[_t,vt]=(0,J.useState)(``),yt=et.filter(e=>(e.kind??`web`)===`web`),St=(e=>e?et.filter(t=>`${t.name} ${t.section??``} ${t.description??``}`.toLowerCase().includes(e)):et)(_t.trim().toLowerCase()),[Ct,wt]=(0,J.useState)(``),[q,At]=(0,J.useState)(null),[Mt,Nt]=(0,J.useState)(``),[Pt,Ft]=(0,J.useState)({}),It=(0,J.useRef)(null),[Rt,Bt]=(0,J.useState)(``),[Vt,Ut]=(0,J.useState)(``),[Jt,rn]=(0,J.useState)(null),[an,on]=(0,J.useState)(!1),[sn,cn]=(0,J.useState)(!1),[fn,mn]=(0,J.useState)(``),[gn,_n]=(0,J.useState)(!1),[vn,yn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(null),[Sn,Cn]=(0,J.useState)(``);(0,J.useEffect)(()=>{let t=!1;return v.review(e).then(e=>{t||(p(e),ee(e.name),Qe(e.instructions))},e=>!t&&g(e.message)),()=>{t=!0}},[e]),(0,J.useEffect)(()=>{v.blocks().then(e=>{it(e.blocks),ot(e.shared),ft(e.secrets??[]),ut(Et(e.blocks.find(e=>(e.kind??`web`)===`web`),e.secrets??[]))},()=>it([]))},[]),(0,J.useEffect)(()=>{let t=!1;return v.tryView(e).then(e=>{if(t)return;let n=new Map((It.current??[]).map(e=>[e.name,e.value]));It.current=e.data,At(e),Ft(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]!==void 0&&t[e.name]!==n.get(e.name)?t[e.name]:e.value])))},()=>{}),()=>{t=!0}},[e,f]);let wn=()=>v.review(e).then(e=>p(t=>t&&{...t,test:e.test}),()=>{}),Tn=f?.test?.state===`writing`||f?.test?.state===`checking`;(0,J.useEffect)(()=>{if(!Tn)return;let e=U(()=>void wn(),2500);return()=>$e(e)},[Tn,e]);let X=q?.running===e,En=q?.result?`${q.result.ms??0}-${q.result.env??``}-${q.result.steps.length}-${q.result.ok}`:``;(0,J.useEffect)(()=>De({}),[En]),(0,J.useEffect)(()=>{if(!X)return;let t=U(()=>{v.tryView(e).then(At,()=>{})},1500);return()=>$e(t)},[X,e]);let Dn=()=>Object.fromEntries(Object.entries(Pt).filter(([e,t])=>t!==q?.data.find(t=>t.name===e)?.value)),On=()=>Rt.startsWith(`file:`)?{file:Rt.slice(5),...Vt.trim()&&/\.xls[xm]$/i.test(Rt)?{sheet:Vt.trim()}:{}}:Rt.startsWith(`request:`)?{request:Rt.slice(8)}:void 0,kn=async t=>{g(``),on(!0);try{let n=await v.write(e,{check:t,env:Mt,data:Dn(),each:On()});p(e=>e&&{...e,test:n.test}),At(n.try),t&&rn(f)}catch(e){g(e.message)}finally{on(!1)}},An=async()=>{g(``),Cn(``),xn(null),yn(!1);try{let t=await v.tryRun(e,Mt,Dn(),On());rn(f),At(t)}catch(e){g(e.message)}},jn=async()=>{g(``),Cn(``),xn(null),yn(!0);try{let t=await v.reheal(e,Mt,Dn(),On());rn(f),At(t)}catch(e){g(e.message),yn(!1)}},Mn=async t=>{y(!0),g(``),Cn(``);try{let n=await v.acceptReheals(e,t);At(n.try),xn(n.heals),n.written?Cn(`${u(n.written,`step`)} now ${n.written===1?`uses`:`use`} the locator the re-record found.${n.skipped.length?` ${u(n.skipped.length,`heal`)} left: ${n.skipped[0].why}.`:``}`):g(`Nothing was changed: ${n.skipped[0]?.why??`those steps have no heal.`}`)}catch(e){g(e.message)}finally{y(!1)}},Nn=async()=>{g(``);try{At(await v.tryStop(e)),wn()}catch(e){g(e.message)}},Pn=async()=>{g(``),_n(!0);try{let t=await v.stopWrite(e);p(e=>e&&{...e,test:t.test})}catch(e){g(e.message)}finally{_n(!1)}},Fn=async()=>{y(!0),g(``),wt(``);try{let t=await v.saveBlock(e,W.name.trim(),W.from,W.to,W.section.trim());it(t.blocks);let n=t.block.inputs.length?` It takes ${t.block.inputs.map(e=>e.label||e.name).join(`, `)} each time it is used.`:``;wt(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.${n}`),st({...W,name:``})}catch(e){g(e.message)}finally{y(!1)}},In=async(t,n)=>{y(!0),g(``);try{let r=await v.updateBlock(t,n);it(r.blocks),pt(null),p(await v.review(e))}catch(e){g(e.message)}finally{y(!1)}},Ln=async e=>{y(!0),g(``);try{let t=await v.deleteBlock(e,ht?.id===e);it(t.blocks),gt(null),G.block!==e&&G.block||(ct({...G,block:``}),ut(Et(t.blocks.find(e=>(e.kind??`web`)===`web`),dt)))}catch(t){let n=t;n.status===409?gt({id:e,why:n.message}):g(n.message)}finally{y(!1)}},Z=async t=>{y(!0),g(``);try{let n=`restore`in t?await v.restoreReview(e,t.restore):`insert`in t?await v.insertBlock(e,t.insert.after,t.insert.block,t.insert.use&&Ot(t.insert.use)):`refreshBlock`in t?await v.refreshBlock(e,t.refreshBlock.block,t.refreshBlock.from):`useBlock`in t?await v.useBlock(e,t.useBlock.block,t.useBlock.from):await v.saveReview(e,t);p(n),ee(n.name),Qe(n.instructions)}catch(e){g(e.message)}finally{y(!1)}},Rn=async()=>{qe(!0),Xe(``);try{let t=await v.suggest(e);We(t.picks),Xe(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Xe(e.message)}finally{qe(!1)}},zn=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},Bn=async e=>{for(let t of e)await Z(zn(t));We(t=>(t||[]).filter(t=>!e.includes(t)))};if(!f)return m?(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:m}):(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Reading the recording…`});let Vn=f.steps.filter(e=>e.value),Hn=f.steps.filter(e=>e.kept),Un=f.steps.filter(e=>e.op===`expect`).length,Q=X?void 0:q?.result,Wn=new Map((Q?.steps??[]).map(e=>[e.n-1,e])),Gn=Q?.steps.find(e=>!e.ok),Kn=Gn?Gn.n-1:-1,qn=Kn>=0?f.steps[Kn]:void 0,Jn=!!Q&&!!Jt&&Jt!==f,Yn=(Q?.steps??[]).filter(e=>!e.ok).length,Xn=Me.toLowerCase().split(/\s+/).filter(Boolean),Zn=f.steps.filter(e=>Xn.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(Le===`all`||(Le===`checks`?e.op===`expect`:Wn.get(e.index)?.ok===!1))),Qn=e=>{k(`steps`),ze(`all`),Ie(``);let t=n=>requestAnimationFrame(()=>{let r=document.getElementById(`step-${e}`);r?r.scrollIntoView({block:`center`,behavior:l()}):n>0&&t(n-1)});t(30)},$n=!!q?.running&&!X,$=bt(f.test),er=()=>void kn(!(Q?.ok&&Jt===f)),tr=X&&!!q?.stopping,nr=an||$.writing,rr=[{id:`steps`,label:`Steps`,icon:Ne,n:f.steps.length},{id:`data`,label:`Test data`,icon:Ve,n:Vn.length+Hn.length},{id:`run`,label:`Runs`,icon:fe,...q?.runs?.length?{n:q.runs.length}:{}},{id:`instructions`,label:`Instructions`,icon:Ke},{id:`blocks`,label:`Blocks`,icon:Ee},{id:`history`,label:`Versions`,icon:be,n:f.history.length}];return(0,Y.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-4 border-b border-line bg-canvas px-1 py-4`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:t&&(0,Y.jsxs)(x,{size:`sm`,variant:`ghost`,onClick:t,className:`-ml-2 text-ink-2`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Recordings`]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-4`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[M?(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),te(!1),j.trim()&&j.trim()!==f.name&&Z({name:j.trim()})},children:[(0,Y.jsx)(a,{"aria-label":`Name of the recording`,value:j,maxLength:200,autoFocus:!0,onChange:e=>ee(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>{ee(f.name),te(!1)},children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}):(0,Y.jsx)(mt,{id:`review-title`,icon:I,title:(0,Y.jsx)(`span`,{"data-tip":f.name,children:f.name}),actions:(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>te(!0),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm text-muted`,children:[(0,Y.jsxs)(`span`,{children:[u(f.steps.length,`step`),` · `,u(Un,`check`)]}),X?(0,Y.jsx)(A,{tone:`running`,children:tr?`Stopping…`:`Running the steps…`}):Q?.stopped?(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Last run stopped`}):Q?(0,Y.jsx)(A,{tone:Q.ok?`pass`:`fail`,children:Q.ok?`Last run passed${Q.env?` on ${Q.env}`:``}`:Gn?`Last run failed at step ${Gn.n}`:`Last run did not get through`}):(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Not run yet`}),Jn&&(0,Y.jsx)(`span`,{children:`· you changed it since`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-body-sm`,"aria-label":`The test written from this recording`,children:[(0,Y.jsx)(A,{tone:$.tone,icon:$.tone!==`neutral`,children:$.label}),f.test?.testFile&&$.hasTest&&(0,Y.jsxs)(x,{variant:`link`,size:`inline`,onClick:async()=>mn(await xt(f.test.testFile)),"data-tip":`Open ${f.test.testFile}${f.test.repo?` in ${f.test.repo}`:``}`,className:`min-w-0 gap-1 font-mono`,children:[(0,Y.jsx)(Fe,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:f.test.testFile})]}),f.test&&!$.writing&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,nt(f.test.at)]}),(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:$.detail}),fn&&(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-fail [overflow-wrap:anywhere]`,children:fn})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[X?(0,Y.jsxs)(x,{busy:tr,variant:`destructive`,disabled:tr,onClick:()=>void Nn(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),tr?`Stopping…`:`Stop`]}):(0,Y.jsxs)(x,{disabled:$n||nr,onClick:()=>void An(),"data-tip":$n?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Re-run`]}),f.test?.state===`writing`?(0,Y.jsxs)(x,{busy:gn,variant:`destructive`,disabled:gn,onClick:()=>void Pn(),"data-tip":`Stop Quill: what it changed so far is kept, and Write carries on from there`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),gn?`Stopping…`:`Stop writing`]}):(0,Y.jsxs)(x,{busy:f.test?.state===`checking`,variant:$.hasTest&&!$.writing?`outline`:`primary`,disabled:_||X||$n||nr||$.writing,onClick:()=>$.hasTest?cn(!0):er(),"data-tip":$.writing?`A test is being written from this recording`:$.hasTest?`Update ${f.test?.testFile}: the steps are run first; when they work, Quill changes that test to match the recording`:`Write the test: the steps are run first; when they work, Quill writes the test in your repository's style`,children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),f.test?.state===`checking`?`Checking…`:an||$.writing?$.hasTest?`Updating…`:`Writing…`:$.hasTest?`Update the test`:`Write the test`]})]})]})]}),o,m&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:m}),Q&&!Q.ok&&(0,Y.jsxs)(`div`,{role:`alert`,className:d(S.fail,`flex flex-col gap-2`),children:[(0,Y.jsxs)(`p`,{className:`m-0 font-medium text-fail [overflow-wrap:anywhere]`,children:[Gn?`Step ${Gn.n} failed${Q.env?` on ${Q.env}`:``}`:`The run did not get through${Q.env?` on ${Q.env}`:``}`,Jn&&(0,Y.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),qn&&(0,Y.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:qn.line}),(0,Y.jsx)(`p`,{className:`m-0 line-clamp-3 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":(Gn?Gn.error:Q.error)||void 0,children:(Gn?Gn.error:Q.error)||(Gn?`It failed.`:`The last page was not the recorded one.`)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[qn&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>Qn(Kn),"data-tip":`Show the failed step`,children:[(0,Y.jsx)(Pe,{"aria-hidden":`true`}),`Show`]}),qn&&n&&Kn>0&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>n(Kn,!0),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),qn&&!qn.fixed&&(0,Y.jsxs)(x,{size:`sm`,variant:`danger`,disabled:_,onClick:()=>void Z({remove:[Kn]}),"data-tip":`Drop the failed step`,children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`ghost`,disabled:nr,onClick:()=>void kn(!1),"data-tip":`Write the test anyway`,children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),`Write`]})]})]}),f.test?.chat&&(0,Y.jsx)(jt,{id:f.test.chat,onEnd:()=>void wn(),label:$.hasTest?`Quill updating the test`:`Quill 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.`},f.test.chat),sn&&f.test?.testFile&&(0,Y.jsx)(rt,{open:!0,onClose:()=>cn(!1),title:`Update the test?`,description:`A test was already written from this recording: ${f.test.testFile}. Quill updates that test so it matches the recording as it is now. No second test is added.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(x,{variant:`outline`,onClick:()=>cn(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{variant:`primary`,onClick:()=>{cn(!1),er()},children:[(0,Y.jsx)(Re,{"aria-hidden":`true`}),`Update the test`]})]}),children:(0,Y.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-ink-2`,children:`The steps are played first; the test is changed only when they work.`})}),(e=>e.length>0&&(0,Y.jsxs)(`div`,{role:`status`,className:d(S.warn,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:F,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`The test reads `,e.length===1?`the secret`:`the secrets`,` `,e.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t>0&&`, `,(0,Y.jsx)(`code`,{children:e})]},e)),`, which `,e.length===1?`has`:`have`,` no value on this computer: save `,e.length===1?`it`:`them`,` in Settings › Secrets, or runs of this recording stop at that step.`]})]}))((f.secrets??[]).filter(e=>!e.set).map(e=>e.name)),f.blocksStale?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:d(S.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:Ee,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are `,e.version?`version ${e.version}`:`an older version`,` of the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:e.name}),`; version `,e.latest,` is saved now.`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Z({refreshBlock:{block:e.block,from:e.from}}),"data-tip":`Put the saved version in their place, with the same values`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Update`]})]},`stale-${e.block}-${e.from}`)),f.blocksFound?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:d(S.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:Ee,size:16,className:`flex-none`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:e.name}),`: the test can call its helper instead.`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Z({useBlock:{block:e.block,from:e.from}}),"data-tip":`Use the block: the test calls its helper instead`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Use`]})]},`${e.block}-${e.from}`)),(0,Y.jsx)(tt,{prefix:`rev`,label:`This recording`,className:`mb-0`,current:O,onPick:k,tabs:rr.map(e=>({id:e.id,label:e.label,...e.id===`run`&&Q?{n:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e.n!==void 0&&e.n,Q.ok?(0,Y.jsx)(ce,{size:12,role:`img`,"aria-label":`passed`,className:`text-pass`}):(0,Y.jsx)(Je,{size:12,role:`img`,"aria-label":`failed`,className:`text-fail`})]})}:e.n===void 0?{}:{n:e.n}}))}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${O}`,"aria-labelledby":`rev-${O}`,className:`flex min-w-0 flex-col gap-4`,children:[O===`steps`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(w,{id:`rev-step-search`,label:`Find a step`,value:Me,onChange:Ie}),(0,Y.jsx)(E,{items:[{id:`all`,label:`All`,n:f.steps.length},{id:`checks`,label:`Checks`,n:Un},...Yn?[{id:`failed`,label:`Failed`,n:Yn,alert:!0}]:[]],value:Le,onChange:ze}),(0,Y.jsx)(`span`,{className:`flex-1`}),(0,Y.jsxs)(x,{busy:Ge,size:`sm`,variant:`ghost`,disabled:Ge||_,onClick:()=>void Rn(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,Y.jsx)(se,{"aria-hidden":`true`}),Ge?`Asking…`:`Suggest`]})]}),(f.videos?.includes(`recording`)||f.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f.videos?.includes(`recording`)&&(0,Y.jsx)(Xt,{runDir:e,kind:`recording`}),f.log&&(0,Y.jsx)(Zt,{runDir:e,which:`recording`,label:`Recording log`})]}),Ye&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:Ye}),He&&He.length>0&&(0,Y.jsxs)(`div`,{className:d(S.info,`flex flex-col gap-2`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-body-sm`,children:[(0,Y.jsx)(T,{icon:Te,size:14}),(0,Y.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,Y.jsxs)(x,{size:`sm`,disabled:_,onClick:()=>void Bn(He),"data-tip":`Add all the suggestions`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add all`]}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>We(null),className:`size-8`,children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:He.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-body-sm`,children:[(0,Y.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,Y.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void Bn([e]),className:`size-8`,children:(0,Y.jsx)(ve,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),Zn.length===0?(0,Y.jsx)(`p`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 text-body-sm text-muted`),children:`No step matches.`}):(0,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col overflow-hidden p-0`),children:Zn.map((t,r)=>{let i=Wn.get(t.index),a=t.op===`expect`;return(0,Y.jsxs)(`li`,{id:`step-${t.index}`,className:d(`flex scroll-mt-48 flex-col`,r>0&&`border-t border-line-soft`,i&&!i.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-4 px-4 py-2`,children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right font-mono text-body-sm text-muted tabular-nums`,children:t.index+1}),(0,Y.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:i?i.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):i.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):a?(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[a&&(0,Y.jsx)(A,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-body-sm`,children:`Check`}),(0,Y.jsx)(`span`,{className:`min-w-0 text-body-sm text-ink [overflow-wrap:anywhere]`,children:t.line}),t.block&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[(0,Y.jsx)(T,{icon:Ee,size:11}),et.find(e=>e.id===t.block)?.name||t.block]})]}),t.value&&(0,Y.jsx)(pn,{step:t,busy:_,open:ue===t.index,onOpen:e=>de(e?t.index:null),sources:Kt(t),onSave:e=>void Z(e)},dn(t)),t.note&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Note: `,t.note]}),(e=>{if(!e?.risk)return null;let n=(t.locators?.length??0)>1&&!!t.detail?.length,r=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{icon:F,size:12,className:`mt-px flex-none`}),(0,Y.jsxs)(`span`,{children:[`This step is found by `,zt[e.risk].found,`.`,n?` Pick another way to find it.`:``]})]});return n?(0,Y.jsx)(x,{variant:`link`,size:`inline`,"aria-expanded":V.has(t.index),onClick:()=>Se(t.index),className:`items-start gap-1 self-start whitespace-normal text-left text-warn hover:text-warn`,children:r}):(0,Y.jsx)(`span`,{className:`inline-flex items-start gap-1 self-start text-body-sm text-warn`,children:r})})(t.locators?.find(e=>e.chosen)),i&&!i.ok&&i.error&&(0,Y.jsx)(`span`,{className:`line-clamp-2 text-body-sm text-fail [overflow-wrap:anywhere]`,"data-tip":i.error,children:i.error}),t.suggest&&t.suggest.length>0&&(0,Y.jsxs)(x,{variant:`link`,size:`inline`,"aria-expanded":ke===t.index,onClick:()=>Ae(ke===t.index?null:t.index),className:`gap-1 self-start`,children:[(0,Y.jsx)(T,{icon:Te,size:12}),ke===t.index?`Hide the suggested checks`:`${u(t.suggest.length,`suggested check`)}`]})]}),(0,Y.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[t.start&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-expanded":re,"aria-label":`Change the start page`,"data-tip":`Change the start page`,onClick:()=>le(!re),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`menu`,"aria-expanded":z===t.index,"aria-label":`Add a check, step, note${et.length?` or block`:``} after step ${t.index+1}`,"data-tip":`Add a check, step, note${et.length?` or block`:``} after step ${t.index+1}`,onClick:()=>B(z===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(ve,{"aria-hidden":`true`})}),(0,Y.jsx)(h,{open:z===t.index,onClose:()=>B(null),label:`Add after step ${t.index+1}`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(un,{step:t,blocks:yt,secrets:dt,onAddBlock:(e,n)=>{B(null),Z({insert:{after:t.index,block:e,use:n}})},...n?{onRecordMore:()=>{B(null),n(t.index)}}:{},onAdd:e=>{B(null),Z(e)}})}),t.check&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`dialog`,"aria-expanded":ge===t.index,"aria-label":`Change how check ${t.index+1} compares`,"data-tip":`Change how check ${t.index+1} compares`,onClick:()=>_e(ge===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(h,{open:ge===t.index,onClose:()=>_e(null),label:`How check ${t.index+1} compares`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(ln,{check:t.check,onSave:e=>{_e(null),Z({matches:[{index:t.index,...e}]})}})})]}),t.detail&&t.detail.length>0&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`What was recorded for step ${t.index+1}`,"aria-expanded":V.has(t.index),"data-tip":`What was recorded for step ${t.index+1}`,onClick:()=>Se(t.index),className:`size-8`,children:(0,Y.jsx)(ne,{"aria-hidden":`true`,className:d(`transition-transform`,V.has(t.index)&&`rotate-180`)})}),t.shot&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.index+1}`,"aria-expanded":pe===t.index,"data-tip":`See the page after step ${t.index+1}`,onClick:()=>he(pe===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})}),!t.fixed&&!t.block&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_||!Lt(f.steps,t.index,t.index-1),"aria-label":`Move step ${t.index+1} up`,"data-tip":`Move step ${t.index+1} up`,onClick:()=>void Z({move:{index:t.index,to:t.index-1}}),className:`size-8`,children:(0,Y.jsx)(Be,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_||!Lt(f.steps,t.index,t.index+1),"aria-label":`Move step ${t.index+1} down`,"data-tip":`Move step ${t.index+1} down`,onClick:()=>void Z({move:{index:t.index,to:t.index+1}}),className:`size-8`,children:(0,Y.jsx)(je,{"aria-hidden":`true`})})]}),!t.fixed&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Drop step ${t.index+1}`,"data-tip":`Drop step ${t.index+1}`,onClick:()=>void Z({remove:[t.index]}),className:`size-8`,children:(0,Y.jsx)(N,{"aria-hidden":`true`})})]})]}),re&&t.start&&(0,Y.jsx)(hn,{start:t.start,busy:_,onCancel:()=>le(!1),onSave:(e,t)=>{le(!1),Z({start:{url:e,site:t}})}},t.start),ke===t.index&&t.suggest&&t.suggest.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pr-4 pb-2 pl-4 sm:pl-20`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`Add a check that`}),t.suggest.map(e=>(0,Y.jsxs)(x,{size:`sm`,disabled:_,"data-tip":`Add this check after the step`,onClick:()=>void Z({checks:[{after:t.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-body-sm`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),V.has(t.index)&&t.detail&&(0,Y.jsx)(tn,{rows:t.detail,n:t.index+1,locators:t.locators,busy:_,onPick:e=>void Z({locator:[{index:t.index,pick:e}]})}),pe===t.index&&t.shot&&t.snap&&(0,Y.jsx)(nn,{runDir:e,step:t,busy:_,onPick:(e,n,r)=>void Z({checks:[{after:t.index,kind:e,text:n,...r===void 0?{}:{frame:r}}]})})]},`${t.index}-${t.line}`)})})]}),O===`data`&&Hn.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Values read off the page while the test runs, kept under a name for the steps after them.`}),(0,Y.jsx)(`ul`,{"aria-label":`Values the test keeps`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Hn.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`Kept as `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:`{{${e.kept}}}`})]})]})]},e.index))})]}),O===`data`&&(Vn.length===0?Hn.length>0?null:(0,Y.jsx)(b,{className:`py-4`,children:`Nothing was typed, chosen or clicked as data in this recording, so it has no test data.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`Where each value you typed, chose or clicked comes from when the test runs. A slot or a day that cannot be used twice can be any free one or a date from today.`}),(0,Y.jsx)(`ul`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Vn.map((e,t)=>{let n=e.value,i=Kt(e);return(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:Gt(e,n.as)}),(0,Y.jsx)(pn,{step:e,busy:_,onSave:e=>void Z(e)},dn(e)),n.name&&Ht.has(n.as)&&P?.index!==e.index&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-body-sm text-ink-2`,children:[`Named `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:n.name}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Rename ${n.name}`,"data-tip":`Rename ${n.name}`,disabled:_,onClick:()=>L({index:e.index,name:n.name}),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})]}),P?.index===e.index&&(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault();let r=P.name.trim();L(null),r&&r!==n.name&&Z({data:[{index:e.index,as:n.as,name:r}]})},children:[(0,Y.jsx)(a,{"aria-label":`Name of the value of step ${e.index+1}`,value:P.name,maxLength:40,autoFocus:!0,placeholder:`lower_case_name`,onChange:e=>L({...P,name:e.target.value}),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>L(null),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]})]}),(0,Y.jsx)(r,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:_,onChange:t=>void Z({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:i.map(t=>(0,Y.jsx)(`option`,{value:t.id,children:Wt(e,t.id)},t.id))})]},e.index)})})]})),O===`run`&&q&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-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. Re-record plays them the same way, but a control that moved is reached through another locator the recorder kept for that step, and you choose whether the recording takes it.`}),(0,Y.jsxs)(`form`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-end gap-4`),onSubmit:e=>{e.preventDefault(),An()},children:[q.environments.length>0&&(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Environment`,(0,Y.jsxs)(r,{value:Mt,onChange:e=>Nt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Where it was recorded`}),q.environments.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[e,e===q.environment?` (active)`:``]},e))]})]}),q.data.length>0&&!!(q.sources?.files.length||q.sources?.requests.length)&&(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Test data`,(0,Y.jsxs)(r,{value:Rt,onChange:e=>Bt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The values typed here`}),!!q.sources?.files.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a data file`,children:q.sources.files.map(e=>(0,Y.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!q.sources?.requests.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a kept request`,children:q.sources.requests.map(e=>(0,Y.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(Rt)&&(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Sheet`,(0,Y.jsx)(a,{value:Vt,maxLength:100,placeholder:`The first sheet`,onChange:e=>Ut(e.target.value)})]}),!Rt&&q.data.map(e=>(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[(0,Y.jsxs)(`span`,{children:[e.name,e.env&&(0,Y.jsx)(`span`,{className:`font-normal text-muted`,children:` · from the environment`})]}),(0,Y.jsx)(a,{value:Pt[e.name]??``,maxLength:300,onChange:t=>Ft({...Pt,[e.name]:t.target.value})})]},e.name)),(0,Y.jsxs)(x,{type:`submit`,disabled:X||$n||nr||_,"data-tip":$n?`Another run is going`:void 0,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),X&&!vn?`Running…`:`Re-run`]}),(0,Y.jsxs)(x,{disabled:X||$n||nr||_,onClick:()=>void jn(),"data-tip":$n?`Another run is going`:`Play the steps and reach a control that moved through another of its recorded locators`,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),X&&vn?`Re-recording…`:`Re-record`]})]}),Rt&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`The steps play once for each row (up to 20), one after another. A column named like the test data (`,q.data.map(e=>e.name).join(`, `),`) gives its value; other columns are left out.`]}),X&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(A,{tone:`running`,children:tr?`Stopping: closing the browser…`:vn?`Playing the steps, healing a control that moved…`:`Playing the steps in a new browser…`}),(0,Y.jsxs)(x,{busy:tr,variant:`destructive`,disabled:tr,onClick:()=>void Nn(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),tr?`Stopping…`:`Stop`]})]}),!X&&!Q&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Not run yet.`}),Q&&(0,Y.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:d(`m-0 text-body-sm font-medium [overflow-wrap:anywhere]`,Q.ok?`text-pass`:Q.stopped?`text-ink-2`:`text-fail`),children:Q.stopped?Q.rows?`Stopped after ${u(Q.rows.length,`row`)}${Q.env?` on ${Q.env}`:``}.`:`Stopped after ${u(Q.steps.filter(e=>!e.skipped).length,`step`)}${Q.env?` on ${Q.env}`:``}.`:Q.rows?Q.ok?`All ${Q.rows.length} rows passed${Q.env?` on ${Q.env}`:``}${Q.ms?` in ${Math.round(Q.ms/1e3)}s`:``}. The steps below are row ${Q.rows.at(-1)?.n}'s.`:Q.rows.some(e=>!e.ok)?`${Q.rows.filter(e=>!e.ok).length} of ${Q.rows.length} rows failed${Q.env?` on ${Q.env}`:``}. The steps below are row ${Q.rows.find(e=>!e.ok)?.n}'s.`:`It did not get through${Q.env?` on ${Q.env}`:``}: ${Q.error||`no row was played`}`:Q.ok?`All ${Q.steps.length} steps passed${Q.env?` on ${Q.env}`:``}${Q.ms?` in ${Math.round(Q.ms/1e3)}s`:``}.`:Gn?`Step ${Gn.n} failed${Q.env?` on ${Q.env}`:``}.`:`It did not get through${Q.env?` on ${Q.env}`:``}: ${Q.error||`the last page was not the recorded one`}`}),(()=>{let e=bn??Q.heals??[],t=e.filter(e=>!e.accepted);return e.length?(0,Y.jsxs)(Y.Fragment,{children:[t.length>0&&(0,Y.jsxs)(`div`,{className:d(S.info,`flex flex-wrap items-center gap-4`),children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`The re-record found `,u(t.length,`moved control`),` and reached `,t.length===1?`it`:`them`,` by another locator the recorder kept: use `,t.length===1?`it`:`them`,` in the recording?`]}),(0,Y.jsxs)(x,{busy:_,size:`sm`,disabled:_||X||nr,onClick:()=>void Mn(t.map(e=>e.index)),"data-tip":`Make each healed locator the one its step uses`,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),_?`Accepting…`:`Accept`]})]}),(0,Y.jsx)(`ol`,{"aria-label":`Controls that moved`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:e.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.index}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.action}),(0,Y.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`was `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:e.from}),`, now `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:e.to})]}),e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.accepted&&(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-pass`,children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`}),`In the recording`]})]})]},e.index))})]}):null})(),Sn&&(0,Y.jsx)(`p`,{role:`status`,className:d(S.pass,`m-0`),children:Sn}),Q.rows&&(0,Y.jsx)(`ol`,{"aria-label":`Rows of ${Q.from||`the test data`}`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:Q.rows.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.label||`Row ${e.n}`}),!e.ok&&e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))}),Q.steps.length>0&&(0,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0 text-body-sm`),children:Q.steps.map((t,n)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col`,n>0&&`border-t border-line-soft`,!t.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 px-4 py-2`,children:[t.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):t.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:t.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[t.action,t.skipped?(0,Y.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!t.ok&&t.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]}),(0,Y.jsx)(`span`,{className:`flex-1`}),t.shot&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.n} of the run`,"aria-expanded":Oe(t),"data-tip":`See the page after step ${t.n} of the run`,onClick:()=>De({...we,[t.n]:!Oe(t)}),className:`size-8 flex-none`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})})]}),t.shot&&Oe(t)&&(0,Y.jsx)(en,{runDir:e,n:t.n,failed:!t.ok},`${Q.ms??0}-${t.n}`)]},t.n))})]}),Q&&(Q.video||Q.trace||Q.network||q.runs?.[0]?.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Q.video&&(0,Y.jsx)(Xt,{runDir:e,kind:`try`}),q.runs?.[0]?.log&&(0,Y.jsx)(Zt,{runDir:e,which:q.runs[0].log,label:`Re-run log`}),Q.trace&&(0,Y.jsx)($t,{runDir:e}),Q.network&&(0,Y.jsx)(Qt,{runDir:e})]}),(q.runs?.length??0)>1&&(0,Y.jsx)(Yt,{runDir:e,runs:q.runs.slice(1)})]}),O===`instructions`&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium text-ink`,children:[`Instructions for Quill`,(0,Y.jsx)(`span`,{className:`text-body-sm 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,Y.jsx)(i,{value:Ze,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>Qe(e.target.value),onBlur:()=>Ze.trim()!==f.instructions&&void Z({instructions:Ze.trim()}),className:`font-normal`})]}),O===`blocks`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-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. Quill writes each block once, as a helper every test calls.`}),at===!0&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:`They are kept in .forgeqe/blocks/ and go into the repository with your next commit, so the team shares them.`}),at===!1&&(0,Y.jsxs)(`p`,{className:d(S.warn,`m-0`),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,Y.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,Y.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-4`),children:[(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),W.name.trim()&&Fn()},children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Keep steps`,(0,Y.jsx)(r,{"aria-label":`The first step of the block`,value:W.from,onChange:e=>st({...W,from:Number(e.target.value),to:Math.max(W.to,Number(e.target.value))}),className:`w-[84px]`,children:f.steps.map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`to`,(0,Y.jsx)(r,{"aria-label":`The last step of the block`,value:W.to,onChange:e=>st({...W,to:Number(e.target.value)}),className:`w-[84px]`,children:f.steps.filter(e=>e.index>=W.from).map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`as the block`,(0,Y.jsx)(a,{value:W.name,maxLength:80,placeholder:`Sign in`,onChange:e=>st({...W,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[140px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`in the section`,(0,Y.jsx)(a,{value:W.section,maxLength:40,placeholder:`Account`,list:`rev-block-sections`,onChange:e=>st({...W,section:e.target.value})}),(0,Y.jsx)(`datalist`,{id:`rev-block-sections`,children:[...new Set(et.flatMap(e=>e.section?[e.section]:[]))].map(e=>(0,Y.jsx)(`option`,{value:e},e))})]}),(0,Y.jsxs)(x,{type:`submit`,disabled:_||!W.name.trim(),"data-tip":`Keep as a block`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Keep`]})]}),Ct&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-pass`,children:Ct}),yt.length>0&&(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 pt-4`,onSubmit:e=>{e.preventDefault();let t=G.block||yt[0].id,n=yt.find(e=>e.id===t);n&&Tt(n,lt)&&Z({insert:{after:G.after,block:n.id,use:lt}})},children:[(0,Y.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Put in the block`,(0,Y.jsx)(r,{"aria-label":`The block to put in`,value:G.block||yt[0].id,onChange:e=>{ct({...G,block:e.target.value}),ut(Et(yt.find(t=>t.id===e.target.value),dt))},children:yt.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`after step`,(0,Y.jsx)(r,{"aria-label":`The step the block goes after`,value:G.after,onChange:e=>ct({...G,after:Number(e.target.value)}),className:`w-[84px]`,children:f.steps.map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(x,{type:`submit`,disabled:_||!Tt(yt.find(e=>e.id===(G.block||yt[0].id)),lt),"data-tip":`Put the block in after the step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]}),(e=>e&&e.inputs.length>0?(0,Y.jsxs)(`div`,{className:`flex basis-full flex-col gap-2`,children:[(0,Y.jsx)(kt,{block:e}),(0,Y.jsx)(Dt,{block:e,secrets:dt,use:lt,onChange:ut,disabled:_})]}):null)(yt.find(e=>e.id===(G.block||yt[0].id)))]})]}),et.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(w,{id:`rev-block-search`,label:`Find a block`,value:_t,onChange:e=>{vt(e),gt(null)}})}),St.length===0&&(0,Y.jsx)(`p`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 text-body-sm text-muted`),children:`No block matches.`}),[...St.reduce((e,t)=>e.set(t.section??``,[...e.get(t.section??``)??[],t]),new Map)].map(([e,t])=>(0,Y.jsxs)(`section`,{"aria-label":e||`No section`,className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`h3`,{className:`m-0 text-body-sm font-medium text-ink-2`,children:e||`No section`}),(0,Y.jsx)(`ul`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:t.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[K?.id===e.id?(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),In(e.id,{name:K.name,section:K.section,description:K.description})},children:[(0,Y.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Name`,(0,Y.jsx)(a,{value:K.name,maxLength:80,onChange:e=>pt({...K,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[120px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`Section`,(0,Y.jsx)(a,{value:K.section,maxLength:40,list:`rev-block-sections`,onChange:e=>pt({...K,section:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-[200px] flex-[2_1_200px] flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`What it does`,(0,Y.jsx)(a,{value:K.description,maxLength:300,onChange:e=>pt({...K,description:e.target.value})})]}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:_||!K.name.trim(),"data-tip":`Save the block as a new version`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>pt(null),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}):(0,Y.jsxs)(`div`,{className:`flex items-start gap-x-4`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:[e.name,` `,(0,Y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`v`,e.version,` · `,u(e.steps,`step`),e.kind&&e.kind!==`web`?` · ${e.kind===`desktop`?`desktop app`:`mobile app`}${e.app?` ${e.app}`:``}`:``]})]}),e.description&&(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.description}),e.inputs.length>0&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Takes `,e.inputs.map(e=>`${e.label||e.name}${e.kind===`data`?``:` (secret)`}`).join(`, `)]})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Change the block ${e.name}`,"data-tip":`Change the block ${e.name}`,onClick:()=>pt({id:e.id,name:e.name,section:e.section??``,description:e.description??``}),className:`size-8`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})}),(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":ht?.id===e.id?`Delete the block ${e.name} anyway`:`Delete the block ${e.name}`,"data-tip":ht?.id===e.id?`Delete it anyway`:`Delete the block ${e.name}`,onClick:()=>void Ln(e.id),className:`size-8`,children:(0,Y.jsx)(N,{"aria-hidden":`true`})})]})]}),ht?.id===e.id&&(0,Y.jsxs)(`p`,{className:d(S.warn,`m-0`),children:[ht.why,` Click delete again to delete it anyway.`]})]},e.id))})]},e||`-`))]})]}),O===`history`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(T,{icon:be,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,Y.jsx)(`ol`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:[...f.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[(0,Y.jsxs)(`span`,{className:`w-8 flex-none font-mono text-body-sm text-muted tabular-nums`,children:[`v`,e.n]}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[nt(e.at),` · `,u(e.steps,`step`)]})]}),t===0?(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:`Now`}):(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Go back to v${e.n}`,"data-tip":`Go back to v${e.n}`,onClick:()=>void Z({restore:e.n}),className:`size-8`,children:(0,Y.jsx)(ae,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function Yt({runDir:e,runs:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),o=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,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(T,{icon:be,size:15}),`Earlier runs, newest first. Only the latest run keeps its pictures, video and trace; each keeps its log.`]}),i&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:i}),(0,Y.jsx)(`ol`,{"aria-label":`Earlier runs`,className:d(s,`m-0 flex list-none flex-col p-0`),children:t.map((t,i)=>(0,Y.jsxs)(`li`,{className:d(`flex flex-col`,i>0&&`border-t border-line-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2`,children:[t.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`flex-none text-pass`}):t.stopped?(0,Y.jsx)(me,{size:14,"aria-label":`Stopped`,className:`flex-none text-muted`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`flex-none text-fail`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,Y.jsx)(`span`,{className:d(`text-body-sm [overflow-wrap:anywhere]`,t.ok||t.stopped?`text-ink`:`text-fail`),children:o(t)}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[nt(t.at),t.env?` · on ${t.env}`:``,t.ms?` · ${Math.round(t.ms/1e3)}s`:``,t.why===`write`?` · before writing the test`:``]})]}),t.log&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Open the log of the run ${nt(t.at)} in a new tab`,"data-tip":`Open the log of the run ${nt(t.at)} in a new tab`,onClick:async()=>a(await k(t.log,()=>v.openLog(e,t.log))),className:`size-8 flex-none`,children:(0,Y.jsx)(xe,{"aria-hidden":`true`})}),t.steps.length>0&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`See the steps of the run ${nt(t.at)}`,"aria-expanded":n===t.at,"data-tip":`See the steps of the run ${nt(t.at)}`,onClick:()=>r(n===t.at?null:t.at),className:`size-8 flex-none`,children:(0,Y.jsx)(Pe,{"aria-hidden":`true`})})]}),n===t.at&&(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col border-t border-line-soft p-0 text-body-sm`,children:t.steps.map((e,t)=>(0,Y.jsxs)(`li`,{className:d(`flex items-start gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,Y.jsx)(me,{size:14,"aria-label":`Not replayed`,className:`mt-1 flex-none text-muted`}):e.ok?(0,Y.jsx)(H,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(R,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-1 flex-none text-fail`}),(0,Y.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-body-sm text-muted tabular-nums`,children:e.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,Y.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]},t.at))})]})}function Xt({runDir:e,kind:t}){let[n,r]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"data-tip":`Open the video of ${t===`try`?`the re-run`:`the recording`} in a new tab`,onClick:async()=>r(await k(t,()=>v.openVideo(e,t))),children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),t===`try`?`Re-run video`:`Recording video`]}),n&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:n})]})}function Zt({runDir:e,which:t,label:n}){let[r,i]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"data-tip":`Open the ${n.toLowerCase()} in a new tab`,onClick:async()=>i(await k(t,()=>v.openLog(e,t))),children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),n]}),r&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:r})]})}function Qt({runDir:e}){let t=e.split(/[\\/]/).filter(Boolean).pop()||``;return t?(0,Y.jsxs)(x,{"data-tip":`Make API tests from the calls the app made in this re-run, with their payloads and answers`,onClick:()=>location.hash=n(`api-tests`,encodeURIComponent(`new:${t}/tries`)),children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`}),`API tests from its calls`]}):null}function $t({runDir:e}){let[t,n]=(0,J.useState)(``);return(0,Y.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(x,{"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 k(`trace.zip`,()=>v.openTrace(e))),children:[(0,Y.jsx)(qe,{"aria-hidden":`true`}),`Trace`]}),t&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:t})]})}function en({runDir:e,n:t,failed:n}){let[r,i]=(0,J.useState)(``),[a,s]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let n=!1;return v.tryShot(e,t).then(e=>!n&&i(e),()=>!n&&s(!0)),()=>{n=!0}},[e,t]);let c=n?`The page when step ${t} of the run failed`:`The page after step ${t} of the run`;return(0,Y.jsx)(`div`,{className:`px-4 pb-4 sm:pl-14`,children:a?(0,Y.jsx)(`p`,{className:d(o,`m-0 px-4 py-6 text-center text-body-sm text-muted`),children:`No screenshot`}):r?(0,Y.jsx)(`img`,{src:r,alt:c,className:d(o,`max-h-[420px] w-full max-w-[720px] object-contain object-top`)}):(0,Y.jsx)(`div`,{className:d(o,`min-h-24 max-w-[720px]`)})})}function tn({rows:e,n:t,locators:n,busy:i,onPick:a}){let o=n?.find(e=>e.chosen);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[n&&n.length>1&&a&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium text-ink-2`,children:[`How step `,t,` finds its element`,(0,Y.jsx)(r,{value:String(o?.pick??n[0].pick),disabled:i,onChange:e=>a(Number(e.target.value)),"aria-describedby":o?.risk?`step-${t}-locator-risk`:void 0,className:`max-w-[560px]`,children:n.map(e=>(0,Y.jsxs)(`option`,{value:e.pick,children:[Bt(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))})]}),o?.risk&&(0,Y.jsx)(`span`,{id:`step-${t}-locator-risk`,className:`text-body-sm text-warn`,children:zt[o.risk].alone})]}),(0,Y.jsx)(`dl`,{"aria-label":`What was recorded for step ${t}`,className:d(c,`m-0 grid grid-cols-1 gap-x-6 gap-y-1 text-body-sm sm:grid-cols-[170px_minmax(0,1fr)] sm:gap-y-2`),children:e.map((e,t)=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e.label}),(0,Y.jsx)(`dd`,{className:d(`m-0 text-ink [overflow-wrap:anywhere]`,e.code&&`font-mono text-body-sm`),children:e.value})]},`${t}-${e.label}`))})]})}function nn({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(``);(0,J.useEffect)(()=>{let n=!1;return v.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,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:o}),!i&&!o&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading the picture…`}),i&&(0,Y.jsxs)(`div`,{className:d(`rounded-base bg-surface-muted object-cover`,`relative w-full max-w-[720px] overflow-hidden`),style:{aspectRatio:`${c.w} / ${c.h}`},children:[(0,Y.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,Y.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t,e.f),className:`absolute rounded-sm 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`,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 rn=[[`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`]],an=[[`eq`,`=`],[`gt`,`>`],[`gte`,`≥`],[`lt`,`<`],[`lte`,`≤`],[`between`,`between`]],on=[[`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`]],sn=/^[A-Za-z_][\w:.-]{0,60}$/,cn=e=>{let t=e.replace(/\u00a0/g,` `).match(/-?\d{1,3}(?:,\d{3})+(?:\.\d+)?|-?\d+(?:\.\d+)?/);return t?t[0].replace(/,/g,``):``};function ln({check:e,onSave:t}){let n=e.match,i=e.was??e.kind,[o,s]=(0,J.useState)(e.kind),[c,l]=(0,J.useState)(e.attr??``),[u,d]=(0,J.useState)(n?.how??(e.kind===`count`?`number`:`contains`)),[f,p]=(0,J.useState)(n?.text??(e.kind===`attribute`?``:e.text)),[m,h]=(0,J.useState)(!!n?.ci),[g,_]=(0,J.useState)(n?.op??(e.kind===`count`?`gte`:`eq`)),[v,y]=(0,J.useState)(n?.min===void 0?e.kind===`count`?`1`:cn(e.text):String(n.min)),[b,S]=(0,J.useState)(n?.max===void 0?``:String(n.max)),C=e=>e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,w=(()=>{try{return new RegExp(f),!0}catch{return!1}})(),T=o===`count`?`number`:[`text`,`value`,`attribute`,`url`,`title`].includes(o)?`text`:`none`,E=T===`number`?`number`:u,D=o!==`attribute`||sn.test(c),O=E===`number`?C(v)===void 0||g===`between`&&(C(b)===void 0||C(b)<C(v))?void 0:{how:E,op:g,min:C(v),...g===`between`?{max:C(b)}:{}}:!f.trim()||E===`regex`&&(!w||f.length>200)?void 0:{how:E,text:f.trim(),...m?{ci:!0}:{}},k=D&&(T===`none`||O!==void 0&&(o!==`attribute`||O.how!==`number`)),A=e.element&&o!==e.kind,j=e.kind===`value`?`The field's value`:e.kind===`url`?`The page address`:e.kind===`title`?`The page title`:`The text`;return(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:n=>{if(n.preventDefault(),!k)return;let r=T===`none`?null:O;if(!A&&o===i&&(o===`text`||o===`value`)&&r&&r.how===`contains`&&!r.ci&&r.text===e.text)return t({match:null});t(e.element?{match:r,kind:o,...o===`attribute`?{attr:c}:{}}:{match:r})},children:[e.element&&(0,Y.jsx)(r,{value:o,"aria-label":`What to check`,onChange:t=>{let r=t.target.value;if(s(r),r===`count`?(d(`number`),o!==`count`&&(_(`gte`),y(`1`))):u===`number`&&r===`attribute`&&d(`equals`),r===`attribute`&&o!==`attribute`&&p(e.kind===`attribute`?n?.text??``:``),(r===`text`||r===`value`)&&o!==r){let t=e.kind===`text`||e.kind===`value`?n:void 0;d(t?.how??`contains`),p(t?.text??e.text),h(!!t?.ci),_(t?.op??`eq`),y(t?.min===void 0?cn(e.text):String(t.min)),S(t?.max===void 0?``:String(t.max))}},children:on.filter(([e])=>e===`text`||e===`value`?e===i:!0).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),o===`attribute`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{value:c,maxLength:61,"aria-label":`The attribute`,placeholder:`e.g. aria-expanded or data-state`,onChange:e=>l(e.target.value)}),c!==``&&!D&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`An attribute's name starts with a letter or _, then letters, digits and - _ : . only.`})]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:o===`attribute`?`The attribute's value, compared as text.`:T===`number`?`How many elements this check's locator finds on the page.`:T===`none`?o===`visible`?`The replay checks it shows.`:o===`hidden`?`The replay checks it is gone.`:`The replay checks it is ${o}.`:`${j} was “${e.text}” when you recorded.`}),T===`text`&&(0,Y.jsx)(r,{value:u,"aria-label":`How to compare`,onChange:e=>d(e.target.value),children:rn.filter(([e])=>o!==`attribute`||e!==`number`).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),T===`none`?null:E===`number`?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(r,{value:g,"aria-label":`Compared with`,onChange:e=>_(e.target.value),className:`flex-none`,children:an.map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),(0,Y.jsx)(a,{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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`and`}),(0,Y.jsx)(a,{value:b,inputMode:`decimal`,maxLength:20,"aria-label":`Highest value`,onChange:e=>S(e.target.value),className:`min-w-0 flex-1`})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{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`&&!w&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`That is not a valid pattern.`}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(K,{checked:m,onCheckedChange:h}),`Any case (capital or small letters)`]})]}),T===`text`&&(0,Y.jsx)(`span`,{className:`text-body-sm 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,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:!k,"data-tip":`Save this check`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),n&&(e.kind===`text`||e.kind===`value`||!e.element)&&(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({match:null}),"data-tip":`Compare by contains, as recorded`,children:[(0,Y.jsx)(ae,{"aria-hidden":`true`}),`Back to contains “`,e.text,`”`]})]})}function un({step:e,onAdd:t,onRecordMore:n,blocks:i=[],secrets:o=[],onAddBlock:s}){let[c,l]=(0,J.useState)(`check`),[u,d]=(0,J.useState)(i[0]?.id??``),f=i.find(e=>e.id===u)??i[0],[p,m]=(0,J.useState)(()=>Et(f,o)),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(!1),[S,C]=(0,J.useState)(`2`),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(e.note||``),O=e.index,k=[[`check`,`Check`,we],[`step`,`Step`,Ne],[`wait`,`Wait`,he],[`note`,`Note`,ke],...i.length&&s?[[`block`,`Block`,Ee]]:[]],A=Number(S),j=Number.isInteger(A)&&A>=1&&A<=60;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,Y.jsx)(tt,{prefix:`add`,label:`What to add`,className:`mb-0`,current:c,onPick:l,tabs:k.map(([e,t])=>({id:e,label:t}))}),c===`block`&&f&&s&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),Tt(f,p)&&s(f.id,p)},children:[(0,Y.jsx)(r,{"aria-label":`The block to put in after this step`,value:f.id,onChange:e=>{d(e.target.value),m(Et(i.find(t=>t.id===e.target.value),o))},children:i.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))}),(0,Y.jsx)(kt,{block:f}),(0,Y.jsx)(Dt,{block:f,secrets:o,use:p,onChange:m}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`When the page here is not where the block starts, it opens its start page first, on this recording's site.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!Tt(f,p),"data-tip":`Put the block in after this step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),c===`check`&&(0,Y.jsxs)(Y.Fragment,{children:[e.page&&(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({checks:[{after:O,kind:`url`}]}),children:[`The page is `,e.page]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h.trim()&&t({checks:[{after:O,kind:`intent`,text:h.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A check in your words`,value:h,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>g(e.target.value)}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!h.trim(),"data-tip":`Add the check`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]})]}),c===`step`&&(0,Y.jsxs)(Y.Fragment,{children:[n&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,Y.jsxs)(x,{size:`sm`,onClick:n,"data-tip":`Record more from here`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),(0,Y.jsx)(`span`,{className:`text-body-sm 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,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),h.trim()&&t({steps:[{after:O,kind:`do`,text:h.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A step in your words`,value:h,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>g(e.target.value)}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Quill finds the control on the page and does it here.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!h.trim(),"data-tip":`Add the step`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(w.trim())&&t({steps:[{after:O,kind:`open`,url:w.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`A page to open`,value:w,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>T(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(w.trim()),"data-tip":`Add a step that opens this page`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:O,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Go back`]})]}),c===`wait`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-body-sm 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,Y.jsxs)(x,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:O,kind:`wait_load`}]}),"data-tip":`Wait until the page has loaded, its calls have finished and its spinners have gone`,children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),`Until the page has loaded`]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),_.trim()&&t({steps:[{after:O,kind:`wait_text`,text:_.trim(),...y?{gone:!0}:{}}]})},children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(r,{value:y?`gone`:`shows`,"aria-label":`Wait until the text`,onChange:e=>b(e.target.value===`gone`),className:`flex-none`,children:[(0,Y.jsx)(`option`,{value:`shows`,children:`Until it shows`}),(0,Y.jsx)(`option`,{value:`gone`,children:`Until it is gone`})]}),(0,Y.jsx)(a,{value:_,maxLength:120,placeholder:y?`e.g. Loading`:`e.g. Order placed`,"aria-label":`The text to wait for`,onChange:e=>v(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`accent`,disabled:!_.trim(),"data-tip":`Add the wait`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(`form`,{className:`flex items-center gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),j&&t({steps:[{after:O,kind:`wait_seconds`,seconds:A}]})},children:[(0,Y.jsx)(a,{value:S,type:`number`,min:1,max:60,step:1,maxLength:2,"aria-label":`Seconds to wait`,onChange:e=>C(e.target.value),className:`w-20 flex-none`}),(0,Y.jsx)(`span`,{className:`flex-1 text-body-sm text-ink-2`,children:`seconds`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,disabled:!j,"data-tip":`Add a pause of this many seconds`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Add`]})]})]}),c===`note`&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),t({notes:[{index:O,text:E.trim()}]})},children:[(0,Y.jsx)(a,{"aria-label":`Note`,value:E,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>D(e.target.value)}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:E.trim()===(e.note||``),"data-tip":E.trim()||!e.note?`Save the note`:`Remove the note`,children:[E.trim()||!e.note?(0,Y.jsx)(H,{"aria-hidden":`true`}):(0,Y.jsx)(N,{"aria-hidden":`true`}),E.trim()||!e.note?`Save`:`Remove`]})]})]})}var dn=e=>`${e.index}-${e.value?.as}-${e.value?.text}-${e.value?.days??``}`,fn=e=>e===0?`today`:`${u(Math.abs(e),`day`)} ${e>0?`from`:`before`} today`;function pn({step:e,busy:t,onSave:n,open:i,onOpen:o,sources:s}){let c=e.value,[l,u]=(0,J.useState)(!1),d=o?!!i:l,f=o??u,[p,m]=(0,J.useState)(c.text),[h,g]=(0,J.useState)(String(c.days??0)),_=e.index+1,v=c.as===`secret`?(0,Y.jsxs)(Y.Fragment,{children:[`Read from `,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.name})]}):c.as===`any`?(0,Y.jsxs)(Y.Fragment,{children:[`Picked on each run`,c.text?(0,Y.jsxs)(Y.Fragment,{children:[` (`,(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.text}),` this time)`]}):null]}):c.edit===`days`?(0,Y.jsx)(`span`,{className:`text-ink`,children:fn(c.days??0)}):(0,Y.jsx)(`span`,{className:`font-mono text-ink [overflow-wrap:anywhere]`,children:c.text===``?`(empty)`:c.text}),y=/^-?\d{1,4}$/.test(h.trim())&&Math.abs(Number(h))<=3660,b=c.edit===`days`?y&&Number(h)!==c.days:p!==c.text&&(e.op===`input`||p.trim()!==``);return d?(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:t=>{t.preventDefault(),b&&(f(!1),n({values:[c.edit===`days`?{index:e.index,days:Number(h)}:{index:e.index,text:p}]}))},children:[s&&s.length>1&&(0,Y.jsx)(r,{"aria-label":`Where the value of step ${_} comes from`,value:c.as,disabled:t,onChange:t=>n({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:s.map(t=>(0,Y.jsx)(`option`,{value:t.id,children:Wt(e,t.id)},t.id))}),c.edit===`days`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{value:h,type:`number`,min:-3660,max:3660,step:1,"aria-label":`Days from today for step ${_}`,autoFocus:!0,onChange:e=>g(e.target.value),className:`w-20 flex-none`}),(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`days from today`})]}):c.edit?(0,Y.jsx)(a,{value:p,maxLength:300,"aria-label":`Value of step ${_}`,autoFocus:!0,onChange:e=>m(e.target.value),className:`min-w-[160px] flex-1`}):(0,Y.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:v}),c.edit&&(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!b,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>f(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),c.edit?`Cancel`:`Close`]}),e.op===`click`&&c.as===`typed`&&c.edit&&(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-muted`,children:`Clicking another one makes it test data.`})]}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-body-sm text-ink-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[c.as===`data`&&c.name&&s?(0,Y.jsx)(`span`,{className:`font-mono text-ink`,children:c.name}):`Value`,`: `,v]}),(c.edit||s&&s.length>1)&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,disabled:t,"aria-label":`Change the value of step ${_}`,"data-tip":`Change the value of step ${_}`,onClick:()=>f(!0),className:`size-8 flex-none`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`})})]})}var mn=e=>{try{let t=new URL(e.trim());return/^https?:$/.test(t.protocol)?t.origin:``}catch{return``}};function hn({start:e,busy:t,onSave:n,onCancel:r}){let[i,o]=(0,J.useState)(e),[s,c]=(0,J.useState)(!0),l=mn(e),u=mn(i),d=!!l&&!!u&&l!==u;return(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 px-4 pb-2 sm:pl-20`,onSubmit:t=>{t.preventDefault(),u&&i.trim()!==e&&n(i.trim(),d&&s)},children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(a,{value:i,type:`url`,maxLength:2e3,"aria-label":`The page the test starts on`,autoFocus:!0,onChange:e=>o(e.target.value),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!u||i.trim()===e,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(x,{size:`sm`,variant:`outline`,onClick:r,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}),i.trim()&&!u&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:`Start on a web page: an http or https address.`}),d&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,Y.jsx)(K,{checked:s,onCheckedChange:c}),`Move the other pages of `,l,` to `,u,` too`]})]})}var gn={navigate:pe,back:Ce,click:P,dblclick:P,input:j,press:j,select:we,upload:Me,expect:ce,wait_for:z,capture:de,note:ke,launch:fe,double_click:P,type:j,keys:j,tap:P,double_tap:P,long_press:P,swipe:Ie,scroll:je,hide_keyboard:j,wait:he,dismiss:Je},_n=e=>gn[e]||(e.startsWith(`expect`)?ce:ze),vn=new Set([`starting`,`recording`,`paused`,`stopping`]);function yn(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 bn(e){await v.write(e,{check:!0})}async function xn(e,t=`desktop`){let r=t===`mobile`?`mobile_replay`:`desktop_replay`,{id:i}=await y.start(`Replay the ${t} workflow ${e}: call ${r} with workflow ${e}, and tell me how each step went.`,{});location.hash=n(`chats`,i)}function Sn({list:e}){return(0,Y.jsx)(`ul`,{"aria-label":`Found on a replay by`,className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:e.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-10 flex-none text-muted`,children:t===0?`uses`:`then`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,Y.jsx)(`span`,{className:`text-muted`,children:e.kind}),(0,Y.jsx)(`code`,{className:`line-clamp-2 font-mono text-body-sm text-ink-2 [overflow-wrap:anywhere]`,...e.value.length>80?{"data-tip":e.value}:{},children:e.value})]})]},`${t}-${e.kind}`))})}function Cn({s:e,live:t,onDelete:n}){let r=_n(e.op);return(0,Y.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,Y.jsx)(`span`,{className:`w-6 flex-none pt-1 text-right text-body-sm text-muted tabular-nums`,children:e.n||`–`}),(0,Y.jsx)(r,{size:16,"aria-hidden":`true`,className:d(`mt-1 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:e.text}),e.locators&&e.locators.length>0&&(0,Y.jsx)(Sn,{list:e.locators}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,Y.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-body-sm text-muted`,children:[e.case_step?(0,Y.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,Y.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,Y.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,Y.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,Y.jsx)(x,{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,Y.jsx)(N,{"aria-hidden":`true`})})]})}var wn=[[`tap`,`Tap`],[`check`,`Check`],[`long_press`,`Hold`],[`wait_for`,`Wait for`],[`point`,`Point`]],Tn={tap:`Tap`,check:`Check`,long_press:`Long-press`,wait_for:`Wait for`,point:`Tap a point in`},X={check:`Click what shows the outcome: a check of what it shows is added.`,long_press:`Click the control to long-press.`,wait_for:`Click the control a replay waits for before it goes on.`,point:`Click where the app draws something with no control of its own (a canvas, a chart): the spot is tapped inside the nearest control that can be found.`},En=3e4;function Dn({s:e,send:t,busy:n,secrets:i,links:o=[],className:c,fit:l}){let u=e.screen,[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`tap`),[g,_]=(0,J.useState)(!1),[y,b]=(0,J.useState)(o[0]??``),C=o.includes(y)?y:o[0]??``,[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,ee]=(0,J.useState)(null),M=u?.seq??0,N=u?.frame??M;(0,J.useEffect)(()=>{if(!N||!u?.image)return;let e=!1;return v.screen().then(t=>!e&&p(t),()=>{}),()=>{e=!0}},[N,u?.image]),(0,J.useEffect)(()=>{w&&w.seq!==M&&T(null)},[M,w]),(0,J.useEffect)(()=>{A&&(N!==A.frame||e.notice?.at!==A.notice||e.state!==`recording`)&&ee(null)},[N,e.notice?.at,e.state,A]),(0,J.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>ee(null),En);return()=>clearTimeout(e)},[A]);let ne=n||!!A,P=!ne&&e.state===`recording`&&!!u,F=n=>{ee({frame:N,notice:e.notice?.at}),t(n)},I=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,L=Pt(u),z=e=>e.label?`“${e.label}”`:`the ${e.kind||`control`}`,B=(e,t)=>{m!==`point`&&(m===`tap`&&t.field?(T({el:e,seq:M,c:t}),D(``),k(t.secure&&i.length?i[0]:``)):(F({cmd:m,seq:M,el:e}),m!==`tap`&&h(`tap`)))},re=u&&u.width>0&&u.height>0?`min(var(--phone-max, 100%), calc(max(420px, 100vh - 260px) * ${u.width/u.height}))`:`100%`;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-screen`,className:d(d(s,`flex min-w-0 flex-col gap-4`),c),style:l?{width:`max(min(400px, var(--phone-max, 100%)), ${re===`100%`?`0px`:re})`}:void 0,children:[(0,Y.jsx)(mt,{id:`rec-screen`,icon:Le,title:`Screen`,actions:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Qe,{checked:g,onChange:_,label:`Outline controls`}),(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Outline controls`})]})}),(0,Y.jsx)(Ze,{label:`What a click on the screen does`,value:m,onChange:h,options:wn.map(([e,t])=>({id:e,label:t})),className:`self-center`}),m!==`tap`&&(0,Y.jsxs)(`p`,{role:`status`,className:d(S.info,`m-0 flex flex-wrap items-center gap-x-2`),children:[(0,Y.jsx)(`span`,{className:`flex-1`,children:X[m]}),(0,Y.jsx)(x,{variant:`link`,size:`inline`,onClick:()=>h(`tap`),children:`Back to Tap`})]}),e.notice&&(0,Y.jsx)(`p`,{role:`status`,className:d(S.warn,`m-0`),children:e.notice.text}),u?(0,Y.jsxs)(St,{src:f,alt:`The screen of ${e.app} now`,width:u.width,height:u.height,size:re,busy:ne,children:[L.map(({c:e,i:t})=>{let n=m===`tap`&&e.field?`${e.picker?`Choose in`:`Type into`} ${z(e)}`:`${Tn[m]} ${z(e)}${e.prompt?` (a system prompt: kept to answer whenever a replay is asked)`:``}`;return(0,Y.jsx)(`button`,{type:`button`,disabled:!P||!!w,"aria-label":n,"data-tip":n,onClick:()=>B(t,e),className:d(`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-default disabled:hover:bg-transparent disabled:hover:ring-0`,g&&`ring-2 ring-inset ring-accent/30`),style:{left:I(e.box[0],u.width),top:I(e.box[1],u.height),width:I(e.box[2],u.width),height:I(e.box[3],u.height)}},`${M}-${t}`)}),m===`point`&&(0,Y.jsx)(`button`,{type:`button`,disabled:!P,"aria-label":`Tap this point of the screen`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();if(!t.width||!t.height)return;let n=Math.max(0,Math.min(u.width-1,Math.round((e.clientX-t.left)/t.width*u.width))),r=Math.max(0,Math.min(u.height-1,Math.round((e.clientY-t.top)/t.height*u.height)));F({cmd:`tap_at`,seq:M,x:n,y:r}),h(`tap`)},className:`absolute inset-0 z-[2] cursor-crosshair border-0 bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent disabled:cursor-default`}),ne&&!w&&(0,Y.jsx)(`span`,{role:`status`,className:`absolute inset-0 flex items-center justify-center bg-bg/60`,children:(0,Y.jsxs)(`span`,{className:d(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`flex items-center gap-2 text-body-sm text-ink-2`),children:[(0,Y.jsx)(De,{size:16,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),`Doing it on the device…`]})}),w&&(0,Y.jsxs)(`form`,{className:d(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`absolute inset-x-0 bottom-0 z-10 flex flex-col gap-2`),onKeyDown:e=>{e.key===`Escape`&&T(null)},onSubmit:e=>{if(e.preventDefault(),O)F({cmd:`type`,seq:w.seq,el:w.el,secret:O});else if(E)F({cmd:`type`,seq:w.seq,el:w.el,text:E});else return;T(null)},children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm font-medium [overflow-wrap:anywhere]`,children:[(0,Y.jsxs)(`span`,{className:`flex-1`,children:[w.c.picker?`Choose in`:`Type into`,` `,z(w.c)]}),(0,Y.jsx)(x,{type:`button`,variant:`icon`,size:`icon`,"aria-label":`Cancel`,"data-tip":`Cancel (Esc)`,onClick:()=>T(null),children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),!w.c.picker&&(i.length>0||w.c.secure)&&(0,Y.jsxs)(r,{"aria-label":`What to type`,autoFocus:!!w.c.secure,value:O,onChange:e=>k(e.target.value),className:`min-w-0`,children:[!w.c.secure&&(0,Y.jsx)(`option`,{value:``,children:`Text I type`}),i.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[`Secret `,e]},e))]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[!O&&(0,Y.jsx)(a,{"aria-label":w.c.picker?`Value to choose`:`Text to type`,autoFocus:!0,value:E,maxLength:w.c.picker?200:2e3,spellCheck:!1,onChange:e=>D(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(x,{type:`submit`,variant:`primary`,disabled:!P||!O&&!E,className:d(!!O&&`flex-1`),children:[(0,Y.jsx)(j,{"aria-hidden":`true`}),w.c.picker?`Choose`:`Type`]})]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:w.c.picker?`A picker wheel: write the value as the wheel shows it; the step chooses it.`:w.c.secure?i.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,Y.jsx)(x,{variant:`link`,size:`inline`,onClick:()=>(F({cmd:`tap`,seq:w.seq,el:w.el}),T(null)),className:`self-start`,children:`Only tap it, type nothing`})]})]}):(0,Y.jsxs)(`p`,{className:`m-0 flex items-center gap-2 py-2 text-body-sm text-muted`,children:[(0,Y.jsx)(De,{size:16,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),e.state===`starting`?`Starting ${e.app} on ${e.device||`the device`}: a device cloud can take a minute or two…`:`Waiting for the screen…`]}),(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,"aria-label":`Gestures and keys`,role:`group`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-2`,children:[[`Scroll`,[[`Scroll up`,Be,{cmd:`scroll`,direction:`up`}],[`Scroll down`,je,{cmd:`scroll`,direction:`down`}]]],[`Swipe`,[[`Swipe left`,te,{cmd:`swipe`,direction:`left`}],[`Swipe right`,le,{cmd:`swipe`,direction:`right`}]]]].map(([e,t])=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`pr-1 text-body-sm text-muted`,children:e}),t.map(([e,t,n])=>(0,Y.jsx)(x,{variant:`icon`,size:`icon`,"aria-label":e,"data-tip":e,disabled:!P,onClick:()=>F(n),children:(0,Y.jsx)(t,{"aria-hidden":`true`})},e))]},e))}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`back`}),"data-tip":`The device's Back`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),`Back`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`keys`,key:`enter`}),"data-tip":`Press Enter on the keyboard`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`}),`Enter`]}),(0,Y.jsx)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`hide_keyboard`}),"data-tip":`Hide the keyboard`,children:`Hide keyboard`}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`wait`,seconds:2}),"data-tip":`Record a wait of 2 seconds`,children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Wait 2 s`]}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P,onClick:()=>F({cmd:`refresh`}),"data-tip":`Read the screen again, when the app changed by itself`,children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),`Read again`]})]}),o.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[o.length>1&&(0,Y.jsx)(r,{size:`sm`,"aria-label":`Whose mailbox`,value:C,onChange:e=>b(e.target.value),className:`w-auto min-w-0 max-w-[160px]`,children:o.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsxs)(x,{size:`sm`,disabled:!P||!o.includes(C),onClick:()=>F({cmd:`magic_link`,login:C}),"data-tip":`Open the newest link ${C}'s site sent to its mailbox, on the device`,children:[(0,Y.jsx)(Ae,{"aria-hidden":`true`}),`Open magic link`]})]})]})]})}function On({s:e,where:t}){let n=[[`Device`,e.device||`The default device`],[`Platform`,e.platform===`ios`?`iOS`:`Android`],[`App`,e.app||``],...t?[[`Runs on`,t]]:[],[`Steps`,String(e.steps.length)]];return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-device`,className:d(s,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-device`,icon:Se,title:`Device`}),(0,Y.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 text-body-sm`,children:n.map(([e,t])=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:t})]},e))})]})}function kn({s:e,send:t,busy:n,secrets:i=[],devices:a=[],links:o=[],blocks:c=[],blockSecrets:l=[],unsetSecrets:u=[],onPlayBlock:f}){let[,p]=(0,J.useState)(0),[m,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(``),y=c.find(e=>e.id===_)??c[0],[b,w]=(0,J.useState)(()=>Et(c[0],l));(0,J.useEffect)(()=>{let e=U(()=>p(e=>e+1),1e3);return()=>$e(e)},[]);let T=(0,J.useRef)(null),E=(0,J.useRef)(null);(0,J.useEffect)(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[e.log.length]),(0,J.useEffect)(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[e.steps.length]);let D=e.kind===`desktop`,O=e.kind===`mobile`,k=e.kind===`web`,A=e.state===`paused`,j=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),M=Math.max(0,...e.steps.map(e=>e.case_step||0)),N=Nt(e.screen),te=(a.find(t=>t.name===e.device&&t.platform===e.platform)??a.find(t=>t.name===e.device))?.where,ne=(0,Y.jsx)(On,{s:e,where:e.device?te:void 0}),P=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:d(d(s,`flex min-w-0 flex-col gap-2`),!O&&`flex-[999_1_420px]`),children:[(0,Y.jsx)(mt,{id:`rec-steps`,icon:Ne,title:`Steps`,n:e.summary}),e.steps.length?(0,Y.jsx)(`div`,{ref:E,className:`max-h-[60vh] overflow-y-auto`,children:(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,Y.jsx)(Cn,{s:e,live:!D,onDelete:()=>t({cmd:`delete`,n:e.n})},`${e.n}-${e.op}-${e.text}`))})}):(0,Y.jsx)(`p`,{className:`m-0 py-2 text-body-sm text-muted`,children:e.state===`starting`?D||O?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step ${O?`on the screen`:`in ${D?e.app:`the browser`}`}.`})]}),F=e.case&&(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-case`,icon:ee,title:e.case.id,description:`${e.case.title}. Each step you record belongs to the case step you are on: pick one to record it.`}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(r=>{let i=e.steps.some(e=>e.case_step===r.n);return(0,Y.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,Y.jsxs)(`button`,{type:`button`,disabled:n,"aria-current":r.n===M?`step`:void 0,onClick:()=>t({cmd:`case_step`,n:r.n}),className:d(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start gap-2 px-2`),children:[i?(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(`span`,{className:`mt-1 w-4 flex-none text-center text-body-sm text-muted`,children:r.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.action}),r.expected&&(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,r.expected]})]})]})},r.n)})}),(0,Y.jsxs)(x,{disabled:n,onClick:()=>t({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,Y.jsx)(Ie,{"aria-hidden":`true`}),`Next`]})]}),I=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:d(s,`flex flex-col gap-2`),children:[(0,Y.jsx)(mt,{id:`rec-log`,icon:xe,title:`What the recorder says`}),(0,Y.jsx)(`div`,{ref:T,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-body-sm`,"aria-live":`polite`,children:e.log.length?e.log.map((e,t)=>(0,Y.jsx)(`p`,{className:d(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,Y.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,O?`the device`:D?`the app`:`the browser`,`…`]})})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:d(s,`flex flex-wrap items-center gap-x-4 gap-y-4`),children:[A?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,Y.jsx)(C,{state:e.state===`starting`?`waiting`:e.state===`stopping`?`working`:`recording`,px:20}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.state===`starting`?O?`Starting ${e.app} on ${e.device||`the device`}…`:D?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:A?`Paused: what you do now is not recorded`:`Recording`,` · `,yn(e.startedAt),` ·`,` `,O?`${e.app} on ${e.device||`the device`}`:D?`${e.app}, a desktop app`:e.url]}),e.block&&(0,Y.jsx)(`span`,{className:d(`text-body-sm [overflow-wrap:anywhere]`,e.block.state===`stopped`?`text-warn`:`text-muted`),children:e.block.kind===`recording`?e.block.state===`waiting`?`The recording's steps up to step ${e.block.total+1} play when the page is open.`:e.block.state===`playing`?`Doing the recording's steps up to step ${e.block.total+1}: wait for it.`:e.block.state===`done`?`At step ${e.block.total+1}: record what comes next, then Stop and save.`:`Step ${e.block.done+2} could not be done${e.block.note?` (${e.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${e.block.done+2} to ${e.block.total+1}.`:e.block.state===`waiting`?`The block "${e.block.name}" plays when the page is open.`:e.block.state===`playing`?`Doing the block "${e.block.name}" (${e.block.total} steps): wait for it.`:e.block.state===`done`?`The block "${e.block.name}" is done: carry on.`:`The block "${e.block.name}" stopped after ${e.block.done} of ${e.block.total} steps${e.block.note?` (${e.block.note})`:``}: do the rest by hand.`})]}),k&&(0,Y.jsxs)(x,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:`pause`}),children:[A?(0,Y.jsx)(fe,{"aria-hidden":`true`}):(0,Y.jsx)(L,{"aria-hidden":`true`}),A?`Resume`:`Pause`]}),!D&&(0,Y.jsxs)(x,{disabled:n||e.state===`starting`||!e.steps.length,onClick:()=>t({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,Y.jsx)(ue,{"aria-hidden":`true`}),`Undo`]}),f&&y&&(0,Y.jsxs)(`span`,{className:`relative inline-block`,children:[(0,Y.jsxs)(x,{disabled:n||e.state!==`recording`||e.block?.state===`playing`||e.block?.state===`waiting`,"aria-haspopup":`dialog`,"aria-expanded":m,onClick:()=>{m||(v(c[0]?.id??``),w(Et(c[0],l))),g(!m)},"data-tip":`Do a saved block's steps here, then carry on`,children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`}),`Play a block`]}),(0,Y.jsx)(h,{open:m,onClose:()=>g(!1),label:`Play a block`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2 p-2`,onSubmit:e=>{e.preventDefault(),Tt(y,b)&&(g(!1),f(y.id,Ot(b)))},children:[(0,Y.jsx)(r,{"aria-label":`The block to play now`,value:y.id,onChange:e=>{v(e.target.value),w(Et(c.find(t=>t.id===e.target.value),l))},children:c.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))}),(0,Y.jsx)(kt,{block:y}),(0,Y.jsx)(Dt,{block:y,secrets:l,use:b,onChange:w,unset:u}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:O?`Its steps are done on the device now and go into the recording here; a step that cannot be done, you do by hand.`:D?`Its steps are done in the app now and go into the recording here: keep your hands off the mouse and keys until it is done.`:`The recorder pauses while it opens the block's start page and does its steps; they go into the recording here.`}),(0,Y.jsxs)(x,{type:`submit`,size:`sm`,variant:`primary`,disabled:!Tt(y,b),"data-tip":`Play the block now`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Play`]})]})})]}),(0,Y.jsxs)(x,{variant:`destructive`,disabled:n||e.state===`stopping`,onClick:()=>t({cmd:`stop`,...j?{force:!0}:{}}),"data-tip":j?`Stop anyway`:`Stop and save`,children:[(0,Y.jsx)(Ue,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),O?(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),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,Y.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.`]}):D?(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),children:[e.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,Y.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,Y.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,Y.jsxs)(`p`,{className:d(S.info,`m-0 leading-relaxed`),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, `,e.leader,` then `,(0,Y.jsx)(`strong`,{children:`P`}),` pauses, `,(0,Y.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,Y.jsx)(`strong`,{children:`S`}),` stops.`]}),O?(0,Y.jsx)(`div`,{className:`@container`,children:(0,Y.jsxs)(`div`,{className:d(`grid items-start gap-6`,N?`[--phone-max:100cqw] @2xl:grid-cols-2`:`[--phone-max:100cqw] @2xl:grid-cols-[auto_minmax(280px,1fr)] @2xl:[--phone-max:calc(100cqw-304px)] @5xl:grid-cols-[minmax(240px,1fr)_auto_minmax(240px,1fr)] @5xl:[--phone-max:calc(100cqw-528px)]`),children:[(0,Y.jsx)(Dn,{s:e,busy:n,secrets:i,links:o,send:t,fit:!N,className:N?`@2xl:col-span-2`:`@2xl:col-start-1 @2xl:row-span-2 @2xl:row-start-1 @5xl:col-start-2 @5xl:row-span-1`}),(0,Y.jsx)(`div`,{className:d(`flex min-w-0 flex-col`,!N&&`@2xl:col-start-2 @2xl:row-start-1 @5xl:col-start-1`),children:P}),(0,Y.jsxs)(`div`,{className:d(`flex min-w-0 flex-col gap-6`,!N&&`@2xl:col-start-2 @2xl:row-start-2 @5xl:col-start-3 @5xl:row-start-1`),children:[ne,F,I]})]})}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-6`,children:[P,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-6`,children:[F,I]})]})]})}function An({s:e}){let t=e.result,[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1);if(!t)return null;let o=e.kind!==`web`,c=!t.ok&&t.error?It(t.error,e.kind):null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:d(s,`flex max-w-[1024px] flex-col gap-2`,!t.ok&&`bg-fail-soft`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-4`,children:[t.ok?(0,Y.jsx)(ce,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(Je,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-fail`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`p`,{id:`rec-result`,className:`m-0 font-medium [overflow-wrap:anywhere]`,children:t.ok?`${e.name} is recorded`:`${e.name} was not recorded`}),(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[t.ok?t.summary||e.summary:c||`The recording stopped with an error before its first step.`,e.endedAt&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · stopped after `,yn(e.startedAt,e.endedAt)]})]})]}),t.ok&&(0,Y.jsx)(A,{tone:`pass`,children:`Recorded`})]}),t.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-body-sm`,children:[(0,Y.jsx)(A,{tone:`neutral`,icon:!1,children:u(e.steps.length,`step`)}),(0,Y.jsxs)(A,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,Y.jsxs)(A,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!o&&t.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono text-body-sm`,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,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-warn`,children:t.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:t.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-body-sm text-muted`,children:t.skipped.map((e,t)=>(0,Y.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[o&&t.workflow&&(0,Y.jsxs)(x,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await xn(t.workflow,e.kind===`mobile`?`mobile`:`desktop`)}catch(e){r(e.message),a(!1)}},children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Replay`]}),o&&t.report&&(0,Y.jsxs)(x,{onClick:async()=>r(await k(t.report)),"data-tip":`Open the report`,children:[(0,Y.jsx)(Oe,{"aria-hidden":`true`}),`Report`]}),!o&&t.ok&&(0,Y.jsxs)(x,{onClick:async()=>r(await k(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,Y.jsx)(He,{"aria-hidden":`true`}),`Steps`]}),(0,Y.jsx)(`span`,{className:`flex min-w-0 max-w-full text-body-sm`,children:(0,Y.jsx)(O,{path:o&&t.workflow?t.workflow:e.runDir})}),n&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:n})]}),!t.ok&&t.error&&(0,Y.jsx)(ut,{title:`What the recorder said`,children:(0,Y.jsx)(`code`,{className:d(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`block max-h-[120px]`),children:t.error})})]})}function jn(e){try{let t=decodeURIComponent(e);return t&&t.length<=500&&!/[\0\r\n]/.test(t)?t:null}catch{return null}}var Mn={emulator:`this computer's emulators`,device:`phones plugged into this computer`,testmu:`TestMu AI`,browserstack:`BrowserStack`};function Nn({place:e,listing:t,loading:n,error:r}){let i=e===`testmu`||e===`browserstack`;return n?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-muted`,children:[(0,Y.jsx)(De,{size:14,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),i?`Connecting to ${Mn[e]}…`:`Looking for devices…`]}):r||t&&!t.ready?(0,Y.jsxs)(`span`,{className:`flex items-start gap-2 text-fail`,children:[(0,Y.jsx)(Je,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r||t?.problem})]}):t?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-ink-2`,children:[(0,Y.jsx)(ce,{size:14,"aria-hidden":`true`,className:`flex-none text-pass`}),i?`Connected to ${Mn[e]} · ${u(t.devices.length,`device`)}`:`${u(t.devices.length,`device`)} on ${Mn[e]}`]}):null}function Pn({open:e,onClose:t,place:n,app:r,listing:i,loading:a,error:o,picked:s,onUse:c,onRefresh:l}){let[u,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(s);(0,J.useEffect)(()=>{e&&m(s)},[e,s]);let h=i?.devices??[],g=u.trim().toLowerCase(),_=g?h.filter(e=>e.label.toLowerCase().includes(g)):h,v=h.some(e=>e.id===p);return(0,Y.jsx)(rt,{open:e,onClose:t,title:`Choose a device`,description:`For ${r} on ${Mn[n]}: the devices there now.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:v?h.find(e=>e.id===p).label:`None chosen`}),(0,Y.jsxs)(x,{onClick:t,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{variant:`primary`,disabled:!v,onClick:()=>(c(p),t()),children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Use`]})]}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-body-sm`,children:(0,Y.jsx)(Nn,{place:n,listing:i,loading:a,error:o})}),(0,Y.jsxs)(x,{size:`sm`,disabled:a,onClick:l,"data-tip":`Ask again`,children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),`Refresh`]})]}),i&&!i.build.ok&&(0,Y.jsxs)(`p`,{role:`alert`,className:d(S.warn,`m-0 flex items-start gap-2`),children:[(0,Y.jsx)(F,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:i.build.note})]}),h.length>6&&(0,Y.jsx)(`div`,{className:`flex`,children:(0,Y.jsx)(w,{id:`rec-device-search`,label:`Find a device`,value:u,onChange:f,placeholder:`Galaxy, Pixel, 14…`,className:`max-w-none flex-1`})}),h.length>0&&(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Devices`,className:`-mx-2 flex flex-col`,children:[_.map(e=>(0,Y.jsxs)(`label`,{className:d(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`px-2`,p===e.id&&`bg-tint-hover`),children:[(0,Y.jsx)(At,{name:`rec-device`,value:e.id,checked:p===e.id,onSelect:()=>m(e.id)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.version?`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`:``,e.type===`virtual`?e.running?`running`:`starts for the recording`:e.running?`connected`:``].filter(Boolean).join(` · `)})]})]},e.id)),!_.length&&(0,Y.jsxs)(`p`,{className:`m-0 px-2 py-2 text-body-sm text-muted`,children:[`No device matches “`,u.trim(),`”.`]})]})]})})}function Fn({view:e,busy:t,onStart:n,start:i}){let o=Ft(i),s=e.mobile.apps.length>0,[c,l]=(0,J.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:e.session?.kind===`mobile`&&s?`mobile`:`web`),[f,p]=(0,J.useState)(e.mobile.apps[0]?.name??``),m=e.mobile.devices[0]?.where,[h,g]=(0,J.useState)(m===`TestMu AI`?`testmu`:m===`BrowserStack`?`browserstack`:`emulator`),[y,b]=(0,J.useState)(null),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(!1),[D,O]=(0,J.useState)(``),[k,A]=(0,J.useState)(0),[j,ee]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(c!==`mobile`||!f)return;let e=!0;return E(!0),w(``),b(null),v.mobileDevices(h,f,k>0).then(t=>{e&&(b(t),O(e=>t.devices.some(t=>t.id===e)?e:t.devices.length===1?t.devices[0].id:``))},t=>e&&w(t.message)).finally(()=>e&&E(!1)),()=>{e=!1}},[c,h,f,k]);let[N,te]=(0,J.useState)(e.desktop.apps[0]??``),[ne,P]=(0,J.useState)(``),[L,z]=(0,J.useState)(``),[B,re]=(0,J.useState)(``),[ie,ae]=(0,J.useState)(!1),[oe,se]=(0,J.useState)(!1),[ce,le]=(0,J.useState)(``),[ue,de]=(0,J.useState)(o?``:e.apps[0]?.name??``),[fe,me]=(0,J.useState)(o),[he,ge]=(0,J.useState)(``),[V,ve]=(0,J.useState)(e.environment??``),[ye,be]=(0,J.useState)(!1),[xe,Ce]=(0,J.useState)(!1),[we,Te]=(0,J.useState)(``),[Ee,De]=(0,J.useState)(``),[Oe,ke]=(0,J.useState)([]);(0,J.useEffect)(()=>ke([]),[c,N,f]);let[Ae,je]=(0,J.useState)(``),Me=c===`web`?e.blocks.filter(e=>(e.kind??`web`)===`web`):e.blocks.filter(e=>e.kind===c&&e.app===(c===`mobile`?f:N)),Ne=c===`mobile`?e.mobile.secrets:c===`desktop`?e.desktop.secrets??[]:e.blockSecrets??[],Pe=Oe.flatMap(e=>(t=>t?[{block:t,use:e.use}]:[])(Me.find(t=>t.id===e.id))),Fe=c===`web`?Pe[0]?.block:void 0,Ie=Pe.every(e=>Tt(e.block,e.use)),Re=y?.devices.find(e=>e.id===D),ze=!!y&&y.build.ok&&!!Re,Be=c===`web`&&xe,Ve=Be?{asBlock:{name:we.trim(),...Ee.trim()?{section:Ee.trim()}:{}}}:{},He=Be&&!we.trim()?!1:c===`mobile`?s&&!!f&&ze&&Ie:c===`desktop`?e.desktop.available&&(!!N||!!ne.trim()&&!!L.trim())&&Ie:Fe?Ie:ue?!0:/^https?:\/\/\S+$/i.test(fe.trim()),Ue=Pe.length?{blocks:Pe.map(e=>({id:e.block.id,...Ot(e.use)}))}:{},H=Me.length>0&&(c!==`desktop`||!!N),Ke=e.environments.length>1&&(c!==`web`||!!ue),qe=c===`web`&&e.logins.length>0,Je=H||c===`web`||Ke||qe,Ye=c===`mobile`?`App and device`:c===`desktop`?`App`:`Start on`,Xe=c===`mobile`?(e=>e?`${f} starts on ${e.label}${h===`testmu`?` at TestMu AI`:h===`browserstack`?` at BrowserStack`:``}, and its screen is shown on this page: do the steps there. It is saved as a workflow that replays with no model.`:`Choose a device to record on.`)(y?.devices.find(e=>e.id===D)):c===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:Be?`A browser opens on this computer: do the steps. When you stop, they are kept as the block${we.trim()?` "${we.trim()}"`:``} to start other recordings from, and the recording is kept too.`:`A browser opens on this computer: do the steps, then choose the checks and the test data here, and Quill writes the test.`,U=`flex min-w-0 flex-col gap-2 text-body-sm font-medium`,$e=`-mt-1 text-body-sm font-normal text-muted`;return(0,Y.jsx)(`div`,{className:`@container`,children:(0,Y.jsxs)(`form`,{"aria-label":`New recording`,className:`grid grid-cols-[minmax(0,1fr)] items-start gap-x-16 gap-y-6 @4xl:grid-cols-[minmax(0,640px)_320px]`,onSubmit:t=>{if(t.preventDefault(),He){if(c===`mobile`)return n({kind:`mobile`,app:f,target:{place:h,id:D},...V&&V!==e.environment?{env:V}:{},...Ue});if(c===`desktop`&&N)return n({kind:`desktop`,app:N,...V&&V!==e.environment?{env:V}:{},...Ue});if(c===`desktop`)se(!0),le(``),_.addApp({name:L.trim(),path:ne.trim(),...B.trim()?{args:B.trim()}:{},...V?{env:V}:{}}).then(t=>n({kind:`desktop`,app:t.name,...V&&V!==e.environment?{env:V}:{}}),e=>le(e.message)).finally(()=>se(!1));else{if(Fe)return n({...Ue,...Ae?{app:Ae}:{},...V&&V!==e.environment?{env:V}:{},signedIn:ye,...Ve});n({...ue?{app:ue}:{url:fe.trim()},...he.trim()?{case:he.trim()}:{},...V&&V!==e.environment?{env:V}:{},signedIn:ye,...Ve})}}},children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{id:`rec-kind`,className:`text-body-sm font-medium`,children:`What to record`}),(0,Y.jsx)(Ze,{labelledBy:`rec-kind`,value:c,onChange:l,className:`self-start`,options:[{id:`web`,label:`Web page`,icon:(0,Y.jsx)(pe,{size:14,"aria-hidden":`true`})},{id:`desktop`,label:`Desktop app`,icon:(0,Y.jsx)(M,{size:14,"aria-hidden":`true`}),...e.desktop.available?{}:{disabled:!0,tip:e.desktop.reason||`Windows only.`}},{id:`mobile`,label:`Mobile app`,icon:(0,Y.jsx)(Le,{size:14,"aria-hidden":`true`}),...s?{}:{disabled:!0,tip:`Add a mobile app in Settings → Mobile first.`}}]})]}),(0,Y.jsx)(`div`,{role:`group`,"aria-label":Ye,className:`grid gap-4 @2xl:grid-cols-2`,children:c===`mobile`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 @2xl:col-span-2`,children:[(0,Y.jsx)(`span`,{id:`rec-place`,className:`text-body-sm font-medium`,children:`Record on`}),(0,Y.jsx)(Ze,{labelledBy:`rec-place`,value:h,onChange:g,className:`self-start`,options:[{id:`emulator`,label:`Emulator`,icon:(0,Y.jsx)(Ge,{size:14,"aria-hidden":`true`})},{id:`device`,label:`Real device`,icon:(0,Y.jsx)(We,{size:14,"aria-hidden":`true`})},{id:`testmu`,label:`TestMu AI`,icon:(0,Y.jsx)(_e,{size:14,"aria-hidden":`true`})},{id:`browserstack`,label:`BrowserStack`,icon:(0,Y.jsx)(_e,{size:14,"aria-hidden":`true`})}]})]}),(0,Y.jsxs)(`label`,{className:U,children:[`App`,(0,Y.jsx)(r,{"aria-label":`App`,value:f,onChange:e=>p(e.target.value),children:e.mobile.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.platform===`ios`?`iOS`:`Android`]},e.name))})]}),(0,Y.jsxs)(`div`,{className:d(U,`@2xl:col-span-2`),children:[(0,Y.jsx)(`span`,{id:`rec-device`,children:`Device`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(a,{readOnly:!0,"aria-labelledby":`rec-device`,value:Re?Re.label:``,placeholder:`None chosen`,className:`min-w-0 flex-1 truncate font-normal`}),(0,Y.jsxs)(x,{type:`button`,disabled:!f,onClick:()=>ee(!0),"data-tip":`Choose a device on ${h===`testmu`?`TestMu AI`:h===`browserstack`?`BrowserStack`:`this computer`}`,children:[(0,Y.jsx)(Le,{"aria-hidden":`true`}),`Choose`]})]}),(0,Y.jsx)(`span`,{className:`text-body-sm font-normal`,children:(0,Y.jsx)(Nn,{place:h,listing:y,loading:T,error:C})})]}),y&&!y.build.ok&&(0,Y.jsxs)(`p`,{role:`alert`,className:d(S.warn,`m-0 flex items-start gap-2 @2xl:col-span-2`),children:[(0,Y.jsx)(F,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:y.build.note})]})]}):c===`desktop`?(0,Y.jsxs)(Y.Fragment,{children:[e.desktop.apps.length>0&&(0,Y.jsxs)(`label`,{className:U,children:[`App`,(0,Y.jsxs)(r,{"aria-label":`App`,value:N,onChange:e=>te(e.target.value),children:[e.desktop.apps.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e)),(0,Y.jsx)(`option`,{value:``,children:`Another app…`})]})]}),!N&&(0,Y.jsxs)(`div`,{className:U,children:[(0,Y.jsx)(`span`,{children:`Program`}),(0,Y.jsx)(wt,{value:ne,onChange:e=>{P(e),ie||z(e.trim()?Ct(e):``)},onPicked:(e,t)=>{ie||z(t)},onError:le,className:`flex-1`})]})]}):Fe?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 @2xl:col-span-2`,children:[(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm [overflow-wrap:anywhere]`,children:[`Opens `,(e=>e?`${new URL(Fe.startUrl).pathname} on ${e.url}`:Fe.startUrl)(e.apps.find(e=>e.name===Ae)),`, does `,Pe.length>1?`the blocks `:`the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:Pe.map(e=>e.block.name).join(`, then `)}),` (`,u(Pe.reduce((e,t)=>e+t.block.steps,0),`step`),`), then you carry on.`]}),e.apps.length>0&&(0,Y.jsxs)(r,{"aria-label":`Play the blocks on`,value:Ae,onChange:e=>je(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`On the site the block was recorded on`}),e.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[`On `,e.name,` (`,e.url,`)`]},e.name))]})]}):(0,Y.jsxs)(Y.Fragment,{children:[e.apps.length>0&&(0,Y.jsxs)(`label`,{className:U,children:[`Start on`,(0,Y.jsxs)(r,{"aria-label":`Start on`,value:ue,onChange:e=>de(e.target.value),children:[e.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,Y.jsx)(`option`,{value:``,children:`Another page…`})]})]}),!ue&&(0,Y.jsxs)(`label`,{className:U,children:[`Page address`,(0,Y.jsx)(a,{"aria-label":`Page address`,type:`url`,value:fe,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>me(e.target.value)})]})]})}),c===`desktop`&&!N&&(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`grid gap-4 @2xl:grid-cols-[minmax(0,220px)_minmax(0,1fr)]`),children:[(0,Y.jsxs)(`label`,{className:U,children:[`Save it as`,(0,Y.jsx)(a,{"aria-label":`The app's name`,value:L,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{ae(!0),z(e.target.value)}})]}),(0,Y.jsxs)(`label`,{className:U,children:[`Arguments `,(0,Y.jsx)(`span`,{className:$e,children:`Optional: what the app starts with. Quotes keep spaces together; no shell.`}),(0,Y.jsx)(a,{"aria-label":`The app's arguments`,value:B,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>re(e.target.value),className:`font-mono text-body-sm`})]}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted @2xl:col-span-2`,children:[`Added to the apps of `,V||e.environment?`the ${V||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]}),Je&&(0,Y.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0 pt-6`,children:[(0,Y.jsxs)(`legend`,{className:`float-left mb-4 p-0 text-body-sm font-medium`,children:[`Options `,(0,Y.jsx)(`span`,{className:`font-normal text-muted`,children:`· optional`})]}),(0,Y.jsxs)(`div`,{className:`clear-left grid gap-x-6 gap-y-4 @2xl:grid-cols-2`,children:[H&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[Oe.length?`Then the block`:`Start from a block`,` `,(0,Y.jsxs)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:[c===`web`?`Its steps are done for you first, then you record the rest.`:`Its steps are done in ${c===`mobile`?`the app on the device`:`the app`} once it is open, then you record the rest.`,` Add more to do one after another.`]}),(0,Y.jsxs)(r,{value:``,disabled:Oe.length>=10,onChange:e=>{let t=Me.find(t=>t.id===e.target.value);t&&ke([...Oe,{id:t.id,use:Et(t,Ne)}])},children:[(0,Y.jsx)(`option`,{value:``,children:Oe.length?`Add another block`:`No block: start on the page`}),Me.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),Pe.length>0&&(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:Pe.map((n,r)=>(0,Y.jsxs)(`li`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2 font-normal`),children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 text-body-sm text-ink [overflow-wrap:anywhere]`,children:[r+1,`. `,n.block.name]}),(0,Y.jsx)(x,{type:`button`,size:`icon`,variant:`icon`,disabled:t,"aria-label":`Leave out the block ${n.block.name}`,"data-tip":`Leave it out`,onClick:()=>ke(Oe.filter((e,t)=>t!==r)),className:`size-8`,children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),(0,Y.jsx)(kt,{block:n.block}),(0,Y.jsx)(Dt,{block:n.block,secrets:Ne,use:n.use,onChange:e=>ke(Oe.map((t,n)=>n===r?{...t,use:e}:t)),unset:e.unsetSecrets??[]})]},`${n.block.id}-${r}`))})]}),c===`web`&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[`Test case `,(0,Y.jsx)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,Y.jsx)(a,{value:he,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>ge(e.target.value)})]}),Ke&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-2 text-body-sm font-medium`,children:[`Environment `,(0,Y.jsx)(`span`,{className:`-mt-1 text-body-sm font-normal text-muted`,children:`Where the app's address and sign-ins come from.`}),(0,Y.jsx)(r,{value:V,onChange:e=>ve(e.target.value),children:e.environments.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),qe&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 @2xl:col-span-2`,children:[(0,Y.jsx)(Qe,{checked:ye,onChange:be,label:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`text-body-sm 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.`]})]})]}),c===`web`&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 @2xl:col-span-2`,children:[(0,Y.jsx)(Qe,{checked:xe,onChange:Ce,label:`Record a block`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Record a block`}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Steps you do in many tests, like signing in: when you stop, they are kept under a name to start other recordings from or play in the middle of one.`})]})]}),Be&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:U,children:[`Block name`,(0,Y.jsx)(a,{"aria-label":`Block name`,value:we,maxLength:80,placeholder:`Sign in`,onChange:e=>Te(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:U,children:[`Section `,(0,Y.jsx)(`span`,{className:$e,children:`Optional: where it is listed with others, like Account.`}),(0,Y.jsx)(a,{"aria-label":`Section`,value:Ee,maxLength:40,placeholder:`Account`,list:`rec-block-sections`,onChange:e=>De(e.target.value)}),(0,Y.jsx)(`datalist`,{id:`rec-block-sections`,children:[...new Set(e.blocks.flatMap(e=>e.section?[e.section]:[]))].map(e=>(0,Y.jsx)(`option`,{value:e},e))})]})]})]})]}),ce&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:ce})]}),(0,Y.jsx)(Z,{kind:c}),c===`mobile`&&(0,Y.jsx)(Pn,{open:j,onClose:()=>ee(!1),place:h,app:f,listing:y,loading:T,error:C,picked:D,onUse:O,onRefresh:()=>A(e=>e+1)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 pt-4 @4xl:col-span-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] items-start gap-2 text-body-sm text-muted`,children:[(0,Y.jsx)(Se,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:Xe})]}),(0,Y.jsxs)(x,{busy:oe,type:`submit`,variant:`primary`,disabled:t||oe||!He,"data-tip":`Start recording`,className:`min-h-11`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),oe?`Adding…`:t?c===`web`?`Opening…`:`Starting…`:`Record`]})]})]})})}function In(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 Ln({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`&&bt(e.test).hasTest).length,a=Math.round(r/60),o=Math.floor(a/60),s=a%60;return(0,Y.jsxs)(Xe,{label:`Recordings in numbers`,children:[(0,Y.jsx)(et,{compact:!0,icon:fe,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,Y.jsx)(et,{compact:!0,icon:Fe,label:`Tests written`,value:String(i),note:`from these recordings`}),(0,Y.jsx)(et,{compact:!0,icon:Ee,label:`Reusable flows`,value:String(e.blocks.length),note:`blocks kept to use again`}),(0,Y.jsx)(et,{compact:!0,icon:he,label:`Total duration`,value:n.length?o?`${o}h ${s}m`:`${s}m`:`—`,note:n.length?`${u(n.length,`recording`)} timed`:`kept from now on`})]})}function Z({kind:e}){let t=[{icon:I,title:`Record your journey`,text:`Each tap, click, entry and choice in ${e===`web`?`the browser`:e===`mobile`?`the app on the device`:`the app`} is recorded in order.`},{icon:we,title:`Define checks`,text:`Choose what each step must show, and where typed values come from.`},e===`web`?{icon:Fe,title:`Generate the test`,text:`Write turns it into a test in your repository; Re-run plays it on any environment.`}:{icon:fe,title:`Replay it`,text:`It is saved as a workflow that replays with no model, on any environment.`}];return(0,Y.jsxs)(`aside`,{"aria-labelledby":`rec-how`,className:d(s,`flex flex-col gap-4`),children:[(0,Y.jsx)(mt,{id:`rec-how`,icon:re,title:`How it works`,level:3}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:t.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-4`,children:[(0,Y.jsx)(vt,{state:`pending`,n:t+1}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm font-medium`,children:[(0,Y.jsx)(T,{icon:e.icon,size:14,className:`flex-none text-icon`}),e.title]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.text})]})]},e.title))})]})}function Rn({anchor:e,open:t,onClose:n,label:r,align:i,children:a}){let o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!t)return;let n=setTimeout(()=>o.current?.querySelector(`[role^="menuitem"]`)?.focus(),0),r=o.current;return()=>{clearTimeout(n);let t=document.activeElement;setTimeout(()=>{let n=document.activeElement;(!n||n===document.body||n===t&&r?.contains(n))&&e?.querySelector(`button`)?.focus()},0)}},[t,e]),(0,Y.jsx)(`div`,{ref:o,className:`contents`,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,Y.jsx)(h,{open:t,onClose:n,label:r,anchor:e,align:i===`right`?`end`:`start`,className:`w-[230px] text-left`,children:a})})}function zn(){let[e,t]=(0,J.useState)(!1),n=(0,J.useRef)(0);return[e,(0,J.useCallback)(e=>{e||(n.current=Date.now()),t(e)},[]),(0,J.useCallback)(()=>{Date.now()-n.current<300||t(e=>!e)},[])]}function Bn({r:e,onReview:t,onWrite:r,onDelete:i,onNote:a}){let[o,s,c]=zn(),l=(0,J.useRef)(null),u=bt(e.test),d=e=>()=>{s(!1),e()};return(0,Y.jsxs)(`span`,{ref:l,className:`relative inline-block`,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`More for ${e.name}`,"data-tip":`More for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":o,onClick:c,children:(0,Y.jsx)(ge,{"aria-hidden":`true`})}),(0,Y.jsxs)(Rn,{anchor:l.current,open:o,onClose:()=>s(!1),label:`More for ${e.name}`,align:`right`,children:[(e.kind===`web`&&e.ok||e.kind!==`web`&&e.workflow)&&(0,Y.jsx)(p,{onClick:d(t),children:`Open the recording`}),e.kind!==`web`&&e.workflow&&(0,Y.jsx)(p,{onClick:d(()=>xn(e.workflow,e.kind===`mobile`?`mobile`:`desktop`).catch(e=>a(e.message))),children:`Replay`}),e.kind===`web`&&e.ok&&u.hasTest&&e.test?.testFile&&(0,Y.jsx)(p,{onClick:d(()=>void xt(e.test.testFile).then(a)),children:`Open the test`}),e.kind===`web`&&e.ok&&!u.hasTest&&!u.writing&&(0,Y.jsx)(p,{onClick:d(r),children:`Write the test`}),e.test?.chat&&(0,Y.jsx)(p,{onClick:d(()=>location.hash=n(`chats`,e.test.chat)),children:`Open the chat`}),e.trace&&(0,Y.jsx)(p,{onClick:d(()=>void k(e.trace).then(a)),children:`Read the steps`}),e.report&&(0,Y.jsx)(p,{onClick:d(()=>void k(e.report).then(a)),children:`Open the report`}),(0,Y.jsx)(p,{onClick:d(i),children:(0,Y.jsx)(`span`,{className:`text-fail`,children:`Delete`})})]})]})}function Vn({r:e,onNote:t}){let n=bt(e.test);return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,onClick:e=>e.stopPropagation(),children:[e.kind===`web`&&e.ok&&(0,Y.jsx)(`span`,{"data-tip":`${n.detail}${e.test?.testFile?` (${e.test.testFile})`:``}`,children:(0,Y.jsx)(A,{tone:n.tone,icon:n.tone!==`neutral`,className:`min-h-5 px-2 text-body-sm`,children:n.label})}),n.hasTest&&e.test?.testFile&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the test of ${e.name}`,"data-tip":`Open ${e.test.testFile}`,onClick:async()=>t(await xt(e.test.testFile)),children:(0,Y.jsx)(Fe,{"aria-hidden":`true`})}),(e.yaml||e.kind===`mobile`&&e.workflow)&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the workflow of ${e.name}`,"data-tip":`Open the YAML workflow`,onClick:async()=>t(await k(e.yaml||e.workflow)),children:(0,Y.jsx)(B,{"aria-hidden":`true`})}),e.trace&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>t(await k(e.trace)),children:(0,Y.jsx)(He,{"aria-hidden":`true`})}),e.report&&(0,Y.jsx)(x,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>t(await k(e.report)),children:(0,Y.jsx)(Oe,{"aria-hidden":`true`})})]})}function Hn({rows:e,onReview:t,onReviewDesktop:r,onDeleted:i,onChanged:a}){let[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)([]),[f,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,y,b]=zn(),S=(0,J.useRef)(null),[C,E]=(0,J.useState)(`any`),[D,O]=(0,J.useState)(``),[k,j]=(0,J.useState)(`all`);(0,J.useEffect)(()=>l(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let ee=async()=>{g(!0),s(``);try{let e=c.length;i(await v.deleteRecordings(c)),l([]),s(`Deleted ${u(e,`recording`)}.`)}catch(e){s(e.message)}finally{g(!1),p(!1)}},te=e=>e.kind===`web`&&bt(e.test).hasTest,P=k===`all`?e:e.filter(e=>e.kind===k),F=D.toLowerCase().split(/\s+/).filter(Boolean),L=F.length?P.filter(e=>F.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl} ${e.browser||``} ${e.test?.testFile||``} ${e.kind===`web`?bt(e.test).label:``}`.toLowerCase().includes(t))):P,z=C===`any`?L:L.filter(e=>e.kind===`web`&&C===`written`===te(e)),B=z,re=new Set(e.map(e=>e.kind)).size>1,ie=C!==`any`||k!==`all`,ae=e=>{l([e]),p(!0)},oe=e=>bn(e).then(()=>a(),e=>s(e.message)),se=(0,Y.jsxs)(`span`,{ref:S,className:`relative inline-block`,children:[(0,Y.jsxs)(x,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":_,onClick:b,"data-tip":`Show only some recordings`,children:[`Filter`,ie?` · on`:``,(0,Y.jsx)(ne,{"aria-hidden":`true`})]}),(0,Y.jsxs)(Rn,{anchor:S.current,open:_,onClose:()=>y(!1),label:`Show only`,align:`left`,children:[[[`any`,`Any test`],[`written`,`Test written (${e.filter(te).length})`],[`none`,`No test yet (${e.filter(e=>e.kind===`web`&&!te(e)).length})`]].map(([e,t])=>(0,Y.jsx)(m,{role:`menuitemradio`,checked:C===e,onSelect:()=>E(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})},e)),re&&[[`all`,`Every kind`],[`web`,`Web pages`],[`desktop`,`Desktop apps`],[`mobile`,`Mobile apps`]].map(([e,t],n)=>(0,Y.jsx)(`span`,{className:d(`block`,n===0&&`mt-1 border-t border-line-soft pt-1`),children:(0,Y.jsx)(m,{role:`menuitemradio`,checked:k===e,onSelect:()=>j(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})})},e))]})]});return(0,Y.jsxs)(ft,{id:`rec-all`,icon:I,title:`All recordings`,n:z.length,children:[o&&(0,Y.jsx)(`p`,{role:`status`,className:d(`m-0 text-body-sm`,o.startsWith(`Deleted`)?`text-muted`:`text-fail`),children:o}),(0,Y.jsx)(ct,{label:`Recordings`,resetKey:`${C}-${k}-${D}`,search:!1,size:25,height:W,selection:{count:c.length,onClear:()=>l([]),actions:(0,Y.jsxs)(x,{size:`sm`,variant:`danger`,disabled:!c.length||h,"data-tip":`Delete the selected recordings`,onClick:()=>p(!0),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Delete`]})},tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(w,{id:`rec-search`,label:`Search recordings`,placeholder:`Search recordings`,value:D,onChange:O}),se]}),empty:F.length||ie?`Nothing matches.`:`No recordings yet.`,head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`w-9`),children:(0,Y.jsx)(K,{"aria-label":`Select all ${u(B.length,`recording`)}`,"data-tip":`Select all ${u(B.length,`recording`)} the search and filter keep`,checked:B.length>0&&B.every(e=>c.includes(e.runDir)),onCheckedChange:e=>l(e?[...new Set([...c,...B.map(e=>e.runDir)])]:c.filter(e=>!B.some(t=>t.runDir===e)))})}),(0,Y.jsx)(`th`,{scope:`col`,className:st,children:`Recording`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @3xl:table-cell`),children:`Test case`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @4xl:table-cell`),children:`Browser`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(lt,`hidden @4xl:table-cell`),children:`Duration`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @xl:table-cell`),children:`Outputs`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`hidden @2xl:table-cell`),children:`Created`}),(0,Y.jsx)(`th`,{scope:`col`,className:d(st,`w-10`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`More`})})]}),children:B.map(e=>{let i=e.kind!==`web`&&!!e.workflow,a=e.kind===`web`&&e.ok||i,o=()=>i?r(e.workflow):t(e.runDir);return(0,Y.jsxs)(`tr`,{onClick:a?o:void 0,className:a?ot:at,"data-state":c.includes(e.runDir)?`selected`:void 0,children:[(0,Y.jsx)(`td`,{className:G,onClick:e=>e.stopPropagation(),children:(0,Y.jsx)(K,{"aria-label":`Select ${e.name}`,checked:c.includes(e.runDir),onCheckedChange:t=>l(t?[...c,e.runDir]:c.filter(t=>t!==e.runDir))})}),(0,Y.jsx)(`td`,{className:G,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[e.ok?e.kind===`desktop`?(0,Y.jsx)(T,{icon:M,size:16,className:`mt-1 flex-none text-muted`,label:`Desktop app`}):e.kind===`mobile`?(0,Y.jsx)(T,{icon:Le,size:16,className:`mt-1 flex-none text-muted`,label:`Mobile app`}):(0,Y.jsx)(T,{icon:pe,size:16,className:`mt-1 flex-none text-muted`,label:`Web page`}):(0,Y.jsx)(Je,{size:16,"aria-label":`Not recorded`,className:`mt-1 flex-none text-fail`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[a?(0,Y.jsx)(`a`,{href:i?n(`record`):yt(e.runDir),onClick:e=>{e.stopPropagation(),(i||!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.button===0)&&(e.preventDefault(),o())},className:`truncate font-medium text-ink no-underline hover:underline`,"data-tip":e.name,children:e.name}):(0,Y.jsx)(`span`,{className:`truncate font-medium text-ink`,"data-tip":e.name,children:e.name}),(0,Y.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:e.kind===`web`?e.startUrl:e.app}),e.kind===`web`&&e.ok&&(0,Y.jsx)(`span`,{className:`mt-1 @xl:hidden`,"data-tip":bt(e.test).detail,children:(0,Y.jsx)(A,{tone:bt(e.test).tone,icon:bt(e.test).tone!==`neutral`,className:`min-h-5 px-2 text-body-sm`,children:bt(e.test).label})})]})]})}),(0,Y.jsx)(`td`,{className:d(G,`hidden @3xl:table-cell`),children:e.caseId?(0,Y.jsx)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:e.caseId}):(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:d(G,`hidden text-ink-2 @4xl:table-cell`),children:e.browser??(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:d(it,`hidden text-ink-2 @4xl:table-cell`),"data-sort":e.seconds??-1,children:e.seconds===void 0?(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`}):In(e.seconds)}),(0,Y.jsx)(`td`,{className:d(G,`hidden @xl:table-cell`),children:(0,Y.jsx)(Vn,{r:e,onNote:s})}),(0,Y.jsx)(`td`,{className:d(G,`hidden whitespace-nowrap text-ink-2 @2xl:table-cell`),"data-tip":new Date(e.startedAt).toLocaleString(),"data-sort":new Date(e.startedAt).getTime()||0,children:nt(e.startedAt)}),(0,Y.jsx)(`td`,{className:d(G,`text-right`),children:(0,Y.jsx)(Bn,{r:e,onReview:o,onWrite:()=>void oe(e.runDir),onDelete:()=>ae(e.runDir),onNote:s})})]},e.runDir)})}),f&&(0,Y.jsx)(rt,{open:!0,onClose:()=>p(!1),title:`Delete ${u(c.length,`recording`)}`,description:`Their steps, screenshots, tries and reports are removed from this computer. Tests already written from them stay.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(x,{variant:`outline`,disabled:h,onClick:()=>p(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(x,{busy:h,variant:`destructive`,disabled:h,onClick:()=>void ee(),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),h?`Deleting…`:`Delete`]})]}),children:(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 pt-4 text-body-sm text-ink-2`,children:e.filter(e=>c.includes(e.runDir)).map(e=>(0,Y.jsxs)(`li`,{className:`truncate`,children:[e.name,` `,(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,nt(e.startedAt)]})]},e.runDir))})})]})}function Un({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length+(t.block||t.blockError?1:0))?null:(0,Y.jsxs)(`div`,{role:`status`,className:d(s,`flex flex-col gap-2 text-body-sm text-ink`),children:[(0,Y.jsx)(`p`,{className:`m-0 font-medium`,children:`Just recorded: worth knowing`}),t.block&&(0,Y.jsxs)(`p`,{className:`m-0 text-pass [overflow-wrap:anywhere]`,children:[`Kept as the block “`,t.block.name,`”: start other recordings from it on the Record page, or put it into one on its Blocks tab.`]}),t.blockError&&(0,Y.jsxs)(`p`,{className:`m-0 text-fail [overflow-wrap:anywhere]`,children:[`Not kept as a block: `,t.blockError,` The recording is kept; keep its steps as a block on its Blocks tab.`]}),t.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono text-body-sm`,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,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.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,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:t.skipped.map((e,t)=>(0,Y.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function Q({sub:e}={}){let[t,r]=(0,J.useState)(null),i=e?.startsWith(`recording/`)||e?.startsWith(`workflow/`)?e.split(`/`):[],a=i[1]?jn(i[1]):null,o=e=>!!e&&!!t&&(t.recordings.some(t=>t.runDir===e)||t.session?.runDir===e),s=e=>!!e&&!!t&&(t.recordings.some(t=>t.workflow===e)||t.session?.result?.workflow===e),c=i[0]===`recording`&&o(a)?a:null,f=i[0]===`workflow`&&s(a)?a:null,p=i[2],m=e=>location.hash=e?n(`record`,`recording`,encodeURIComponent(e)):n(`record`,`recordings`),h=e=>location.hash=e?n(`record`,`workflow`,encodeURIComponent(e)):n(`record`,`recordings`),_=g(`coding`),y=e=>e===`agent`?_t:e===`recordings`?`recordings`:`new`,[C,w]=(0,J.useState)(i.length?`recordings`:y(e));(0,J.useEffect)(()=>{w(i.length?`recordings`:y(e))},[e]);let[T,E]=(0,J.useState)(``),[O,k]=(0,J.useState)(!1),A=(0,J.useCallback)(()=>{v.get().then(e=>{r(e),E(``)},e=>E(e.message))},[]);(0,J.useEffect)(A,[A]);let j=!!t?.session&&vn.has(t.session.state);(0,J.useEffect)(()=>{if(!j)return;let e=U(A,800);return()=>$e(e)},[j,A]);let ee=!!t?.recordings.some(e=>e.test?.state===`writing`||e.test?.state===`checking`);(0,J.useEffect)(()=>{if(!ee||j)return;let e=U(A,4e3);return()=>$e(e)},[ee,j,A]);let M=(0,J.useRef)(!1),N=t?.session;(0,J.useEffect)(()=>{j?M.current=!0:M.current&&N&&(M.current=!1,N.result?.ok&&N.kind===`web`&&m(N.runDir),N.result?.ok&&N.kind!==`web`&&N.result.workflow&&h(N.result.workflow),w(e=>e===`agent`?`new`:e))},[j,N]);let te=async e=>{k(!0),E(``);try{r(await e())}catch(e){E(e.message)}finally{k(!1)}},ne=(e,t,r)=>{location.hash=n(`record`),window.scrollTo({top:0,behavior:l()}),te(()=>v.start({more:{run:e,after:t,...r?{redo:r}:{}}}))},P=e=>{m(e),window.scrollTo({top:0})},F=!!N?.result&&!N.result.ok,L=!!c||!!f,R=e=>{h(e),window.scrollTo({top:0})},z=e=>{w(e),location.hash=e===`new`?n(`record`):n(`record`,e)};return(0,Y.jsxs)(gt,{title:dt(`record`),page:_,label:`Record`,current:C,onPick:z,tabs:[{id:`new`,label:j?`Recording`:`New recording`,icon:oe},{id:`recordings`,label:`Recordings`,icon:I,...t?.recordings.length?{n:t.recordings.length}:{}}],below:(0,Y.jsx)(ht,{page:_}),children:[!L&&(0,Y.jsx)(pt,{more:(0,Y.jsx)(Y.Fragment,{children:`ForgeQE opens the browser or app; each click, entry and choice is recorded in order, and you choose the checks after.`}),children:`Record a test by doing its steps yourself in a browser, a Windows app or a mobile app.`}),T&&(0,Y.jsx)(`p`,{role:`alert`,className:d(S.fail,`m-0`),children:T}),!t&&!T&&(0,Y.jsx)(D,{shape:`lines`}),t&&N&&j&&(0,Y.jsx)(kn,{s:N,busy:O,secrets:t.mobile.secrets,devices:t.mobile.devices,links:t.mobile.links,blocks:t.blocks.filter(e=>(e.kind??`web`)===N.kind&&(N.kind===`web`||e.app===N.app)),blockSecrets:N.kind===`mobile`?t.mobile.secrets:N.kind===`desktop`?t.desktop.secrets??[]:t.blockSecrets??[],unsetSecrets:t.unsetSecrets??[],onPlayBlock:(e,t)=>void te(()=>v.playBlock(e,t)),send:e=>void te(()=>v.command(e))}),t&&!j&&c&&(0,Y.jsx)(Jt,{runDir:c,notices:N&&N.runDir===c?(0,Y.jsx)(Un,{s:N}):void 0,onRecordMore:(e,t)=>ne(c,e,t),tab:p,onTab:e=>location.hash=e===`steps`?n(`record`,`recording`,encodeURIComponent(c)):n(`record`,`recording`,encodeURIComponent(c),e),onClose:()=>{m(null),w(`recordings`),A()}},c),t&&!j&&f&&(0,Y.jsx)(q,{workflow:f,backLabel:`Recordings`,notices:N&&N.kind===`desktop`&&N.result?.workflow===f?(0,Y.jsx)(Un,{s:N}):void 0,tab:p,onTab:e=>location.hash=e===`steps`?n(`record`,`workflow`,encodeURIComponent(f)):n(`record`,`workflow`,encodeURIComponent(f),e),onClose:()=>{h(null),w(`recordings`),A()}},f),t&&!j&&!L&&(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel-${C}`,"aria-labelledby":`rec-${C}`,className:`flex min-w-0 flex-col gap-4`,children:[C===`new`&&(0,Y.jsxs)(Y.Fragment,{children:[F&&(0,Y.jsx)(An,{s:N}),N?.result?.ok&&(N.kind===`web`||!!N.result.workflow)&&(0,Y.jsxs)(`div`,{className:d(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-4 text-body-sm`),children:[(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:N.name}),(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · `,u(N.steps.length,`step`)]})]}),(0,Y.jsxs)(x,{size:`sm`,onClick:()=>N.kind===`desktop`?R(N.result.workflow):P(N.runDir),"data-tip":`Open the recording`,children:[(0,Y.jsx)(Pe,{"aria-hidden":`true`}),`Open`]})]}),(0,Y.jsx)(Fn,{view:t,busy:O,start:e===`agent`||e===`recordings`?void 0:e,onStart:e=>void te(()=>v.start(e))})]}),C===`recordings`&&(t.recordings.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ln,{view:t}),(0,Y.jsx)(Hn,{rows:t.recordings,onReview:P,onReviewDesktop:R,onDeleted:r,onChanged:A})]}):(0,Y.jsx)(b,{page:!0,icon:I,title:`No recordings yet`,action:(0,Y.jsxs)(x,{size:`sm`,onClick:()=>z(`new`),"data-tip":`New recording`,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Record`]}),children:`Record a test's steps once, and it shows here to review, check and turn into a test.`}))]})]})}export{Q as Record};
@@ -1 +0,0 @@
1
- var e=`/api/prefs/sample`,t=`forgeqe-sample-data`,n=`This page is showing sample data, so nothing was changed. Turn sample data off in Settings › Sample data to work with your project.`,r=!1,i=null;function a(){return r}function o(e){let n=e===!0;n!==r&&(r=n,typeof window<`u`&&window.dispatchEvent(new Event(t)))}function s(e){return i||=e().then(e=>o(!!e&&typeof e==`object`&&e.on===!0),()=>o(!1)),i}var c=`modulepreload`,l=function(e){return`/`+e},u={},ee=function(e){return e.pathname.endsWith(`.css`)},te=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},d=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=l(t,n);let r=s(t),i=ee(r);return te(u,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:c,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},f=`forgeqe-web-token`,p=``;function ne(e){return/(?:^#|&)token=([A-Za-z0-9]+)(?:&|$)/.exec(e)?.[1]}function m(){let e=ne(location.hash);if(!e)return!1;let t=e!==g();return h(e),history.replaceState(null,``,`${location.pathname}${location.search}#/`),t&&x({kind:`token`,token:e,fresh:!0}),t}function re(){window.addEventListener(`hashchange`,()=>{m()&&location.reload()})}function h(e){p=e;try{sessionStorage.setItem(f,e)}catch{}}function g(){if(p)return p;try{return sessionStorage.getItem(f)||``}catch{return``}}var _=`forgeqe-web-sign-in`;function v(e){if(!e||typeof e!=`object`)return;let t=e;if(t.kind===`ask`)return{kind:`ask`};if(t.kind===`token`&&typeof t.token==`string`&&/^[A-Za-z0-9]{1,256}$/.test(t.token))return{kind:`token`,token:t.token,fresh:t.fresh===!0}}var y,b=!1;function x(e){try{y?.postMessage(e)}catch{}}var ie=600,S=Promise.resolve();function ae(){if(typeof BroadcastChannel>`u`)return;y=new BroadcastChannel(_);let e;y.onmessage=t=>{let n=v(t.data);if(!n)return;if(n.kind===`ask`){let e=g();e&&x({kind:`token`,token:e,fresh:!1});return}let r=g();r?n.fresh&&n.token!==r&&(h(n.token),b&&location.reload()):(h(n.token),e?.(),b&&location.reload())},!g()&&(S=new Promise(t=>{let n=setTimeout(t,ie);e=()=>{clearTimeout(n),t()}}),x({kind:`ask`}))}var C=`forgeqe-web-signed-out`,oe=`ForgeQE web does not accept this page's sign-in: it was started again, with a new token. Open the address it printed last (with its #token=…) in this tab.`,se=`This tab is not signed in to ForgeQE web, and no other open ForgeQE tab could share its sign-in. Open the address forgeqe web printed (with its #token=…), then other tabs work too.`;function w(){return g()?oe:se}var T=class extends Error{status;constructor(e,t){super(e),this.status=t}},E=`forgeqe-web-config-changed`,D=``;function O(e,t){e&&(!D||t!==`GET`?D=e:e!==D&&(D=e,window.dispatchEvent(new Event(E))))}function k(){return s(async()=>{await S;let t=await fetch(e,{headers:{Authorization:`Bearer ${g()}`}});return t.ok?t.json():void 0})}async function A(e,t){if(await k(),!a())return;let{sampleAnswer:n}=await d(async()=>{let{sampleAnswer:e}=await import(`./answer-BCM85AEe.js`);return{sampleAnswer:e}},[]);return n(e,t)}async function j(e,t,r){await S;let i=await A(e,t);if(i?.kind===`data`)return i.value;if(i?.kind===`refused`)throw new T(n,409);let a;try{a=await fetch(t,{method:e,headers:{Authorization:`Bearer ${g()}`,...r===void 0?{}:{"Content-Type":`application/json`}},body:r===void 0?void 0:JSON.stringify(r)})}catch{throw new T(`ForgeQE web is not running. Start it in your project folder with forgeqe web, then open the address it prints.`,0)}let o=await a.json().catch(()=>({}));if(a.ok&&O(a.headers.get(`X-ForgeQE-Config`),e),a.status===401)throw b=!0,window.dispatchEvent(new Event(C)),new T(w(),401);if(!a.ok)throw new T(o.error||`The request failed (${a.status}).`,a.status);return o}async function M(e,t){if(await S,(await A(`POST`,t))?.kind===`refused`)throw new T(n,409);let r;try{r=await fetch(t,{method:e,headers:{Authorization:`Bearer ${g()}`}})}catch{throw new T(`ForgeQE web is not running. Start it in your project folder with forgeqe web, then open the address it prints.`,0)}if(!r.ok)throw new T(await r.json().then(e=>e.error,()=>void 0)||`The file could not be made (HTTP ${r.status}).`,r.status);return r.blob()}function N(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}var P={view:()=>j(`GET`,`/api/telemetry`),save:e=>j(`POST`,`/api/telemetry/save`,e),on:e=>j(`POST`,`/api/telemetry/on`,{confirm:e}),off:()=>j(`POST`,`/api/telemetry/off`,{}),test:()=>j(`POST`,`/api/telemetry/test`,{})},F={status:()=>j(`GET`,`/api/voice`),setup:()=>j(`POST`,`/api/voice/setup`,{confirm:!0}),warm:()=>j(`POST`,`/api/voice/warm`,{}),ticket:(e,t)=>j(`POST`,`/api/voice/ticket`,{...e?{chat:e}:{},eagerness:t})},I={repos:(e,t,n,r)=>j(`POST`,`/api/settings/repo-accounts/list`,{id:e,account:t,values:n,taken:r}),signIn:(e,t)=>j(`POST`,`/api/settings/repo-accounts/signin`,{id:e,account:t}),testSearch:(e,t,n,r)=>j(`POST`,`/api/settings/search/test`,{rag:e,mcp:t,query:n,values:r}),documents:()=>j(`GET`,`/api/settings/documents`),addDocument:(e,t,n)=>j(`POST`,`/api/settings/documents`,{name:e,text:t,replace:n}),removeDocument:e=>j(`POST`,`/api/settings/documents/remove`,{name:e})},L={settings:()=>j(`GET`,`/api/settings`),save:(e,t,n,r)=>j(`PUT`,`/api/settings/${e}`,{value:t,version:n,...r&&Object.keys(r).length?{renames:r}:{}}),saveText:(e,t,n,r)=>j(`PUT`,`/api/settings/${e}`,{text:t,env:n,version:r}),splitEnvironments:()=>j(`PUT`,`/api/settings/split`,{}),saveGrid:(e,t,n)=>j(`PUT`,`/api/settings/grid`,{grid:e,value:t,version:n}),test:(e,t,n,r)=>j(`POST`,`/api/test`,{kind:e,id:t,settings:n,values:r}),saveSecrets:e=>j(`PUT`,`/api/secrets`,{values:e}),saveGuardrails:(e,t)=>j(`PUT`,`/api/settings/guardrails`,{rules:e,version:t})},R={list:()=>j(`GET`,`/api/secrets-hub`),save:(e,t)=>j(`POST`,`/api/secrets-hub/secret`,{name:e,value:t}),remove:e=>j(`POST`,`/api/secrets-hub/secret`,{name:e,remove:!0}),saveVault:(e,t)=>j(`POST`,`/api/secrets-hub/vault`,{vault:e,replace:t}),removeVault:e=>j(`POST`,`/api/secrets-hub/vault`,{id:e,remove:!0}),names:(e,t=``)=>j(`GET`,`/api/secrets-hub/vault/${encodeURIComponent(e)}/names${t?`?search=${encodeURIComponent(t)}`:``}`),pull:e=>j(`POST`,`/api/secrets-hub/pull`,e),signIn:e=>j(`POST`,`/api/secrets-hub/vault/${encodeURIComponent(e)}/signin`,{}),signinState:()=>j(`GET`,`/api/secrets-hub/signin`),cancelSignin:()=>j(`POST`,`/api/secrets-hub/signin/cancel`,{}),check:e=>j(`POST`,`/api/secrets-hub/vault/${encodeURIComponent(e)}/check`,{}),exportVaults:()=>j(`GET`,`/api/secrets-hub/export`),importVaults:e=>j(`POST`,`/api/secrets-hub/import`,{text:e}),pullAgain:e=>j(`POST`,`/api/secrets-hub/pull-again`,e?{name:e}:{})},z={state:()=>j(`GET`,`/api/setup`),machine:()=>j(`GET`,`/api/setup/machine`),folders:e=>j(`GET`,`/api/folders${e?`?path=${encodeURIComponent(e)}`:``}`),newFolder:(e,t)=>j(`POST`,`/api/folders`,{parent:e,name:t}),open:e=>j(`PUT`,`/api/project`,{path:e}),init:()=>j(`POST`,`/api/project/init`),run:()=>j(`POST`,`/api/setup/run`),packages:()=>j(`GET`,`/api/setup/packages`)},B={get:()=>j(`GET`,`/api/onboarding`),status:()=>j(`GET`,`/api/onboarding/state`),save:e=>j(`POST`,`/api/onboarding`,e),features:()=>j(`GET`,`/api/onboarding/features`),install:e=>j(`POST`,`/api/onboarding/install`,{features:e,confirm:!0}),repo:()=>j(`GET`,`/api/onboarding/repo`),branches:(e,t)=>j(`POST`,`/api/onboarding/repo/branches`,{url:e,...t?{tokenVar:t}:{}}),clone:(e,t,n)=>j(`POST`,`/api/onboarding/repo/clone`,{url:e,...t?{branch:t}:{},...n?{tokenVar:n}:{}}),startRepo:e=>j(`POST`,`/api/onboarding/repo/init`,e?{remote:e}:{}),tokens:()=>j(`GET`,`/api/onboarding/tokens`)},V={get:()=>j(`GET`,`/api/fx`)},H={list:()=>j(`GET`,`/api/background`)},U={files:()=>j(`GET`,`/api/guardrails/files`),add:e=>j(`POST`,`/api/guardrails/files`,e),save:(e,t)=>j(`PUT`,`/api/guardrails/files/${encodeURIComponent(e)}`,t),remove:e=>j(`DELETE`,`/api/guardrails/files/${encodeURIComponent(e)}`)},W={prompts:()=>j(`GET`,`/api/prompts`),addTeamPrompt:e=>j(`POST`,`/api/prompts/team`,e),saveTeamPrompt:(e,t)=>j(`PUT`,`/api/prompts/team/${encodeURIComponent(e)}`,t),deleteTeamPrompt:e=>j(`DELETE`,`/api/prompts/team/${encodeURIComponent(e)}`),agentPrompt:e=>j(`GET`,`/api/prompts/agent/${encodeURIComponent(e)}`),prompt:e=>j(`GET`,`/api/prompts/${encodeURIComponent(e)}`),savePrompt:(e,t)=>j(`PUT`,`/api/prompts/${encodeURIComponent(e)}`,{text:t}),resetPrompt:e=>j(`DELETE`,`/api/prompts/${encodeURIComponent(e)}`),skills:()=>j(`GET`,`/api/skills`),skill:e=>j(`GET`,`/api/skills/${encodeURIComponent(e)}`),addSkill:e=>j(`POST`,`/api/skills`,e),saveSkill:(e,t)=>j(`PUT`,`/api/skills/${encodeURIComponent(e)}`,t),removeSkill:e=>j(`DELETE`,`/api/skills/${encodeURIComponent(e)}`),registry:()=>j(`GET`,`/api/registry`),logs:()=>j(`GET`,`/api/logs`),log:e=>j(`GET`,`/api/logs/${encodeURIComponent(e)}`),audit:()=>j(`GET`,`/api/audit`),tokenomics:()=>j(`GET`,`/api/tokenomics`)},G={start:(e,t,n,r)=>j(`POST`,`/api/chats`,{text:e,...t,...n?{page:n}:{},...r?{context:r}:{}}),list:()=>j(`GET`,`/api/chats`),events:(e,t,n)=>j(`GET`,`/api/chats/${encodeURIComponent(e)}?after=${t}${n?`&wait=1`:``}`),send:(e,t,n)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/messages`,{text:t,...n?{context:n}:{}}),answer:(e,t,n)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/answer`,{ask:t,choice:n}),proceed:(e,t,n)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/continue`,{wait:t,ok:n}),stop:e=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/stop`,{}),pause:(e,t)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/${t?`pause`:`resume`}`,{}),settings:(e,t)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/settings`,t),screen:(e,t,n)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/screen`,{read:t,text:n}),model:(e,t)=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/model`,{profile:t}),close:e=>j(`DELETE`,`/api/chats/${encodeURIComponent(e)}`),refresh:e=>j(`POST`,`/api/chats/${encodeURIComponent(e)}/refresh`,{}),files:(e,t={})=>j(`GET`,`/api/chat/files?q=${encodeURIComponent(e)}${t.chat?`&chat=${encodeURIComponent(t.chat)}`:``}${t.code===!1?`&code=0`:``}`),attachFile:(e,t={})=>j(`POST`,`/api/chat/files`,{...e,...t}),dropFile:(e,t={})=>j(`DELETE`,`/api/chat/files`,{path:e,...t}),openFile:(e,t={})=>j(`POST`,`/api/chat/files/open`,{path:e,...t})},K={view:()=>j(`GET`,`/api/knowledge/graph`),search:(e,t)=>j(`GET`,`/api/knowledge/graph/search?q=${encodeURIComponent(e)}${t?`&kind=${encodeURIComponent(t)}`:``}`),part:e=>j(`GET`,`/api/knowledge/graph/part?id=${encodeURIComponent(e)}`),build:()=>j(`POST`,`/api/knowledge/graph/build`,{action:`build`}),understand:()=>j(`POST`,`/api/knowledge/graph/build`,{action:`model`,confirmed:!0}),stop:()=>j(`POST`,`/api/knowledge/graph/stop`)},ce={view:()=>j(`GET`,`/api/knowledge/product`),feedback:(e,t,n)=>j(`POST`,`/api/knowledge/feedback`,{id:e,verdict:t,...n?{note:n}:{}})},le={view:()=>j(`GET`,`/api/knowledge/landscape`),decide:(e,t,n)=>j(`POST`,`/api/knowledge/systems`,{repo:e,verdict:t,...n?{system:n}:{}})},ue={overview:()=>j(`GET`,`/api/evidence`),monitor:e=>j(`GET`,`/api/evidence/monitor${e?`?agent=${encodeURIComponent(e)}`:``}`),audit:e=>j(`GET`,`/api/evidence/audit?agent=${encodeURIComponent(e)}`),baseline:(e,t,n)=>j(`POST`,`/api/evidence/baseline`,{agent:e,confirm:t,reason:n}),trust:(e,t,n,r)=>j(`POST`,`/api/evidence/trust`,{agent:e,level:t,confirm:n,reason:r}),learn:e=>j(`GET`,`/api/evidence/learn?agent=${encodeURIComponent(e)}`),replay:(e,t,n,r)=>j(`POST`,`/api/evidence/replay`,{agent:e,run:t,hypothesis:n,replays:r}),decide:(e,t,n,r)=>j(`POST`,`/api/evidence/decide`,{agent:e,proposal:t,decision:n,reason:r}),dashboard:e=>j(`GET`,`/api/evidence/dashboard?agent=${encodeURIComponent(e)}`),runs:()=>j(`GET`,`/api/evidence/runs`),run:e=>j(`GET`,`/api/evidence/run?id=${encodeURIComponent(e)}`),verdict:e=>j(`GET`,`/api/evidence/verdict?id=${encodeURIComponent(e)}`),review:()=>j(`GET`,`/api/evidence/review`),releases:()=>j(`GET`,`/api/evidence/releases`),release:(e,t,n)=>j(`GET`,`/api/evidence/release?agent=${encodeURIComponent(e)}&candidate=${encodeURIComponent(t)}${n?`&live=${encodeURIComponent(n)}`:``}`),overrule:(e,t,n)=>j(`POST`,`/api/evidence/overrule`,{run:e,finding:t,reason:n}),drafts:()=>j(`GET`,`/api/evidence/drafts`),decideDraft:(e,t,n,r)=>j(`POST`,`/api/evidence/draft`,{id:e,decision:t,confirm:n,reason:r}),grade:(e,t,n,r)=>j(`POST`,`/api/evidence/grade`,{run:e,criterion:t,grade:n,reason:r}),contracts:()=>j(`GET`,`/api/evidence/contracts`)},de={view:()=>j(`GET`,`/api/knowledge/engineering`),service:e=>j(`GET`,`/api/knowledge/engineering/service?repo=${encodeURIComponent(e)}`),impact:e=>j(`GET`,`/api/knowledge/engineering/impact?id=${encodeURIComponent(e)}`),path:(e,t)=>j(`GET`,`/api/knowledge/engineering/path?from=${encodeURIComponent(e)}&to=${encodeURIComponent(t)}`),codeMap:e=>j(`GET`,`/api/knowledge/engineering/codemap${e?`?repo=${encodeURIComponent(e)}`:``}`),files:e=>j(`GET`,`/api/knowledge/engineering/files${e?`?repo=${encodeURIComponent(e)}`:``}`),churn:()=>j(`GET`,`/api/knowledge/engineering/churn`)},fe={knowledge:()=>j(`GET`,`/api/knowledge`),knowledgeFile:e=>j(`GET`,`/api/knowledge/file?rel=${encodeURIComponent(e)}`),saveKnowledgeFile:(e,t)=>j(`PUT`,`/api/knowledge/file`,{rel:e,text:t}),docsStatus:()=>j(`GET`,`/api/docs/status`),indexDocs:()=>j(`POST`,`/api/docs/index`),searchDocs:(e,t={})=>j(`POST`,`/api/docs/search`,{query:e,...t}),docOutline:e=>j(`GET`,`/api/docs/outline?rel=${encodeURIComponent(e)}`),docFile:(e,t)=>j(`GET`,`/api/docs/file?source=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`),memory:()=>j(`GET`,`/api/memory`),clearMemory:e=>j(`POST`,`/api/memory/clear`,{...e?{target:e.name,kind:e.kind}:{},confirmed:!0})},pe={get:()=>j(`GET`,`/api/theme`),uploadLogo:(e,t,n=`logo`)=>j(`POST`,`/api/theme/logo`,{data:e,type:t,which:n}),fromUrl:e=>j(`POST`,`/api/theme/from-url`,{url:e})},me={convert:(e,t)=>j(`POST`,`/api/environments/convert`,{...e,...t?{name:t}:{}}),files:e=>j(`GET`,`/api/environments/files?kind=${e}`)},he={get:()=>j(`GET`,`/api/workspace`)},ge={open:e=>j(`POST`,`/api/files/open`,{path:e})},_e={list:()=>j(`GET`,`/api/reports`),build:()=>j(`POST`,`/api/reports/project/build`),buildStatus:()=>j(`GET`,`/api/reports/project/build`)},ve={list:()=>j(`GET`,`/api/jobs`),detail:e=>j(`GET`,`/api/jobs/${encodeURIComponent(e)}`),log:(e,t)=>j(`GET`,`/api/jobs/${encodeURIComponent(e)}/log?tail=400${t?`&run=${encodeURIComponent(t)}`:``}`),add:e=>j(`POST`,`/api/jobs`,e),act:(e,t)=>j(`POST`,`/api/jobs/${encodeURIComponent(e)}/${t}`),remove:e=>j(`DELETE`,`/api/jobs/${encodeURIComponent(e)}`)},ye={list:()=>j(`GET`,`/api/runs`),detail:e=>j(`GET`,`/api/runs/${encodeURIComponent(e)}`),cancel:e=>j(`POST`,`/api/runs/${encodeURIComponent(e)}/cancel`)},be={get:()=>j(`GET`,`/api/record`),mobileDevices:(e,t,n=!1)=>j(`GET`,`/api/record/mobile/devices?place=${encodeURIComponent(e)}&app=${encodeURIComponent(t)}${n?`&fresh=1`:``}`),review:e=>j(`GET`,`/api/record/review?run=${encodeURIComponent(e)}`),saveReview:(e,t)=>j(`POST`,`/api/record/review`,{run:e,...t}),restoreReview:(e,t)=>j(`POST`,`/api/record/review`,{run:e,restore:t}),suggest:e=>j(`POST`,`/api/record/suggest`,{run:e}),useBlock:(e,t,n)=>j(`POST`,`/api/record/review`,{run:e,useBlock:{block:t,from:n}}),insertBlock:(e,t,n,r)=>j(`POST`,`/api/record/review`,{run:e,insert:{after:t,block:n,...r}}),refreshBlock:(e,t,n)=>j(`POST`,`/api/record/review`,{run:e,refreshBlock:{block:t,from:n}}),blocks:()=>j(`GET`,`/api/record/blocks`),saveBlock:(e,t,n,r,i)=>j(`POST`,`/api/record/blocks`,{run:e,name:t,from:n,to:r,...i?{section:i}:{}}),updateBlock:(e,t)=>j(`POST`,`/api/record/blocks/update`,{id:e,...t}),deleteBlock:(e,t=!1)=>j(`POST`,`/api/record/blocks/delete`,{id:e,...t?{confirmed:!0}:{}}),playBlock:(e,t)=>j(`POST`,`/api/record/command`,{cmd:`play_block`,block:{id:e,...t}}),deleteRecordings:e=>j(`POST`,`/api/record/delete`,{runs:e,confirmed:!0}),tryView:e=>j(`GET`,`/api/record/try?run=${encodeURIComponent(e)}`),tryRun:(e,t,n,r)=>j(`POST`,`/api/record/try`,{run:e,...t?{env:t}:{},data:n,...r?{each:r}:{}}),write:(e,t)=>j(`POST`,`/api/record/write`,{run:e,check:t.check,...t.env?{env:t.env}:{},...t.data?{data:t.data}:{},...t.each?{each:t.each}:{}}),stopWrite:e=>j(`POST`,`/api/record/write/stop`,{run:e}),reheal:(e,t,n,r)=>j(`POST`,`/api/record/reheal`,{run:e,...t?{env:t}:{},data:n,...r?{each:r}:{}}),acceptReheals:(e,t)=>j(`POST`,`/api/record/reheal/accept`,{run:e,...t.length?{steps:t}:{}}),tryStop:e=>j(`POST`,`/api/record/try/stop`,{run:e}),shot:(e,t)=>Q(`/api/record/shot?run=${encodeURIComponent(e)}&shot=${encodeURIComponent(t)}`,`image/jpeg`),tryShot:(e,t)=>{let n=`/api/record/shot?run=${encodeURIComponent(e)}&kind=try&shot=${String(t).padStart(3,`0`)}`;return Q(n,`image/jpeg`).catch(()=>Q(n,`image/png`))},openVideo:(e,t)=>j(`POST`,`/api/record/video/open`,{run:e,kind:t}),openLog:(e,t)=>j(`POST`,`/api/record/log/open`,{run:e,which:t}),openTrace:e=>j(`POST`,`/api/record/trace/open`,{run:e}),screen:()=>Q(`/api/record/screen`,`image/png`),start:e=>j(`POST`,`/api/record`,e),command:e=>j(`POST`,`/api/record/command`,e)},xe={list:()=>j(`GET`,`/api/packs`),detail:e=>j(`GET`,`/api/packs/${encodeURIComponent(e)}`),build:e=>j(`POST`,`/api/packs/build`,e),run:(e,t)=>j(`POST`,`/api/packs/${encodeURIComponent(e)}/run`,{on:t}),heal:(e,t)=>j(`POST`,`/api/packs/${encodeURIComponent(e)}/heal`,{tests:t}),stop:()=>j(`POST`,`/api/packs/stop`,{}),answer:(e,t)=>j(`POST`,`/api/packs/answer`,{id:e,choice:t}),edit:(e,t)=>j(`POST`,`/api/packs/${encodeURIComponent(e)}/edit`,t),refresh:e=>j(`POST`,`/api/packs/${encodeURIComponent(e)}/refresh`,{}),compare:(e,t)=>j(`GET`,`/api/packs/${encodeURIComponent(e)}/compare?with=${encodeURIComponent(t)}`)},Se={view:()=>j(`GET`,`/api/desktop`),replay:e=>j(`POST`,`/api/desktop/replay`,e),explore:(e,t,n)=>j(`POST`,`/api/desktop/explore`,{app:e,goal:t,name:n,confirmed:!0}),validate:e=>j(`POST`,`/api/desktop/validate`,{workflow:e}),setup:e=>j(`POST`,`/api/desktop/setup`,{...e,confirmed:!0}),doctor:()=>j(`POST`,`/api/desktop/doctor`,{}),acceptHeals:e=>j(`POST`,`/api/desktop/heals`,{run:e}),addApp:e=>j(`POST`,`/api/desktop/apps`,e),steps:e=>j(`GET`,`/api/desktop/steps?workflow=${encodeURIComponent(e)}`),editStep:e=>j(`POST`,`/api/desktop/steps/edit`,e),restore:(e,t,n)=>j(`POST`,`/api/desktop/restore`,{workflow:e,backup:t,...n?{version:n}:{}}),saveBlock:(e,t,n,r,i)=>j(`POST`,`/api/desktop/blocks`,{workflow:e,from:t,to:n,name:r,...i?{section:i}:{}}),review:e=>j(`GET`,`/api/desktop/review?workflow=${encodeURIComponent(e)}`),controls:(e,t)=>j(`GET`,`/api/desktop/controls?run=${encodeURIComponent(e)}&step=${t}`),shot:(e,t)=>Q(`/api/desktop/shot?run=${encodeURIComponent(e)}&step=${t}`,`image/png`),editApp:e=>j(`POST`,`/api/desktop/apps/edit`,e),removeApp:(e,t)=>j(`POST`,`/api/desktop/apps/remove`,{name:e,confirmed:t}),browse:()=>j(`POST`,`/api/desktop/browse`,{}),stop:()=>j(`POST`,`/api/desktop/stop`,{}),answer:(e,t)=>j(`POST`,`/api/desktop/answer`,{id:e,choice:t})},Ce={view:()=>j(`GET`,`/api/mobile`),live:()=>j(`GET`,`/api/mobile/live`),screen:e=>Q(`/api/mobile/live/screen?id=${encodeURIComponent(e)}`,`image/png`),replay:e=>j(`POST`,`/api/mobile/replay`,e),explore:e=>j(`POST`,`/api/mobile/explore`,{...e,confirmed:!0}),maestro:(e,t)=>j(`POST`,`/api/mobile/maestro`,{flows:e,...t?.length?{devices:t}:{}}),validate:e=>j(`POST`,`/api/mobile/validate`,{workflow:e}),keepDevices:(e,t)=>j(`POST`,`/api/mobile/devices/keep`,{app:e,picks:t}),setup:e=>j(`POST`,`/api/mobile/setup`,{force:e,confirmed:!0}),doctor:()=>j(`POST`,`/api/mobile/doctor`,{}),upload:e=>j(`POST`,`/api/mobile/upload`,{...e,confirmed:!0}),stop:()=>j(`POST`,`/api/mobile/stop`,{}),answer:(e,t)=>j(`POST`,`/api/mobile/answer`,{id:e,choice:t}),chatDevice:e=>j(`GET`,`/api/chats/${encodeURIComponent(e)}/device`),chatScreen:(e,t)=>Q(`/api/chats/${encodeURIComponent(e)}/device/screen?id=${encodeURIComponent(t)}`,`image/png`)},q=e=>`/api/migrations/${encodeURIComponent(e)}`,we={list:()=>j(`GET`,`/api/migrations`),testRepository:(e,t)=>j(`POST`,`/api/migrations/sources/test`,{url:e,tokenVar:t}),source:e=>j(`POST`,`/api/migrations/sources`,e),files:(e,t)=>j(`POST`,`/api/migrations/sources/${encodeURIComponent(e)}/files`,{files:t}),finish:e=>j(`POST`,`/api/migrations/sources/${encodeURIComponent(e)}/finish`,{}),discover:(e,t)=>j(`GET`,`/api/migrations/discover?${new URLSearchParams({...e?{workspace:e}:{},from:t})}`),plan:e=>j(`POST`,`/api/migrations/plan`,e),detail:e=>j(`GET`,q(e)),events:(e,t)=>j(`GET`,`${q(e)}/events?after=${t}`),pair:(e,t)=>j(`GET`,`${q(e)}/files?unit=${encodeURIComponent(t)}`),report:e=>j(`GET`,`${q(e)}/report`),start:(e,t,n)=>j(`POST`,`${q(e)}/start`,{confirm:t,acceptLimits:n}),verify:e=>j(`POST`,`${q(e)}/verify`,{}),fix:(e,t,n)=>j(`POST`,`${q(e)}/fix`,{units:t,note:n}),stop:e=>j(`POST`,`${q(e)}/stop`,{}),delete:(e,t)=>j(`POST`,`${q(e)}/delete`,{confirm:t})},J=e=>`/api/tosca/assistant/${encodeURIComponent(e)}`,Te={start:e=>j(`POST`,`/api/tosca/assistant`,{text:e}),view:e=>j(`GET`,J(e)),say:(e,t)=>j(`POST`,J(e),{text:t}),pick:(e,t,n)=>j(`POST`,J(e),{question:t,pick:n}),token:(e,t)=>j(`POST`,J(e),{tokenVar:t}),end:e=>j(`DELETE`,J(e))},Y=e=>`/api/tosca/${encodeURIComponent(e)}`,X={list:()=>j(`GET`,`/api/tosca`),inspect:(e,t)=>j(`POST`,`/api/tosca/inspect`,{file:e,testAttributes:t}),inspectSources:(e,t)=>j(`POST`,`/api/tosca/inspect`,{sources:e,testAttributes:t}),clone:(e,t,n)=>j(`POST`,`/api/tosca/sources/git`,{url:e,...t?{branch:t}:{},...n?{tokenVar:n}:{}}),removeClone:e=>j(`DELETE`,`/api/tosca/sources/${encodeURIComponent(e)}`),adopt:e=>j(`POST`,`/api/tosca/sources/${encodeURIComponent(e)}/adopt`),plan:e=>j(`POST`,`/api/tosca/plan`,e),detail:e=>j(`GET`,Y(e)),events:(e,t)=>j(`GET`,`${Y(e)}/events?after=${t}`),case:(e,t)=>j(`GET`,`${Y(e)}/case?id=${encodeURIComponent(t)}`),estimate:e=>j(`GET`,`${Y(e)}/estimate`),ci:(e,t)=>j(`GET`,`${Y(e)}/ci?kind=${t}`),writeCi:(e,t)=>j(`POST`,`${Y(e)}/ci`,{kind:t}),data:e=>j(`GET`,`${Y(e)}/data`),setData:(e,t)=>j(`POST`,`${Y(e)}/data`,t),pr:(e,t=``)=>j(`GET`,`${Y(e)}/pr${t?`?base=${encodeURIComponent(t)}`:``}`),openPr:(e,t)=>j(`POST`,`${Y(e)}/pr`,t),reimport:(e,t)=>j(`POST`,`${Y(e)}/reimport`,{refresh:t}),ready:e=>j(`GET`,`${Y(e)}/ready`),answer:(e,t)=>j(`POST`,`${Y(e)}/ready`,t),report:e=>j(`GET`,`${Y(e)}/report`),reportCase:(e,t)=>j(`GET`,`${Y(e)}/report-case?id=${encodeURIComponent(t)}`),reportZip:async e=>{await S;let t=await fetch(`${Y(e)}/report-zip`,{headers:{Authorization:`Bearer ${g()}`}});if(!t.ok)throw new T(await t.json().then(e=>e.error,()=>void 0)||`The zip could not be made (HTTP ${t.status}).`,t.status);return t.blob()},reportHtml:async e=>{await S;let t=await fetch(`${Y(e)}/report-html`,{headers:{Authorization:`Bearer ${g()}`}});if(!t.ok)throw new T(`The HTML report could not be made (HTTP ${t.status}).`,t.status);return t.blob()},evidenceUrl:(e,t,n)=>`${Y(e)}/evidence/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,evidence:(e,t,n)=>Q(X.evidenceUrl(e,t,n),De(n)),start:(e,t,n,r)=>j(`POST`,`${Y(e)}/start`,{confirm:t,acceptLimits:n,...r?{batch:r}:{}}),fix:(e,t,n)=>j(`POST`,`${Y(e)}/fix`,{units:t,note:n}),stop:e=>j(`POST`,`${Y(e)}/stop`,{}),verify:(e,t,n)=>j(`POST`,`${Y(e)}/verify`,{...t?{suite:t}:{},...n?.length?{units:n}:{}}),delete:(e,t)=>j(`POST`,`${Y(e)}/delete`,{confirm:t})},Z=(e,t)=>`/api/apitests/${encodeURIComponent(e)}/${t}`,Ee={view:()=>j(`GET`,`/api/apitests`),set:e=>j(`GET`,`/api/apitests/${encodeURIComponent(e)}`),contracts:e=>j(`POST`,`/api/apitests/contracts`,e),run:(e,t)=>j(`POST`,Z(e,`run`),t),runAll:(e,t)=>j(`POST`,Z(e,`run-all`),t),scenarios:(e,t)=>j(`POST`,Z(e,`scenarios`),t),runScenarios:(e,t)=>j(`POST`,Z(e,`run-scenarios`),t),stop:()=>j(`POST`,`/api/apitests/stop`,{}),send:(e,t)=>j(`POST`,Z(e,`send`),t),preview:(e,t)=>j(`POST`,Z(e,`preview`),t),save:(e,t)=>j(`POST`,Z(e,`save`),t),signInSave:(e,t)=>j(`POST`,Z(e,`sign-in-save`),{signIn:t}),signInRemove:(e,t)=>j(`POST`,Z(e,`sign-in-remove`),{name:t}),expectFrom:(e,t)=>j(`POST`,Z(e,`expect-from`),t),add:(e,t)=>j(`POST`,Z(e,`add`),t),rename:(e,t)=>j(`POST`,Z(e,`rename`),t),remove:(e,t)=>j(`POST`,Z(e,`remove`),{call:t}),renameFolder:(e,t,n)=>j(`POST`,Z(e,`folder-rename`),{folder:t,to:n}),removeFolder:(e,t)=>j(`POST`,Z(e,`folder-remove`),{folder:t}),deleteSet:e=>j(`POST`,Z(e,`delete`),{confirmed:!0}),auth:(e,t)=>j(`POST`,Z(e,`auth`),t),base:(e,t)=>j(`POST`,Z(e,`base`),t),prefs:(e,t)=>j(`POST`,Z(e,`prefs`),t),saveFlow:(e,t)=>j(`POST`,Z(e,`flow-save`),{flow:t}),removeFlow:(e,t)=>j(`POST`,Z(e,`flow-remove`),{flow:t}),importCollection:(e,t)=>j(`POST`,`/api/apitests/import`,{collection:e,...t?{name:t}:{}}),exportCollection:e=>j(`GET`,Z(e,`postman`)),specFile:(e,t)=>j(`POST`,`/api/apitests/spec-file`,{name:e,text:t})};async function Q(e,t=`image/png`){await S;let n=await fetch(e,{headers:{Authorization:`Bearer ${g()}`}}),r=(n.headers.get(`content-type`)||``).split(`;`)[0].trim();if(!n.ok||r!==t)throw new T(`The image could not be loaded.`,n.status);let i=new Blob([await n.arrayBuffer()],{type:t}),a=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.onerror=()=>t(new T(`The image could not be read.`,0)),n.readAsDataURL(i)});if(!a.startsWith(`data:${t};base64,`))throw new T(`The image could not be read.`,0);return a}function De(e){let t=e.slice(e.lastIndexOf(`.`)).toLowerCase();return t===`.jpg`||t===`.jpeg`?`image/jpeg`:t===`.webp`?`image/webp`:t===`.webm`?`video/webm`:t===`.mp4`?`video/mp4`:`image/png`}var Oe={view:()=>j(`GET`,`/api/quality`),run:e=>j(`GET`,`/api/quality/${encodeURIComponent(e)}`),compare:e=>j(`POST`,`/api/quality/${encodeURIComponent(e)}/compare`,{}),approve:(e,t,n)=>j(`POST`,`/api/quality/${encodeURIComponent(e)}/approve`,{pages:t,...n?{reason:n}:{}}),image:(e,t,n)=>Q(`/api/quality/${encodeURIComponent(e)}/image/${t}/${n}`),shot:(e,t)=>Q(`/api/quality/${encodeURIComponent(e)}/${t.split(`/`).map(encodeURIComponent).join(`/`)}`,`image/jpeg`)},ke={view:()=>j(`GET`,`/api/perf`),predict:(e,t)=>j(`GET`,`/api/perf/predict?plan=${encodeURIComponent(e)}${t?.length?`&users=${t.join(`,`)}`:``}`),plan:(e,t)=>j(`GET`,`/api/perf/plan?plan=${encodeURIComponent(e)}${t?`&env=${encodeURIComponent(t)}`:``}`),run:(e,t)=>j(`GET`,`/api/perf/run?plan=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),baseline:(e,t,n)=>j(`POST`,`/api/perf/baseline`,{plan:e,id:t,confirmed:!0,...n?{reason:n}:{}}),report:(e,t)=>j(`POST`,`/api/perf/report`,{plan:e,id:t}),analyse:(e,t)=>j(`POST`,`/api/perf/analyse`,{plan:e,id:t}),convert:e=>j(`POST`,`/api/perf/convert`,e),exportLoadRunner:e=>j(`POST`,`/api/perf/export`,e),import:e=>j(`POST`,`/api/perf/import`,e),setup:()=>j(`POST`,`/api/perf/setup`,{confirmed:!0}),start:e=>j(`POST`,`/api/perf/run`,e),stop:()=>j(`POST`,`/api/perf/stop`,{}),strategies:()=>j(`GET`,`/api/perf/strategies`),strategy:e=>j(`GET`,`/api/perf/strategy?id=${encodeURIComponent(e)}`),draftStrategy:(e,t)=>j(`POST`,`/api/perf/strategy`,{request:e,...t?{nfr_file:t.file,...t.sheet?{sheet:t.sheet}:{}}:{}}),strategySummary:e=>j(`GET`,`/api/perf/strategy/summary?id=${encodeURIComponent(e)}`),linkStrategyRun:(e,t,n,r)=>j(`POST`,`/api/perf/strategy/link`,{id:e,test:t,plan:n,...r?{run:r}:{}}),markStrategyNfr:(e,t,n,r)=>j(`POST`,`/api/perf/strategy/mark`,{id:e,nfr:t,status:n,note:r}),exportStrategySummary:e=>j(`POST`,`/api/perf/strategy/summary/export`,{id:e}),checkStrategy:(e,t,n)=>j(`GET`,`/api/perf/strategy/check?id=${encodeURIComponent(e)}&plan=${encodeURIComponent(t)}${n?`&run=${encodeURIComponent(n)}`:``}`),approveStrategy:(e,t,n)=>j(`POST`,`/api/perf/strategy/approve`,{id:e,typed:t,digest:n}),writeStrategy:e=>j(`POST`,`/api/perf/strategy/write`,{id:e})},Ae={view:(e,t)=>j(`GET`,`/api/test-cases?${new URLSearchParams({system:e,story:t})}`),preview:(e,t,n)=>j(`POST`,`/api/test-cases/preview`,{system:e,story:t,changes:n}),apply:(e,t,n)=>j(`POST`,`/api/test-cases/apply`,{system:e,story:t,changes:n,confirmed:!0}),tryMapping:(e,t,n)=>j(`POST`,`/api/test-cases/try-mapping`,{system:e,key:t,value:n})},je={personas:()=>j(`GET`,`/api/a11y/personas`),sessions:()=>j(`GET`,`/api/a11y/sessions`),session:e=>j(`GET`,`/api/a11y/sessions/${encodeURIComponent(e)}`)},Me=[`sme`,`end_user`,`specialist`,`business_user`],Ne=[`novice`,`intermediate`,`expert`],Pe=[`legitimate`,`opportunistic`,`adversarial`],Fe=[`low`,`medium`,`high`],Ie={list:()=>j(`GET`,`/api/personas`),draft:e=>j(`POST`,`/api/personas/draft`,e),exportFile:()=>j(`GET`,`/api/personas/export`),importFile:e=>j(`POST`,`/api/personas/import`,{text:e}),save:e=>j(`POST`,`/api/personas`,{persona:e}),update:(e,t)=>j(`POST`,`/api/personas/update`,{id:e,persona:t}),resources:()=>j(`GET`,`/api/personas/resources`),suggest:e=>j(`GET`,`/api/personas/suggest?id=${encodeURIComponent(e)}`),own:e=>j(`GET`,`/api/personas/own?id=${encodeURIComponent(e)}`),draftOwn:e=>j(`POST`,`/api/personas/own/draft`,{id:e}),saveOwn:(e,t)=>j(`POST`,`/api/personas/own/save`,{id:e,items:t}),removeOwn:(e,t,n)=>j(`POST`,`/api/personas/own/remove`,{id:e,kind:t,name:n})},Le={view:()=>j(`GET`,`/api/data`),log:(e=500)=>j(`GET`,`/api/data/log?limit=${e}`),impact:e=>j(`GET`,`/api/data/impact?of=${encodeURIComponent(e)}`),stop:()=>j(`POST`,`/api/data/stop`,{}),run:(e,t)=>j(`POST`,`/api/data/${e}`,t)},Re={view:()=>j(`GET`,`/api/features`),detail:e=>j(`GET`,`/api/features/${encodeURIComponent(e)}`),scope:(e,t)=>j(`POST`,`/api/features/${encodeURIComponent(e)}/scope`,{to:t})},ze={job:()=>j(`GET`,`/api/refine`),start:(e,t)=>j(`POST`,`/api/refine`,{text:e,key:t}),stop:()=>j(`POST`,`/api/refine/stop`,{})},Be={view:()=>j(`GET`,`/api/about`),generated:()=>j(`GET`,`/api/generated`),run:(e,t={})=>j(`POST`,`/api/about/${e}`,t),stop:()=>j(`POST`,`/api/about/stop`,{}),restart:()=>j(`POST`,`/api/about/restart`,{confirmed:!0})},Ve={view:e=>j(`GET`,`/api/feedback${e?`?session=${encodeURIComponent(e)}`:``}`),draft:e=>j(`POST`,`/api/feedback/draft`,e),text:e=>j(`POST`,`/api/feedback/text`,{draft:e}),send:e=>j(`POST`,`/api/feedback/send`,e)},$={tools:e=>j(`GET`,`/api/agents/${encodeURIComponent(e)}`),directory:()=>j(`GET`,`/api/agents`)},He={get:()=>j(`GET`,`/api/signin`),start:e=>j(`POST`,`/api/signin`,{system:e}),answer:(e,t)=>j(`POST`,`/api/signin/answer`,{id:e,value:t}),cancel:()=>j(`POST`,`/api/signin/cancel`,{}),signOut:e=>j(`POST`,`/api/signout`,{system:e})},Ue={get:()=>j(`GET`,`/api/copilot`),signIn:e=>j(`POST`,`/api/copilot/signin`,{how:e}),answer:(e,t)=>j(`POST`,`/api/copilot/signin/answer`,{id:e,value:t}),cancel:()=>j(`POST`,`/api/copilot/signin/cancel`,{}),signOut:()=>j(`POST`,`/api/copilot/signout`,{}),models:()=>j(`GET`,`/api/copilot/models`),syncModels:()=>j(`POST`,`/api/copilot/models/sync`,{})},We={list:()=>j(`GET`,`/api/teams`),view:e=>j(`GET`,`/api/teams/${encodeURIComponent(e)}`),act:(e,t,n)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/${t}`,n),ask:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/ask`,{words:t}),try:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/try`,{words:t}),sharedFile:(e,t,n)=>j(`GET`,`/api/teams/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/files/${encodeURIComponent(n)}`),choices:()=>j(`GET`,`/api/teams/_choices`),propose:e=>j(`POST`,`/api/teams/_propose`,{goal:e}),create:e=>j(`POST`,`/api/teams`,{fields:e}),save:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/save`,{fields:t}),own:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/own`,t),ownAll:()=>j(`GET`,`/api/teams/_own`),look:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/look`,{look:t}),image:(e,t,n)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/image`,n===null?{slot:t,remove:!0}:{slot:t,data:n}),remove:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/delete`,{confirm:t}),canvas:(e,t)=>j(`POST`,`/api/teams/${encodeURIComponent(e)}/canvas`,{positions:t})},Ge={list:()=>j(`GET`,`/api/custom-agents`),bulk:(e,t,n)=>j(`POST`,`/api/custom-agents/bulk`,{action:e,ids:t,confirm:n}),view:e=>j(`GET`,`/api/custom-agents/${encodeURIComponent(e)}`),audit:async e=>{await S;let t=await fetch(`/api/custom-agents/${encodeURIComponent(e)}/audit`,{headers:{Authorization:`Bearer ${g()}`}});if(!t.ok)throw new T(`Its record could not be read (HTTP ${t.status}).`,t.status);return t.text()},checks:{job:()=>j(`GET`,`/api/agent-checks`),start:e=>j(`POST`,`/api/agent-checks/${encodeURIComponent(e)}`,{}),stop:()=>j(`POST`,`/api/agent-checks/stop`,{}),answer:(e,t)=>j(`POST`,`/api/agent-checks/answer`,{id:e,choice:t})},version:(e,t)=>j(`GET`,`/api/custom-agents/${encodeURIComponent(e)}/versions/${encodeURIComponent(t)}`),duplicate:(e,t={})=>j(`POST`,`/api/custom-agents/${encodeURIComponent(e)}/duplicate`,t),pack:async e=>{await S;let t=await fetch(`/api/custom-agents/${encodeURIComponent(e)}/pack`,{headers:{Authorization:`Bearer ${g()}`}});if(!t.ok)throw new T(`Its package could not be read (HTTP ${t.status}).`,t.status);return t.blob()},importPreview:(e,t)=>j(`POST`,`/api/custom-agents/import/preview`,{pack:{base64:e},...t?{id:t}:{}}),importPack:(e,t={})=>j(`POST`,`/api/custom-agents/import`,{pack:{base64:e},...t}),choices:()=>j(`GET`,`/api/custom-agents/choices`),validate:e=>j(`POST`,`/api/custom-agents/validate`,{fields:e}),save:(e,t)=>j(`POST`,`/api/custom-agents`,{fields:e,...t}),library:{list:()=>j(`GET`,`/api/custom-agents/_library`),pack:e=>j(`GET`,`/api/custom-agents/_library/${encodeURIComponent(e)}`),publish:e=>j(`POST`,`/api/custom-agents/${encodeURIComponent(e)}/publish`),remove:(e,t)=>j(`POST`,`/api/custom-agents/_library/remove`,{entry:e,confirm:t})},forget:(e,t)=>j(`POST`,`/api/custom-agents/${encodeURIComponent(e)}/memory`,t),act:(e,t,n)=>j(`POST`,`/api/custom-agents/${encodeURIComponent(e)}/${t}`,n),templates:()=>j(`GET`,`/api/custom-agent-templates`),template:e=>j(`GET`,`/api/custom-agent-templates/${encodeURIComponent(e)}`)},Ke={list:()=>j(`GET`,`/api/agent-builder`),start:e=>j(`POST`,`/api/agent-builder`,{goal:e}),view:e=>j(`GET`,`/api/agent-builder/${encodeURIComponent(e)}`),answer:(e,t,n)=>j(`POST`,`/api/agent-builder/${encodeURIComponent(e)}/${t}`,n),discard:e=>j(`DELETE`,`/api/agent-builder/${encodeURIComponent(e)}`)},qe={list:()=>j(`GET`,`/api/agent-approvals`),answer:(e,t,n)=>j(`POST`,`/api/agent-approvals/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{choice:n})},Je={view:e=>j(`GET`,`/api/impact${e?`?repo=${encodeURIComponent(e)}`:``}`),run:(e,t,n)=>j(`POST`,`/api/impact`,{repo:e,base:t,head:n}),runPr:(e,t)=>j(`POST`,`/api/impact`,{repo:e,pr:t}),check:e=>j(`POST`,`/api/impact/check`,{repo:e}),report:e=>j(`GET`,`/api/impact/report?repo=${encodeURIComponent(e)}`),comment:e=>j(`POST`,`/api/impact/comment`,{repo:e,confirm:!0}),source:(e,t)=>j(`GET`,`/api/impact/source?repo=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`)},Ye={status:()=>j(`GET`,`/api/config/status`)},Xe={view:()=>j(`GET`,`/api/flaky`),quarantine:(e,t,n)=>j(`POST`,`/api/flaky/quarantine`,{tests:e,release:t,confirmed:!0,...n?{reason:n}:{}})},Ze={runs:()=>j(`GET`,`/api/run-diff/runs`),diff:(e,t)=>j(`GET`,`/api/run-diff?a=${encodeURIComponent(e)}&b=${encodeURIComponent(t)}`),shot:(e,t,n)=>Q(`/api/run-diff/${encodeURIComponent(e)}/shot/${t}`,n)},Qe={home:()=>j(`GET`,`/api/basal`),test:e=>j(`GET`,`/api/basal/tests/${encodeURIComponent(e)}`),graph:e=>j(`GET`,`/api/basal/tests/${encodeURIComponent(e)}/graph`),ask:(e,t)=>j(`POST`,`/api/basal/tests`,{request:e,...t?{environment:t}:{}}),stage:(e,t)=>j(`POST`,`/api/basal/tests/${encodeURIComponent(e)}/${t}`,{}),act:(e,t,n)=>j(`POST`,`/api/basal/tests/${encodeURIComponent(e)}/act`,{approved:t,...n?.length?{only:n}:{}}),approve:(e,t)=>j(`POST`,`/api/basal/tests/${encodeURIComponent(e)}/approve`,{typed:t}),observe:(e,t)=>j(`POST`,`/api/basal/tests/${encodeURIComponent(e)}/observe`,t),regraph:e=>j(`POST`,`/api/basal/tests/${encodeURIComponent(e)}/regraph`,{})};export{Ze as $,Re as A,le as B,Ge as C,me as D,de as E,K as F,xe as G,we as H,U as I,ce as J,ke as K,Q as L,ge as M,Xe as N,ue as O,V as P,_e as Q,Je as R,Ue as S,Se as T,Ce as U,fe as V,B as W,be as X,Oe as Y,ze as Z,Ke as _,d as _t,Me as a,w as at,G as b,a as bt,je as c,We as ct,$ as d,pe as dt,ye as et,L as f,X as ft,Qe as g,he as gt,H as h,re as ht,Pe as i,ae as it,Ve as j,I as k,Be as l,P as lt,qe as m,F as mt,E as n,R as nt,Fe as o,He as ot,Ee as p,Te as pt,Ie as q,Ne as r,z as rt,C as s,m as st,T as t,N as tt,W as u,Ae as ut,j as v,t as vt,Le as w,Ye as x,o as xt,M as y,e as yt,ve as z};