@capagents/forgeqe 3.4.7 → 3.4.8

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 (105) hide show
  1. package/dist/forgeqe.js +1970 -1970
  2. package/dist/requirement-agent/requirements_agent/config.py +7 -8
  3. package/dist/requirement-agent/requirements_agent/llm/providers.py +11 -1
  4. package/dist/template.html +2 -2
  5. package/dist/web/assets/{3d-force-graph-nC19sloS.js → 3d-force-graph-CiCC5APC.js} +1 -1
  6. package/dist/web/assets/{Agent-5Q96YSvr.js → Agent-BB5w6CFT.js} +7 -7
  7. package/dist/web/assets/{AgentWork-BWjyDUEc.js → AgentWork-BIDUzmaq.js} +1 -1
  8. package/dist/web/assets/{ApiTests-D493px70.js → ApiTests-B9xJf6Cy.js} +5 -5
  9. package/dist/web/assets/{Browse-hN_pjYbP.js → Browse-DWBe9mKl.js} +1 -1
  10. package/dist/web/assets/Chat-DHpceBhs.js +3 -0
  11. package/dist/web/assets/CommandPalette-C94g3GC3.js +1 -0
  12. package/dist/web/assets/{Compare-sqYji9Pk.js → Compare-BZBgd0y1.js} +1 -1
  13. package/dist/web/assets/{Compare-BYFsbaGF.js → Compare-DdpFDNye.js} +1 -1
  14. package/dist/web/assets/Cost-DeG7MOk_.js +1 -0
  15. package/dist/web/assets/{Data-BNcT6ygh.js → Data-C23A9m-E.js} +1 -1
  16. package/dist/web/assets/Desktop-DEMEf1js.js +1 -0
  17. package/dist/web/assets/{DesktopReview-Cd-oH_U5.js → DesktopReview-QI-8PPuf.js} +1 -1
  18. package/dist/web/assets/{DeviceScreen-DDERg3YQ.js → DeviceScreen-DJiqz1aE.js} +1 -1
  19. package/dist/web/assets/Evidence-CCgOWjCG.js +1 -0
  20. package/dist/web/assets/{Explore-CIrFwA2S.js → Explore-BaWlUaKG.js} +1 -1
  21. package/dist/web/assets/Features-BVmUtZ3B.js +1 -0
  22. package/dist/web/assets/{FileTree-CNGOe2xf.js → FileTree-hV2COTtr.js} +1 -1
  23. package/dist/web/assets/{Flags-C69Twz3o.js → Flags-B4d9s8zr.js} +1 -1
  24. package/dist/web/assets/Flaky-CZw09rGV.js +1 -0
  25. package/dist/web/assets/{Impact-Dc1w1OJz.js → Impact-C0RrcnHq.js} +2 -2
  26. package/dist/web/assets/{Jobs-hS20eWew.js → Jobs-DJLhtCP4.js} +1 -1
  27. package/dist/web/assets/{KindPage-Dwn1bRlI.js → KindPage-BDDN_Tvk.js} +1 -1
  28. package/dist/web/assets/{LiveDevice-CAqR5xdi.js → LiveDevice-mowq_cHn.js} +1 -1
  29. package/dist/web/assets/{Migration-B8Cde1ef.js → Migration-BMN6ORSe.js} +4 -4
  30. package/dist/web/assets/Mobile-Cb-MttFC.js +2 -0
  31. package/dist/web/assets/Observability-Jj9dRXFD.js +1 -0
  32. package/dist/web/assets/{OwnItems-Cw923K1y.js → OwnItems-DE8fyJHx.js} +1 -1
  33. package/dist/web/assets/PageAgent--Trp4TeQ.js +1 -0
  34. package/dist/web/assets/Product-D6eFHH3k.js +6 -0
  35. package/dist/web/assets/Production-BHY4nlNS.js +1 -0
  36. package/dist/web/assets/Quality-D0ZwjBaV.js +1 -0
  37. package/dist/web/assets/Readiness-Ck09aYm6.js +1 -0
  38. package/dist/web/assets/Record-CZ8vdz9z.js +1 -0
  39. package/dist/web/assets/{Regression-DSGl56Mr.js → Regression-DpksCvrY.js} +2 -2
  40. package/dist/web/assets/RelationGraph-ceeoXUfO.js +1 -0
  41. package/dist/web/assets/Reports-DwQ4rGuE.js +2 -0
  42. package/dist/web/assets/{Requirements-D-FLXDK0.js → Requirements-CrrPYfmf.js} +1 -1
  43. package/dist/web/assets/Responsive-D-_Z1zWt.js +3 -0
  44. package/dist/web/assets/RunDiff-6ubx_siR.js +1 -0
  45. package/dist/web/assets/Settings-B-VqCcSI.js +21 -0
  46. package/dist/web/assets/{SiteScan-CKc7eUOn.js → SiteScan-Atalzdep.js} +1 -1
  47. package/dist/web/assets/{Steps-DvTL0-9L.js → Steps-DJKLOcXA.js} +1 -1
  48. package/dist/web/assets/{TestData-Bo0i6j6h.js → TestData-D8X3YVNO.js} +1 -1
  49. package/dist/web/assets/{TestManagement-a1zMxdc6.js → TestManagement-CFkof7HP.js} +2 -2
  50. package/dist/web/assets/WhatsNew-Zh7ANIT4.js +1 -0
  51. package/dist/web/assets/agentSettingsSheet-BXo7tt4e.js +1 -0
  52. package/dist/web/assets/api-C5wO4oo1.js +1 -0
  53. package/dist/web/assets/choice-DU4-gNa8.js +1 -0
  54. package/dist/web/assets/{dataParts-DCcZLVns.js → dataParts-XwGL6chT.js} +1 -1
  55. package/dist/web/assets/{desktopAppPath-Ch1JeF98.js → desktopAppPath-ClRxEs7y.js} +1 -1
  56. package/dist/web/assets/{flowTheme-BP9HI_83.js → flowTheme-C6XgxapL.js} +1 -1
  57. package/dist/web/assets/index-4aprf7A6.css +2 -0
  58. package/dist/web/assets/index-Bm0NGw2p.js +186 -0
  59. package/dist/web/assets/{nav-DS7OIItb.js → nav-BVGAdkgR.js} +1 -1
  60. package/dist/web/assets/{pageBack-BKHdI-pD.js → pageBack-C6KF2YWt.js} +1 -1
  61. package/dist/web/assets/paletteCommands-4ZbMQrvq.js +5 -0
  62. package/dist/web/assets/{parts-EZhmj8re.js → parts-Bw9UqYIt.js} +1 -1
  63. package/dist/web/assets/{productParts-BTy_xRc1.js → productParts-C2WZmf3J.js} +1 -1
  64. package/dist/web/assets/{qualityParts-CaibRb_n.js → qualityParts-xNbrX_EB.js} +1 -1
  65. package/dist/web/assets/{recordTest-DOqE44_1.js → recordTest-ecnqAff5.js} +1 -1
  66. package/dist/web/assets/searchRecents-BRxclL5B.js +1 -0
  67. package/dist/web/assets/{stepper-PKh2muBc.js → stepper-ghyjNRgc.js} +1 -1
  68. package/dist/web/assets/surface-CJmzHqOR.js +1 -0
  69. package/dist/web/assets/uploadBuild-sQwJpid1.js +1 -0
  70. package/dist/web/assets/{wizardParts-DgElx0Cb.js → wizardParts-CtlGV71f.js} +1 -1
  71. package/dist/web/index.html +8 -8
  72. package/package.json +1 -1
  73. package/py/forgeqe_engine/llm.py +30 -1
  74. package/py/forgeqe_engine/service.py +8 -0
  75. package/dist/web/assets/Chat-CzEPSJKG.js +0 -3
  76. package/dist/web/assets/CommandPalette-Bupa5F4q.js +0 -1
  77. package/dist/web/assets/Cost-CWWczZfn.js +0 -1
  78. package/dist/web/assets/Desktop-CG9lFU5l.js +0 -1
  79. package/dist/web/assets/Evidence-DPF6gCpK.js +0 -1
  80. package/dist/web/assets/Features-DzK_-8h1.js +0 -1
  81. package/dist/web/assets/Flaky-CNPjhYIZ.js +0 -1
  82. package/dist/web/assets/Mobile-D3Pch-1L.js +0 -2
  83. package/dist/web/assets/Observability-QUxLZNhO.js +0 -1
  84. package/dist/web/assets/PageAgent-xDYi2Zgw.js +0 -1
  85. package/dist/web/assets/Product-CVn9yHyn.js +0 -6
  86. package/dist/web/assets/Production-BNg-ims6.js +0 -1
  87. package/dist/web/assets/Quality-BzcQTBgO.js +0 -1
  88. package/dist/web/assets/Readiness-Bx5JZpXY.js +0 -1
  89. package/dist/web/assets/Record-CM_ZJv5n.js +0 -1
  90. package/dist/web/assets/RelationGraph-8Ko7oUzf.js +0 -1
  91. package/dist/web/assets/Reports-CBanmypE.js +0 -2
  92. package/dist/web/assets/Responsive-DLU7BLkW.js +0 -3
  93. package/dist/web/assets/RunDiff-D2IKjRcf.js +0 -1
  94. package/dist/web/assets/Settings-Bi99A4lM.js +0 -21
  95. package/dist/web/assets/WhatsNew-OtotufjV.js +0 -1
  96. package/dist/web/assets/agentSettingsSheet-DJDT3xqY.js +0 -1
  97. package/dist/web/assets/api-BJHzfOse.js +0 -1
  98. package/dist/web/assets/choice-W0qOx_1k.js +0 -1
  99. package/dist/web/assets/coverage-DbHm8BUP.js +0 -5
  100. package/dist/web/assets/index-B58JrUzp.js +0 -186
  101. package/dist/web/assets/index-B9F7yrF9.css +0 -2
  102. package/dist/web/assets/palette-BEo5X3wD.js +0 -1
  103. package/dist/web/assets/paletteCommands-DdFd3e0-.js +0 -1
  104. package/dist/web/assets/sectionList-B6NF3ZMb.js +0 -1
  105. package/dist/web/assets/surface-c1kG1KPS.js +0 -1
@@ -0,0 +1 @@
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{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{z as a}from"./searchRecents-BRxclL5B.js";import{b as o,v as s}from"./api-C5wO4oo1.js";import{F as c,I as l,P as u,T as d,g as f,n as p,o as m}from"./pageBack-C6KF2YWt.js";import{Er as h,F as g,Gr as _,N as v,P as y,Un as b,ct as ee,o as te,vn as ne,z as x,zn as S}from"./line-icons-Cwj9OmCz.js";import{Ft as C,G as w,J as T,L as E,U as D,W as O,cn as k,pn as A,zt as j}from"./index-Bm0NGw2p.js";import{d as re}from"./qualityParts-xNbrX_EB.js";var M=e(t(),1),N={view:(e=!1)=>s(`GET`,`/api/production${e?`?refresh=1`:``}`)},P=i(),F={sentry:`Sentry`,datadog:`Datadog`,appinsights:`App Insights`},I={fatal:{label:`Fatal`,tone:`text-fail`},error:{label:`Error`,tone:`text-fail`},warning:{label:`Warning`,tone:`text-warn`},info:{label:`Info`,tone:`text-muted`}};function L(e,t,n){return e.flatMap(e=>{let r=e.issues.filter(e=>(t===`all`||!e.coverage.covered)&&(n===`all`||e.provider===n));return r.length?[{...e,issues:r}]:[]})}var R=e=>e&&m(e)===`web`?e:void 0,z=e=>n(`record`,encodeURIComponent(e));function B({p:e}){let t=e.error||e.problem?x:e.configured?v:y,n=e.error||e.problem?`Not read`:e.configured?`Connected`:`Not set up`,i=e.error||e.problem?`text-fail`:e.configured?`text-pass`:`text-muted`;return(0,P.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-2 text-body-sm`,children:[(0,P.jsx)(t,{size:15,"aria-label":n,className:r(`mt-1 flex-none`,i)}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e.label}),e.host&&(0,P.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.host]}),(0,P.jsxs)(`span`,{className:`text-ink-2`,children:[` — `,e.problem?e.problem:e.error?e.error:e.configured?`${e.issues} issue${e.issues===1?``:`s`}${e.fetchedAt?`, read ${C(e.fetchedAt)}`:``}`:e.missing.length?`set ${e.missing.join(` and `)}`:`not set up`]})]})]})}function V({i:e}){if(!e.coverage.covered)return(0,P.jsxs)(`span`,{className:`flex items-center gap-2 whitespace-nowrap text-warn`,children:[(0,P.jsx)(h,{size:14,"aria-label":`No test`,className:`flex-none`}),`No test`]});let t=[...e.coverage.runs.map(e=>e.goal?`${e.id} (${e.goal})`:e.id),...e.coverage.tests],n=e.coverage.runs[0]?.id??e.coverage.tests[0]??``;return(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,"data-tip":`Covered by ${e.coverage.how===`page`?`a run on this page`:`a test named for this page`}: ${t.join(`, `)}`,children:[(0,P.jsx)(v,{size:14,"aria-label":`Covered`,className:`flex-none text-pass`}),(0,P.jsxs)(`span`,{className:`truncate`,children:[n,t.length>1?` +${t.length-1}`:``]})]})}function H(){let[e,t]=(0,M.useState)(null),[i,s]=(0,M.useState)(``),[m,H]=(0,M.useState)(`uncovered`),[U,W]=(0,M.useState)(`all`),[G,K]=(0,M.useState)(!1),[q,J]=(0,M.useState)(``),[Y,X]=(0,M.useState)(null),Z=(0,M.useCallback)((e=!1)=>{K(e),N.view(e).then(e=>{t(e),s(``),K(!1)},e=>{s(e.message),K(!1)})},[]);(0,M.useEffect)(()=>Z(),[Z]);let ie=e=>{if(e.repro){if(e.repro.on===`production`)return X(e);location.hash=z(e.repro.url)}},ae=async e=>{K(!0);try{let{id:t}=await o.start(e.ask,{});location.hash=n(`chats`,t)}catch(e){J(e.message),K(!1)}},Q=e?.providers.filter(e=>e.configured)??[],oe=e?L(e.pages,m,U):[],$=[`sentry`,`datadog`,`appinsights`].filter(t=>e?.pages.some(e=>e.issues.some(e=>e.provider===t)));return(0,P.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,P.jsx)(T,{}),(0,P.jsxs)(`main`,{className:r(E,`@container flex-auto gap-4`),children:[(0,P.jsx)(p,{}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,P.jsx)(A,{pixel:a.production,size:`lg`,head:!0}),(0,P.jsx)(`h1`,{className:`m-0 flex-1 text-headline-md`,children:`Production signals`}),Q.length>0&&(0,P.jsxs)(u,{size:`sm`,disabled:G,onClick:()=>Z(!0),"data-tip":`Read again`,children:[(0,P.jsx)(b,{"aria-hidden":`true`}),`Refresh`]})]}),(0,P.jsx)(w,{more:(0,P.jsxs)(P.Fragment,{children:[`The errors of the last 14 days come from Sentry, Datadog and Azure Application Insights, grouped by the page they happened on. Each one says which browser run or automated test already goes to that page, or that no test does. This page only reads: nothing is changed at the provider. Record a repro opens `,(0,P.jsx)(`a`,{href:n(`record`),children:`Record`}),` at the same page on `,e?.testEnvironment?(0,P.jsxs)(P.Fragment,{children:[`the `,e.testEnvironment,` environment`]}):`your test environment`,`. A tracker is set up with `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.sentry`}),`, `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.datadog`}),` or `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations.appinsights`}),` in forgeqe.yaml, its keys saved in Settings under the variable names the trackers list shows; Sentry uses the same settings as its MCP server.`]}),children:`See the errors real users hit, and which of them no test covers yet.`}),i&&(0,P.jsx)(`p`,{role:`alert`,className:r(l.fail,`m-0`),children:i}),!e&&!i&&(0,P.jsx)(f,{shape:`rows`,count:3}),e&&Q.length>0&&(0,P.jsx)(`ul`,{"aria-label":`Error trackers`,className:`m-0 flex list-none flex-col divide-y divide-line-soft border-y border-line-soft p-0`,children:e.providers.map(e=>(0,P.jsx)(B,{p:e},e.id))}),e&&!Q.length&&(0,P.jsxs)(k,{page:!0,icon:S,title:`No error tracker set up`,action:(0,P.jsxs)(`a`,{className:c({size:`sm`}),href:n(`settings`,`integrations`),"data-tip":`Open Integrations in Settings`,children:[(0,P.jsx)(te,{"aria-hidden":`true`}),`Integrations`]}),children:[`Connect Sentry, Datadog or Azure Application Insights, and the errors real users hit show here, grouped by page. In forgeqe.yaml that is one of the `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:`integrations`}),`, with its keys saved in Settings.`,e.providers.some(e=>e.problem||e.error||e.missing.length)&&(0,P.jsx)(`ul`,{"aria-label":`Error trackers`,className:`m-0 mt-2 flex list-none flex-col p-0 text-left`,children:e.providers.map(e=>(0,P.jsx)(B,{p:e},e.id))})]}),e&&Q.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(D,{label:`Errors in the last 14 days`,children:[(0,P.jsx)(O,{dot:`neutral`,value:e.counts.issues,label:`errors on ${e.pages.length} page${e.pages.length===1?``:`s`}`}),(0,P.jsx)(`span`,{className:`flex items-center`,"data-tip":`No run or test goes there`,children:(0,P.jsx)(O,{dot:e.counts.uncovered?`warn`:`pass`,value:e.counts.uncovered,label:`with no test`})}),(0,P.jsx)(O,{dot:`neutral`,value:e.counts.events.toLocaleString(),label:`events`}),(0,P.jsx)(`span`,{className:`flex items-center`,"data-tip":`Added up per error`,children:(0,P.jsx)(O,{dot:`neutral`,value:e.counts.users.toLocaleString(),label:`users affected`})})]}),Y?.repro&&(0,P.jsxs)(`div`,{role:`group`,"aria-label":`Record on production`,className:r(l.warn,`flex flex-wrap items-center gap-2`),children:[(0,P.jsx)(h,{size:15,"aria-label":`Warning`,className:`flex-none text-warn`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[`No test environment is active, so the recording would open the production page `,(0,P.jsx)(`code`,{className:`font-mono text-body-sm`,children:Y.repro.url}),`. Real data is there: record only steps that read.`]}),(0,P.jsxs)(u,{size:`sm`,onClick:()=>{let e=Y.repro.url;X(null),location.hash=z(e)},"data-tip":`Record on production`,children:[(0,P.jsx)(g,{"aria-hidden":`true`}),`Record`]}),(0,P.jsxs)(u,{size:`sm`,variant:`outline`,onClick:()=>X(null),children:[(0,P.jsx)(_,{"aria-hidden":`true`}),`Cancel`]})]}),q&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-ink-2`,children:q}),$.length>1&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,P.jsx)(d,{items:[{id:`all`,label:`All trackers`},...$.map(t=>({id:t,label:F[t],n:e.pages.reduce((e,n)=>e+n.issues.filter(e=>e.provider===t).length,0)}))],value:U,onChange:W})}),e.counts.issues===0?(0,P.jsx)(k,{icon:v,title:`No errors in the last 14 days`,children:`The trackers that are set up report no unresolved errors.`}):(0,P.jsx)(j,{label:`Errors by page`,placeholder:`Find an error, page or test`,height:`max(320px, calc(var(--screen) - 288px))`,resetKey:`${m}-${U}`,empty:m===`uncovered`?`Every error here has a test.`:`Nothing matches.`,tools:(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,P.jsx)(d,{items:[{id:`uncovered`,label:`No test`,n:L(e.pages,`uncovered`,U).reduce((e,t)=>e+t.issues.length,0),alert:!0},{id:`all`,label:`All`,n:L(e.pages,`all`,U).reduce((e,t)=>e+t.issues.length,0)}],value:m,onChange:H})}),head:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[38%]`),children:`Error`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Tracker`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Events`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Users`}),(0,P.jsx)(`th`,{scope:`col`,className:r(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Last seen`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Covered by`}),(0,P.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:(0,P.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:oe.map(e=>(0,P.jsxs)(M.Fragment,{children:[(0,P.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted`,children:(0,P.jsx)(`td`,{colSpan:7,className:r(`px-4 py-2`,`max-w-0 text-body-sm`),children:(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono`,"data-tip":e.url||e.page||`The tracker names no page`,children:e.page||`No page named`}),(0,P.jsxs)(`span`,{className:`flex-none text-muted`,children:[e.issues.length,` error`,e.issues.length===1?``:`s`,e.uncovered?`, ${e.uncovered} with no test`:``]})]})})}),e.issues.map(e=>{let t=I[e.level],n=R(e.link);return(0,P.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0`),children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.level===`info`?(0,P.jsx)(y,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}):e.level===`warning`?(0,P.jsx)(h,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}):(0,P.jsx)(x,{size:15,"aria-label":t.label,className:r(`flex-none`,t.tone)}),(0,P.jsx)(`span`,{className:`truncate`,"data-tip":[e.title,`${F[e.provider]} ${e.id}`,e.environment&&`environment ${e.environment}${e.production?` (production: read only)`:``}`,e.release&&`release ${e.release}`,e.service].filter(Boolean).join(` · `),children:e.title})]})}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-ink-2 @xl:table-cell`),children:F[e.provider]}),(0,P.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.count,children:e.count.toLocaleString()}),(0,P.jsx)(`td`,{className:r(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),"data-sort":e.users,children:e.users.toLocaleString()}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-muted @2xl:table-cell`),"data-tip":e.lastSeen?re(e.lastSeen):void 0,children:e.lastSeen?C(e.lastSeen):`–`}),(0,P.jsx)(`td`,{className:r(`px-4 py-2`,`max-w-0 text-body-sm`),children:(0,P.jsx)(V,{i:e})}),(0,P.jsxs)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:[e.repro&&(0,P.jsx)(u,{variant:`icon`,size:`icon-sm`,disabled:G,onClick:()=>ie(e),"aria-label":e.repro.on===`test`?`Record a repro at ${e.repro.url}`:`Record a repro at the production page (asks first)`,"data-tip":e.repro.on===`test`?`Record a repro at ${e.repro.url}`:`Record a repro at the production page (asks first)`,children:(0,P.jsx)(g,{"aria-hidden":`true`})}),(0,P.jsx)(u,{variant:`icon`,size:`icon-sm`,disabled:G,onClick:()=>void ae(e),"aria-label":`Ask in a chat about ${F[e.provider]} ${e.id}`,"data-tip":`Ask in a chat about ${F[e.provider]} ${e.id}`,children:(0,P.jsx)(ne,{"aria-hidden":`true`})}),n&&(0,P.jsx)(`a`,{className:c({variant:`icon`,size:`icon`}),href:n,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open in ${F[e.provider]}`,"data-tip":`Open in ${F[e.provider]}`,children:(0,P.jsx)(ee,{"aria-hidden":`true`})})]})]},`${e.provider}-${e.id}`)})]},e.page||`-`))})]})]})]})}export{H as Production,L as shownPages};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,V as a,a as o,c as s}from"./surface-CJmzHqOR.js";import{t as c}from"./utils-DJRAScIl.js";import{t as l}from"./jsx-runtime-LKYXHABd.js";import{z as u}from"./searchRecents-BRxclL5B.js";import{L as d,Y as f,b as p,tt as m,v as h}from"./api-C5wO4oo1.js";import{F as g,I as _,P as v,T as y,_ as b,g as x,i as S,k as C,n as ee}from"./pageBack-C6KF2YWt.js";import{C as w,E as T,Er as E,F as D,N as O,Nt as te,Rn as ne,Rt as k,Tr as A,Xn as j,Yt as re,ft as M,ir as N,it as ie,pn as P,t as F,vn as I,wr as ae,z as L}from"./line-icons-Cwj9OmCz.js";import{t as oe}from"./collapse-C0q3vXUR.js";import{At as se,Bt as R,Dt as ce,Et as le,Ft as z,G as B,Gt as V,J as ue,L as de,Tt as fe,U as H,Ut as U,Vt as W,W as G,Wt as K,Zt as pe,cn as q,pn as me,qt as he,zt as ge}from"./index-Bm0NGw2p.js";import{a as _e,c as ve,d as J,l as Y,n as ye,s as be,t as xe,v as Se,x as Ce,y as we}from"./qualityParts-xNbrX_EB.js";import{a as Te,c as Ee,i as De,n as Oe,s as X}from"./SiteScan-Atalzdep.js";var Z=e(t(),1),ke={view:()=>h(`GET`,`/api/localization`),run:e=>h(`GET`,`/api/localization/${encodeURIComponent(e)}`),shot:(e,t,n)=>d(`/api/localization/${encodeURIComponent(e)}/shot/${t}/${n}`,`image/jpeg`)},Q=l(),Ae={high:`text-fail`,medium:`text-warn`,low:`text-muted`},je=[`key`,`untranslated`,`cut_off`,`overflow`,`expansion`,`rtl`];function Me({id:e,index:t,mode:n}){let[r,i]=(0,Z.useState)(``),[a,s]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let r=!1;return ke.shot(e,t,n).then(e=>!r&&i(e),()=>!r&&s(!0)),()=>{r=!0}},[e,t,n]);let l=n===`pseudo`?`Pseudo-localized`:`Right to left`;return(0,Q.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1`,children:[(0,Q.jsx)(`figcaption`,{className:`text-body-sm text-muted`,children:l}),a?(0,Q.jsx)(`p`,{className:c(o,`m-0 px-4 py-6 text-center text-body-sm text-muted`),children:`No capture`}):r?(0,Q.jsx)(`img`,{src:r,alt:`${l} capture`,className:c(o,`max-h-[420px] w-full object-contain object-top`)}):(0,Q.jsx)(`div`,{className:c(o,`min-h-24`)})]})}function Ne({id:e,page:t,index:n,text:r}){let[i,o]=(0,Z.useState)(!1),s=t.findings.some(e=>r[e.kind].severity===`high`)?`high`:t.findings.some(e=>r[e.kind].severity===`medium`)?`medium`:t.findings.length?`low`:void 0,l=s===`high`?L:s?E:O,u=t.findings.toSorted((e,t)=>je.indexOf(e.kind)-je.indexOf(t.kind));return(0,Q.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>o(!i),className:c(a,`items-start gap-2`),children:[(0,Q.jsx)(l,{size:15,"aria-label":s?`${s} findings`:`Nothing found`,className:c(`mt-1 flex-none`,s?Ae[s]:`text-pass`)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`truncate font-medium`,"data-tip":t.url,children:[t.title||Ce(t.url),s&&(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ae[s]),children:[` · `,s===`high`?`High`:s===`medium`?`Medium`:`Low`]})]}),(0,Q.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[Ce(t.url),` · `,t.lang?`lang ${t.lang}`:`no lang`,u.length?` · ${u.map(e=>`${r[e.kind].label.charAt(0).toLowerCase()}${r[e.kind].label.slice(1)} ${e.count}`).join(`, `)}`:` · nothing found`]})]}),(0,Q.jsx)(T,{size:14,"aria-hidden":`true`,className:c(`mt-1 flex-none transition-transform`,i&&`rotate-180`)})]}),(0,Q.jsx)(oe,{open:i,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 pb-4 pl-8`,children:[u.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[r[e.kind].label,` `,(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ae[r[e.kind].severity]),children:[`· `,e.count]})]}),(0,Q.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:r[e.kind].fix}),e.examples.map((e,t)=>(0,Q.jsx)(`span`,{className:`truncate font-mono text-body-sm text-muted`,"data-tip":e,children:e},t))]},e.kind)),(t.shots.pseudo||t.shots.rtl)&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 @2xl:grid-cols-2`,children:[t.shots.pseudo&&(0,Q.jsx)(Me,{id:e,index:n,mode:`pseudo`}),t.shots.rtl&&(0,Q.jsx)(Me,{id:e,index:n,mode:`rtl`})]})]})})]})}function Pe({id:e,text:t}){let[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,l]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return i(null),ke.run(e).then(e=>!t&&(i(e),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]);let u=(0,Q.jsxs)(`a`,{href:r(`quality`,`localization`),className:c(g({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,Q.jsx)(T,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(a||!n)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u,a?(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:a}):(0,Q.jsx)(x,{shape:`detail`})]});let d=async()=>{try{let{id:e}=await p.start(`Explain the localization findings of the browser run ${n.id} in the reports folder (its localization.json and the captures in its localization folder), page by page, and what the developers should change.`,{});location.hash=r(`chats`,e)}catch(e){l(e.message)}},f=e=>n.counts[e]??0;return(0,Q.jsxs)(`section`,{"aria-labelledby":`l10n-run-h`,className:`flex min-w-0 flex-col gap-4`,children:[u,(0,Q.jsx)(pe,{id:`l10n-run-h`,icon:k,title:(0,Q.jsx)(`span`,{"data-tip":n.goal,children:n.goal}),description:(0,Q.jsxs)(Q.Fragment,{children:[J(n.at),` · `,n.langs.length?n.langs.join(`, `):`no lang`,` · `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.id})]}),actions:(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void d(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})}),s&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:s}),(0,Q.jsxs)(H,{label:`What the run found`,children:[(0,Q.jsx)(G,{dot:`neutral`,value:n.pages,label:n.langs.length?`pages (${n.langs.join(`, `)})`:`pages, no lang set`}),(0,Q.jsx)(G,{dot:`fail`,value:f(`key`),label:`translation keys shown`}),(0,Q.jsx)(G,{dot:`warn`,value:f(`untranslated`),label:`English left on other languages`}),(0,Q.jsx)(G,{dot:`warn`,value:f(`cut_off`)+f(`overflow`),label:`cut off as the page was`}),(0,Q.jsx)(G,{dot:`warn`,value:f(`expansion`),label:`break with longer text`}),(0,Q.jsx)(G,{dot:`warn`,value:f(`rtl`),label:`break right to left`})]}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:n.list.map((e,r)=>(0,Q.jsx)(Ne,{id:n.id,page:e,index:r,text:t},e.url))})]})}function Fe({runs:e}){let t=e=>location.hash=r(`quality`,`localization`,encodeURIComponent(e)),n=(e,t)=>e.counts[t]??0;return(0,Q.jsx)(ge,{label:`Runs`,placeholder:`Find a run by what it did`,empty:`Nothing matches.`,height:R,head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`w-[44%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Keys`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`English left`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Cut off`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Longer · RTL`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`hidden @xl:table-cell`),children:`When`})]}),children:e.map(e=>{let i=n(e,`key`),a=n(e,`untranslated`)+n(e,`cut_off`)+n(e,`overflow`)+n(e,`expansion`)+n(e,`rtl`),o=i?L:a?E:O;return(0,Q.jsxs)(`tr`,{onClick:()=>t(e.id),className:he,children:[(0,Q.jsx)(`td`,{className:c(W,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{size:15,"aria-label":i?`Keys shown`:a?`Needs a look`:`Nothing found`,className:c(`flex-none`,i?`text-fail`:a?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,`localization`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{className:c(U,i?`text-fail`:`text-muted`),children:i}),(0,Q.jsx)(`td`,{className:c(U,`hidden @xl:table-cell`,n(e,`untranslated`)?`text-warn`:`text-muted`),children:n(e,`untranslated`)}),(0,Q.jsx)(`td`,{className:c(U,n(e,`cut_off`)+n(e,`overflow`)?`text-warn`:`text-muted`),children:n(e,`cut_off`)+n(e,`overflow`)}),(0,Q.jsxs)(`td`,{className:c(U,`hidden text-muted @2xl:table-cell`),"data-sort":n(e,`expansion`)+n(e,`rtl`),children:[n(e,`expansion`),` · `,n(e,`rtl`)]}),(0,Q.jsx)(`td`,{className:c(W,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:z(e.at)})]},e.id)})})}function Ie({id:e}){let[t,n]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{ke.view().then(e=>(n(e),a(``)),e=>a(e.message))},[]),i?(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:i}):t?e?(0,Q.jsx)(Pe,{id:e,text:t.text}):t.runs.length?(0,Q.jsx)(Fe,{runs:t.runs}):(0,Q.jsx)(q,{page:!0,icon:k,title:`No runs checked yet`,action:(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow in each language your site has, and what it found shows here. Every browser run with accessibility checks on also checks each page's language.`}):(0,Q.jsx)(x,{shape:`rows`})}var Le=[{id:`7d`,label:`Last 7 days`},{id:`30d`,label:`Last 30 days`},{id:`90d`,label:`Last 90 days`},{id:`all`,label:`All time`}],Re=[{key:`a11y`,label:`Accessibility violations`,better:`down`,show:e=>String(e)},{key:`seo`,label:`SEO score`,better:`up`,show:e=>String(e)},{key:`lcp`,label:`Largest paint (LCP)`,better:`down`,show:e=>Se(e,`ms`)}];function ze(e,t,n,r){if(t===void 0||n===void 0||r<2)return;let i=n-t;if(!i)return;let a=i>0;return{text:`${a?`+`:`−`}${e.key===`lcp`?Se(Math.abs(i),`ms`):Math.abs(i)}`,dir:a?`up`:`down`,good:(a?`up`:`down`)===e.better,against:`since the first run of the range`}}function Be({s:e}){let t=t=>e.points.map(e=>e[t]).filter(e=>typeof e==`number`),n=Re.filter(e=>t(e.key).length),r=e=>e?J(e.at):``;return(0,Q.jsxs)(`section`,{"aria-label":e.site,className:c(s,`flex flex-col gap-4`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,Q.jsx)(k,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,Q.jsx)(`h3`,{className:`m-0 min-w-0 truncate font-mono text-body-lg font-medium`,children:e.site}),(0,Q.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[we(e.runs,`run`),` · `,we(e.pages,`page`),e.first&&e.latest&&e.runs>1?` · ${r(e.first)} to ${r(e.latest)}`:e.latest?` · ${r(e.latest)}`:``]})]}),n.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(le,{label:`${e.site} now`,className:`shadow-none`,children:n.map(t=>{let n=e.latest?.[t.key],r=ze(t,e.first?.[t.key],n,e.runs);return(0,Q.jsx)(fe,{compact:!0,label:t.label,value:n===void 0?`–`:t.show(n),...r?{change:r}:{note:e.runs>1?`No change in this range`:`One run in this range`}},t.key)})}),e.points.length>1&&(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,150px),1fr))] gap-x-px`,children:n.map(n=>{let r=t(n.key),i=ze(n,e.first?.[n.key],e.latest?.[n.key],e.runs);return r.length>1?(0,Q.jsx)(b,{series:[{values:r,tone:i?.good===!1?`fail`:`accent`}],label:`${n.label} over the last ${r.length} runs: ${r.map(n.show).join(`, `)}`,className:`h-12 px-4`},n.key):(0,Q.jsx)(`span`,{},n.key)})})]}),e.analytics.length>0&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-body-sm`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-muted`,children:`Analytics in the latest run:`}),e.analytics.map(e=>(0,Q.jsxs)(C,{tone:`neutral`,icon:!1,children:[e.tool,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,we(e.pages,`page`)]})]},e.tool))]}),(0,Q.jsx)(ye,{icon:A,className:`text-fail`,lines:e.newRules.map(e=>`newly failing: ${e}`)}),(0,Q.jsx)(ye,{icon:ae,className:`text-pass`,lines:e.fixedRules.map(e=>`fixed: ${e}`)})]})}function Ve(){let[e,t]=(0,Z.useState)(`30d`),[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{let t=!1;return i(null),Ee.view(e).then(e=>!t&&(i(e.sites),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(B,{more:(0,Q.jsx)(Q.Fragment,{children:`Every browser run and site scan adds each page's accessibility and timings to the history; a scan also adds its SEO score and analytics tags. A site is its origin; each number is per run, summed over its pages (violations) or their average (SEO score, LCP). The change is against the first run in the range.`}),children:`How each site's accessibility, SEO, speed and analytics changed over time.`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:Le,value:e,onChange:t})}),a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:a}),!n&&!a&&(0,Q.jsx)(x,{shape:`detail`}),n&&(n.length?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map(e=>(0,Q.jsx)(Be,{s:e},e.site))}):(0,Q.jsx)(q,{page:!0,icon:w,title:e===`all`?`No history yet`:`Nothing in this range`,action:(0,Q.jsx)(`a`,{className:g({size:`sm`}),href:r(`quality`,`scans`),children:`Scan pages`}),children:`Scan a few pages, or run a flow in a browser: each page's results are kept, and every site shows here with how it changed.`}))]})}var He={view:()=>h(`GET`,`/api/security`),run:e=>h(`GET`,`/api/security/${encodeURIComponent(e)}`)},Ue={high:`text-fail`,medium:`text-warn`,low:`text-muted`},$={high:`High`,medium:`Medium`,low:`Low`};function We({id:e,fix:t}){let[n,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[s,l]=(0,Z.useState)(`all`),[u,d]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return i(null),He.run(e).then(e=>!t&&(i(e),o(``)),e=>!t&&o(e.message)),()=>{t=!0}},[e]);let f=(0,Q.jsxs)(`a`,{href:r(`quality`,`security`),className:`inline-flex items-center gap-1 self-start text-body-sm no-underline`,children:[(0,Q.jsx)(T,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(a)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f,(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:a})]});if(!n)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[f,(0,Q.jsx)(x,{shape:`detail`})]});let m=async()=>{try{let{id:e}=await p.start(`Explain the passive security findings of the browser run ${n.id} in the reports folder (its network.json, security section), most serious first, and how the team should fix each.`,{});location.hash=r(`chats`,e)}catch(e){d(e.message)}},h=n.findings.filter(e=>s===`all`||e.severity===s);return(0,Q.jsxs)(`section`,{"aria-labelledby":`sec-run-h`,className:`flex min-w-0 flex-col gap-4`,children:[f,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,Q.jsx)(pe,{id:`sec-run-h`,icon:N,title:(0,Q.jsx)(`span`,{"data-tip":n.goal,className:`block truncate`,children:n.goal})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-muted`,children:[J(n.at),` · `,n.env?`${n.env} · `:``,n.host??`no start page`,` · `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.id})]})]}),!n.production&&n.findings.length>0&&(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void m(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})]}),u&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:u}),n.production?(0,Q.jsxs)(q,{icon:P,title:`Not checked`,children:[`This run was on `,n.env,`, an environment named like production. The security smoke checks are for test environments only.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(H,{label:`Findings by severity`,children:[(0,Q.jsx)(G,{dot:`fail`,value:n.counts.high,label:`high: fix before release`}),(0,Q.jsx)(G,{dot:`warn`,value:n.counts.medium,label:`medium: worth fixing`}),(0,Q.jsx)(G,{dot:`neutral`,value:n.counts.low,label:`low: hardening`}),(0,Q.jsx)(G,{dot:`neutral`,value:n.pages,label:`pages checked`}),(0,Q.jsx)(G,{dot:`neutral`,value:n.calls,label:`calls checked`})]}),!n.pages&&!n.findings.length?(0,Q.jsx)(q,{icon:E,title:`No pages recorded`,children:`This run kept its API calls but not the pages' headers and cookies: it was made before ForgeQE recorded them. Run the flow again to check it.`}):n.findings.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`all`,label:`All`,n:n.findings.length},...[`high`,`medium`,`low`].filter(e=>n.counts[e]).map(e=>({id:e,label:$[e],n:n.counts[e],alert:e===`high`}))],value:s,onChange:l})}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:h.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 border-t border-line-soft py-2 text-body-sm`,children:[e.severity===`high`?(0,Q.jsx)(L,{size:15,"aria-label":`High`,className:`mt-1 flex-none text-fail`}):(0,Q.jsx)(E,{size:15,"aria-label":$[e.severity],className:c(`mt-1 flex-none`,Ue[e.severity])}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[e.title,` `,(0,Q.jsxs)(`span`,{className:c(`font-normal`,Ue[e.severity]),children:[`· `,$[e.severity]]})]}),(0,Q.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-ink-2`,"data-tip":e.target,children:[e.target,e.detail?` · ${e.detail}`:``]}),(0,Q.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:t[e.kind]?.fix})]})]},`${e.kind}|${e.target}`))})]}):(0,Q.jsx)(q,{icon:O,title:`Nothing found`,children:`The pages this run loaded sent the security headers checked, their cookies had safe flags, and no answer held a key or token.`})]})]})}function Ge({runs:e}){let[t,n]=(0,Z.useState)(`all`),i=t===`high`?e.filter(e=>e.counts.high):e,a=e=>location.hash=r(`quality`,`security`,encodeURIComponent(e));return(0,Q.jsx)(ge,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,height:R,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`all`,label:`All`,n:e.length},{id:`high`,label:`High findings`,n:e.filter(e=>e.counts.high).length,alert:!0}],value:t,onChange:n})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`w-[46%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`High`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Medium`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Low`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`hidden @2xl:table-cell`),children:`Environment`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`hidden @xl:table-cell`),children:`When`})]}),children:i.map(e=>{let t=e.production||!e.pages&&!e.counts.high&&!e.counts.medium&&!e.counts.low,n=t?P:e.counts.high?L:e.counts.medium?E:O,i=e.production?`Not checked: production`:t?`No pages recorded`:e.counts.high?`High findings`:e.counts.medium?`Medium findings`:`Nothing serious`;return(0,Q.jsxs)(`tr`,{onClick:()=>a(e.id),className:he,children:[(0,Q.jsx)(`td`,{className:c(W,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(n,{size:15,"aria-label":i,className:c(`flex-none`,t?`text-muted`:e.counts.high?`text-fail`:e.counts.medium?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,`security`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.high,className:c(U,e.counts.high?`text-fail`:`text-muted`),children:t?`–`:e.counts.high}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.medium,className:c(U,e.counts.medium?`text-warn`:`text-muted`),children:t?`–`:e.counts.medium}),(0,Q.jsx)(`td`,{"data-sort":t?-1:e.counts.low,className:c(U,`hidden text-muted @xl:table-cell`),children:t?`–`:e.counts.low}),(0,Q.jsx)(`td`,{className:c(W,`hidden text-body-sm text-muted @2xl:table-cell`),children:e.production?`${e.env} · not checked`:t?`no pages recorded`:e.env??e.host??`–`}),(0,Q.jsx)(`td`,{className:c(W,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:z(e.at)})]},e.id)})})}function Ke({id:e}){let[t,n]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{He.view().then(e=>(n(e),a(``)),e=>a(e.message))},[]),i?(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:i}):t?e?(0,Q.jsx)(We,{id:e,fix:t.fix}):t.runs.length?(0,Q.jsx)(Ge,{runs:t.runs}):(0,Q.jsx)(q,{page:!0,icon:P,title:`No runs to check yet`,action:(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow on a test environment, and what it found shows here. Every browser run keeps the pages' security headers, the cookies' flags and its API calls.`}):(0,Q.jsx)(x,{shape:`rows`})}function qe(){let[e,t]=(0,Z.useState)(``),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let i=!1;return X.view(e,n).then(a=>{i||(o(a),l(``),e||t(a.coverage.standard),n||r(a.coverage.engine))},e=>!i&&l(e.message)),()=>{i=!0}},[e,n]);let f=async t=>{d(t),l(``);try{let r=await(t===`csv`?X.csv(e,n):t===`html`?X.html(e,n):X.pdf(e,n));m(r,`wcag-coverage-${e}-${n}.${t}`)}catch(e){l(e.message)}finally{d(``)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(B,{more:(0,Q.jsx)(Q.Fragment,{children:`Rules come from the engine's own map of its rules to the success criteria; a rule that runs never proves a criterion is met. The personas (Accessibility › Agent) exercise criteria by how they use a page: a keyboard-only person meets focus order, a person at 200% zoom meets reflow. What is left needs a person reviewing by hand.`}),children:`What ForgeQE's rules and accessibility personas can check of a WCAG standard, criterion by criterion.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_220px] flex-col gap-1 text-body-sm font-medium`,children:[`Standard`,(0,Q.jsx)(i,{size:`sm`,value:e,onChange:e=>t(e.target.value),disabled:!a,children:(a?.standards??[]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_200px] flex-col gap-1 text-body-sm font-medium`,children:[`Rule engine`,(0,Q.jsx)(i,{size:`sm`,value:n,onChange:e=>r(e.target.value),disabled:!a,children:(a?.engines??[]).map(e=>(0,Q.jsx)(`option`,{value:e,children:Te(e)},e))})]}),(0,Q.jsx)(`span`,{className:`flex-auto`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`csv`),"data-tip":`Download the matrix as CSV`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),`CSV`]}),(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`html`),"data-tip":`Download the matrix as an HTML page`,children:[(0,Q.jsx)(M,{"aria-hidden":`true`}),`HTML`]}),(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,disabled:!a||!!u,onClick:()=>void f(`pdf`),"data-tip":`Print the matrix to PDF and download it`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),u===`pdf`?`Printing…`:`PDF`]})]})]}),s&&(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:s}),!a&&!s&&(0,Q.jsx)(x,{shape:`rows`,count:8}),a&&(0,Q.jsx)(De,{c:a.coverage,engineLabel:Te(a.coverage.engine)},`${a.coverage.standard}-${a.coverage.engine}`)]})}function Je({id:e,asked:t,view:n,onChanged:i}){let[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(`accessibility`),m=t===`accessibility`||t===`performance`||t===`visual`?t:u,h=t=>location.hash=r(`quality`,encodeURIComponent(e),t),[y,b]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{let t=!1;return o(null),f.run(e).then(e=>{if(t)return;o(e),l(``);let n=e.visual?.pages.some(e=>e.status===`changed`)||!e.visual&&e.captured;d(e.report?.accessibility.failed.length?`accessibility`:e.report?.breaches.some(e=>e.kind===`performance`)?`performance`:n?`visual`:e.report?.accessibility.pages?`accessibility`:e.report?.performance.pages.length?`performance`:`visual`)},e=>!t&&l(e.message)),()=>{t=!0}},[e]);let C=(0,Q.jsxs)(`a`,{href:r(`quality`),className:c(g({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,Q.jsx)(T,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(s)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[C,(0,Q.jsx)(`p`,{className:c(_.fail,`m-0`),children:s})]});if(!a)return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[C,(0,Q.jsx)(x,{shape:`detail`})]});let ee=async()=>{try{let{id:e}=await p.start(`Explain the accessibility, performance and visual results of the run in ${a.dir}: call quality_report and visual_compare with run_dir ${a.dir}. Say what matters most to fix first, and why.`,{});location.hash=r(`chats`,e)}catch(e){b(e.message)}},w=a.report,E=w?.accessibility,D=w?.performance.pages??[],O=D.filter(e=>e.over.length).length,k=D.map(e=>e.lcp).filter(e=>typeof e==`number`),A=k.length?Math.max(...k):void 0,j=a.visual?.pages.filter(e=>e.status===`changed`).length??0,M=w?.breaches.length??0,N=[{id:`accessibility`,label:`Accessibility`,icon:F,n:E?.pages?`${E.failed.length} failed`:`not measured`,tone:E?.failed.length?`text-fail`:void 0},{id:`performance`,label:`Performance`,icon:te,n:D.length?O?`${O} over budget`:`${D.length} pages`:`not measured`,tone:O?`text-fail`:void 0},{id:`visual`,label:`Visual`,icon:re,n:a.visual?`${j} changed`:a.captured?`not compared`:`not captured`,tone:j?`text-warn`:void 0}];return(0,Q.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-4`,children:[C,(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,Q.jsx)(pe,{id:`run-h`,icon:ne,title:(0,Q.jsx)(`span`,{"data-tip":a.goal,className:`block truncate`,children:a.goal})}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-muted`,children:[J(a.at),` · `,n.standard,` · `,(0,Q.jsx)(S,{path:a.dir})]})]}),(0,Q.jsxs)(v,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void ee(),children:[(0,Q.jsx)(I,{"aria-hidden":`true`}),`Chat`]})]}),y&&(0,Q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:y}),(0,Q.jsxs)(H,{label:`What the run measured`,children:[(0,Q.jsx)(G,{dot:M?`fail`:`pass`,value:M,label:M?`budgets exceeded: fails the run`:`budgets exceeded`}),E?.pages?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{dot:`fail`,value:E.failed.length,label:`rules failed (${E.passed.length} passed)`}),(0,Q.jsx)(G,{dot:`fail`,value:`${E.byImpact.critical} · ${E.byImpact.serious}`,label:`critical · serious`}),(0,Q.jsx)(G,{dot:`warn`,value:`${E.byImpact.moderate} · ${E.byImpact.minor}`,label:`moderate · minor`})]}):null,D.length>0&&(0,Q.jsx)(G,{dot:O?`fail`:`neutral`,value:D.length,label:O?`pages timed, ${O} over budget`:`pages timed`}),A!==void 0&&(0,Q.jsx)(G,{dot:A>4e3?`fail`:A>2500?`warn`:`pass`,value:Se(A,`ms`),label:`slowest LCP (good up to 2.5s)`}),a.visual?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{dot:`neutral`,value:a.visual.pages.length,label:`pages compared`}),(0,Q.jsx)(G,{dot:`warn`,value:j,label:a.visual.pages.some(e=>e.over)?`pages changed, over budget`:`pages changed`})]}):a.captured?(0,Q.jsx)(G,{dot:`neutral`,value:a.captured,label:`pages captured, not compared`}):null]}),(0,Q.jsx)(se,{label:`Results`,className:`mb-0`,current:m,onPick:h,tabs:N.map(e=>({id:e.id,label:e.label,n:e.n,...e.tone?{tone:e.tone}:{}}))}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-${m}`,"aria-labelledby":`tab-${m}`,className:`flex min-w-0 flex-col`,children:[m===`accessibility`&&(0,Q.jsx)(xe,{run:a,standard:n.standard,disclaimer:n.disclaimer},a.id),m===`performance`&&(0,Q.jsx)(_e,{run:a}),m===`visual`&&(0,Q.jsx)(ve,{run:a,budget:n.budgets.visual,onChange:e=>{o(e),i()}})]})]})}function Ye({runs:e}){let[t,n]=(0,Z.useState)(`all`),i=e,a=t===`attention`?i.filter(Y):i,o=e=>location.hash=r(`quality`,encodeURIComponent(e));return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,Q.jsx)(ge,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,height:R,tools:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Q.jsx)(y,{items:[{id:`all`,label:`All`,n:i.length},{id:`attention`,label:`Needs a look`,n:i.filter(Y).length,alert:!0}],value:t,onChange:n})}),head:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`w-[46%]`),children:`Run`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Rules failed`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @2xl:table-cell`),children:`Critical · serious`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @xl:table-cell`),children:`Slow pages`}),(0,Q.jsx)(`th`,{scope:`col`,className:V,children:`Visual`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(V,`hidden @3xl:table-cell`),children:`Budgets`}),(0,Q.jsx)(`th`,{scope:`col`,className:c(K,`hidden @xl:table-cell`),children:`When`})]}),children:a.map(e=>{let t=e.breaches?L:Y(e)?E:O,n=e.a11y?e.a11y.critical+e.a11y.serious:void 0;return(0,Q.jsxs)(`tr`,{onClick:()=>o(e.id),className:he,children:[(0,Q.jsx)(`td`,{className:c(W,`max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(t,{size:15,"aria-label":e.breaches?`Over a budget`:Y(e)?`Needs a look`:`Within budgets`,className:c(`flex-none`,e.breaches?`text-fail`:Y(e)?`text-warn`:`text-pass`)}),(0,Q.jsx)(`a`,{href:r(`quality`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,Q.jsx)(`td`,{className:c(U,e.a11y?.failed?`text-fail`:`text-muted`),"data-sort":e.a11y?e.a11y.failed:-1,children:e.a11y?e.a11y.failed:`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden @2xl:table-cell`,n?`text-fail`:`text-muted`),"data-sort":e.a11y?e.a11y.critical*1e3+e.a11y.serious:-1,children:e.a11y?`${e.a11y.critical} · ${e.a11y.serious}`:`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden @xl:table-cell`,e.perf.over?`text-fail`:`text-muted`),"data-sort":e.perf.pages?e.perf.over:-1,children:e.perf.pages?`${e.perf.over} / ${e.perf.pages}`:`–`}),(0,Q.jsx)(`td`,{className:c(U,e.visual?.changed?`text-warn`:`text-muted`),"data-sort":e.visual?e.visual.changed:-1,children:e.visual?`${e.visual.changed} changed`:e.captured?`not compared`:`–`}),(0,Q.jsx)(`td`,{className:c(U,`hidden @3xl:table-cell`,e.breaches?`text-fail`:`text-muted`),"data-sort":e.breaches||0,children:e.breaches?`${e.breaches} over`:`ok`}),(0,Q.jsx)(`td`,{className:c(W,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":J(e.at),"data-sort":new Date(e.at).getTime()||0,children:z(e.at)})]},e.id)})})})}function Xe({sub:e}){let[t,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),s=(0,Z.useCallback)(()=>{f.view().then(e=>{i(e),o(``)},e=>o(e.message))},[]);(0,Z.useEffect)(s,[s]);let[l=``,d,p]=(e??``).split(`/`),m=l===`trends`,h=l===`security`,v=l===`localization`,y=l===`scans`,b=l===`dashboard`,S=l===`coverage`,C=y||b||S,T=(h||v)&&d?n(d):void 0,E=h?T:void 0,O=l&&!m&&!h&&!v&&!C?n(l):``;return(0,Q.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Q.jsx)(ue,{}),(0,Q.jsxs)(`main`,{className:c(de,`@container flex-auto gap-4`),children:[(0,Q.jsx)(ee,{}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Q.jsx)(me,{pixel:u.quality,size:`lg`,head:!0}),(0,Q.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Quality`}),!O&&!(y&&d)&&(0,Q.jsx)(ce,{label:`Show`,current:m?`trends`:h?`security`:v?`localization`:y?`scans`:b?`dashboard`:S?`coverage`:`runs`,links:[{id:`runs`,label:`Runs`,icon:ne,href:r(`quality`)},{id:`scans`,label:`Scan history`,icon:j,href:r(`quality`,`scans`)},{id:`dashboard`,label:`Dashboard`,icon:w,href:r(`quality`,`dashboard`)},{id:`trends`,label:`Trends`,icon:A,href:r(`quality`,`trends`)},{id:`coverage`,label:`WCAG coverage`,icon:F,href:r(`quality`,`coverage`)},{id:`security`,label:`Security`,icon:N,href:r(`quality`,`security`)},{id:`localization`,label:`Localization`,icon:k,href:r(`quality`,`localization`)}]})]}),h&&!E&&(0,Q.jsx)(B,{more:(0,Q.jsx)(Q.Fragment,{children:`Passive smoke checks read from what each run recorded: the pages' security headers, the flags of the cookies they set, http requests from https pages, redirects to an address taken from the URL, and keys or tokens in API answers. Nothing is sent to the site, and runs on an environment named like production are not checked.`}),children:`Security problems each browser run's pages showed, found without touching the site.`}),v&&!T&&(0,Q.jsx)(B,{more:(0,Q.jsx)(Q.Fragment,{children:`Each page is checked for translation keys shown as text, English left on a page in another language, and text cut off or running past its box. Then, for a moment the run never sees, the page is shown with pseudo-localized text (accented and a third longer) and right to left, to find what breaks in German or Arabic before it is translated. Run a flow in each language your site has.`}),children:`Each page a browser run visited, checked for its language and for what breaks when it is translated.`}),!O&&!h&&!v&&!C&&(0,Q.jsx)(B,{more:(0,Q.jsxs)(Q.Fragment,{children:[`Each browser run measures accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run. Open a run for all its details, or one kind with its agent: `,(0,Q.jsx)(`a`,{href:r(`accessibility`,`agent`),children:`Accessibility`}),`, `,(0,Q.jsx)(`a`,{href:r(`performance`,`agent`),children:`Performance`}),` or `,(0,Q.jsx)(`a`,{href:r(`visual`,`agent`),children:`Visual`}),`.`]}),children:`How accessible, fast and visually unchanged the pages of each browser run were.`}),a&&(0,Q.jsx)(`p`,{role:`alert`,className:c(_.fail,`m-0`),children:a}),!t&&!a&&!C&&(0,Q.jsx)(x,{shape:`rows`}),h&&(0,Q.jsx)(Ke,{id:E}),y&&(0,Q.jsx)(Oe,{id:d,asked:p}),b&&(0,Q.jsx)(Ve,{}),S&&(0,Q.jsx)(qe,{}),v&&(0,Q.jsx)(Ie,{id:T}),t&&O&&(0,Q.jsx)(Je,{id:O,asked:d,view:t,onChanged:s},O),t&&!O&&m&&!C&&(0,Q.jsx)(`div`,{role:`tabpanel`,"aria-label":`Trends`,children:(0,Q.jsx)(be,{trends:t.trends})}),t&&!O&&!m&&!h&&!v&&!C&&(t.runs.length?(0,Q.jsx)(Ye,{runs:t.runs}):(0,Q.jsx)(q,{page:!0,icon:F,title:`No measurements yet`,action:(0,Q.jsxs)(`a`,{className:g({size:`sm`}),href:r(`record`),"data-tip":`Record a flow`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`}),`Record`]}),children:`Run a flow from a chat or the Record page, and what it measured shows here. Every browser run checks accessibility, timings and visual changes of the pages it visits.`}))]})]})}export{Xe as Quality};
@@ -0,0 +1 @@
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,P as i,i as a}from"./surface-CJmzHqOR.js";import{t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{z as c}from"./searchRecents-BRxclL5B.js";import{v as l}from"./api-C5wO4oo1.js";import{I as u,P as d,g as f,n as p}from"./pageBack-C6KF2YWt.js";import{Er as m,N as h,P as g,it as _,o as v,z as y}from"./line-icons-Cwj9OmCz.js";import{Ft as b,G as x,J as S,L as C,Xt as w,pn as T}from"./index-Bm0NGw2p.js";import{d as E}from"./qualityParts-xNbrX_EB.js";var D=e(t(),1),O={view:(e,t)=>l(`GET`,`/api/readiness?${new URLSearchParams({...e?{pack:e}:{},...t?{report:t}:{}})}`),signOff:e=>l(`POST`,`/api/readiness/signoff`,{...e,confirmed:!0})},k=s(),A={pass:{label:`Pass`,icon:h,tone:`text-pass`},risk:{label:`Risk`,icon:m,tone:`text-warn`},block:{label:`Blocker`,icon:y,tone:`text-fail`},unknown:{label:`No evidence`,icon:g,tone:`text-muted`}},j={GO:{word:`Go`,tone:`text-pass`,bg:`bg-pass-soft`,text:`Every criterion with evidence passed.`},"GO WITH RISKS":{word:`Go with risks`,tone:`text-warn`,bg:`bg-warn-soft`,text:`Nothing blocks the release, but some criteria are risks or have no evidence yet.`},"NO-GO":{word:`No go`,tone:`text-fail`,bg:`bg-fail-soft`,text:`At least one criterion blocks the release.`},"NO EVIDENCE":{word:`No evidence yet`,tone:`text-muted`,bg:`bg-surface-muted`,text:`Nothing has been measured for this release yet: build and run a regression pack.`}},M={GO:`go`,"GO WITH RISKS":`go-with-risks`,"NO-GO":`no-go`,"NO EVIDENCE":`no-go`};function N({view:e,onDone:t}){let[n,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(M[e.verdict]),[u,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(!1),[g,_]=(0,D.useState)(``),v=async()=>{m(!0);try{let r=await O.signOff({by:n.trim(),decision:c,...u.trim()?{note:u.trim()}:{},...e.pack?{pack:e.pack}:{},...e.report?{report:e.report}:{}});t(r.view,r.file,r.markdown)}catch(e){_(e.message)}finally{m(!1)}};return(0,k.jsxs)(`form`,{"aria-label":`Sign off`,className:o(a,`flex flex-col gap-2 text-body-sm`),onSubmit:e=>{e.preventDefault(),n.trim()&&v()},children:[(0,k.jsxs)(`span`,{children:[`Sign off `,e.release||e.pack||`this release`,` as it is now. The record keeps your name, your decision, ForgeQE's verdict and every criterion with its evidence.`]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1 font-medium`,children:[`Your name`,(0,k.jsx)(i,{size:`sm`,value:n,maxLength:80,onChange:e=>s(e.target.value)})]}),(0,k.jsxs)(`label`,{className:`flex flex-[0_1_200px] flex-col gap-1 font-medium`,children:[`Decision`,(0,k.jsxs)(r,{size:`sm`,value:c,onChange:e=>l(e.target.value),children:[(0,k.jsx)(`option`,{value:`go`,children:`Go`}),(0,k.jsx)(`option`,{value:`go-with-risks`,children:`Go with risks`}),(0,k.jsx)(`option`,{value:`no-go`,children:`No go`})]})]}),(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1 font-medium`,children:[`Note (optional)`,(0,k.jsx)(i,{size:`sm`,value:u,maxLength:500,onChange:e=>f(e.target.value),placeholder:`Accepted the coupon risk: covered by a manual check`})]}),(0,k.jsxs)(d,{size:`sm`,variant:`primary`,type:`submit`,disabled:p||!n.trim(),children:[(0,k.jsx)(h,{"aria-hidden":`true`}),`Sign off`]})]}),g&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 text-fail`,children:g})]})}function P(){let[e,t]=(0,D.useState)(null),[i,a]=(0,D.useState)(``),[s,l]=(0,D.useState)(),[m,g]=(0,D.useState)(),[y,M]=(0,D.useState)(!1),[P,F]=(0,D.useState)(null),I=(0,D.useCallback)(()=>{O.view(s,m).then(e=>(t(e),a(``)),e=>a(e.message))},[s,m]);(0,D.useEffect)(I,[I]);let L=e,R=L?{block:L.criteria.filter(e=>e.status===`block`).length,risk:L.criteria.filter(e=>e.status===`risk`).length,unknown:L.criteria.filter(e=>e.status===`unknown`).length}:void 0;return(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(S,{}),(0,k.jsxs)(`main`,{className:o(C,`@container flex-auto gap-4`),children:[(0,k.jsx)(p,{}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(T,{pixel:c.readiness,size:`lg`,head:!0}),(0,k.jsx)(`h1`,{className:`m-0 text-headline-md`,children:`Release readiness`})]}),(0,k.jsx)(x,{more:(0,k.jsx)(k.Fragment,{children:`The verdict comes from what ForgeQE has measured: the regression pack's last run and the changes it does not cover, the latest readiness report of the test cases and bugs, flaky tests, Quality budgets and Security findings since the pack was built, the agents' Evidence verdicts and exploratory sessions. Any blocker makes it a no go. Each criterion opens the page with its evidence.`}),children:`Decide whether a release is ready to ship, and sign it off.`}),i&&(0,k.jsx)(`p`,{role:`alert`,className:o(u.fail,`m-0`),children:i}),!L&&!i&&(0,k.jsx)(f,{shape:`detail`}),L&&R&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1 text-body-sm font-medium`,children:[`Release (regression pack)`,(0,k.jsxs)(r,{size:`sm`,value:L.pack??``,onChange:e=>(l(e.target.value||void 0),F(null)),disabled:!L.packs.length,children:[!L.packs.length&&(0,k.jsx)(`option`,{value:``,children:`No packs yet`}),L.packs.map(e=>(0,k.jsx)(`option`,{value:e.name,children:e.release?`${e.release} · ${e.name}`:e.name},e.name))]})]}),(0,k.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1 text-body-sm font-medium`,children:[`Test cases and bugs (readiness report)`,(0,k.jsxs)(r,{size:`sm`,value:L.report??``,onChange:e=>(g(e.target.value||void 0),F(null)),disabled:!L.reports.length,children:[!L.reports.length&&(0,k.jsx)(`option`,{value:``,children:`No reports yet`}),L.reports.map(e=>(0,k.jsxs)(`option`,{value:e.id,children:[e.scope,` · `,e.verdict,` · `,e.id]},e.id))]})]})]}),(0,k.jsxs)(`section`,{"aria-label":`Verdict`,className:o(`flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md px-4 py-4`,j[L.verdict].bg),children:[(0,k.jsxs)(`div`,{className:`flex flex-col`,children:[(0,k.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`ForgeQE's verdict`,L.release?` for ${L.release}`:``]}),(0,k.jsx)(`span`,{className:o(L.verdict===`NO EVIDENCE`?`text-body-md`:`text-headline-lg`,j[L.verdict].tone),children:j[L.verdict].word})]}),(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1 text-body-sm`,children:[(0,k.jsx)(`span`,{className:`text-ink-2`,children:j[L.verdict].text}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[R.block,` blocker`,R.block===1?``:`s`,` · `,R.risk,` risk`,R.risk===1?``:`s`,` · `,R.unknown,` without evidence`,L.since?(0,k.jsxs)(`span`,{"data-tip":E(L.since),children:[` · measured since the pack was built, `,b(L.since)]}):null]})]}),!y&&(0,k.jsxs)(d,{size:`sm`,onClick:()=>(M(!0),F(null)),children:[(0,k.jsx)(h,{"aria-hidden":`true`}),`Sign off`]})]}),y&&(0,k.jsx)(N,{view:L,onDone:(e,n,r)=>{t(e),M(!1),F({file:n,markdown:r})}}),P&&(0,k.jsxs)(`p`,{role:`status`,className:`m-0 flex flex-wrap items-center gap-2 text-body-sm text-ink-2`,children:[`Signed off: saved as `,(0,k.jsx)(`code`,{className:`font-mono text-body-sm`,children:P.file}),(0,k.jsxs)(d,{size:`sm`,variant:`ghost`,"data-tip":`Download the record`,onClick:()=>{let e=URL.createObjectURL(new Blob([P.markdown],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=`signoff.md`,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},children:[(0,k.jsx)(_,{"aria-hidden":`true`}),`Download`]})]}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:L.criteria.map(e=>{let t=A[e.status];return(0,k.jsxs)(`li`,{className:`flex flex-wrap items-start gap-4 border-t border-line-soft py-4 text-body-sm`,children:[(0,k.jsx)(t.icon,{size:16,"aria-label":t.label,className:o(`mt-1 flex-none`,t.tone)}),(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,k.jsxs)(`span`,{className:`font-medium`,children:[e.label,` `,(0,k.jsxs)(`span`,{className:o(`font-normal`,t.tone),children:[`· `,t.label,`: `,e.value]})]}),e.detail.map((e,t)=>(0,k.jsx)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]}),e.link.length>0&&(0,k.jsxs)(`a`,{href:n(...e.link.map(encodeURIComponent)),className:`inline-flex items-center gap-1 self-center text-body-sm whitespace-nowrap`,children:[`Open`,(0,k.jsx)(v,{size:14,"aria-hidden":`true`})]})]},e.id)})}),L.signoffs.length>0&&(0,k.jsx)(w,{id:`signoffs`,icon:h,title:`Sign-offs`,children:(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-body-sm`,children:L.signoffs.map(e=>(0,k.jsxs)(`li`,{className:`flex flex-wrap gap-x-2 border-t border-line-soft py-2`,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:e.release}),(0,k.jsx)(`span`,{className:e.decision===`NO-GO`?`text-fail`:e.decision===`GO`?`text-pass`:`text-warn`,children:j[e.decision]?.word??e.decision}),(0,k.jsxs)(`span`,{className:`text-muted`,children:[`by `,e.by,`, `,e.at?E(e.at):e.id,` · ForgeQE said `,j[e.verdict]?.word??e.verdict]})]},e.id))})})]})]})]})}export{P as Readiness};
@@ -0,0 +1 @@
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,N as a,P as o,a as s,c,s as l,z as u}from"./surface-CJmzHqOR.js";import{n as d,t as f}from"./utils-DJRAScIl.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{J as m,Y as h,q as g}from"./searchRecents-BRxclL5B.js";import{L as _}from"./paletteCommands-4ZbMQrvq.js";import{T as v,U as y,X as b,b as x,tt as S}from"./api-C5wO4oo1.js";import{A as C,I as w,N as T,O as E,P as D,T as O,g as k,i as A,j,k as M}from"./pageBack-C6KF2YWt.js";import{$t as N,B as P,Cn as ee,Cr as F,D as te,E as I,En as L,Er as ne,F as re,Fn as ie,Gr as R,Gt as ae,Hr as oe,I as se,In as z,Kn as ce,L as le,Lr as ue,N as de,O as fe,Or as pe,Pr as me,Rn as he,Rt as ge,Sn as _e,Sr as ve,Tn as ye,U as be,Un as xe,Vn as Se,Wr as Ce,Wt as we,Z as Te,Zn as Ee,Zt as De,a as Oe,br as ke,cn as Ae,cr as je,f as B,fn as Me,ft as Ne,gr as Pe,hn as Fe,i as Ie,kr as Le,ln as Re,lt as ze,mt as Be,o as Ve,or as He,pr as Ue,rt as We,s as V,tt as Ge,un as Ke,ur as qe,vr as Je,w as H,wn as Ye,yn as Xe,yt as Ze,z as Qe,zn as $e}from"./line-icons-Cwj9OmCz.js";import{u as et}from"./nav-BVGAdkgR.js";import{At as tt,Bt as nt,Et as rt,Fn as it,Ft as at,G as U,Gt as ot,Jt as W,Kt as st,On as ct,Tt as lt,Ut as ut,Vt as G,Wt as dt,Xt as ft,Zt as pt,cn as mt,dr as ht,kn as gt,kt as _t,l as vt,n as yt,pn as bt,qt as xt,t as St,tt as Ct,zt as wt}from"./index-Bm0NGw2p.js";import{n as K,r as Tt}from"./choice-DU4-gNa8.js";import{t as Et}from"./step-mark-BCkZt2-_.js";import{n as Dt,r as q,t as Ot}from"./recordTest-ecnqAff5.js";import{t as kt}from"./DeviceScreen-DJiqz1aE.js";import{n as At,t as jt}from"./desktopAppPath-ClRxEs7y.js";import{a as Mt,i as Nt,n as Pt,o as Ft,r as It,t as Lt}from"./DesktopReview-QI-8PPuf.js";import{t as Rt}from"./radio-BLI4Ubhk.js";import{n as zt,t as Bt}from"./uploadBuild-sQwJpid1.js";import{t as Vt}from"./AgentWork-BIDUzmaq.js";var J=e(t(),1),Ht=.85;function Ut(e){return!!e&&e.width>0&&e.height>0&&e.width>=e.height*.8}function Wt(e){if(!e||!(e.width>0)||!(e.height>0))return[];let t=e.width*e.height*Ht;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 Gt(e){try{let t=decodeURIComponent(e??``).trim();return/^https?:\/\/\S+$/i.test(t)&&t.length<=2e3?t:``}catch{return``}}function Kt(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 qt(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)}function Jt(e){return e.index>0&&!e.fixed&&!e.block&&e.op!==`capture`}var Yt=/^(a|button|input|select|textarea|form|img|label|table|tr|td|th|li|ul|ol|nav|header|footer|main|h[1-6])$/;function Xt(e){let t=e.trim();return/^[/(]/.test(t)?`xpath`:/^[a-z]+\|/.test(t)?`role`:/^[#.[*]/.test(t)||/^[a-z][a-z0-9-]*(?:[#.[:]|\s*[>~+])/.test(t)||Yt.test(t)?`css`:`text`}var Y=p(),Zt={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`,xpath_relative:`A path from a text or attribute near it`},Qt={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.`}},$t=e=>`${Zt[e.type]||e.type}: ${e.value}`,en=[{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.`}],tn=new Set([`data`,`date`,`any`]),nn={label:`As clicked`,note:`The test clicks exactly this one.`},rn=(e,t)=>e.op===`click`&&t===`typed`?nn.label:en.find(e=>e.id===t)?.label,an=(e,t)=>e.op===`click`&&t===`typed`?nn.note:en.find(e=>e.id===t)?.note,on=e=>{let t=e.value;return en.filter(n=>t.choices?t.choices.includes(n.id):e.op===`select`?n.id===`typed`||n.id===`data`:n.id!==`date`&&n.id!==`any`)},sn=[`steps`,`data`,`run`,`instructions`,`blocks`,`history`];function cn({runDir:e,onClose:t,onRecordMore:n,notices:a,tab:s,onTab:c}){let[l,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,x]=(0,J.useState)(`steps`),S=c?sn.includes(s??``)?s:`steps`:y,C=e=>c?c(e):x(e),[k,A]=(0,J.useState)(``),[j,N]=(0,J.useState)(!1),[P,ee]=(0,J.useState)(null);(0,J.useEffect)(()=>ee(null),[S,l]);let[te,L]=(0,J.useState)(null),[ie,ae]=(0,J.useState)(!1),[oe,se]=(0,J.useState)(null),[fe,pe]=(0,J.useState)(null),[me,ge]=(0,J.useState)(null),[ve,ye]=(0,J.useState)(new Set),be=e=>ye(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[xe,Ee]=(0,J.useState)({}),De=e=>xe[e.n]??(!e.ok&&!e.skipped),[ke,Ae]=(0,J.useState)(null),[Me,Ne]=(0,J.useState)(``),[Pe,Fe]=(0,J.useState)(`all`),[Le,Ve]=(0,J.useState)(null),[He,We]=(0,J.useState)(!1),[Ke,Je]=(0,J.useState)(``),[Ye,Ze]=(0,J.useState)(``),[$e,et]=(0,J.useState)([]),[nt,rt]=(0,J.useState)(void 0),[U,ot]=(0,J.useState)({from:0,to:0,name:``,section:``}),[W,st]=(0,J.useState)({block:``,after:0}),[lt,ut]=(0,J.useState)({values:{},secrets:{}}),[G,dt]=(0,J.useState)([]),[ft,ht]=(0,J.useState)(null),[_t,vt]=(0,J.useState)(null),[yt,bt]=(0,J.useState)(``),xt=$e.filter(e=>(e.kind??`web`)===`web`),St=(e=>e?$e.filter(t=>`${t.name} ${t.section??``} ${t.description??``}`.toLowerCase().includes(e)):$e)(yt.trim().toLowerCase()),[Ct,wt]=(0,J.useState)(``),[K,Tt]=(0,J.useState)(null),[Et,Dt]=(0,J.useState)(``),[kt,At]=(0,J.useState)({}),jt=(0,J.useRef)(null),[Lt,Rt]=(0,J.useState)(``),[zt,Bt]=(0,J.useState)(``),[Ht,Ut]=(0,J.useState)(null),[Wt,Gt]=(0,J.useState)(!1),[Kt,Yt]=(0,J.useState)(!1),[Xt,Zt]=(0,J.useState)(``),[$t,en]=(0,J.useState)(!1),[nn,cn]=(0,J.useState)(!1),[hn,gn]=(0,J.useState)(null),[yn,bn]=(0,J.useState)(``);(0,J.useEffect)(()=>{let t=!1;return b.review(e).then(e=>{t||(p(e),A(e.name),Ze(e.instructions))},e=>!t&&h(e.message)),()=>{t=!0}},[e]);let[xn,Sn]=(0,J.useState)([]);(0,J.useEffect)(()=>{let e=!1;return b.get().then(t=>!e&&Sn(t.recordings.filter(e=>e.kind===`web`).map(e=>({runDir:e.runDir,name:e.name}))),()=>!e&&Sn([])),()=>{e=!0}},[e]),(0,J.useEffect)(()=>{b.blocks().then(e=>{et(e.blocks),rt(e.shared),dt(e.secrets??[]),ut(Nt(e.blocks.find(e=>(e.kind??`web`)===`web`),e.secrets??[]))},()=>et([]))},[]),(0,J.useEffect)(()=>{let t=!1;return b.tryView(e).then(e=>{if(t)return;let n=new Map((jt.current??[]).map(e=>[e.name,e.value]));jt.current=e.data,Tt(e),At(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,l]);let Cn=()=>b.review(e).then(e=>p(t=>t&&{...t,test:e.test}),()=>{}),Tn=l?.test?.state===`writing`||l?.test?.state===`checking`;(0,J.useEffect)(()=>{if(!Tn)return;let e=gt(()=>void Cn(),2500);return()=>ct(e)},[Tn,e]);let X=K?.running===e,kn=K?.result?`${K.result.ms??0}-${K.result.env??``}-${K.result.steps.length}-${K.result.ok}`:``;(0,J.useEffect)(()=>Ee({}),[kn]),(0,J.useEffect)(()=>{if(!X)return;let t=gt(()=>{b.tryView(e).then(Tt,()=>{})},1500);return()=>ct(t)},[X,e]);let jn=()=>Object.fromEntries(Object.entries(kt).filter(([e,t])=>t!==K?.data.find(t=>t.name===e)?.value)),Mn=()=>Lt.startsWith(`file:`)?{file:Lt.slice(5),...zt.trim()&&/\.xls[xm]$/i.test(Lt)?{sheet:zt.trim()}:{}}:Lt.startsWith(`request:`)?{request:Lt.slice(8)}:void 0,Nn=async t=>{h(``),Gt(!0);try{let n=await b.write(e,{check:t,env:Et,data:jn(),each:Mn()});p(e=>e&&{...e,test:n.test}),Tt(n.try),t&&Ut(l)}catch(e){h(e.message)}finally{Gt(!1)}},Pn=async()=>{h(``),bn(``),gn(null),cn(!1);try{let t=await b.tryRun(e,Et,jn(),Mn());Ut(l),Tt(t)}catch(e){h(e.message)}},Fn=async()=>{h(``),bn(``),gn(null),cn(!0);try{let t=await b.reheal(e,Et,jn(),Mn());Ut(l),Tt(t)}catch(e){h(e.message),cn(!1)}},In=async t=>{v(!0),h(``),bn(``);try{let n=await b.acceptReheals(e,t);Tt(n.try),gn(n.heals),n.written?bn(`${d(n.written,`step`)} now ${n.written===1?`uses`:`use`} the locator the re-record found.${n.skipped.length?` ${d(n.skipped.length,`heal`)} left: ${n.skipped[0].why}.`:``}`):h(`Nothing was changed: ${n.skipped[0]?.why??`those steps have no heal.`}`)}catch(e){h(e.message)}finally{v(!1)}},Ln=async()=>{h(``);try{Tt(await b.tryStop(e)),Cn()}catch(e){h(e.message)}},Rn=async()=>{h(``),en(!0);try{let t=await b.stopWrite(e);p(e=>e&&{...e,test:t.test})}catch(e){h(e.message)}finally{en(!1)}},zn=async()=>{v(!0),h(``),wt(``);try{let t=await b.saveBlock(e,U.name.trim(),U.from,U.to,U.section.trim());et(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}`),ot({...U,name:``})}catch(e){h(e.message)}finally{v(!1)}},Bn=async(t,n)=>{v(!0),h(``);try{let r=await b.updateBlock(t,n);et(r.blocks),ht(null),p(await b.review(e))}catch(e){h(e.message)}finally{v(!1)}},Vn=async e=>{v(!0),h(``);try{let t=await b.deleteBlock(e,_t?.id===e);et(t.blocks),vt(null),W.block!==e&&W.block||(st({...W,block:``}),ut(Nt(t.blocks.find(e=>(e.kind??`web`)===`web`),G)))}catch(t){let n=t;n.status===409?vt({id:e,why:n.message}):h(n.message)}finally{v(!1)}},Z=async t=>{v(!0),h(``);try{let n=`restore`in t?await b.restoreReview(e,t.restore):`insert`in t?await b.insertBlock(e,t.insert.after,t.insert.block,t.insert.use&&Ft(t.insert.use)):`refreshBlock`in t?await b.refreshBlock(e,t.refreshBlock.block,t.refreshBlock.from):`useBlock`in t?await b.useBlock(e,t.useBlock.block,t.useBlock.from):`copyFrom`in t?await b.copyStep(e,t.copyFrom.run,t.copyFrom.index,t.copyFrom.after):await b.saveReview(e,t);return p(n),A(n.name),Ze(n.instructions),!0}catch(e){return h(e.message),!1}finally{v(!1)}},Hn=async()=>{We(!0),Je(``);try{let t=await b.suggest(e);Ve(t.picks),Je(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Je(e.message)}finally{We(!1)}},Un=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},Wn=async e=>{for(let t of e)await Z(Un(t));Ve(t=>(t||[]).filter(t=>!e.includes(t)))};if(!l)return m?(0,Y.jsx)(`p`,{role:`alert`,className:f(w.fail,`m-0`),children:m}):(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Reading the recording…`});let Gn=l.steps.filter(e=>e.value),Kn=l.steps.filter(e=>e.kept),qn=l.steps.filter(e=>e.op===`expect`).length,Q=X?void 0:K?.result,Jn=new Map((Q?.steps??[]).map(e=>[e.n-1,e])),Yn=Q?.steps.find(e=>!e.ok),Xn=Yn?Yn.n-1:-1,Zn=Xn>=0?l.steps[Xn]:void 0,Qn=!!Q&&!!Ht&&Ht!==l,$n=(Q?.steps??[]).filter(e=>!e.ok).length,er=Me.toLowerCase().split(/\s+/).filter(Boolean),tr=l.steps.filter(e=>er.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(Pe===`all`||(Pe===`checks`?e.op===`expect`:Jn.get(e.index)?.ok===!1))),nr=e=>{C(`steps`),Fe(`all`),Ne(``);let t=n=>requestAnimationFrame(()=>{let r=document.getElementById(`step-${e}`);r?r.scrollIntoView({block:`center`,behavior:u()}):n>0&&t(n-1)});t(30)},rr=!!K?.running&&!X,$=q(l.test),ir=()=>void Nn(!(Q?.ok&&Ht===l)),ar=X&&!!K?.stopping,or=Wt||$.writing,sr=[{id:`steps`,label:`Steps`,icon:Re,n:l.steps.length},{id:`data`,label:`Test data`,icon:Ge,n:Gn.length+Kn.length},{id:`run`,label:`Runs`,icon:he,...K?.runs?.length?{n:K.runs.length}:{}},{id:`instructions`,label:`Instructions`,icon:Xe},{id:`blocks`,label:`Blocks`,icon:B},{id:`history`,label:`Versions`,icon:we,n:l.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)(D,{size:`sm`,variant:`ghost`,onClick:t,className:`-ml-2 text-ink-2`,children:[(0,Y.jsx)(Oe,{"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:[j?(0,Y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),N(!1),k.trim()&&k.trim()!==l.name&&Z({name:k.trim()})},children:[(0,Y.jsx)(o,{"aria-label":`Name of the recording`,value:k,maxLength:200,autoFocus:!0,onChange:e=>A(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{size:`sm`,variant:`outline`,onClick:()=>{A(l.name),N(!1)},children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}):(0,Y.jsx)(pt,{id:`review-title`,icon:re,title:(0,Y.jsx)(`span`,{"data-tip":l.name,children:l.name}),actions:(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename the recording`,onClick:()=>N(!0),className:`size-8 flex-none`,children:(0,Y.jsx)(z,{"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:[d(l.steps.length,`step`),` · `,d(qn,`check`)]}),X?(0,Y.jsx)(M,{tone:`running`,children:ar?`Stopping…`:`Running the steps…`}):Q?.stopped?(0,Y.jsx)(M,{tone:`neutral`,icon:!1,children:`Last run stopped`}):Q?(0,Y.jsx)(M,{tone:Q.ok?`pass`:`fail`,children:Q.ok?`Last run passed${Q.env?` on ${Q.env}`:``}`:Yn?`Last run failed at step ${Yn.n}`:`Last run did not get through`}):(0,Y.jsx)(M,{tone:`neutral`,icon:!1,children:`Not run yet`}),Qn&&(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)(M,{tone:$.tone,icon:$.tone!==`neutral`,children:$.label}),l.test?.testFile&&$.hasTest&&(0,Y.jsxs)(D,{variant:`link`,size:`inline`,onClick:async()=>Zt(await Ot(l.test.testFile)),"data-tip":`Open ${l.test.testFile}${l.test.repo?` in ${l.test.repo}`:``}`,className:`min-w-0 gap-1 font-mono`,children:[(0,Y.jsx)(Be,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:l.test.testFile})]}),l.test&&!$.writing&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,at(l.test.at)]}),(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:$.detail}),Xt&&(0,Y.jsx)(`span`,{className:`basis-full text-body-sm text-fail [overflow-wrap:anywhere]`,children:Xt})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[X?(0,Y.jsxs)(D,{busy:ar,variant:`destructive`,disabled:ar,onClick:()=>void Ln(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(qe,{fill:`currentColor`,"aria-hidden":`true`}),ar?`Stopping…`:`Stop`]}):(0,Y.jsxs)(D,{disabled:rr||or,onClick:()=>void Pn(),"data-tip":rr?`Another run is going`:`Play the steps in a new browser, as the test will`,children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Re-run`]}),l.test?.state===`writing`?(0,Y.jsxs)(D,{busy:$t,variant:`destructive`,disabled:$t,onClick:()=>void Rn(),"data-tip":`Stop Quill: what it changed so far is kept, and Write carries on from there`,children:[(0,Y.jsx)(qe,{fill:`currentColor`,"aria-hidden":`true`}),$t?`Stopping…`:`Stop writing`]}):(0,Y.jsxs)(D,{busy:l.test?.state===`checking`,variant:$.hasTest&&!$.writing?`outline`:`primary`,disabled:_||X||rr||or||$.writing,onClick:()=>$.hasTest?Yt(!0):ir(),"data-tip":$.writing?`A test is being written from this recording`:$.hasTest?`Update ${l.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)(Ue,{"aria-hidden":`true`}),l.test?.state===`checking`?`Checking…`:Wt||$.writing?$.hasTest?`Updating…`:`Writing…`:$.hasTest?`Update the test`:`Write the test`]})]})]})]}),a,m&&(0,Y.jsx)(`p`,{role:`alert`,className:f(w.fail,`m-0`),children:m}),Q&&!Q.ok&&(0,Y.jsxs)(`div`,{role:`alert`,className:f(w.fail,`flex flex-col gap-2`),children:[(0,Y.jsxs)(`p`,{className:`m-0 font-medium text-fail [overflow-wrap:anywhere]`,children:[Yn?`Step ${Yn.n} failed${Q.env?` on ${Q.env}`:``}`:`The run did not get through${Q.env?` on ${Q.env}`:``}`,Qn&&(0,Y.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),Zn&&(0,Y.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:Zn.line}),(0,Y.jsx)(`p`,{className:`m-0 line-clamp-3 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,"data-tip":(Yn?Yn.error:Q.error)||void 0,children:(Yn?Yn.error:Q.error)||(Yn?`It failed.`:`The last page was not the recorded one.`)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Zn&&(0,Y.jsxs)(D,{size:`sm`,onClick:()=>nr(Xn),"data-tip":`Show the failed step`,children:[(0,Y.jsx)(ze,{"aria-hidden":`true`}),`Show`]}),Zn&&n&&Xn>0&&(0,Y.jsxs)(D,{size:`sm`,onClick:()=>n(Xn,!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)(re,{"aria-hidden":`true`}),`Record`]}),Zn&&!Zn.fixed&&(0,Y.jsxs)(D,{size:`sm`,variant:`danger`,disabled:_,onClick:()=>void Z({remove:[Xn]}),"data-tip":`Drop the failed step`,children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(D,{size:`sm`,variant:`ghost`,disabled:or,onClick:()=>void Nn(!1),"data-tip":`Write the test anyway`,children:[(0,Y.jsx)(Ue,{"aria-hidden":`true`}),`Write`]})]})]}),l.test?.chat&&(0,Y.jsx)(Vt,{id:l.test.chat,onEnd:()=>void Cn(),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.`},l.test.chat),Kt&&l.test?.testFile&&(0,Y.jsx)(it,{open:!0,onClose:()=>Yt(!1),title:`Update the test?`,description:`A test was already written from this recording: ${l.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)(D,{variant:`outline`,onClick:()=>Yt(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(D,{variant:`primary`,onClick:()=>{Yt(!1),ir()},children:[(0,Y.jsx)(Ue,{"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:f(w.warn,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:ne,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.`]})]}))((l.secrets??[]).filter(e=>!e.set).map(e=>e.name)),l.blocksStale?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:f(w.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:B,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)(D,{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}`)),l.blocksFound?.map(e=>(0,Y.jsxs)(`div`,{role:`status`,className:f(w.info,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsx)(T,{icon:B,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)(D,{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:S,onPick:C,tabs:sr.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)(de,{size:12,role:`img`,"aria-label":`passed`,className:`text-pass`}):(0,Y.jsx)(Qe,{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-${S}`,"aria-labelledby":`rev-${S}`,className:`flex min-w-0 flex-col gap-4`,children:[S===`steps`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{id:`rev-step-search`,label:`Find a step`,value:Me,onChange:Ne}),(0,Y.jsx)(O,{items:[{id:`all`,label:`All`,n:l.steps.length},{id:`checks`,label:`Checks`,n:qn},...$n?[{id:`failed`,label:`Failed`,n:$n,alert:!0}]:[]],value:Pe,onChange:Fe}),(0,Y.jsx)(`span`,{className:`flex-1`}),(0,Y.jsxs)(D,{busy:He,size:`sm`,variant:`ghost`,disabled:He||_,onClick:()=>void Hn(),"data-tip":`Suggest checks: one model call reads the pages after each step and suggests checks and test data`,children:[(0,Y.jsx)(ue,{"aria-hidden":`true`}),He?`Asking…`:`Suggest`]})]}),(l.videos?.includes(`recording`)||l.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l.videos?.includes(`recording`)&&(0,Y.jsx)(un,{runDir:e,kind:`recording`}),l.log&&(0,Y.jsx)(dn,{runDir:e,which:`recording`,label:`Recording log`})]}),Ke&&(0,Y.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:Ke}),Le&&Le.length>0&&(0,Y.jsxs)(`div`,{className:f(w.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:je,size:14}),(0,Y.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,Y.jsxs)(D,{size:`sm`,disabled:_,onClick:()=>void Wn(Le),"data-tip":`Add all the suggestions`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add all`]}),(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,"data-tip":`Dismiss the suggestions`,onClick:()=>Ve(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:Le.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)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Add: ${e.label}`,"data-tip":`Add: ${e.label}`,onClick:()=>void Wn([e]),className:`size-8`,children:(0,Y.jsx)(Se,{"aria-hidden":`true`})})]},`${e.after}-${e.kind}-${e.text}`))})]}),tr.length===0?(0,Y.jsx)(`p`,{className:f(`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:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col overflow-hidden p-0`),children:tr.map((t,r)=>{let i=Jn.get(t.index),a=t.op===`expect`;return(0,Y.jsxs)(`li`,{id:`step-${t.index}`,className:f(`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)(_e,{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)(de,{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)(M,{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)(M,{tone:`neutral`,icon:!1,children:[(0,Y.jsx)(T,{icon:B,size:11}),$e.find(e=>e.id===t.block)?.name||t.block]})]}),t.value&&(0,Y.jsx)(On,{step:t,busy:_,open:oe===t.index,onOpen:e=>se(e?t.index:null),sources:on(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:ne,size:12,className:`mt-px flex-none`}),(0,Y.jsxs)(`span`,{children:[`This step is found by `,Qt[e.risk].found,`.`,n?` Pick another way to find it.`:``]})]});return n?(0,Y.jsx)(D,{variant:`link`,size:`inline`,"aria-expanded":ve.has(t.index),onClick:()=>be(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)(D,{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:je,size:12}),ke===t.index?`Hide the suggested checks`:`${d(t.suggest.length,`suggested check`)}`]})]}),(0,Y.jsxs)(`span`,{className:`relative flex flex-none items-center gap-1`,children:[t.start&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-expanded":ie,"aria-label":`Change the start page`,"data-tip":`Change the start page`,onClick:()=>ae(!ie),className:`size-8`,children:(0,Y.jsx)(z,{"aria-hidden":`true`})}),(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`menu`,"aria-expanded":te===t.index,"aria-label":`Add a check, step, note${$e.length?` or block`:``} after step ${t.index+1}`,"data-tip":`Add a check, step, note${$e.length?` or block`:``} after step ${t.index+1}`,onClick:()=>L(te===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(Se,{"aria-hidden":`true`})}),(0,Y.jsx)(g,{open:te===t.index,onClose:()=>L(null),label:`Add after step ${t.index+1}`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(En,{step:t,blocks:xt,secrets:G,recordings:xn,here:e,onCopy:(e,n)=>{L(null),Z({copyFrom:{run:e,index:n,after:t.index}})},onAddBlock:(e,n)=>{L(null),Z({insert:{after:t.index,block:e,use:n}})},...n?{onRecordMore:()=>{L(null),n(t.index)}}:{},onAdd:e=>{L(null),Z(e)}})}),t.check&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-haspopup":`dialog`,"aria-expanded":me===t.index,"aria-label":`Change how check ${t.index+1} compares`,"data-tip":`Change how check ${t.index+1} compares`,onClick:()=>ge(me===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(z,{"aria-hidden":`true`})}),(0,Y.jsx)(g,{open:me===t.index,onClose:()=>ge(null),label:`How check ${t.index+1} compares`,role:`dialog`,align:`end`,className:`w-[min(360px,calc(100vw-48px))]`,children:(0,Y.jsx)(wn,{check:t.check,onSave:e=>{ge(null),Z({matches:[{index:t.index,...e}]})}})})]}),t.detail&&t.detail.length>0&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`What was recorded for step ${t.index+1}`,"aria-expanded":ve.has(t.index),"data-tip":`What was recorded for step ${t.index+1}`,onClick:()=>be(t.index),className:`size-8`,children:(0,Y.jsx)(I,{"aria-hidden":`true`,className:f(`transition-transform`,ve.has(t.index)&&`rotate-180`)})}),t.shot&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.index+1}`,"aria-expanded":fe===t.index,"data-tip":`See the page after step ${t.index+1}`,onClick:()=>pe(fe===t.index?null:t.index),className:`size-8`,children:(0,Y.jsx)(ze,{"aria-hidden":`true`})}),!t.fixed&&!t.block&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_||!qt(l.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)(V,{"aria-hidden":`true`})}),(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_||!qt(l.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)(Ie,{"aria-hidden":`true`})}),Jt(t)&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Duplicate step ${t.index+1}`,"data-tip":`Duplicate step ${t.index+1}: a copy right after it`,onClick:()=>void Z({duplicate:t.index}),className:`size-8`,children:(0,Y.jsx)(Te,{"aria-hidden":`true`})})]}),!t.fixed&&(0,Y.jsx)(D,{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)(F,{"aria-hidden":`true`})})]})]}),ie&&t.start&&(0,Y.jsx)(An,{start:t.start,busy:_,onCancel:()=>ae(!1),onSave:(e,t)=>{ae(!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)(D,{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)(le,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),ve.has(t.index)&&t.detail&&(0,Y.jsx)(_n,{rows:t.detail,n:t.index+1,locators:t.locators,semantic:t.semantic,busy:_,onPick:e=>void Z({locator:[{index:t.index,pick:e}]}),onEdit:e=>Z({locator:[{index:t.index,...e}]})}),fe===t.index&&t.shot&&t.snap&&(0,Y.jsx)(vn,{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}`)})})]}),S===`data`&&Kn.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:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Kn.map((e,t)=>(0,Y.jsxs)(`li`,{className:f(`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))})]}),S===`data`&&(Gn.length===0?Kn.length>0?null:(0,Y.jsx)(mt,{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:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:Gn.map((e,t)=>{let n=e.value,i=on(e);return(0,Y.jsxs)(`li`,{className:f(`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:an(e,n.as)}),(0,Y.jsx)(On,{step:e,busy:_,onSave:e=>void Z(e)},Dn(e)),n.name&&tn.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)(D,{size:`icon`,variant:`icon`,"aria-label":`Rename ${n.name}`,"data-tip":`Rename ${n.name}`,disabled:_,onClick:()=>ee({index:e.index,name:n.name}),className:`size-8 flex-none`,children:(0,Y.jsx)(z,{"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();ee(null),r&&r!==n.name&&Z({data:[{index:e.index,as:n.as,name:r}]})},children:[(0,Y.jsx)(o,{"aria-label":`Name of the value of step ${e.index+1}`,value:P.name,maxLength:40,autoFocus:!0,placeholder:`lower_case_name`,onChange:e=>ee({...P,name:e.target.value}),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`primary`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{size:`sm`,variant:`outline`,onClick:()=>ee(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:rn(e,t.id)},t.id))})]},e.index)})})]})),S===`run`&&K&&(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:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-end gap-4`),onSubmit:e=>{e.preventDefault(),Pn()},children:[K.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:Et,onChange:e=>Dt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`Where it was recorded`}),K.environments.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[e,e===K.environment?` (active)`:``]},e))]})]}),K.data.length>0&&!!(K.sources?.files.length||K.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:Lt,onChange:e=>Rt(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The values typed here`}),!!K.sources?.files.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a data file`,children:K.sources.files.map(e=>(0,Y.jsx)(`option`,{value:`file:${e}`,children:e},e))}),!!K.sources?.requests.length&&(0,Y.jsx)(`optgroup`,{label:`Each row of a kept request`,children:K.sources.requests.map(e=>(0,Y.jsx)(`option`,{value:`request:${e}`,children:e},e))})]})]}),/\.xls[xm]$/i.test(Lt)&&(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)(o,{value:zt,maxLength:100,placeholder:`The first sheet`,onChange:e=>Bt(e.target.value)})]}),!Lt&&K.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)(o,{value:kt[e.name]??``,maxLength:300,onChange:t=>At({...kt,[e.name]:t.target.value})})]},e.name)),(0,Y.jsxs)(D,{type:`submit`,disabled:X||rr||or||_,"data-tip":rr?`Another run is going`:void 0,children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),X&&!nn?`Running…`:`Re-run`]}),(0,Y.jsxs)(D,{disabled:X||rr||or||_,onClick:()=>void Fn(),"data-tip":rr?`Another run is going`:`Play the steps and reach a control that moved through another of its recorded locators`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),X&&nn?`Re-recording…`:`Re-record`]})]}),Lt&&(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 (`,K.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)(M,{tone:`running`,children:ar?`Stopping: closing the browser…`:nn?`Playing the steps, healing a control that moved…`:`Playing the steps in a new browser…`}),(0,Y.jsxs)(D,{busy:ar,variant:`destructive`,disabled:ar,onClick:()=>void Ln(),"data-tip":`Stop the run and close its browser`,children:[(0,Y.jsx)(qe,{fill:`currentColor`,"aria-hidden":`true`}),ar?`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:f(`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 ${d(Q.rows.length,`row`)}${Q.env?` on ${Q.env}`:``}.`:`Stopped after ${d(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`:``}.`:Yn?`Step ${Yn.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=hn??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:f(w.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 `,d(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)(D,{busy:_,size:`sm`,disabled:_||X||or,onClick:()=>void In(t.map(e=>e.index)),"data-tip":`Make each healed locator the one its step uses`,children:[(0,Y.jsx)(Ce,{"aria-hidden":`true`}),_?`Accepting…`:`Accept`]})]}),(0,Y.jsx)(`ol`,{"aria-label":`Controls that moved`,className:f(`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:f(`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)(de,{size:14,"aria-hidden":`true`}),`In the recording`]})]})]},e.index))})]}):null})(),yn&&(0,Y.jsx)(`p`,{role:`status`,className:f(w.pass,`m-0`),children:yn}),Q.rows&&(0,Y.jsx)(`ol`,{"aria-label":`Rows of ${Q.from||`the test data`}`,className:f(`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:f(`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:f(`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:f(`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)(_e,{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}),t.ok&&t.healed&&(0,Y.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:t.healed})]}),(0,Y.jsx)(`span`,{className:`flex-1`}),t.shot&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`See the page after step ${t.n} of the run`,"aria-expanded":De(t),"data-tip":`See the page after step ${t.n} of the run`,onClick:()=>Ee({...xe,[t.n]:!De(t)}),className:`size-8 flex-none`,children:(0,Y.jsx)(ze,{"aria-hidden":`true`})})]}),t.shot&&De(t)&&(0,Y.jsx)(mn,{runDir:e,n:t.n,failed:!t.ok},`${Q.ms??0}-${t.n}`)]},t.n))})]}),Q&&(Q.video||Q.trace||Q.network||K.runs?.[0]?.log)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Q.video&&(0,Y.jsx)(un,{runDir:e,kind:`try`}),K.runs?.[0]?.log&&(0,Y.jsx)(dn,{runDir:e,which:K.runs[0].log,label:`Re-run log`}),Q.trace&&(0,Y.jsx)(pn,{runDir:e}),Q.network&&(0,Y.jsx)(fn,{runDir:e})]}),(K.runs?.length??0)>1&&(0,Y.jsx)(ln,{runDir:e,runs:K.runs.slice(1)})]}),S===`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:Ye,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>Ze(e.target.value),onBlur:()=>Ye.trim()!==l.instructions&&void Z({instructions:Ye.trim()}),className:`font-normal`})]}),S===`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.`}),nt===!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.`}),nt===!1&&(0,Y.jsxs)(`p`,{className:f(w.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:f(`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(),U.name.trim()&&zn()},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:U.from,onChange:e=>ot({...U,from:Number(e.target.value),to:Math.max(U.to,Number(e.target.value))}),className:`w-[84px]`,children:l.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:U.to,onChange:e=>ot({...U,to:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.filter(e=>e.index>=U.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)(o,{value:U.name,maxLength:80,placeholder:`Sign in`,onChange:e=>ot({...U,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)(o,{value:U.section,maxLength:40,placeholder:`Account`,list:`rev-block-sections`,onChange:e=>ot({...U,section:e.target.value})}),(0,Y.jsx)(`datalist`,{id:`rev-block-sections`,children:[...new Set($e.flatMap(e=>e.section?[e.section]:[]))].map(e=>(0,Y.jsx)(`option`,{value:e},e))})]}),(0,Y.jsxs)(D,{type:`submit`,disabled:_||!U.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}),xt.length>0&&(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 pt-4`,onSubmit:e=>{e.preventDefault();let t=W.block||xt[0].id,n=xt.find(e=>e.id===t);n&&Mt(n,lt)&&Z({insert:{after:W.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:W.block||xt[0].id,onChange:e=>{st({...W,block:e.target.value}),ut(Nt(xt.find(t=>t.id===e.target.value),G))},children:xt.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:W.after,onChange:e=>st({...W,after:Number(e.target.value)}),className:`w-[84px]`,children:l.steps.map(e=>(0,Y.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,Y.jsxs)(D,{type:`submit`,disabled:_||!Mt(xt.find(e=>e.id===(W.block||xt[0].id)),lt),"data-tip":`Put the block in after the step`,children:[(0,Y.jsx)(Se,{"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)(It,{block:e}),(0,Y.jsx)(Pt,{block:e,secrets:G,use:lt,onChange:ut,disabled:_})]}):null)(xt.find(e=>e.id===(W.block||xt[0].id)))]})]}),$e.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)(E,{id:`rev-block-search`,label:`Find a block`,value:yt,onChange:e=>{bt(e),vt(null)}})}),St.length===0&&(0,Y.jsx)(`p`,{className:f(`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:f(`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:f(`flex flex-col gap-2 px-4 py-2`,t>0&&`border-t border-line-soft`),children:[ft?.id===e.id?(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),Bn(e.id,{name:ft.name,section:ft.section,description:ft.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)(o,{value:ft.name,maxLength:80,onChange:e=>ht({...ft,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)(o,{value:ft.section,maxLength:40,list:`rev-block-sections`,onChange:e=>ht({...ft,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)(o,{value:ft.description,maxLength:300,onChange:e=>ht({...ft,description:e.target.value})})]}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:_||!ft.name.trim(),"data-tip":`Save the block as a new version`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>ht(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,` · `,d(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)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-label":`Change the block ${e.name}`,"data-tip":`Change the block ${e.name}`,onClick:()=>ht({id:e.id,name:e.name,section:e.section??``,description:e.description??``}),className:`size-8`,children:(0,Y.jsx)(z,{"aria-hidden":`true`})}),(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:_,"aria-label":_t?.id===e.id?`Delete the block ${e.name} anyway`:`Delete the block ${e.name}`,"data-tip":_t?.id===e.id?`Delete it anyway`:`Delete the block ${e.name}`,onClick:()=>void Vn(e.id),className:`size-8`,children:(0,Y.jsx)(F,{"aria-hidden":`true`})})]})]}),_t?.id===e.id&&(0,Y.jsxs)(`p`,{className:f(w.warn,`m-0`),children:[_t.why,` Click delete again to delete it anyway.`]})]},e.id))})]},e||`-`))]})]}),S===`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:we,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:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col p-0`),children:[...l.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,Y.jsxs)(`li`,{className:f(`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:[at(e.at),` · `,d(e.steps,`step`)]})]}),t===0?(0,Y.jsx)(M,{tone:`neutral`,icon:!1,children:`Now`}):(0,Y.jsx)(D,{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)(ce,{"aria-hidden":`true`})})]},e.n))})]})]})]})}function ln({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:we,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:f(c,`m-0 flex list-none flex-col p-0`),children:t.map((t,i)=>(0,Y.jsxs)(`li`,{className:f(`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)(_e,{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:f(`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:[at(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)(D,{size:`icon`,variant:`icon`,"aria-label":`Open the log of the run ${at(t.at)} in a new tab`,"data-tip":`Open the log of the run ${at(t.at)} in a new tab`,onClick:async()=>a(await C(t.log,()=>b.openLog(e,t.log))),className:`size-8 flex-none`,children:(0,Y.jsx)(Ee,{"aria-hidden":`true`})}),t.steps.length>0&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,"aria-label":`See the steps of the run ${at(t.at)}`,"aria-expanded":n===t.at,"data-tip":`See the steps of the run ${at(t.at)}`,onClick:()=>r(n===t.at?null:t.at),className:`size-8 flex-none`,children:(0,Y.jsx)(ze,{"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:f(`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)(_e,{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.ok&&e.healed&&(0,Y.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:e.healed})]})]},e.n))})]},t.at))})]})}function un({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)(D,{"data-tip":`Open the video of ${t===`try`?`the re-run`:`the recording`} in a new tab`,onClick:async()=>r(await C(t,()=>b.openVideo(e,t))),children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),t===`try`?`Re-run video`:`Recording video`]}),n&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:n})]})}function dn({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)(D,{"data-tip":`Open the ${n.toLowerCase()} in a new tab`,onClick:async()=>i(await C(t,()=>b.openLog(e,t))),children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`}),n]}),r&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:r})]})}function fn({runDir:e}){let t=e.split(/[\\/]/).filter(Boolean).pop()||``;return t?(0,Y.jsxs)(D,{"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)($e,{"aria-hidden":`true`}),`API tests from its calls`]}):null}function pn({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)(D,{"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 C(`trace.zip`,()=>b.openTrace(e))),children:[(0,Y.jsx)(Ze,{"aria-hidden":`true`}),`Trace`]}),t&&(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:t})]})}function mn({runDir:e,n:t,failed:n}){let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let n=!1;return b.tryShot(e,t).then(e=>!n&&i(e),()=>!n&&o(!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:f(s,`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:f(s,`max-h-[420px] w-full max-w-[720px] object-contain object-top`)}):(0,Y.jsx)(`div`,{className:f(s,`min-h-24 max-w-[720px]`)})})}var hn=new Set([`test_id`,`id`,`role`,`label`,`placeholder`,`alt`,`title`,`text`,`css`,`xpath`,`xpath_relative`,`name`,`href`,`role_pattern`,`text_pattern`]),gn={role:`What it is and its name, as role|name, for example button|Save.`,role_pattern:`What it is and a pattern of its name, as role|pattern.`,text_pattern:`A pattern of its text.`,xpath:`An XPath starting with / or //.`,xpath_relative:`An XPath starting with //.`,css:`A CSS selector.`};function _n({rows:e,n:t,locators:n,semantic:i,busy:a,onPick:s,onEdit:c}){let u=n?.find(e=>e.chosen),[d,p]=(0,J.useState)(null),m=n?.find(e=>e.type===`role`),h=async()=>{if(!d||!c)return;let e=d.value.trim();await c(d.semantic?m?{pick:m.pick,value:e}:{type:`role`,value:e}:d.pick===void 0?{type:Xt(e),value:e}:{pick:d.pick,value:e})&&p(null)},g=(e,t)=>(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,Y.jsx)(o,{"aria-label":e,value:d?.value??``,maxLength:300,placeholder:t,className:`min-w-[200px] flex-[1_1_260px] font-mono`,autoFocus:!0,onChange:e=>d&&p({...d,value:e.target.value}),onKeyDown:e=>e.key===`Escape`&&p(null)}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:a||!d?.value.trim(),"data-tip":`The step uses it from now on; the next re-run checks that it finds the element`,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>p(null),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]})]}),_=n&&n.length>0,v=_?e.filter(e=>!e.label.startsWith(`Locator:`)):e,y=e=>[e.chosen?`in use`:``,e.edited?`written by you, not run yet`: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.edited?`${e.confidence}%`:``].filter(Boolean).join(`, `);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pr-4 pb-4 pl-4 sm:pl-20`,children:[_&&s&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-1 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(u?.pick??n[0].pick),disabled:a||n.length<2,onChange:e=>s(Number(e.target.value)),"aria-describedby":u?.risk?`step-${t}-locator-risk`:void 0,className:`max-w-[560px]`,children:n.map(e=>(0,Y.jsxs)(`option`,{value:e.pick,children:[$t(e),e.edited?` — written by you, not run yet`: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.edited?` (${e.confidence}%)`:``]},e.pick))})]}),c&&d===null&&(0,Y.jsxs)(D,{type:`button`,size:`sm`,variant:`outline`,disabled:a,"data-tip":`Write a locator of your own for this step`,onClick:()=>p({value:``}),children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add a locator`]})]}),u?.risk&&!u.edited&&(0,Y.jsx)(`span`,{id:`step-${t}-locator-risk`,className:`text-body-sm text-warn`,children:Qt[u.risk].alone}),d&&d.pick===void 0&&c&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g(`A locator of your own for step ${t}`,`button|Save, a CSS selector, an XPath, or its text`),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Write role|name, a CSS selector, an XPath starting with /, or the element's text. It is not checked until you re-run the recording.`})]})]}),(0,Y.jsxs)(`dl`,{"aria-label":`What was recorded for step ${t}`,className:f(l,`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:[v.map((e,n)=>{let r=e.label===`Element`&&!!i&&!!c;return(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:e.label}),(0,Y.jsx)(`dd`,{className:f(`m-0 text-ink [overflow-wrap:anywhere]`,e.code&&`font-mono text-body-sm`),children:r&&d?.semantic?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g(`Change the role and name of step ${t}`),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[gn.role,` The step finds its element by them once saved; it is not checked until you re-run the recording.`]})]}):r?(0,Y.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.value}),(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:a||d!==null,"aria-label":`Edit the role and name of step ${t}`,"data-tip":`Find the element by its role and a name you write`,onClick:()=>p({semantic:!0,value:m?.value??`${i.role}|${i.name}`}),className:`size-7`,children:(0,Y.jsx)(z,{"aria-hidden":`true`})})]}):e.value})]},`${n}-${e.label}`)}),_&&n.map(e=>{let n=d?.pick===e.pick,r=!!c&&hn.has(e.type);return(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsxs)(`dt`,{className:`text-muted`,children:[`Locator: `,e.type,y(e)?` (${y(e)})`:``]}),(0,Y.jsx)(`dd`,{className:`m-0 text-ink [overflow-wrap:anywhere]`,children:n?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[g(`Change the ${e.type} locator of step ${t}`),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[gn[e.type]?`${gn[e.type]} `:``,`The step uses it once saved; it is not checked until you re-run the recording.`]})]}):(0,Y.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-body-sm`,children:e.value}),r&&(0,Y.jsx)(D,{size:`icon`,variant:`icon`,disabled:a||d!==null,"aria-label":`Edit the ${e.type} locator of step ${t}`,"data-tip":`Edit this locator`,onClick:()=>p({pick:e.pick,value:e.value}),className:`size-7`,children:(0,Y.jsx)(z,{"aria-hidden":`true`})})]})})]},`loc-${e.pick}`)})]})]})}function vn({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 b.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:f(`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 yn=[[`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`]],bn=[[`eq`,`=`],[`gt`,`>`],[`gte`,`≥`],[`lt`,`<`],[`lte`,`≤`],[`between`,`between`]],xn=[[`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 wn({check:e,onSave:t}){let n=e.match,i=e.was??e.kind,[a,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,x]=(0,J.useState)(n?.max===void 0?``:String(n.max)),S=e=>e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,C=(()=>{try{return new RegExp(f),!0}catch{return!1}})(),w=a===`count`?`number`:[`text`,`value`,`attribute`,`url`,`title`].includes(a)?`text`:`none`,T=w===`number`?`number`:u,E=a!==`attribute`||Sn.test(c),O=T===`number`?S(v)===void 0||g===`between`&&(S(b)===void 0||S(b)<S(v))?void 0:{how:T,op:g,min:S(v),...g===`between`?{max:S(b)}:{}}:!f.trim()||T===`regex`&&(!C||f.length>200)?void 0:{how:T,text:f.trim(),...m?{ci:!0}:{}},k=E&&(w===`none`||O!==void 0&&(a!==`attribute`||O.how!==`number`)),A=e.element&&a!==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=w===`none`?null:O;if(!A&&a===i&&(a===`text`||a===`value`)&&r&&r.how===`contains`&&!r.ci&&r.text===e.text)return t({match:null});t(e.element?{match:r,kind:a,...a===`attribute`?{attr:c}:{}}:{match:r})},children:[e.element&&(0,Y.jsx)(r,{value:a,"aria-label":`What to check`,onChange:t=>{let r=t.target.value;if(s(r),r===`count`?(d(`number`),a!==`count`&&(_(`gte`),y(`1`))):u===`number`&&r===`attribute`&&d(`equals`),r===`attribute`&&a!==`attribute`&&p(e.kind===`attribute`?n?.text??``:``),(r===`text`||r===`value`)&&a!==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)),x(t?.max===void 0?``:String(t.max))}},children:xn.filter(([e])=>e===`text`||e===`value`?e===i:!0).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),a===`attribute`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(o,{value:c,maxLength:61,"aria-label":`The attribute`,placeholder:`e.g. aria-expanded or data-state`,onChange:e=>l(e.target.value)}),c!==``&&!E&&(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:a===`attribute`?`The attribute's value, compared as text.`:w===`number`?`How many elements this check's locator finds on the page.`:w===`none`?a===`visible`?`The replay checks it shows.`:a===`hidden`?`The replay checks it is gone.`:`The replay checks it is ${a}.`:`${j} was “${e.text}” when you recorded.`}),w===`text`&&(0,Y.jsx)(r,{value:u,"aria-label":`How to compare`,onChange:e=>d(e.target.value),children:yn.filter(([e])=>a!==`attribute`||e!==`number`).map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),w===`none`?null:T===`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:bn.map(([e,t])=>(0,Y.jsx)(`option`,{value:e,children:t},e))}),(0,Y.jsx)(o,{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)(o,{value:b,inputMode:`decimal`,maxLength:20,"aria-label":`Highest value`,onChange:e=>x(e.target.value),className:`min-w-0 flex-1`})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(o,{value:f,maxLength:u===`regex`?200:300,"aria-label":u===`regex`?`The pattern`:`The text`,placeholder:u===`regex`?`e.g. ^Order \\d+ placed$`:void 0,onChange:e=>p(e.target.value)}),u===`regex`&&!C&&(0,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)(W,{checked:m,onCheckedChange:h}),`Any case (capital or small letters)`]})]}),w===`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)(D,{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)(D,{size:`sm`,className:`justify-start`,onClick:()=>t({match:null}),"data-tip":`Compare by contains, as recorded`,children:[(0,Y.jsx)(ce,{"aria-hidden":`true`}),`Back to contains “`,e.text,`”`]})]})}function Tn({recordings:e,here:t,onCopy:n}){let[i,a]=(0,J.useState)(()=>e.some(e=>e.runDir===t)?t:e[0]?.runDir??``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(``);return(0,J.useEffect)(()=>{if(!i)return;let e=!1;return s(null),l(null),d(``),b.peekSteps(i).then(t=>{if(e)return;let n=t.steps.filter(e=>!e.block);s(n),l(n[0]?.index??null)},t=>!e&&d(t.message)),()=>{e=!0}},[i]),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),i&&c!==null&&n(i,c)},children:[(0,Y.jsx)(r,{"aria-label":`The recording to copy a step from`,value:i,onChange:e=>a(e.target.value),children:e.map(e=>(0,Y.jsx)(`option`,{value:e.runDir,children:e.runDir===t?`${e.name} (this one)`:e.name},e.runDir))}),u?(0,Y.jsx)(`span`,{className:`text-body-sm text-fail`,children:u}):o===null?(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Reading its steps…`}):o.length?(0,Y.jsx)(r,{"aria-label":`The step to copy`,value:c??``,onChange:e=>l(Number(e.target.value)),children:o.map(e=>(0,Y.jsxs)(`option`,{value:e.index,children:[e.index+1,`. `,e.line]},e.index))}):(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`It has no step to copy outside its blocks.`}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The copy keeps its locators, checks and value; a secret only by its variable, its pages on this recording's site.`}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`accent`,disabled:!i||c===null,"data-tip":`Put a copy of that step in after this step`,children:[(0,Y.jsx)(Te,{"aria-hidden":`true`}),`Copy here`]})]})}function En({step:e,onAdd:t,onRecordMore:n,blocks:i=[],secrets:a=[],onAddBlock:s,recordings:c=[],here:l,onCopy:u}){let[d,f]=(0,J.useState)(`check`),[p,m]=(0,J.useState)(i[0]?.id??``),h=i.find(e=>e.id===p)??i[0],[g,_]=(0,J.useState)(()=>Nt(h,a)),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(`2`),[E,O]=(0,J.useState)(``),[k,A]=(0,J.useState)(e.note||``),j=e.index,M=[[`check`,`Check`,Ae],[`step`,`Step`,Re],[`wait`,`Wait`,ve],[`note`,`Note`,Pe],...i.length&&s?[[`block`,`Block`,B]]:[],...c.length&&u?[[`copy`,`Copy`,Te]]:[]],N=Number(w),P=Number.isInteger(N)&&N>=1&&N<=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:d,onPick:f,tabs:M.map(([e,t])=>({id:e,label:t}))}),d===`copy`&&u&&(0,Y.jsx)(Tn,{recordings:c,here:l,onCopy:u}),d===`block`&&h&&s&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),Mt(h,g)&&s(h.id,g)},children:[(0,Y.jsx)(r,{"aria-label":`The block to put in after this step`,value:h.id,onChange:e=>{m(e.target.value),_(Nt(i.find(t=>t.id===e.target.value),a))},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)(It,{block:h}),(0,Y.jsx)(Pt,{block:h,secrets:a,use:g,onChange:_}),(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)(D,{type:`submit`,size:`sm`,variant:`accent`,disabled:!Mt(h,g),"data-tip":`Put the block in after this step`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add`]})]}),d===`check`&&(0,Y.jsxs)(Y.Fragment,{children:[e.page&&(0,Y.jsxs)(D,{size:`sm`,className:`justify-start`,onClick:()=>t({checks:[{after:j,kind:`url`}]}),children:[`The page is `,e.page]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),v.trim()&&t({checks:[{after:j,kind:`intent`,text:v.trim()}]})},children:[(0,Y.jsx)(o,{"aria-label":`A check in your words`,value:v,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>y(e.target.value)}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`accent`,disabled:!v.trim(),"data-tip":`Add the check`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add`]})]})]}),d===`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)(D,{size:`sm`,onClick:n,"data-tip":`Record more from here`,children:[(0,Y.jsx)(re,{"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(),v.trim()&&t({steps:[{after:j,kind:`do`,text:v.trim()}]})},children:[(0,Y.jsx)(o,{"aria-label":`A step in your words`,value:v,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>y(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)(D,{type:`submit`,size:`sm`,variant:`accent`,disabled:!v.trim(),"data-tip":`Add the step`,children:[(0,Y.jsx)(Se,{"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(E.trim())&&t({steps:[{after:j,kind:`open`,url:E.trim()}]})},children:[(0,Y.jsx)(o,{"aria-label":`A page to open`,value:E,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>O(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(E.trim()),"data-tip":`Add a step that opens this page`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add`]})]}),(0,Y.jsxs)(D,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:j,kind:`back`}]}),"data-tip":`Add a step that goes back a page`,children:[(0,Y.jsx)(Oe,{"aria-hidden":`true`}),`Go back`]})]}),d===`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)(D,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:j,kind:`wait_load`}]}),"data-tip":`Wait until the page has loaded, its calls have finished and its spinners have gone`,children:[(0,Y.jsx)(ae,{"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(),b.trim()&&t({steps:[{after:j,kind:`wait_text`,text:b.trim(),...S?{gone:!0}:{}}]})},children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(r,{value:S?`gone`:`shows`,"aria-label":`Wait until the text`,onChange:e=>C(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)(o,{value:b,maxLength:120,placeholder:S?`e.g. Loading`:`e.g. Order placed`,"aria-label":`The text to wait for`,onChange:e=>x(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`accent`,disabled:!b.trim(),"data-tip":`Add the wait`,children:[(0,Y.jsx)(Se,{"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(),P&&t({steps:[{after:j,kind:`wait_seconds`,seconds:N}]})},children:[(0,Y.jsx)(o,{value:w,type:`number`,min:1,max:60,step:1,maxLength:2,"aria-label":`Seconds to wait`,onChange:e=>T(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)(D,{type:`submit`,size:`sm`,disabled:!P,"data-tip":`Add a pause of this many seconds`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Add`]})]})]}),d===`note`&&(0,Y.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),t({notes:[{index:j,text:k.trim()}]})},children:[(0,Y.jsx)(o,{"aria-label":`Note`,value:k,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>A(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)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:k.trim()===(e.note||``),"data-tip":k.trim()||!e.note?`Save the note`:`Remove the note`,children:[k.trim()||!e.note?(0,Y.jsx)(H,{"aria-hidden":`true`}):(0,Y.jsx)(F,{"aria-hidden":`true`}),k.trim()||!e.note?`Save`:`Remove`]})]})]})}var Dn=e=>`${e.index}-${e.value?.as}-${e.value?.text}-${e.value?.days??``}`,X=e=>e===0?`today`:`${d(Math.abs(e),`day`)} ${e>0?`from`:`before`} today`;function On({step:e,busy:t,onSave:n,open:i,onOpen:a,sources:s}){let c=e.value,[l,u]=(0,J.useState)(!1),d=a?!!i:l,f=a??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:X(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:rn(e,t.id)},t.id))}),c.edit===`days`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(o,{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)(o,{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)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!b,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{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)(D,{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)(z,{"aria-hidden":`true`})})]})}var kn=e=>{try{let t=new URL(e.trim());return/^https?:$/.test(t.protocol)?t.origin:``}catch{return``}};function An({start:e,busy:t,onSave:n,onCancel:r}){let[i,a]=(0,J.useState)(e),[s,c]=(0,J.useState)(!0),l=kn(e),u=kn(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)(o,{value:i,type:`url`,maxLength:2e3,"aria-label":`The page the test starts on`,autoFocus:!0,onChange:e=>a(e.target.value),className:`min-w-0 flex-1 font-mono`}),(0,Y.jsxs)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:t||!u||i.trim()===e,children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Save`]}),(0,Y.jsxs)(D,{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)(W,{checked:s,onCheckedChange:c}),`Move the other pages of `,l,` to `,u,` too`]})]})}var jn={navigate:ge,back:Oe,click:L,dblclick:L,input:N,press:N,select:Ae,upload:Le,expect:de,wait_for:ae,capture:me,note:Pe,launch:he,double_click:L,type:N,keys:N,tap:L,double_tap:L,long_press:L,swipe:Ve,scroll:Ie,hide_keyboard:N,wait:ve,dismiss:Qe},Mn=e=>jn[e]||(e.startsWith(`expect`)?de:We),Nn=`:new`,Pn=new Set([`starting`,`recording`,`paused`,`stopping`]);function Fn(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 In(e){await b.write(e,{check:!0})}async function Ln(e,t=`desktop`){let r=t===`mobile`?`mobile_replay`:`desktop_replay`,{id:i}=await x.start(`Replay the ${t} workflow ${e}: call ${r} with workflow ${e}, and tell me how each step went.`,{});location.hash=n(`chats`,i)}function Rn({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 zn({s:e,live:t,onDelete:n}){let r=Mn(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:f(`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)(Rn,{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)(D,{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)(F,{"aria-hidden":`true`})})]})}var Bn=[[`tap`,`Tap`],[`check`,`Check`],[`long_press`,`Hold`],[`wait_for`,`Wait for`],[`point`,`Point`]],Vn={tap:`Tap`,check:`Check`,long_press:`Long-press`,wait_for:`Wait for`,point:`Tap a point in`},Z={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.`},Hn=3e4;function Un({s:e,send:t,busy:n,secrets:i,links:a=[],className:s,fit:l}){let u=e.screen,[d,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(`tap`),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(a[0]??``),x=a.includes(v)?v:a[0]??``,[S,C]=(0,J.useState)(null),[T,E]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,j]=(0,J.useState)(null),M=u?.seq??0,P=u?.frame??M;(0,J.useEffect)(()=>{if(!P||!u?.image)return;let e=!1;return b.screen().then(t=>!e&&p(t),()=>{}),()=>{e=!0}},[P,u?.image]),(0,J.useEffect)(()=>{S&&S.seq!==M&&C(null)},[M,S]),(0,J.useEffect)(()=>{A&&(P!==A.frame||e.notice?.at!==A.notice||e.state!==`recording`)&&j(null)},[P,e.notice?.at,e.state,A]),(0,J.useEffect)(()=>{if(!A)return;let e=setTimeout(()=>j(null),Hn);return()=>clearTimeout(e)},[A]);let ee=n||!!A,F=!ee&&e.state===`recording`&&!!u,I=n=>{j({frame:P,notice:e.notice?.at}),t(n)},L=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`,ne=Wt(u),re=e=>e.label?`“${e.label}”`:`the ${e.kind||`control`}`,ie=(e,t)=>{m!==`point`&&(m===`tap`&&t.field?(C({el:e,seq:M,c:t}),E(``),k(t.secure&&i.length?i[0]:``)):(I({cmd:m,seq:M,el:e}),m!==`tap`&&h(`tap`)))},ae=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:f(f(c,`flex min-w-0 flex-col gap-4`),s),style:l?{width:`max(min(400px, var(--phone-max, 100%)), ${ae===`100%`?`0px`:ae})`}:void 0,children:[(0,Y.jsx)(pt,{id:`rec-screen`,icon:He,title:`Screen`,actions:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ht,{checked:g,onChange:_,label:`Outline controls`}),(0,Y.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Outline controls`})]})}),(0,Y.jsx)(_t,{label:`What a click on the screen does`,value:m,onChange:h,options:Bn.map(([e,t])=>({id:e,label:t})),className:`self-center`}),m!==`tap`&&(0,Y.jsxs)(`p`,{role:`status`,className:f(w.info,`m-0 flex flex-wrap items-center gap-x-2`),children:[(0,Y.jsx)(`span`,{className:`flex-1`,children:Z[m]}),(0,Y.jsx)(D,{variant:`link`,size:`inline`,onClick:()=>h(`tap`),children:`Back to Tap`})]}),e.notice&&(0,Y.jsx)(`p`,{role:`status`,className:f(w.warn,`m-0`),children:e.notice.text}),u?(0,Y.jsxs)(kt,{src:d,alt:`The screen of ${e.app} now`,width:u.width,height:u.height,size:ae,busy:ee,children:[ne.map(({c:e,i:t})=>{let n=m===`tap`&&e.field?`${e.picker?`Choose in`:`Type into`} ${re(e)}`:`${Vn[m]} ${re(e)}${e.prompt?` (a system prompt: kept to answer whenever a replay is asked)`:``}`;return(0,Y.jsx)(`button`,{type:`button`,disabled:!F||!!S,"aria-label":n,"data-tip":n,onClick:()=>ie(t,e),className:f(`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:L(e.box[0],u.width),top:L(e.box[1],u.height),width:L(e.box[2],u.width),height:L(e.box[3],u.height)}},`${M}-${t}`)}),m===`point`&&(0,Y.jsx)(`button`,{type:`button`,disabled:!F,"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)));I({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`}),ee&&!S&&(0,Y.jsx)(`span`,{role:`status`,className:`absolute inset-0 flex items-center justify-center bg-bg/60`,children:(0,Y.jsxs)(`span`,{className:f(`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)(Me,{size:16,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),`Doing it on the device…`]})}),S&&(0,Y.jsxs)(`form`,{className:f(`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`&&C(null)},onSubmit:e=>{if(e.preventDefault(),O)I({cmd:`type`,seq:S.seq,el:S.el,secret:O});else if(T)I({cmd:`type`,seq:S.seq,el:S.el,text:T});else return;C(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:[S.c.picker?`Choose in`:`Type into`,` `,re(S.c)]}),(0,Y.jsx)(D,{type:`button`,variant:`icon`,size:`icon`,"aria-label":`Cancel`,"data-tip":`Cancel (Esc)`,onClick:()=>C(null),children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),!S.c.picker&&(i.length>0||S.c.secure)&&(0,Y.jsxs)(r,{"aria-label":`What to type`,autoFocus:!!S.c.secure,value:O,onChange:e=>k(e.target.value),className:`min-w-0`,children:[!S.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)(o,{"aria-label":S.c.picker?`Value to choose`:`Text to type`,autoFocus:!0,value:T,maxLength:S.c.picker?200:2e3,spellCheck:!1,onChange:e=>E(e.target.value),className:`min-w-0 flex-1`}),(0,Y.jsxs)(D,{type:`submit`,variant:`primary`,disabled:!F||!O&&!T,className:f(!!O&&`flex-1`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),S.c.picker?`Choose`:`Type`]})]}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:S.c.picker?`A picker wheel: write the value as the wheel shows it; the step chooses it.`:S.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)(D,{variant:`link`,size:`inline`,onClick:()=>(I({cmd:`tap`,seq:S.seq,el:S.el}),C(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)(Me,{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`,V,{cmd:`scroll`,direction:`up`}],[`Scroll down`,Ie,{cmd:`scroll`,direction:`down`}]]],[`Swipe`,[[`Swipe left`,te,{cmd:`swipe`,direction:`left`}],[`Swipe right`,fe,{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)(D,{variant:`icon`,size:`icon`,"aria-label":e,"data-tip":e,disabled:!F,onClick:()=>I(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)(D,{size:`sm`,disabled:!F,onClick:()=>I({cmd:`back`}),"data-tip":`The device's Back`,children:[(0,Y.jsx)(Oe,{"aria-hidden":`true`}),`Back`]}),(0,Y.jsxs)(D,{size:`sm`,disabled:!F,onClick:()=>I({cmd:`keys`,key:`enter`}),"data-tip":`Press Enter on the keyboard`,children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Enter`]}),(0,Y.jsx)(D,{size:`sm`,disabled:!F,onClick:()=>I({cmd:`hide_keyboard`}),"data-tip":`Hide the keyboard`,children:`Hide keyboard`}),(0,Y.jsxs)(D,{size:`sm`,disabled:!F,onClick:()=>I({cmd:`wait`,seconds:2}),"data-tip":`Record a wait of 2 seconds`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`}),`Wait 2 s`]}),(0,Y.jsxs)(D,{size:`sm`,disabled:!F,onClick:()=>I({cmd:`refresh`}),"data-tip":`Read the screen again, when the app changed by itself`,children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),`Read again`]})]}),a.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[a.length>1&&(0,Y.jsx)(r,{size:`sm`,"aria-label":`Whose mailbox`,value:x,onChange:e=>y(e.target.value),className:`w-auto min-w-0 max-w-[160px]`,children:a.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsxs)(D,{size:`sm`,disabled:!F||!a.includes(x),onClick:()=>I({cmd:`magic_link`,login:x}),"data-tip":`Open the newest link ${x}'s site sent to its mailbox, on the device`,children:[(0,Y.jsx)(Fe,{"aria-hidden":`true`}),`Open magic link`]})]})]})]})}function Wn({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:f(c,`flex flex-col gap-2`),children:[(0,Y.jsx)(pt,{id:`rec-device`,icon:De,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 Gn({s:e,send:t,busy:n,secrets:i=[],devices:a=[],links:o=[],blocks:s=[],blockSecrets:l=[],unsetSecrets:u=[],onPlayBlock:d}){let[,p]=(0,J.useState)(0),[m,h]=(0,J.useState)(!1),[_,v]=(0,J.useState)(``),y=s.find(e=>e.id===_)??s[0],[b,x]=(0,J.useState)(()=>Nt(s[0],l));(0,J.useEffect)(()=>{let e=gt(()=>p(e=>e+1),1e3);return()=>ct(e)},[]);let S=(0,J.useRef)(null),C=(0,J.useRef)(null);(0,J.useEffect)(()=>{S.current&&(S.current.scrollTop=S.current.scrollHeight)},[e.log.length]),(0,J.useEffect)(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[e.steps.length]);let T=e.kind===`desktop`,E=e.kind===`mobile`,O=e.kind===`web`,k=e.state===`paused`,A=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=Ut(e.screen),ee=(a.find(t=>t.name===e.device&&t.platform===e.platform)??a.find(t=>t.name===e.device))?.where,F=(0,Y.jsx)(Wn,{s:e,where:e.device?ee:void 0}),te=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:f(f(c,`flex min-w-0 flex-col gap-2`),!E&&`flex-[999_1_420px]`),children:[(0,Y.jsx)(pt,{id:`rec-steps`,icon:Re,title:`Steps`,n:e.summary}),e.steps.length?(0,Y.jsx)(`div`,{ref:C,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)(zn,{s:e,live:!T,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`?T||E?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step ${E?`on the screen`:`in ${T?e.app:`the browser`}`}.`})]}),I=e.case&&(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,Y.jsx)(pt,{id:`rec-case`,icon:P,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:f(`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)(de,{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)(D,{disabled:n,onClick:()=>t({cmd:`case_next`}),className:`self-start`,"data-tip":`Next case step`,children:[(0,Y.jsx)(Ve,{"aria-hidden":`true`}),`Next`]})]}),L=(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:f(c,`flex flex-col gap-2`),children:[(0,Y.jsx)(pt,{id:`rec-log`,icon:Ee,title:`What the recorder says`}),(0,Y.jsx)(`div`,{ref:S,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:f(`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 `,E?`the device`:T?`the app`:`the browser`,`…`]})})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:f(c,`flex flex-wrap items-center gap-x-4 gap-y-4`),children:[k?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,Y.jsx)(j,{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`?E?`Starting ${e.app} on ${e.device||`the device`}…`:T?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:k?`Paused: what you do now is not recorded`:`Recording`,` · `,Fn(e.startedAt),` ·`,` `,E?`${e.app} on ${e.device||`the device`}`:T?`${e.app}, a desktop app`:e.url]}),e.block&&(0,Y.jsx)(`span`,{className:f(`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.`})]}),O&&(0,Y.jsxs)(D,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:`pause`}),children:[k?(0,Y.jsx)(he,{"aria-hidden":`true`}):(0,Y.jsx)(ie,{"aria-hidden":`true`}),k?`Resume`:`Pause`]}),!T&&(0,Y.jsxs)(D,{disabled:n||e.state===`starting`||!e.steps.length,onClick:()=>t({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,Y.jsx)(pe,{"aria-hidden":`true`}),`Undo`]}),d&&y&&(0,Y.jsxs)(`span`,{className:`relative inline-block`,children:[(0,Y.jsxs)(D,{disabled:n||e.state!==`recording`||e.block?.state===`playing`||e.block?.state===`waiting`,"aria-haspopup":`dialog`,"aria-expanded":m,onClick:()=>{m||(v(s[0]?.id??``),x(Nt(s[0],l))),h(!m)},"data-tip":`Do a saved block's steps here, then carry on`,children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),`Play a block`]}),(0,Y.jsx)(g,{open:m,onClose:()=>h(!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(),Mt(y,b)&&(h(!1),d(y.id,Ft(b)))},children:[(0,Y.jsx)(r,{"aria-label":`The block to play now`,value:y.id,onChange:e=>{v(e.target.value),x(Nt(s.find(t=>t.id===e.target.value),l))},children:s.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)(It,{block:y}),(0,Y.jsx)(Pt,{block:y,secrets:l,use:b,onChange:x,unset:u}),(0,Y.jsx)(`span`,{className:`text-body-sm text-muted`,children:E?`Its steps are done on the device now and go into the recording here; a step that cannot be done, you do by hand.`:T?`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)(D,{type:`submit`,size:`sm`,variant:`primary`,disabled:!Mt(y,b),"data-tip":`Play the block now`,children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Play`]})]})})]}),(0,Y.jsxs)(D,{variant:`destructive`,disabled:n||e.state===`stopping`,onClick:()=>t({cmd:`stop`,...A?{force:!0}:{}}),"data-tip":A?`Stop anyway`:`Stop and save`,children:[(0,Y.jsx)(qe,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),E?(0,Y.jsxs)(`p`,{className:f(w.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.`]}):T?(0,Y.jsxs)(`p`,{className:f(w.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:f(w.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.`]}),E?(0,Y.jsx)(`div`,{className:`@container`,children:(0,Y.jsxs)(`div`,{className:f(`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)(Un,{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:f(`flex min-w-0 flex-col`,!N&&`@2xl:col-start-2 @2xl:row-start-1 @5xl:col-start-1`),children:te}),(0,Y.jsxs)(`div`,{className:f(`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:[F,I,L]})]})}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-6`,children:[te,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-6`,children:[I,L]})]})]})}function Kn({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`,s=!t.ok&&t.error?Kt(t.error,e.kind):null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:f(c,`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)(de,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}):(0,Y.jsx)(Qe,{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:s||`The recording stopped with an error before its first step.`,e.endedAt&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[` · stopped after `,Fn(e.startedAt,e.endedAt)]})]})]}),t.ok&&(0,Y.jsx)(M,{tone:`pass`,children:`Recorded`})]}),t.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-body-sm`,children:[(0,Y.jsx)(M,{tone:`neutral`,icon:!1,children:d(e.steps.length,`step`)}),(0,Y.jsxs)(M,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,Y.jsxs)(M,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,Y.jsxs)(M,{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)(D,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await Ln(t.workflow,e.kind===`mobile`?`mobile`:`desktop`)}catch(e){r(e.message),a(!1)}},children:[(0,Y.jsx)(he,{"aria-hidden":`true`}),`Replay`]}),o&&t.report&&(0,Y.jsxs)(D,{onClick:async()=>r(await C(t.report)),"data-tip":`Open the report`,children:[(0,Y.jsx)(Ne,{"aria-hidden":`true`}),`Report`]}),!o&&t.ok&&(0,Y.jsxs)(D,{onClick:async()=>r(await C(`${e.runDir}/trace.md`)),"data-tip":`Read the steps`,children:[(0,Y.jsx)(Ke,{"aria-hidden":`true`}),`Steps`]}),(0,Y.jsx)(`span`,{className:`flex min-w-0 max-w-full text-body-sm`,children:(0,Y.jsx)(A,{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)(Ct,{title:`What the recorder said`,children:(0,Y.jsx)(`code`,{className:f(`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 qn(e){try{let t=decodeURIComponent(e);return t&&t.length<=500&&!/[\0\r\n]/.test(t)?t:null}catch{return null}}var Q={emulator:`this computer's emulators`,device:`phones plugged into this computer`,testmu:`TestMu AI`,browserstack:`BrowserStack`};function Jn({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)(Me,{size:14,"aria-hidden":`true`,className:`flex-none animate-spin text-accent-fg`}),i?`Connecting to ${Q[e]}…`:`Looking for devices…`]}):r||t&&!t.ready?(0,Y.jsxs)(`span`,{className:`flex items-start gap-2 text-fail`,children:[(0,Y.jsx)(Qe,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r||t?.problem||(t?.missing?.length?`Not signed in to ${Q[e]}: save ${t.missing.join(` and `)} in Settings, Mobile.`:`${Q[e]} is not ready.`)})]}):t?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-ink-2`,children:[(0,Y.jsx)(de,{size:14,"aria-hidden":`true`,className:`flex-none text-pass`}),i?`Connected to ${Q[e]} · ${d(t.devices.length,`device`)}`:`${d(t.devices.length,`device`)} on ${Q[e]}`]}):null}function Yn({open:e,onClose:t,place:n,app:r,listing:i,loading:a,error:o,picked:s,onUse:c,onRefresh:l}){let[u,d]=(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)(it,{open:e,onClose:t,title:`Choose a device`,description:`For ${r} on ${Q[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)(D,{onClick:t,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(D,{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)(Jn,{place:n,listing:i,loading:a,error:o})}),(0,Y.jsxs)(D,{size:`sm`,disabled:a,onClick:l,"data-tip":`Ask again`,children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),`Refresh`]})]}),i&&!i.build.ok&&(0,Y.jsxs)(`p`,{role:`alert`,className:f(w.warn,`m-0 flex items-start gap-2`),children:[(0,Y.jsx)(ne,{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)(E,{id:`rec-device-search`,label:`Find a device`,value:u,onChange:d,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:f(`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)(Rt,{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 Xn({view:e,busy:t,onStart:n,start:i}){let s=Gt(i),l=e.mobile.apps.length>0,[u,p]=(0,J.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:e.session?.kind===`mobile`&&l?`mobile`:`web`),[m,h]=(0,J.useState)(e.mobile.apps[0]?.name??``),g=e.mobile.devices[0]?.where,[_,x]=(0,J.useState)(g===`TestMu AI`?`testmu`:g===`BrowserStack`?`browserstack`:`emulator`),[S,C]=(0,J.useState)(null),[T,E]=(0,J.useState)(``),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(0),[P,F]=(0,J.useState)(!1),[te,I]=(0,J.useState)(!1),[L,ie]=(0,J.useState)(!1),[ae,oe]=(0,J.useState)(null),[se,z]=(0,J.useState)(!1),[ce,le]=(0,J.useState)(``),[ue,de]=(0,J.useState)(``);(0,J.useEffect)(()=>{I(!1),de(``)},[_,m]);let fe=()=>{le(``),ie(!0),ae===null&&y.view().then(e=>oe(e.builds),e=>{oe([]),le(e.message)})},pe=async e=>{z(!0),le(``);try{return await e(),!0}catch(e){return le(e.message),!1}finally{z(!1)}};(0,J.useEffect)(()=>{if(u!==`mobile`||!m)return;let e=!0;return k(!0),E(``),C(null),b.mobileDevices(_,m,M>0).then(t=>{e&&(C(t),j(e=>t.devices.some(t=>t.id===e)?e:t.devices.length===1?t.devices[0].id:``))},t=>e&&E(t.message)).finally(()=>e&&k(!1)),()=>{e=!1}},[u,_,m,M]);let[me,he]=(0,J.useState)(e.desktop.apps[0]??``),[_e,ve]=(0,J.useState)(``),[ye,xe]=(0,J.useState)(``),[Se,Ce]=(0,J.useState)(``),[we,Te]=(0,J.useState)(!1),[Ee,Oe]=(0,J.useState)(!1),[Ae,je]=(0,J.useState)(``),[B,Me]=(0,J.useState)(s?``:e.apps[0]?.name??``),[Ne,Pe]=(0,J.useState)(s),[Fe,Ie]=(0,J.useState)(!1),[Re,ze]=(0,J.useState)(``),[Be,Ve]=(0,J.useState)(!1),[Ue,We]=(0,J.useState)(``),[V,Ge]=(0,J.useState)(e.environment??``),[Ke,qe]=(0,J.useState)(!1),[Xe,Ze]=(0,J.useState)(!1),[Qe,$e]=(0,J.useState)(``),[et,tt]=(0,J.useState)(``),[nt,rt]=(0,J.useState)([]);(0,J.useEffect)(()=>rt([]),[u,me,m]);let[it,at]=(0,J.useState)(``),U=u===`web`?e.blocks.filter(e=>(e.kind??`web`)===`web`):e.blocks.filter(e=>e.kind===u&&e.app===(u===`mobile`?m:me)),ot=u===`mobile`?e.mobile.secrets:u===`desktop`?e.desktop.secrets??[]:e.blockSecrets??[],W=nt.flatMap(e=>(t=>t?[{block:t,use:e.use}]:[])(U.find(t=>t.id===e.id))),st=u===`web`?W[0]?.block:void 0,ct=W.every(e=>Mt(e.block,e.use)),lt=S?.devices.find(e=>e.id===A),ut=e.apps.find(e=>e.name===B)?.url??``,G=V||e.environment||``,dt=/^https?:\/\/\S+$/i.test(Ne.trim()),ft=u===`web`&&!B&&!st&&Fe&&!!G;(0,J.useEffect)(()=>{if(Be)return;let e=``;try{e=new URL(Ne.trim()).hostname}catch{}ze(e.replace(/^www\./,``).split(`.`).slice(0,2).join(`-`).toLowerCase().replace(/[^a-z0-9_.-]+/g,`-`).replace(/^[^a-z]+/,``).slice(0,40))},[Ne,Be]);let pt=!!S&&S.build.ok&&!!lt,mt=u===`web`&&Xe,gt=mt?{asBlock:{name:Qe.trim(),...et.trim()?{section:et.trim()}:{}}}:{},vt=mt&&!Qe.trim()||ft&&!Re.trim()?!1:u===`mobile`?l&&!!m&&pt&&ct:u===`desktop`?e.desktop.available&&(!!me||!!_e.trim()&&!!ye.trim())&&ct:st?ct:B?!0:dt,yt=W.length?{blocks:W.map(e=>({id:e.block.id,...Ft(e.use)}))}:{},xt=U.length>0&&(u!==`desktop`||!!me),St=e.environments.length>1&&(u!==`web`||!!B),Ct=u===`web`&&e.logins.length>0,wt=xt||u===`web`||St||Ct,Et=u===`mobile`?`App and device`:u===`desktop`?`App`:`Start on`,Dt=u===`mobile`?(e=>e?`${m} starts on ${e.label}${_===`testmu`?` at TestMu AI`:_===`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.`)(S?.devices.find(e=>e.id===A)):u===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:mt?`A browser opens on this computer: do the steps. When you stop, they are kept as the block${Qe.trim()?` "${Qe.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.`,q=`flex min-w-0 flex-col gap-2 text-body-md font-medium`,Ot=`-mt-1 text-body-sm font-normal text-muted`,kt=_===`testmu`||_===`browserstack`?_:null,Lt=kt===`testmu`?`TestMu AI`:kt===`browserstack`?`BrowserStack`:``,Rt=u===`mobile`?`Execution environment`:u===`desktop`?`App`:`Start page`,Vt=[Rt,...u===`mobile`?[`App & device`]:[],...wt?[`Options`]:[]],Ht=e=>Vt.indexOf(e)+2;return(0,Y.jsxs)(`div`,{className:`@container`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @4xl:grid-cols-[minmax(0,1fr)_minmax(296px,360px)] @4xl:min-h-[calc(var(--screen)-232px)] @4xl:items-stretch`,children:[(0,Y.jsxs)(`form`,{"aria-label":`New recording`,className:f(c,`flex min-w-0 flex-col p-0 @container`),onSubmit:t=>{if(t.preventDefault(),vt){if(u===`mobile`)return n({kind:`mobile`,app:m,target:{place:_,id:A},...V&&V!==e.environment?{env:V}:{},...yt});if(u===`desktop`&&me)return n({kind:`desktop`,app:me,...V&&V!==e.environment?{env:V}:{},...yt});if(u===`desktop`)Oe(!0),je(``),v.addApp({name:ye.trim(),path:_e.trim(),...Se.trim()?{args:Se.trim()}:{},...V?{env:V}:{}}).then(t=>n({kind:`desktop`,app:t.name,...V&&V!==e.environment?{env:V}:{}}),e=>je(e.message)).finally(()=>Oe(!1));else{if(st)return n({...yt,...it?{app:it}:{},...V&&V!==e.environment?{env:V}:{},signedIn:Ke,...gt});ft?(Oe(!0),je(``),b.addWebApp({name:Re.trim(),url:Ne.trim(),env:G}).then(t=>n({app:t.name,...Ue.trim()?{case:Ue.trim()}:{},...V&&V!==e.environment?{env:V}:{},signedIn:Ke,...gt}),e=>je(e.message)).finally(()=>Oe(!1))):n({...B?{app:B}:{url:Ne.trim()},...Ue.trim()?{case:Ue.trim()}:{},...V&&V!==e.environment?{env:V}:{},signedIn:Ke,...gt})}}},children:[(0,Y.jsx)(Zn,{n:1,title:`Target platform`,first:!0,children:(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Target platform`,className:f(K,`grid gap-1 @lg:grid-cols-3`),children:[(0,Y.jsx)(Tt,{on:u===`web`,onPick:()=>p(`web`),logo:(0,Y.jsx)(bt,{icon:ge,size:`lg`}),title:`Web page`,lift:!0,sub:`Browser address`,label:`Web page`}),(0,Y.jsx)(Tt,{on:u===`desktop`,onPick:()=>p(`desktop`),logo:(0,Y.jsx)(bt,{icon:ee,size:`lg`}),title:`Desktop app`,lift:!0,sub:e.desktop.available?`Windows client`:`Windows only`,label:`Desktop app`,disabled:!e.desktop.available}),(0,Y.jsx)(Tt,{on:u===`mobile`,onPick:()=>p(`mobile`),logo:(0,Y.jsx)(bt,{icon:He,size:`lg`}),title:`Mobile app`,lift:!0,sub:l?`iOS & Android`:`Add one in Settings, Mobile`,label:`Mobile app`,disabled:!l})]})}),u===`mobile`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Zn,{n:Ht(Rt),title:Rt,children:[(0,Y.jsx)(_t,{label:Rt,value:_,onChange:x,className:`self-start`,options:[{id:`emulator`,label:`Emulator`,icon:(0,Y.jsx)(Ye,{size:14,"aria-hidden":`true`})},{id:`device`,label:`Real device`,icon:(0,Y.jsx)(Je,{size:14,"aria-hidden":`true`})},{id:`testmu`,label:`TestMu AI`,icon:(0,Y.jsx)(be,{size:14,"aria-hidden":`true`})},{id:`browserstack`,label:`BrowserStack`,icon:(0,Y.jsx)(be,{size:14,"aria-hidden":`true`})}]}),(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm`,children:(0,Y.jsx)(Jn,{place:_,listing:S,loading:O,error:T})})]}),(0,Y.jsxs)(Zn,{n:Ht(`App & device`),title:`App & device`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 @lg:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:q,children:[`App`,(0,Y.jsx)(r,{size:`lg`,"aria-label":`App`,value:m,onChange:e=>h(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:q,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)(o,{size:`lg`,readOnly:!0,"aria-labelledby":`rec-device`,value:lt?lt.label:``,placeholder:`None chosen`,className:`min-w-0 flex-1 truncate font-normal`}),(0,Y.jsxs)(D,{type:`button`,size:`lg`,disabled:!m,onClick:()=>F(!0),"data-tip":`Choose a device on ${Lt||`this computer`}`,children:[(0,Y.jsx)(He,{"aria-hidden":`true`}),`Choose`]})]})]})]}),S&&!S.build.ok&&(0,Y.jsxs)(`div`,{role:`alert`,className:f(w.warn,`flex flex-wrap items-center gap-x-4 gap-y-2`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] items-start gap-2`,children:[(0,Y.jsx)(ne,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:kt?(0,Y.jsxs)(Y.Fragment,{children:[Lt,` cannot install this app's build. Upload a build, or set the app's `,(0,Y.jsx)(`code`,{className:`font-mono`,children:kt===`testmu`?`lt://`:`bs://`}),` id in Settings, Mobile.`]}):S.build.note})]}),kt&&(0,Y.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,Y.jsxs)(D,{type:`button`,size:`sm`,variant:`ghost`,"data-tip":zt(kt,m),"aria-label":`Copy the command: ${zt(kt,m)}`,onClick:()=>void navigator.clipboard?.writeText(zt(kt,m)).then(()=>I(!0)),children:[te?(0,Y.jsx)(H,{"aria-hidden":`true`}):(0,Y.jsx)(ke,{"aria-hidden":`true`}),te?`Copied`:`CLI`]}),(0,Y.jsxs)(D,{type:`button`,size:`sm`,onClick:fe,children:[(0,Y.jsx)(Le,{"aria-hidden":`true`}),`Upload build`]})]})]}),ue&&(0,Y.jsx)(`p`,{role:`status`,className:f(w.pass,`m-0`),children:ue})]})]}):(0,Y.jsxs)(Zn,{n:Ht(Rt),title:Rt,children:[(0,Y.jsx)(`div`,{role:`group`,"aria-label":Et,className:`grid gap-4 @lg:grid-cols-2`,children:u===`desktop`?(0,Y.jsxs)(Y.Fragment,{children:[e.desktop.apps.length>0&&(0,Y.jsxs)(`label`,{className:q,children:[`App`,(0,Y.jsxs)(r,{size:`lg`,"aria-label":`App`,value:me,onChange:e=>he(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…`})]})]}),!me&&(0,Y.jsxs)(`div`,{className:q,children:[(0,Y.jsx)(`span`,{children:`Program`}),(0,Y.jsx)(jt,{value:_e,onChange:e=>{ve(e),we||xe(e.trim()?At(e):``)},onPicked:(e,t)=>{we||xe(t)},onError:je,className:`flex-1`})]})]}):st?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 @lg:col-span-2`,children:[(0,Y.jsxs)(`p`,{className:`m-0 text-body-sm [overflow-wrap:anywhere]`,children:[`Opens `,(e=>e?`${new URL(st.startUrl).pathname} on ${e.url}`:st.startUrl)(e.apps.find(e=>e.name===it)),`, does `,W.length>1?`the blocks `:`the block `,(0,Y.jsx)(`strong`,{className:`font-medium`,children:W.map(e=>e.block.name).join(`, then `)}),` (`,d(W.reduce((e,t)=>e+t.block.steps,0),`step`),`), then you carry on.`]}),e.apps.length>0&&(0,Y.jsxs)(r,{size:`lg`,"aria-label":`Play the blocks on`,value:it,onChange:e=>at(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)(`div`,{className:f(q,`@lg:col-span-2`),children:[(0,Y.jsx)(`span`,{id:`rec-start`,children:`Start on`}),(0,Y.jsxs)(`div`,{role:`group`,"aria-labelledby":`rec-start`,className:f(a,`flex min-h-12 min-w-0 items-stretch overflow-hidden font-normal`),children:[e.apps.length>0&&(0,Y.jsxs)(r,{size:`lg`,"aria-label":`App`,value:B,onChange:e=>{!e.target.value&&B&&!Ne.trim()&&Pe(ut),Me(e.target.value)},className:`min-h-12 w-[30%] min-w-[120px] flex-none rounded-none border-0 border-r border-line bg-transparent focus:bg-transparent focus:shadow-none focus-visible:outline-none`,children:[e.apps.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.name},e.name)),(0,Y.jsx)(`option`,{value:``,children:`Another page…`})]}),(0,Y.jsx)(`input`,{"aria-label":`Page address`,type:`url`,inputMode:`url`,value:B?ut:Ne,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>{B&&Me(``),Pe(e.target.value)},"data-tip":(B?ut:Ne)||void 0,className:`min-w-0 flex-1 border-0 bg-transparent px-4 font-mono text-body-md text-ink outline-none placeholder:text-placeholder`})]}),(0,Y.jsx)(`span`,{className:Ot,children:B?`${B}'s address on ${V||e.environment||`this environment`}. Type to start on another page of it.`:`Any http(s) page. Save it to the environment to start on it by name next time.`}),!B&&G&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-normal`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ht,{checked:Fe,onChange:Ie,label:`Save to the ${G} environment`}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-ink`,children:[`Save to the `,G,` environment`]})]}),Fe&&(0,Y.jsx)(o,{size:`lg`,"aria-label":`Save as`,value:Re,maxLength:40,spellCheck:!1,placeholder:`app name`,onChange:e=>{Ve(!0),ze(e.target.value)},className:`w-[min(240px,100%)] font-mono text-body-sm`})]})]})}),u===`desktop`&&!me&&(0,Y.jsxs)(`div`,{className:`grid gap-4 @lg:grid-cols-[minmax(0,220px)_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`label`,{className:q,children:[`Save it as`,(0,Y.jsx)(o,{size:`lg`,"aria-label":`The app's name`,value:ye,maxLength:40,spellCheck:!1,placeholder:`billing`,onChange:e=>{Te(!0),xe(e.target.value)}})]}),(0,Y.jsxs)(`label`,{className:q,children:[`Arguments`,(0,Y.jsx)(o,{size:`lg`,"aria-label":`The app's arguments`,value:Se,maxLength:500,spellCheck:!1,placeholder:`--server qa-db01 --profile "Test User"`,onChange:e=>Ce(e.target.value),className:`font-mono text-body-sm`}),(0,Y.jsx)(`span`,{className:Ot,children:`Optional: what the app starts with. Quotes keep spaces together; no shell.`})]}),(0,Y.jsxs)(`span`,{className:`text-body-sm text-muted @lg:col-span-2`,children:[`Added to the apps of `,V||e.environment?`the ${V||e.environment} environment`:`forgeqe.yaml`,`, so you can replay it.`]})]})]}),wt&&(0,Y.jsx)(Zn,{n:Ht(`Options`),title:(0,Y.jsxs)(Y.Fragment,{children:[`Options `,(0,Y.jsx)(`span`,{className:`font-normal text-muted`,children:`· optional`})]}),children:(0,Y.jsxs)(`div`,{className:`grid gap-x-6 gap-y-4 @lg:grid-cols-2`,children:[u===`web`&&(0,Y.jsxs)(`label`,{className:q,children:[`Test case`,(0,Y.jsx)(o,{size:`lg`,value:Ue,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>We(e.target.value)}),(0,Y.jsx)(`span`,{className:Ot,children:`Its steps are listed while you record; each one you do is tied to it.`})]}),(xt||u===`web`)&&(0,Y.jsxs)(`label`,{className:q,children:[`Block`,(0,Y.jsxs)(r,{size:`lg`,"aria-label":`Block`,value:mt?Nn:``,onChange:e=>{let t=e.target.value;if(t===Nn)return Ze(!0);if(!t)return Ze(!1);let n=U.find(e=>e.id===t);n&&nt.length<10&&rt([...nt,{id:n.id,use:Nt(n,ot)}])},children:[(0,Y.jsx)(`option`,{value:``,children:W.length?`Add another block…`:`No block`}),u===`web`&&(0,Y.jsx)(`option`,{value:Nn,children:`Record a new block`}),U.length>0&&(0,Y.jsx)(`optgroup`,{label:`Start from a kept block`,children:U.map(e=>(0,Y.jsxs)(`option`,{value:e.id,disabled:nt.length>=10,children:[e.section?`${e.section} › `:``,e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,Y.jsx)(`span`,{className:Ot,children:mt?`Steps you do in many tests, like signing in: when you stop, they are kept under a name to use again.`:W.length?`Its steps are done for you first, then you record the rest. Add more to do one after another.`:`Record a new one to use again, or start from one kept: its steps are done ${u===`web`?`first`:`in ${u===`mobile`?`the app on the device`:`the app`} once it is open`}.`})]}),mt&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:q,children:[`Block name`,(0,Y.jsx)(o,{size:`lg`,"aria-label":`Block name`,value:Qe,maxLength:80,placeholder:`Sign in`,onChange:e=>$e(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:q,children:[`Section`,(0,Y.jsx)(o,{size:`lg`,"aria-label":`Section`,value:et,maxLength:40,placeholder:`Account`,list:`rec-block-sections`,onChange:e=>tt(e.target.value)}),(0,Y.jsx)(`span`,{className:Ot,children:`Optional: where it is listed with others, like Account.`}),(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))})]})]}),W.length>0&&(0,Y.jsx)(`ol`,{"aria-label":`Blocks done first`,className:`m-0 flex list-none flex-col gap-2 p-0 @lg:col-span-2`,children:W.map((n,r)=>(0,Y.jsxs)(`li`,{className:f(`rounded-base bg-surface-muted p-4`,`flex flex-col gap-2`),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 font-medium text-ink [overflow-wrap:anywhere]`,children:[r+1,`. `,n.block.name]}),(0,Y.jsx)(D,{type:`button`,size:`icon`,variant:`icon`,disabled:t,"aria-label":`Leave out the block ${n.block.name}`,"data-tip":`Leave it out`,onClick:()=>rt(nt.filter((e,t)=>t!==r)),className:`size-8`,children:(0,Y.jsx)(R,{"aria-hidden":`true`})})]}),(0,Y.jsx)(It,{block:n.block}),(0,Y.jsx)(Pt,{block:n.block,secrets:ot,use:n.use,onChange:e=>rt(nt.map((t,n)=>n===r?{...t,use:e}:t)),unset:e.unsetSecrets??[]})]},`${n.block.id}-${r}`))}),St&&(0,Y.jsxs)(`label`,{className:q,children:[`Environment`,(0,Y.jsx)(r,{size:`lg`,value:V,onChange:e=>Ge(e.target.value),children:e.environments.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsx)(`span`,{className:Ot,children:`Where the app's address and sign-ins come from.`})]}),Ct&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-4 @lg:col-span-2`,children:[(0,Y.jsx)(ht,{checked:Ke,onChange:qe,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.`]})]})]})]})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 z-10 mt-auto flex flex-wrap items-center gap-4 rounded-b-lg border-t border-line-soft bg-surface-muted px-8 py-6`,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)(De,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:Dt})]}),Ae&&(0,Y.jsx)(`p`,{role:`alert`,className:f(w.fail,`m-0 basis-full`),children:Ae}),(0,Y.jsxs)(D,{busy:Ee,type:`submit`,variant:`primary`,disabled:t||Ee||!vt,"data-tip":`Start recording`,size:`lg`,className:`ml-auto`,children:[(0,Y.jsx)(re,{"aria-hidden":`true`}),Ee?`Adding…`:t?u===`web`?`Opening…`:`Starting…`:`Record`]})]})]}),(0,Y.jsx)(tr,{kind:u})]}),u===`mobile`&&(0,Y.jsx)(Yn,{open:P,onClose:()=>F(!1),place:_,app:m,listing:S,loading:O,error:T,picked:A,onUse:j,onRefresh:()=>N(e=>e+1)}),kt&&(0,Y.jsx)(Bt,{open:L,builds:ae,apps:e.mobile.apps.map(e=>e.name),busy:se,act:pe,cloud:kt,app:m,problem:ce,onClose:()=>ie(!1),onDone:e=>{de(e),N(e=>e+1)}})]})}function Zn({n:e,title:t,first:n,className:r,children:i}){return(0,Y.jsxs)(`fieldset`,{className:f(`m-0 min-w-0 border-0 px-8 py-8 @4xl:flex-1`,!n&&`border-t border-solid border-line-soft`,r),children:[(0,Y.jsxs)(`legend`,{className:`float-left m-0 p-0 pr-4 text-body-lg font-medium text-ink`,children:[e,`. `,t]}),(0,Y.jsx)(`div`,{className:`clear-both flex min-w-0 flex-col gap-6 pt-6`,children:i})]})}function Qn(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 $n({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`&&q(e.test).hasTest).length,a=Math.round(r/60),o=Math.floor(a/60),s=a%60;return(0,Y.jsxs)(rt,{label:`Recordings in numbers`,children:[(0,Y.jsx)(lt,{compact:!0,icon:he,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)(lt,{compact:!0,icon:Be,label:`Tests written`,value:String(i),note:`from these recordings`}),(0,Y.jsx)(lt,{compact:!0,icon:B,label:`Reusable flows`,value:String(e.blocks.length),note:`blocks kept to use again`}),(0,Y.jsx)(lt,{compact:!0,icon:ve,label:`Total duration`,value:n.length?o?`${o}h ${s}m`:`${s}m`:`—`,note:n.length?`${d(n.length,`recording`)} timed`:`kept from now on`})]})}var er={web:{steps:[{icon:ge,title:`A browser opens`,text:`On this computer, at the start page you chose, signed in if you asked.`},{icon:re,title:`Record your journey`,text:`Each click, entry and choice is recorded in order, with the locators a replay finds it by.`},{icon:Ae,title:`Define checks`,text:`After you stop, choose what each step must show and where typed values come from.`},{icon:Be,title:`Generate the test`,text:`Quill writes it into your repository; Re-run plays it on any environment.`}],needs:[`A web app of the environment, or any http(s) address`,`Saved sign-ins, to start signed in`],after:`Passwords are kept as a variable's name, never as typed.`},desktop:{steps:[{icon:ee,title:`The app starts`,text:`On this computer, with the arguments it is saved with.`},{icon:re,title:`Record your journey`,text:`Each click, typed value and key in the app is recorded by its controls, in order.`},{icon:Ae,title:`Define checks`,text:`In the review, add checks, waits and keys after any step, and say where typed values come from.`},{icon:he,title:`Replay it`,text:`It is saved as a workflow that replays with no model, on any environment.`}],needs:[`Windows`,`The app's .exe, from the list or added by its path`],after:`Keep your hands off the mouse and keys while a block plays.`},mobile:{steps:[{icon:He,title:`The app starts on a device`,text:`An emulator or phone on this computer, or a device at TestMu AI or BrowserStack.`},{icon:L,title:`Record on its screen`,text:`The device's screen shows on this page: tap, type and swipe there, and each becomes a step.`},{icon:Ae,title:`Define checks`,text:`Add checks and waits in the review, and say where typed values come from.`},{icon:he,title:`Replay it`,text:`It is saved as a workflow that replays with no model, on the devices you pick.`}],needs:[`A mobile app in Settings, Mobile`,`A device here, or a cloud's sign-in`,`For a cloud, the app's build uploaded there`],after:`Secrets are typed by their name; their values never reach this page.`}};function tr({kind:e}){let t=er[e],n=e===`web`?`a web page`:e===`desktop`?`a desktop app`:`a mobile app`;return(0,Y.jsxs)(`aside`,{"aria-labelledby":`rec-how`,className:f(c,`flex flex-col gap-6`),children:[(0,Y.jsx)(pt,{id:`rec-how`,icon:se,title:`How it works`,level:3,description:`Recording ${n}.`}),(0,Y.jsx)(`ol`,{className:`pane-swap m-0 flex list-none flex-col gap-4 p-0`,children:t.steps.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-4`,children:[(0,Y.jsx)(Et,{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 text-ink`,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))},e),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-body-sm font-medium text-ink`,children:`What it needs`}),(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 text-body-sm text-ink-2`,children:t.needs.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Y.jsx)(H,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none text-pass`}),(0,Y.jsx)(`span`,{children:e})]},e))})]}),(0,Y.jsxs)(`p`,{className:`m-0 flex items-start gap-2 text-body-sm text-muted`,children:[(0,Y.jsx)(De,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Y.jsx)(`span`,{children:t.after})]})]})}function nr({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)(g,{open:t,onClose:n,label:r,anchor:e,align:i===`right`?`end`:`start`,className:`w-[230px] text-left`,children:a})})}function rr(){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)},[])]}async function $(e){let t=`${e.name.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`recording`}.forgeqe-recording.json`;return S(await b.exportRecording(e.runDir),t),`Exported ${e.name}: its steps and locators, without its pictures, video or logs. Import the file on the Record page of another project.`}function ir({r:e,onReview:t,onWrite:r,onDelete:i,onNote:a}){let[o,s,c]=rr(),l=(0,J.useRef)(null),u=q(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)(D,{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)(ye,{"aria-hidden":`true`})}),(0,Y.jsxs)(nr,{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)(m,{onClick:d(t),children:`Open the recording`}),e.kind!==`web`&&e.workflow&&(0,Y.jsx)(m,{onClick:d(()=>Ln(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)(m,{onClick:d(()=>void Ot(e.test.testFile).then(a)),children:`Open the test`}),e.kind===`web`&&e.ok&&!u.hasTest&&!u.writing&&(0,Y.jsx)(m,{onClick:d(r),children:`Write the test`}),e.test?.chat&&(0,Y.jsx)(m,{onClick:d(()=>location.hash=n(`chats`,e.test.chat)),children:`Open the chat`}),e.trace&&(0,Y.jsx)(m,{onClick:d(()=>void C(e.trace).then(a)),children:`Read the steps`}),e.report&&(0,Y.jsx)(m,{onClick:d(()=>void C(e.report).then(a)),children:`Open the report`}),e.kind===`web`&&e.ok&&(0,Y.jsx)(m,{onClick:d(()=>void $(e).then(a,e=>a(e.message))),children:`Export to a file`}),(0,Y.jsx)(m,{onClick:d(i),children:(0,Y.jsx)(`span`,{className:`text-fail`,children:`Delete`})})]})]})}function ar({r:e,onNote:t}){let n=q(e.test);return(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 whitespace-nowrap`,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)(M,{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)(D,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the test of ${e.name}`,"data-tip":`Open ${e.test.testFile}`,onClick:async()=>t(await Ot(e.test.testFile)),children:(0,Y.jsx)(Be,{"aria-hidden":`true`})}),(e.yaml||e.kind===`mobile`&&e.workflow)&&(0,Y.jsx)(D,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the workflow of ${e.name}`,"data-tip":`Open the YAML workflow`,onClick:async()=>t(await C(e.yaml||e.workflow)),children:(0,Y.jsx)(oe,{"aria-hidden":`true`})}),e.trace&&(0,Y.jsx)(D,{variant:`icon`,size:`icon-sm`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>t(await C(e.trace)),children:(0,Y.jsx)(Ke,{"aria-hidden":`true`})}),e.report&&(0,Y.jsx)(D,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>t(await C(e.report)),children:(0,Y.jsx)(Ne,{"aria-hidden":`true`})})]})}function or({rows:e,onReview:t,onReviewDesktop:r,onDeleted:i,onChanged:a}){let[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)([]),[u,p]=(0,J.useState)(!1),[m,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),y=(0,J.useRef)(null),[x,S,C]=rr(),w=(0,J.useRef)(null),[O,k]=(0,J.useState)(`any`),[A,j]=(0,J.useState)(``),[N,P]=(0,J.useState)(`all`);(0,J.useEffect)(()=>l(t=>t.filter(t=>e.some(e=>e.runDir===t))),[e]);let te=async()=>{g(!0),s(``);try{let e=c.length;i(await b.deleteRecordings(c)),l([]),s(`Deleted ${d(e,`recording`)}.`)}catch(e){s(e.message)}finally{g(!1),p(!1)}},L=async e=>{let n=e?.[0];if(n){if(s(``),n.size>921600)return s(`${n.name} is over 900 KB: a recording file holds steps only.`);v(!0);try{let e=await b.importRecording(await n.text());i(e);let r=e.recordings.find(t=>t.runDir===e.imported);s(`Imported ${r?r.name:n.name}. Re-run it here before writing its test: its locators were found on another computer.`),r&&t(r.runDir)}catch(e){s(e.message)}finally{v(!1)}}},ne=e=>e.kind===`web`&&q(e.test).hasTest,ie=N===`all`?e:e.filter(e=>e.kind===N),ae=A.toLowerCase().split(/\s+/).filter(Boolean),oe=ae.length?ie.filter(e=>ae.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl} ${e.browser||``} ${e.test?.testFile||``} ${e.kind===`web`?q(e.test).label:``}`.toLowerCase().includes(t))):ie,se=O===`any`?oe:oe.filter(e=>e.kind===`web`&&O===`written`===ne(e)),z=se,ce=new Set(e.map(e=>e.kind)).size>1,le=O!==`any`||N!==`all`,ue=e=>{l([e]),p(!0)},de=e=>In(e).then(()=>a(),e=>s(e.message)),fe=(0,Y.jsxs)(`span`,{ref:w,className:`relative inline-block`,children:[(0,Y.jsxs)(D,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":x,onClick:C,"data-tip":`Show only some recordings`,children:[`Filter`,le?` · on`:``,(0,Y.jsx)(I,{"aria-hidden":`true`})]}),(0,Y.jsxs)(nr,{anchor:w.current,open:x,onClose:()=>S(!1),label:`Show only`,align:`left`,children:[[[`any`,`Any test`],[`written`,`Test written (${e.filter(ne).length})`],[`none`,`No test yet (${e.filter(e=>e.kind===`web`&&!ne(e)).length})`]].map(([e,t])=>(0,Y.jsx)(h,{role:`menuitemradio`,checked:O===e,onSelect:()=>k(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})},e)),ce&&[[`all`,`Every kind`],[`web`,`Web pages`],[`desktop`,`Desktop apps`],[`mobile`,`Mobile apps`]].map(([e,t],n)=>(0,Y.jsx)(`span`,{className:f(`block`,n===0&&`mt-1 border-t border-line-soft pt-1`),children:(0,Y.jsx)(h,{role:`menuitemradio`,checked:N===e,onSelect:()=>P(e),children:(0,Y.jsx)(`span`,{className:`flex-1`,children:t})})},e))]})]});return(0,Y.jsxs)(ft,{id:`rec-all`,icon:re,title:`All recordings`,n:se.length,children:[o&&(0,Y.jsx)(`p`,{role:`status`,className:f(`m-0 text-body-sm`,/^(Deleted|Imported|Exported) /.test(o)?`text-muted`:`text-fail`),children:o}),(0,Y.jsx)(wt,{label:`Recordings`,resetKey:`${O}-${N}-${A}`,search:!1,size:25,height:nt,selection:{count:c.length,onClear:()=>l([]),actions:(0,Y.jsxs)(D,{size:`sm`,variant:`danger`,disabled:!c.length||m,"data-tip":`Delete the selected recordings`,onClick:()=>p(!0),children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Delete`]})},tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{id:`rec-search`,label:`Search recordings`,placeholder:`Search recordings`,value:A,onChange:j}),fe,(0,Y.jsxs)(D,{size:`sm`,busy:_,disabled:_,onClick:()=>y.current?.click(),"data-tip":`A recording another project exported to a file`,children:[(0,Y.jsx)(Le,{"aria-hidden":`true`}),_?`Importing…`:`Import`]}),(0,Y.jsx)(`input`,{ref:y,type:`file`,accept:`.json,application/json`,hidden:!0,"aria-label":`Recording file to import`,onChange:e=>(L(e.target.files),e.target.value=``)})]}),empty:ae.length||le?`Nothing matches.`:`No recordings yet.`,head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`w-9`),children:(0,Y.jsx)(W,{"aria-label":`Select all ${d(z.length,`recording`)}`,"data-tip":`Select all ${d(z.length,`recording`)} the search and filter keep`,checked:z.length>0&&z.every(e=>c.includes(e.runDir)),onCheckedChange:e=>l(e?[...new Set([...c,...z.map(e=>e.runDir)])]:c.filter(e=>!z.some(t=>t.runDir===e)))})}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`w-full`),children:`Recording`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`hidden whitespace-nowrap @3xl:table-cell`),children:`Test case`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`hidden @4xl:table-cell`),children:`Browser`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(ot,`hidden whitespace-nowrap @4xl:table-cell`),children:`Duration`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`hidden @xl:table-cell`),children:`Outputs`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`hidden @2xl:table-cell`),children:`Created`}),(0,Y.jsx)(`th`,{scope:`col`,className:f(dt,`w-10`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`More`})})]}),children:z.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?xt:st,"data-state":c.includes(e.runDir)?`selected`:void 0,children:[(0,Y.jsx)(`td`,{className:G,onClick:e=>e.stopPropagation(),children:(0,Y.jsx)(W,{"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:f(G,`max-w-0`),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:ee,size:16,className:`mt-1 flex-none text-muted`,label:`Desktop app`}):e.kind===`mobile`?(0,Y.jsx)(T,{icon:He,size:16,className:`mt-1 flex-none text-muted`,label:`Mobile app`}):(0,Y.jsx)(T,{icon:ge,size:16,className:`mt-1 flex-none text-muted`,label:`Web page`}):(0,Y.jsx)(Qe,{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`):Dt(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":q(e.test).detail,children:(0,Y.jsx)(M,{tone:q(e.test).tone,icon:q(e.test).tone!==`neutral`,className:`min-h-5 px-2 text-body-sm`,children:q(e.test).label})})]})]})}),(0,Y.jsx)(`td`,{className:f(G,`hidden whitespace-nowrap @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:f(G,`hidden whitespace-nowrap text-ink-2 @4xl:table-cell`),children:e.browser??(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:f(ut,`hidden whitespace-nowrap text-ink-2 @4xl:table-cell`),"data-sort":e.seconds??-1,children:e.seconds===void 0?(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`}):Qn(e.seconds)}),(0,Y.jsx)(`td`,{className:f(G,`hidden @xl:table-cell`),children:(0,Y.jsx)(ar,{r:e,onNote:s})}),(0,Y.jsx)(`td`,{className:f(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:at(e.startedAt)}),(0,Y.jsx)(`td`,{className:f(G,`text-right`),children:(0,Y.jsx)(ir,{r:e,onReview:o,onWrite:()=>void de(e.runDir),onDelete:()=>ue(e.runDir),onNote:s})})]},e.runDir)})}),u&&(0,Y.jsx)(it,{open:!0,onClose:()=>p(!1),title:`Delete ${d(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)(D,{variant:`outline`,disabled:m,onClick:()=>p(!1),children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Cancel`]}),(0,Y.jsxs)(D,{busy:m,variant:`destructive`,disabled:m,onClick:()=>void te(),children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),m?`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:[`· `,at(e.startedAt)]})]},e.runDir))})})]})}function sr({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:f(c,`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 cr({sub:e}={}){let[t,r]=(0,J.useState)(null),i=e?.startsWith(`recording/`)||e?.startsWith(`workflow/`)?e.split(`/`):[],a=i[1]?qn(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,l=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`),v=e=>e===`agent`?St:e===`recordings`?`recordings`:`new`,[y,x]=(0,J.useState)(i.length?`recordings`:v(e));(0,J.useEffect)(()=>{x(i.length?`recordings`:v(e))},[e]);let[S,C]=(0,J.useState)(``),[T,E]=(0,J.useState)(!1),O=(0,J.useCallback)(()=>{b.get().then(e=>{r(e),C(``)},e=>C(e.message))},[]);(0,J.useEffect)(O,[O]);let A=!!t?.session&&Pn.has(t.session.state);(0,J.useEffect)(()=>{if(!A)return;let e=gt(O,800);return()=>ct(e)},[A,O]);let j=!!t?.recordings.some(e=>e.test?.state===`writing`||e.test?.state===`checking`);(0,J.useEffect)(()=>{if(!j||A)return;let e=gt(O,4e3);return()=>ct(e)},[j,A,O]);let M=(0,J.useRef)(!1),N=t?.session;(0,J.useEffect)(()=>{A?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),x(e=>e===`agent`?`new`:e))},[A,N]);let P=async e=>{E(!0),C(``);try{r(await e())}catch(e){C(e.message)}finally{E(!1)}},ee=(e,t,r)=>{location.hash=n(`record`),window.scrollTo({top:0,behavior:u()}),P(()=>b.start({more:{run:e,after:t,...r?{redo:r}:{}}}))},F=e=>{m(e),window.scrollTo({top:0})},te=!!N?.result&&!N.result.ok,I=!!c||!!l,L=e=>{h(e),window.scrollTo({top:0})},ne=e=>{x(e),location.hash=e===`new`?n(`record`):n(`record`,e)};return(0,Y.jsxs)(yt,{title:et(`record`),page:g,label:`Record`,current:y,onPick:ne,tabs:[{id:`new`,label:A?`Recording`:`New recording`,icon:le},{id:`recordings`,label:`Recordings`,icon:re,...t?.recordings.length?{n:t.recordings.length}:{}}],below:(0,Y.jsx)(vt,{page:g}),children:[!I&&(0,Y.jsx)(U,{children:`Record a test by stepping through your browser, Windows app or mobile app.`}),S&&(0,Y.jsx)(`p`,{role:`alert`,className:f(w.fail,`m-0`),children:S}),!t&&!S&&(0,Y.jsx)(k,{shape:`lines`}),t&&N&&A&&(0,Y.jsx)(Gn,{s:N,busy:T,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 P(()=>b.playBlock(e,t)),send:e=>void P(()=>b.command(e))}),t&&!A&&c&&(0,Y.jsx)(cn,{runDir:c,notices:N&&N.runDir===c?(0,Y.jsx)(sr,{s:N}):void 0,onRecordMore:(e,t)=>ee(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),x(`recordings`),O()}},c),t&&!A&&l&&(0,Y.jsx)(Lt,{workflow:l,backLabel:`Recordings`,notices:N&&N.kind===`desktop`&&N.result?.workflow===l?(0,Y.jsx)(sr,{s:N}):void 0,tab:p,onTab:e=>location.hash=e===`steps`?n(`record`,`workflow`,encodeURIComponent(l)):n(`record`,`workflow`,encodeURIComponent(l),e),onClose:()=>{h(null),x(`recordings`),O()}},l),t&&!A&&!I&&(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel-${y}`,"aria-labelledby":`rec-${y}`,className:`flex min-w-0 flex-col gap-4`,children:[y===`new`&&(0,Y.jsxs)(Y.Fragment,{children:[te&&(0,Y.jsx)(Kn,{s:N}),N?.result?.ok&&(N.kind===`web`||!!N.result.workflow)&&(0,Y.jsxs)(`div`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-wrap items-center gap-4 text-body-sm`),children:[(0,Y.jsx)(de,{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:[` · `,d(N.steps.length,`step`)]})]}),(0,Y.jsxs)(D,{size:`sm`,onClick:()=>N.kind===`desktop`?L(N.result.workflow):F(N.runDir),"data-tip":`Open the recording`,children:[(0,Y.jsx)(ze,{"aria-hidden":`true`}),`Open`]})]}),(0,Y.jsx)(Xn,{view:t,busy:T,start:e===`agent`||e===`recordings`?void 0:e,onStart:e=>void P(()=>b.start(e))})]}),y===`recordings`&&(t.recordings.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($n,{view:t}),(0,Y.jsx)(or,{rows:t.recordings,onReview:F,onReviewDesktop:L,onDeleted:r,onChanged:O})]}):(0,Y.jsx)(mt,{page:!0,icon:re,title:`No recordings yet`,action:(0,Y.jsxs)(D,{size:`sm`,onClick:()=>ne(`new`),"data-tip":`New recording`,children:[(0,Y.jsx)(re,{"aria-hidden":`true`}),`Record`]}),children:`Record a test's steps once, and it shows here to review, check and turn into a test.`}))]})]})}export{cr as Record};