@capagents/forgeqe 2.8.4 → 2.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forgeqe.js +1476 -1476
- package/dist/web/assets/Agent-D8H4GQqN.js +4 -0
- package/dist/web/assets/ApiTests-CWqanyU_.js +10 -0
- package/dist/web/assets/Chat-C0xpL7po.js +3 -0
- package/dist/web/assets/{CommandPalette-BYvOQjLS.js → CommandPalette-KUx-yMp_.js} +1 -1
- package/dist/web/assets/Cost-CkRettF6.js +1 -0
- package/dist/web/assets/Data-DNzLSp63.js +6 -0
- package/dist/web/assets/Evidence-DzzA0pJV.js +1 -0
- package/dist/web/assets/{Explore-B4RIFQSP.js → Explore-DEpzpdkj.js} +2 -2
- package/dist/web/assets/{Features-PwuXPwsQ.js → Features-Bzje_5As.js} +1 -1
- package/dist/web/assets/Flags-xUvz1QHr.js +2 -0
- package/dist/web/assets/Flaky-BFnVLi7W.js +1 -0
- package/dist/web/assets/{ForceGraph-C_zLHbjL.js → ForceGraph-DVfDfy7Y.js} +1 -1
- package/dist/web/assets/Impact-BvRUudsB.js +3 -0
- package/dist/web/assets/Jobs-DLPS5xnJ.js +5 -0
- package/dist/web/assets/KindPage-BFX76RUt.js +6 -0
- package/dist/web/assets/Migration-64HvSMZo.js +2 -0
- package/dist/web/assets/Product-07coKIAf.js +7 -0
- package/dist/web/assets/Production-Bj_uz9hT.js +1 -0
- package/dist/web/assets/{Quality-BLD_hTzQ.js → Quality-De99Esv0.js} +1 -1
- package/dist/web/assets/{Readiness-BhdZCmc5.js → Readiness-CwdvybGl.js} +1 -1
- package/dist/web/assets/Record-CxbGHIHP.js +2 -0
- package/dist/web/assets/Regression-CRE2UEhg.js +5 -0
- package/dist/web/assets/{Reports-B7_QOXgR.js → Reports-NMLgQnIX.js} +2 -2
- package/dist/web/assets/Response-B_YF1EA8.js +4 -0
- package/dist/web/assets/{RunDiff-oLQoRUYt.js → RunDiff-DF8c2dBn.js} +1 -1
- package/dist/web/assets/Runs-CBuhWb7S.js +2 -0
- package/dist/web/assets/{TestCases-BsY_u_c2.js → TestCases-CKTFzk6l.js} +1 -1
- package/dist/web/assets/TestData-DoYuREXo.js +2 -0
- package/dist/web/assets/TestDebt-Ce7PUROD.js +1 -0
- package/dist/web/assets/Tosca-DBj7j-jL.js +2 -0
- package/dist/web/assets/{WhatsNew-Bw0a6thL.js → WhatsNew-DwoYoM_4.js} +1 -1
- package/dist/web/assets/agentIconBodies-Cpn22UTR.js +1 -0
- package/dist/web/assets/{dataParts-Bwftp_1E.js → dataParts-CsXXLImJ.js} +3 -3
- package/dist/web/assets/{families-CwLTQ9Rz.js → families-D1xiKkTa.js} +1 -1
- package/dist/web/assets/{frame-PaIZHHuH.js → frame-D6-mukAC.js} +4 -4
- package/dist/web/assets/index-CQaKWOwX.js +45 -0
- package/dist/web/assets/index-D2XiTaRH.css +2 -0
- package/dist/web/assets/{logos-UVpBu7FK.js → logos-CAM1NTNS.js} +1 -1
- package/dist/web/assets/{parts-Dxtb4Bbc.js → parts-C-cHoGBa.js} +1 -1
- package/dist/web/assets/{productParts-BOFjMKqP.js → productParts-DxYwA64l.js} +1 -1
- package/dist/web/assets/{qualityParts-B8Ez1Yru.js → qualityParts-BDSq6Q05.js} +1 -1
- package/dist/web/assets/segmented-CqVJLxy-.js +1 -0
- package/dist/web/assets/{thread-tfPSGuU_.js → thread-Cqqn51v8.js} +1 -1
- package/dist/web/assets/{usePageChat-CI-050n8.js → usePageChat-BiWHDk1V.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/web/assets/Agent-BNqNqlnh.js +0 -4
- package/dist/web/assets/ApiTests-CFBsj4t8.js +0 -10
- package/dist/web/assets/Chat-BvvsVyfQ.js +0 -3
- package/dist/web/assets/Cost-CQKzgsB4.js +0 -1
- package/dist/web/assets/Data-Coon55p7.js +0 -6
- package/dist/web/assets/Evidence-Ai0Dptf2.js +0 -1
- package/dist/web/assets/Flags-DWF2JPYv.js +0 -2
- package/dist/web/assets/Flaky-CrqNK0MG.js +0 -1
- package/dist/web/assets/Impact-DrWOOLCh.js +0 -3
- package/dist/web/assets/Jobs-BbMCch6k.js +0 -5
- package/dist/web/assets/KindPage-Qp49_Zba.js +0 -6
- package/dist/web/assets/Migration-nG2ZGz54.js +0 -2
- package/dist/web/assets/Product-ECS4coRw.js +0 -7
- package/dist/web/assets/Production-D5fdXi9r.js +0 -1
- package/dist/web/assets/Record-Dfs6EU9D.js +0 -2
- package/dist/web/assets/Regression-C0-KdOsi.js +0 -5
- package/dist/web/assets/Response-Bk5bwieC.js +0 -4
- package/dist/web/assets/Runs-D-c_Cwvy.js +0 -2
- package/dist/web/assets/TestData-D4qSo30K.js +0 -2
- package/dist/web/assets/TestDebt-D80D911j.js +0 -1
- package/dist/web/assets/Tosca-DVzWEwsl.js +0 -2
- package/dist/web/assets/index-D_Rdwtap.css +0 -2
- package/dist/web/assets/index-uKsXcgSa.js +0 -45
- package/dist/web/assets/segmented-CaCvJJD1.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ai as e,Ao as t,Ar as n,Ca as r,Di as i,Do as a,Ea as o,Fn as s,Ft as c,Ia as l,Ln as u,Mi as d,Mt as f,Ni as p,Nn as m,Oa as h,Ot as g,Pr as _,To as v,Tr as y,Ui as b,Zi as x,_n as S,_t as C,at as w,ca as T,co as E,da as D,dn as O,dt as k,et as A,ft as j,gn as M,gt as N,jt as P,kt as F,ot as I,pt as ee,r as L,t as R,tr as z,tt as B,ut as te,vt as V,yr as ne}from"./frame-D6-mukAC.js";import{c as H,o as re,r as U,u as W}from"./index-CQaKWOwX.js";import{t as G}from"./segmented-CqVJLxy-.js";import{n as ie}from"./families-D1xiKkTa.js";import{a as ae,c as oe,i as se,n as ce,o as K,r as le,s as q,t as ue}from"./logos-CAM1NTNS.js";import{a as de,c as fe,d as pe,f as J,i as me,l as he,n as ge,o as _e,p as ve,r as Y,s as ye,t as be,u as xe}from"./parts-C-cHoGBa.js";var X=t(a(),1),Z=v(),Se={py:`python`,ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,java:`java`,cs:`csharp`,rb:`ruby`};function Ce({path:e}){let t=le[Se[e.split(`.`).pop()?.toLowerCase()||``]||``];return t?(0,Z.jsx)(t,{"aria-hidden":`true`,width:15,height:15,className:`flex-none`}):(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`})}function we(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=t;for(let t of e.slice(0,-1))r.dirs.has(t)||r.dirs.set(t,{name:t,path:r.path?`${r.path}/${t}`:t,dirs:new Map,files:[]}),r=r.dirs.get(t);r.files.push(n)}let n=e=>{for(let[t,r]of[...e.dirs]){let i=n(r);for(;i.files.length===0&&i.dirs.size===1;){let e=[...i.dirs.values()][0];i={...e,name:`${i.name}/${e.name}`}}e.dirs.set(t,i)}return e};return n(t)}function Te({files:e,selected:t,onSelect:r,label:i}){let a=(0,X.useMemo)(()=>we(e),[e]),[o,s]=(0,X.useState)(new Set),c=e=>s(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),l=(e,i)=>(0,Z.jsxs)(Z.Fragment,{children:[[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=!o.has(e.path);return(0,Z.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t,"aria-selected":!1,className:`list-none`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:`flex h-8 w-full cursor-pointer items-center gap-1.5 rounded-[6px] border-0 bg-transparent px-1.5 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(u,{size:14,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform duration-150`,t&&`rotate-90`)}),t?(0,Z.jsx)(_,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}):(0,Z.jsx)(n,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,Z.jsx)(`ul`,{role:`group`,className:`m-0 ml-[13px] border-l border-line-soft p-0 pl-2`,children:l(e,i+1)})]},e.path)}),[...e.files].sort((e,t)=>e.path.localeCompare(t.path)).map(e=>{let n=t===e.id;return(0,Z.jsx)(`li`,{role:`treeitem`,"aria-selected":n,className:`list-none`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r?.(e.id),"data-tip":e.title,className:h(`flex h-8 w-full items-center gap-2 rounded-[6px] border-0 px-1.5 text-left text-[13px]`,r?`cursor-pointer`:`cursor-default`,n?`bg-accent-soft font-medium text-ink`:`bg-transparent text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,Z.jsx)(`span`,{className:`w-[14px] flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(Ce,{path:e.path}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path.slice(e.path.lastIndexOf(`/`)+1)}),e.tail]})},e.id)})]});return(0,Z.jsx)(`ul`,{role:`tree`,"aria-label":i,className:`m-0 flex flex-col p-0`,children:l(a,0)})}function Ee({title:e,side:t,file:n,lang:r,text:i,missing:a}){let o=(i??``).split(`
|
|
2
|
+
`),s=(0,X.useMemo)(()=>i?W(i,r):null,[i,r]);return(0,Z.jsxs)(`figure`,{className:`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Z.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-3`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:t}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2`,"data-tip":n,children:n||e}),i&&(0,Z.jsx)(re,{text:i,label:`Copy ${n||t}`})]}),i?(0,Z.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,Z.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft px-3 py-3 text-right text-muted select-none`,children:o.map((e,t)=>`${t+1}\n`).join(``)}),(0,Z.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-3 py-3`,children:(0,Z.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,Z.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:a||`Nothing to show.`})]})}function De({id:e,plan:t,result:n,initial:r}){let i=new Map((n?.units||[]).map(e=>[e.id,e.status])),a=[...t.units.filter(e=>e.kind!==`setup`).map(e=>({unit:e.id,kind:ge[e.kind],source:e.source,target:e.target,status:i.get(e.id)})),...t.copies.map((e,t)=>({unit:`c${t}`,kind:`Data`,source:e.source,target:e.target,data:!0}))],[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(r||a.find(e=>e.kind===`Test`)?.unit||a[0]?.unit||``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{c&&(p(``),E.pair(e,c).then(d,e=>p(e.message)))},[e,c,n?.units.length,n?.endedAt]);let m=a.filter(e=>!o||`${e.source} ${e.target}`.toLowerCase().includes(o.toLowerCase())),g=a.filter(e=>e.status===`migrated`).length,_=a.filter(e=>e.status===`failed`||e.status===`blocked`).length;return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-4 @4xl:h-[calc(var(--screen)-320px)] @4xl:min-h-[540px] @4xl:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`nav`,{"aria-label":`Files`,className:`flex max-h-[360px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-3 @4xl:max-h-none`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:`Files`}),(0,Z.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[g,` migrated · `,_,` failed · `,a.length,` files`]})]}),(0,Z.jsx)(te,{id:`find-a-file`,label:`Find a file`,value:o,onChange:s,className:`max-w-none flex-none`}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m.length?(0,Z.jsx)(Te,{label:`Files`,selected:c,onSelect:l,files:m.map(e=>({id:e.unit,path:e.target,title:e.source?`from ${e.source}`:void 0,tail:(0,Z.jsx)(`span`,{role:`img`,"aria-label":e.status?fe[e.status].label:e.data?`Copied`:`Waiting`,className:h(`size-2 flex-none rounded-full`,e.status===`migrated`?`bg-pass`:e.status===`failed`?`bg-fail`:e.status===`blocked`?`bg-warn`:e.status===`written`?`bg-line-strong`:`bg-line`)})}))}):(0,Z.jsx)(`p`,{className:`m-0 px-2 py-3 text-[13px] text-muted`,children:`No file matches.`})})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-3`,children:[f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:f}),(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-3 @3xl:grid-cols-2`,children:[(0,Z.jsx)(Ee,{title:`Source`,side:`Source`,file:u?.source?.path,lang:u?.source?.lang||`plaintext`,text:u?.source?.text,missing:u&&!u.source?`This file is made new for the target.`:void 0}),(0,Z.jsx)(Ee,{title:`Target`,side:`Migrated`,file:u?.target.path,lang:u?.target.lang||`plaintext`,text:u?.target.text,missing:u&&!u.target.exists?`Not written yet.`:void 0})]})]})]})}var Oe=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function ke(e){if(e.job?.running)return{label:e.job.kind===`verify`?`Validating`:e.job.kind===`fix`?`Fixing`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:t.stage===`fix`?`Fixing`:`Running`,tone:`running`}:t?me[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:he[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function Ae({id:e,title:t,targetDir:n,onClose:r}){let[i,a]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{await E.delete(e,i),location.hash=f(`migration`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(P,{open:!0,onClose:r,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${n} stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(o,{variant:`ghost`,onClick:r,children:`Keep it`}),(0,Z.jsxs)(o,{variant:`danger`,disabled:s||i!==e,onClick:()=>void d(),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Z.jsx)(k,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function je({d:e,planView:t}){let n=e.result;if(!n)return(0,Z.jsx)(Z.Fragment,{children:t});let r=new Map(n.units.map(e=>[e.id,e])),i=e.plan.units.filter(e=>e.kind===`test`),a=n.units.filter(e=>e.kind===`test`&&e.status===`migrated`).length,o=e.plan.units.filter(e=>e.kind!==`setup`),s=n.units.filter(e=>e.kind!==`setup`&&(e.status===`migrated`||e.status===`written`)).length,c=n.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,l=e.plan.source.stack,[u,...d]=e.plan.target.id.split(`-`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(Y,{label:`Tests passing`,value:`${a} / ${i.length}`,tone:a===i.length&&i.length?`text-pass`:void 0}),(0,Z.jsx)(Y,{label:`Files migrated`,value:`${s} / ${o.length}`}),(0,Z.jsx)(Y,{label:`Need attention`,value:c,tone:c?`text-fail`:void 0}),(0,Z.jsx)(Y,{label:n.status===`running`?`Running for`:`Took`,value:pe(n.status===`running`?Date.now()-Date.parse(n.startedAt):n.ms)})]}),n.notes&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n.notes}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(A,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-2 pr-3 pl-3 font-medium`,children:`File`}),(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-2 pr-3 font-medium @3xl:table-cell`,children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?fe[t.status]:null;return(0,Z.jsxs)(`tr`,{className:w,children:[(0,Z.jsxs)(`td`,{className:B,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.kind===`setup`?`Project set-up`:Q(e.target)}),(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.source?`from ${Q(e.source)}`:e.target})]}),(0,Z.jsx)(`td`,{className:h(B,`whitespace-nowrap`),children:n?(0,Z.jsx)(N,{tone:n.tone,children:n.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`})}),(0,Z.jsx)(`td`,{className:h(B,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:t?.problems?.[0]||t?.reason||``})})]},e.id)})}),(0,Z.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[l&&(0,Z.jsx)(q,{framework:l.framework,language:l.language}),e.plan.source.title]}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,Z.jsx)(K,{kind:e.origin.kind,label:e.origin.label,size:15}),(0,Z.jsxs)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:[J(e.origin.label),e.origin.branch?` · ${e.origin.branch}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:u,language:d.join(`-`)}),e.plan.target.title]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.targetPath})]}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Z.jsx)(`dd`,{className:`m-0 text-right`,children:ve(n.startedAt)}),n.model&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Z.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":n.model,children:n.model})]}),n.reverted.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Z.jsxs)(`dd`,{className:`m-0 text-right`,children:[n.reverted.length,` edits outside the target`]})]})]})]})]})]})}function Me({d:e,events:t,picked:n,setPicked:r,busy:i,working:a,onFix:s,onCheck:l}){let[u,f]=(0,X.useState)(``),p=(0,X.useRef)(null),m=e.result?.validation?.tests||[],g=m.filter(e=>!e.ok),_=[];for(let t of e.result?.fixes||[])t.auto||_.push({who:`you`,text:t.note?`${t.note}`:`Fix ${Q(t.target)}`,at:t.at,detail:t.note?`for ${Q(t.target)}`:void 0}),_.push({who:`agent`,tone:t.ok?`ok`:`fail`,at:t.at,text:t.ok?`${Q(t.target)} passes now${t.attempts>1?` (${t.attempts} tries)`:``}. ${t.reason||``}`.trim():`I could not make ${Q(t.target)} pass. ${t.problems?.[0]||t.reason||``}`.trim(),detail:t.auto?`after the first check`:void 0});let v=a?t.filter(e=>e.stage===`fix`&&(e.kind===`agent`||e.kind===`ok`||e.kind===`fail`||e.kind===`info`)).slice(-6):[];(0,X.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[_.length,v.length]);let y=()=>{let e=[...n];e.length&&(s(e,u.trim()),f(``))},x=e=>{let t=new Set(n);t.has(e)?t.delete(e):t.add(e),r(t)};return(0,Z.jsxs)(`section`,{"aria-label":`Migration agent`,className:`flex h-[560px] min-h-0 min-w-0 flex-col overflow-hidden rounded-[14px] card border @5xl:h-full`,children:[(0,Z.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-line-soft px-4 py-3`,children:[(0,Z.jsx)(c,{agent:`forgeqe-migrate`,px:28,working:a,decorative:!0}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:`Migration agent`}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted`,children:a?`Working on it…`:g.length?`${g.length} test${g.length===1?``:`s`} to fix`:`Every test passes`})]}),(0,Z.jsxs)(o,{size:`sm`,variant:`ghost`,disabled:i,onClick:l,"data-tip":`Run every migrated test again`,children:[(0,Z.jsx)(d,{"aria-hidden":`true`}),`Run tests`]})]}),(0,Z.jsxs)(`ol`,{ref:p,"aria-live":`polite`,className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-3 overflow-y-auto bg-surface-muted p-4`,children:[!_.length&&!v.length&&(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] bg-bg p-3 text-[13px] text-ink-2`,children:[(0,Z.jsx)(`span`,{children:`I fix migrated tests that fail. Pick the tests below and tell me what you know, or just send.`}),g.length>0&&(0,Z.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>s(g.map(e=>e.id),``),className:`self-start rounded-[8px] border-0 bg-surface-strong px-2.5 py-1.5 text-[13px] font-medium text-ink hover:bg-line disabled:opacity-50`,children:`Fix all failing tests`})]}),_.map((e,t)=>(0,Z.jsxs)(`li`,{className:h(`flex max-w-[92%] flex-col gap-1`,e.who===`you`?`self-end items-end`:`self-start`),children:[(0,Z.jsxs)(`span`,{className:h(`rounded-[12px] px-3 py-2 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,e.who===`you`?`bg-accent text-accent-ink`:e.tone===`fail`?`border border-fail-soft bg-bg text-ink`:`bg-bg text-ink`),children:[e.who===`agent`&&(0,Z.jsx)(`span`,{className:h(`mr-1 font-semibold`,e.tone===`ok`?`text-pass`:`text-fail`),children:e.tone===`ok`?`✓`:`✗`}),e.text]}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted`,children:[e.detail?`${e.detail} · `:``,U(e.at)]})]},t)),v.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex max-w-[92%] items-start gap-2 self-start rounded-[12px] bg-bg px-3 py-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:h(`flex-none`,e.kind===`ok`?`text-pass`:e.kind===`fail`?`text-fail`:`text-muted`),children:e.kind===`ok`?`✓`:e.kind===`fail`?`✗`:`•`}),(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text})]},`live-${t}`))]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t border-line-soft p-3`,children:[m.length>0&&(0,Z.jsx)(`div`,{role:`group`,"aria-label":`Tests to fix`,className:`flex flex-wrap gap-1.5`,children:m.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":n.has(e.id),onClick:()=>x(e.id),className:h(`inline-flex min-h-7 items-center gap-1.5 rounded-full border px-2.5 text-[12px]`,n.has(e.id)?`border-accent bg-accent-soft text-ink`:`border-line-soft bg-bg text-ink-2 hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:h(`size-1.5 rounded-full`,e.ok?`bg-pass`:`bg-fail`)}),Q(e.target)]},e.id))}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsx)(ee,{"aria-label":`Message to the agent`,value:u,rows:2,maxLength:2e3,placeholder:n.size?`What should change? (optional)`:`Pick a test above first`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!i&&n.size&&(e.preventDefault(),y())},className:`min-h-[44px] flex-1 resize-none`}),(0,Z.jsx)(o,{variant:`primary`,size:`icon`,"aria-label":`Send to the agent`,disabled:i||!n.size,onClick:y,children:(0,Z.jsx)(b,{"aria-hidden":`true`})})]})]})]})}var Ne=`@5xl:h-[calc(var(--screen)-320px)] @5xl:min-h-[540px]`;function Pe({d:e,events:t,busy:n,working:i,onFix:a,onCheck:s,onCompare:c}){let l=e.result?.validation?.tests||[],u=e.result?.fixes||[],d=l.filter(e=>!e.ok).map(e=>e.id).join(`,`),[f,p]=(0,X.useState)(()=>l.find(e=>!e.ok)?.id||l[0]?.id||``),[m,g]=(0,X.useState)(()=>new Set(l.filter(e=>!e.ok).map(e=>e.id)));(0,X.useEffect)(()=>g(new Set(d?d.split(`,`):[])),[d]);let _=l.find(e=>e.id===f),v=_&&[...u].reverse().find(e=>e.id===_.id);return l.length?(0,Z.jsxs)(`div`,{className:h(`grid grid-cols-[minmax(0,1fr)] gap-5 @5xl:grid-cols-[minmax(0,1fr)_380px]`,Ne),children:[(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`relative flex-none overflow-x-auto rounded-[12px] card border`,children:(0,Z.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{className:`bg-surface-strong text-left text-[12px] text-muted`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`px-4 py-2.5 font-medium`,children:[`Test `,(0,Z.jsxs)(`span`,{className:`font-normal`,children:[`· `,l.filter(e=>e.ok).length,` of `,l.length,` pass`]})]}),(0,Z.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Result`}),(0,Z.jsx)(`th`,{className:`hidden px-3 py-2.5 font-medium @2xl:table-cell`,children:`Kept from the source`}),(0,Z.jsx)(`th`,{className:`hidden px-3 py-2.5 text-right font-medium @3xl:table-cell`,children:`Time`})]})}),(0,Z.jsx)(`tbody`,{children:l.map(e=>{let t=[...u].reverse().find(t=>t.id===e.id);return(0,Z.jsxs)(`tr`,{onClick:()=>p(e.id),"aria-selected":f===e.id,className:h(`cursor-pointer border-t border-line-soft`,f===e.id?`bg-accent-soft`:`hover:bg-surface-muted`),children:[(0,Z.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>p(e.id),className:`cursor-pointer border-0 bg-transparent p-0 text-left font-medium text-ink`,children:Q(e.target)}),t&&(0,Z.jsx)(`span`,{className:h(`block text-[12px]`,t.ok?`text-pass`:`text-muted`),children:t.ok?`Fixed by the agent`:`The agent could not fix it`})]}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 whitespace-nowrap`,children:(0,Z.jsx)(N,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,Z.jsxs)(`td`,{className:`hidden px-3 py-2.5 text-[13px] whitespace-nowrap text-ink-2 @2xl:table-cell`,children:[(0,Z.jsxs)(`span`,{className:e.after.tests<e.before.tests?`text-fail`:void 0,children:[e.after.tests,`/`,e.before.tests,` tests`]}),` · `,(0,Z.jsxs)(`span`,{className:e.after.assertions<e.before.assertions?`text-warn`:void 0,children:[e.after.assertions,`/`,e.before.assertions,` checks`]})]}),(0,Z.jsx)(`td`,{className:`hidden px-3 py-2.5 text-right text-[13px] text-muted tabular-nums @3xl:table-cell`,children:e.ms?pe(e.ms):`–`})]},e.id)})})]})}),_&&(0,Z.jsxs)(`section`,{"aria-label":`${Q(_.target)} details`,className:`flex min-h-[260px] flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:Q(_.target)}),(0,Z.jsx)(N,{tone:_.ok?`pass`:`fail`,children:_.ok?`Passes`:_.exitCode===null&&_.ms?`Timed out`:`Fails`}),_.source&&(0,Z.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`from `,Q(_.source)]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(o,{size:`sm`,variant:`ghost`,onClick:()=>c(_.id),children:[(0,Z.jsx)(z,{"aria-hidden":`true`}),`Compare`]}),!_.ok&&(0,Z.jsxs)(o,{size:`sm`,disabled:n,onClick:()=>g(new Set([_.id])),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),`Fix`]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto bg-surface-muted px-4 py-3`,children:[_.problems.length>0&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:_.problems.join(` `)}),v&&(0,Z.jsxs)(`p`,{className:h(`m-0 text-[13px]`,v.ok?`text-pass`:`text-ink-2`),children:[v.ok?`Fixed by the agent`:`The agent could not fix it`,v.reason?`: ${v.reason}`:`.`]}),_.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,_.command]}),(0,Z.jsx)(`pre`,{className:`m-0 flex-1 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:_.output||(_.ok?`${_.after.tests} test${_.after.tests===1?``:`s`} passed in ${pe(_.ms)}.`:`No output.`)})]})]})]}),(0,Z.jsx)(Me,{d:e,events:t,picked:m,setPicked:g,busy:n,working:i,onFix:a,onCheck:s})]}):(0,Z.jsx)(C,{center:!0,className:`py-6`,children:e.result?`The tests are checked once every file is migrated.`:`Start the migration first.`})}var Fe={ok:{mark:`✓`,cls:`text-pass`},fail:{mark:`✗`,cls:`text-fail`},info:{mark:`•`,cls:`text-muted`},agent:{mark:`•`,cls:`text-accent-fg`},tool:{mark:`·`,cls:`text-muted`}};function Ie({events:e,running:t}){let n=(0,X.useRef)(null);(0,X.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,Z.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto rounded-[12px] card border p-0`,children:[r.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-[64px] flex-none text-[12px] text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:h(`w-3 flex-none text-center`,Fe[e.kind].cls),children:Fe[e.kind].mark}),(0,Z.jsx)(`span`,{className:h(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:`text-ink-2`),children:e.text})]},t)),!r.length&&(0,Z.jsx)(`li`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`Nothing yet.`})]})}function Le({id:e,plan:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[s,c]=(0,X.useState)(`overview`),[l,u]=(0,X.useState)(),[p,m]=(0,X.useState)([]),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),C=(0,X.useRef)(0),w=(0,X.useCallback)(()=>{E.detail(e).then(e=>{r(e),a(``)},e=>a(e.message)),E.events(e,C.current).then(e=>{e.next<C.current?(C.current=0,m([])):(C.current=e.next,e.events.length&&m(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,X.useEffect)(w,[w]);let D=!!(n?.job?.running||n?.result?.status===`running`);(0,X.useEffect)(()=>{if(!D)return;let e=setInterval(w,1500);return()=>clearInterval(e)},[D,w]);let O=async e=>{v(!0),a(``);try{r(await e()),setTimeout(w,800)}catch(e){a(e.message)}finally{v(!1)}};if(!n)return i?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let k=ke(n),A=xe(n.plan,n.result),j=n.result,F=(j?.validation?.tests||[]).filter(e=>!e.ok).length,I=[{id:`overview`,label:`Overview`},{id:`tests`,label:`Tests`,n:j?.validation?`${j.validation.tests.length-F}/${j.validation.tests.length}`:void 0,tone:F?`text-fail`:void 0},{id:`compare`,label:`Compare`},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:f(`migration`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(M,{size:16,"aria-hidden":`true`}),`Migration`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n.plan.source.stack&&(0,Z.jsx)(q,{framework:n.plan.source.stack.framework,language:n.plan.source.stack.language,size:22}),n.plan.source.title]}),(0,Z.jsx)(S,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(q,{framework:n.plan.target.id.split(`-`)[0],language:n.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),n.plan.target.title]})]}),(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,Z.jsx)(K,{kind:n.origin.kind,label:n.origin.label,size:15}),(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:J(n.origin.label)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{children:[`into `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:n.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(N,{tone:k.tone,children:k.label}),D?(0,Z.jsxs)(o,{variant:`danger`,disabled:_,onClick:()=>void O(()=>E.stop(e)),children:[(0,Z.jsx)(x,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,Z.jsxs)(Z.Fragment,{children:[j?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(o,{variant:`ghost`,onClick:()=>E.report(e).then(e=>g(e.text),()=>g(``)),children:`Report`}),(0,Z.jsxs)(o,{disabled:_,onClick:()=>void O(()=>E.verify(e)),children:[(0,Z.jsx)(d,{"aria-hidden":`true`}),`Check again`]})]}):null,(0,Z.jsxs)(o,{variant:`ghost`,disabled:_,onClick:()=>b(!0),"data-tip":`Remove this plan from the list. Converted tests stay.`,children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Delete`]})]})]})]}),y&&(0,Z.jsx)(Ae,{id:e,title:`${n.plan.source.title} → ${n.plan.target.title}`,targetDir:n.plan.target.dir,onClose:()=>b(!1)}),j&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(de,{ids:Oe,states:j.stages})}),D&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(A)}% done`,children:[Math.round(A),`%`]})]}),i&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),(0,Z.jsx)(ye,{tabs:I,tab:s,onTab:c,label:`Migration`}),(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${s}`,"aria-labelledby":`mtab-${s}`,className:`flex min-w-0 flex-col gap-4`,children:[s===`overview`&&(0,Z.jsx)(je,{d:n,planView:t(n)}),s===`tests`&&(0,Z.jsx)(Pe,{d:n,events:p,busy:_||D,working:D,onFix:(t,n)=>void O(()=>E.fix(e,t,n)),onCheck:()=>void O(()=>E.verify(e)),onCompare:e=>(u(e),c(`compare`))}),s===`compare`&&(0,Z.jsx)(De,{id:e,plan:n.plan,result:j,initial:l}),s===`activity`&&(0,Z.jsx)(Ie,{events:p,running:D})]}),(0,Z.jsx)(P,{open:h!==null,onClose:()=>g(null),wide:!0,title:`Report`,description:`migrate.md for ${n.plan.id}`,footer:(0,Z.jsx)(o,{onClick:()=>g(null),children:`Close`}),children:h?(0,Z.jsx)(H,{text:h}):(0,Z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var Re=[{id:`git`,label:`Git`},{id:`folder`,label:`Folder`},{id:`upload`,label:`Upload`},{id:`paste`,label:`Paste`},{id:`project`,label:`This project`}],ze=[`Source`,`Target`,`Instructions`,`Review`],Be=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`],Ve=[`Where the tests are`,`Framework and language`,`Your rules, optional`,`Check and start`];function He({at:e,reached:t,onGo:n}){return(0,Z.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Z.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:ze.map((r,i)=>{let a=i<=t,o=i===e,s=i<t&&!o;return(0,Z.jsxs)(`li`,{className:h(`flex items-center gap-2`,i<ze.length-1&&`flex-1`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:!a,"aria-current":o?`step`:void 0,onClick:()=>n(i),"aria-label":r,"data-tip":Ve[i],className:h(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,a&&!o?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:h(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums`,s?`bg-pass text-white`:o?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:s?(0,Z.jsx)(m,{size:13,strokeWidth:3}):i+1}),(0,Z.jsx)(`span`,{className:h(o?`font-medium text-ink`:a?`text-ink-2`:`text-muted`,!o&&`hidden @xl:inline`),children:r})]}),i<ze.length-1&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,Z.jsx)(`span`,{className:h(`block h-full rounded-full bg-pass transition-[width] duration-500`,i<t?`w-full`:`w-0`)})})]},r)})})})}function $({id:e,label:t,help:n,children:r}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function Ue({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Z.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-3 border-t border-line-soft bg-bg py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Z.jsx)(o,{variant:`ghost`,disabled:e,onClick:t,children:`Back`}),(0,Z.jsx)(o,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function We({d:e}){let t=e.counts,n=[`${t.tests} test file${t.tests===1?``:`s`}`,`${t.support} support file${t.support===1?``:`s`}`,...t.features?[`${t.features} feature file${t.features===1?``:`s`}`]:[],...t.data?[`${t.data} data file${t.data===1?``:`s`}`]:[]];return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[e.stack?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:e.stack.framework,language:e.stack.language}),e.title]}):(0,Z.jsx)(N,{tone:`warn`,children:`Framework not detected`}),(0,Z.jsx)(`span`,{className:`text-ink-2`,children:n.join(` · `)}),t.skipped>0&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`· `,t.skipped,` left out (links, large files)`]})]})}async function Ge(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await E.files(e,r),o+=r.length,n(o),r=[],i=0)};for(let e of t){let t=e.webkitRelativePath||``,n=t&&t.split(`/`).slice(1).join(`/`)||e.name,a=new Uint8Array(await e.arrayBuffer()),o=``;for(let e=0;e<a.length;e+=32768)o+=String.fromCharCode(...a.subarray(e,e+32768));let c=btoa(o);i+c.length>8388608&&await s(),r.push({path:n,data:c}),i+=c.length}return await s(),a}var Ke=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function qe({view:t,kind:n,setKind:r,src:i,setSrc:a,from:s,setFrom:c,stack:u,setStack:d,found:f,setFound:p}){let[m,g]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(``),[w,D]=(0,X.useState)(t.credentials),[O,A]=(0,X.useState)(null),[M,P]=(0,X.useState)(``),[F,I]=(0,X.useState)([{path:``,text:``}]),[L,R]=(0,X.useState)(``),[z,B]=(0,X.useState)(``),[te,V]=(0,X.useState)(``),H=(0,X.useRef)(null),re=(0,X.useRef)(null);(0,X.useEffect)(()=>{H.current?.setAttribute(`webkitdirectory`,``)},[n,i]);let U=i?.workspace,W=async(e,t)=>{R(e),B(``),V(``);try{await t()}catch(e){B(e.message)}finally{R(``)}},G=e=>{a(e),c(`.`),p(e.discovery)};(0,X.useEffect)(()=>{if(n!==`project`)return;let e=setTimeout(()=>E.discover(void 0,s||`.`).then(p,()=>p(null)),300);return()=>clearTimeout(e)},[n,s,p]);let ie=e=>{let t=e.filter(e=>!Ke(e));if(!t.length)return B(`Nothing to send: every file is hidden or a dependency.`);W(`upload`,async()=>{let n=e[0],r=await E.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:`${t.length} files`});await Ge(r.workspace.id,t,e=>V(`Sending ${e} of ${t.length} files…`)),G(await E.finish(r.workspace.id))})},le=n===`project`||!!U?.ready;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Where the tests come from`,className:`flex w-fit max-w-full gap-1 overflow-x-auto rounded-[10px] bg-surface-strong p-1`,children:Re.map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e.id,onClick:()=>{e.id!==n&&(r(e.id),a(null),p(null),B(``),c(e.id===`project`?``:`.`))},className:h(`inline-flex min-h-9 flex-none cursor-pointer items-center gap-2 rounded-[7px] border-0 px-3 text-sm font-medium`,n===e.id?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,Z.jsx)(se,{logo:ae[e.id].Logo,icon:ae[e.id].Icon,size:16}),e.label]},e.id))}),z&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:z}),U?.ready?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsx)(K,{kind:U.kind,label:U.label,size:22}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:J(U.label)}),U.branch&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,U.branch]}),(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,U.files,` files`]})]}),(0,Z.jsx)(N,{tone:`pass`,children:`Ready`}),(0,Z.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>(a(null),p(null)),children:`Change`})]}):n===`git`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)($,{id:`mig-url`,label:`Repository URL`,help:(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[`Works with `,ce.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(se,{logo:e.Logo,size:14}),e.name]},e.name)),` and any git server over https or ssh.`]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(`span`,{className:`relative min-w-0 flex-[1_1_300px]`,children:[(0,Z.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,Z.jsx)(se,{logo:oe(m).Logo,size:18})}),(0,Z.jsx)(k,{id:`mig-url`,value:m,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(g(e.target.value),x(null)),className:`w-full pl-10`})]}),(0,Z.jsx)(o,{disabled:!!L||!m.trim(),onClick:()=>void W(`test`,async()=>{let e=await E.testRepository(m.trim(),S||void 0);x(e.branches),!v&&e.head&&y(e.head),V(`Connected · ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:L===`test`?`Testing…`:`Test connection`})]})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-branch`,label:`Branch`,children:b?.length?(0,Z.jsx)(j,{id:`mig-branch`,value:v,onChange:e=>y(e.target.value),children:b.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))}):(0,Z.jsx)(k,{id:`mig-branch`,value:v,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>y(e.target.value)})}),(0,Z.jsx)($,{id:`mig-token`,label:`Access token`,help:O?void 0:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>A({name:`GIT_TOKEN`,value:``}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:`Add a token`}),children:(0,Z.jsxs)(j,{id:`mig-token`,value:S,onChange:e=>C(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),w.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})})]}),O&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,Z.jsx)($,{id:`mig-token-name`,label:`Name`,children:(0,Z.jsx)(k,{id:`mig-token-name`,value:O.name,spellCheck:!1,maxLength:64,onChange:e=>A({...O,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,Z.jsx)($,{id:`mig-token-value`,label:`Token`,children:(0,Z.jsx)(k,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:O.value,onChange:e=>A({...O,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,Z.jsx)(o,{disabled:!!L||!O.name||!O.value,onClick:()=>void W(`token`,async()=>{await l.saveSecrets({[O.name]:O.value}),D([...new Set([...w,O.name])].sort()),C(O.name),A(null)}),children:`Save`}),(0,Z.jsx)(o,{variant:`ghost`,onClick:()=>A(null),children:`Cancel`}),(0,Z.jsx)(`span`,{className:`w-full text-[12.5px] text-muted`,children:`Kept in ForgeQE's credential store, never in the URL or on this page.`})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(o,{variant:`primary`,disabled:!!L||!m.trim(),onClick:()=>void W(`clone`,async()=>G(await E.source({kind:`git`,url:m.trim(),...v?{branch:v}:{},...S?{tokenVar:S}:{}}))),children:L===`clone`?`Cloning…`:`Clone`})})]}):n===`folder`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)($,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,Z.jsx)(k,{id:`mig-folder`,value:M,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>P(e.target.value)})}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(o,{variant:`primary`,disabled:!!L||!M.trim(),onClick:()=>void W(`copy`,async()=>G(await E.source({kind:`folder`,folder:M.trim()}))),children:L===`copy`?`Copying…`:`Use this folder`})})]}):n===`upload`?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-[14px] border border-dashed border-line px-6 py-10 text-center`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Choose a folder of tests, or some files.`}),(0,Z.jsx)(`input`,{ref:H,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&ie([...e.target.files])}),(0,Z.jsx)(`input`,{ref:re,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&ie([...e.target.files])}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,Z.jsxs)(o,{variant:`primary`,disabled:!!L,onClick:()=>H.current?.click(),children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Choose a folder`]}),(0,Z.jsxs)(o,{disabled:!!L,onClick:()=>re.current?.click(),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Choose files`]})]})]}):n===`paste`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[F.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(k,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>I(F.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px]`}),F.length>1&&(0,Z.jsx)(o,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,onClick:()=>I(F.filter((e,n)=>n!==t)),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})]}),(0,Z.jsx)(ee,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>I(F.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(o,{variant:`ghost`,onClick:()=>I([...F,{path:``,text:``}]),children:[(0,Z.jsx)(e,{"aria-hidden":`true`}),`Add a file`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(o,{variant:`primary`,disabled:!!L||F.some(e=>!e.path.trim()||!e.text.trim()),onClick:()=>void W(`paste`,async()=>{let e=await E.source({kind:`paste`});await E.files(e.workspace.id,F.map(e=>({path:e.path.trim(),text:e.text}))),G(await E.finish(e.workspace.id))}),children:L===`paste`?`Adding…`:`Use this code`})]})]}):null,te&&!z&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:te}),le&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-from`,label:`Tests folder`,children:n===`project`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{id:`mig-from`,list:`mig-folders`,value:s,spellCheck:!1,maxLength:300,placeholder:`Whole project`,onChange:e=>c(e.target.value)}),(0,Z.jsx)(`datalist`,{id:`mig-folders`,children:t.folders.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]}):(0,Z.jsxs)(j,{id:`mig-from`,value:s||`.`,onChange:e=>(c(e.target.value),U&&E.discover(U.id,e.target.value).then(p,()=>{})),children:[(0,Z.jsx)(`option`,{value:`.`,children:`All of it`}),(i?.folders||[]).map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}),(0,Z.jsx)($,{id:`mig-stack`,label:`Framework`,children:(0,Z.jsxs)(j,{id:`mig-stack`,value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:f?.stack?`${f.title} (detected)`:`Detect`}),t.sources.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})})]}),f&&(0,Z.jsx)(We,{d:f})]})]})}function Je({on:e,onPick:t,logo:n,title:r,sub:i,label:a}){return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":a,onClick:t,className:h(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-3 rounded-[12px] border px-3.5 py-3 text-left transition-colors`,e?`border-accent bg-accent-soft ring-1 ring-accent`:`border-line-soft bg-bg hover:border-line hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{className:`inline-flex size-9 flex-none items-center justify-center rounded-[10px] bg-surface-muted`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:i})]})]})}var Ye={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function Xe({view:t,to:n,setTo:r,other:i,setOther:a,into:o,setInto:s,only:c,setOnly:l}){let u=e=>e.split(`-`)[0],d=e=>e.split(`-`).slice(1).join(`-`),f=[...new Map(t.targets.map(e=>[u(e.id),e.framework])).entries()],p=i===null?u(n):``,m=t.targets.filter(e=>u(e.id)===p);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Framework`}),(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:[f.map(([e,i])=>{let o=ue[e];return(0,Z.jsx)(Je,{on:p===e,onPick:()=>(a(null),r((t.targets.find(t=>u(t.id)===e&&d(t.id)===d(n))||t.targets.find(t=>u(t.id)===e)).id)),logo:o?(0,Z.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:i,sub:Ye[e],label:i},e)}),(0,Z.jsx)(Je,{on:i!==null,onPick:()=>a(i??``),logo:(0,Z.jsx)(e,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),i===null?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Language`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:m.map(e=>{let t=le[d(e.id)];return(0,Z.jsx)(Je,{on:n===e.id,onPick:()=>r(e.id),logo:t?(0,Z.jsx)(t,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.title.includes(`(`)&&e.title.slice(e.title.indexOf(`(`)+1,-1).replace(e.language,``).replace(/^,\s*/,``)||void 0,label:e.language},e.id)})})]}):(0,Z.jsx)($,{id:`mig-other`,label:`Which framework and language?`,help:`ForgeQE checks it against what it can run, and says so before anything starts.`,children:(0,Z.jsx)(k,{id:`mig-other`,value:i,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>a(e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,Z.jsx)(k,{id:`mig-into`,value:o,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>s(e.target.value)})}),(0,Z.jsx)($,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,Z.jsx)(k,{id:`mig-only`,value:c,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>l(e.target.value)})})]})]})}function Ze({view:e,kind:t,src:n,found:r,to:i,other:a,instructions:o}){let s=e.targets.find(e=>e.id===i),c=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,Z.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-5`,children:[c(`Source`,n?.workspace?.ready||t===`project`&&r?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(K,{kind:n?.workspace?.kind||`project`,label:n?.workspace?.label,size:18}),(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:n?.workspace?J(n.workspace.label):`This project`})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),c(`Tests found`,r?.stack?(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:r.stack.framework,language:r.stack.language}),r.title]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[r.counts.tests,` test files · `,r.counts.support,` support files`]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})),c(`Target`,a===null?s?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:s.id.split(`-`)[0],language:s.id.split(`-`).slice(1).join(`-`)}),s.title]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`}):(0,Z.jsx)(`span`,{className:a.trim()?`font-medium`:`text-muted`,children:a.trim()||`Type it in`})),c(`Instructions`,o.trim()?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:o.trim()}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function Qe({view:t,review:n,onStart:r}){let[a,o]=(0,X.useState)(0),[s,c]=(0,X.useState)(0),[l,u]=(0,X.useState)(`git`),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(`.`),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(t.targets[0]?.id||``),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[T,D]=(0,X.useState)(``),[k,A]=(0,X.useState)(``),[j,M]=(0,X.useState)(null),[N,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(!1),[L,R]=(0,X.useState)(``);(0,X.useEffect)(()=>{M(null),P(!1),c(e=>Math.min(e,2))},[l,d,p,h,T,y,x,C,k]);let z=e=>{o(e),c(t=>Math.max(t,e)),R(``)},B=l===`project`||!!d?.workspace?.ready,te=async()=>{I(!0),R(``);try{let e=await E.plan({...l!==`project`&&d?.workspace?{workspace:d.workspace.id}:{},...p.trim()&&p!==`.`?{from:p.trim()}:{},...h?{stack:h}:{},...x===null?{to:y}:{to:``,toText:x.trim()},...C.trim()?{into:C.trim()}:{},...T.trim()?{only:T.trim()}:{},...k.trim()?{instructions:k.trim()}:{}});M(e),z(3)}catch(e){R(e.message)}finally{I(!1)}},V=j?.plan,ne=V?.feasibility.findings.some(e=>e.level===`limit`),H=V?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsx)(He,{at:a,reached:s,onGo:e=>!F&&(e<3||j)&&o(e)}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsx)(`h2`,{id:`mig-step`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:[`Where are the tests?`,`What should they become?`,`Anything the agent should know?`,`Review and start`][a]}),L&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:L}),a===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qe,{view:t,kind:l,setKind:u,src:d,setSrc:f,from:p,setFrom:m,stack:h,setStack:g,found:_,setFound:v}),(0,Z.jsx)(Ue,{busy:F,next:`Continue`,onNext:()=>z(1),disabled:!B})]}),a===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Xe,{view:t,to:y,setTo:b,other:x,setOther:S,into:C,setInto:w,only:T,setOnly:D}),(0,Z.jsx)(Ue,{busy:F,onBack:()=>o(0),next:`Continue`,onNext:()=>z(2),disabled:x===null?!y:!x.trim()})]}),a===2&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{id:`mig-instructions`,label:`Instructions (optional)`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,Z.jsx)(ee,{id:`mig-instructions`,value:k,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>A(e.target.value)})}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Be.map(t=>(0,Z.jsxs)(`button`,{type:`button`,disabled:k.includes(t),onClick:()=>A(k.trim()?`${k.trim()}\n${t}`:t),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-2.5 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Z.jsx)(e,{size:13,"aria-hidden":`true`}),t]},t))}),(0,Z.jsx)(Ue,{busy:F,onBack:()=>o(1),next:F?`Checking…`:`Check the plan`,onNext:()=>void te(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),a===3&&V&&(0,Z.jsxs)(Z.Fragment,{children:[n(V,N,P),(0,Z.jsx)(Ue,{busy:F,onBack:()=>o(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O,{icon:i,size:15}),`Start migration`]}),disabled:H||ne&&!N,onNext:()=>r(j,!!ne&&N),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:H?`Change what is not possible first.`:ne&&!N?`Accept the limits to start.`:`Runs in the background.`})})]})]}),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(Ze,{view:t,kind:l,src:d,found:_,to:y,other:x,instructions:k})})]})]})}function $e({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(L,{}),(0,Z.jsx)(`main`,{className:h(R,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function et({action:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(g,{pixel:V.migration,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Migration`})]}),(0,Z.jsx)(G,{label:`Migration`,links:ie,current:`migration`}),(0,Z.jsx)(`span`,{className:`flex-1`}),e]})}function tt({error:e}){return e?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function nt({title:e,children:t}){let[n,r]=(0,X.useState)(!1),i=(0,X.useId)();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(s,{size:15,"aria-hidden":`true`,className:h(`transition-transform`,n&&`rotate-180`)}),e]}),(0,Z.jsx)(F,{open:n,id:i,children:t})]})}function rt({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` (`,n,` file`,n===1?``:`s`,`)`]}):null;let r=n-new Set(t.map(e=>e.file)).size;return(0,Z.jsxs)(`details`,{className:`mt-1 text-[13px]`,children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,Z.jsxs)(`ul`,{className:`m-0 mt-1.5 flex list-none flex-col gap-1.5 p-0`,children:[t.map(e=>(0,Z.jsxs)(`li`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,Z.jsx)(`code`,{className:`mt-0.5 block overflow-x-auto rounded-[8px] bg-bg px-2 py-1 font-mono text-[12px] whitespace-pre text-ink`,children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,Z.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function it({plan:e,accepted:t,onAccept:n}){let r=e.feasibility.findings.filter(e=>e.level===`blocker`),i=e.feasibility.findings.filter(e=>e.level===`limit`),a=e.units.filter(e=>e.kind===`test`).length,o=e.units.filter(e=>e.kind===`support`).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2.5 rounded-[14px] card border px-5 py-4 text-sm @xl:grid-cols-[auto_1fr]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.source.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.workspace?J(e.workspace.label):`this project`,e.source.dir===`.`?``:`/${e.source.dir}`]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.target.dir]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[a,` test`,a===1?``:`s`,`, `,o,` support file`,o===1?``:`s`,e.copies.length?`, ${e.copies.length} data file${e.copies.length===1?``:`s`}`:``]}),e.instructions&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Z.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]}),r.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`mig-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5 text-sm text-ink`,children:r.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))})]}),i.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-3 rounded-[14px] bg-warn-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`mig-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1.5 pl-5 text-sm text-ink`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[e.text,(0,Z.jsx)(rt,{finding:e})]},e.code))}),n&&!r.length&&(0,Z.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!t,onChange:e=>n(e.target.checked)}),`I understand`]})]}),(0,Z.jsxs)(nt,{title:`Files, in order (${e.units.length})`,children:[(0,Z.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.units.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-3 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:ge[e.kind]}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 mt-2 text-[12.5px] text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function at({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{r((await E.start(e.id,i,t)).detail)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(P,{open:!0,onClose:n,title:`Start the migration`,description:`The tests are rewritten in ${e.target.title} into ${e.target.dir}, and ForgeQE runs each one. It runs in the background; your source tests are not changed.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(o,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,Z.jsx)(o,{variant:`primary`,disabled:s||i!==e.id,onClick:()=>void d(),children:`Start migration`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(k,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(tt,{error:l})]})})}function ot({d:e,onStarted:t}){let[n,r]=(0,X.useState)(!1),[a,s]=(0,X.useState)(!1),c=e.plan.feasibility.findings.some(e=>e.level===`limit`),l=e.plan.feasibility.verdict===`blocked`,u=!!e.job?.running;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.job?.last&&!u&&(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Z.jsx)(it,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!l&&!u&&(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(o,{variant:`primary`,disabled:!e.confirmed&&c&&!n,onClick:()=>s(!0),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Start migration`]})}),a&&(0,Z.jsx)(at,{plan:e.plan,acceptLimits:c&&(e.confirmed||n),onClose:()=>s(!1),onStarted:e=>{s(!1),t(e)}})]})}function st(e){return e.result?.status===`running`?`running`:e.result?.status===`migrated`?`done`:e.result?`review`:`planned`}function ct(e){return e.result?me[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:he[e.verdict]}function lt({view:e}){let[t,n]=(0,X.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>st(e)===t).length,i=e.plans.filter(e=>t===`all`||st(e)===t),a=e=>location.hash=f(`migration`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(Y,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,Z.jsx)(Y,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,Z.jsx)(Y,{label:`Migrated`,value:r(`done`),tone:r(`done`)?`text-pass`:void 0,onClick:()=>n(`done`),on:t===`done`}),(0,Z.jsx)(Y,{label:`Needs review`,value:r(`review`),tone:r(`review`)?`text-warn`:void 0,onClick:()=>n(`review`),on:t===`review`})]}),(0,Z.jsx)(A,{label:`Migrations`,placeholder:`Find a migration`,empty:t===`all`?`No migrations.`:`None here.`,resetKey:t,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Migration`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @3xl:table-cell`,children:`Source`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Tests`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Updated`})]}),children:i.map(e=>{let t=ct(e),n=e.result?e.result.status===`migrated`||e.result.endedAt?100:Math.min(99,Math.round(e.result.done/Math.max(1,e.files)*95)):0;return(0,Z.jsxs)(`tr`,{onClick:()=>a(e.id),className:I,children:[(0,Z.jsx)(`td`,{className:B,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[(0,Z.jsx)(q,{framework:e.stack?.framework,language:e.stack?.language,size:18}),(0,Z.jsx)(S,{size:13,className:`text-muted`}),(0,Z.jsx)(q,{framework:e.targetId.split(`-`)[0],language:e.targetId.split(`-`).slice(1).join(`-`),size:18})]}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`a`,{href:f(`migration`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[e.source,` to `,e.target]}),(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.to})]})]})}),(0,Z.jsx)(`td`,{className:h(B,`hidden max-w-[260px] @3xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-ink-2`,children:[(0,Z.jsx)(K,{kind:e.origin.kind,label:e.origin.label,size:15}),(0,Z.jsx)(`span`,{className:`truncate`,"data-tip":e.origin.label,children:e.origin.kind===`project`?e.from:J(e.origin.label)})]})}),(0,Z.jsx)(`td`,{className:h(B,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(be,{value:n,label:`${e.source} to ${e.target}: progress`}),(0,Z.jsxs)(`span`,{className:`w-9 flex-none text-right text-[12px] text-muted tabular-nums`,children:[n,`%`]})]}):e.result?(0,Z.jsxs)(`span`,{className:e.result.migrated===e.tests?`text-pass`:`text-ink-2`,children:[e.result.migrated,` of `,e.tests,` pass`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Z.jsx)(`td`,{className:h(B,`whitespace-nowrap`),children:(0,Z.jsx)(N,{tone:t.tone,children:t.label})}),(0,Z.jsx)(`td`,{className:h(B,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:U(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function ut({sub:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(null),c=(0,X.useCallback)(()=>{E.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,X.useEffect)(c,[c,e]);let l=t?.plans.some(e=>e.result?.status===`running`);(0,X.useEffect)(()=>{if(!l||e)return;let t=setInterval(c,3e3);return()=>clearInterval(t)},[l,e,c]);let u=e&&/^mig-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:``,d=()=>location.hash=f(`migration`,`new`),m=!t&&!r&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return e===`new`?(0,Z.jsxs)($e,{children:[(0,Z.jsx)(et,{}),(0,Z.jsx)(tt,{error:r}),m,t&&(0,Z.jsx)(Qe,{view:t,review:(e,t,n)=>(0,Z.jsx)(it,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>s({d:e,accept:t})}),a&&(0,Z.jsx)(at,{plan:a.d.plan,acceptLimits:a.accept,onClose:()=>s(null),onStarted:e=>location.hash=f(`migration`,e.plan.id)})]}):u?(0,Z.jsxs)($e,{wide:!0,children:[(0,Z.jsx)(et,{}),(0,Z.jsx)(tt,{error:r}),m,t&&(0,Z.jsx)(Le,{id:u,view:t,plan:e=>(0,Z.jsx)(ot,{d:e,onStarted:()=>location.reload()})},u)]}):(0,Z.jsxs)($e,{children:[(0,Z.jsx)(et,{action:t&&!t.plans.length?void 0:(0,Z.jsx)(o,{variant:`primary`,disabled:!t,onClick:d,children:`New migration`})}),(0,Z.jsx)(tt,{error:r}),m,t&&(t.plans.length?(0,Z.jsx)(lt,{view:t}):(0,Z.jsx)(C,{icon:p,title:`No migrations yet`,action:(0,Z.jsx)(o,{size:`sm`,onClick:d,children:`New migration`}),children:`Bring in tests from git, a folder, uploaded files or pasted code, and pick the framework they move to. Nothing starts until you confirm.`}))]})}export{ut as Migration};
|