@capagents/forgeqe 2.10.5 → 3.0.0

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 (110) hide show
  1. package/HOW_TO_USE.md +93 -19
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/docs-site/docs/index.html +78 -16
  4. package/dist/docs-site/docs/search.js +1 -1
  5. package/dist/forgeqe.js +1946 -1929
  6. package/dist/web/assets/Agent-DISh0THc.js +8 -0
  7. package/dist/web/assets/ApiTests-CK0HqEH4.js +10 -0
  8. package/dist/web/assets/Browse-WylAQZvD.js +2 -0
  9. package/dist/web/assets/Chat-B7IOg3I3.js +5 -0
  10. package/dist/web/assets/{CommandPalette-D7ufvlUN.js → CommandPalette-CkreEJ8R.js} +1 -1
  11. package/dist/web/assets/Compare-CgOfZofk.js +1 -0
  12. package/dist/web/assets/{Cost-DGZ5t-Q_.js → Cost-Dl5-viu4.js} +1 -1
  13. package/dist/web/assets/{Data-DqGA1ZtQ.js → Data-Bv2S5wkW.js} +4 -4
  14. package/dist/web/assets/Desktop-CifPwy5u.js +1 -0
  15. package/dist/web/assets/DesktopReview-fpGdtU4r.js +1 -0
  16. package/dist/web/assets/Evidence-hOZDzfKt.js +1 -0
  17. package/dist/web/assets/{Explore-TtfTWmGW.js → Explore-c85VGE9Q.js} +2 -2
  18. package/dist/web/assets/{Features-DazoSiEi.js → Features-DXL_vSjn.js} +1 -1
  19. package/dist/web/assets/{Flags-Brja-ZXF.js → Flags-B7x2pDud.js} +2 -2
  20. package/dist/web/assets/Flaky-BM3syqCt.js +1 -0
  21. package/dist/web/assets/Impact-BUCh8OAI.js +3 -0
  22. package/dist/web/assets/Jobs-B8sBDYRI.js +5 -0
  23. package/dist/web/assets/KindPage-yVmpQm7L.js +6 -0
  24. package/dist/web/assets/Migration-BOLN1duU.js +2 -0
  25. package/dist/web/assets/Product-C0FeEaJg.js +7 -0
  26. package/dist/web/assets/Production-BSMQyWKd.js +1 -0
  27. package/dist/web/assets/{Quality-C4Aak_hw.js → Quality-DsM9gWZb.js} +1 -1
  28. package/dist/web/assets/Readiness-BhqkAJYN.js +1 -0
  29. package/dist/web/assets/Record-CPx-lK53.js +2 -0
  30. package/dist/web/assets/Regression-BXbX46nO.js +5 -0
  31. package/dist/web/assets/{RelationGraph-DLeEarQd.js → RelationGraph-eoGXXz5t.js} +1 -1
  32. package/dist/web/assets/{Reports-ClSAzQOh.js → Reports-36YQzVhA.js} +2 -2
  33. package/dist/web/assets/Response-DplUOsue.js +4 -0
  34. package/dist/web/assets/{RunDiff-0ibEcmI5.js → RunDiff-D0fDhRmK.js} +1 -1
  35. package/dist/web/assets/{Runs-T8yF8Hi0.js → Runs-Bv1Ef8zq.js} +2 -2
  36. package/dist/web/assets/{Steps-CB30w6BA.js → Steps-Cm-atRtk.js} +2 -2
  37. package/dist/web/assets/TestCases-B9x9W3zJ.js +1 -0
  38. package/dist/web/assets/TestData-DsJ6Z2YI.js +2 -0
  39. package/dist/web/assets/TestDebt-B_FUbMOb.js +1 -0
  40. package/dist/web/assets/Tosca-nxVCubA5.js +3 -0
  41. package/dist/web/assets/{WhatsNew-D7n48IsG.js → WhatsNew-CdnbMvrr.js} +1 -1
  42. package/dist/web/assets/agentLink-BGKAF6xd.js +1 -0
  43. package/dist/web/assets/{dataParts-CZAcb4L_.js → dataParts-Bn-tzbKg.js} +3 -3
  44. package/dist/web/assets/{families-D2ygriY6.js → families-DPlFfKf2.js} +1 -1
  45. package/dist/web/assets/filters-Bj5K1WaL.js +1 -0
  46. package/dist/web/assets/{fold-BhYvId2X.js → fold-BhRpA0sy.js} +1 -1
  47. package/dist/web/assets/frame-D_TPoUTD.js +16 -0
  48. package/dist/web/assets/index-BRB-oAMd.js +67 -0
  49. package/dist/web/assets/index-CIw5WfL8.css +2 -0
  50. package/dist/web/assets/{logos-DmK40tlV.js → logos-839CfoKx.js} +1 -1
  51. package/dist/web/assets/{markdown-Bej6qyls.js → markdown-6z0km3hN.js} +3 -3
  52. package/dist/web/assets/paletteCommands-CZFdKGhh.js +1 -0
  53. package/dist/web/assets/{parts-BOpbd90H.js → parts-VPcxh6Jc.js} +1 -1
  54. package/dist/web/assets/{productParts-B3_FGd-T.js → productParts-BjfWgMtq.js} +1 -1
  55. package/dist/web/assets/{qualityParts-B8yJRVpP.js → qualityParts-PGN65yfI.js} +1 -1
  56. package/dist/web/assets/{recordTest-CZUrGm8I.js → recordTest-EkxSMWbe.js} +1 -1
  57. package/dist/web/assets/{rows-BcG6gFCy.js → rows-uLoguIo5.js} +1 -1
  58. package/dist/web/assets/{segmented-ffWUfF8N.js → segmented-DphDskQz.js} +1 -1
  59. package/dist/web/assets/{usePageChat-T6vQY_1C.js → usePageChat-DqEwGcyO.js} +1 -1
  60. package/dist/web/index.html +5 -5
  61. package/docs/user-guide.html +78 -16
  62. package/package.json +3 -1
  63. package/prompts/requests-rule.md +1 -1
  64. package/prompts/talk-summary.md +43 -0
  65. package/prompts/talk.md +49 -0
  66. package/prompts/test-agent.md +1 -0
  67. package/py/forgeqe_data/__init__.py +1 -0
  68. package/py/forgeqe_data/__main__.py +12 -0
  69. package/py/forgeqe_data/connect.py +290 -0
  70. package/py/forgeqe_data/connstr.py +169 -0
  71. package/py/forgeqe_data/flows.py +603 -0
  72. package/py/forgeqe_data/guard.py +214 -0
  73. package/py/forgeqe_data/mongo.py +219 -0
  74. package/py/forgeqe_data/schema.py +431 -0
  75. package/py/forgeqe_data/service.py +651 -0
  76. package/py/forgeqe_data/streams.py +400 -0
  77. package/py/forgeqe_data/subset.py +299 -0
  78. package/py/forgeqe_data/testdata.py +861 -0
  79. package/py/forgeqe_data/vector.py +113 -0
  80. package/py/forgeqe_talk/__init__.py +1 -0
  81. package/py/forgeqe_talk/__main__.py +65 -0
  82. package/py/forgeqe_voice/worker.py +24 -4
  83. package/dist/web/assets/Agent-bSVNDlcU.js +0 -8
  84. package/dist/web/assets/ApiTests-DOxGgoZC.js +0 -10
  85. package/dist/web/assets/Browse-CG8jzqR1.js +0 -2
  86. package/dist/web/assets/Chat-DzufzeGg.js +0 -5
  87. package/dist/web/assets/Compare-6vHuAaKv.js +0 -1
  88. package/dist/web/assets/Desktop-CSOFE8cN.js +0 -1
  89. package/dist/web/assets/DesktopReview-BWtionFH.js +0 -1
  90. package/dist/web/assets/Evidence-D8pLFcbr.js +0 -1
  91. package/dist/web/assets/Flaky-jJlHFFCa.js +0 -1
  92. package/dist/web/assets/Impact-b60dmhJK.js +0 -3
  93. package/dist/web/assets/Jobs-Y9W9nBgx.js +0 -5
  94. package/dist/web/assets/KindPage-Y72w2UwG.js +0 -6
  95. package/dist/web/assets/Migration-CvIeTB9p.js +0 -2
  96. package/dist/web/assets/Product-BEe2GyO6.js +0 -7
  97. package/dist/web/assets/Production-D2qmPFYy.js +0 -1
  98. package/dist/web/assets/Readiness-ClXnnmLo.js +0 -1
  99. package/dist/web/assets/Record-LaLYhQgk.js +0 -2
  100. package/dist/web/assets/Regression-DKz05MC_.js +0 -5
  101. package/dist/web/assets/Response-De60pk_7.js +0 -10
  102. package/dist/web/assets/TestCases-Ba6bUE4i.js +0 -1
  103. package/dist/web/assets/TestData-DefDzeMW.js +0 -2
  104. package/dist/web/assets/TestDebt-zohltDHp.js +0 -1
  105. package/dist/web/assets/Tosca-jAtdiG28.js +0 -3
  106. package/dist/web/assets/filters-CYaF2RvC.js +0 -1
  107. package/dist/web/assets/frame-DeJBYtBX.js +0 -11
  108. package/dist/web/assets/index-CYlacOTX.css +0 -2
  109. package/dist/web/assets/index-DXpBYobT.js +0 -67
  110. package/dist/web/assets/paletteCommands-CKBMmhb4.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{$t as e,Ar as t,C as n,D as r,En as i,Lr as a,On as o,Pn as s,Pr as c,Wn as l,_r as u,a as d,bt as f,dt as p,er as m,gt as h,ht as g,jn as _,jr as v,kn as ee,mr as y,o as b,ot as te,tt as x,wt as ne}from"./line-icons-DBwNPSmu.js";import{At as S,V as C,a as w,c as T,en as E,i as D,l as O,o as k,p as A,s as j,tt as M,z as N}from"./filters-Bj5K1WaL.js";import{B as P,G as F,Mt as I,Nt as L,W as re,r as R,t as z,tt as B,un as V,z as H}from"./frame-D_TPoUTD.js";import{a as ie,r as ae,t as oe}from"./markdown-6z0km3hN.js";import{r as se,s as ce}from"./index-BRB-oAMd.js";import{t as U}from"./segmented-DphDskQz.js";import{t as W}from"./fold-BhRpA0sy.js";import{n as G}from"./families-DPlFfKf2.js";import{t as le}from"./agentLink-BGKAF6xd.js";import{a as ue,c as de,i as fe,n as pe,o as K,r as me,s as q,t as he}from"./logos-839CfoKx.js";import{a as ge,c as _e,d as ve,f as J,i as ye,l as be,n as xe,o as Se,p as Ce,r as Y,s as we,t as Te,u as Ee}from"./parts-VPcxh6Jc.js";var X=a(c(),1),Z=E(),De={py:`python`,ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,java:`java`,cs:`csharp`,rb:`ruby`};function Oe({path:e}){let t=me[De[e.split(`.`).pop()?.toLowerCase()||``]||``];return t?(0,Z.jsx)(t,{"aria-hidden":`true`,width:15,height:15,className:`flex-none`}):(0,Z.jsx)(g,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`})}function ke(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 Ae({files:e,selected:t,onSelect:n,label:i}){let a=(0,X.useMemo)(()=>ke(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-2 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(r,{size:14,"aria-hidden":`true`,className:C(`flex-none text-muted transition-transform duration-150`,t&&`rotate-90`)}),t?(0,Z.jsx)(ne,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}):(0,Z.jsx)(f,{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-4 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 r=t===e.id;return(0,Z.jsx)(`li`,{role:`treeitem`,"aria-selected":r,className:`list-none`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),"data-tip":e.title,className:C(`flex h-8 w-full items-center gap-2 rounded-[6px] border-0 px-2 text-left text-[13px]`,n?`cursor-pointer`:`cursor-default`,r?`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)(Oe,{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 je({title:e,side:t,file:n,lang:r,text:i,missing:a}){let o=(i??``).split(`
2
+ `),s=(0,X.useMemo)(()=>i?ie(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-4`,children:[(0,Z.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:t}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":n,children:n||e}),i&&(0,Z.jsx)(oe,{text:i,label:`Copy ${n||t}`})]}),i?(0,Z.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] 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-4 py-4 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-4 py-4`,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 Me({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:xe[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(``),S.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())),h=a.filter(e=>e.status===`migrated`).length,g=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-4 @4xl:max-h-none`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:`Files`}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[h,` migrated · `,g,` failed · `,a.length,` files`]})]}),(0,Z.jsx)(D,{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)(Ae,{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?_e[e.status].label:e.data?`Copied`:`Waiting`,className:C(`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-4 text-[13px] text-muted`,children:`No file matches.`})})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 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-4 @3xl:grid-cols-2`,children:[(0,Z.jsx)(je,{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)(je,{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 Ne=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function Pe(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?ye[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:be[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function Fe({id:e,title:t,targetDir:r,onClose:i}){let[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(``),d=async()=>{c(!0),u(``);try{await S.delete(e,a),location.hash=A(`migration`)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(I,{open:!0,onClose:i,title:`Delete this migration`,description:`${t}. Removes the plan and its run history from the list. Files already written under ${r} stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:i,"data-tip":`Keep it`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),`Keep`]}),(0,Z.jsxs)(N,{variant:`danger`,disabled:s||a!==e,onClick:()=>void d(),children:[(0,Z.jsx)(y,{"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-2 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` to confirm`]}),(0,Z.jsx)(w,{value:a,onChange:e=>o(e.target.value),autoComplete:`off`,spellCheck:!1})]}),l?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:l}):null]})})}function Ie({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-6`,children:[(0,Z.jsxs)(Se,{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:ve(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-4 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-6 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(H,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-2 pr-4 pl-4 font-medium`,children:`File`}),(0,Z.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @3xl:table-cell`,children:`Note`})]}),children:e.plan.units.map(e=>{let t=r.get(e.id),n=t?_e[t.status]:null;return(0,Z.jsxs)(`tr`,{className:re,children:[(0,Z.jsxs)(`td`,{className:P,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-[13px] text-muted`,children:e.source?`from ${Q(e.source)}`:e.target})]}),(0,Z.jsx)(`td`,{className:C(P,`whitespace-nowrap`),children:n?(0,Z.jsx)(T,{tone:n.tone,children:n.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`})}),(0,Z.jsx)(`td`,{className:C(P,`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-6 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[13px] 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-[13px] 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-[13px] 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-2 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:Ce(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 Le({d:e,events:n,picked:r,setPicked:i,busy:a,working:s,onFix:c,onCheck:u}){let[d,f]=(0,X.useState)(``),p=(0,X.useRef)(null),m=e.result?.validation?.tests||[],h=m.filter(e=>!e.ok),g=[];for(let t of e.result?.fixes||[])t.auto||g.push({who:`you`,text:t.note?`${t.note}`:`Fix ${Q(t.target)}`,at:t.at,detail:t.note?`for ${Q(t.target)}`:void 0}),g.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 _=s?n.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)},[g.length,_.length]);let v=()=>{let e=[...r];e.length&&(c(e,d.trim()),f(``))},ee=e=>{let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(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-4 border-b border-line-soft px-4 py-4`,children:[(0,Z.jsx)(L,{agent:`forgeqe-migrate`,px:28,working:s,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-[13px] text-muted`,children:s?`Working on it…`:h.length?`${h.length} test${h.length===1?``:`s`} to fix`:`Every test passes`})]}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,disabled:a,onClick:u,"data-tip":`Run every migrated test again`,children:[(0,Z.jsx)(o,{"aria-hidden":`true`}),`Run`]})]}),(0,Z.jsxs)(`ol`,{ref:p,"aria-live":`polite`,className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-4 overflow-y-auto bg-surface-muted p-4`,children:[!g.length&&!_.length&&(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] bg-bg p-4 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.`}),h.length>0&&(0,Z.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>c(h.map(e=>e.id),``),"data-tip":`Fix all failing tests`,className:`inline-flex items-center gap-2 self-start rounded-[8px] border-0 bg-surface-strong px-2 py-2 text-[13px] font-medium text-ink hover:bg-line disabled:opacity-50`,children:[(0,Z.jsx)(t,{size:14,"aria-hidden":`true`}),`Fix all`]})]}),g.map((e,t)=>(0,Z.jsxs)(`li`,{className:C(`flex max-w-[92%] flex-col gap-1`,e.who===`you`?`self-end items-end`:`self-start`),children:[(0,Z.jsxs)(`span`,{className:C(`rounded-[12px] px-4 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:C(`mr-1 font-semibold`,e.tone===`ok`?`text-pass`:`text-fail`),children:e.tone===`ok`?`✓`:`✗`}),e.text]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.detail?`${e.detail} · `:``,se(e.at)]})]},t)),_.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex max-w-[92%] items-start gap-2 self-start rounded-[12px] bg-bg px-4 py-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:C(`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 border-t border-line-soft p-4`,children:[m.length>0&&(0,Z.jsx)(`div`,{role:`group`,"aria-label":`Tests to fix`,className:`flex flex-wrap gap-2`,children:m.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":r.has(e.id),onClick:()=>ee(e.id),className:C(`inline-flex min-h-7 items-center gap-2 rounded-full border px-2 text-[13px]`,r.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:C(`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)(j,{"aria-label":`Message to the agent`,value:d,rows:2,maxLength:2e3,placeholder:r.size?`What should change? (optional)`:`Pick a test above first`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!a&&r.size&&(e.preventDefault(),v())},className:`min-h-[44px] flex-1 resize-none`}),(0,Z.jsx)(N,{variant:`primary`,size:`icon`,"aria-label":`Send to the agent`,"data-tip":`Send to the agent`,disabled:a||!r.size,onClick:v,children:(0,Z.jsx)(l,{"aria-hidden":`true`})})]})]})]})}var Re=`@5xl:h-[calc(var(--screen)-320px)] @5xl:min-h-[540px]`;function ze({d:e,events:n,busy:r,working:i,onFix:a,onCheck:o,onCompare:s}){let c=e.result?.validation?.tests||[],l=e.result?.fixes||[],u=c.filter(e=>!e.ok).map(e=>e.id).join(`,`),[d,f]=(0,X.useState)(()=>c.find(e=>!e.ok)?.id||c[0]?.id||``),[m,h]=(0,X.useState)(()=>new Set(c.filter(e=>!e.ok).map(e=>e.id)));(0,X.useEffect)(()=>h(new Set(u?u.split(`,`):[])),[u]);let g=c.find(e=>e.id===d),_=g&&[...l].reverse().find(e=>e.id===g.id);return c.length?(0,Z.jsxs)(`div`,{className:C(`grid grid-cols-[minmax(0,1fr)] gap-6 @5xl:grid-cols-[minmax(0,1fr)_380px]`,Re),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-[13px] text-muted`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`px-4 py-2 font-medium`,children:[`Test `,(0,Z.jsxs)(`span`,{className:`font-normal`,children:[`· `,c.filter(e=>e.ok).length,` of `,c.length,` pass`]})]}),(0,Z.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Result`}),(0,Z.jsx)(`th`,{className:`hidden px-4 py-2 font-medium @2xl:table-cell`,children:`Kept from the source`}),(0,Z.jsx)(`th`,{className:`hidden px-4 py-2 text-right font-medium @3xl:table-cell`,children:`Time`})]})}),(0,Z.jsx)(`tbody`,{children:c.map(e=>{let t=[...l].reverse().find(t=>t.id===e.id);return(0,Z.jsxs)(`tr`,{onClick:()=>f(e.id),"aria-selected":d===e.id,className:C(`cursor-pointer border-t border-line-soft`,d===e.id?`bg-accent-soft`:`hover:bg-surface-muted`),children:[(0,Z.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>f(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:C(`block text-[13px]`,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-4 py-2 whitespace-nowrap`,children:(0,Z.jsx)(T,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,Z.jsxs)(`td`,{className:`hidden px-4 py-2 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-4 py-2 text-right text-[13px] text-muted tabular-nums @3xl:table-cell`,children:e.ms?ve(e.ms):`–`})]},e.id)})})]})}),g&&(0,Z.jsxs)(`section`,{"aria-label":`${Q(g.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`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:Q(g.target)}),(0,Z.jsx)(T,{tone:g.ok?`pass`:`fail`,children:g.ok?`Passes`:g.exitCode===null&&g.ms?`Timed out`:`Fails`}),g.source&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`from `,Q(g.source)]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(N,{size:`sm`,variant:`ghost`,onClick:()=>s(g.id),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Compare`]}),!g.ok&&(0,Z.jsxs)(N,{size:`sm`,disabled:r,onClick:()=>h(new Set([g.id])),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Fix`]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-auto bg-surface-muted px-4 py-4`,children:[g.problems.length>0&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g.problems.join(` `)}),_&&(0,Z.jsxs)(`p`,{className:C(`m-0 text-[13px]`,_.ok?`text-pass`:`text-ink-2`),children:[_.ok?`Fixed by the agent`:`The agent could not fix it`,_.reason?`: ${_.reason}`:`.`]}),g.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[13px] text-muted`,children:[`$ `,g.command]}),(0,Z.jsx)(`pre`,{className:`m-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:g.output||(g.ok?`${g.after.tests} test${g.after.tests===1?``:`s`} passed in ${ve(g.ms)}.`:`No output.`)})]})]})]}),(0,Z.jsx)(Le,{d:e,events:n,picked:m,setPicked:h,busy:r,working:i,onFix:a,onCheck:o})]}):(0,Z.jsx)(O,{center:!0,className:`py-6`,children:e.result?`The tests are checked once every file is migrated.`:`Start the migration first.`})}var Be={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 Ve({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-4 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-[13px] 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:C(`w-3 flex-none text-center`,Be[e.kind].cls),children:Be[e.kind].mark}),(0,Z.jsx)(`span`,{className:C(`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 He({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)(),[f,p]=(0,X.useState)([]),[h,g]=(0,X.useState)(null),[_,ee]=(0,X.useState)(!1),[x,ne]=(0,X.useState)(!1),C=(0,X.useRef)(0),w=(0,X.useCallback)(()=>{S.detail(e).then(e=>{r(e),a(``)},e=>a(e.message)),S.events(e,C.current).then(e=>{e.next<C.current?(C.current=0,p([])):(C.current=e.next,e.events.length&&p(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,X.useEffect)(w,[w]);let E=!!(n?.job?.running||n?.result?.status===`running`);(0,X.useEffect)(()=>{if(!E)return;let e=setInterval(w,1500);return()=>clearInterval(e)},[E,w]);let D=async e=>{ee(!0),a(``);try{r(await e()),setTimeout(w,800)}catch(e){a(e.message)}finally{ee(!1)}};if(!n)return i?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 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 O=Pe(n),k=Ee(n.plan,n.result),j=n.result,M=(j?.validation?.tests||[]).filter(e=>!e.ok).length,P=[{id:`overview`,label:`Overview`},{id:`tests`,label:`Tests`,n:j?.validation?`${j.validation.tests.length-M}/${j.validation.tests.length}`:void 0,tone:M?`text-fail`:void 0},{id:`compare`,label:`Compare`},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:A(`migration`),className:`inline-flex items-center gap-2 self-start text-sm`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`}),`Migration`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 @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 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)(b,{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-2 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-[13px]`,children:n.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(T,{tone:O.tone,children:O.label}),E?(0,Z.jsxs)(N,{variant:`danger`,disabled:_,onClick:()=>void D(()=>S.stop(e)),children:[(0,Z.jsx)(m,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,Z.jsxs)(Z.Fragment,{children:[j?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>S.report(e).then(e=>g(e.text),()=>g(``)),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Report`]}),(0,Z.jsxs)(N,{disabled:_,onClick:()=>void D(()=>S.verify(e)),"data-tip":`Check again: run every migrated test again`,children:[(0,Z.jsx)(o,{"aria-hidden":`true`}),`Run`]})]}):null,(0,Z.jsxs)(N,{variant:`ghost`,disabled:_,onClick:()=>ne(!0),"data-tip":`Remove this plan from the list. Converted tests stay.`,children:[(0,Z.jsx)(y,{"aria-hidden":`true`}),`Delete`]})]})]})]}),x&&(0,Z.jsx)(Fe,{id:e,title:`${n.plan.source.title} → ${n.plan.target.title}`,targetDir:n.plan.target.dir,onClose:()=>ne(!1)}),j&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 rounded-[12px] card border px-4 py-2 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(ge,{ids:Ne,states:j.stages})}),E&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(k)}% done`,children:[Math.round(k),`%`]})]}),i&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),(0,Z.jsx)(we,{tabs:P,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)(Ie,{d:n,planView:t(n)}),s===`tests`&&(0,Z.jsx)(ze,{d:n,events:f,busy:_||E,working:E,onFix:(t,n)=>void D(()=>S.fix(e,t,n)),onCheck:()=>void D(()=>S.verify(e)),onCompare:e=>(u(e),c(`compare`))}),s===`compare`&&(0,Z.jsx)(Me,{id:e,plan:n.plan,result:j,initial:l}),s===`activity`&&(0,Z.jsx)(Ve,{events:f,running:E})]}),(0,Z.jsx)(I,{open:h!==null,onClose:()=>g(null),wide:!0,title:`Report`,description:`migrate.md for ${n.plan.id}`,footer:(0,Z.jsxs)(N,{onClick:()=>g(null),children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Close`]}),children:h?(0,Z.jsx)(ae,{text:h}):(0,Z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var Ue=[{id:`git`,label:`Git`},{id:`folder`,label:`Folder`},{id:`upload`,label:`Upload`},{id:`paste`,label:`Paste`},{id:`project`,label:`This project`}],We=[`Source`,`Target`,`Instructions`,`Review`],Ge=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`],Ke=[`Where the tests are`,`Framework and language`,`Your rules, optional`,`Check and start`];function qe({at:e,reached:t,onGo:r}){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:We.map((i,a)=>{let o=a<=t,s=a===e,c=a<t&&!s;return(0,Z.jsxs)(`li`,{className:C(`flex items-center gap-2`,a<We.length-1&&`flex-1`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:!o,"aria-current":s?`step`:void 0,onClick:()=>r(a),"aria-label":i,"data-tip":Ke[a],className:C(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,o&&!s?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:C(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,c?`bg-pass text-white`:s?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,Z.jsx)(n,{size:13,strokeWidth:3}):a+1}),(0,Z.jsx)(`span`,{className:C(s?`font-medium text-ink`:o?`text-ink-2`:`text-muted`,!s&&`hidden @xl:inline`),children:i})]}),a<We.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:C(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,a<t?`w-full`:`w-0`)})})]},i)})})})}function $({id:e,label:t,help:n,children:r}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,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 Je({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-4 border-t border-line-soft bg-bg py-4`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Z.jsxs)(N,{variant:`ghost`,disabled:e,onClick:t,children:[(0,Z.jsx)(d,{"aria-hidden":`true`}),`Back`]}),(0,Z.jsx)(N,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function Ye({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-4 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)(T,{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 Xe(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await S.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 Ze=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function Qe({view:e,kind:t,setKind:r,src:a,setSrc:o,from:s,setFrom:c,stack:l,setStack:u,found:d,setFound:f}){let[p,m]=(0,X.useState)(``),[g,b]=(0,X.useState)(``),[te,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(``),[A,P]=(0,X.useState)(e.credentials),[F,I]=(0,X.useState)(null),[L,re]=(0,X.useState)(``),[R,z]=(0,X.useState)([{path:``,text:``}]),[B,V]=(0,X.useState)(``),[H,ie]=(0,X.useState)(``),[ae,oe]=(0,X.useState)(``),se=(0,X.useRef)(null),ce=(0,X.useRef)(null);(0,X.useEffect)(()=>{se.current?.setAttribute(`webkitdirectory`,``)},[t,a]);let U=a?.workspace,W=async(e,t)=>{V(e),ie(``),oe(``);try{await t()}catch(e){ie(e.message)}finally{V(``)}},G=e=>{o(e),c(`.`),f(e.discovery)};(0,X.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>S.discover(void 0,s||`.`).then(f,()=>f(null)),300);return()=>clearTimeout(e)},[t,s,f]);let le=e=>{let t=e.filter(e=>!Ze(e));if(!t.length)return ie(`Nothing to send: every file is hidden or a dependency.`);W(`upload`,async()=>{let n=e[0],r=await S.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:`${t.length} files`});await Xe(r.workspace.id,t,e=>oe(`Sending ${e} of ${t.length} files…`)),G(await S.finish(r.workspace.id))})},me=t===`project`||!!U?.ready;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,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:Ue.map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e.id,onClick:()=>{e.id!==t&&(r(e.id),o(null),f(null),ie(``),c(e.id===`project`?``:`.`))},className:C(`inline-flex min-h-9 flex-none cursor-pointer items-center gap-2 rounded-[7px] border-0 px-4 text-sm font-medium`,t===e.id?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,Z.jsx)(fe,{logo:ue[e.id].Logo,icon:ue[e.id].Icon,size:16}),e.label]},e.id))}),H&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:H}),U?.ready?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-[12px] card border px-4 py-4`,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)(T,{tone:`pass`,children:`Ready`}),(0,Z.jsxs)(N,{variant:`ghost`,size:`sm`,onClick:()=>(o(null),f(null)),children:[(0,Z.jsx)(i,{"aria-hidden":`true`}),`Change`]})]}):t===`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-4 gap-y-1`,children:[`Works with `,pe.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(fe,{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)(fe,{logo:de(p).Logo,size:18})}),(0,Z.jsx)(w,{id:`mig-url`,value:p,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(m(e.target.value),E(null)),className:`w-full pl-10`})]}),(0,Z.jsxs)(N,{disabled:!!B||!p.trim(),"data-tip":`Test the connection`,onClick:()=>void W(`test`,async()=>{let e=await S.testRepository(p.trim(),D||void 0);E(e.branches),!g&&e.head&&b(e.head),oe(`Connected · ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),B===`test`?`Testing…`:`Test`]})]})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-branch`,label:`Branch`,children:te?.length?(0,Z.jsx)(k,{id:`mig-branch`,value:g,onChange:e=>b(e.target.value),children:te.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))}):(0,Z.jsx)(w,{id:`mig-branch`,value:g,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>b(e.target.value)})}),(0,Z.jsx)($,{id:`mig-token`,label:`Access token`,help:F?void 0:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>I({name:`REPO_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)(k,{id:`mig-token`,value:D,onChange:e=>O(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),A.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})})]}),F&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,Z.jsx)($,{id:`mig-token-name`,label:`Name`,children:(0,Z.jsx)(w,{id:`mig-token-name`,value:F.name,spellCheck:!1,maxLength:64,onChange:e=>I({...F,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)(w,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:F.value,onChange:e=>I({...F,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,Z.jsxs)(N,{disabled:!!B||!F.name||!F.value,onClick:()=>void W(`token`,async()=>{await M.saveSecrets({[F.name]:F.value}),P([...new Set([...A,F.name])].sort()),O(F.name),I(null)}),children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),`Save`]}),(0,Z.jsxs)(N,{variant:`ghost`,onClick:()=>I(null),children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsx)(`span`,{className:`w-full text-[13px] text-muted`,children:`Kept in ForgeQE's credential store, never in the URL or on this page.`})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(N,{variant:`primary`,disabled:!!B||!p.trim(),onClick:()=>void W(`clone`,async()=>G(await S.source({kind:`git`,url:p.trim(),...g?{branch:g}:{},...D?{tokenVar:D}:{}}))),children:[(0,Z.jsx)(x,{"aria-hidden":`true`}),B===`clone`?`Cloning…`:`Clone`]})})]}):t===`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)(w,{id:`mig-folder`,value:L,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>re(e.target.value)})}),(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(N,{variant:`primary`,disabled:!!B||!L.trim(),onClick:()=>void W(`copy`,async()=>G(await S.source({kind:`folder`,folder:L.trim()}))),"data-tip":`Use this folder`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),B===`copy`?`Copying…`:`Use`]})})]}):t===`upload`?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 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:se,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,Z.jsx)(`input`,{ref:ce,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&le([...e.target.files])}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,Z.jsxs)(N,{variant:`primary`,disabled:!!B,onClick:()=>se.current?.click(),"data-tip":`Choose a folder`,children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Browse`]}),(0,Z.jsxs)(N,{disabled:!!B,onClick:()=>ce.current?.click(),"data-tip":`Choose files`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Files`]})]})]}):t===`paste`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R.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)(w,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>z(R.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px]`}),R.length>1&&(0,Z.jsx)(N,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,"data-tip":`Remove file ${t+1}`,onClick:()=>z(R.filter((e,n)=>n!==t)),children:(0,Z.jsx)(y,{"aria-hidden":`true`})})]}),(0,Z.jsx)(j,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>z(R.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)(N,{variant:`ghost`,onClick:()=>z([...R,{path:``,text:``}]),"data-tip":`Add a file`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`Add`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(N,{variant:`primary`,disabled:!!B||R.some(e=>!e.path.trim()||!e.text.trim()),onClick:()=>void W(`paste`,async()=>{let e=await S.source({kind:`paste`});await S.files(e.workspace.id,R.map(e=>({path:e.path.trim(),text:e.text}))),G(await S.finish(e.workspace.id))}),"data-tip":`Use this code`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),B===`paste`?`Adding…`:`Use`]})]})]}):null,ae&&!H&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:ae}),me&&(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:t===`project`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{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:e.folders.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]}):(0,Z.jsxs)(k,{id:`mig-from`,value:s||`.`,onChange:e=>(c(e.target.value),U&&S.discover(U.id,e.target.value).then(f,()=>{})),children:[(0,Z.jsx)(`option`,{value:`.`,children:`All of it`}),(a?.folders||[]).map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}),(0,Z.jsx)($,{id:`mig-stack`,label:`Framework`,children:(0,Z.jsxs)(k,{id:`mig-stack`,value:l,onChange:e=>u(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:d?.stack?`${d.title} (detected)`:`Detect`}),e.sources.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})})]}),d&&(0,Z.jsx)(Ye,{d})]})]})}function $e({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:C(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-4 rounded-[12px] border px-4 py-4 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-[13px] text-muted`,children:i})]})]})}var et={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function tt({view:e,to:t,setTo:n,other:r,setOther:i,into:a,setInto:o,only:s,setOnly:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r===null?l(t):``,p=e.targets.filter(e=>l(e.id)===f);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2 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`,children:[d.map(([r,a])=>{let o=he[r];return(0,Z.jsx)($e,{on:f===r,onPick:()=>(i(null),n((e.targets.find(e=>l(e.id)===r&&u(e.id)===u(t))||e.targets.find(e=>l(e.id)===r)).id)),logo:o?(0,Z.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:a,sub:et[r],label:a},r)}),(0,Z.jsx)($e,{on:r!==null,onPick:()=>i(r??``),logo:(0,Z.jsx)(_,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2 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`,children:p.map(e=>{let r=me[u(e.id)];return(0,Z.jsx)($e,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,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)(w,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>i(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)(w,{id:`mig-into`,value:a,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>o(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)(w,{id:`mig-only`,value:s,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>c(e.target.value)})})]})]})}function nt({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-2 border-b border-line-soft py-4 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[13px] 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-6`,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 rt({view:t,review:n,onStart:r}){let[i,a]=(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,ee]=(0,X.useState)(null),[y,te]=(0,X.useState)(t.targets[0]?.id||``),[x,ne]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(``),[D,O]=(0,X.useState)(``),[k,A]=(0,X.useState)(null),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(``);(0,X.useEffect)(()=>{A(null),N(!1),c(e=>Math.min(e,2))},[l,d,p,h,T,y,x,C,D]);let re=e=>{a(e),c(t=>Math.max(t,e)),L(``)},R=l===`project`||!!d?.workspace?.ready,z=async()=>{F(!0),L(``);try{let e=await S.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()}:{},...D.trim()?{instructions:D.trim()}:{}});A(e),re(3)}catch(e){L(e.message)}finally{F(!1)}},B=k?.plan,V=B?.feasibility.findings.some(e=>e.level===`limit`),H=B?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsx)(qe,{at:i,reached:s,onGo:e=>!P&&(e<3||k)&&a(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-6`,children:[(0,Z.jsx)(`h2`,{id:`mig-step`,className:`m-0 text-[20px] font-semibold tracking-[-0.01em]`,children:[`Where are the tests?`,`What should they become?`,`Anything the agent should know?`,`Review and start`][i]}),I&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:I}),i===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:v,setFound:ee}),(0,Z.jsx)(Je,{busy:P,next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>re(1),disabled:!R})]}),i===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(tt,{view:t,to:y,setTo:te,other:x,setOther:ne,into:C,setInto:w,only:T,setOnly:E}),(0,Z.jsx)(Je,{busy:P,onBack:()=>a(0),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>re(2),disabled:x===null?!y:!x.trim()})]}),i===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)(j,{id:`mig-instructions`,value:D,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>O(e.target.value)})}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ge.map(e=>(0,Z.jsxs)(`button`,{type:`button`,disabled:D.includes(e),onClick:()=>O(D.trim()?`${D.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Z.jsx)(_,{size:13,"aria-hidden":`true`}),e]},e))}),(0,Z.jsx)(Je,{busy:P,onBack:()=>a(1),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(e,{"aria-hidden":`true`}),P?`Checking…`:`Check`]}),onNext:()=>void z(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),i===3&&B&&(0,Z.jsxs)(Z.Fragment,{children:[n(B,M,N),(0,Z.jsx)(Je,{busy:P,onBack:()=>a(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(o,{"aria-hidden":`true`}),`Start`]}),disabled:H||V&&!M,onNext:()=>r(k,!!V&&M),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:H?`Change what is not possible first.`:V&&!M?`Accept the limits to start.`:`Runs in the background.`})})]})]}),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(nt,{view:t,kind:l,src:d,found:v,to:y,other:x,instructions:D})})]})]})}function it({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(R,{}),(0,Z.jsx)(`main`,{className:C(z,`@container flex-auto gap-6`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function at({action:e,chat:t}){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-4`,children:[(0,Z.jsx)(B,{pixel:V.migration,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Migration`})]}),(0,Z.jsx)(U,{label:`Migration`,links:G,current:`migration`}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[t,e]})]})}function ot({error:e}){return e?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function st({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-2 flex list-none flex-col gap-2 p-0`,children:[t.map(e=>(0,Z.jsxs)(`li`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,Z.jsx)(`code`,{className:`mt-1 block overflow-x-auto rounded-[8px] bg-bg px-2 py-1 font-mono text-[13px] 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 ct({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-6`,children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2 rounded-[14px] card border px-6 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-6 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)(u,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 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-4 rounded-[14px] bg-warn-soft px-6 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)(u,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-2 pl-6 text-sm text-ink`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[e.text,(0,Z.jsx)(st,{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)(ce,{checked:!!t,onCheckedChange:n}),`I understand`]})]}),(0,Z.jsxs)(W,{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-4 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:xe[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-[13px] text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function lt({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 S.start(e.id,i,t)).detail)}catch(e){u(e.message),c(!1)}};return(0,Z.jsx)(I,{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.jsxs)(N,{variant:`ghost`,onClick:n,children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(N,{variant:`primary`,disabled:s||i!==e.id,onClick:()=>void d(),"data-tip":`Start the migration`,children:[(0,Z.jsx)(o,{"aria-hidden":`true`}),`Start`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(w,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(ot,{error:l})]})})}function ut({d:e,onStarted:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),s=e.plan.feasibility.findings.some(e=>e.level===`limit`),c=e.plan.feasibility.verdict===`blocked`,l=!!e.job?.running;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.job?.last&&!l&&(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 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)(ct,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!c&&!l&&(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(N,{variant:`primary`,disabled:!e.confirmed&&s&&!n,onClick:()=>a(!0),"data-tip":`Start the migration`,children:[(0,Z.jsx)(o,{"aria-hidden":`true`}),`Start`]})}),i&&(0,Z.jsx)(lt,{plan:e.plan,acceptLimits:s&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}function dt(e){return e.result?.status===`running`?`running`:e.result?.status===`migrated`?`done`:e.result?`review`:`planned`}function ft(e){return e.result?ye[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:be[e.verdict]}function pt({view:e}){let[t,n]=(0,X.useState)(`all`),r=t=>t===`all`?e.plans.length:e.plans.filter(e=>dt(e)===t).length,i=e.plans.filter(e=>t===`all`||dt(e)===t),a=e=>location.hash=A(`migration`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Se,{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)(H,{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-2 pr-4 pl-4 font-medium`,children:`Migration`}),(0,Z.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @3xl:table-cell`,children:`Source`}),(0,Z.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Tests`}),(0,Z.jsx)(`th`,{className:`py-2 pr-4 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-2 pr-4 font-medium @xl:table-cell`,children:`Updated`})]}),children:i.map(e=>{let t=ft(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:F,children:[(0,Z.jsx)(`td`,{className:P,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-4`,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)(b,{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:A(`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-[13px] text-muted`,children:e.to})]})]})}),(0,Z.jsx)(`td`,{className:C(P,`hidden max-w-[260px] @3xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 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:C(P,`w-[180px] text-[13px]`),children:e.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Te,{value:n,label:`${e.source} to ${e.target}: progress`}),(0,Z.jsxs)(`span`,{className:`w-9 flex-none text-right text-[13px] 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:C(P,`whitespace-nowrap`),children:(0,Z.jsx)(T,{tone:t.tone,children:t.label})}),(0,Z.jsx)(`td`,{className:C(P,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),children:se(e.result?.endedAt||e.result?.at||e.createdAt)})]},e.id)})})]})}function mt({sub:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),c=(0,X.useCallback)(()=>{S.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=A(`migration`,`new`),f=!t&&!r&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return e===`new`?(0,Z.jsxs)(it,{children:[(0,Z.jsx)(at,{}),(0,Z.jsx)(ot,{error:r}),f,t&&(0,Z.jsx)(rt,{view:t,review:(e,t,n)=>(0,Z.jsx)(ct,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>o({d:e,accept:t})}),a&&(0,Z.jsx)(lt,{plan:a.d.plan,acceptLimits:a.accept,onClose:()=>o(null),onStarted:e=>location.hash=A(`migration`,e.plan.id)})]}):u?(0,Z.jsxs)(it,{wide:!0,children:[(0,Z.jsx)(at,{}),(0,Z.jsx)(ot,{error:r}),f,t&&(0,Z.jsx)(He,{id:u,view:t,plan:e=>(0,Z.jsx)(ut,{d:e,onStarted:()=>location.reload()})},u)]}):(0,Z.jsxs)(it,{children:[(0,Z.jsx)(at,{chat:(0,Z.jsx)(le,{id:`migration`}),action:t&&!t.plans.length?void 0:(0,Z.jsxs)(N,{variant:`primary`,disabled:!t,onClick:d,"data-tip":`New migration`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`New`]})}),(0,Z.jsx)(ot,{error:r}),f,t&&(t.plans.length?(0,Z.jsx)(pt,{view:t}):(0,Z.jsx)(O,{icon:s,title:`No migrations yet`,action:(0,Z.jsxs)(N,{size:`sm`,onClick:d,"data-tip":`New migration`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),`New`]}),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{mt as Migration};