@capagents/forgeqe 3.1.6 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forgeqe.js +1753 -1752
- package/dist/web/assets/{3d-force-graph-DhjnuSZ7.js → 3d-force-graph-OeCdKJJ-.js} +1 -1
- package/dist/web/assets/{Agent-BvZNnkYO.js → Agent-DrdDwck4.js} +1 -1
- package/dist/web/assets/{AgentWork-CXqq9ihT.js → AgentWork-wNaA-i2T.js} +1 -1
- package/dist/web/assets/ApiTests-B3X6NIn8.js +10 -0
- package/dist/web/assets/{Browse-DU423cZs.js → Browse-Cd1DEgYR.js} +1 -1
- package/dist/web/assets/{Chat-D128NJm9.js → Chat-4GknHS5Z.js} +1 -1
- package/dist/web/assets/{CommandPalette-CqHeNMlz.js → CommandPalette-zRrrp6F_.js} +1 -1
- package/dist/web/assets/{Compare-Cfhl9eEb.js → Compare-DJVhkzqO.js} +1 -1
- package/dist/web/assets/{Cost-BZ34Hxth.js → Cost-CbKnuQuB.js} +1 -1
- package/dist/web/assets/{Data-BQx6Yjyt.js → Data-Bt5yqqvq.js} +1 -1
- package/dist/web/assets/{Desktop-XvNM9FOF.js → Desktop-CPDo3Ir-.js} +1 -1
- package/dist/web/assets/{DesktopReview-hvUm15-5.js → DesktopReview-CCaqTSu5.js} +1 -1
- package/dist/web/assets/{Evidence-Cfk59P10.js → Evidence-BAuIgj1h.js} +1 -1
- package/dist/web/assets/{Explore-BDyb5dKe.js → Explore-BqzEPdP7.js} +1 -1
- package/dist/web/assets/{Features-XIqYxKc1.js → Features-DFuPCW9x.js} +1 -1
- package/dist/web/assets/{Flags-CdHPrNp4.js → Flags-UBakvqIq.js} +1 -1
- package/dist/web/assets/{Flaky-DwDQRut-.js → Flaky-DUzdfQW4.js} +1 -1
- package/dist/web/assets/{Impact-t9iOQDtS.js → Impact-jLZqUzz9.js} +1 -1
- package/dist/web/assets/{Jobs-48PdEMgf.js → Jobs-De3NyY5s.js} +1 -1
- package/dist/web/assets/{KindPage-Dy0J7L-M.js → KindPage-DWznWcLB.js} +1 -1
- package/dist/web/assets/{Migration-0HYN_JZm.js → Migration-BdOq6RO6.js} +1 -1
- package/dist/web/assets/{PageAgent-DY8YEIdr.js → PageAgent-dVvZtNoB.js} +1 -1
- package/dist/web/assets/{Product-Ba9C8kLQ.js → Product-ByZ8Qr3i.js} +3 -3
- package/dist/web/assets/{Production-DzfDMnnj.js → Production-D8L2TchK.js} +1 -1
- package/dist/web/assets/{Quality-CnURaQom.js → Quality-CSZEuhZo.js} +1 -1
- package/dist/web/assets/{Readiness-DlwnwSJ8.js → Readiness-bBu_84mx.js} +1 -1
- package/dist/web/assets/{Record-CrJyzp8u.js → Record-DWJEDj2C.js} +1 -1
- package/dist/web/assets/{Regression-D-qjvr44.js → Regression-D2VkPIhZ.js} +1 -1
- package/dist/web/assets/{Reports-BspqEzVg.js → Reports-dF-O5HTI.js} +1 -1
- package/dist/web/assets/{Response-BxvDBStv.js → Response-D4JW3pwi.js} +1 -1
- package/dist/web/assets/{Responsive-C4chhZcc.js → Responsive-CLX9S27s.js} +1 -1
- package/dist/web/assets/{RunDiff-D8NBOHwI.js → RunDiff-BuL_-GwF.js} +1 -1
- package/dist/web/assets/{Runs-Bb2krvLN.js → Runs-DyyaAiyA.js} +1 -1
- package/dist/web/assets/{Settings-D2Byn_Va.js → Settings-DnG6_QQj.js} +3 -3
- package/dist/web/assets/{Steps-CymeLF90.js → Steps-C-0zwG7T.js} +1 -1
- package/dist/web/assets/{TestCases-DYTIR2LB.js → TestCases-DXk9qsEL.js} +1 -1
- package/dist/web/assets/{TestData-UNmAG8Wi.js → TestData-D4al7-3Z.js} +1 -1
- package/dist/web/assets/{TestDebt-CQOYiRaK.js → TestDebt-BzOVDuS8.js} +1 -1
- package/dist/web/assets/{TestManagement-DWNUDF7y.js → TestManagement-T-NIlhc9.js} +1 -1
- package/dist/web/assets/{Tosca-BJsofAG8.js → Tosca-D7tqMGK0.js} +1 -1
- package/dist/web/assets/{WhatsNew-Gs-_0But.js → WhatsNew-DBViE2Qt.js} +1 -1
- package/dist/web/assets/{dataParts-DV44YXP9.js → dataParts-D56_9p6T.js} +1 -1
- package/dist/web/assets/{fold-CdtPs-3w.js → fold-UP5ihvz-.js} +1 -1
- package/dist/web/assets/{head-EHQVlLa5.js → head-BpR3dGRT.js} +1 -1
- package/dist/web/assets/{highlight-DIktyogB.js → highlight--Ayfy7Gy.js} +1 -1
- package/dist/web/assets/{index-Cq2sihjc.js → index-CljX5dI4.js} +5 -5
- package/dist/web/assets/{logos-B1BhmXnA.js → logos-B4e5nBuL.js} +1 -1
- package/dist/web/assets/{paletteCommands-w1UNWBRa.js → paletteCommands-ar4wAGok.js} +1 -1
- package/dist/web/assets/{qualityParts-B8bouYKy.js → qualityParts-D_U5zhKC.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/prompts/test-plan.md +1 -1
- package/prompts/test-reviewer.md +1 -1
- package/prompts/test-rules.md +6 -1
- package/py/forgeqe_engine/brand.py +45 -27
- package/py/forgeqe_engine/browser.py +34 -1
- package/py/forgeqe_engine/browserlaunch.py +16 -3
- package/py/forgeqe_engine/orb_assets.py +30 -0
- package/py/forgeqe_engine/profilename.py +168 -0
- package/py/forgeqe_engine/pwlaunch.mjs +3 -2
- package/py/forgeqe_engine/service.py +7 -1
- package/py/forgeqe_engine/settings.py +17 -0
- package/skills/bdd-gherkin/SKILL.md +3 -0
- package/dist/web/assets/ApiTests-B26ezscO.js +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Features-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$n as n,A as r,At as i,Bn as a,C as o,Dn as s,Dr as c,Dt as l,Er as u,Et as d,F as f,Fn as p,Ft as m,G as h,H as g,Hn as _,Hr as v,I as y,In as b,Jn as x,K as S,Kt as C,Ln as w,Lr as T,M as E,N as D,Nn as O,O as k,Pt as A,Qn as j,Rn as M,Rr as N,Rt as P,St as F,Tr as I,Un as ee,Vr as L,Wt as te,Xt as R,Yn as ne,Zn as re,_t as ie,an as ae,ar as oe,bt as se,d as z,dn as ce,fn as le,g as ue,ht as de,in as fe,kt as pe,l as me,lt as he,mt as ge,n as _e,on as ve,ot as ye,pn as B,r as be,rr as xe,s as Se,sr as Ce,tr as we,u as Te,ur as Ee,ut as De,v as Oe,wr as ke,xn as Ae,xr as je,xt as Me}from"./route-Dg53WdFu.js";import{D as Ne,E as Pe,f as V,g as Fe,k as Ie,n as Le}from"./agents-C0Jg2pN8.js";import{t as Re}from"./jsx-runtime-LKYXHABd.js";import{$ as ze,A as H,At as Be,Bt as Ve,H as He,It as Ue,Lt as We,N as Ge,Pt as Ke,V as qe,W as Je,bt as Ye,ct as Xe,it as Ze,j as Qe,jt as $e,l as et,n as U,ot as tt,pt as nt,r as rt,s as it,t as W}from"./input-D7iHeNXz.js";import{a as at,c as ot,d as G,f as st,i as ct,l as lt,o as ut,t as dt}from"./filters-Culzq1j1.js";import{A as ft,C as pt,D as mt,E as ht,I as gt,L as _t,M as vt,O as yt,P as bt,S as xt,T as St,_ as Ct,a as wt,b as Tt,g as Et,h as Dt,i as Ot,k as kt,m as At,u as jt,v as Mt,w as Nt,y as Pt}from"./palette-lUno7fso.js";import{An as Ft,At as It,Bn as Lt,C as Rt,Cn as K,Ct as zt,Dn as Bt,Dt as Vt,Et as q,Ft as Ht,Gn as Ut,Gt as Wt,Ht as Gt,J as Kt,K as qt,Kn as Jt,Kt as Yt,Lt as Xt,Mn as Zt,Mt as Qt,Nt as $t,O as en,Ot as tn,Pt as nn,S as rn,Sn as an,St as on,T as sn,Tt as J,Vn as cn,Vt as ln,X as un,Y as dn,Z as fn,Zt as pn,b as mn,bn as Y,bt as hn,ct as gn,dn as _n,dt as vn,fn as yn,ft as bn,g as xn,hn as Sn,ht as Cn,jn as wn,jt as Tn,kt as En,lt as Dn,mt as On,n as kn,pn as An,pt as jn,st as Mn,t as Nn,u as Pn,un as Fn,ut as In,vn as Ln,w as Rn,wn as zn,wt as X,x as Bn,xn as Vn,y as Hn,yn as Z,zn as Un}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Features-DFuPCW9x.js","assets/rolldown-runtime-XKyaHtl9.js","assets/route-Dg53WdFu.js","assets/jsx-runtime-LKYXHABd.js","assets/input-D7iHeNXz.js","assets/filters-Culzq1j1.js","assets/palette-lUno7fso.js","assets/agents-C0Jg2pN8.js","assets/index-CljX5dI4.js","assets/index-CwAqcn-z.css","assets/WhatsNew-DBViE2Qt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$n as n,A as r,At as i,Bn as a,C as o,Dn as s,Dr as c,Dt as l,Er as u,Et as d,F as f,Fn as p,Ft as m,G as h,H as g,Hn as _,Hr as v,I as y,In as b,Jn as x,K as S,Kt as C,Ln as w,Lr as T,M as E,N as D,Nn as O,O as k,Pt as A,Qn as j,Rn as M,Rr as N,Rt as P,St as F,Tr as I,Un as ee,Vr as L,Wt as te,Xt as R,Yn as ne,Zn as re,_t as ie,an as ae,ar as oe,bt as se,d as z,dn as ce,fn as le,g as ue,ht as de,in as fe,kt as pe,l as me,lt as he,mt as ge,n as _e,on as ve,ot as ye,pn as B,r as be,rr as xe,s as Se,sr as Ce,tr as we,u as Te,ur as Ee,ut as De,v as Oe,wr as ke,xn as Ae,xr as je,xt as Me}from"./route-Dg53WdFu.js";import{D as Ne,E as Pe,f as V,g as Fe,k as Ie,n as Le}from"./agents-C0Jg2pN8.js";import{t as Re}from"./jsx-runtime-LKYXHABd.js";import{$ as ze,A as H,At as Be,Bt as Ve,H as He,It as Ue,Lt as We,N as Ge,Pt as Ke,V as qe,W as Je,bt as Ye,ct as Xe,it as Ze,j as Qe,jt as $e,l as et,n as U,ot as tt,pt as nt,r as rt,s as it,t as W}from"./input-D7iHeNXz.js";import{a as at,c as ot,d as G,f as st,i as ct,l as lt,o as ut,t as dt}from"./filters-Culzq1j1.js";import{A as ft,C as pt,D as mt,E as ht,I as gt,L as _t,M as vt,O as yt,P as bt,S as xt,T as St,_ as Ct,a as wt,b as Tt,g as Et,h as Dt,i as Ot,k as kt,m as At,u as jt,v as Mt,w as Nt,y as Pt}from"./palette-lUno7fso.js";import{An as Ft,At as It,Bn as Lt,C as Rt,Cn as K,Ct as zt,Dn as Bt,Dt as Vt,Et as q,Ft as Ht,Gn as Ut,Gt as Wt,Ht as Gt,J as Kt,K as qt,Kn as Jt,Kt as Yt,Lt as Xt,Mn as Zt,Mt as Qt,Nt as $t,O as en,Ot as tn,Pt as nn,S as rn,Sn as an,St as on,T as sn,Tt as J,Vn as cn,Vt as ln,X as un,Y as dn,Z as fn,Zt as pn,b as mn,bn as Y,bt as hn,ct as gn,dn as _n,dt as vn,fn as yn,ft as bn,g as xn,hn as Sn,ht as Cn,jn as wn,jt as Tn,kt as En,lt as Dn,mt as On,n as kn,pn as An,pt as jn,st as Mn,t as Nn,u as Pn,un as Fn,ut as In,vn as Ln,w as Rn,wn as zn,wt as X,x as Bn,xn as Vn,y as Hn,yn as Z,zn as Un}from"./index-CljX5dI4.js";import{C as Wn,S as Gn,_ as Kn,a as qn,b as Jn,c as Yn,d as Xn,f as Zn,g as Qn,h as $n,i as er,l as tr,m as nr,n as rr,o as ir,p as ar,r as or,s as sr,t as cr,u as lr,v as ur,w as dr,x as fr,y as pr}from"./coverage-BB9BLjGz.js";var Q=e(v(),1),$=Re();function mr({names:e,max:t=4}){let n=e.slice(0,t);return(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[n.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[13px] text-ink-2`,"data-tip":V(e).name,children:[(0,$.jsx)(wt,{agent:e,px:16,decorative:!0}),V(e).name]},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`+`,e.length-t,` more`]}),!e.length&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not used by an agent`})]})}function hr({p:e}){return(0,$.jsx)(`span`,{className:H(`rounded-full px-2 py-1 text-[13px] font-medium whitespace-nowrap`,e.outdated?`bg-warn-soft text-warn`:e.edited?`bg-accent-soft text-accent-fg`:`bg-surface-strong text-muted`),children:e.outdated?`Edited, older base`:e.edited?`Edited`:`ForgeQE's`})}function gr(e){let t=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{head:t[0],body:e.slice(t[0].length)}:{head:``,body:e}}var _r=e=>e.replace(/\{\{>\s*([\w-]+)\s*\}\}/g,`the shared part $1`);function vr(e){return e.replace(/^[ \t]*\{\{>\s*([\w-]+)\s*\}\}[ \t]*$/gm,(e,t)=>`> Also includes ForgeQE's shared part: ${t}`)}function yr({label:e,rows:t}){return(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(nn,{label:e,search:!1,empty:`No prompt matches.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:Xt,children:`Prompt`}),(0,$.jsx)(`th`,{scope:`col`,className:H(Xt,`hidden @2xl:table-cell`),children:`Used by`}),(0,$.jsx)(`th`,{scope:`col`,className:H(Xt,`text-right`),children:`Status`})]}),children:t.map(e=>(0,$.jsxs)(`tr`,{onClick:e.onOpen,className:`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,$.jsxs)(`td`,{className:H(Ht,`min-w-0`),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t=>(t.stopPropagation(),e.onOpen()),className:`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-left`,children:[e.mark,(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink hover:underline`,children:e.name})]}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-[13px] text-muted`,children:e.about})]}),(0,$.jsx)(`td`,{className:H(Ht,`hidden w-[34%] @2xl:table-cell`),children:(0,$.jsx)(mr,{names:e.agents,max:2})}),(0,$.jsx)(`td`,{className:H(Ht,`w-[1%] text-right whitespace-nowrap`),children:e.state})]},e.key))})})}function br({p:e,onOpen:t,agents:n=!0}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Open ${e.name}`,className:`grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(lt,{icon:Me,size:16,className:`text-muted`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:_r(e.description||e.usedBy)}),n?(0,$.jsx)(mr,{names:e.agents}):e.agents.length>1&&(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Shared with `,Qe(e.agents.length-1,`other agent`),`: editing it changes them too`]})]}),(0,$.jsx)(hr,{p:e})]})}function xr({t:e,onOpen:t}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Edit ${e.name}`,className:`grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] border-0 bg-transparent px-4 py-2 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(c,{size:16,strokeWidth:1.8,"aria-hidden":`true`,className:`text-accent-fg`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.description||e.text.split(`
|
|
3
3
|
`)[0]}),(0,$.jsx)(mr,{names:e.agents})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-pass-soft px-2 py-1 text-[13px] font-medium whitespace-nowrap text-pass`,children:`Yours`})]})}function Sr({onChanged:e}){let{data:t,error:n,reload:r}=hn(He.prompts),[i,a]=(0,Q.useState)(`all`),[o,s]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(`read`),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(``),E=o.toLowerCase().split(/\s+/).filter(Boolean),O=e=>E.every(t=>e.toLowerCase().includes(t)),A=(0,Q.useMemo)(()=>(t?.prompts||[]).filter(e=>O(`${e.name} ${e.description} ${e.usedBy} ${e.agents.map(e=>V(e).name).join(` `)}`)),[t,o]),j=(0,Q.useMemo)(()=>(t?.team||[]).filter(e=>O(`${e.name} ${e.description} ${e.text} ${e.agents.map(e=>V(e).name).join(` `)}`)),[t,o]),P=async t=>{T(``);try{let e=await He.prompt(t);u(e),f(e.text),m(!1),g(`read`)}catch(t){e(t.message)}},F=async t=>{try{let e=await He.agentPrompt(t);b({agent:t,text:e.text})}catch(t){e(t.message)}},I=async(t,n,i)=>{C(!0),T(``);try{await t(),i(),r(),e(n)}catch(e){T(e.message)}finally{C(!1)}};if(!t)return(0,$.jsx)(In,{error:n,reload:r});let L=t.prompts.find(e=>e.name===l?.name),te=t.agents,R=[{id:`all`,label:`All prompts`,n:t.prompts.length},{id:`agents`,label:`By agent`,n:te.length},{id:`team`,label:`Your prompts`,n:t.team.length}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Wt,{label:`Show`,value:i,onChange:a,options:R.map(e=>({id:e.id,label:e.label,n:e.n}))}),(0,$.jsx)(ct,{id:`find-a-prompt`,label:`Find a prompt`,value:o,onChange:s,placeholder:`Find a prompt or agent`}),(0,$.jsxs)(G,{variant:`primary`,"data-tip":`Add a prompt`,onClick:()=>(T(``),v({name:``,description:``,agents:[],text:``})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),i===`agents`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:te.filter(e=>A.some(t=>t.agents.includes(e.name))||j.some(t=>t.agents.includes(e.name))).map(e=>{let t=V(e.name),n=A.filter(t=>t.agents.includes(e.name)).sort((t,n)=>t.name===e.prompt?-1:n.name===e.prompt?1:t.name.localeCompare(n.name)),r=j.filter(t=>t.agents.includes(e.name));return(0,$.jsxs)(`section`,{"aria-labelledby":`agent-${e.name}`,className:`rounded-[14px] card border p-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(wt,{agent:e.name,px:28,decorative:!0}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{id:`agent-${e.name}`,className:`m-0 text-[16px] font-semibold`,style:{color:t.hue},children:t.name}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.title})]}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[Qe(n.length,`prompt`),r.length?` · ${r.length} yours`:``]}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Full prompt of ${t.name}`,"data-tip":`Full prompt of ${t.name}`,onClick:()=>F(e.name),children:(0,$.jsx)(De,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:[n.map(e=>(0,$.jsx)(br,{p:e,agents:!1,onOpen:()=>P(e.name)},e.name)),r.map(e=>(0,$.jsx)(xr,{t:e,onOpen:()=>(T(``),v({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))},e.name))]})]},e.name)})}),i===`all`&&(0,$.jsx)(yr,{label:`All prompts`,rows:A.map(e=>({key:e.name,name:e.name,about:_r(e.description||e.usedBy),agents:e.agents,state:(0,$.jsx)(hr,{p:e}),onOpen:()=>P(e.name)}))}),i===`team`&&(t.team.length===0?(0,$.jsx)(ut,{icon:x,title:`No prompts of your own yet`,action:(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add a prompt`,onClick:()=>v({name:``,description:``,agents:[],text:``}),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]}),children:`Write instructions once for the agents that should follow them: "Tag every test with its Azure DevOps work item id" for Quill, or "Answer in British English" for Atlas. They are added at the end of those agents' instructions, saved in .forgeqe/prompts/team, and shared with the project.`}):(0,$.jsx)(yr,{label:`Your prompts`,rows:j.map(e=>({key:e.name,name:e.name,about:e.description||e.text.split(`
|
|
4
4
|
`)[0]||``,agents:e.agents,mark:(0,$.jsx)(c,{size:15,strokeWidth:1.8,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),state:(0,$.jsx)(`span`,{className:`rounded-full bg-pass-soft px-2 py-1 text-[13px] font-medium whitespace-nowrap text-pass`,children:`Yours`}),onOpen:()=>(T(``),v({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))}))})),(0,$.jsx)(Jt,{wide:!0,open:!!l,onClose:()=>u(null),title:l?.name||``,description:_r(L?.description||L?.usedBy||``),footer:(0,$.jsxs)($.Fragment,{children:[w&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail`,children:w}),L?.edited&&L.source===`project`&&(0,$.jsxs)(G,{disabled:S,onClick:()=>l&&I(()=>He.resetPrompt(l.name),`${l.name} is ForgeQE's own prompt again.`,()=>u(null)),className:`mr-auto`,"data-tip":`Reset to ForgeQE's own prompt`,children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Reset`]}),(0,$.jsxs)(G,{onClick:()=>u(null),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:S||!l||d===l.text,onClick:()=>l&&I(()=>He.savePrompt(l.name,d),`Saved your copy of ${l.name}.`,()=>u(null)),children:[(0,$.jsx)(k,{"aria-hidden":`true`}),S?`Saving…`:`Save`]})]}),children:l&&(()=>{let{head:e,body:t}=gr(d);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Used by`}),(0,$.jsx)(`dd`,{className:`m-0`,children:L?(0,$.jsx)(mr,{names:L.agents,max:8}):null}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Status`}),(0,$.jsx)(`dd`,{className:`m-0`,children:L?(0,$.jsx)(hr,{p:L}):null})]}),L?.edited&&L.source!==`project`&&(0,$.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2`,children:[`This prompt comes from a `,L.source,` copy; saving here makes a project copy, which the shared folder still wins over.`]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft pt-4`,children:[(0,$.jsx)(Wt,{label:`Show the prompt`,value:h,onChange:g,options:[{id:`read`,label:`Read`},{id:`edit`,label:`Edit`}]}),L?.edited&&(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":p,onClick:()=>m(!p),"data-tip":p?`Hide ForgeQE's original`:`Compare with ForgeQE's original`,className:`inline-flex min-h-10 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[p?(0,$.jsx)(D,{"aria-hidden":`true`}):(0,$.jsx)(ie,{"aria-hidden":`true`}),p?`Hide`:`Compare`]})]}),(0,$.jsx)(Un,{open:p,children:(0,$.jsx)(`div`,{className:`max-h-[40vh] overflow-auto rounded-[12px] bg-surface-muted p-4`,children:(0,$.jsx)(en,{text:vr(gr(l.builtin).body),className:`text-[13px]`})})}),h===`read`?(0,$.jsx)(en,{text:vr(t),className:`text-[16px]`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`prompt-text`,className:`sr-only`,children:`Prompt`}),(0,$.jsx)(Hn,{id:`prompt-text`,value:t,lang:`markdown`,onChange:t=>f(e+t)}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Saved to `,(0,$.jsxs)(`span`,{className:`font-mono`,children:[`.forgeqe/prompts/`,l.name,`.md`]}),`; new chats and runs use it.`]})]})]})})()}),(0,$.jsx)(Jt,{wide:!0,open:!!_,onClose:()=>v(null),title:_?.existing?`Edit ${_.existing}`:`Add a prompt`,description:(0,$.jsxs)($.Fragment,{children:[`Added at the end of the chosen agents' instructions, from their next start. Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[`.forgeqe/prompts/team/`,_?.name||`name`,`.md`]}),`, shared with the project.`]}),footer:(0,$.jsxs)($.Fragment,{children:[w&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:w}),_?.existing&&(0,$.jsxs)(G,{disabled:S,onClick:()=>_.existing&&I(()=>He.deleteTeamPrompt(_.existing),`Removed ${_.existing}.`,()=>v(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(je,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(G,{onClick:()=>v(null),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:S||!_?.name||!_.agents.length||!_.text.trim(),onClick:()=>_&&I(()=>_.existing?He.saveTeamPrompt(_.existing,_):He.addTeamPrompt(_),`${_.existing?`Saved`:`Added`} ${_.name}: ${_.agents.map(e=>V(e).name).join(`, `)} use it from their next start.`,()=>v(null)),children:[_?.existing?(0,$.jsx)(k,{"aria-hidden":`true`}):(0,$.jsx)(M,{"aria-hidden":`true`}),S?`Saving…`:_?.existing?`Save`:`Add`]})]}),children:_&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,$.jsx)(W,{value:_.name,disabled:!!_.existing,placeholder:`tag-tests-with-work-items`,onChange:e=>v({..._,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,48)}),className:`font-mono`}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Lowercase letters, digits and dashes.`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`What it is for`}),(0,$.jsx)(W,{value:_.description,maxLength:200,placeholder:`Tests carry the work item they cover`,onChange:e=>v({..._,description:e.target.value})})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 p-0 font-medium`,children:`Agents that follow it`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:te.map(e=>{let t=_.agents.includes(e.name);return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,"data-tip":e.title,onClick:()=>v({..._,agents:t?_.agents.filter(t=>t!==e.name):[..._.agents,e.name]}),className:H(`inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-[8px] border px-4 text-[13px] font-medium`,t?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[(0,$.jsx)(wt,{agent:e.name,px:18,decorative:!0}),V(e.name).name]},e.name)})})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Instructions`}),(0,$.jsx)(rt,{rows:14,spellCheck:!0,value:_.text,placeholder:`Tag every test with the Azure DevOps work item it covers, as [Property("WorkItem", "1234")].
|
|
5
5
|
If the request names no work item, ask for it.`,onChange:e=>v({..._,text:e.target.value}),className:`leading-[1.6]`}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Plain words, as you would tell a colleague. Use MUST for a rule the agent may never break.`})]})]})}),(0,$.jsx)(Jt,{wide:!0,open:!!y,onClose:()=>b(null),title:y?`${V(y.agent).name}: full prompt`:``,description:`What the agent starts with now: ForgeQE's prompt (or your edited copy), with the included parts and your prompts for it.`,footer:(0,$.jsxs)(G,{onClick:()=>b(null),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Close`]}),children:y&&(0,$.jsx)(en,{text:vr(gr(y.text).body),className:`mt-4 text-[16px]`})})]})}var Cr={prebuilt:`ForgeQE's`,project:`This project`,user:`Yours`,external:`Claude / agent skill`,extra:`Shared folder`};function wr({agents:e,max:t=6}){return(0,$.jsxs)(`span`,{className:`flex items-center -space-x-1`,children:[e.slice(0,t).map(e=>(0,$.jsx)(`span`,{role:`img`,"aria-label":V(e).name,"data-tip":V(e).name,className:`rounded-md bg-bg p-1 ring-1 ring-line-soft`,children:(0,$.jsx)(wt,{agent:e,px:18,decorative:!0})},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`pl-2 text-[13px] text-muted`,children:[`+`,e.length-t]})]})}function Tr({edit:e}){let{data:i,error:a,reload:o}=hn(He.skills),s=Z(e.value,[`skills`,`disable`])||[],c=t=>e.set(K(e.value,[`skills`,`disable`],t.length?t:void 0)),[l,u]=(0,Q.useState)(`all`),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),D=d.toLowerCase().split(/\s+/).filter(Boolean),A=(0,Q.useMemo)(()=>(i?.skills||[]).filter(e=>D.every(t=>`${e.name} ${e.description} ${e.users.map(e=>V(e).name).join(` `)}`.toLowerCase().includes(t))),[i,d]),j=async(e,t,n)=>{S(!0),w(``);try{await e(),n(),o(),E(t)}catch(e){w(e.message)}finally{S(!1)}},P=async e=>{try{let t=await He.skill(e.name);g({name:e.name,text:t.text,editable:t.editable})}catch(e){E(e.message)}},F=(e,t)=>(v(t?[..._,t]:[]),P(e)),I=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();w(``),g(null),b({name:e.name,description:e.description,agents:e.agents,body:n,existing:e.name})},ee=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();w(``),g(null),b({name:e.name,description:e.description,agents:e.agents,body:n,copyOf:e.name})},L=e=>i?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)||``,te=e=>(0,$.jsx)(`span`,{className:H(`rounded-full px-2 py-px text-[13px] font-medium whitespace-nowrap`,e.source===`project`?`bg-pass-soft text-pass`:`bg-surface-strong text-muted`),children:Cr[e.source]||e.source}),R=e=>{let t=!s.includes(e.name);return(0,$.jsx)(Fn,{checked:t,onChange:t=>c(t?s.filter(t=>t!==e.name):[...s,e.name]),label:`Use ${e.name}`})},ne=Z(e.value,[`skills`,`enabled`])!==!1,re=(e,t)=>{let n=!s.includes(e.name);return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 hover:bg-surface-muted`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>F(e),"aria-label":`Read ${e.name}`,className:`flex min-w-0 cursor-pointer flex-col gap-1 border-0 bg-transparent p-0 text-left`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:H(`font-mono text-[13px] font-medium`,n?`text-ink`:`text-muted line-through`),children:e.name}),(0,$.jsx)(`span`,{className:H(`rounded-full px-2 py-px text-[13px] font-medium`,e.source===`project`?`bg-pass-soft text-pass`:`bg-surface-strong text-muted`),children:Cr[e.source]||e.source})]}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.description}),t&&(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,$.jsx)(wr,{agents:e.users}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:i?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)})]})]}),(0,$.jsx)(Fn,{checked:n,onChange:t=>c(t?s.filter(t=>t!==e.name):[...s,e.name]),label:`Use ${e.name}`})]},e.name)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`mb-4 rounded-[14px] card border`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":p,onClick:()=>m(!p),className:`flex min-h-12 w-full cursor-pointer items-center gap-4 rounded-[14px] border-0 bg-transparent px-4 text-left hover:bg-surface-muted`,children:[(0,$.jsx)(n,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:`How skills are used`}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[ne?`On`:`Off`,` · `,Qe(s.length,`turned off`,`turned off`),` · `,String(Z(e.value,[`skills`,`browser_max_chars`])??6e3),` characters a browser run`]}),(0,$.jsx)(r,{size:16,"aria-hidden":`true`,className:H(`text-muted transition-transform`,!p&&`-rotate-90`)})]}),(0,$.jsx)(Un,{open:p,children:(0,$.jsx)(`div`,{className:`border-t border-line-soft px-4 pb-2`,children:(0,$.jsx)(X,{defs:jn.fields,edit:e,base:jn.base})})})]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Wt,{label:`Show`,value:l,onChange:u,options:[{id:`agents`,label:`By agent`,n:i.audiences.length},{id:`all`,label:`All skills`,n:i.skills.length}]}),(0,$.jsx)(ct,{id:`find-a-skill`,label:`Find a skill`,value:d,onChange:f,placeholder:`Find a skill or agent`}),(0,$.jsxs)(G,{variant:`primary`,"data-tip":`Add a skill`,onClick:()=>(w(``),b({name:``,description:``,agents:[],body:``})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),T&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 mb-4 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2`,children:T}),i.skills.length===0&&(0,$.jsx)(Dn,{children:`No skills found. Add one for your framework, conventions or app.`}),l===`agents`&&i.audiences.map(e=>{let t=A.filter(t=>t.agents.includes(e.id));return!t.length&&D.length?null:(0,$.jsxs)(`section`,{"aria-labelledby":`aud-${e.id}`,className:`mb-4 rounded-[14px] card border p-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(wr,{agents:e.agents,max:8}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{id:`aud-${e.id}`,className:`m-0 text-[16px] font-semibold`,children:e.label}),(0,$.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:e.agents.map(e=>V(e).name).filter((e,t,n)=>n.indexOf(e)===t).join(`, `)})]}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:Qe(t.length,`skill`)})]}),(0,$.jsx)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:t.length?t.map(e=>re(e,!1)):(0,$.jsx)(`p`,{className:`m-0 px-4 py-2 text-[13px] text-muted`,children:`No skills for them yet.`})})]},e.id)}),l===`all`&&i.skills.length>0&&(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(nn,{label:`All skills`,search:!1,empty:`No skill matches.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Who uses it`}),(0,$.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`From`}),(0,$.jsx)(`th`,{scope:`col`,className:H(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`text-right`),children:`On`})]}),children:A.map(e=>{let t=!s.includes(e.name);return(0,$.jsxs)(`tr`,{onClick:()=>F(e),className:`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:t=>(t.stopPropagation(),F(e)),className:H(`cursor-pointer border-0 bg-transparent p-0 text-left font-mono text-[13px] font-medium hover:underline`,t?`text-ink`:`text-muted line-through`),children:e.name}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-[13px] text-muted`,children:e.description})]}),(0,$.jsx)(`td`,{className:H(`px-4 py-2`,`hidden w-[30%] @2xl:table-cell`),children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(wr,{agents:e.users,max:4}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:L(e)})]})}),(0,$.jsx)(`td`,{className:H(`px-4 py-2`,`hidden w-[1%] @xl:table-cell`),children:te(e)}),(0,$.jsx)(`td`,{className:H(`px-4 py-2`,`w-[1%] text-right`),onClick:e=>e.stopPropagation(),children:R(e)})]},e.name)})})}),i.problems.length?(0,$.jsx)(`div`,{role:`alert`,className:`mt-4 rounded-[12px] bg-warn-soft px-4 py-4 text-sm text-warn`,children:i.problems.map(e=>(0,$.jsx)(`p`,{className:`m-0`,children:e},e))}):null]}):(0,$.jsx)(In,{error:a,reload:o}),(0,$.jsx)(Jt,{wide:!0,open:!!h,onClose:()=>g(null),title:h?.name||``,description:h?.editable?`This project's own skill: you can edit it.`:`ForgeQE's skill: read only. Copy it to edit your own version for this project.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(G,{onClick:()=>g(null),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Close`]}),h?.editable&&(0,$.jsxs)(G,{variant:`primary`,onClick:()=>h&&i&&I(i.skills.find(e=>e.name===h.name),h.text),children:[(0,$.jsx)(O,{"aria-hidden":`true`}),`Edit`]}),h&&!h.editable&&(0,$.jsxs)(G,{variant:`primary`,"data-tip":`Your copy replaces this skill in this project`,onClick:()=>h&&i&&ee(i.skills.find(e=>e.name===h.name),h.text),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Copy to edit`]})]}),children:h&&i&&(()=>{let e=i.skills.find(e=>e.name===h.name),t=_[_.length-1],n=t?i.skills.find(e=>e.name===t):void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[n&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>(v(_.slice(0,-1)),void P(n)),"data-tip":`Back to ${n.name}`,className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start border-0 bg-transparent p-0 text-sm font-medium text-accent-fg hover:text-accent-fg-hover [&>svg]:size-4`,children:[(0,$.jsx)(me,{"aria-hidden":`true`}),`Back`]}),e&&(0,$.jsxs)(`dl`,{className:`m-0 grid grid-cols-[110px_minmax(0,1fr)] items-start gap-x-4 gap-y-2 text-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Use when`}),(0,$.jsx)(`dd`,{className:`m-0 text-ink-2`,children:e.description.replace(/^Use when\s+/i,``)}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Who uses it`}),(0,$.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(wr,{agents:e.users,max:8}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:L(e)})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsx)(`dd`,{className:`m-0`,children:te(e)}),(0,$.jsx)(`dt`,{className:`self-center text-muted`,children:`On`}),(0,$.jsx)(`dd`,{className:`m-0`,children:R(e)})]}),(0,$.jsx)(`div`,{className:`border-t border-line-soft pt-4`,children:(0,$.jsx)(en,{text:vr(gr(h.text).body),className:`text-[16px]`,refs:{names:i.skills.map(e=>e.name).filter(e=>e!==h.name),open:e=>{let t=i.skills.find(t=>t.name===e);t&&F(t,h.name)}}})})]})})()}),(0,$.jsx)(Jt,{wide:!0,open:!!y,onClose:()=>b(null),title:y?.existing?`Edit ${y.existing}`:y?.copyOf?`Copy ${y.copyOf}`:`Add a skill`,description:(0,$.jsxs)($.Fragment,{children:[y?.copyOf&&y.name===y.copyOf&&(0,$.jsxs)($.Fragment,{children:[`Replaces ForgeQE's `,y.copyOf,` in this project. `]}),`Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[`.forgeqe/skills/`,y?.name||`name`,`/SKILL.md`]}),`, shared with the project. The agents read a skill when its "use when" matches the work.`]}),footer:(0,$.jsxs)($.Fragment,{children:[C&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:C}),y?.existing&&(0,$.jsxs)(G,{disabled:x,onClick:()=>y.existing&&j(()=>He.removeSkill(y.existing),`Removed ${y.existing}.`,()=>b(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(je,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(G,{onClick:()=>b(null),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:x||!y?.name||!y.description.trim()||!y.agents.length||!!y.existing&&!y.body.trim(),onClick:()=>y&&j(()=>y.existing?He.saveSkill(y.existing,y):He.addSkill(y),y.existing?`Saved ${y.name}.`:y.copyOf&&y.name===y.copyOf?`Copied ${y.name}: yours is used in this project.`:`Added ${y.name}.`,()=>b(null)),children:[y?.existing?(0,$.jsx)(k,{"aria-hidden":`true`}):(0,$.jsx)(M,{"aria-hidden":`true`}),x?`Saving…`:y?.existing?`Save`:y?.copyOf&&y.name===y.copyOf?`Save copy`:`Add`]})]}),children:y&&i&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Name`}),(0,$.jsx)(W,{value:y.name,disabled:!!y.existing,placeholder:`sap-fiori`,onChange:e=>b({...y,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,64)}),className:`font-mono`})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Use when`}),(0,$.jsx)(W,{value:y.description,placeholder:`Use when the site is SAP Fiori: tiles, smart tables, value help dialogs.`,onChange:e=>b({...y,description:e.target.value})}),(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The agents choose skills by this line: say when it applies.`})]}),(0,$.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`mb-2 p-0 font-medium`,children:`Who it is for`}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.audiences.map(e=>{let t=y.agents.includes(e.id);return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,onClick:()=>b({...y,agents:t?y.agents.filter(t=>t!==e.id):[...y.agents,e.id]}),className:H(`inline-flex min-h-10 cursor-pointer items-center gap-2 rounded-[8px] border px-4 text-[13px] font-medium`,t?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[(0,$.jsx)(wr,{agents:e.agents,max:3}),e.label]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`skill-text`,className:`font-medium`,children:`Instructions`}),(0,$.jsx)(Hn,{id:`skill-text`,value:y.body,lang:`markdown`,onChange:e=>b({...y,body:e})}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[y.existing?``:`Leave it empty to start from ForgeQE's outline for that agent. `,`Markdown; short rules the agent can follow step by step.`]})]})]})})]})}function Er({checked:e,onSelect:t,label:n}){return(0,$.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":n,onClick:t,className:H(`relative inline-flex size-4 flex-none cursor-pointer items-center justify-center rounded-full border-[1.5px] bg-bg p-0 before:absolute before:-inset-2.5 before:content-['']`,e?`border-accent`:`border-muted`),children:(0,$.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-2 rounded-full`,e?`bg-accent`:`bg-transparent`)})})}function Dr(e,t,n){return e?/^[A-Za-z0-9_-][A-Za-z0-9_.-]*$/.test(e)?e!==t&&n.includes(e)?`There is already an environment called ${e}.`:``:`Letters, digits, dots, dashes and underscores only.`:`Give it a name.`}var Or=/^[A-Za-z_][A-Za-z0-9_]*$/,kr=/\.(csv|tsv|json|ya?ml|xlsx|xls|xml|sql|txt)$/i;function Ar(e){for(let[t,n]of Object.entries(e)){if(!Or.test(t))return`${t||`A test data file`}: the name is letters, digits and _`;let e=String(n??``).trim();if(!e)return`${t}: pick its file`;if(!kr.test(e)||e.startsWith(`/`)||/^[A-Za-z]:/.test(e)||e.split(/[\\/]/).some(e=>e===`..`||e.startsWith(`.`)))return`${t}: a data file of the project (.csv, .json, .yaml, .xlsx…)`}return``}var jr=e=>{if(!(`data`in e))return`data`;for(let t=2;;t++)if(!(`data_${t}`in e))return`data_${t}`},Mr=e=>(e.split(/[\\/]/).pop()||``).replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9_]+/g,`_`).replace(/^(?=\d)/,`_`)||`data`,Nr={azure:{subscription:[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,`a subscription id, a GUID`],tenant:[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,`a tenant id, a GUID`],resource_group:[/^[A-Za-z0-9_.()-]{0,89}[A-Za-z0-9_()-]$/,`a resource group's name`]},aws:{account:[/^\d{12}$/,`a 12-digit account id`],region:[/^[a-z]{2}(?:-[a-z]+){1,2}-\d{1,2}$/,`a region such as eu-west-1`],profile:[/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/,`a profile's name`]},gcp:{project:[/^[a-z][a-z0-9-]{4,28}[a-z0-9]$/,`a project id`],region:[/^[a-z]+-[a-z]+\d{1,2}$/,`a region such as europe-west1`]}},Pr={azure:[`subscription`,`Azure`,`subscription id`],aws:[`account`,`AWS`,`account id`],gcp:[`project`,`Google Cloud`,`project id`]};function Fr(e){for(let[t,n]of Object.entries(e)){let e=Nr[t];if(!e||!n||typeof n!=`object`)continue;let r=n,[i,a,o]=Pr[t];if(Object.values(r).some(e=>String(e??``).trim())&&!String(r[i]??``).trim())return`${a}: give its ${o}`;for(let[t,n]of Object.entries(r)){let r=String(n??``).trim(),i=e[t];if(r&&i&&!i[0].test(r))return`${a}: ${i[1]}`}}return``}var Ir=[[`web`,`Web`],[`api`,`API`],[`desktop`,`Windows desktop`],[`mobile`,`Mobile`]],Lr={web:P,api:j,desktop:Ae,mobile:xe};function Rr(e){let t=String(e.kind||`web`),n=[{key:`kind`,label:`Kind`,type:`select`,default:`web`,options:Ir.map(([e,t])=>({value:e,label:t}))}];return(t===`web`||t===`api`)&&n.push({key:`url`,label:`Address`,type:`url`,placeholder:t===`api`?`https://qa.api.example.com/v1`:`https://qa.shop.example.com`}),t===`desktop`&&n.push({key:`path`,label:`Program`,type:`path`,placeholder:`C:\\Program Files\\Contoso\\Billing\\Billing.exe`},{key:`args`,label:`Arguments`,help:`Comma separated.`,type:`list`,placeholder:`--server, qa-db01`}),t===`mobile`&&n.push({key:`platform`,label:`Platform`,type:`select`,options:[{value:`android`,label:`Android`},{value:`ios`,label:`iOS`}]},{key:`app_id`,label:`App id`,type:`path`,placeholder:`com.contoso.courier`},{key:`activity`,label:`Activity`,help:`Android: the activity to start.`,type:`path`,placeholder:`.MainActivity`},{key:`app`,label:`Build to install`,help:`An .apk or .ipa, an https address, or bs://…`,type:`path`}),n.push({key:`description`,label:`Description`,help:`The agent picks apps by this, so say what the app is for.`,type:`text`}),t===`web`&&n.push({key:`login`,label:`Sign-in`,help:`A sign-in from Sign-ins.`,type:`text`,placeholder:`shop-qa`}),n}function zr({value:e,onChange:t}){let n=Object.entries(e);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-surface-strong py-4`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Variables`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Plain values tests read as FORGEQE_VAR_NAME. No secrets here: list those under Secrets.`}),n.map(([n,r],i)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(W,{"aria-label":`Variable name`,value:n,spellCheck:!1,onChange:r=>t(Vn(e,n,r.target.value)),className:`max-w-[200px] flex-[1_1_140px] font-mono`}),(0,$.jsx)(W,{"aria-label":`Value of ${n}`,value:String(r??``),onChange:r=>t({...e,[n]:r.target.value}),className:`flex-[2_1_200px]`}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${n}`,"data-tip":`Remove ${n}`,onClick:()=>{let r={...e};delete r[n],t(r)},children:(0,$.jsx)(je,{"aria-hidden":`true`})})]},i)),(0,$.jsx)(`div`,{children:(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add a variable`,onClick:()=>t({...e,[Ln(e,`name`)]:``}),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})})]})}function Br({value:e,onChange:t}){let n=Array.isArray(e)?e.map(String):[],[r,i]=(0,Q.useState)(``),a=/^[A-Za-z_][A-Za-z0-9_]*$/.test(r.trim());return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-surface-strong py-4`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Secrets`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Passwords and keys this environment's tests and desktop flows read, by name. Their values are kept in your credential store.`}),n.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-line-soft pt-2`,children:[(0,$.jsx)(`code`,{className:`w-full font-mono text-[13px] sm:w-[200px]`,children:e}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(tn,{name:e,field:e,compact:!0})}),(0,$.jsx)(En,{name:e}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Stop using ${e} here`,"data-tip":`Stop using ${e} here`,onClick:()=>t(n.filter(t=>t!==e)),children:(0,$.jsx)(je,{"aria-hidden":`true`})})]},e)),(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),a&&!n.includes(r.trim())&&t([...n,r.trim()]),i(``)},children:[(0,$.jsx)(W,{"aria-label":`Secret's variable name`,value:r,placeholder:`BILLING_PASSWORD_QA`,spellCheck:!1,onChange:e=>i(e.target.value),className:`max-w-[280px] flex-[1_1_200px] font-mono`}),(0,$.jsxs)(G,{size:`sm`,type:`submit`,disabled:!a,"data-tip":`Add a secret`,children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]})]})}var Vr=(e,t)=>(t.startsWith(e)?t.slice(e.length).replace(/^[\\/]+/,``):t).replace(/\\/g,`/`);function Hr({envs:e,layout:t,files:n,base:r,onSplit:i,splitBlocked:a,config:o}){let[s,c]=(0,Q.useState)(null),l=t.layout===`dir`?Vr(r,t.dir):``,u=e=>{let t=n.find(t=>t.name===e);return t?Vr(r,t.path):`${l}/${e}.yaml`},d=Y(e.value.environments),f=Object.keys(d),p=typeof e.value.default==`string`?e.value.default:f[0]||``;return(0,$.jsxs)($.Fragment,{children:[o&&(0,$.jsx)(`div`,{className:`mb-6`,children:t.layout===`dir`?(0,$.jsx)(zt,{def:{key:`dir`,label:`Environments folder`,help:`One YAML file per environment, named after it. Relative to forgeqe.yaml; read from there after you save.`,type:`path`,placeholder:`./environments`},edit:o,base:[`environments`]}):(0,$.jsx)(zt,{def:{key:`file`,label:`Environments file`,help:`All environments in one YAML file. Relative to forgeqe.yaml; read from there after you save. --env NAME or FORGEQE_ENV picks one for a run.`,type:`path`,default:`./env.yaml`},edit:o,base:[`environments`]})}),t.layout===`file`?(0,$.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-x-4 gap-y-4 rounded-[14px] bg-surface-muted px-6 py-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 flex-[1_1_300px] text-sm leading-relaxed text-ink-2`,children:[`All environments are in one file, `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:Vr(r,t.file)}),`. One file per environment is easier to change and review: each goes into`,` `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:`environments/`}),`, and the old file is left as it is.`,a&&(0,$.jsx)(`span`,{className:`mt-1 block text-muted`,children:a})]}),(0,$.jsxs)(G,{size:`sm`,onClick:i,disabled:!!a,"data-tip":`Split into one file each`,children:[(0,$.jsx)(O,{"aria-hidden":`true`}),`Split`]})]}):(0,$.jsxs)(`p`,{className:`mt-0 mb-4 text-sm leading-relaxed text-ink-2`,children:[`Each environment is its own file in `,(0,$.jsxs)(`span`,{className:`font-mono text-[13px]`,children:[l,`/`]}),`. The active one is set in forgeqe.yaml.`]}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`The active one is used when a run names none.`}),(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add an environment`,onClick:()=>c({mode:`add`,from:``,name:Ln(d,f.length?`new-environment`:`qa`),env:{description:``,apps:{}}}),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Active environment`,children:[f.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`No environments yet. Add one with the apps your tests use.`}),f.map(r=>{let i=Y(d[r]),a=Y(i.apps);return(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Er,{checked:p===r,onSelect:()=>e.set({...e.value,default:r}),label:`Use ${r}`}),title:r,meta:(0,$.jsxs)($.Fragment,{children:[[i.description,typeof i.file==`string`?`reads ${i.file}`:`${Object.keys(a).length} app${Object.keys(a).length===1?``:`s`}`,Object.keys(Y(i.data)).length?`${Object.keys(Y(i.data)).length} test data file${Object.keys(Y(i.data)).length===1?``:`s`}`:``].filter(Boolean).map(String).join(`, `),t.layout===`dir`&&(0,$.jsxs)(`span`,{className:`block font-mono text-[13px]`,children:[u(r),n.some(e=>e.name===r)?``:` (new)`]})]}),state:p===r?(0,$.jsx)(`span`,{className:`text-sm text-pass`,children:`Active`}):void 0,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${r}`,"data-tip":`Edit ${r}`,onClick:()=>c({mode:`edit`,from:r,name:r,env:i}),children:(0,$.jsx)(O,{"aria-hidden":`true`})}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${r}`,"data-tip":`Remove ${r}`,onClick:()=>{let t={...d};delete t[r];let n={...e.value,environments:t};p===r&&delete n.default,e.set(n)},children:(0,$.jsx)(je,{"aria-hidden":`true`})})]}),children:null},r)})]}),(0,$.jsx)(Ur,{panel:s,setPanel:c,taken:f,vars:e.vars,dirLayout:t.layout===`dir`,onApply:t=>{t.mode===`add`?e.set({...e.value,...f.length?{}:{default:t.name},environments:{...d,[t.name]:t.env}}):e.set({...e.value,...p===t.from&&e.value.default!==void 0?{default:t.name}:{},environments:{...Vn(d,t.from,t.name),[t.name]:t.env}})}})]})}function Ur({panel:e,setPanel:t,taken:n,vars:r,dirLayout:i,onApply:a}){let[o,s]=(0,Q.useState)(``),c=e?Y(e.env):{},l=Y(c.apps),u=n=>e&&t({...e,env:n}),d={value:c,set:u,vars:r},f=Object.entries(l).filter(([,e])=>(Y(e).kind||`web`)===`web`),p=Object.entries(l).filter(([,e])=>Y(e).kind===`api`),m=typeof c.file==`string`?String(c.file):``,h=Y(c.data),g=e?Dr(e.name,e.from,n):``,_=Y(c.cloud),v=Ar(h)||Fr(_),[y,b]=(0,Q.useState)([]),x=()=>{t(null),s(``),b([])},S=(e,t)=>{u({...e,...e.data?{}:Object.keys(h).length?{data:h}:{},...e.cloud?{}:Object.keys(_).length?{cloud:_}:{},...!e.description&&c.description?{description:c.description}:{}}),s(``),b(t.length?[`Secret values written in the YAML were left out (${t.join(`, `)}): put each in an environment variable and add its name under Secrets.`]:[])};return(0,$.jsx)(Jt,{wide:!0,open:!!e,onClose:x,title:e?.mode===`add`?`Add an environment`:`Edit ${e?.from}`,description:`The apps, values and secrets tests use in one place, such as QA or staging. Changes apply when you press the button below; a secret's value goes to your credential store as you type it.`,footer:(0,$.jsxs)($.Fragment,{children:[(g||v)&&(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:g?`Needs a valid name`:v}),(0,$.jsxs)(G,{onClick:x,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:!!g||!!v,onClick:()=>{a(e),x()},children:[e?.mode===`add`?(0,$.jsx)(M,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),e?.mode===`add`?`Add`:`Done`]})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Name`,help:g?(0,$.jsx)(`span`,{className:`text-fail`,children:g}):i?`Also its file's name. Pick it with --env NAME or FORGEQE_ENV.`:`Pick it with --env NAME or FORGEQE_ENV.`,htmlFor:`env-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(W,{id:`env-name`,value:e.name,spellCheck:!1,placeholder:`qa`,"aria-invalid":!!g,onChange:n=>t({...e,name:n.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(X,{defs:[{key:`description`,label:`Description`,type:`text`}],edit:d,base:[],stacked:!0}),(0,$.jsx)(Wr,{name:e.name,linked:m,onFill:S,onLink:e=>u({file:e,...c.description?{description:c.description}:{},...Object.keys(h).length?{data:h}:{},...Object.keys(_).length?{cloud:_}:{}})}),y.map(e=>(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 mb-0 flex items-start gap-2 text-sm leading-relaxed text-warn`,children:[(0,$.jsx)(lt,{icon:ke,size:16,className:`mt-1 flex-none`}),e]},e)),m?(0,$.jsx)(Gr,{file:m,name:e.name,onCopy:S}):(0,$.jsxs)($.Fragment,{children:[f.length>1&&(0,$.jsx)(zt,{def:{key:`start_app`,label:`Start app`,help:`Where browser runs start when no app or address is given.`,type:`select`,options:f.map(([e])=>({value:e,label:e}))},edit:d,base:[],stacked:!0}),p.length>1&&(0,$.jsx)(zt,{def:{key:`api_app`,label:`API app`,help:`The API that API tests call.`,type:`select`,options:p.map(([e])=>({value:e,label:e}))},edit:d,base:[],stacked:!0}),(0,$.jsx)(J,{children:`Apps`}),Object.keys(l).length===0&&(0,$.jsx)(`p`,{className:`m-0 pb-2 text-sm text-muted`,children:`No apps yet: add the web pages, APIs and programs tests use here.`}),Object.entries(l).map(([e,t],n)=>{let i=Y(t);return(0,$.jsxs)(on,{lead:(0,$.jsx)(Bt,{icon:Lr[String(i.kind||`web`)]||P,logo:i.kind===`mobile`?_n[String(i.platform)]:i.kind===`desktop`?_n.windows:void 0}),title:e,meta:[Ir.find(([e])=>e===(i.kind||`web`))?.[1],i.url||i.path||i.app_id].filter(Boolean).map(String).join(`, `),open:o===String(n),onToggle:()=>s(o===String(n)?``:String(n)),actions:(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e}`,"data-tip":`Remove ${e}`,onClick:()=>{let t={...l};delete t[e],u({...c,apps:t})},children:(0,$.jsx)(je,{"aria-hidden":`true`})}),children:[(0,$.jsx)(q,{label:`Name`,htmlFor:`app-${n}`,stacked:!0,children:(0,$.jsx)(W,{id:`app-${n}`,defaultValue:e,spellCheck:!1,onBlur:t=>{let n=t.target.value.trim();n&&n!==e&&/^[A-Za-z0-9_.-]+$/.test(n)&&!(n in l)?u({...c,apps:Vn(l,e,n)}):t.target.value=e},className:`font-mono`})}),(0,$.jsx)(X,{defs:Rr(i),edit:{value:i,set:t=>u({...c,apps:{...l,[e]:t}}),vars:r},base:[],stacked:!0})]},n)}),(0,$.jsx)(`div`,{className:`border-t border-line-soft py-4`,children:(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add an app`,onClick:()=>{u({...c,apps:{...l,[Ln(l,`app`)]:{kind:`web`}}}),s(String(Object.keys(l).length))},children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})}),(0,$.jsx)(zr,{value:Y(c.variables),onChange:e=>u(K(c,[`variables`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(Br,{value:c.secrets,onChange:e=>u(K(c,[`secrets`],e.length?e:void 0))})]}),(0,$.jsx)(Jr,{value:h,onChange:e=>u(K(c,[`data`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(qr,{edit:d})]})})}function Wr({name:e,linked:t,onFill:n,onLink:r}){let[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(``),x=(0,Q.useRef)(null),S=(0,Q.useId)(),C=(0,Q.useId)();(0,Q.useEffect)(()=>{i===`link`&&_===null&&Ze.files(`yaml`).then(e=>v(e.files)).catch(e=>d(e.message))},[i,_]);let w=(e,t)=>{n(Y(e.environments[t]),e.literalByEnv[t]||[]),p(null),a(``),s(``)},T=async t=>{l(!0),d(``);try{let n=await Ze.convert(t,e),r=Object.keys(n.environments);r.length===1?w(n,r[0]):r.includes(e)?w(n,e):(p(n),g(n.default&&r.includes(n.default)?n.default:r[0]))}catch(e){d(e.message)}finally{l(!1)}};return(0,$.jsxs)(`div`,{className:`mt-6 flex flex-col gap-4 rounded-[12px] bg-surface-muted px-4 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] font-medium text-ink`,children:[(0,$.jsx)(lt,{icon:ge,size:16,className:`text-muted`}),t?`Read from your team's YAML`:`Start from your team's YAML`]}),(0,$.jsx)(`span`,{className:`text-[13px] leading-relaxed text-ink-2`,children:`Any layout works: ForgeQE finds the addresses, programs, values and secret names in it. Secret values are never copied.`})]}),(0,$.jsx)(`div`,{role:`group`,"aria-label":`How to bring the YAML in`,className:`flex flex-wrap gap-2`,children:(0,$.jsx)(dt,{items:[{id:`paste`,label:`Paste`,icon:h},{id:`import`,label:`Import a file`,icon:F},{id:`link`,label:`Link a project file`,icon:ae}],value:i,onChange:e=>{a(i===e?``:e),d(``),p(null)}})}),i===`paste`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:S,className:`text-[13px] text-ink-2`,children:`The environment's YAML, or a file of several`}),(0,$.jsx)(rt,{id:S,rows:8,spellCheck:!1,value:o,placeholder:`base_url: https://qa.shop.example.com
|
|
@@ -18,4 +18,4 @@ TST* = servicenow
|
|
|
18
18
|
`):``,d=/installs (\d[\w.-]*)/.exec(u)?.[1];return(0,$.jsxs)($.Fragment,{children:[(t||i)&&(0,$.jsx)(`p`,{className:`m-0 mb-4 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:t||i}),(0,$.jsx)(q,{label:`Version`,help:d?`${d} is out.`:u&&/latest/.test(u)?`This is the latest.`:`forgeqe update installs a new one for every forgeqe on this computer (bun, npm, pip).`,className:`border-t-0 pt-0`,children:(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[16px]`,children:e?e.running||e.version:`…`}),(0,$.jsxs)(G,{size:`sm`,disabled:r,"data-tip":`Check for updates`,onClick:()=>void n(`update-check`),children:[(0,$.jsx)(ve,{"aria-hidden":`true`}),`Check`]}),(0,$.jsxs)(G,{size:`sm`,variant:d?`primary`:`outline`,disabled:r,"data-tip":d?`Update to ${d}`:`Update to the latest version`,onClick:()=>c(!0),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Update`]})]})}),s&&(0,$.jsx)(xa,{text:`Update ForgeQE${d?` to ${d}`:` to the latest version`} on this computer?`,note:`It replaces every forgeqe on PATH. When it is done, restart forgeqe web from here; on Windows it is installed when you restart forgeqe web.`,yes:`Update`,icon:a,onYes:()=>{c(!1),n(`update`,{confirmed:!0})},onNo:()=>c(!1)}),(0,$.jsx)(ba,{job:l,kinds:[`update-check`,`update`],onStop:()=>void qe.stop()}),e&&(0,$.jsx)(Ca,{view:e,onError:o}),(0,$.jsx)(J,{children:`Guides`}),[[`Docs`,`Every feature with examples, setup, settings and commands, with search.`,e?.help.guide],[`Architecture`,`How ForgeQE is built: its agents, the engine and where data goes.`,e?.help.architecture]].map(([e,t,n])=>(0,$.jsx)(q,{label:e,help:t,children:n?(0,$.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:st({size:`sm`}),children:[(0,$.jsx)(Oe,{"aria-hidden":`true`}),`Open`]}):(0,$.jsxs)(G,{size:`sm`,disabled:!0,children:[(0,$.jsx)(Oe,{"aria-hidden":`true`}),`Open`]})},e))]})}function Ea(){let{view:e,error:t,run:n,running:r}=ya(),[i,a]=(0,Q.useState)(``);return e?.channels.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`A card says it is a test and which events each channel gets; nothing else is sent.`,children:`Send a test`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(U,{"aria-label":`Channel`,value:i,onChange:e=>a(e.target.value),className:`w-[220px]`,children:[(0,$.jsx)(`option`,{value:``,children:`Every channel`}),e.channels.map(e=>(0,$.jsx)(`option`,{children:e},e))]}),(0,$.jsxs)(G,{size:`sm`,disabled:r,"data-tip":`Send a test`,onClick:()=>void n(`notify-test`,i?{channel:i}:{}),children:[(0,$.jsx)(re,{"aria-hidden":`true`}),`Test`]})]}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-fail`,children:t}),(0,$.jsx)(ba,{job:e.job,kinds:[`notify-test`],onStop:()=>void qe.stop()})]}):null}function Da(){let{view:e,error:t,run:n,running:r}=ya(),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1);return e?.evalCases.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`Runs stories from ForgeQE's evaluation cases (banking, insurance, lending, privacy) with the domain declared and without, and scores how many domain and regulation expectations the agent's test design meets. It makes model calls for each case.`,children:`Check the agent's domain knowledge`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(U,{"aria-label":`Cases`,value:i,onChange:e=>a(e.target.value),className:`w-[320px] max-w-full`,children:[(0,$.jsxs)(`option`,{value:``,children:[`All `,e.evalCases.length,` cases`]}),e.evalCases.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))]}),(0,$.jsxs)(G,{size:`sm`,disabled:r,"data-tip":`Run the domain check`,onClick:()=>s(!0),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),`Run`]})]}),o&&(0,$.jsx)(xa,{text:`Run ${i?`one case`:`all ${e.evalCases.length} cases`} of the domain check?`,note:`Each case is a model session with the domain and one without, plus a judge; it takes a few minutes and costs tokens.`,yes:`Run`,icon:p,onYes:()=>{s(!1),n(`eval-domain`,{confirmed:!0,...i?{only:[i]}:{}})},onNo:()=>s(!1)}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-fail`,children:t}),(0,$.jsx)(ba,{job:e.job,kinds:[`eval-domain`],onStop:()=>void qe.stop()})]}):null}function Oa(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``);if((0,Q.useEffect)(()=>{qe.generated().then(t,e=>r(e.message))},[]),n)return(0,$.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:n});if(!e)return(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let i=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return e.runs?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`mt-0 mb-4 text-sm text-muted`,children:[`In `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.repo}),`, from .forgeqe/generated.jsonl: every line ForgeQE added, checked against the files as they are now.`]}),(0,$.jsxs)(Gt,{label:`Generated code`,children:[(0,$.jsx)(ln,{label:`Lines written`,value:e.written.toLocaleString(),note:`${Qe(e.files,`file`)}: ${e.created} created, ${e.edited} edited`}),(0,$.jsx)(ln,{label:`Still in the code`,value:i(e.present,e.written),note:`${e.present.toLocaleString()} lines`}),(0,$.jsx)(ln,{label:`Share of those files`,value:i(e.present,e.totalLines),note:`of ${e.totalLines.toLocaleString()} lines`}),(0,$.jsx)(ln,{label:`Files it created`,value:String(e.headers.unchanged),note:`as written; ${e.headers.changed} changed, ${e.headers.removed} gone`})]}),(0,$.jsx)(J,{children:`By run, newest first`}),(0,$.jsx)(On,{label:`Runs that wrote code`,head:[`Run`,`Files`,`Lines still there`],children:e.byRun.map(e=>(0,$.jsx)(gn,{cells:[(0,$.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.fq}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[e.run,e.test?` · ${e.test}`:``]})]},`r`),e.files,`${e.present} of ${e.written}`]},e.fq))}),e.missing.length>0&&(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Not found now: `,e.missing.slice(0,10).join(`, `)]})]}):(0,$.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-sm text-muted`,children:[(0,$.jsx)(lt,{icon:de,size:16}),`ForgeQE has not written code in `,!e.repo||e.repo===`.`?`this repository`:(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.repo}),` yet.`]})}var ka={critical:`Critical: ForgeQE cannot start, or loses or exposes data`,high:`High: a main feature does not work`,medium:`Medium: there is a workaround`,low:`Low: small or cosmetic`},Aa=3,ja={done:`finished`,failed:`failed`,stopped:`stopped`,running:`running`};function Ma(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),a=(0,Q.useCallback)(()=>Xe.view(e).then(n,e=>i(e.message)),[e]);(0,Q.useEffect)(()=>void a(),[a]);let o=!!t?.job?.running;return(0,Q.useEffect)(()=>{if(!o)return;let e=cn(a,1e3);return()=>Lt(e)},[o,a]),{view:t,error:r,setError:i,load:a,running:o}}function Na({draft:e,areas:t,severities:n,onChange:r}){let i=(0,Q.useId)(),a=(t,n)=>r({...e,[t]:n});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Title`,htmlFor:`${i}-title`,stacked:!0,className:`border-t-0 pt-0`,children:(0,$.jsx)(W,{id:`${i}-title`,value:e.title,maxLength:200,onChange:e=>a(`title`,e.target.value)})}),(0,$.jsx)(q,{label:`What happened`,htmlFor:`${i}-summary`,stacked:!0,children:(0,$.jsx)(rt,{id:`${i}-summary`,rows:4,value:e.summary,maxLength:4e3,onChange:e=>a(`summary`,e.target.value)})}),(0,$.jsx)(q,{label:`Steps to reproduce`,help:`One step on each line.`,htmlFor:`${i}-steps`,stacked:!0,children:(0,$.jsx)(rt,{id:`${i}-steps`,rows:4,value:e.steps.join(`
|
|
19
19
|
`),onChange:e=>a(`steps`,e.target.value.split(`
|
|
20
20
|
`))})}),(0,$.jsx)(q,{label:`Expected result`,htmlFor:`${i}-expected`,stacked:!0,children:(0,$.jsx)(rt,{id:`${i}-expected`,rows:2,value:e.expected,maxLength:2e3,onChange:e=>a(`expected`,e.target.value)})}),(0,$.jsx)(q,{label:`Actual result`,help:`Copy an error message exactly.`,htmlFor:`${i}-actual`,stacked:!0,children:(0,$.jsx)(rt,{id:`${i}-actual`,rows:2,value:e.actual,maxLength:2e3,onChange:e=>a(`actual`,e.target.value)})}),(0,$.jsx)(q,{label:`Severity`,htmlFor:`${i}-severity`,children:(0,$.jsx)(U,{id:`${i}-severity`,value:e.severity,onChange:e=>a(`severity`,e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:ka[e]??e},e))})}),(0,$.jsx)(q,{label:`Area`,htmlFor:`${i}-area`,children:(0,$.jsx)(U,{id:`${i}-area`,value:e.area,onChange:e=>a(`area`,e.target.value),children:t.map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})})]})}var Pa=e=>e<1024?`${e} bytes`:`${Math.round(e/1024)} KB`;function Fa(){let[e,n]=(0,Q.useState)(null),{view:r,error:i,setError:o,load:s,running:c}=Ma(e),l=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[g,_]=(0,Q.useState)({}),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)([]),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),P=r?.job;(0,Q.useEffect)(()=>{P&&!P.running&&j.current!==P&&(j.current=P,P.error?o(P.error):P.kind===`draft`&&P.result?(p(P.result.draft),h(P.result.questions),_({})):P.kind===`send`&&P.result&&k(P.result))},[P,o]);let F=r?.attachments??[],I=r?.session??void 0,ee=v??new Set(F.filter(e=>e.picked).map(e=>e.id)),L=e=>{n(e),y(null)},te=(e,t)=>{let n=new Set(ee);t?n.add(e):n.delete(e),y(n)},R=async e=>{o(``);try{await Xe.draft(e),s()}catch(e){o(e.message)}},ne=()=>void R({session:I,description:u,current:f??void 0,answers:m.map(e=>({question:e,answer:g[e]??``}))}),ie=async e=>{o(``);for(let t of Array.from(e??[]).slice(0,Aa-b.length))try{let e=await Ut(t);if(e.type!==`image/png`&&e.type!==`image/jpeg`)throw Error(`${t.name}: use a PNG or JPEG picture.`);x(t=>[...t,{name:e.name,url:`data:${e.type};base64,${e.data}`}])}catch(e){o(e.message)}},ae=async()=>{if(f){T(!1),o(``);try{await Xe.send({session:I,draft:f,attach:[...ee],images:b.map(e=>e.url),contact:S.trim()||void 0,confirmed:!0}),s()}catch(e){o(e.message)}}},oe=async()=>{if(f){o(``);try{let{text:e}=await Xe.text(f);await navigator.clipboard.writeText(e),D(`Copied. Paste it into an email or a Teams message to the ForgeQE team.`)}catch(e){o(e.message)}}},se=()=>{d(``),n(null),p(null),h([]),_({}),x([]),y(null),k(null),D(``)};if(!r)return i?(0,$.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,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let z=r.intake.url&&(r.intake.key||r.intake.entra),ce=O?.url&&/^https:\/\/dev\.azure\.com\/[^\s"<>]+$/.test(O.url)?O.url:null;return O?(0,$.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[O.existing?`This problem was already reported, so your report was added to bug `:`Thank you. The ForgeQE team has your report as bug `,ce?(0,$.jsxs)(`a`,{href:ce,target:`_blank`,rel:`noreferrer noopener`,className:`font-medium text-ink no-underline hover:underline`,children:[`#`,O.id]}):(0,$.jsxs)(`span`,{className:`font-medium`,children:[`#`,O.id]}),` `,`in `,r.target,`.`]}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(G,{size:`sm`,"data-tip":`Report another problem`,onClick:se,children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`New`]})})]}):(0,$.jsxs)($.Fragment,{children:[i&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),(0,$.jsx)(J,{first:!0,help:r.sessions.length?`ForgeQE looked at your recent sessions and picked the one that went wrong. Pick another if that is not the one.`:`ForgeQE has no session on this computer to look at. Say what went wrong in your own words.`,children:`What went wrong`}),r.sessions.length>0&&(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Session to report`,children:r.sessions.map(e=>(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4 first:border-t-0`,children:[(0,$.jsx)(Er,{checked:r.session===e.name,onSelect:()=>L(e.name),label:`Report ${e.title}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:[`forgeqe ${e.command}`,xn(e.startedAt),ja[e.status]].join(` · `)}),e.error&&(0,$.jsx)(`span`,{className:`text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]}),e.problem&&(0,$.jsx)(at,{tone:`fail`,children:`Went wrong`})]},e.name))}),r.findings&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`From the session's log, with secrets removed. The bug is drafted from this. Test cases that failed are your app's results, so they are only counted.`,children:`What ForgeQE found`}),(0,$.jsxs)(`dl`,{className:`m-0 flex flex-col gap-4 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`What was asked or run`}),(0,$.jsx)(`dd`,{className:`m-0 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:r.findings.request})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`ForgeQE's errors`}),(0,$.jsx)(`dd`,{className:`m-0`,children:r.findings.errors.length?(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.findings.errors.map(e=>(0,$.jsx)(`li`,{className:`rounded-[10px] bg-surface-muted px-4 py-2 font-mono text-[13px] leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:e},e))}):(0,$.jsx)(`span`,{className:`text-ink-2`,children:`None logged. Say below what went wrong.`})})]}),r.findings.facts.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`dt`,{className:`font-medium text-ink`,children:`Also`}),(0,$.jsx)(`dd`,{className:`m-0`,children:(0,$.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-ink-2`,children:r.findings.facts.map(e=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e))})})]})]})]}),(0,$.jsx)(q,{label:r.findings?`Anything to add`:`Describe the problem`,help:r.findings?`Optional: what you were trying to do, or what you expected.`:void 0,htmlFor:`${l}-description`,stacked:!0,className:r.findings?void 0:`border-t-0 pt-0`,children:(0,$.jsx)(rt,{id:`${l}-description`,rows:r.findings?3:5,value:u,maxLength:8e3,placeholder:r.findings?`For example: I expected the run to open the login page.`:`For example: I clicked Run on a test case in the web app and nothing happened for ten minutes.`,onChange:e=>d(e.target.value)})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsxs)(G,{size:`sm`,variant:f?`outline`:`primary`,disabled:c||!I&&u.trim().length<10,"data-tip":f?`Draft again`:`Draft the bug`,onClick:()=>void R({session:I,description:u}),children:[(0,$.jsx)(Ee,{"aria-hidden":`true`}),`Draft`]}),c&&P?.kind===`draft`&&(0,$.jsx)(at,{tone:`running`,orb:`thinking`,children:`Drafting`})]}),m.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`Answer what you can, then update the draft. You can leave a question empty.`,children:`Questions`}),m.map((e,t)=>(0,$.jsx)(q,{label:e,htmlFor:`${l}-q${t}`,stacked:!0,className:t===0?`border-t-0 pt-0`:void 0,children:(0,$.jsx)(rt,{id:`${l}-q${t}`,rows:2,value:g[e]??``,maxLength:2e3,onChange:t=>_(n=>({...n,[e]:t.target.value}))})},e)),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsxs)(G,{size:`sm`,disabled:c||!Object.values(g).some(e=>e.trim()),"data-tip":`Update the draft`,onClick:ne,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Update`]})})]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`Check each field and change what is not right. This is what the ForgeQE team reads.`,children:`The bug`}),(0,$.jsx)(Na,{draft:f,areas:r.areas,severities:r.severities,onChange:p}),(0,$.jsx)(J,{help:`Secrets ForgeQE knows are replaced in every file. Open a log first if you are not sure what is in it: it can show addresses and test data of your project.`,children:`What is attached`}),(0,$.jsxs)(`ul`,{"aria-label":`Attachments`,className:`m-0 list-none p-0`,children:[F.map(e=>(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 py-2`,children:[(0,$.jsx)(Pn,{checked:ee.has(e.id),onCheckedChange:t=>te(e.id,t)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsxs)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.note,` · `,Pa(e.bytes)]})]})]})},e.id)),b.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex min-h-12 items-center gap-4 border-t border-line-soft py-2`,children:[(0,$.jsx)(`img`,{src:e.url,alt:`Screenshot ${t+1}`,className:`h-10 w-16 rounded-[8px] border border-line-soft bg-surface-muted object-cover`}),(0,$.jsx)(`span`,{className:`flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>x(t=>t.filter(t=>t!==e)),children:(0,$.jsx)(je,{"aria-hidden":`true`})})]},e.url))]}),(0,$.jsxs)(`div`,{className:`pt-2`,children:[(0,$.jsx)(`input`,{ref:A,type:`file`,accept:`image/png,image/jpeg`,multiple:!0,hidden:!0,onChange:e=>void ie(e.target.files).then(()=>e.target.value=``)}),(0,$.jsxs)(G,{size:`sm`,disabled:b.length>=Aa,"data-tip":`Add a screenshot`,onClick:()=>A.current?.click(),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),(0,$.jsx)(J,{children:`Send`}),(0,$.jsx)(q,{label:`Your contact`,help:`Optional: an email or a Teams name, so the team can ask you about it.`,htmlFor:`${l}-contact`,className:`border-t-0 pt-0`,children:(0,$.jsx)(W,{id:`${l}-contact`,value:S,maxLength:200,onChange:e=>C(e.target.value)})}),r.intake.url?!z&&(0,$.jsx)(q,{label:`Intake key`,help:`Sign in to your organization with the Azure CLI (az login), or save the key the ForgeQE team gave you. It is kept in your credential store when you save.`,htmlFor:`${l}-key`,children:(0,$.jsx)(tn,{id:`${l}-key`,name:r.keyEnv,field:`Intake key`})}):(0,$.jsx)(q,{label:`Not set up yet`,help:`ForgeQE's defect intake is not set up on this computer. Copy the report and send it to the ForgeQE team.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-2`,children:[(0,$.jsxs)(G,{size:`sm`,variant:`primary`,disabled:c||!z||!f.title.trim()||!f.summary.trim(),"data-tip":`Send to the ForgeQE team`,onClick:()=>T(!0),children:[(0,$.jsx)(re,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(G,{size:`sm`,disabled:!f.title.trim()||!f.summary.trim(),"data-tip":`Copy as text`,onClick:()=>void oe(),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Copy`]}),c&&P?.kind===`send`&&(0,$.jsx)(at,{tone:`running`,children:`Sending`})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:E&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-sm text-ink-2`,children:E})}),w&&(0,$.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Send this bug?`,className:`mt-4 flex flex-col gap-2 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:`Send this bug to the ForgeQE team?`}),(0,$.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`It is filed in `,r.target,` with the fields above`,ee.size+b.length?`, and ${ee.size+b.length} attached file${ee.size+b.length===1?``:`s`}: ${[...F.filter(e=>ee.has(e.id)).map(e=>e.name),...b.map(e=>e.name)].join(`, `)}`:`, with nothing attached`,`.`]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(G,{size:`sm`,variant:`primary`,onClick:()=>void ae(),children:[(0,$.jsx)(re,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(G,{size:`sm`,"data-tip":`Not now`,onClick:()=>T(!1),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Later`]})]})]})]})]})}function Ia({config:e}){let{saved:t,preview:n,reload:r}=jt(),i=Y(Z(e.value,[`agent`,`names`])),a=Ie(i),o=Z(e.value,[`agent`,`app_name`]),s=typeof o==`string`?o:``,l=Ne(s),u=JSON.stringify([a,l]);return(0,Q.useEffect)(()=>n({...t,agentNames:a,appName:l}),[u,t]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{icon:Se,help:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`What the web app calls ForgeQE itself: in every page, message and tab title, and in the reports and documents it writes. Commands, files and settings keep forgeqe. Empty keeps ForgeQE.`}),children:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`ForgeQE's name`})}),(0,$.jsx)(q,{label:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`App name`}),help:(0,$.jsx)(`span`,{"data-keep-name":!0,children:`Instead of ForgeQE, for everyone who opens this project.`}),htmlFor:`agent-app-name`,yamlKey:`agent.app_name`,children:(0,$.jsx)(W,{id:`agent-app-name`,"data-keep-name":!0,value:s,maxLength:40,placeholder:`ForgeQE`,onChange:t=>e.set(K(e.value,[`agent`,`app_name`],t.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})}),(0,$.jsx)(J,{icon:c,help:`Call each agent what your team calls it: the name shows in chats, on the Agents page and in the terminal, for everyone who opens this project. What it does and may do stay the same. Empty keeps ForgeQE's name.`,children:`Agent names`}),Pe.map(t=>{let n=Fe(t).name,r=`agent-name-${t}`,a=typeof i[t]==`string`?i[t]:``;return(0,$.jsx)(q,{label:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(wt,{agent:t,px:22,decorative:!0}),n]}),help:t,htmlFor:r,yamlKey:`agent.names.${t}`,children:(0,$.jsx)(W,{id:r,value:a,maxLength:40,placeholder:n,onChange:n=>e.set(K(e.value,[`agent`,`names`,t],n.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})},t)})]})}var La=524288,Ra=[`image/png`,`image/jpeg`,`image/webp`,`image/svg+xml`];async function za(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function Ba({children:e,className:t}){return(0,$.jsx)(`div`,{className:H(`flex w-full flex-wrap items-center gap-2 sm:justify-end`,t),children:e})}function Va({colour:e,label:t}){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-ink-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 flex-none rounded-[4px] border border-line`,style:{background:e}}),t&&(0,$.jsx)(`span`,{className:`text-muted`,children:t}),(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]})}function Ha({onUse:e}){let t=(0,Q.useId)(),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1);return(0,$.jsx)(q,{label:`From a website`,help:`Suggests its sidebar, button and page colours. Nothing changes until you use them.`,htmlFor:t,children:(0,$.jsxs)(Ba,{children:[(0,$.jsxs)(`form`,{className:`flex w-full items-center gap-2`,onSubmit:async e=>{e.preventDefault(),a(!0),s(``),l(null),f(!1);try{l(await We.fromUrl(n.trim()))}catch(e){s(e.message)}finally{a(!1)}},children:[(0,$.jsx)(W,{id:t,type:`url`,value:n,placeholder:`https://www.example.com`,spellCheck:!1,onChange:e=>r(e.target.value),className:`min-w-0 flex-1`}),(0,$.jsxs)(G,{size:`sm`,type:`submit`,disabled:!n.trim()||i,"data-tip":`Read the site's colours`,children:[(0,$.jsx)(u,{"aria-hidden":`true`}),i?`Importing…`:`Import`]})]}),o&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 w-full text-[13px] text-fail sm:text-right`,children:o}),c&&(0,$.jsxs)(`div`,{role:`status`,className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`From `,new URL(c.url).host]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[c.primary&&(0,$.jsx)(Va,{colour:c.primary,label:`Sidebar`}),c.gradient&&(0,$.jsx)(Va,{colour:c.gradient,label:`Gradient`}),c.secondary&&(0,$.jsx)(Va,{colour:c.secondary,label:`Buttons`}),c.background&&(0,$.jsx)(Va,{colour:c.background,label:`Page`})]}),(0,$.jsxs)(G,{size:`sm`,variant:`primary`,onClick:()=>{e(c),f(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),d?`Used`:`Use`]}),c.palette.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 sm:justify-end`,children:[(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Others:`}),c.palette.map(e=>(0,$.jsx)(Va,{colour:e},e))]})]})]})})}var Ua={deep:`Deep sidebar, white text`,light:`Pale sidebar, dark text`};function Wa({start:e,onUse:t}){let n=(0,Q.useId)(),[r,i]=(0,Q.useState)(e),[a,o]=(0,Q.useState)(`deep`),[s,c]=(0,Q.useState)(!1),l=ht(r),u=bt(l),d=St(l,a),f=r.trim()!==``&&!l?`Write a colour as #rrggbb, for example #0e7490.`:``,p=e=>(i(e),c(!1));return(0,$.jsx)(q,{label:`From one colour`,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):`Makes a family of shades of one colour for the sidebar, buttons and page, so they belong together. Nothing changes until you use them.`,htmlFor:n,children:(0,$.jsxs)(Ba,{children:[(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`From one colour: pick a colour`,value:l||Dt,onChange:e=>p(e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(W,{id:n,value:r,spellCheck:!1,placeholder:`#0e7490`,"aria-invalid":!!f,onChange:e=>p(e.target.value),className:`min-w-0 flex-1 font-mono`})]}),(0,$.jsx)(U,{"aria-label":`Where the sidebar sits in the family`,value:a,onChange:e=>(o(e.target.value),c(!1)),className:`w-full`,children:Et.map(e=>(0,$.jsx)(`option`,{value:e,children:Ua[e]},e))}),u&&d&&(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsx)(`span`,{"aria-label":`Shades 50 to 950 of ${l}`,className:`flex w-full overflow-hidden rounded-[8px] border border-line`,children:xt.map(e=>(0,$.jsx)(`span`,{"data-tip":`${e} ${u[e]}`,className:`h-6 min-w-0 flex-1`,style:{background:u[e]}},e))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[(0,$.jsx)(Va,{colour:d.primary,label:`Sidebar`}),(0,$.jsx)(Va,{colour:d.gradient,label:`Gradient`}),(0,$.jsx)(Va,{colour:d.secondary,label:`Buttons`}),(0,$.jsx)(Va,{colour:d.background,label:`Page`})]}),(0,$.jsxs)(G,{size:`sm`,variant:`primary`,onClick:()=>{t(d),c(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(k,{"aria-hidden":`true`}),s?`Used`:`Use`]})]})]})})}function Ga({label:e,help:t,yamlKey:n,value:r,fallback:i,check:a,onChange:o}){let s=(0,Q.useId)(),[c,l]=(0,Q.useState)(r);(0,Q.useEffect)(()=>l(r),[r]);let u=ht(c),d=c.trim()!==``&&!u?`Write a colour as #rrggbb, for example #0b1f3a.`:u&&a?a(u):``;return(0,$.jsx)(q,{label:e,help:d?(0,$.jsx)(`span`,{className:`text-fail`,children:d}):t,htmlFor:s,yamlKey:n,children:(0,$.jsxs)(Ba,{className:`flex-nowrap`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`${e}: pick a colour`,value:ht(r)||i||`#ffffff`,onChange:e=>o(a?.(e.target.value)?``:e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(W,{id:s,value:c,spellCheck:!1,placeholder:i?`${i} (default)`:`None`,"aria-invalid":!!d,onChange:e=>{l(e.target.value);let t=ht(e.target.value);(t&&!a?.(t)||!e.target.value.trim())&&o(t||``)},className:`min-w-0 flex-1 font-mono`})]})})}function Ka({which:e,label:t,yamlKey:n,value:r,url:i,savedError:a,onChange:o}){let[s,c]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),p=e===`mark`?`small logo`:`logo`;return(0,$.jsx)(q,{label:t,help:s||r&&!i&&a?(0,$.jsx)(`span`,{className:`text-fail`,children:s||a}):e===`mark`?`For the narrow sidebar. Square or round works best.`:`In the sidebar, reports and documents. PNG, JPEG or WebP (a large one is made smaller), or SVG up to 512 KB; an empty margin round it is cut off.`,yamlKey:n,children:(0,$.jsxs)(Ba,{children:[i&&(0,$.jsx)(`span`,{className:H(`theme-side flex h-12 items-center justify-center rounded-[8px] border border-line`,e===`mark`?`w-12`:`min-w-16 px-4`),children:(0,$.jsx)(`img`,{src:i,alt:`The ${p}`,className:H(`block object-contain`,e===`mark`?`max-h-9 max-w-9`:`max-h-8 max-w-[140px]`)})}),(0,$.jsx)(`input`,{ref:f,type:`file`,accept:`.png,.jpg,.jpeg,.webp,.svg`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async t=>{let n=t.target.files?.[0];if(t.target.value=``,n){if(c(``),!Ra.includes(n.type))return c(`A ${p} is a PNG, JPEG, WebP or SVG image.`);if(n.type===`image/svg+xml`&&n.size>La)return c(`${n.name} is over 512 KB.`);if(n.size>20971520)return c(`${n.name} is over ${un/1024/1024} MB: save a smaller copy and upload that.`);d(!0);try{let t=await fn(n,La),r=await We.uploadLogo(await za(t),t.type,e);o(r.file,(e===`mark`?r.view.logoMark:r.view.logo)||``)}catch(e){c(e.message)}finally{d(!1)}}}}),(0,$.jsxs)(G,{size:`sm`,disabled:l,"data-tip":i?`Change the ${p}`:`Upload a ${p}`,onClick:()=>f.current?.click(),children:[i?(0,$.jsx)(O,{"aria-hidden":`true`}):(0,$.jsx)(u,{"aria-hidden":`true`}),l?`Uploading…`:i?`Change`:`Upload`]}),r&&(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove the ${p}`,"data-tip":`Remove the ${p}`,onClick:()=>o(``),children:(0,$.jsx)(je,{"aria-hidden":`true`})})]})})}var qa={auto:`Auto (recommended)`,plain:`Plain`,tiles:`On tiles`,outline:`Outlined`,mono:`One colour`};function Ja(e){for(let{item:t}of pn)if(t.icon===e||_t[t.id]===e)return t.label;for(let t of Le)if(V(t.agent).icon===e)return V(t.agent).name;return e}function Ya({draft:e,value:t,onChange:n}){let{mode:r}=jt(),i=kt(e,void 0,r),a=ft(e)!==`3d`,o=!a&&t!==`mono`&&t!==`outline`&&i.lowest<2,s=o?`${i.faint.length||`Some`} ${i.faint.length===1?`icon is`:`icons are`} hard to see on this colour${i.faint.length?` (${i.faint.slice(0,2).map(e=>Ja(e.icon)).join(`, `)}${i.faint.length>2?`, …`:``})`:``}. Try Auto or On tiles.`:!a&&t===`auto`&&i.style!==`plain`?`Auto put them on tiles: this colour hides some of them.`:``;return(0,$.jsx)(q,{label:`Sidebar icons`,help:a?`For the 3D icons. Flat icons take the Icon colour above.`:`Auto puts them on tiles when the sidebar's colour hides any.`,htmlFor:`theme-icons`,yamlKey:`theme.icon_style`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsx)(U,{id:`theme-icons`,value:t,disabled:a,onChange:e=>n(e.target.value),className:`w-full`,children:Mt.map(e=>(0,$.jsx)(`option`,{value:e,children:qa[e]},e))}),!a&&(0,$.jsx)(Xa,{}),s&&(0,$.jsx)(`span`,{className:H(`w-full text-[13px] sm:text-right`,o?`text-warn`:`text-muted`),children:s})]})})}function Xa(){let e=[`record`,`data`,`jobs`,`guardrails`].map(e=>_t[e]).concat([`orchestrator`,`healer`,`browser-agent`]);return(0,$.jsx)(`span`,{"aria-label":`How the sidebar's icons look`,className:`theme-side flex w-full items-center justify-between rounded-[10px] border border-line-soft px-4 py-2`,children:e.map(e=>(0,$.jsx)(et,{name:e,px:18},e))})}var Za={phosphor:`Phosphor Duotone (default)`,solar:`Solar Bold Duotone`,lucide:`Lucide (buttons and menus too)`,"3d":`3D (ForgeQE's pixel icons)`};function Qa({value:e,onChange:t}){return(0,$.jsx)(q,{label:`Icons`,help:`Flat icons are black, or the Icon colour below, so they show on any sidebar.`,htmlFor:`theme-icon-set`,yamlKey:`theme.icon_set`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsx)(U,{id:`theme-icon-set`,value:e,onChange:e=>t(e.target.value),className:`w-full`,children:Ct.map(e=>(0,$.jsx)(`option`,{value:e,children:Za[e]},e))}),(0,$.jsx)(Xa,{})]})})}function $a(){return(0,$.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,"aria-hidden":`true`,children:[`forgeqe`,`engine`,`forgeqe-test`,`forgeqe-heal`,`forgeqe-pr-review`,`forgeqe-data`].map(e=>(0,$.jsx)(wt,{agent:e,px:40,decorative:!0},e))})}var eo={visor:`Robots (default)`,classic:`Characters`,icons:`Icons`},to={soft:`Soft pastel (default)`,original:`Each agent's own`};function no({value:e,colours:t,onChange:n,onColours:r}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Agents`,help:`Robots and characters follow your cursor, show what they are doing and react to how it went. Sidebars and lists keep the icons.`,htmlFor:`theme-mascot`,yamlKey:`theme.mascot`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsx)(U,{id:`theme-mascot`,value:e,onChange:e=>n(e.target.value),className:`w-full`,children:Pt.map(e=>(0,$.jsx)(`option`,{value:e,children:eo[e]},e))}),(0,$.jsx)($a,{})]})}),(0,$.jsx)(q,{label:`Agent colours`,help:e===`icons`?`For robots and characters.`:`Pastels from one family, or each agent's colour as the rest of the app shows it.`,htmlFor:`theme-mascot-colours`,yamlKey:`theme.mascot_colours`,children:(0,$.jsx)(Ba,{children:(0,$.jsx)(U,{id:`theme-mascot-colours`,value:t,disabled:e===`icons`,onChange:e=>r(e.target.value),className:`w-full`,children:Tt.map(e=>(0,$.jsx)(`option`,{value:e,children:to[e]},e))})})})]})}var ro={text:`Black, white in dark mode (default)`,accent:`The buttons' colour`,custom:`A colour of their own`};function io({draft:e,value:t,onChange:n}){let{mode:r}=jt(),i=mt({iconColour:t}),a=ft(e)!==`3d`,[o,s]=(0,Q.useState)(i===`custom`?t:``);(0,Q.useEffect)(()=>s(i===`custom`?t:``),[t,i]);let c=i===`custom`&&o.trim()!==``&&!ht(o)?`Write a colour as #rrggbb, for example #7c3aed.`:``,l=a?yt(e,r).moved:[],u=l.length?`Made ${r===`dark`?`lighter`:`darker`} on the ${l.join(` and the `)} so the icons show.`:``;return(0,$.jsx)(q,{label:`Icon colour`,help:c?(0,$.jsx)(`span`,{className:`text-fail`,children:c}):a?`For the flat icons of the pages and agents: their lines take the colour, and their second tone its palest shade.`:`For the flat icons. The 3D icons keep their own colours.`,htmlFor:`theme-icon-colour`,yamlKey:`theme.icon_colour`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsx)(U,{id:`theme-icon-colour`,value:i,disabled:!a,onChange:t=>{let r=t.target.value;n(r===`accent`?`accent`:r===`custom`?ht(e.secondary)||Dt:``)},className:`w-full`,children:Object.keys(ro).map(e=>(0,$.jsx)(`option`,{value:e,children:ro[e]},e))}),a&&i===`custom`&&(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`color`,"aria-label":`Icon colour: pick a colour`,value:ht(t)||Dt,onChange:e=>n(e.target.value),className:`size-10 flex-none cursor-pointer rounded-[8px] border border-line bg-bg p-1`}),(0,$.jsx)(W,{id:`theme-icon-colour-hex`,"aria-label":`Icon colour`,value:o,spellCheck:!1,placeholder:`#7c3aed`,"aria-invalid":!!c,onChange:e=>{s(e.target.value);let t=ht(e.target.value);(t||!e.target.value.trim())&&n(t||``)},className:`min-w-0 flex-1 font-mono`})]}),u&&(0,$.jsx)(`span`,{className:`w-full text-[13px] text-warn sm:text-right`,children:u})]})})}function ao(){let{choice:e,setChoice:t}=jt();return(0,$.jsx)(q,{label:`Colour mode`,help:`Only for you, in this browser.`,children:(0,$.jsx)(Ba,{children:(0,$.jsx)(Wt,{label:`Colour mode`,value:e,onChange:t,options:[{id:`system`,label:`System`},{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}].map(e=>({id:e.id,label:e.label}))})})})}var oo=[`primary`,`gradient`,`secondary`,`background`,`icon_style`,`icon_set`,`icon_colour`,`mascot`,`mascot_colours`];function so({theme:e,value:t,onReset:n}){let{choice:r,setChoice:i}=jt(),a=oo.some(t=>e[t]!==void 0)||r!==`system`;return(0,$.jsxs)(G,{size:`sm`,disabled:!a,"data-tip":`Reset colours: ForgeQE's own colours and icons, and System mode. The logo and name stay.`,onClick:()=>{let e=t;for(let t of oo)e=K(e,[`theme`,t],void 0);n(e),i(`system`)},children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Reset`]})}var co=e=>vt(e)<.75?`Choose a light colour: dark mode gives the dark page.`:``;function lo({config:e}){let{saved:t,preview:n,reload:r}=jt(),i=Y(e.value.theme),a=e=>typeof i[e]==`string`?i[e]:``,o=(t,n)=>e.set(K(e.value,[`theme`,t],n||void 0)),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(null),v=c&&c.file===a(`logo`)?c.url:t.logoFile===a(`logo`)?t.logo:void 0,y=u&&u.file===a(`logo_mark`)?u.url:t.logoMarkFile===a(`logo_mark`)?t.logoMark:void 0,b=[`plain`,`rounded`,`circle`,`tile`].find(e=>e===a(`logo_frame`)),x=a(`logo_size`)===`large`||a(`logo_size`)===`standard`?a(`logo_size`):void 0,S=Mt.find(e=>e===a(`icon_style`)),w=Ct.find(e=>e===a(`icon_set`)),T=Pt.find(e=>e===a(`mascot`)),E=Tt.find(e=>e===a(`mascot_colours`)),D=Ie(Z(e.value,[`agent`,`names`])),O={...Object.keys(D).length?{agentNames:D}:{},logoSize:x,name:a(`name`)||void 0,primary:ht(a(`primary`)),gradient:ht(a(`gradient`)),secondary:ht(a(`secondary`)),background:ht(a(`background`)),logo:a(`logo`)?v:void 0,logoMark:a(`logo_mark`)?y:void 0,logoFrame:b,iconStyle:S,iconSet:w,mascot:T,mascotColours:E,iconColour:a(`icon_colour`)===`accent`?`accent`:ht(a(`icon_colour`))},k=JSON.stringify(O);(0,Q.useEffect)(()=>n(O),[k]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]);let A=gt(O).filter(e=>!e.ok);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{icon:C,first:!0,children:`Logo and name`}),(0,$.jsx)(Ka,{which:`logo`,label:`Logo`,yamlKey:`theme.logo`,value:a(`logo`),url:v,savedError:t.logoError,onChange:(e,t)=>(l(t?{file:e,url:t}:null),o(`logo`,e))}),(0,$.jsx)(Ka,{which:`mark`,label:`Small logo`,yamlKey:`theme.logo_mark`,value:a(`logo_mark`),url:y,savedError:t.logoMarkError,onChange:(e,t)=>(d(t?{file:e,url:t}:null),o(`logo_mark`,e))}),(0,$.jsx)(q,{label:`Logo frame`,help:`A circle suits a square logo; a white tile, a dark logo on a dark sidebar.`,htmlFor:`theme-frame`,yamlKey:`theme.logo_frame`,children:(0,$.jsx)(Ba,{children:(0,$.jsxs)(U,{id:`theme-frame`,value:b||`plain`,onChange:e=>o(`logo_frame`,e.target.value===`plain`?``:e.target.value),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`plain`,children:`As it is`}),(0,$.jsx)(`option`,{value:`rounded`,children:`Rounded corners`}),(0,$.jsx)(`option`,{value:`circle`,children:`Circle`}),(0,$.jsx)(`option`,{value:`tile`,children:`On a white tile`})]})})}),(0,$.jsx)(q,{label:`Logo size`,help:`Fit automatically sizes the logo from its shape, so its words can be read. Large spreads a wide logo across the top of the sidebar.`,htmlFor:`theme-size`,yamlKey:`theme.logo_size`,children:(0,$.jsx)(Ba,{children:(0,$.jsxs)(U,{id:`theme-size`,value:x||`auto`,onChange:e=>o(`logo_size`,e.target.value===`large`||e.target.value===`standard`?e.target.value:``),className:`w-full`,children:[(0,$.jsx)(`option`,{value:`auto`,children:`Fit automatically`}),(0,$.jsx)(`option`,{value:`standard`,children:`Standard`}),(0,$.jsx)(`option`,{value:`large`,children:`Large`})]})})}),(0,$.jsx)(q,{label:`Name`,help:`Beside a square logo, or instead of one. Screen readers say it.`,htmlFor:`theme-name`,yamlKey:`theme.name`,children:(0,$.jsx)(Ba,{children:(0,$.jsx)(W,{id:`theme-name`,value:a(`name`),maxLength:40,placeholder:`ForgeQE`,onChange:e=>o(`name`,e.target.value),className:`w-full`})})}),(0,$.jsx)(q,{label:`Preview`,help:h?(0,$.jsx)(`span`,{className:`text-warn`,children:`The logo is close to the sidebar's colour, so it sits on a plate. A different sidebar colour sets it off without one.`}):`The sidebar's top, wide and narrow.`,children:(0,$.jsxs)(Ba,{className:`flex-nowrap`,children:[(0,$.jsx)(`span`,{"aria-label":`How the sidebar's top looks`,className:`theme-side flex min-h-14 min-w-0 flex-1 items-center rounded-[10px] border border-line-soft px-4 text-base font-semibold`,children:(0,$.jsx)(Kt,{theme:O,onPlate:g})}),(0,$.jsx)(`span`,{"aria-label":`How the narrow sidebar's top looks`,className:`theme-side flex size-14 flex-none items-center justify-center rounded-[10px] border border-line-soft`,children:(0,$.jsx)(dn,{theme:O})})]})}),(0,$.jsx)(J,{icon:s,help:`Leave a colour empty to keep ForgeQE's own.`,children:`Colours`}),(0,$.jsx)(ao,{}),(0,$.jsx)(Ga,{label:`Sidebar`,help:`Light mode. Its text turns white on a dark colour.`,yamlKey:`theme.primary`,value:a(`primary`),fallback:At,onChange:e=>o(`primary`,e)}),(0,$.jsx)(Ga,{label:`Sidebar gradient`,help:`The sidebar fades into it, top to bottom.`,yamlKey:`theme.gradient`,value:a(`gradient`),onChange:e=>o(`gradient`,e)}),(0,$.jsx)(Ga,{label:`Buttons and links`,help:`Also selected tabs and filters and the sidebar entry you are on, with shades made from it. Left empty, it is the icon colour when that is a colour of its own, so the app has one brand colour.`,yamlKey:`theme.secondary`,value:a(`secondary`),fallback:pt({...O,secondary:void 0})||Dt,onChange:e=>o(`secondary`,e)}),(0,$.jsx)(Ga,{label:`Page background`,help:`Light mode, a light colour. Dark mode keeps its dark page.`,yamlKey:`theme.background`,value:a(`background`),fallback:`#ffffff`,check:co,onChange:e=>o(`background`,e)}),(0,$.jsx)(Qa,{value:w||`phosphor`,onChange:e=>o(`icon_set`,e===`phosphor`?``:e)}),(0,$.jsx)(io,{draft:O,value:a(`icon_colour`),onChange:e=>o(`icon_colour`,e)}),(0,$.jsx)(Ya,{draft:O,value:S||`auto`,onChange:e=>o(`icon_style`,e===`auto`?``:e)}),(0,$.jsx)(no,{value:T||`visor`,colours:E||`soft`,onChange:e=>o(`mascot`,e===`visor`?``:e),onColours:e=>o(`mascot_colours`,e===`soft`?``:e)}),(0,$.jsx)(q,{label:`Preview`,help:A.length?(0,$.jsx)(`span`,{className:`flex flex-col gap-1 text-warn`,children:A.map(e=>(0,$.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(f,{size:14,"aria-hidden":`true`,className:`mt-1 flex-none`}),e.label,` is hard to read (`,e.ratio,`:1, 4.5:1 needed).`]},e.label))}):`Every text reads on these colours.`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsxs)(`span`,{className:`flex w-full items-center justify-end gap-4 rounded-[10px] border border-line-soft bg-bg p-4`,children:[(0,$.jsx)(`a`,{href:`#appearance-preview`,onClick:e=>e.preventDefault(),className:`text-sm`,children:`A link`}),(0,$.jsx)(G,{variant:`primary`,size:`sm`,tabIndex:-1,"aria-hidden":`true`,className:`pointer-events-none`,children:`A button`})]}),(0,$.jsx)(so,{theme:i,onReset:t=>e.set(t),value:e.value})]})}),(0,$.jsx)(J,{icon:P,children:`Import colours`}),(0,$.jsx)(Wa,{start:ht(a(`secondary`))||ht(a(`primary`))||``,onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=K(n,[`theme`,e],t[e]);e.set(n)}}),(0,$.jsx)(Ha,{onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=K(n,[`theme`,e],t[e]||void 0);e.set(n)}}),(0,$.jsx)(q,{label:`From a DESIGN.md`,help:p?(0,$.jsx)(`span`,{role:`status`,className:`text-ink-2`,children:p}):`Reads the lines that name primary, secondary, gradient and background.`,children:(0,$.jsxs)(Ba,{children:[(0,$.jsx)(`input`,{ref:_,type:`file`,accept:`.md,.markdown,.txt,.css`,className:`sr-only`,tabIndex:-1,"aria-hidden":`true`,onChange:async t=>{let n=t.target.files?.[0];if(t.target.value=``,!n)return;if(n.size>262144)return m(`${n.name} is over 256 KB.`);let r=Nt(await n.text()),i=Object.entries(r).map(([e,t])=>`${e} ${t}`);if(!i.length)return m(`No primary, secondary, gradient or background colour in ${n.name}.`);let a=e.value;for(let[e,t]of Object.entries(r))a=K(a,[`theme`,e],t);e.set(a),m(`From ${n.name}: ${i.join(`, `)}.`)}}),(0,$.jsxs)(G,{size:`sm`,"data-tip":`Choose a DESIGN.md`,onClick:()=>_.current?.click(),children:[(0,$.jsx)(F,{"aria-hidden":`true`}),`Choose`]})]})}),(0,$.jsx)(q,{label:`Reset all`,help:`The logo, name and colours back to ForgeQE's own.`,children:(0,$.jsx)(Ba,{children:(0,$.jsxs)(G,{size:`sm`,disabled:!Object.keys(i).length,"data-tip":`The logo, name and colours back to ForgeQE's own`,onClick:()=>e.set(K(e.value,[`theme`],void 0)),children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Reset all`]})})})]})}function uo({ok:e,children:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:H(`m-0 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm leading-relaxed`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(f,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function fo({label:e,value:t,options:n,onPick:r}){return(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Wt,{label:e,value:t,onChange:r,options:n.map(e=>({id:e.id,label:e.label}))})})}var po=[{id:`eager`,label:`Briefly`},{id:`normal`,label:`A moment`},{id:`patient`,label:`Longer`}],mo=e=>e>=1e9?`${(e/1e9).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1e6))} MB`;function ho(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(wn()),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let n=!0,i=()=>Zt(!0).then(e=>n&&t(e)).catch(e=>n&&r(e.message));i();let a=cn(()=>e?.setup.running&&void i(),1500);return()=>{n=!1,Lt(a)}},[e?.setup.running]);let u=async()=>{r(``),s(!0),l(!0);try{t(await Ve.setup())}catch(e){r(e.message)}finally{l(!1)}},d=e,f=!!d?.setup.running;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{first:!0,help:`Listening and speaking run on this computer. Only the words go to your model, as typed words do.`,children:`Speech on this computer`}),(0,$.jsx)(q,{label:d?d.ready?`Set up`:f?`Setting up`:`Not set up yet`:`Speech`,help:d?.ready?`Talk, at the foot of the right panel or beside Refine in a chat, opens a conversation with Atlas. Talk over it any time: it stops and listens. English only for now.`:`A one-time download of open speech models${d?`, about ${mo(d.setup.bytes)}`:``}, into ForgeQE's folder.`,children:d?d.ready?(0,$.jsx)(at,{tone:`pass`,children:`Ready`}):f?(0,$.jsx)(at,{tone:`running`,children:`Setting up`}):(0,$.jsxs)(G,{size:`sm`,variant:`primary`,disabled:c,onClick:()=>void u(),"data-tip":`Download the speech models once: nothing is sent anywhere`,children:[c?(0,$.jsx)(ot,{state:`handing`,px:16}):(0,$.jsx)(ye,{"aria-hidden":`true`}),c?`Starting…`:`Install (${mo(d.setup.bytes)})`]}):(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Reading…`})}),(f||o&&d&&d.setup.lines.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!f&&d&&(0,$.jsx)(uo,{ok:d.ready,children:d.ready?`Speech is set up.`:d.setup.error||`The setup stopped with a problem. The last lines below say what.`}),(0,$.jsx)(`pre`,{"aria-label":`Speech setup output`,"aria-live":`polite`,className:`m-0 max-h-[280px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:d?.setup.lines.length?d.setup.lines.join(`
|
|
21
|
-
`):`Starting…`})]}),n&&(0,$.jsx)(uo,{ok:!1,children:n}),d?.ready&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Voice`,help:`An open voice that runs on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Ready`})}),(0,$.jsx)(q,{label:`Listening`,help:`Writes down what you say, on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:d.hearing?.model??`None`})})]}),(0,$.jsx)(J,{help:`How Talk takes turns with you. Yours alone: kept in this browser.`,children:`Conversation`}),(0,$.jsx)(q,{label:`It waits for you`,help:i===`eager`?`Answers soon after you pause: quick, but it may cut in.`:i===`patient`?`Waits longer when you pause mid-thought.`:`Waits a moment when you sound unfinished.`,children:(0,$.jsx)(fo,{label:`How long it waits for you`,value:i,options:po,onPick:e=>(a(e),Ft(e))})})]})}var go=[{id:`github`,name:`GitHub`,note:`github.com, or GitHub Enterprise at your own address.`,logo:An.github,tokenEnv:`GITHUB_TOKEN`,cloud:!0,cli:{system:`github`,label:`GitHub`}},{id:`azure-devops`,name:`Azure DevOps`,note:`An organization on dev.azure.com, or Azure DevOps Server.`,logo:An.azure_devops,tokenEnv:`ADO_PAT`,cloud:!0,org:`Organization`,cli:{system:`azure_devops`,label:`Azure DevOps`}},{id:`gitlab`,name:`GitLab`,note:`gitlab.com, or GitLab at your own address.`,logo:An.gitlab,tokenEnv:`GITLAB_TOKEN`,cloud:!0},{id:`bitbucket-cloud`,name:`Bitbucket Cloud`,note:`bitbucket.org: a workspace's repositories, or every one you can read.`,logo:An.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!0,org:`Workspace`},{id:`bitbucket-server`,name:`Bitbucket Data Center`,note:`Bitbucket Server or Data Center at your own address.`,logo:An.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!1}],_o=e=>go.find(t=>t.id===e),vo=/^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;function yo(e,t){let n=!t.url||bo(e?.id,String(t.url)).cloud;return e?.id===`github`?n?`cli`:`gh-host`:e?.id===`azure-devops`&&n?`cli`:`git`}function bo(e,t){let n;try{n=new URL(t.trim())}catch{return{cloud:!1}}let r=n.hostname.toLowerCase(),i=_e(n.pathname).split(`/`).filter(Boolean)[0],a=i&&/^[A-Za-z0-9][A-Za-z0-9 ._-]{0,99}$/.test(i)?i:void 0;if(e===`azure-devops`){if(r===`dev.azure.com`)return{cloud:!0,org:a};let e=/^([a-z0-9][a-z0-9-]{0,62})\.visualstudio\.com$/.exec(r);return e?{cloud:!0,org:e[1]}:{cloud:!1}}return e===`bitbucket-cloud`?r===`bitbucket.org`?{cloud:!0,org:a}:{cloud:!1}:e===`github`?{cloud:r===`github.com`}:e===`gitlab`?{cloud:r===`gitlab.com`}:{cloud:!1}}function xo({logo:e,icon:t,title:n,meta:r,state:i,actions:a}){return(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Bt,{icon:t,logo:e}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:r}),i]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:a})]})}function So({ok:e,message:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:H(`mt-2 mb-1 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(g,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function Co({title:e,help:t}){return(0,$.jsxs)(`div`,{className:`mt-8 mb-2 flex flex-col gap-1`,children:[(0,$.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),t&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:t})]})}var wo=({children:e})=>(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:e}),To=e=>Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`));function Eo(e,t,n){let r=Y(Z(e,[`product`,`repos`])),i=e;for(let[e,a]of Object.entries(r))Y(a).account===t&&(i=K(i,[`product`,`repos`,e,`account`],n));return i}function Do({edit:e}){let t=e.value,n=Y(Z(t,[`product`,`accounts`])),r=Y(Z(t,[`product`,`repos`])),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)({}),d=(0,Q.useCallback)(()=>{Ke.get().then(e=>u(e.saved),()=>{})},[]);(0,Q.useEffect)(d,[d]);let f=$t(),p=e=>Object.values(r).filter(t=>Y(t).account===e).length,m=(e,t)=>{let n=_o(t.host),r=p(e),i=`${r} ${r===1?`repository`:`repositories`} connected`;if(t.auth===`token`)return Tn(f,String(t.token_env||``))?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected with a token, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs its token: Edit to add it`});let a=yo(n,t),o=l[n.cli.system];return a===`cli`?o&&(o.via!==`token`||o.browser)&&hi(o,n.name)?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs a sign-in: Edit to sign in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`${a===`gh-host`?`The GitHub CLI's`:`Git Credential Manager's`} sign-in, ${i}`})};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{first:!0,help:`Sign in to where your code is, then pick the repositories ForgeQE reads into the product graph.`,children:`1. Repositories`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:Object.keys(n).length?`Your accounts. Pick more repositories from one with Repositories.`:`No account yet: add GitHub, Azure DevOps, GitLab or Bitbucket.`}),(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add an account`,onClick:()=>o({step:`catalog`}),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),Object.entries(n).map(([n,r])=>{let a=Y(r),s=_o(a.host);return(0,$.jsx)(xo,{logo:s?.logo,icon:pe,title:n,meta:[s?.name||`Unknown host`,a.org,a.url].filter(Boolean).map(String).join(`, `),state:m(n,a),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Repositories of ${n}`,"data-tip":`Repositories of ${n}`,disabled:!s,onClick:()=>c(n),children:(0,$.jsx)(i,{"aria-hidden":`true`})}),s&&(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${n}`,"data-tip":`Edit ${n}`,onClick:()=>o({step:`form`,host:s,mode:`edit`,name:n,from:n,value:a}),children:(0,$.jsx)(O,{"aria-hidden":`true`})}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${n}`,"data-tip":`Disconnect ${n}`,onClick:()=>e.set(Eo(K(t,[`product`,`accounts`,n],void 0),n,void 0)),children:(0,$.jsx)(w,{"aria-hidden":`true`})})]})},n)}),(0,$.jsx)(Co,{title:`Connected repositories`,help:`Each one a repository the graph reads: connected from an account, or a local clone or a link added by hand.`}),(0,$.jsx)(Rt,{edit:e,base:[`product`,`repos`],defs:Gn,noun:`repository by hand`,placeholder:`web`,meta:e=>typeof e.git==`string`&&e.git?`${e.git}${typeof e.branch==`string`&&e.branch?` (${e.branch})`:``}${typeof e.account==`string`?`, from ${e.account}`:``}`:typeof e.path==`string`?e.path:``}),(0,$.jsx)(No,{edit:e}),(0,$.jsx)(Io,{edit:e}),(0,$.jsx)(J,{help:nr[0].help,children:`4. The product and its knowledge`}),(0,$.jsx)(X,{defs:nr[0].fields,edit:e,base:nr[0].base}),nr.slice(1).map(t=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Co,{title:t.title,help:t.help}),(0,$.jsx)(X,{defs:t.fields,edit:e,base:t.base})]},t.title)),(0,$.jsx)(J,{help:ar[0].help,children:`5. ${ar[0].title}`}),(0,$.jsx)(X,{defs:ar[0].fields,edit:e,base:ar[0].base}),(0,$.jsx)(Oo,{sheet:a,setSheet:o,taken:e=>e in n,onSigned:d,onApply:n=>{let r=t;n.mode===`edit`&&n.from!==n.name&&(r=Eo(K(r,[`product`,`accounts`,n.from],void 0),n.from,n.name)),e.set(K(r,[`product`,`accounts`,n.name],n.value)),o(null),n.mode===`add`&&c(n.name)}}),(0,$.jsx)(ko,{id:s,account:s?Y(n[s]):{},repos:r,onClose:()=>c(null),onConnect:n=>e.set(K(t,[`product`,`repos`],{...r,...n}))})]})}function Oo({sheet:e,setSheet:t,taken:n,onApply:r,onSigned:i}){let a=$t(),[o,s]=(0,Q.useState)({busy:!1}),c=e?.step===`form`?`${e.host.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>s({busy:!1}),[c]);let l=()=>t(null);if(e?.step===`form`){let c=e,u=c.value,d=e=>t({...c,value:e}),f=c.name?vo.test(c.name)?c.name!==c.from&&n(c.name)?`Another account has this name.`:``:`Letters, digits, - and _.`:``,p=!u.url||bo(c.host.id,String(u.url)).cloud,m=c.host.id===`azure-devops`&&p&&!(u.url&&bo(c.host.id,String(u.url)).org),h=(()=>{let e=String(u.url||``).trim();if(!e)return``;try{let t=new URL(e);return t.protocol===`https:`?t.username||t.password?`No user name or password in the address: the token goes in its own field.`:``:`The address is https.`}catch{return`That is not an address.`}})(),g=!!c.name&&!f&&!h&&(c.host.cloud||!!String(u.url||``).trim())&&(!m||!!String(u.org||``).trim())&&(u.auth!==`token`||!!String(u.token_env||``).trim()),_=yo(c.host,u),v=async e=>{s({busy:!0});try{if(e===`signin`){let e=await tt.signIn(c.name||`account`,u);s({busy:!1,ok:e.ok,message:e.message})}else{let e=await tt.repos(c.name||`account`,u,To(a.pending),[]);s({busy:!1,ok:e.ok,message:e.ok?`Signed in: ${e.repos.length} ${e.repos.length===1?`repository`:`repositories`} to pick from${e.truncated?` (the first ones)`:``}.`:e.message})}}catch(e){s({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(Jt,{open:!0,onClose:l,title:c.mode===`add`?`Connect ${c.host.name}`:`Edit ${c.name}`,description:`Then pick its repositories. A token you type is kept in ${Qt(a.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[c.mode===`add`&&(0,$.jsxs)(G,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(me,{"aria-hidden":`true`}),`Back`]}),(0,$.jsxs)(G,{onClick:()=>v(`list`),disabled:o.busy||!g,className:`mr-auto`,"data-tip":`Test the connection`,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),o.busy?`Testing…`:`Test`]}),(0,$.jsxs)(G,{onClick:l,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:!g,onClick:()=>r(c),children:[c.mode===`add`?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),c.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(Bt,{logo:c.host.logo,icon:pe,size:`lg`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:c.host.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:o.message&&(0,$.jsx)(So,{ok:!!o.ok,message:o.message})}),(0,$.jsx)(q,{label:`Name`,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):`A short name for the account, such as work.`,htmlFor:`acct-name`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-name`,value:c.name,spellCheck:!1,"aria-invalid":!!f,placeholder:`work`,onChange:e=>t({...c,name:e.target.value.trim()})})}),(0,$.jsx)(q,{label:c.host.cloud?`Address of your own server`:`Address`,help:h?(0,$.jsx)(`span`,{className:`text-fail`,children:h}):c.host.cloud?`Empty: ${c.host.name}'s cloud.`:`https, the server's address.`,htmlFor:`acct-url`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-url`,"aria-invalid":!!h,value:String(u.url||``),spellCheck:!1,placeholder:c.host.cloud?``:`https://bitbucket.acme.example`,onChange:e=>d(K(u,[`url`],e.target.value.trim()||void 0))})}),c.host.org&&(0,$.jsx)(q,{label:c.host.org,help:m?`Its name, as in dev.azure.com/<organization>.`:`Empty: every repository you can read.`,htmlFor:`acct-org`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-org`,value:String(u.org||``),spellCheck:!1,placeholder:`acme`,onChange:e=>d(K(u,[`org`],e.target.value.trim()||void 0))})}),(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 py-4`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Sign in`}),[[`browser`,_===`git`?`In the browser, with Git Credential Manager`:c.host.id===`github`?`In the browser, with the GitHub CLI`:`In the browser, with Microsoft (the Azure CLI)`],[`token`,`With a personal access token`]].map(([e,t])=>(0,$.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-4 text-sm`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`acct-auth`,checked:u.auth===`token`==(e===`token`),onChange:()=>d(e===`token`?{...u,auth:`token`,token_env:u.token_env||c.host.tokenEnv}:{...u,auth:`browser`,token_env:void 0,user:void 0})}),t]},e))]}),u.auth===`token`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Token`,help:`Read access to the repositories (code: read).`,htmlFor:`account-token`,stacked:!0,children:(0,$.jsx)(tn,{id:`account-token`,name:String(u.token_env||c.host.tokenEnv),field:`token`,onRename:e=>d({...u,token_env:e})})}),(c.host.id===`bitbucket-cloud`||c.host.id===`bitbucket-server`)&&(0,$.jsx)(q,{label:`User name for the token`,help:`With a Bitbucket app password. Empty: an access token.`,htmlFor:`acct-user`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-user`,value:String(u.user||``),spellCheck:!1,onChange:e=>d(K(u,[`user`],e.target.value.trim()||void 0))})})]}):_===`cli`?(0,$.jsx)(gi,{system:c.host.cli.system,label:c.host.cli.label,keyless:!0,onChanged:i}):_===`gh-host`?(0,$.jsx)(q,{label:`Sign in with the GitHub CLI`,help:`In a terminal: gh auth login --web --hostname ${(()=>{try{return new URL(String(u.url)).hostname}catch{return`<your server>`}})()}. Then Test.`,stacked:!0}):(0,$.jsx)(q,{label:`Sign in with the browser`,help:`Git Credential Manager opens the sign-in on this computer and keeps it for git, which fetches the repositories with it.`,stacked:!0,children:(0,$.jsxs)(G,{onClick:()=>v(`signin`),disabled:o.busy||!g,"data-tip":`Sign in with the browser`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),o.busy?`Signing in…`:`Sign in`]})})]})}return(0,$.jsx)(Jt,{open:e?.step===`catalog`,onClose:l,title:`Add an account`,description:`Pick where your code is.`,footer:(0,$.jsxs)(G,{onClick:l,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsx)(`div`,{className:`pt-4`,children:go.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({step:`form`,host:e,mode:`add`,name:``,from:``,value:{host:e.id,auth:`browser`}}),className:`flex min-h-14 w-full cursor-pointer items-center gap-4 rounded-[12px] border-0 bg-transparent px-2 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,$.jsx)(Bt,{logo:e.logo,icon:pe}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:`text-[13px] text-accent-fg`,children:`Add`})]},e.id))})})}function ko({id:e,account:t,repos:n,onClose:r,onConnect:i}){let a=$t(),[o,s]=(0,Q.useState)({busy:!1}),[c,l]=(0,Q.useState)(new Set),[u,d]=(0,Q.useState)(``),f=(0,Q.useMemo)(()=>new Set(Object.values(n).map(e=>String(Y(e).git||``))),[n]);(0,Q.useEffect)(()=>{e&&(l(new Set),d(``),s({busy:!0}),tt.repos(e,t,To(a.pending),Object.keys(n)).then(e=>s(e.ok?{busy:!1,repos:e.repos,truncated:e.truncated,skipped:e.skipped}:{busy:!1,message:e.message}),e=>s({busy:!1,message:e.message})))},[e]);let p=(o.repos||[]).filter(e=>!u||e.fullName.toLowerCase().includes(u.toLowerCase()));return(0,$.jsxs)(Jt,{open:!!e,onClose:r,wide:!0,title:`Repositories of ${e||``}`,description:`Pick the ones ForgeQE reads into the product graph. They are fetched into ForgeQE's own cache, never your workspace.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-sm text-muted`,children:c.size?`${c.size} picked`:``}),(0,$.jsxs)(G,{onClick:r,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:!c.size,onClick:()=>{let e={};for(let t of o.repos||[])c.has(t.git)&&(e[t.key]=t.entry);i(e),r()},"data-tip":c.size>1?`Connect ${c.size} repositories`:void 0,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),c.size>1?`Connect (${c.size})`:`Connect`]})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[o.busy&&(0,$.jsx)(wo,{children:`Reading the account's repositories…`}),o.message&&(0,$.jsx)(So,{ok:!1,message:o.message})]}),o.repos&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Find`,htmlFor:`repo-find`,stacked:!0,children:(0,$.jsx)(W,{id:`repo-find`,value:u,placeholder:`shop`,onChange:e=>d(e.target.value)})}),!p.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:o.repos.length?`None matches.`:`None yet: the account can read no repository.`}),(0,$.jsx)(`ul`,{"aria-label":`Repositories`,className:`m-0 list-none p-0`,children:p.map(e=>{let t=f.has(e.git);return(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:H(`flex min-h-12 items-center gap-4 py-2`,t?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(Pn,{disabled:t,checked:t||c.has(e.git),onCheckedChange:t=>l(n=>{let r=new Set(n);return t?r.add(e.git):r.delete(e.git),r})}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.fullName}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.branch,e.private?`private`:e.private===!1?`public`:``,e.description].filter(Boolean).join(` · `)})]}),t&&(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected`})]})},e.git)})}),(o.truncated||!!o.skipped)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[o.truncated?`The first 2,000 are listed: find narrows them.`:``,o.skipped?`${o.skipped} left out: their links are not of this host, or not https.`:``].filter(Boolean).join(` `)})]})]})}var Ao=e=>e.url?`url`:e.mcp?`mcp`:e.command?`command`:e.documents?`documents`:`none`,jo=$n[0].fields,Mo=e=>e.map(e=>jo.find(t=>t.key===e));function No({edit:e}){let t=$t(),n=Y(e.value.rag),r=Ao(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)({busy:!1}),u=JSON.stringify(n),d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>a(r===`none`&&d.current?.rag===u?d.current.kind:r),[r,u]);let f=t=>{a(t),l({busy:!1});let r={top_k:n.top_k,timeout_seconds:n.timeout_seconds},i=t===`none`?{}:Object.fromEntries(Object.entries({...r,...t===`url`?{url:n.url,token_env:n.token_env}:t===`mcp`?{mcp:n.mcp}:t===`documents`?{documents:n.documents&&typeof n.documents==`object`?n.documents:{reasoning:!1}}:{command:n.command}}).filter(([,e])=>e!==void 0));d.current={kind:t,rag:JSON.stringify(Object.keys(i).length?i:{})},e.set(K(e.value,[`rag`],Object.keys(i).length?i:void 0))},p=Object.keys(Y(e.value.mcp)),m=async()=>{l({busy:!0});try{let r=await tt.testSearch(n,Y(e.value.mcp),o,To(t.pending));l({busy:!1,...r})}catch(e){l({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`Where your requirements, specs and wiki are searched (a RAG index): checking a test case or a story adds the passages it finds.`,children:`2. Search service`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`The search service`,className:`mb-2`,children:[[`none`,`None`,`Test cases and stories are checked without passages from your documents.`],[`documents`,`This project's documents`,`Built in, no vectors: searches the folders you name.`],[`url`,`A service at an address`,`Your own RAG service, at its address.`],[`mcp`,`A tool of one of your MCP servers`,`A search tool of a server set up under MCP servers.`],[`command`,`A command on this machine`,`A program that prints the passages it finds.`]].map(([e,t,n])=>(0,$.jsxs)(`div`,{onClick:t=>i!==e&&!t.target.closest(`[role=radio]`)&&f(e),className:`flex min-h-[68px] cursor-pointer flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4 first:border-t-0`,children:[(0,$.jsx)(Er,{checked:i===e,onSelect:()=>i!==e&&f(e),label:`Use ${t}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:n})]})]},e))}),i===`url`&&(0,$.jsx)(X,{defs:Mo([`url`,`token_env`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{defs:Mo([`mcp.server`,`mcp.tool`,`mcp.query_arg`,`mcp.top_k_arg`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-4 text-[13px] text-muted`,children:p.length?`MCP servers set up: ${p.join(`, `)}.`:`No MCP server is set up yet: add one under MCP servers, then name it here.`})]}),i===`command`&&(0,$.jsx)(X,{defs:Mo([`command`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`documents`&&(0,$.jsx)(X,{defs:Mo([`documents.folders`,`documents.reasoning`,`top_k`]),edit:e,base:[`rag`]}),i!==`none`&&(0,$.jsx)(q,{label:`Try a search`,help:i===`command`?`A command runs on the next real search, not from this page.`:i===`documents`?`Searched by keywords only on this page; the model is asked on a real search. Nothing is saved.`:`What a test case would search for. Nothing is saved.`,htmlFor:`rag-query`,children:(0,$.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,$.jsx)(W,{id:`rag-query`,value:o,placeholder:`refunds over 500 EUR`,onChange:e=>s(e.target.value),onKeyDown:e=>Ot(e)&&o.trim()&&m(),className:`min-w-0 flex-1`}),(0,$.jsxs)(G,{size:`sm`,disabled:c.busy||!o.trim(),onClick:m,children:[(0,$.jsx)(ne,{"aria-hidden":`true`}),c.busy?`Searching…`:`Search`]})]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[c.message&&(0,$.jsx)(So,{ok:!!c.ok,message:c.message}),!!c.passages?.length&&(0,$.jsx)(`ul`,{"aria-label":`Passages found`,className:`m-0 list-none p-0`,children:c.passages.map((e,t)=>(0,$.jsxs)(`li`,{className:`border-t border-line-soft py-2 text-sm [overflow-wrap:anywhere]`,children:[e.source&&(0,$.jsxs)(`span`,{className:`font-medium`,children:[e.source,`: `]}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:e.text})]},t))})]})]})}var Po=/^[A-Za-z0-9][A-Za-z0-9 _.()-]{0,99}\.(md|markdown|txt)$/i,Fo=e=>e<1024?`${e} bytes`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Io({edit:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{tt.documents().then(e=>n(e.documents),e=>i({ok:!1,message:e.message}))},[]);let c=async e=>{if(!e?.length)return;o(!0),i(null);let r=[];try{for(let i of Array.from(e)){if(!Po.test(i.name))throw Error(`${i.name}: only a .md, .markdown or .txt file with a plain name.`);if(i.size>1e6)throw Error(`${i.name} is over 1 MB.`);let e=t?.some(e=>e.name===i.name)??!1,a=await tt.addDocument(i.name,await i.text(),e);n(a.documents),r.push(i.name)}i({ok:!0,message:`Added ${r.join(`, `)}. forgeqe knowledge build reads them with the other documents.`})}catch(e){i({ok:!1,message:e.message})}finally{o(!1),s.current&&(s.current.value=``)}},l=async e=>{try{n((await tt.removeDocument(e)).documents)}catch(e){i({ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`What the graph reads beside the code: Markdown files you add here, folders on this computer, links, Confluence spaces, and the pages ForgeQE remembers of a web app.`,children:`3. Documents`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Added here: kept in .forgeqe/documents, read as the source uploaded.`}),(0,$.jsxs)(G,{size:`sm`,disabled:a,"data-tip":`Add Markdown files`,onClick:()=>s.current?.click(),children:[(0,$.jsx)(u,{"aria-hidden":`true`}),a?`Uploading…`:`Upload`]}),(0,$.jsx)(`input`,{ref:s,type:`file`,accept:`.md,.markdown,.txt,text/markdown,text/plain`,multiple:!0,hidden:!0,onChange:e=>c(e.target.files)})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:r&&(0,$.jsx)(So,{ok:r.ok,message:r.message})}),!t&&!r&&(0,$.jsx)(wo,{children:`Reading the documents…`}),t&&!t.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet.`}),t?.map(e=>(0,$.jsx)(xo,{icon:Me,title:e.title,meta:`${e.name}, ${Fo(e.bytes)}`,actions:(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>l(e.name),children:(0,$.jsx)(je,{"aria-hidden":`true`})})},e.name)),(0,$.jsx)(Co,{title:`Documents and links`,help:`Each one a folder of documents, a link, a Confluence space, or a web app whose pages ForgeQE remembers, by a name no repository has.`}),(0,$.jsx)(Rt,{edit:e,base:[`product`,`docs`],defs:Zn,noun:`source`,placeholder:`help`,meta:e=>String(e.path||e.url||(e.confluence?`Confluence ${e.confluence}`:e.app?`app ${e.app}`:``))})]})}var Lo=/^[A-Z][A-Z0-9_]{1,63}$/,Ro=/^(PATH|PATHEXT|HOME|SHELL|USER|USERNAME|LOGNAME|PWD|TMPDIR|TEMP|TMP|LANG|LC_\w+|TERM|COMSPEC|SYSTEMROOT|WINDIR|APPDATA|LOCALAPPDATA|USERPROFILE|NODE_\w+|BUN_\w+|NPM_\w+|PYTHON\w*|VIRTUAL_ENV|UV_\w+|LD_\w+|DYLD_\w+|SSL_CERT_\w+|REQUESTS_CA_BUNDLE|CURL_CA_BUNDLE|(HTTPS?|ALL|NO)_PROXY|GIT_\w+|SSH_\w+|GNUPGHOME|EDITOR|VISUAL|PAGER|FORGEQE_\w+|WEBPILOT_\w+|WP_CONFIG|WP_LLMS_JSON|WP_LLM_PROFILE)$/i,zo=/(TOKEN|PAT)$/,Bo=(e,t=`SHOP_PASSWORD`)=>Lo.test(e)?Ro.test(e)?`${e} changes how programs start: pick another name.`:``:`Capital letters, digits and _, such as ${t}.`,Vo=[{id:`azure`,label:`Azure Key Vault`,where:`Key vault`,whereHelp:`Its name, as in https://<name>.vault.azure.net.`,placeholder:`shop-qa-kv`,cli:`Microsoft, in the browser (az login)`},{id:`gcp`,label:`Google Secret Manager`,where:`Project`,whereHelp:`The Google Cloud project's id.`,placeholder:`shop-qa-123456`,cli:`Google, in the browser (gcloud auth login)`},{id:`aws`,label:`AWS Secrets Manager`,where:`Region`,whereHelp:`Where its secrets are, such as eu-west-1.`,placeholder:`eu-west-1`,cli:`AWS SSO, in the browser (aws sso login)`}],Ho={tenant:`Tenant id`,clientId:`Client id`,clientSecret:`Client secret`,serviceAccount:`Service account key (JSON)`,accessKeyId:`Access key id`,secretAccessKey:`Secret access key`,sessionToken:`Session token (optional)`},Uo=e=>e?.length?`Used by ${e.slice(0,2).join(`, `)}${e.length>2?` and ${e.length-2} more`:``}`:``,Wo=()=>Be.list();function Go({show:e}){let{data:t,error:n,reload:r}=hn(Wo),[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`sec-saved`),[l,d]=(0,Q.useState)(e||`all`);(0,Q.useEffect)(()=>{e&&c(`sec-saved`),d(e||`all`)},[e]);let[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[j,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)({}),I=i??t,ee=(I?.vaults||[]).filter(e=>e.auth===`cli`).map(e=>e.id).join(`,`),L=e=>{F(t=>({...t,[e]:`checking`})),Be.check(e).then(t=>F(n=>({...n,[e]:t})),t=>F(n=>({...n,[e]:{signedIn:!1,problem:t.message}})))};(0,Q.useEffect)(()=>{if(s===`sec-vaults`)for(let e of ee.split(`,`).filter(Boolean))P[e]||L(e)},[s,ee]),(0,Q.useEffect)(()=>{if(j?.state!==`running`)return;let e=setTimeout(()=>{Be.signinState().then(e=>{N(e.signin),e.signin&&e.signin.state!==`running`&&L(e.signin.vault)},()=>{})},1e3);return()=>clearTimeout(e)},[j]);let te=async e=>{p(``),h(``);try{N(await Be.signIn(e))}catch(e){h(e.message)}},ne=async(e,t,n)=>{w(!0),k(``);try{o(await e()),n(),p(t)}catch(e){k(e.message)}finally{w(!1)}},re=e=>{k(``),p(``),e()};if(!I)return(0,$.jsx)(In,{error:n,reload:r});let ie=I.secrets.filter(e=>e.from===`vault`&&!e.pending).length,ae=async()=>{p(``),h(``);try{let e=await Be.exportVaults(),t=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json;charset=utf-8`})),n=document.createElement(`a`);n.href=t,n.download=`forgeqe-vaults.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3),p(`Exported the vault connections: no value is in the file. A teammate imports it here and pulls with their own sign-in.`)}catch(e){h(e.message)}},oe=async e=>{let t=e?.[0];if(t){if(p(``),h(``),t.size>262144)return h(`${t.name} is over 256 KB.`);w(!0),D(!0);try{let e=await Be.importVaults(await t.text());o(e.view);let n=[e.added.length?`Added ${e.added.length===1?`the vault`:`${e.added.length} vaults:`} ${e.added.join(`, `)}.`:`No new vault.`,e.toPull.length?`${e.toPull.length===1?`1 secret is`:`${e.toPull.length} secrets are`} ready to pull on Saved: sign in, then Pull.`:``];p(n.filter(Boolean).join(` `)),e.skipped.length&&h(`Not imported: ${e.skipped.map(e=>`${e.id} (${e.why})`).join(`; `)}`)}catch(e){h(e.message)}finally{w(!1),D(!1)}}},se=I.secrets.filter(e=>e.token),z=l===`tokens`?se:I.secrets,le=(e=I.suggestedTokens[0]||`REPO_TOKEN`)=>re(()=>_({mode:`add`,name:e,value:``,token:!0})),ue=async e=>{w(!0),p(``),h(``);try{let t=await Be.pullAgain(e);o(t.view),t.failed.length?h(`Not pulled: ${t.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`):p(`Pulled ${e}.`)}catch(e){h(e.message)}finally{w(!1)}},de=async()=>{w(!0),p(``),h(``);try{let e=await Be.pullAgain();o(e.view),p(`Pulled ${e.pulled.length} again from their vaults.`),h(e.failed.length?`Not pulled: ${e.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`:``)}catch(e){h(e.message)}finally{w(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Yt,{label:`Secrets`,current:s,onPick:e=>{c(e),p(``),h(``)},tabs:[{id:`sec-saved`,label:`Saved (${I.secrets.length})`},{id:`sec-vaults`,label:`Vaults (${I.vaults.length})`}]}),f&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 mb-4 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:f}),m&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:m}),s===`sec-saved`?(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-saved`,"aria-labelledby":`tab-sec-saved`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":`Show`,children:(0,$.jsx)(dt,{value:l,onChange:e=>{d(e),p(``)},items:[{id:`all`,label:`All`,n:I.secrets.length},{id:`tokens`,label:`Repository tokens`,n:se.length+I.neededTokens.length}]})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[ie>0&&(0,$.jsxs)(G,{size:`sm`,disabled:C,onClick:()=>void de(),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),C?`Pulling…`:`Pull all again`]}),l===`tokens`?(0,$.jsxs)(G,{size:`sm`,onClick:()=>le(),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a token`]}):(0,$.jsxs)(G,{size:`sm`,onClick:()=>re(()=>_({mode:`add`,name:``,value:``})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a secret`]})]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:l===`tokens`?`The tokens ForgeQE clones and reads git repositories with: one for each git host or account. A clone picks one by its name.`:`Agents and tests use a secret by its name: in a sign-in, an environment's secrets, or a test's variables.`}),I.neededTokens.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:A}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:`${Uo(e.usedBy)}. It has no value here yet.`,state:(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:(0,$.jsx)(G,{size:`sm`,"aria-label":`Add ${e.name}`,onClick:()=>le(e.name),children:`Add`}),children:null},`needed-${e.name}`)),z.length===0&&!I.neededTokens.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:l===`tokens`?`No repository tokens yet. Add one for each git host or account.`:`None yet. Add one, or pull one from a vault.`}),z.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:e.from===`vault`?S:e.from===`sign-in`?R:e.token?A:ce}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:[e.from===`vault`&&e.vault?`From ${e.vault.provider} ${e.vault.id}: ${e.vault.secret}${e.vault.key?` › ${e.vault.key}`:``} · ${e.pending?`not pulled yet`:`pulled ${xn(e.vault.at)}`}`:e.from===`sign-in`?`From the ${e.system} sign-in: sign out of it to remove it.`:e.from===`shell`?`Set in your shell: change or remove it there.`:`Saved in Settings`,e.token?Uo(e.usedBy)||`Not used yet`:``].filter(Boolean).join(` · `),state:e.from===`shell`?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Set in the environment`}):e.set?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Saved`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:e.pending?(0,$.jsx)(G,{size:`sm`,"aria-label":`Pull ${e.name}`,disabled:C,onClick:()=>void ue(e.name),children:`Pull`}):e.from===`sign-in`||e.from===`shell`?void 0:(0,$.jsx)(G,{size:`sm`,"aria-label":`Edit ${e.name}`,onClick:()=>re(()=>_({mode:`edit`,name:e.name,value:``,row:e,...e.token?{token:!0}:{}})),children:`Edit`}),children:null},e.name)),(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:[`Kept in `,Qt(I.store),`. ForgeQE never shows a value again, and the agents see only names.`,l===`tokens`?` Give each token read access to the repositories it clones, nothing more.`:``]})]}):(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-vaults`,"aria-labelledby":`tab-sec-vaults`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[I.vaults.length>0&&(0,$.jsxs)(G,{size:`sm`,onClick:()=>void ae(),"data-tip":`A file of the connections, without values, for a teammate to import`,children:[(0,$.jsx)(ye,{"aria-hidden":`true`}),`Export`]}),(0,$.jsxs)(G,{size:`sm`,disabled:C,onClick:()=>T.current?.click(),"data-tip":`Connections a teammate exported`,children:[(0,$.jsx)(u,{"aria-hidden":`true`}),E?`Importing…`:`Import`]}),(0,$.jsx)(`input`,{ref:T,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>(oe(e.target.files),e.target.value=``)}),(0,$.jsxs)(G,{size:`sm`,onClick:()=>re(()=>y({mode:`add`,v:{id:``,provider:`azure`,where:``,auth:`cli`}})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a vault`]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:`Where ForgeQE pulls secrets from. It reads a value only when you pull that secret.`}),j&&(0,$.jsx)(Yo,{s:j,onCancel:()=>void Be.cancelSignin().then(e=>N(e.signin),()=>{}),onClose:()=>N(null)}),I.vaults.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet. Add Azure Key Vault, Google Secret Manager or AWS Secrets Manager.`}),I.vaults.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:S}),title:e.id,meta:`${e.providerLabel} · ${e.where} · ${e.auth===`cli`?`signs in with your browser${e.profile?`, profile ${e.profile}`:``}`:`signs in with saved keys`}${e.pulled?` · ${e.pulled} pulled`:``}${e.missing.length?` · not saved yet: ${e.missing.join(`, `)}`:``}`,state:e.auth===`cli`?P[e.id]===`checking`||!P[e.id]?(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Checking the sign-in…`}):P[e.id].signedIn?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":P[e.id].problem,children:`Not signed in`}):e.missing.length?(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":e.missing.join(`, `),children:e.missing.length===1?`Needs ${e.missing[0]}`:`Needs ${e.missing.length} variables`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.pulled===1?`1 secret pulled`:`${e.pulled} secrets pulled`}),actions:(0,$.jsxs)($.Fragment,{children:[e.auth===`cli`&&P[e.id]!==`checking`&&P[e.id]&&!P[e.id].signedIn?(0,$.jsxs)(G,{size:`sm`,variant:`primary`,"aria-label":`Sign in to ${e.id}`,disabled:j?.state===`running`,onClick:()=>void te(e.id),children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Sign in`]}):(0,$.jsx)(G,{size:`sm`,"aria-label":`Browse ${e.id}`,disabled:e.missing.length>0||e.auth===`cli`&&P[e.id]===`checking`,onClick:()=>re(()=>x(e)),children:`Browse`}),(0,$.jsx)(G,{size:`sm`,"aria-label":`Edit ${e.id}`,onClick:()=>re(()=>y({mode:`edit`,v:{id:e.id,provider:e.provider,where:e.where,auth:e.auth,...e.profile?{profile:e.profile}:{},...e.keys?{keys:e.keys}:{}}})),children:`Edit`})]}),children:null},e.id)),(0,$.jsx)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:`Vaults are kept on this computer for this project, never in the repository: share them with Export and Import, which carry no value. Give ForgeQE's sign-in read access to the secrets it needs, nothing more.`})]}),(0,$.jsx)(Ko,{panel:g,setPanel:_,busy:C,error:O,onSave:e=>void ne(()=>Be.save(e.name,e.value),`${e.mode===`add`?`Added`:`Saved`} ${e.name}.`,()=>_(null)),onRemove:e=>void ne(()=>Be.remove(e),`Removed ${e}.`,()=>_(null)),onPull:e=>void ne(async()=>{let t=await Be.pullAgain(e);if(t.failed.length)throw Error(t.failed[0].error);return t.view},`Pulled ${e} again.`,()=>_(null)),taken:new Set(I.secrets.map(e=>e.name))}),(0,$.jsx)(qo,{panel:v,setPanel:y,busy:C,error:O,roles:I.keyRoles,taken:new Set(I.vaults.map(e=>e.id)),missing:I.vaults.find(e=>e.id===v?.v.id)?.missing,onSave:e=>void ne(()=>Be.saveVault(e.v,e.mode===`edit`),`${e.mode===`add`?`Added`:`Saved`} the vault ${e.v.id}.${e.v.auth===`cli`?` Sign in on its row if it says Not signed in.`:``}`,()=>{y(null),F(t=>{let{[e.v.id]:n,...r}=t;return r})}),onRemove:e=>void ne(()=>Be.removeVault(e),`Removed the vault ${e}. The secrets pulled from it stay saved.`,()=>y(null))}),(0,$.jsx)(Jo,{vault:b,onClose:()=>x(null),taken:new Set(I.secrets.map(e=>e.name)),onPulled:(e,t,n)=>{o(e),x(null),c(`sec-saved`),p(`Pulled ${n} as ${t}. Agents and tests can use it by that name.`)}})]})}function Ko({panel:e,setPanel:t,busy:n,error:r,onSave:i,onRemove:o,onPull:s,taken:c}){let l=e?.mode===`add`?Bo(e.name,e.token?`GITHUB_TOKEN`:void 0)||(c.has(e.name)?`${e.name} is already in the list: edit it there.`:``)||(e.token&&!zo.test(e.name)?`A token's name ends in TOKEN or PAT, such as GITHUB_TOKEN.`:``):``,u=e?.row?.from===`vault`,[d,f]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>f(!1),[!!e]),(0,$.jsx)(Jt,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${e.name}`:e?.token?`Add a repository token`:`Add a secret`,description:`The value goes to your credential store when you press the button below. ForgeQE never shows it again, and the agents see only its name.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):l?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(G,{disabled:n,onClick:()=>o(e.name),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(G,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:n||!!l||!e?.value.trim(),onClick:()=>e&&i(e),children:n?`Saving…`:e?.mode===`add`?e.token?`Add token`:`Add secret`:e?.token?`Save token`:`Save secret`})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[e.mode===`add`&&(0,$.jsx)(q,{label:`Name`,help:l?(0,$.jsx)(`span`,{className:`text-fail`,children:l}):e.token?`The variable a clone signs in with: one per host or account.`:`The variable agents and tests read it by.`,htmlFor:`sh-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(W,{id:`sh-name`,value:e.name,spellCheck:!1,maxLength:64,placeholder:e.token?`GITHUB_TOKEN`:`SHOP_PASSWORD`,"aria-invalid":!!l,onChange:n=>t({...e,name:n.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),u&&e.row?.vault&&(0,$.jsx)(q,{label:`From a vault`,help:`${e.row.vault.provider} ${e.row.vault.id}: ${e.row.vault.secret}${e.row.vault.key?` › ${e.row.vault.key}`:``}, pulled ${xn(e.row.vault.at)}. Pull it again for the vault's newest value; a value typed below replaces it and is no longer the vault's.`,className:`mt-4`,stacked:!0,children:(0,$.jsxs)(G,{size:`sm`,disabled:n,onClick:()=>s(e.name),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Pull again`]})}),(0,$.jsx)(q,{label:e.mode===`edit`?`New value`:e.token?`Token`:`Value`,help:e.token?`A personal access token with read access to the repositories (GitHub: Contents read; Azure DevOps: Code read; GitLab: read_repository).`:(0,$.jsxs)($.Fragment,{children:[`At most 16 KB.`,` `,(0,$.jsx)(`button`,{type:`button`,onClick:()=>f(!d),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:d?`One line, hidden`:`Several lines (shown as you type), such as a JSON key`})]}),htmlFor:`sh-value`,className:e.mode===`edit`&&!u?`mt-4`:void 0,stacked:!0,children:d&&!e.token?(0,$.jsx)(rt,{id:`sh-value`,rows:6,autoComplete:`off`,spellCheck:!1,value:e.value,onChange:n=>t({...e,value:n.target.value}),className:`font-mono`}):(0,$.jsx)(W,{id:`sh-value`,type:`password`,autoComplete:`off`,value:e.value,onChange:n=>t({...e,value:n.target.value})})})]})})}function qo({panel:e,setPanel:t,busy:n,error:r,roles:i,taken:a,missing:o,onSave:s,onRemove:c}){let l=e?.v,u=Vo.find(e=>e.id===l?.provider)??Vo[0],d=n=>e&&t({...e,v:{...e.v,...n}}),f=l?.auth===`keys`?Object.entries(i[l.provider]).map(([e,t])=>[e,Bo(l.keys?.[e]??t)]).filter(([,e])=>e):[],p=e?.mode===`add`?/^[a-z][a-z0-9-]{0,39}$/.test(l?.id||``)?a.has(l.id)?`A vault is already named ${l.id}.`:``:`Lower case letters, digits and -, such as qa-kv.`:``;return(0,$.jsx)(Jt,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${l?.id}`:`Add a vault`,description:`Where ForgeQE pulls secrets from, and how it signs in. Kept on this computer for this project. Nothing is read until you pull a secret.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):p||f.length?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(G,{disabled:n,onClick:()=>c(l.id),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(G,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:n||!!p||f.length>0||!l?.where.trim(),onClick:()=>e&&s(e),children:n?`Saving…`:e?.mode===`add`?`Add vault`:`Save vault`})]}),children:e&&l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Provider`,htmlFor:`vt-provider`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(U,{id:`vt-provider`,value:l.provider,disabled:e.mode===`edit`,onChange:e=>d({provider:e.target.value,where:``,keys:void 0,profile:void 0}),children:Vo.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),e.mode===`add`&&(0,$.jsx)(q,{label:`Name`,help:p?(0,$.jsx)(`span`,{className:`text-fail`,children:p}):`What this project calls it.`,htmlFor:`vt-id`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-id`,value:l.id,spellCheck:!1,maxLength:40,placeholder:`qa-kv`,"aria-invalid":!!p,onChange:e=>d({id:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`)}),className:`font-mono`})}),(0,$.jsx)(q,{label:u.where,help:u.whereHelp,htmlFor:`vt-where`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-where`,value:l.where,spellCheck:!1,maxLength:64,placeholder:u.placeholder,onChange:e=>d({where:e.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(q,{label:`Sign in with`,help:l.auth===`cli`?`Your own account, in your browser: Sign in on the vault's row after you add it. The cloud's CLI keeps the sign-in and renews it; ForgeQE saves nothing.`:`For a computer with nobody to sign in, such as a build agent.`,htmlFor:`vt-auth`,stacked:!0,children:(0,$.jsxs)(U,{id:`vt-auth`,value:l.auth,onChange:e=>d({auth:e.target.value,keys:e.target.value===`keys`?{...i[l.provider]}:void 0}),children:[(0,$.jsxs)(`option`,{value:`cli`,children:[u.cli,` (recommended)`]}),(0,$.jsx)(`option`,{value:`keys`,children:l.provider===`azure`?`A service principal's keys, saved as secrets (no browser)`:l.provider===`gcp`?`A service account's key, saved as a secret (no browser)`:`Access keys, saved as secrets (no browser)`})]})}),l.provider===`aws`&&l.auth===`cli`&&(0,$.jsx)(q,{label:`Profile (optional)`,help:`An SSO profile of ~/.aws/config (set one up once with aws configure sso). Empty: the default.`,htmlFor:`vt-profile`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-profile`,value:l.profile||``,spellCheck:!1,maxLength:64,placeholder:`qa`,onChange:e=>d({profile:e.target.value.trim()||void 0}),className:`font-mono`})}),l.auth===`keys`&&Object.entries(i[l.provider]).map(([e,t])=>(0,$.jsx)(q,{label:Ho[e]||e,help:(()=>{let n=l.keys?.[e]??t,r=Bo(n);return r?(0,$.jsx)(`span`,{className:`text-fail`,children:r}):o?.includes(n)?(0,$.jsx)(`span`,{className:`text-warn`,children:`Not saved yet: add ${n} on the Saved tab.`}):`The secret that holds it, saved on the Saved tab as ${n}.`})(),htmlFor:`vt-${e}`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-${e}`,"aria-invalid":!!Bo(l.keys?.[e]??t),value:l.keys?.[e]??t,spellCheck:!1,maxLength:64,onChange:t=>d({keys:{...l.keys||i[l.provider],[e]:t.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}}),className:`font-mono`})},e))]})})}function Jo({vault:e,onClose:t,taken:n,onPulled:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=()=>{e&&(a(null),s(``),Be.names(e.id).then(a,e=>s(e.message)))};(0,Q.useEffect)(()=>{d(null),l(``),h(``),g()},[e?.id]);let _=(i?.names||[]).filter(e=>e.toLowerCase().includes(c.trim().toLowerCase())),v=_.slice(0,200),y=u?Bo(u.name):``,b=async()=>{if(e&&u){p(!0),h(``);try{r(await Be.pull({vault:e.id,secret:u.secret,name:u.name,...u.key.trim()?{key:u.key.trim()}:{}}),u.name,u.secret)}catch(e){h(e.message)}finally{p(!1)}}};return(0,$.jsxs)(Jt,{open:!!e,onClose:t,wide:!0,title:e?`Secrets of ${e.id}`:`Secrets`,description:e?`The names in ${e.providerLabel} ${e.where}. Pick one to pull its value into your credential store under a variable's name; ForgeQE never shows the value.`:void 0,footer:(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:m}):(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:u?y?`Needs a valid name`:`${u.secret} as ${u.name}`:``}),(0,$.jsx)(G,{onClick:t,children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:f||!u||!!y,onClick:()=>void b(),children:f?`Pulling…`:`Pull secret`})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[!i&&!o&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Reading the vault's names…`}),o&&(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(In,{error:o,reload:g})})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Find`,htmlFor:`br-find`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(W,{id:`br-find`,value:c,placeholder:`password`,onChange:e=>l(e.target.value)})}),!_.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:i.total?`None matches.`:`None yet: ForgeQE's sign-in can see no secret in this vault.`}),(0,$.jsx)(`ul`,{"aria-label":`Secrets in the vault`,className:`m-0 list-none p-0`,children:v.map(e=>{let t=u?.secret===e;return(0,$.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 py-2`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`br-secret`,checked:t,onChange:()=>d({secret:e,name:e.toUpperCase().replace(/[^A-Z0-9_]/g,`_`).replace(/^([^A-Z])/,`S_$1`).slice(0,64),key:``})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e})]}),t&&u&&(0,$.jsxs)(`div`,{className:`mb-4 ml-8 flex flex-col gap-4 rounded-[12px] bg-surface-muted p-4`,children:[(0,$.jsx)(q,{label:`Save as`,help:y?(0,$.jsx)(`span`,{className:`text-fail`,children:y}):n.has(u.name)?`${u.name} is saved already: pulling replaces its value.`:`The variable agents and tests read it by.`,htmlFor:`br-name`,stacked:!0,className:`py-0`,children:(0,$.jsx)(W,{id:`br-name`,value:u.name,spellCheck:!1,maxLength:64,"aria-invalid":!!y,onChange:e=>d({...u,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),(0,$.jsx)(q,{label:`JSON field (optional)`,help:`When the secret holds JSON, the one field to keep, such as password.`,htmlFor:`br-key`,stacked:!0,className:`py-0`,children:(0,$.jsx)(W,{id:`br-key`,value:u.key,spellCheck:!1,maxLength:128,placeholder:`password`,onChange:e=>d({...u,key:e.target.value}),className:`font-mono`})})]})]},e)})}),(_.length>v.length||i.total>i.names.length)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[_.length>v.length?`The first ${v.length} of ${_.length} are shown: find narrows them.`:``,i.total>i.names.length?`The first ${i.names.length.toLocaleString()} of the vault's names are listed.`:``].filter(Boolean).join(` `)})]})]})}function Yo({s:e,onCancel:n,onClose:r}){let[i,a]=(0,Q.useState)(!1),o=e.state===`running`,s=e.link&&/^https:\/\//.test(e.link)?e.link:void 0;return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`mb-4 flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Signing in to `,e.vault]}),(s||e.code)&&o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.code&&(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-4 py-2 font-mono text-lg font-semibold tracking-[0.12em]`,children:e.code}),(0,$.jsxs)(G,{size:`sm`,"aria-label":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(e.code).then(()=>a(!0)),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(t,{"aria-hidden":`true`}),i?`Copied`:`Copy`]})]}),s&&(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer noopener`,className:st({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(he,{"aria-hidden":`true`}),`Open `,new URL(s).host]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:[e.lines.slice(-6).map((t,n)=>(0,$.jsx)(`li`,{className:H(`[overflow-wrap:anywhere]`,n===e.lines.slice(-6).length-1&&e.state===`done`?`text-pass`:n===e.lines.slice(-6).length-1&&e.state===`failed`?`text-fail`:`text-ink-2`),children:t},n)),o&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for you to finish in the browser…`})]}),(0,$.jsx)(`div`,{children:o?(0,$.jsx)(G,{size:`sm`,onClick:n,children:`Cancel`}):(0,$.jsx)(G,{size:`sm`,onClick:r,children:`Close`})})]})}var Xo={testmu:`TestMu AI`,browserstack:`BrowserStack`},Zo={testmu:{provider:`testmu`,remote:{username_env:`LT_USERNAME`,access_key_env:`LT_ACCESS_KEY`}},browserstack:{provider:`browserstack`,remote:{username_env:`BROWSERSTACK_USERNAME`,access_key_env:`BROWSERSTACK_ACCESS_KEY`}}},Qo=(...e)=>e.map(([e,t])=>({value:e,label:t})),$o={testmu:[{key:`type`,label:`Type`,type:`select`,default:`real`,options:Qo([`real`,`Real device`],[`virtual`,`Emulator or simulator`])},{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Qo([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As TestMu AI names it.`,type:`text`,placeholder:`Galaxy S23`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}],browserstack:[{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Qo([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As BrowserStack names it. Real devices only.`,type:`text`,placeholder:`Google Pixel 7`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13.0`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}]},es=`Kept in your credential store; the file has only the variable's name. The same sign-in as its browsers.`,ts={testmu:[{key:`remote.username_env`,label:`TestMu AI user`,help:es,type:`var`,default:`LT_USERNAME`},{key:`remote.access_key_env`,label:`TestMu AI key`,help:es,type:`var`,default:`LT_ACCESS_KEY`},{key:`mobile.region`,label:`Region for devices`,type:`text`,placeholder:`us`}],browserstack:[{key:`remote.username_env`,label:`BrowserStack user`,help:es,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`remote.access_key_env`,label:`BrowserStack key`,help:es,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`}]};function ns(e){return[e.type===`virtual`?e.platform===`ios`?`simulator`:`emulator`:`real device`,`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`,e.model,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}function rs({grids:e,setGrids:t,paths:n,vars:r}){return(0,$.jsx)($.Fragment,{children:[`testmu`,`browserstack`].map(i=>{let a=Xo[i],o={value:e[i]??Zo[i],set:n=>t({...e,[i]:n}),vars:r,file:n[i]};return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(J,{help:(0,$.jsxs)($.Fragment,{children:[`Kept in `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:n[i]}),`, `,a,`'s own file`,e[i]?``:`, made when you add a device`,`. Its browsers and their devices are in the same file:`,` `,(0,$.jsxs)(`a`,{href:be(`settings`,`integrations`),children:[`Integrations → `,a]}),`.`]}),children:`${a} devices`}),(0,$.jsx)(Rt,{edit:o,base:[`mobile`,`devices`],defs:$o[i],noun:`${a} device`,placeholder:i===`testmu`?`galaxy-s23`:`pixel7`,start:i===`testmu`?{type:`real`,platform:`android`}:{platform:`android`},meta:ns}),(0,$.jsx)(X,{defs:ts[i],edit:o,base:[]})]},i)})})}var is=(0,Q.lazy)(()=>it(()=>import(`./Features-XIqYxKc1.js`).then(e=>({default:()=>(0,$.jsx)(e.Features,{embedded:!0})})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),as=(0,Q.lazy)(()=>it(()=>import(`./WhatsNew-Gs-_0But.js`).then(e=>({default:()=>(0,$.jsx)(e.WhatsNew,{embedded:!0})})),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),os=Nn.filter(e=>!kn.includes(e.id)),ss=[...new Set(os.map(e=>e.group))],cs=[`setup`,`environments`,`signins`,`secrets`,`integrations`,`notifications`,`appearance`,`voice`,`models`,`databases`,`features`,`whats-new`,`report`,`about`],ls=`forgeqe-settings-more`,us={config:`forgeqe.yaml`,models:`llms.json`,environments:`the environment files`,guardrails:`guardrails.md`,grids:`the browser grid files`,secrets:`keys and passwords`};function ds(e,t){let n=e.paths.base.replace(/(?<![\\/])[\\/]+$/,``);return t.startsWith(`${n}/`)||t.startsWith(`${n}\\`)?`./${t.slice(n.length+1).replace(/\\/g,`/`)}`:t}function fs(e){return{config:e.config,models:e.models,environments:e.environments,guardrails:e.guardrails.filter(e=>e.editable).map(e=>e.text),grids:{browserstack:e.grids.browserstack.linked?e.grids.browserstack.value:null,testmu:e.grids.testmu.linked?e.grids.testmu.value:null},secrets:{}}}var ps={local:`This computer`,browserstack:`BrowserStack`,testmu:`TestMu AI`};function ms(e){let t=ps[String(e.runs_on??`local`)]??String(e.runs_on),n=e.type===`real`||e.type===void 0&&e.runs_on!==void 0&&e.runs_on!==`local`?`real device`:e.platform===`ios`?`simulator`:`emulator`,r=`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`;return[`${t}, ${n}`,r,e.model||e.udid,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}var hs=[{id:`setup`,label:`Set up`},{id:`models`,label:`Models`},{id:`evidence`,label:`Product knowledge`},{id:`appearance`,label:`Appearance`}],gs=e=>hs.find(t=>t.id===e)?.id??`setup`;function _s({section:e,only:t,guide:n}){let r=n===void 0?void 0:gs(n),i=r??t??e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=(0,Q.useCallback)(()=>{d(``),Je.settings().then(e=>{s(e),l(fs(e))},e=>d(e.message))},[]),C=(0,Q.useCallback)(()=>{d(``),$e.state().then(e=>{x(e),e.ready&&S()},e=>d(e.message))},[S]);(0,Q.useEffect)(C,[C]);let w=e=>{e.project===b?.project&&e.ready||(s(null),l(null)),x(e),e.ready&&S()},T=!!b?.ready,[E,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),F=(0,Q.useCallback)(async()=>{if(!(await $e.state()).ready)return!1;let e=await $e.machine();return e.engine&&e.runtime},[]);(0,Q.useEffect)(()=>{r!==void 0&&Ye.status().then(e=>{D(e.state),A(!0)},()=>A(!0))},[r]),(0,Q.useEffect)(()=>{r!==void 0&&F().then(M,()=>M(!1))},[r,b,F]),(0,Q.useEffect)(()=>P(``),[r]),(0,Q.useEffect)(()=>{if(r!==`setup`||j)return;let e=cn(()=>void F().then(M,()=>{}),2500);return()=>Lt(e)},[r,j,F]);let L=async(e,t)=>{P(``);try{if(e===`done`){await Ye.save({done:!0,step:`done`,...t?{skip:t}:{}}),location.hash=be();return}let n=await Ye.save({step:e,...t?{skip:t}:{}});D(n.state),location.hash=be(`welcome`,e)}catch(e){P(e.message)}},te=async()=>{if(await F().catch(()=>!1))return L(`done`);r!==`setup`&&(location.hash=be(`welcome`,`setup`)),P(`Set up is the one step that cannot be skipped: ForgeQE needs it to run. Once it is done, you can leave onboarding.`)};(0,Q.useEffect)(()=>{r===void 0?b&&!T&&i!==`setup`?location.replace(be(`settings`,`setup`)):!t&&i&&kn.includes(i)&&location.replace(be(i)):r!==`setup`&&b&&!T&&location.replace(be(`welcome`,`setup`))},[b,T,i]);let R=(b&&!T?Nn[0]:Nn.find(e=>e.id===(i===`repo-tokens`?`secrets`:i)))||Nn.find(e=>e.id===`models`),[ne,re]=(0,Q.useState)(()=>{try{return localStorage.getItem(ls)===`open`}catch{return!1}}),ie=e=>{re(e);try{localStorage.setItem(ls,e?`open`:`closed`)}catch{}};(0,Q.useEffect)(()=>{h(``),p(``),y(!1)},[R.id]);let ae=o?fs(o):null,oe=e=>!!c&&!!ae&&!an(c[e],ae[e]),se=Object.keys(us).filter(oe);(0,Q.useEffect)(()=>{if(!se.length)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[se.length]);let z=e=>({value:c[e],set:t=>{h(``),l(n=>({...n,[e]:t}))},vars:o.variables,...e===`config`?{file:`forgeqe.yaml`}:{}}),le=(0,Q.useRef)(c);le.current=c;let ue=(0,Q.useRef)(o);ue.current=o;let[de,fe]=(0,Q.useState)(``),pe=(0,Q.useRef)({}),he=(0,Q.useCallback)((e,t)=>{let n=pe.current,r=Object.keys(n).find(t=>n[t]===e)??e;r===t?delete n[r]:n[r]=t},[]),ge=(0,Q.useCallback)(async()=>{let e=le.current,t=ue.current;if(!e||!t)return;let n=fs(t),r=Object.keys(us).filter(t=>!an(e[t],n[t]));if(!r.length)return;_(!0),p(``),y(!1);let i=t,a=(t,n)=>l(r=>{if(!r)return r;let i=fs(t),a={...r};for(let t of Object.keys(us))if(t===`secrets`){if(!n)continue;a.secrets=Object.fromEntries(Object.entries(r.secrets).filter(([t,n])=>e.secrets[t]!==n))}else(n?an(r[t],e[t]):an(r[t],i[t]))&&(a[t]=i[t]);return a});try{for(let a of r)if(a===`secrets`)i=await Je.saveSecrets(e.secrets);else if(a===`grids`)for(let[r,a]of Object.entries(e.grids))a&&!an(a,n.grids[r])&&(i=await Je.saveGrid(r,a,t.versions[`grid:${r}`]));else if(a===`models`){let r=n.models.models,o=e.models.models,s=Object.fromEntries(Object.entries(pe.current).filter(([e,t])=>r&&o&&e in r&&!(e in o)&&t in o));i=await Je.save(a,e[a],t.versions[a],s),pe.current={}}else i=a===`guardrails`?await Je.saveGuardrails(e.guardrails,t.versions.guardrails):await Je.save(a,e[a],t.versions[a]);s(i),a(i,!0),fe(``),h(`Saved`)}catch(n){p(n.message),y(n instanceof Ge&&n.status===409),fe(JSON.stringify(e)),i!==t&&(s(i),a(i,!1))}finally{_(!1)}},[]);(0,Q.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(``),4e3);return()=>clearTimeout(e)},[m]);let _e=c?JSON.stringify(c):``;(0,Q.useEffect)(()=>{if(!se.length||g||v||de&&de===_e)return;let e=se.every(e=>e===`secrets`),t=setTimeout(ge,e?2e3:1e3);return()=>clearTimeout(t)},[_e,g,v,de]);let ve=async()=>{p(``);try{let e=await Je.splitEnvironments();s(e),l(fs(e)),h(`Each environment is now its own file in environments/. The old file is left as it is; ForgeQE no longer reads it.`)}catch(e){p(e.message)}},ye=async(e,t,n)=>{p(``);try{let r=await Je.saveText(e,t,n,o?.versions[e]);return s(r),l(fs(r)),h(`Saved ${us[e]}.`),!0}catch(e){return p(e.message),!1}},B=null;if(R.id===`setup`)B=b&&(0,$.jsx)(fa,{state:b,onState:w,guide:r!==void 0});else if(o&&c){let e=(R.id===`models`||R.id===`routing`?[`models`,`config`]:R.id===`environments`?[`environments`,`config`]:[`files`,`guardrails`,`prompts`,`logs`,`audit`,`generated`,`about`,`report`,`features`,`whats-new`].includes(R.id)?[]:[`config`]).find(e=>o.errors[e]);switch(R.id){case`models`:B=(0,$.jsx)(ci,{config:z(`config`),models:z(`models`),vars:o.variables,onReload:S,onRename:he});break;case`environments`:B=(0,$.jsx)(Hr,{envs:z(`environments`),layout:o.paths.environments,files:o.raw.environments,base:o.paths.base,onSplit:ve,config:z(`config`),splitBlocked:oe(`environments`)||oe(`config`)?`Save or discard your changes to the environments and forgeqe.yaml first.`:``});break;case`browser`:B=(0,$.jsx)(Bn,{groups:qn,edit:z(`config`)});break;case`appearance`:B=(0,$.jsx)(lo,{config:z(`config`)});break;case`voice`:B=(0,$.jsx)(ho,{});break;case`routing`:B=(0,$.jsx)(mi,{config:z(`config`),models:z(`models`)});break;case`generated`:B=(0,$.jsx)(Oa,{});break;case`about`:B=(0,$.jsx)(Ta,{});break;case`features`:case`whats-new`:B=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Opening…`}),children:R.id===`features`?(0,$.jsx)(is,{}):(0,$.jsx)(as,{})});break;case`report`:B=(0,$.jsx)(Fa,{});break;case`notifications`:case`mcp`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ji,{view:R.id,edit:z(`config`),grids:c.grids,setGrids:e=>l(t=>({...t,grids:e})),gridPaths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)}}),R.id===`notifications`&&(0,$.jsx)(Ea,{})]});break;case`parallel`:B=(0,$.jsx)(Bn,{groups:Jn,edit:z(`config`)});break;case`mobile`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Kn,edit:z(`config`)}),(0,$.jsx)(J,{help:`Phones, tablets, emulators and simulators connected to this computer. Every device in use, here and on the clouds below, runs each replay and set of Maestro flows; ForgeQE sets up Appium, Maestro and the cloud for each.`,children:`Devices on this computer`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`mobile`,`devices`],defs:Xn,noun:`device`,placeholder:`pixel8`,start:{type:`virtual`,platform:`android`},meta:ms}),(0,$.jsx)(rs,{grids:c.grids,setGrids:e=>{h(``),l(t=>({...t,grids:e}))},paths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)},vars:o.variables}),(0,$.jsx)(Bn,{groups:ur,edit:z(`config`),continued:!0})]});break;case`desktop`:B=(0,$.jsx)(Bn,{groups:lr,edit:z(`config`)});break;case`containers`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Yn.slice(0,1),edit:z(`config`)}),(0,$.jsx)(J,{help:`Each one ForgeQE may start, stop and read: a database, a queue, the API under test.`,children:`Services`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`containers`,`services`],defs:dr,noun:`service`,placeholder:`db`,meta:e=>[e.image,Array.isArray(e.ports)?`ports ${e.ports.join(`, `)}`:``].filter(Boolean).map(String).join(`, `)}),(0,$.jsx)(Bn,{groups:Yn.slice(1),edit:z(`config`),continued:!0})]});break;case`databases`:B=(0,$.jsx)(Rt,{edit:z(`config`),base:[`databases`],defs:tr,noun:`database`,placeholder:`orders`,meta:e=>[e.description,e.engine,e.url_env?`from ${e.url_env}`:e.host,e.writable?`writable`:`read only`].filter(Boolean).map(String).join(`, `)});break;case`signins`:B=(0,$.jsx)(Rn,{edit:z(`config`)});break;case`secrets`:B=(0,$.jsx)(Go,{show:i===`repo-tokens`?`tokens`:void 0});break;case`integrations`:B=(0,$.jsx)(ji,{edit:z(`config`),grids:c.grids,setGrids:e=>{h(``),l(t=>({...t,grids:e}))},gridPaths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)}});break;case`tests`:B=(0,$.jsx)(Bn,{groups:sr,edit:z(`config`)});break;case`runs`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Wn,edit:z(`config`)}),(0,$.jsx)(Bn,{groups:or,edit:z(`config`),continued:!0}),(0,$.jsx)(J,{help:`Each one a table of the project report: forgeqe.<name>.`,children:`Report datasets`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`bi`,`datasets`],defs:er,noun:`dataset`,placeholder:`open_bugs`,meta:e=>[e.title,e.kind===`jira_jql`?`Jira`:e.kind===`ado_wiql`?`Azure DevOps`:``].filter(Boolean).map(String).join(`, `)})]});break;case`quality`:B=(0,$.jsx)(Bn,{groups:fr,edit:z(`config`)});break;case`evidence`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Do,{edit:z(`config`)}),(0,$.jsx)(Da,{})]});break;case`agents`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:rr,edit:z(`config`)}),(0,$.jsx)(Ia,{config:z(`config`)})]});break;case`guardrails`:B=(0,$.jsx)(Vi,{rules:c.guardrails,others:o.guardrails.filter(e=>!e.editable),onChange:e=>l({...c,guardrails:e}),onChanged:e=>(h(e),Je.settings().then(s,()=>{}))});break;case`monitor`:B=(0,$.jsx)(Ri,{edit:z(`config`)});break;case`skills`:B=(0,$.jsx)(Tr,{edit:z(`config`)});break;case`prompts`:B=(0,$.jsx)(Sr,{onChanged:h});break;case`registry`:B=(0,$.jsx)(bn,{edit:z(`config`)});break;case`logs`:B=(0,$.jsx)(vn,{});break;case`audit`:B=(0,$.jsx)(Mn,{});break;case`tokenomics`:B=(0,$.jsx)(Cn,{edit:z(`config`)});break;case`files`:B=(0,$.jsx)(mn,{snap:o,dirty:{config:oe(`config`),models:oe(`models`),environments:oe(`environments`)},onSave:ye})}e&&(B=(0,$.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail`,children:[e===`environments`?`An environment file`:us[e],` does not parse, so the form cannot show it: `,o.errors[e],`. Fix it in `,(0,$.jsx)(`a`,{href:be(`settings`,`files`),children:`Settings as text`}),`.`]}))}let xe=f?(0,$.jsxs)(`div`,{role:`alert`,className:`flex w-full flex-wrap items-center gap-4 rounded-[14px] border border-fail-soft bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail shadow-composer`,children:[(0,$.jsx)(`span`,{className:`flex-[1_1_260px] [overflow-wrap:anywhere]`,children:f}),v?(0,$.jsxs)(G,{size:`sm`,onClick:()=>{y(!1),p(``),fe(``),C()},"data-tip":`Reload, and lose my unsaved changes`,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Reload`]}):(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[se.length>0&&(0,$.jsxs)(G,{size:`sm`,onClick:()=>{l(ae),pe.current={},p(``),fe(``)},"data-tip":`Undo my change`,children:[(0,$.jsx)(I,{"aria-hidden":`true`}),`Undo`]}),(0,$.jsxs)(G,{size:`sm`,onClick:()=>{p(``),fe(``),ge()},children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Retry`]})]})]}):null,Se={pending:c?.secrets||{},set:(e,t)=>{h(``),l(n=>{let r={...n.secrets};return t===void 0?delete r[e]:r[e]=t,{...n,secrets:r}})},saved:new Set(o?.saved||[]),vars:o?.variables||{},store:o?.store||`the credential store`};return(0,$.jsx)(It.Provider,{value:Se,children:(0,$.jsxs)(`div`,{className:`settings-fields flex min-h-(--screen) flex-col`,children:[(0,$.jsx)(qt,{}),(0,$.jsxs)(`main`,{className:H(`box-border flex w-full flex-auto flex-col items-stretch sm:flex-row sm:items-start`,t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[(0,$.jsx)(`div`,{className:H(`theme-side theme-side--wide w-full flex-col gap-4 border-line px-4 pt-6 pb-4 sm:sticky sm:top-0 sm:h-(--screen) sm:w-[248px] sm:flex-none sm:overflow-y-auto sm:border-r sm:bg-surface-muted`,t?`hidden`:`flex`),children:r===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`a`,{href:be(),className:`inline-flex min-h-9 items-center gap-2 self-start rounded-[8px] px-2 text-[13px] font-medium text-ink-2 no-underline hover:bg-surface-strong hover:text-ink`,children:[(0,$.jsx)(me,{size:16,"aria-hidden":`true`}),`Back`]}),(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Settings`}),(0,$.jsx)(Ss,{ready:T}),(0,$.jsx)(`label`,{htmlFor:`section-pick`,className:`sr-only`,children:`Section`}),(0,$.jsx)(U,{id:`section-pick`,value:R.id,onChange:e=>location.hash=be(`settings`,e.target.value),className:`sm:hidden`,children:ss.map(e=>(0,$.jsx)(`optgroup`,{label:e,children:os.filter(t=>t.group===e).map(e=>(0,$.jsx)(`option`,{value:e.id,disabled:!T&&e.id!==`setup`,children:e.label},e.id))},e))}),(0,$.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`hidden flex-col gap-4 sm:flex`,children:[(0,$.jsx)(bs,{sections:os.filter(e=>cs.includes(e.id)),current:R.id,locked:!!b&&!T}),(0,$.jsx)(xs,{open:ne||!cs.includes(R.id),onToggle:()=>ie(!ne),children:(0,$.jsx)(bs,{sections:os.filter(e=>!cs.includes(e.id)),current:R.id,locked:!!b&&!T})})]})]}):(0,$.jsx)(ys,{step:r,skipped:E?.skipped??[],open:j,onSkip:()=>void te()})}),(0,$.jsxs)(`section`,{"aria-labelledby":`sec-h`,className:H(`flex min-w-0 flex-1 flex-col`,!t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[t?(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-4`,children:[(0,$.jsx)(Bt,{icon:R.icon,pixel:_t[R.id],size:`lg`}),(0,$.jsx)(`h1`,{id:`sec-h`,className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:R.label})]}):(0,$.jsxs)(`h1`,{id:`sec-h`,className:`m-0 mb-2 flex items-center gap-4 text-[25px] leading-tight font-semibold tracking-[-0.01em]`,children:[(0,$.jsx)(lt,{icon:R.icon,size:22,className:`flex-none text-muted`}),R.label]}),(0,$.jsxs)(`p`,{className:`mt-0 mb-10 text-[13px] leading-relaxed text-ink-2`,children:[R.intro,R.file&&o&&(0,$.jsxs)($.Fragment,{children:[` `,`Saved in `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:R.file}),`.`]})]}),u&&(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-4 border-t border-line pt-6`,children:[(0,$.jsx)(`p`,{className:`m-0 leading-relaxed text-ink-2`,children:u}),(0,$.jsxs)(G,{size:`sm`,onClick:C,children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Retry`]})]}),b&&!T&&(0,$.jsxs)(`p`,{className:`mt-0 mb-6 flex items-start gap-2 rounded-[12px] bg-surface-muted px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[(0,$.jsx)(ce,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`The other sections open once ForgeQE is set up in a project folder: choose the folder, then Set up.`]}),!u&&(!b||R.id!==`setup`&&!o)&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading settings…`}),(0,$.jsx)(`div`,{"data-tour":`section`,className:`flex flex-col`,children:B}),r!==void 0&&b&&O&&(0,$.jsx)(ia,{welcome:E===null||ta(),onStart:vs,step:r,ready:T,coreReady:j,onGo:(e,t)=>void L(e,t),onSkipAll:()=>void te(),onFinish:()=>void L(`done`),note:N},r),(0,$.jsxs)(`div`,{className:`sticky bottom-4 z-10 mt-8 flex flex-col items-end gap-2`,children:[xe,(0,$.jsx)(`div`,{"aria-live":`polite`,className:`contents`,children:!f&&(se.length>0||g||m)&&(0,$.jsx)(`span`,{className:H(`inline-flex min-h-9 items-center gap-2 rounded-full border border-line bg-bg px-4 text-[13px] shadow-composer`,se.length||g?`text-ink-2`:`text-pass`),children:se.length||g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ot,{state:`working`,px:16}),`Saving…`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{size:14,"aria-hidden":`true`}),m]})})})]})]})]})]})})}var vs=()=>{na(),Ye.save({step:`setup`}).catch(()=>{})};function ys({step:e,skipped:t,open:n,onSkip:r}){let i=hs.findIndex(t=>t.id===e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Getting started`}),(0,$.jsx)(`p`,{className:`m-0 px-2 text-[13px] leading-relaxed text-ink-2`,children:`A few steps to start. Everything but Set up can be skipped and changed later in Settings.`}),(0,$.jsx)(`nav`,{"aria-label":`Onboarding steps`,children:(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:hs.map((r,a)=>{let o=Nn.find(e=>e.id===r.id),s=a>0&&!n,c=r.id===e,l=a<i&&!t.includes(r.id);return(0,$.jsx)(`li`,{children:s?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`After Set up`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(lt,{icon:o.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),(0,$.jsx)(ce,{size:13,"aria-label":`Locked`,className:`flex-none`})]}):(0,$.jsxs)(`a`,{href:be(`welcome`,r.id),"aria-current":c?`step`:void 0,className:H(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,c?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(lt,{icon:o.icon,size:16,className:H(`flex-none`,c?`text-ink`:`text-muted group-hover:text-ink`)}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),l&&(0,$.jsx)(k,{size:13,"aria-label":`Done`,className:`flex-none text-pass`}),t.includes(r.id)&&!c&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Skipped`})]})},r.id)})})}),(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start rounded-[7px] border-0 bg-transparent px-2 text-[13px] text-ink-2 hover:bg-surface-strong hover:text-ink`,children:[(0,$.jsx)(N,{size:14,"aria-hidden":`true`}),`Skip onboarding`]})]})}function bs({sections:e,current:t,locked:n}){let r=[...new Set(e.map(e=>e.group))];return(0,$.jsx)($.Fragment,{children:r.map(r=>{let i=`group-${r}-${e[0]?.id}`;return(0,$.jsxs)(`div`,{role:`group`,"aria-labelledby":i,className:`flex flex-col gap-px`,children:[(0,$.jsx)(`span`,{id:i,className:`px-2 pt-1 pb-1 text-[13px] font-medium text-muted`,children:r}),e.filter(e=>e.group===r).map(e=>n&&e.id!==`setup`?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`Set up ForgeQE in a project folder first`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(lt,{icon:e.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,$.jsx)(ce,{size:13,"aria-label":`Locked`,className:`flex-none`})]},e.id):(0,$.jsxs)(`a`,{href:be(`settings`,e.id),"aria-current":t===e.id?`page`:void 0,className:H(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,t===e.id?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(lt,{icon:e.icon,size:16,className:H(`flex-none`,t===e.id?`text-ink`:`text-muted group-hover:text-ink`)}),e.label]},e.id))]},r)})})}function xs({open:e,onToggle:t,children:n}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":`settings-more`,onClick:t,className:`flex h-7 cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] font-medium text-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:`More settings`}),(0,$.jsx)(E,{size:14,strokeWidth:2,"aria-hidden":`true`,className:H(`flex-none transition-transform duration-200`,e&&`rotate-90`)})]}),(0,$.jsx)(Un,{open:e,id:`settings-more`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})})]})}function Ss({ready:e}){let[t,n]=(0,Q.useState)(``),r=t.toLowerCase().split(/\s+/).filter(Boolean),i=e=>Nn.find(t=>t.id===e)?.label||e,a=r.length?cr.filter(e=>r.every(t=>`${e.label} ${e.key} ${i(e.section)}`.toLowerCase().includes(t))).slice(0,12):[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`label`,{htmlFor:`find-setting`,className:`sr-only`,children:`Find a setting`}),(0,$.jsx)(W,{size:`sm`,id:`find-setting`,type:`search`,value:t,disabled:!e,placeholder:`Search settings`,className:`bg-bg`,"data-tip":`By its name or its forgeqe.yaml key: max attempts, memory.dir`,onChange:e=>n(e.target.value)}),r.length>0&&(0,$.jsxs)(`ul`,{"aria-label":`Settings found`,className:`m-0 flex list-none flex-col p-0`,children:[a.length===0&&(0,$.jsx)(`li`,{className:`px-2 py-2 text-[13px] text-muted`,children:`Nothing called that. Every key can also be edited in Settings as text.`}),a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`a`,{href:be(`settings`,e.section),onClick:()=>n(``),className:`flex flex-col rounded-[10px] px-2 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`text-sm`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i(e.section),` · `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e.key})]})]})},`${e.section}:${e.key}`))]})]})}export{cs as COMMON_SECTIONS,hs as GUIDE_STEPS,Nn as SECTIONS,kn as SIDEBAR_SECTIONS,_s as Settings};
|
|
21
|
+
`):`Starting…`})]}),n&&(0,$.jsx)(uo,{ok:!1,children:n}),d?.ready&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Voice`,help:`An open voice that runs on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Ready`})}),(0,$.jsx)(q,{label:`Listening`,help:`Writes down what you say, on this computer.`,children:(0,$.jsx)(`span`,{className:`text-sm text-ink-2`,children:d.hearing?.model??`None`})})]}),(0,$.jsx)(J,{help:`How Talk takes turns with you. Yours alone: kept in this browser.`,children:`Conversation`}),(0,$.jsx)(q,{label:`It waits for you`,help:i===`eager`?`Answers soon after you pause: quick, but it may cut in.`:i===`patient`?`Waits longer when you pause mid-thought.`:`Waits a moment when you sound unfinished.`,children:(0,$.jsx)(fo,{label:`How long it waits for you`,value:i,options:po,onPick:e=>(a(e),Ft(e))})})]})}var go=[{id:`github`,name:`GitHub`,note:`github.com, or GitHub Enterprise at your own address.`,logo:An.github,tokenEnv:`GITHUB_TOKEN`,cloud:!0,cli:{system:`github`,label:`GitHub`}},{id:`azure-devops`,name:`Azure DevOps`,note:`An organization on dev.azure.com, or Azure DevOps Server.`,logo:An.azure_devops,tokenEnv:`ADO_PAT`,cloud:!0,org:`Organization`,cli:{system:`azure_devops`,label:`Azure DevOps`}},{id:`gitlab`,name:`GitLab`,note:`gitlab.com, or GitLab at your own address.`,logo:An.gitlab,tokenEnv:`GITLAB_TOKEN`,cloud:!0},{id:`bitbucket-cloud`,name:`Bitbucket Cloud`,note:`bitbucket.org: a workspace's repositories, or every one you can read.`,logo:An.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!0,org:`Workspace`},{id:`bitbucket-server`,name:`Bitbucket Data Center`,note:`Bitbucket Server or Data Center at your own address.`,logo:An.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!1}],_o=e=>go.find(t=>t.id===e),vo=/^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;function yo(e,t){let n=!t.url||bo(e?.id,String(t.url)).cloud;return e?.id===`github`?n?`cli`:`gh-host`:e?.id===`azure-devops`&&n?`cli`:`git`}function bo(e,t){let n;try{n=new URL(t.trim())}catch{return{cloud:!1}}let r=n.hostname.toLowerCase(),i=_e(n.pathname).split(`/`).filter(Boolean)[0],a=i&&/^[A-Za-z0-9][A-Za-z0-9 ._-]{0,99}$/.test(i)?i:void 0;if(e===`azure-devops`){if(r===`dev.azure.com`)return{cloud:!0,org:a};let e=/^([a-z0-9][a-z0-9-]{0,62})\.visualstudio\.com$/.exec(r);return e?{cloud:!0,org:e[1]}:{cloud:!1}}return e===`bitbucket-cloud`?r===`bitbucket.org`?{cloud:!0,org:a}:{cloud:!1}:e===`github`?{cloud:r===`github.com`}:e===`gitlab`?{cloud:r===`gitlab.com`}:{cloud:!1}}function xo({logo:e,icon:t,title:n,meta:r,state:i,actions:a}){return(0,$.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,$.jsx)(Bt,{icon:t,logo:e}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:n}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:r}),i]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:a})]})}function So({ok:e,message:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:H(`mt-2 mb-1 flex items-start gap-2 rounded-[12px] px-4 py-2 text-sm`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(y,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(g,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function Co({title:e,help:t}){return(0,$.jsxs)(`div`,{className:`mt-8 mb-2 flex flex-col gap-1`,children:[(0,$.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),t&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:t})]})}var wo=({children:e})=>(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:e}),To=e=>Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`));function Eo(e,t,n){let r=Y(Z(e,[`product`,`repos`])),i=e;for(let[e,a]of Object.entries(r))Y(a).account===t&&(i=K(i,[`product`,`repos`,e,`account`],n));return i}function Do({edit:e}){let t=e.value,n=Y(Z(t,[`product`,`accounts`])),r=Y(Z(t,[`product`,`repos`])),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)({}),d=(0,Q.useCallback)(()=>{Ke.get().then(e=>u(e.saved),()=>{})},[]);(0,Q.useEffect)(d,[d]);let f=$t(),p=e=>Object.values(r).filter(t=>Y(t).account===e).length,m=(e,t)=>{let n=_o(t.host),r=p(e),i=`${r} ${r===1?`repository`:`repositories`} connected`;if(t.auth===`token`)return Tn(f,String(t.token_env||``))?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected with a token, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs its token: Edit to add it`});let a=yo(n,t),o=l[n.cli.system];return a===`cli`?o&&(o.via!==`token`||o.browser)&&hi(o,n.name)?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in, ${i}`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Needs a sign-in: Edit to sign in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`${a===`gh-host`?`The GitHub CLI's`:`Git Credential Manager's`} sign-in, ${i}`})};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{first:!0,help:`Sign in to where your code is, then pick the repositories ForgeQE reads into the product graph.`,children:`1. Repositories`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:Object.keys(n).length?`Your accounts. Pick more repositories from one with Repositories.`:`No account yet: add GitHub, Azure DevOps, GitLab or Bitbucket.`}),(0,$.jsxs)(G,{size:`sm`,"data-tip":`Add an account`,onClick:()=>o({step:`catalog`}),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add`]})]}),Object.entries(n).map(([n,r])=>{let a=Y(r),s=_o(a.host);return(0,$.jsx)(xo,{logo:s?.logo,icon:pe,title:n,meta:[s?.name||`Unknown host`,a.org,a.url].filter(Boolean).map(String).join(`, `),state:m(n,a),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Repositories of ${n}`,"data-tip":`Repositories of ${n}`,disabled:!s,onClick:()=>c(n),children:(0,$.jsx)(i,{"aria-hidden":`true`})}),s&&(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${n}`,"data-tip":`Edit ${n}`,onClick:()=>o({step:`form`,host:s,mode:`edit`,name:n,from:n,value:a}),children:(0,$.jsx)(O,{"aria-hidden":`true`})}),(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${n}`,"data-tip":`Disconnect ${n}`,onClick:()=>e.set(Eo(K(t,[`product`,`accounts`,n],void 0),n,void 0)),children:(0,$.jsx)(w,{"aria-hidden":`true`})})]})},n)}),(0,$.jsx)(Co,{title:`Connected repositories`,help:`Each one a repository the graph reads: connected from an account, or a local clone or a link added by hand.`}),(0,$.jsx)(Rt,{edit:e,base:[`product`,`repos`],defs:Gn,noun:`repository by hand`,placeholder:`web`,meta:e=>typeof e.git==`string`&&e.git?`${e.git}${typeof e.branch==`string`&&e.branch?` (${e.branch})`:``}${typeof e.account==`string`?`, from ${e.account}`:``}`:typeof e.path==`string`?e.path:``}),(0,$.jsx)(No,{edit:e}),(0,$.jsx)(Io,{edit:e}),(0,$.jsx)(J,{help:nr[0].help,children:`4. The product and its knowledge`}),(0,$.jsx)(X,{defs:nr[0].fields,edit:e,base:nr[0].base}),nr.slice(1).map(t=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Co,{title:t.title,help:t.help}),(0,$.jsx)(X,{defs:t.fields,edit:e,base:t.base})]},t.title)),(0,$.jsx)(J,{help:ar[0].help,children:`5. ${ar[0].title}`}),(0,$.jsx)(X,{defs:ar[0].fields,edit:e,base:ar[0].base}),(0,$.jsx)(Oo,{sheet:a,setSheet:o,taken:e=>e in n,onSigned:d,onApply:n=>{let r=t;n.mode===`edit`&&n.from!==n.name&&(r=Eo(K(r,[`product`,`accounts`,n.from],void 0),n.from,n.name)),e.set(K(r,[`product`,`accounts`,n.name],n.value)),o(null),n.mode===`add`&&c(n.name)}}),(0,$.jsx)(ko,{id:s,account:s?Y(n[s]):{},repos:r,onClose:()=>c(null),onConnect:n=>e.set(K(t,[`product`,`repos`],{...r,...n}))})]})}function Oo({sheet:e,setSheet:t,taken:n,onApply:r,onSigned:i}){let a=$t(),[o,s]=(0,Q.useState)({busy:!1}),c=e?.step===`form`?`${e.host.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>s({busy:!1}),[c]);let l=()=>t(null);if(e?.step===`form`){let c=e,u=c.value,d=e=>t({...c,value:e}),f=c.name?vo.test(c.name)?c.name!==c.from&&n(c.name)?`Another account has this name.`:``:`Letters, digits, - and _.`:``,p=!u.url||bo(c.host.id,String(u.url)).cloud,m=c.host.id===`azure-devops`&&p&&!(u.url&&bo(c.host.id,String(u.url)).org),h=(()=>{let e=String(u.url||``).trim();if(!e)return``;try{let t=new URL(e);return t.protocol===`https:`?t.username||t.password?`No user name or password in the address: the token goes in its own field.`:``:`The address is https.`}catch{return`That is not an address.`}})(),g=!!c.name&&!f&&!h&&(c.host.cloud||!!String(u.url||``).trim())&&(!m||!!String(u.org||``).trim())&&(u.auth!==`token`||!!String(u.token_env||``).trim()),_=yo(c.host,u),v=async e=>{s({busy:!0});try{if(e===`signin`){let e=await tt.signIn(c.name||`account`,u);s({busy:!1,ok:e.ok,message:e.message})}else{let e=await tt.repos(c.name||`account`,u,To(a.pending),[]);s({busy:!1,ok:e.ok,message:e.ok?`Signed in: ${e.repos.length} ${e.repos.length===1?`repository`:`repositories`} to pick from${e.truncated?` (the first ones)`:``}.`:e.message})}}catch(e){s({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(Jt,{open:!0,onClose:l,title:c.mode===`add`?`Connect ${c.host.name}`:`Edit ${c.name}`,description:`Then pick its repositories. A token you type is kept in ${Qt(a.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[c.mode===`add`&&(0,$.jsxs)(G,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(me,{"aria-hidden":`true`}),`Back`]}),(0,$.jsxs)(G,{onClick:()=>v(`list`),disabled:o.busy||!g,className:`mr-auto`,"data-tip":`Test the connection`,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),o.busy?`Testing…`:`Test`]}),(0,$.jsxs)(G,{onClick:l,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:!g,onClick:()=>r(c),children:[c.mode===`add`?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(k,{"aria-hidden":`true`}),c.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(Bt,{logo:c.host.logo,icon:pe,size:`lg`}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:c.host.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:o.message&&(0,$.jsx)(So,{ok:!!o.ok,message:o.message})}),(0,$.jsx)(q,{label:`Name`,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):`A short name for the account, such as work.`,htmlFor:`acct-name`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-name`,value:c.name,spellCheck:!1,"aria-invalid":!!f,placeholder:`work`,onChange:e=>t({...c,name:e.target.value.trim()})})}),(0,$.jsx)(q,{label:c.host.cloud?`Address of your own server`:`Address`,help:h?(0,$.jsx)(`span`,{className:`text-fail`,children:h}):c.host.cloud?`Empty: ${c.host.name}'s cloud.`:`https, the server's address.`,htmlFor:`acct-url`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-url`,"aria-invalid":!!h,value:String(u.url||``),spellCheck:!1,placeholder:c.host.cloud?``:`https://bitbucket.acme.example`,onChange:e=>d(K(u,[`url`],e.target.value.trim()||void 0))})}),c.host.org&&(0,$.jsx)(q,{label:c.host.org,help:m?`Its name, as in dev.azure.com/<organization>.`:`Empty: every repository you can read.`,htmlFor:`acct-org`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-org`,value:String(u.org||``),spellCheck:!1,placeholder:`acme`,onChange:e=>d(K(u,[`org`],e.target.value.trim()||void 0))})}),(0,$.jsxs)(`fieldset`,{className:`m-0 border-0 p-0 py-4`,children:[(0,$.jsx)(`legend`,{className:`mb-2 font-medium`,children:`Sign in`}),[[`browser`,_===`git`?`In the browser, with Git Credential Manager`:c.host.id===`github`?`In the browser, with the GitHub CLI`:`In the browser, with Microsoft (the Azure CLI)`],[`token`,`With a personal access token`]].map(([e,t])=>(0,$.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-4 text-sm`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`acct-auth`,checked:u.auth===`token`==(e===`token`),onChange:()=>d(e===`token`?{...u,auth:`token`,token_env:u.token_env||c.host.tokenEnv}:{...u,auth:`browser`,token_env:void 0,user:void 0})}),t]},e))]}),u.auth===`token`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Token`,help:`Read access to the repositories (code: read).`,htmlFor:`account-token`,stacked:!0,children:(0,$.jsx)(tn,{id:`account-token`,name:String(u.token_env||c.host.tokenEnv),field:`token`,onRename:e=>d({...u,token_env:e})})}),(c.host.id===`bitbucket-cloud`||c.host.id===`bitbucket-server`)&&(0,$.jsx)(q,{label:`User name for the token`,help:`With a Bitbucket app password. Empty: an access token.`,htmlFor:`acct-user`,stacked:!0,children:(0,$.jsx)(W,{id:`acct-user`,value:String(u.user||``),spellCheck:!1,onChange:e=>d(K(u,[`user`],e.target.value.trim()||void 0))})})]}):_===`cli`?(0,$.jsx)(gi,{system:c.host.cli.system,label:c.host.cli.label,keyless:!0,onChanged:i}):_===`gh-host`?(0,$.jsx)(q,{label:`Sign in with the GitHub CLI`,help:`In a terminal: gh auth login --web --hostname ${(()=>{try{return new URL(String(u.url)).hostname}catch{return`<your server>`}})()}. Then Test.`,stacked:!0}):(0,$.jsx)(q,{label:`Sign in with the browser`,help:`Git Credential Manager opens the sign-in on this computer and keeps it for git, which fetches the repositories with it.`,stacked:!0,children:(0,$.jsxs)(G,{onClick:()=>v(`signin`),disabled:o.busy||!g,"data-tip":`Sign in with the browser`,children:[(0,$.jsx)(R,{"aria-hidden":`true`}),o.busy?`Signing in…`:`Sign in`]})})]})}return(0,$.jsx)(Jt,{open:e?.step===`catalog`,onClose:l,title:`Add an account`,description:`Pick where your code is.`,footer:(0,$.jsxs)(G,{onClick:l,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsx)(`div`,{className:`pt-4`,children:go.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({step:`form`,host:e,mode:`add`,name:``,from:``,value:{host:e.id,auth:`browser`}}),className:`flex min-h-14 w-full cursor-pointer items-center gap-4 rounded-[12px] border-0 bg-transparent px-2 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,$.jsx)(Bt,{logo:e.logo,icon:pe}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:`text-[13px] text-accent-fg`,children:`Add`})]},e.id))})})}function ko({id:e,account:t,repos:n,onClose:r,onConnect:i}){let a=$t(),[o,s]=(0,Q.useState)({busy:!1}),[c,l]=(0,Q.useState)(new Set),[u,d]=(0,Q.useState)(``),f=(0,Q.useMemo)(()=>new Set(Object.values(n).map(e=>String(Y(e).git||``))),[n]);(0,Q.useEffect)(()=>{e&&(l(new Set),d(``),s({busy:!0}),tt.repos(e,t,To(a.pending),Object.keys(n)).then(e=>s(e.ok?{busy:!1,repos:e.repos,truncated:e.truncated,skipped:e.skipped}:{busy:!1,message:e.message}),e=>s({busy:!1,message:e.message})))},[e]);let p=(o.repos||[]).filter(e=>!u||e.fullName.toLowerCase().includes(u.toLowerCase()));return(0,$.jsxs)(Jt,{open:!!e,onClose:r,wide:!0,title:`Repositories of ${e||``}`,description:`Pick the ones ForgeQE reads into the product graph. They are fetched into ForgeQE's own cache, never your workspace.`,footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mr-auto text-sm text-muted`,children:c.size?`${c.size} picked`:``}),(0,$.jsxs)(G,{onClick:r,children:[(0,$.jsx)(N,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(G,{variant:`primary`,disabled:!c.size,onClick:()=>{let e={};for(let t of o.repos||[])c.has(t.git)&&(e[t.key]=t.entry);i(e),r()},"data-tip":c.size>1?`Connect ${c.size} repositories`:void 0,children:[(0,$.jsx)(b,{"aria-hidden":`true`}),c.size>1?`Connect (${c.size})`:`Connect`]})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[o.busy&&(0,$.jsx)(wo,{children:`Reading the account's repositories…`}),o.message&&(0,$.jsx)(So,{ok:!1,message:o.message})]}),o.repos&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Find`,htmlFor:`repo-find`,stacked:!0,children:(0,$.jsx)(W,{id:`repo-find`,value:u,placeholder:`shop`,onChange:e=>d(e.target.value)})}),!p.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:o.repos.length?`None matches.`:`None yet: the account can read no repository.`}),(0,$.jsx)(`ul`,{"aria-label":`Repositories`,className:`m-0 list-none p-0`,children:p.map(e=>{let t=f.has(e.git);return(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:H(`flex min-h-12 items-center gap-4 py-2`,t?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(Pn,{disabled:t,checked:t||c.has(e.git),onCheckedChange:t=>l(n=>{let r=new Set(n);return t?r.add(e.git):r.delete(e.git),r})}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.fullName}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[e.branch,e.private?`private`:e.private===!1?`public`:``,e.description].filter(Boolean).join(` · `)})]}),t&&(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Connected`})]})},e.git)})}),(o.truncated||!!o.skipped)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[o.truncated?`The first 2,000 are listed: find narrows them.`:``,o.skipped?`${o.skipped} left out: their links are not of this host, or not https.`:``].filter(Boolean).join(` `)})]})]})}var Ao=e=>e.url?`url`:e.mcp?`mcp`:e.command?`command`:e.documents?`documents`:`none`,jo=$n[0].fields,Mo=e=>e.map(e=>jo.find(t=>t.key===e));function No({edit:e}){let t=$t(),n=Y(e.value.rag),r=Ao(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)({busy:!1}),u=JSON.stringify(n),d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>a(r===`none`&&d.current?.rag===u?d.current.kind:r),[r,u]);let f=t=>{a(t),l({busy:!1});let r={top_k:n.top_k,timeout_seconds:n.timeout_seconds},i=t===`none`?{}:Object.fromEntries(Object.entries({...r,...t===`url`?{url:n.url,token_env:n.token_env}:t===`mcp`?{mcp:n.mcp}:t===`documents`?{documents:n.documents&&typeof n.documents==`object`?n.documents:{reasoning:!1}}:{command:n.command}}).filter(([,e])=>e!==void 0));d.current={kind:t,rag:JSON.stringify(Object.keys(i).length?i:{})},e.set(K(e.value,[`rag`],Object.keys(i).length?i:void 0))},p=Object.keys(Y(e.value.mcp)),m=async()=>{l({busy:!0});try{let r=await tt.testSearch(n,Y(e.value.mcp),o,To(t.pending));l({busy:!1,...r})}catch(e){l({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`Where your requirements, specs and wiki are searched (a RAG index): checking a test case or a story adds the passages it finds.`,children:`2. Search service`}),(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`The search service`,className:`mb-2`,children:[[`none`,`None`,`Test cases and stories are checked without passages from your documents.`],[`documents`,`This project's documents`,`Built in, no vectors: searches the folders you name.`],[`url`,`A service at an address`,`Your own RAG service, at its address.`],[`mcp`,`A tool of one of your MCP servers`,`A search tool of a server set up under MCP servers.`],[`command`,`A command on this machine`,`A program that prints the passages it finds.`]].map(([e,t,n])=>(0,$.jsxs)(`div`,{onClick:t=>i!==e&&!t.target.closest(`[role=radio]`)&&f(e),className:`flex min-h-[68px] cursor-pointer flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4 first:border-t-0`,children:[(0,$.jsx)(Er,{checked:i===e,onSelect:()=>i!==e&&f(e),label:`Use ${t}`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),(0,$.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:n})]})]},e))}),i===`url`&&(0,$.jsx)(X,{defs:Mo([`url`,`token_env`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{defs:Mo([`mcp.server`,`mcp.tool`,`mcp.query_arg`,`mcp.top_k_arg`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-4 text-[13px] text-muted`,children:p.length?`MCP servers set up: ${p.join(`, `)}.`:`No MCP server is set up yet: add one under MCP servers, then name it here.`})]}),i===`command`&&(0,$.jsx)(X,{defs:Mo([`command`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`documents`&&(0,$.jsx)(X,{defs:Mo([`documents.folders`,`documents.reasoning`,`top_k`]),edit:e,base:[`rag`]}),i!==`none`&&(0,$.jsx)(q,{label:`Try a search`,help:i===`command`?`A command runs on the next real search, not from this page.`:i===`documents`?`Searched by keywords only on this page; the model is asked on a real search. Nothing is saved.`:`What a test case would search for. Nothing is saved.`,htmlFor:`rag-query`,children:(0,$.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,$.jsx)(W,{id:`rag-query`,value:o,placeholder:`refunds over 500 EUR`,onChange:e=>s(e.target.value),onKeyDown:e=>Ot(e)&&o.trim()&&m(),className:`min-w-0 flex-1`}),(0,$.jsxs)(G,{size:`sm`,disabled:c.busy||!o.trim(),onClick:m,children:[(0,$.jsx)(ne,{"aria-hidden":`true`}),c.busy?`Searching…`:`Search`]})]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[c.message&&(0,$.jsx)(So,{ok:!!c.ok,message:c.message}),!!c.passages?.length&&(0,$.jsx)(`ul`,{"aria-label":`Passages found`,className:`m-0 list-none p-0`,children:c.passages.map((e,t)=>(0,$.jsxs)(`li`,{className:`border-t border-line-soft py-2 text-sm [overflow-wrap:anywhere]`,children:[e.source&&(0,$.jsxs)(`span`,{className:`font-medium`,children:[e.source,`: `]}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:e.text})]},t))})]})]})}var Po=/^[A-Za-z0-9][A-Za-z0-9 _.()-]{0,99}\.(md|markdown|txt)$/i,Fo=e=>e<1024?`${e} bytes`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Io({edit:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{tt.documents().then(e=>n(e.documents),e=>i({ok:!1,message:e.message}))},[]);let c=async e=>{if(!e?.length)return;o(!0),i(null);let r=[];try{for(let i of Array.from(e)){if(!Po.test(i.name))throw Error(`${i.name}: only a .md, .markdown or .txt file with a plain name.`);if(i.size>1e6)throw Error(`${i.name} is over 1 MB.`);let e=t?.some(e=>e.name===i.name)??!1,a=await tt.addDocument(i.name,await i.text(),e);n(a.documents),r.push(i.name)}i({ok:!0,message:`Added ${r.join(`, `)}. forgeqe knowledge build reads them with the other documents.`})}catch(e){i({ok:!1,message:e.message})}finally{o(!1),s.current&&(s.current.value=``)}},l=async e=>{try{n((await tt.removeDocument(e)).documents)}catch(e){i({ok:!1,message:e.message})}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{help:`What the graph reads beside the code: Markdown files you add here, folders on this computer, links, Confluence spaces, and the pages ForgeQE remembers of a web app.`,children:`3. Documents`}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Added here: kept in .forgeqe/documents, read as the source uploaded.`}),(0,$.jsxs)(G,{size:`sm`,disabled:a,"data-tip":`Add Markdown files`,onClick:()=>s.current?.click(),children:[(0,$.jsx)(u,{"aria-hidden":`true`}),a?`Uploading…`:`Upload`]}),(0,$.jsx)(`input`,{ref:s,type:`file`,accept:`.md,.markdown,.txt,text/markdown,text/plain`,multiple:!0,hidden:!0,onChange:e=>c(e.target.files)})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:r&&(0,$.jsx)(So,{ok:r.ok,message:r.message})}),!t&&!r&&(0,$.jsx)(wo,{children:`Reading the documents…`}),t&&!t.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet.`}),t?.map(e=>(0,$.jsx)(xo,{icon:Me,title:e.title,meta:`${e.name}, ${Fo(e.bytes)}`,actions:(0,$.jsx)(G,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>l(e.name),children:(0,$.jsx)(je,{"aria-hidden":`true`})})},e.name)),(0,$.jsx)(Co,{title:`Documents and links`,help:`Each one a folder of documents, a link, a Confluence space, or a web app whose pages ForgeQE remembers, by a name no repository has.`}),(0,$.jsx)(Rt,{edit:e,base:[`product`,`docs`],defs:Zn,noun:`source`,placeholder:`help`,meta:e=>String(e.path||e.url||(e.confluence?`Confluence ${e.confluence}`:e.app?`app ${e.app}`:``))})]})}var Lo=/^[A-Z][A-Z0-9_]{1,63}$/,Ro=/^(PATH|PATHEXT|HOME|SHELL|USER|USERNAME|LOGNAME|PWD|TMPDIR|TEMP|TMP|LANG|LC_\w+|TERM|COMSPEC|SYSTEMROOT|WINDIR|APPDATA|LOCALAPPDATA|USERPROFILE|NODE_\w+|BUN_\w+|NPM_\w+|PYTHON\w*|VIRTUAL_ENV|UV_\w+|LD_\w+|DYLD_\w+|SSL_CERT_\w+|REQUESTS_CA_BUNDLE|CURL_CA_BUNDLE|(HTTPS?|ALL|NO)_PROXY|GIT_\w+|SSH_\w+|GNUPGHOME|EDITOR|VISUAL|PAGER|FORGEQE_\w+|WEBPILOT_\w+|WP_CONFIG|WP_LLMS_JSON|WP_LLM_PROFILE)$/i,zo=/(TOKEN|PAT)$/,Bo=(e,t=`SHOP_PASSWORD`)=>Lo.test(e)?Ro.test(e)?`${e} changes how programs start: pick another name.`:``:`Capital letters, digits and _, such as ${t}.`,Vo=[{id:`azure`,label:`Azure Key Vault`,where:`Key vault`,whereHelp:`Its name, as in https://<name>.vault.azure.net.`,placeholder:`shop-qa-kv`,cli:`Microsoft, in the browser (az login)`},{id:`gcp`,label:`Google Secret Manager`,where:`Project`,whereHelp:`The Google Cloud project's id.`,placeholder:`shop-qa-123456`,cli:`Google, in the browser (gcloud auth login)`},{id:`aws`,label:`AWS Secrets Manager`,where:`Region`,whereHelp:`Where its secrets are, such as eu-west-1.`,placeholder:`eu-west-1`,cli:`AWS SSO, in the browser (aws sso login)`}],Ho={tenant:`Tenant id`,clientId:`Client id`,clientSecret:`Client secret`,serviceAccount:`Service account key (JSON)`,accessKeyId:`Access key id`,secretAccessKey:`Secret access key`,sessionToken:`Session token (optional)`},Uo=e=>e?.length?`Used by ${e.slice(0,2).join(`, `)}${e.length>2?` and ${e.length-2} more`:``}`:``,Wo=()=>Be.list();function Go({show:e}){let{data:t,error:n,reload:r}=hn(Wo),[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`sec-saved`),[l,d]=(0,Q.useState)(e||`all`);(0,Q.useEffect)(()=>{e&&c(`sec-saved`),d(e||`all`)},[e]);let[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[j,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)({}),I=i??t,ee=(I?.vaults||[]).filter(e=>e.auth===`cli`).map(e=>e.id).join(`,`),L=e=>{F(t=>({...t,[e]:`checking`})),Be.check(e).then(t=>F(n=>({...n,[e]:t})),t=>F(n=>({...n,[e]:{signedIn:!1,problem:t.message}})))};(0,Q.useEffect)(()=>{if(s===`sec-vaults`)for(let e of ee.split(`,`).filter(Boolean))P[e]||L(e)},[s,ee]),(0,Q.useEffect)(()=>{if(j?.state!==`running`)return;let e=setTimeout(()=>{Be.signinState().then(e=>{N(e.signin),e.signin&&e.signin.state!==`running`&&L(e.signin.vault)},()=>{})},1e3);return()=>clearTimeout(e)},[j]);let te=async e=>{p(``),h(``);try{N(await Be.signIn(e))}catch(e){h(e.message)}},ne=async(e,t,n)=>{w(!0),k(``);try{o(await e()),n(),p(t)}catch(e){k(e.message)}finally{w(!1)}},re=e=>{k(``),p(``),e()};if(!I)return(0,$.jsx)(In,{error:n,reload:r});let ie=I.secrets.filter(e=>e.from===`vault`&&!e.pending).length,ae=async()=>{p(``),h(``);try{let e=await Be.exportVaults(),t=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json;charset=utf-8`})),n=document.createElement(`a`);n.href=t,n.download=`forgeqe-vaults.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3),p(`Exported the vault connections: no value is in the file. A teammate imports it here and pulls with their own sign-in.`)}catch(e){h(e.message)}},oe=async e=>{let t=e?.[0];if(t){if(p(``),h(``),t.size>262144)return h(`${t.name} is over 256 KB.`);w(!0),D(!0);try{let e=await Be.importVaults(await t.text());o(e.view);let n=[e.added.length?`Added ${e.added.length===1?`the vault`:`${e.added.length} vaults:`} ${e.added.join(`, `)}.`:`No new vault.`,e.toPull.length?`${e.toPull.length===1?`1 secret is`:`${e.toPull.length} secrets are`} ready to pull on Saved: sign in, then Pull.`:``];p(n.filter(Boolean).join(` `)),e.skipped.length&&h(`Not imported: ${e.skipped.map(e=>`${e.id} (${e.why})`).join(`; `)}`)}catch(e){h(e.message)}finally{w(!1),D(!1)}}},se=I.secrets.filter(e=>e.token),z=l===`tokens`?se:I.secrets,le=(e=I.suggestedTokens[0]||`REPO_TOKEN`)=>re(()=>_({mode:`add`,name:e,value:``,token:!0})),ue=async e=>{w(!0),p(``),h(``);try{let t=await Be.pullAgain(e);o(t.view),t.failed.length?h(`Not pulled: ${t.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`):p(`Pulled ${e}.`)}catch(e){h(e.message)}finally{w(!1)}},de=async()=>{w(!0),p(``),h(``);try{let e=await Be.pullAgain();o(e.view),p(`Pulled ${e.pulled.length} again from their vaults.`),h(e.failed.length?`Not pulled: ${e.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`:``)}catch(e){h(e.message)}finally{w(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Yt,{label:`Secrets`,current:s,onPick:e=>{c(e),p(``),h(``)},tabs:[{id:`sec-saved`,label:`Saved (${I.secrets.length})`},{id:`sec-vaults`,label:`Vaults (${I.vaults.length})`}]}),f&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 mb-4 rounded-[10px] bg-surface-muted px-4 py-2 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:f}),m&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:m}),s===`sec-saved`?(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-saved`,"aria-labelledby":`tab-sec-saved`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":`Show`,children:(0,$.jsx)(dt,{value:l,onChange:e=>{d(e),p(``)},items:[{id:`all`,label:`All`,n:I.secrets.length},{id:`tokens`,label:`Repository tokens`,n:se.length+I.neededTokens.length}]})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[ie>0&&(0,$.jsxs)(G,{size:`sm`,disabled:C,onClick:()=>void de(),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),C?`Pulling…`:`Pull all again`]}),l===`tokens`?(0,$.jsxs)(G,{size:`sm`,onClick:()=>le(),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a token`]}):(0,$.jsxs)(G,{size:`sm`,onClick:()=>re(()=>_({mode:`add`,name:``,value:``})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a secret`]})]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:l===`tokens`?`The tokens ForgeQE clones and reads git repositories with: one for each git host or account. A clone picks one by its name.`:`Agents and tests use a secret by its name: in a sign-in, an environment's secrets, or a test's variables.`}),I.neededTokens.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:A}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:`${Uo(e.usedBy)}. It has no value here yet.`,state:(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:(0,$.jsx)(G,{size:`sm`,"aria-label":`Add ${e.name}`,onClick:()=>le(e.name),children:`Add`}),children:null},`needed-${e.name}`)),z.length===0&&!I.neededTokens.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:l===`tokens`?`No repository tokens yet. Add one for each git host or account.`:`None yet. Add one, or pull one from a vault.`}),z.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:e.from===`vault`?S:e.from===`sign-in`?R:e.token?A:ce}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:[e.from===`vault`&&e.vault?`From ${e.vault.provider} ${e.vault.id}: ${e.vault.secret}${e.vault.key?` › ${e.vault.key}`:``} · ${e.pending?`not pulled yet`:`pulled ${xn(e.vault.at)}`}`:e.from===`sign-in`?`From the ${e.system} sign-in: sign out of it to remove it.`:e.from===`shell`?`Set in your shell: change or remove it there.`:`Saved in Settings`,e.token?Uo(e.usedBy)||`Not used yet`:``].filter(Boolean).join(` · `),state:e.from===`shell`?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Set in the environment`}):e.set?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Saved`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not set`}),actions:e.pending?(0,$.jsx)(G,{size:`sm`,"aria-label":`Pull ${e.name}`,disabled:C,onClick:()=>void ue(e.name),children:`Pull`}):e.from===`sign-in`||e.from===`shell`?void 0:(0,$.jsx)(G,{size:`sm`,"aria-label":`Edit ${e.name}`,onClick:()=>re(()=>_({mode:`edit`,name:e.name,value:``,row:e,...e.token?{token:!0}:{}})),children:`Edit`}),children:null},e.name)),(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:[`Kept in `,Qt(I.store),`. ForgeQE never shows a value again, and the agents see only names.`,l===`tokens`?` Give each token read access to the repositories it clones, nothing more.`:``]})]}):(0,$.jsxs)(`div`,{role:`tabpanel`,id:`panel-sec-vaults`,"aria-labelledby":`tab-sec-vaults`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[I.vaults.length>0&&(0,$.jsxs)(G,{size:`sm`,onClick:()=>void ae(),"data-tip":`A file of the connections, without values, for a teammate to import`,children:[(0,$.jsx)(ye,{"aria-hidden":`true`}),`Export`]}),(0,$.jsxs)(G,{size:`sm`,disabled:C,onClick:()=>T.current?.click(),"data-tip":`Connections a teammate exported`,children:[(0,$.jsx)(u,{"aria-hidden":`true`}),E?`Importing…`:`Import`]}),(0,$.jsx)(`input`,{ref:T,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>(oe(e.target.files),e.target.value=``)}),(0,$.jsxs)(G,{size:`sm`,onClick:()=>re(()=>y({mode:`add`,v:{id:``,provider:`azure`,where:``,auth:`cli`}})),children:[(0,$.jsx)(M,{"aria-hidden":`true`}),`Add a vault`]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-sm text-muted`,children:`Where ForgeQE pulls secrets from. It reads a value only when you pull that secret.`}),j&&(0,$.jsx)(Yo,{s:j,onCancel:()=>void Be.cancelSignin().then(e=>N(e.signin),()=>{}),onClose:()=>N(null)}),I.vaults.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`None yet. Add Azure Key Vault, Google Secret Manager or AWS Secrets Manager.`}),I.vaults.map(e=>(0,$.jsx)(on,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Bt,{icon:S}),title:e.id,meta:`${e.providerLabel} · ${e.where} · ${e.auth===`cli`?`signs in with your browser${e.profile?`, profile ${e.profile}`:``}`:`signs in with saved keys`}${e.pulled?` · ${e.pulled} pulled`:``}${e.missing.length?` · not saved yet: ${e.missing.join(`, `)}`:``}`,state:e.auth===`cli`?P[e.id]===`checking`||!P[e.id]?(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Checking the sign-in…`}):P[e.id].signedIn?(0,$.jsx)(`span`,{className:`text-[13px] text-pass`,children:`Signed in`}):(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":P[e.id].problem,children:`Not signed in`}):e.missing.length?(0,$.jsx)(`span`,{className:`text-[13px] text-warn`,"data-tip":e.missing.join(`, `),children:e.missing.length===1?`Needs ${e.missing[0]}`:`Needs ${e.missing.length} variables`}):(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.pulled===1?`1 secret pulled`:`${e.pulled} secrets pulled`}),actions:(0,$.jsxs)($.Fragment,{children:[e.auth===`cli`&&P[e.id]!==`checking`&&P[e.id]&&!P[e.id].signedIn?(0,$.jsxs)(G,{size:`sm`,variant:`primary`,"aria-label":`Sign in to ${e.id}`,disabled:j?.state===`running`,onClick:()=>void te(e.id),children:[(0,$.jsx)(R,{"aria-hidden":`true`}),`Sign in`]}):(0,$.jsx)(G,{size:`sm`,"aria-label":`Browse ${e.id}`,disabled:e.missing.length>0||e.auth===`cli`&&P[e.id]===`checking`,onClick:()=>re(()=>x(e)),children:`Browse`}),(0,$.jsx)(G,{size:`sm`,"aria-label":`Edit ${e.id}`,onClick:()=>re(()=>y({mode:`edit`,v:{id:e.id,provider:e.provider,where:e.where,auth:e.auth,...e.profile?{profile:e.profile}:{},...e.keys?{keys:e.keys}:{}}})),children:`Edit`})]}),children:null},e.id)),(0,$.jsx)(`p`,{className:`m-0 mt-4 text-[13px] text-muted`,children:`Vaults are kept on this computer for this project, never in the repository: share them with Export and Import, which carry no value. Give ForgeQE's sign-in read access to the secrets it needs, nothing more.`})]}),(0,$.jsx)(Ko,{panel:g,setPanel:_,busy:C,error:O,onSave:e=>void ne(()=>Be.save(e.name,e.value),`${e.mode===`add`?`Added`:`Saved`} ${e.name}.`,()=>_(null)),onRemove:e=>void ne(()=>Be.remove(e),`Removed ${e}.`,()=>_(null)),onPull:e=>void ne(async()=>{let t=await Be.pullAgain(e);if(t.failed.length)throw Error(t.failed[0].error);return t.view},`Pulled ${e} again.`,()=>_(null)),taken:new Set(I.secrets.map(e=>e.name))}),(0,$.jsx)(qo,{panel:v,setPanel:y,busy:C,error:O,roles:I.keyRoles,taken:new Set(I.vaults.map(e=>e.id)),missing:I.vaults.find(e=>e.id===v?.v.id)?.missing,onSave:e=>void ne(()=>Be.saveVault(e.v,e.mode===`edit`),`${e.mode===`add`?`Added`:`Saved`} the vault ${e.v.id}.${e.v.auth===`cli`?` Sign in on its row if it says Not signed in.`:``}`,()=>{y(null),F(t=>{let{[e.v.id]:n,...r}=t;return r})}),onRemove:e=>void ne(()=>Be.removeVault(e),`Removed the vault ${e}. The secrets pulled from it stay saved.`,()=>y(null))}),(0,$.jsx)(Jo,{vault:b,onClose:()=>x(null),taken:new Set(I.secrets.map(e=>e.name)),onPulled:(e,t,n)=>{o(e),x(null),c(`sec-saved`),p(`Pulled ${n} as ${t}. Agents and tests can use it by that name.`)}})]})}function Ko({panel:e,setPanel:t,busy:n,error:r,onSave:i,onRemove:o,onPull:s,taken:c}){let l=e?.mode===`add`?Bo(e.name,e.token?`GITHUB_TOKEN`:void 0)||(c.has(e.name)?`${e.name} is already in the list: edit it there.`:``)||(e.token&&!zo.test(e.name)?`A token's name ends in TOKEN or PAT, such as GITHUB_TOKEN.`:``):``,u=e?.row?.from===`vault`,[d,f]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>f(!1),[!!e]),(0,$.jsx)(Jt,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${e.name}`:e?.token?`Add a repository token`:`Add a secret`,description:`The value goes to your credential store when you press the button below. ForgeQE never shows it again, and the agents see only its name.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):l?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(G,{disabled:n,onClick:()=>o(e.name),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(G,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:n||!!l||!e?.value.trim(),onClick:()=>e&&i(e),children:n?`Saving…`:e?.mode===`add`?e.token?`Add token`:`Add secret`:e?.token?`Save token`:`Save secret`})]}),children:e&&(0,$.jsxs)($.Fragment,{children:[e.mode===`add`&&(0,$.jsx)(q,{label:`Name`,help:l?(0,$.jsx)(`span`,{className:`text-fail`,children:l}):e.token?`The variable a clone signs in with: one per host or account.`:`The variable agents and tests read it by.`,htmlFor:`sh-name`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(W,{id:`sh-name`,value:e.name,spellCheck:!1,maxLength:64,placeholder:e.token?`GITHUB_TOKEN`:`SHOP_PASSWORD`,"aria-invalid":!!l,onChange:n=>t({...e,name:n.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),u&&e.row?.vault&&(0,$.jsx)(q,{label:`From a vault`,help:`${e.row.vault.provider} ${e.row.vault.id}: ${e.row.vault.secret}${e.row.vault.key?` › ${e.row.vault.key}`:``}, pulled ${xn(e.row.vault.at)}. Pull it again for the vault's newest value; a value typed below replaces it and is no longer the vault's.`,className:`mt-4`,stacked:!0,children:(0,$.jsxs)(G,{size:`sm`,disabled:n,onClick:()=>s(e.name),children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Pull again`]})}),(0,$.jsx)(q,{label:e.mode===`edit`?`New value`:e.token?`Token`:`Value`,help:e.token?`A personal access token with read access to the repositories (GitHub: Contents read; Azure DevOps: Code read; GitLab: read_repository).`:(0,$.jsxs)($.Fragment,{children:[`At most 16 KB.`,` `,(0,$.jsx)(`button`,{type:`button`,onClick:()=>f(!d),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:d?`One line, hidden`:`Several lines (shown as you type), such as a JSON key`})]}),htmlFor:`sh-value`,className:e.mode===`edit`&&!u?`mt-4`:void 0,stacked:!0,children:d&&!e.token?(0,$.jsx)(rt,{id:`sh-value`,rows:6,autoComplete:`off`,spellCheck:!1,value:e.value,onChange:n=>t({...e,value:n.target.value}),className:`font-mono`}):(0,$.jsx)(W,{id:`sh-value`,type:`password`,autoComplete:`off`,value:e.value,onChange:n=>t({...e,value:n.target.value})})})]})})}function qo({panel:e,setPanel:t,busy:n,error:r,roles:i,taken:a,missing:o,onSave:s,onRemove:c}){let l=e?.v,u=Vo.find(e=>e.id===l?.provider)??Vo[0],d=n=>e&&t({...e,v:{...e.v,...n}}),f=l?.auth===`keys`?Object.entries(i[l.provider]).map(([e,t])=>[e,Bo(l.keys?.[e]??t)]).filter(([,e])=>e):[],p=e?.mode===`add`?/^[a-z][a-z0-9-]{0,39}$/.test(l?.id||``)?a.has(l.id)?`A vault is already named ${l.id}.`:``:`Lower case letters, digits and -, such as qa-kv.`:``;return(0,$.jsx)(Jt,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${l?.id}`:`Add a vault`,description:`Where ForgeQE pulls secrets from, and how it signs in. Kept on this computer for this project. Nothing is read until you pull a secret.`,footer:(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:r}):p||f.length?(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(G,{disabled:n,onClick:()=>c(l.id),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(G,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:n||!!p||f.length>0||!l?.where.trim(),onClick:()=>e&&s(e),children:n?`Saving…`:e?.mode===`add`?`Add vault`:`Save vault`})]}),children:e&&l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Provider`,htmlFor:`vt-provider`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(U,{id:`vt-provider`,value:l.provider,disabled:e.mode===`edit`,onChange:e=>d({provider:e.target.value,where:``,keys:void 0,profile:void 0}),children:Vo.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),e.mode===`add`&&(0,$.jsx)(q,{label:`Name`,help:p?(0,$.jsx)(`span`,{className:`text-fail`,children:p}):`What this project calls it.`,htmlFor:`vt-id`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-id`,value:l.id,spellCheck:!1,maxLength:40,placeholder:`qa-kv`,"aria-invalid":!!p,onChange:e=>d({id:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`)}),className:`font-mono`})}),(0,$.jsx)(q,{label:u.where,help:u.whereHelp,htmlFor:`vt-where`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-where`,value:l.where,spellCheck:!1,maxLength:64,placeholder:u.placeholder,onChange:e=>d({where:e.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(q,{label:`Sign in with`,help:l.auth===`cli`?`Your own account, in your browser: Sign in on the vault's row after you add it. The cloud's CLI keeps the sign-in and renews it; ForgeQE saves nothing.`:`For a computer with nobody to sign in, such as a build agent.`,htmlFor:`vt-auth`,stacked:!0,children:(0,$.jsxs)(U,{id:`vt-auth`,value:l.auth,onChange:e=>d({auth:e.target.value,keys:e.target.value===`keys`?{...i[l.provider]}:void 0}),children:[(0,$.jsxs)(`option`,{value:`cli`,children:[u.cli,` (recommended)`]}),(0,$.jsx)(`option`,{value:`keys`,children:l.provider===`azure`?`A service principal's keys, saved as secrets (no browser)`:l.provider===`gcp`?`A service account's key, saved as a secret (no browser)`:`Access keys, saved as secrets (no browser)`})]})}),l.provider===`aws`&&l.auth===`cli`&&(0,$.jsx)(q,{label:`Profile (optional)`,help:`An SSO profile of ~/.aws/config (set one up once with aws configure sso). Empty: the default.`,htmlFor:`vt-profile`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-profile`,value:l.profile||``,spellCheck:!1,maxLength:64,placeholder:`qa`,onChange:e=>d({profile:e.target.value.trim()||void 0}),className:`font-mono`})}),l.auth===`keys`&&Object.entries(i[l.provider]).map(([e,t])=>(0,$.jsx)(q,{label:Ho[e]||e,help:(()=>{let n=l.keys?.[e]??t,r=Bo(n);return r?(0,$.jsx)(`span`,{className:`text-fail`,children:r}):o?.includes(n)?(0,$.jsx)(`span`,{className:`text-warn`,children:`Not saved yet: add ${n} on the Saved tab.`}):`The secret that holds it, saved on the Saved tab as ${n}.`})(),htmlFor:`vt-${e}`,stacked:!0,children:(0,$.jsx)(W,{id:`vt-${e}`,"aria-invalid":!!Bo(l.keys?.[e]??t),value:l.keys?.[e]??t,spellCheck:!1,maxLength:64,onChange:t=>d({keys:{...l.keys||i[l.provider],[e]:t.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}}),className:`font-mono`})},e))]})})}function Jo({vault:e,onClose:t,taken:n,onPulled:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=()=>{e&&(a(null),s(``),Be.names(e.id).then(a,e=>s(e.message)))};(0,Q.useEffect)(()=>{d(null),l(``),h(``),g()},[e?.id]);let _=(i?.names||[]).filter(e=>e.toLowerCase().includes(c.trim().toLowerCase())),v=_.slice(0,200),y=u?Bo(u.name):``,b=async()=>{if(e&&u){p(!0),h(``);try{r(await Be.pull({vault:e.id,secret:u.secret,name:u.name,...u.key.trim()?{key:u.key.trim()}:{}}),u.name,u.secret)}catch(e){h(e.message)}finally{p(!1)}}};return(0,$.jsxs)(Jt,{open:!!e,onClose:t,wide:!0,title:e?`Secrets of ${e.id}`:`Secrets`,description:e?`The names in ${e.providerLabel} ${e.where}. Pick one to pull its value into your credential store under a variable's name; ForgeQE never shows the value.`:void 0,footer:(0,$.jsxs)($.Fragment,{children:[m?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:m}):(0,$.jsx)(`span`,{className:`mr-auto self-center text-sm text-muted`,children:u?y?`Needs a valid name`:`${u.secret} as ${u.name}`:``}),(0,$.jsx)(G,{onClick:t,children:`Cancel`}),(0,$.jsx)(G,{variant:`primary`,disabled:f||!u||!!y,onClick:()=>void b(),children:f?`Pulling…`:`Pull secret`})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[!i&&!o&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:`Reading the vault's names…`}),o&&(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(In,{error:o,reload:g})})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{label:`Find`,htmlFor:`br-find`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(W,{id:`br-find`,value:c,placeholder:`password`,onChange:e=>l(e.target.value)})}),!_.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-sm text-muted`,children:i.total?`None matches.`:`None yet: ForgeQE's sign-in can see no secret in this vault.`}),(0,$.jsx)(`ul`,{"aria-label":`Secrets in the vault`,className:`m-0 list-none p-0`,children:v.map(e=>{let t=u?.secret===e;return(0,$.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,$.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-4 py-2`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`br-secret`,checked:t,onChange:()=>d({secret:e,name:e.toUpperCase().replace(/[^A-Z0-9_]/g,`_`).replace(/^([^A-Z])/,`S_$1`).slice(0,64),key:``})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e})]}),t&&u&&(0,$.jsxs)(`div`,{className:`mb-4 ml-8 flex flex-col gap-4 rounded-[12px] bg-surface-muted p-4`,children:[(0,$.jsx)(q,{label:`Save as`,help:y?(0,$.jsx)(`span`,{className:`text-fail`,children:y}):n.has(u.name)?`${u.name} is saved already: pulling replaces its value.`:`The variable agents and tests read it by.`,htmlFor:`br-name`,stacked:!0,className:`py-0`,children:(0,$.jsx)(W,{id:`br-name`,value:u.name,spellCheck:!1,maxLength:64,"aria-invalid":!!y,onChange:e=>d({...u,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),(0,$.jsx)(q,{label:`JSON field (optional)`,help:`When the secret holds JSON, the one field to keep, such as password.`,htmlFor:`br-key`,stacked:!0,className:`py-0`,children:(0,$.jsx)(W,{id:`br-key`,value:u.key,spellCheck:!1,maxLength:128,placeholder:`password`,onChange:e=>d({...u,key:e.target.value}),className:`font-mono`})})]})]},e)})}),(_.length>v.length||i.total>i.names.length)&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft pt-4 text-[13px] text-muted`,children:[_.length>v.length?`The first ${v.length} of ${_.length} are shown: find narrows them.`:``,i.total>i.names.length?`The first ${i.names.length.toLocaleString()} of the vault's names are listed.`:``].filter(Boolean).join(` `)})]})]})}function Yo({s:e,onCancel:n,onClose:r}){let[i,a]=(0,Q.useState)(!1),o=e.state===`running`,s=e.link&&/^https:\/\//.test(e.link)?e.link:void 0;return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`mb-4 flex flex-col gap-4 rounded-[12px] card border p-4`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Signing in to `,e.vault]}),(s||e.code)&&o&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.code&&(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-4 py-2 font-mono text-lg font-semibold tracking-[0.12em]`,children:e.code}),(0,$.jsxs)(G,{size:`sm`,"aria-label":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(e.code).then(()=>a(!0)),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(t,{"aria-hidden":`true`}),i?`Copied`:`Copy`]})]}),s&&(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer noopener`,className:st({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(he,{"aria-hidden":`true`}),`Open `,new URL(s).host]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:[e.lines.slice(-6).map((t,n)=>(0,$.jsx)(`li`,{className:H(`[overflow-wrap:anywhere]`,n===e.lines.slice(-6).length-1&&e.state===`done`?`text-pass`:n===e.lines.slice(-6).length-1&&e.state===`failed`?`text-fail`:`text-ink-2`),children:t},n)),o&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for you to finish in the browser…`})]}),(0,$.jsx)(`div`,{children:o?(0,$.jsx)(G,{size:`sm`,onClick:n,children:`Cancel`}):(0,$.jsx)(G,{size:`sm`,onClick:r,children:`Close`})})]})}var Xo={testmu:`TestMu AI`,browserstack:`BrowserStack`},Zo={testmu:{provider:`testmu`,remote:{username_env:`LT_USERNAME`,access_key_env:`LT_ACCESS_KEY`}},browserstack:{provider:`browserstack`,remote:{username_env:`BROWSERSTACK_USERNAME`,access_key_env:`BROWSERSTACK_ACCESS_KEY`}}},Qo=(...e)=>e.map(([e,t])=>({value:e,label:t})),$o={testmu:[{key:`type`,label:`Type`,type:`select`,default:`real`,options:Qo([`real`,`Real device`],[`virtual`,`Emulator or simulator`])},{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Qo([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As TestMu AI names it.`,type:`text`,placeholder:`Galaxy S23`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}],browserstack:[{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Qo([`android`,`Android`],[`ios`,`iOS`])},{key:`model`,label:`Device model`,help:`As BrowserStack names it. Real devices only.`,type:`text`,placeholder:`Google Pixel 7`},{key:`os_version`,label:`OS version`,type:`text`,placeholder:`13.0`},{key:`enabled`,label:`Use in runs`,help:`Off: kept here, run only when a run names it.`,type:`switch`,default:!0}]},es=`Kept in your credential store; the file has only the variable's name. The same sign-in as its browsers.`,ts={testmu:[{key:`remote.username_env`,label:`TestMu AI user`,help:es,type:`var`,default:`LT_USERNAME`},{key:`remote.access_key_env`,label:`TestMu AI key`,help:es,type:`var`,default:`LT_ACCESS_KEY`},{key:`mobile.region`,label:`Region for devices`,type:`text`,placeholder:`us`}],browserstack:[{key:`remote.username_env`,label:`BrowserStack user`,help:es,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`remote.access_key_env`,label:`BrowserStack key`,help:es,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`}]};function ns(e){return[e.type===`virtual`?e.platform===`ios`?`simulator`:`emulator`:`real device`,`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`,e.model,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}function rs({grids:e,setGrids:t,paths:n,vars:r}){return(0,$.jsx)($.Fragment,{children:[`testmu`,`browserstack`].map(i=>{let a=Xo[i],o={value:e[i]??Zo[i],set:n=>t({...e,[i]:n}),vars:r,file:n[i]};return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(J,{help:(0,$.jsxs)($.Fragment,{children:[`Kept in `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:n[i]}),`, `,a,`'s own file`,e[i]?``:`, made when you add a device`,`. Its browsers and their devices are in the same file:`,` `,(0,$.jsxs)(`a`,{href:be(`settings`,`integrations`),children:[`Integrations → `,a]}),`.`]}),children:`${a} devices`}),(0,$.jsx)(Rt,{edit:o,base:[`mobile`,`devices`],defs:$o[i],noun:`${a} device`,placeholder:i===`testmu`?`galaxy-s23`:`pixel7`,start:i===`testmu`?{type:`real`,platform:`android`}:{platform:`android`},meta:ns}),(0,$.jsx)(X,{defs:ts[i],edit:o,base:[]})]},i)})})}var is=(0,Q.lazy)(()=>it(()=>import(`./Features-DFuPCW9x.js`).then(e=>({default:()=>(0,$.jsx)(e.Features,{embedded:!0})})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),as=(0,Q.lazy)(()=>it(()=>import(`./WhatsNew-DBViE2Qt.js`).then(e=>({default:()=>(0,$.jsx)(e.WhatsNew,{embedded:!0})})),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9]))),os=Nn.filter(e=>!kn.includes(e.id)),ss=[...new Set(os.map(e=>e.group))],cs=[`setup`,`environments`,`signins`,`secrets`,`integrations`,`notifications`,`appearance`,`voice`,`models`,`databases`,`features`,`whats-new`,`report`,`about`],ls=`forgeqe-settings-more`,us={config:`forgeqe.yaml`,models:`llms.json`,environments:`the environment files`,guardrails:`guardrails.md`,grids:`the browser grid files`,secrets:`keys and passwords`};function ds(e,t){let n=e.paths.base.replace(/(?<![\\/])[\\/]+$/,``);return t.startsWith(`${n}/`)||t.startsWith(`${n}\\`)?`./${t.slice(n.length+1).replace(/\\/g,`/`)}`:t}function fs(e){return{config:e.config,models:e.models,environments:e.environments,guardrails:e.guardrails.filter(e=>e.editable).map(e=>e.text),grids:{browserstack:e.grids.browserstack.linked?e.grids.browserstack.value:null,testmu:e.grids.testmu.linked?e.grids.testmu.value:null},secrets:{}}}var ps={local:`This computer`,browserstack:`BrowserStack`,testmu:`TestMu AI`};function ms(e){let t=ps[String(e.runs_on??`local`)]??String(e.runs_on),n=e.type===`real`||e.type===void 0&&e.runs_on!==void 0&&e.runs_on!==`local`?`real device`:e.platform===`ios`?`simulator`:`emulator`,r=`${e.platform===`ios`?`iOS`:`Android`}${e.os_version?` ${String(e.os_version)}`:``}`;return[`${t}, ${n}`,r,e.model||e.udid,e.enabled===!1?`not in use`:``].filter(Boolean).map(String).join(` · `)}var hs=[{id:`setup`,label:`Set up`},{id:`models`,label:`Models`},{id:`evidence`,label:`Product knowledge`},{id:`appearance`,label:`Appearance`}],gs=e=>hs.find(t=>t.id===e)?.id??`setup`;function _s({section:e,only:t,guide:n}){let r=n===void 0?void 0:gs(n),i=r??t??e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=(0,Q.useCallback)(()=>{d(``),Je.settings().then(e=>{s(e),l(fs(e))},e=>d(e.message))},[]),C=(0,Q.useCallback)(()=>{d(``),$e.state().then(e=>{x(e),e.ready&&S()},e=>d(e.message))},[S]);(0,Q.useEffect)(C,[C]);let w=e=>{e.project===b?.project&&e.ready||(s(null),l(null)),x(e),e.ready&&S()},T=!!b?.ready,[E,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),F=(0,Q.useCallback)(async()=>{if(!(await $e.state()).ready)return!1;let e=await $e.machine();return e.engine&&e.runtime},[]);(0,Q.useEffect)(()=>{r!==void 0&&Ye.status().then(e=>{D(e.state),A(!0)},()=>A(!0))},[r]),(0,Q.useEffect)(()=>{r!==void 0&&F().then(M,()=>M(!1))},[r,b,F]),(0,Q.useEffect)(()=>P(``),[r]),(0,Q.useEffect)(()=>{if(r!==`setup`||j)return;let e=cn(()=>void F().then(M,()=>{}),2500);return()=>Lt(e)},[r,j,F]);let L=async(e,t)=>{P(``);try{if(e===`done`){await Ye.save({done:!0,step:`done`,...t?{skip:t}:{}}),location.hash=be();return}let n=await Ye.save({step:e,...t?{skip:t}:{}});D(n.state),location.hash=be(`welcome`,e)}catch(e){P(e.message)}},te=async()=>{if(await F().catch(()=>!1))return L(`done`);r!==`setup`&&(location.hash=be(`welcome`,`setup`)),P(`Set up is the one step that cannot be skipped: ForgeQE needs it to run. Once it is done, you can leave onboarding.`)};(0,Q.useEffect)(()=>{r===void 0?b&&!T&&i!==`setup`?location.replace(be(`settings`,`setup`)):!t&&i&&kn.includes(i)&&location.replace(be(i)):r!==`setup`&&b&&!T&&location.replace(be(`welcome`,`setup`))},[b,T,i]);let R=(b&&!T?Nn[0]:Nn.find(e=>e.id===(i===`repo-tokens`?`secrets`:i)))||Nn.find(e=>e.id===`models`),[ne,re]=(0,Q.useState)(()=>{try{return localStorage.getItem(ls)===`open`}catch{return!1}}),ie=e=>{re(e);try{localStorage.setItem(ls,e?`open`:`closed`)}catch{}};(0,Q.useEffect)(()=>{h(``),p(``),y(!1)},[R.id]);let ae=o?fs(o):null,oe=e=>!!c&&!!ae&&!an(c[e],ae[e]),se=Object.keys(us).filter(oe);(0,Q.useEffect)(()=>{if(!se.length)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[se.length]);let z=e=>({value:c[e],set:t=>{h(``),l(n=>({...n,[e]:t}))},vars:o.variables,...e===`config`?{file:`forgeqe.yaml`}:{}}),le=(0,Q.useRef)(c);le.current=c;let ue=(0,Q.useRef)(o);ue.current=o;let[de,fe]=(0,Q.useState)(``),pe=(0,Q.useRef)({}),he=(0,Q.useCallback)((e,t)=>{let n=pe.current,r=Object.keys(n).find(t=>n[t]===e)??e;r===t?delete n[r]:n[r]=t},[]),ge=(0,Q.useCallback)(async()=>{let e=le.current,t=ue.current;if(!e||!t)return;let n=fs(t),r=Object.keys(us).filter(t=>!an(e[t],n[t]));if(!r.length)return;_(!0),p(``),y(!1);let i=t,a=(t,n)=>l(r=>{if(!r)return r;let i=fs(t),a={...r};for(let t of Object.keys(us))if(t===`secrets`){if(!n)continue;a.secrets=Object.fromEntries(Object.entries(r.secrets).filter(([t,n])=>e.secrets[t]!==n))}else(n?an(r[t],e[t]):an(r[t],i[t]))&&(a[t]=i[t]);return a});try{for(let a of r)if(a===`secrets`)i=await Je.saveSecrets(e.secrets);else if(a===`grids`)for(let[r,a]of Object.entries(e.grids))a&&!an(a,n.grids[r])&&(i=await Je.saveGrid(r,a,t.versions[`grid:${r}`]));else if(a===`models`){let r=n.models.models,o=e.models.models,s=Object.fromEntries(Object.entries(pe.current).filter(([e,t])=>r&&o&&e in r&&!(e in o)&&t in o));i=await Je.save(a,e[a],t.versions[a],s),pe.current={}}else i=a===`guardrails`?await Je.saveGuardrails(e.guardrails,t.versions.guardrails):await Je.save(a,e[a],t.versions[a]);s(i),a(i,!0),fe(``),h(`Saved`)}catch(n){p(n.message),y(n instanceof Ge&&n.status===409),fe(JSON.stringify(e)),i!==t&&(s(i),a(i,!1))}finally{_(!1)}},[]);(0,Q.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>h(``),4e3);return()=>clearTimeout(e)},[m]);let _e=c?JSON.stringify(c):``;(0,Q.useEffect)(()=>{if(!se.length||g||v||de&&de===_e)return;let e=se.every(e=>e===`secrets`),t=setTimeout(ge,e?2e3:1e3);return()=>clearTimeout(t)},[_e,g,v,de]);let ve=async()=>{p(``);try{let e=await Je.splitEnvironments();s(e),l(fs(e)),h(`Each environment is now its own file in environments/. The old file is left as it is; ForgeQE no longer reads it.`)}catch(e){p(e.message)}},ye=async(e,t,n)=>{p(``);try{let r=await Je.saveText(e,t,n,o?.versions[e]);return s(r),l(fs(r)),h(`Saved ${us[e]}.`),!0}catch(e){return p(e.message),!1}},B=null;if(R.id===`setup`)B=b&&(0,$.jsx)(fa,{state:b,onState:w,guide:r!==void 0});else if(o&&c){let e=(R.id===`models`||R.id===`routing`?[`models`,`config`]:R.id===`environments`?[`environments`,`config`]:[`files`,`guardrails`,`prompts`,`logs`,`audit`,`generated`,`about`,`report`,`features`,`whats-new`].includes(R.id)?[]:[`config`]).find(e=>o.errors[e]);switch(R.id){case`models`:B=(0,$.jsx)(ci,{config:z(`config`),models:z(`models`),vars:o.variables,onReload:S,onRename:he});break;case`environments`:B=(0,$.jsx)(Hr,{envs:z(`environments`),layout:o.paths.environments,files:o.raw.environments,base:o.paths.base,onSplit:ve,config:z(`config`),splitBlocked:oe(`environments`)||oe(`config`)?`Save or discard your changes to the environments and forgeqe.yaml first.`:``});break;case`browser`:B=(0,$.jsx)(Bn,{groups:qn,edit:z(`config`)});break;case`appearance`:B=(0,$.jsx)(lo,{config:z(`config`)});break;case`voice`:B=(0,$.jsx)(ho,{});break;case`routing`:B=(0,$.jsx)(mi,{config:z(`config`),models:z(`models`)});break;case`generated`:B=(0,$.jsx)(Oa,{});break;case`about`:B=(0,$.jsx)(Ta,{});break;case`features`:case`whats-new`:B=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Opening…`}),children:R.id===`features`?(0,$.jsx)(is,{}):(0,$.jsx)(as,{})});break;case`report`:B=(0,$.jsx)(Fa,{});break;case`notifications`:case`mcp`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ji,{view:R.id,edit:z(`config`),grids:c.grids,setGrids:e=>l(t=>({...t,grids:e})),gridPaths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)}}),R.id===`notifications`&&(0,$.jsx)(Ea,{})]});break;case`parallel`:B=(0,$.jsx)(Bn,{groups:Jn,edit:z(`config`)});break;case`mobile`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Kn,edit:z(`config`)}),(0,$.jsx)(J,{help:`Phones, tablets, emulators and simulators connected to this computer. Every device in use, here and on the clouds below, runs each replay and set of Maestro flows; ForgeQE sets up Appium, Maestro and the cloud for each.`,children:`Devices on this computer`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`mobile`,`devices`],defs:Xn,noun:`device`,placeholder:`pixel8`,start:{type:`virtual`,platform:`android`},meta:ms}),(0,$.jsx)(rs,{grids:c.grids,setGrids:e=>{h(``),l(t=>({...t,grids:e}))},paths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)},vars:o.variables}),(0,$.jsx)(Bn,{groups:ur,edit:z(`config`),continued:!0})]});break;case`desktop`:B=(0,$.jsx)(Bn,{groups:lr,edit:z(`config`)});break;case`containers`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Yn.slice(0,1),edit:z(`config`)}),(0,$.jsx)(J,{help:`Each one ForgeQE may start, stop and read: a database, a queue, the API under test.`,children:`Services`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`containers`,`services`],defs:dr,noun:`service`,placeholder:`db`,meta:e=>[e.image,Array.isArray(e.ports)?`ports ${e.ports.join(`, `)}`:``].filter(Boolean).map(String).join(`, `)}),(0,$.jsx)(Bn,{groups:Yn.slice(1),edit:z(`config`),continued:!0})]});break;case`databases`:B=(0,$.jsx)(Rt,{edit:z(`config`),base:[`databases`],defs:tr,noun:`database`,placeholder:`orders`,meta:e=>[e.description,e.engine,e.url_env?`from ${e.url_env}`:e.host,e.writable?`writable`:`read only`].filter(Boolean).map(String).join(`, `)});break;case`signins`:B=(0,$.jsx)(Rn,{edit:z(`config`)});break;case`secrets`:B=(0,$.jsx)(Go,{show:i===`repo-tokens`?`tokens`:void 0});break;case`integrations`:B=(0,$.jsx)(ji,{edit:z(`config`),grids:c.grids,setGrids:e=>{h(``),l(t=>({...t,grids:e}))},gridPaths:{browserstack:ds(o,o.grids.browserstack.file),testmu:ds(o,o.grids.testmu.file)}});break;case`tests`:B=(0,$.jsx)(Bn,{groups:sr,edit:z(`config`)});break;case`runs`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:Wn,edit:z(`config`)}),(0,$.jsx)(Bn,{groups:or,edit:z(`config`),continued:!0}),(0,$.jsx)(J,{help:`Each one a table of the project report: forgeqe.<name>.`,children:`Report datasets`}),(0,$.jsx)(Rt,{edit:z(`config`),base:[`bi`,`datasets`],defs:er,noun:`dataset`,placeholder:`open_bugs`,meta:e=>[e.title,e.kind===`jira_jql`?`Jira`:e.kind===`ado_wiql`?`Azure DevOps`:``].filter(Boolean).map(String).join(`, `)})]});break;case`quality`:B=(0,$.jsx)(Bn,{groups:fr,edit:z(`config`)});break;case`evidence`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Do,{edit:z(`config`)}),(0,$.jsx)(Da,{})]});break;case`agents`:B=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{groups:rr,edit:z(`config`)}),(0,$.jsx)(Ia,{config:z(`config`)})]});break;case`guardrails`:B=(0,$.jsx)(Vi,{rules:c.guardrails,others:o.guardrails.filter(e=>!e.editable),onChange:e=>l({...c,guardrails:e}),onChanged:e=>(h(e),Je.settings().then(s,()=>{}))});break;case`monitor`:B=(0,$.jsx)(Ri,{edit:z(`config`)});break;case`skills`:B=(0,$.jsx)(Tr,{edit:z(`config`)});break;case`prompts`:B=(0,$.jsx)(Sr,{onChanged:h});break;case`registry`:B=(0,$.jsx)(bn,{edit:z(`config`)});break;case`logs`:B=(0,$.jsx)(vn,{});break;case`audit`:B=(0,$.jsx)(Mn,{});break;case`tokenomics`:B=(0,$.jsx)(Cn,{edit:z(`config`)});break;case`files`:B=(0,$.jsx)(mn,{snap:o,dirty:{config:oe(`config`),models:oe(`models`),environments:oe(`environments`)},onSave:ye})}e&&(B=(0,$.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail`,children:[e===`environments`?`An environment file`:us[e],` does not parse, so the form cannot show it: `,o.errors[e],`. Fix it in `,(0,$.jsx)(`a`,{href:be(`settings`,`files`),children:`Settings as text`}),`.`]}))}let xe=f?(0,$.jsxs)(`div`,{role:`alert`,className:`flex w-full flex-wrap items-center gap-4 rounded-[14px] border border-fail-soft bg-fail-soft px-4 py-4 text-sm leading-relaxed text-fail shadow-composer`,children:[(0,$.jsx)(`span`,{className:`flex-[1_1_260px] [overflow-wrap:anywhere]`,children:f}),v?(0,$.jsxs)(G,{size:`sm`,onClick:()=>{y(!1),p(``),fe(``),C()},"data-tip":`Reload, and lose my unsaved changes`,children:[(0,$.jsx)(a,{"aria-hidden":`true`}),`Reload`]}):(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[se.length>0&&(0,$.jsxs)(G,{size:`sm`,onClick:()=>{l(ae),pe.current={},p(``),fe(``)},"data-tip":`Undo my change`,children:[(0,$.jsx)(I,{"aria-hidden":`true`}),`Undo`]}),(0,$.jsxs)(G,{size:`sm`,onClick:()=>{p(``),fe(``),ge()},children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Retry`]})]})]}):null,Se={pending:c?.secrets||{},set:(e,t)=>{h(``),l(n=>{let r={...n.secrets};return t===void 0?delete r[e]:r[e]=t,{...n,secrets:r}})},saved:new Set(o?.saved||[]),vars:o?.variables||{},store:o?.store||`the credential store`};return(0,$.jsx)(It.Provider,{value:Se,children:(0,$.jsxs)(`div`,{className:`settings-fields flex min-h-(--screen) flex-col`,children:[(0,$.jsx)(qt,{}),(0,$.jsxs)(`main`,{className:H(`box-border flex w-full flex-auto flex-col items-stretch sm:flex-row sm:items-start`,t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[(0,$.jsx)(`div`,{className:H(`theme-side theme-side--wide w-full flex-col gap-4 border-line px-4 pt-6 pb-4 sm:sticky sm:top-0 sm:h-(--screen) sm:w-[248px] sm:flex-none sm:overflow-y-auto sm:border-r sm:bg-surface-muted`,t?`hidden`:`flex`),children:r===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`a`,{href:be(),className:`inline-flex min-h-9 items-center gap-2 self-start rounded-[8px] px-2 text-[13px] font-medium text-ink-2 no-underline hover:bg-surface-strong hover:text-ink`,children:[(0,$.jsx)(me,{size:16,"aria-hidden":`true`}),`Back`]}),(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Settings`}),(0,$.jsx)(Ss,{ready:T}),(0,$.jsx)(`label`,{htmlFor:`section-pick`,className:`sr-only`,children:`Section`}),(0,$.jsx)(U,{id:`section-pick`,value:R.id,onChange:e=>location.hash=be(`settings`,e.target.value),className:`sm:hidden`,children:ss.map(e=>(0,$.jsx)(`optgroup`,{label:e,children:os.filter(t=>t.group===e).map(e=>(0,$.jsx)(`option`,{value:e.id,disabled:!T&&e.id!==`setup`,children:e.label},e.id))},e))}),(0,$.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`hidden flex-col gap-4 sm:flex`,children:[(0,$.jsx)(bs,{sections:os.filter(e=>cs.includes(e.id)),current:R.id,locked:!!b&&!T}),(0,$.jsx)(xs,{open:ne||!cs.includes(R.id),onToggle:()=>ie(!ne),children:(0,$.jsx)(bs,{sections:os.filter(e=>!cs.includes(e.id)),current:R.id,locked:!!b&&!T})})]})]}):(0,$.jsx)(ys,{step:r,skipped:E?.skipped??[],open:j,onSkip:()=>void te()})}),(0,$.jsxs)(`section`,{"aria-labelledby":`sec-h`,className:H(`flex min-w-0 flex-1 flex-col`,!t&&`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`),children:[t?(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-4`,children:[(0,$.jsx)(Bt,{icon:R.icon,pixel:_t[R.id],size:`lg`}),(0,$.jsx)(`h1`,{id:`sec-h`,className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:R.label})]}):(0,$.jsxs)(`h1`,{id:`sec-h`,className:`m-0 mb-2 flex items-center gap-4 text-[25px] leading-tight font-semibold tracking-[-0.01em]`,children:[(0,$.jsx)(lt,{icon:R.icon,size:22,className:`flex-none text-muted`}),R.label]}),(0,$.jsxs)(`p`,{className:`mt-0 mb-10 text-[13px] leading-relaxed text-ink-2`,children:[R.intro,R.file&&o&&(0,$.jsxs)($.Fragment,{children:[` `,`Saved in `,(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:R.file}),`.`]})]}),u&&(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-4 border-t border-line pt-6`,children:[(0,$.jsx)(`p`,{className:`m-0 leading-relaxed text-ink-2`,children:u}),(0,$.jsxs)(G,{size:`sm`,onClick:C,children:[(0,$.jsx)(ee,{"aria-hidden":`true`}),`Retry`]})]}),b&&!T&&(0,$.jsxs)(`p`,{className:`mt-0 mb-6 flex items-start gap-2 rounded-[12px] bg-surface-muted px-4 py-4 text-sm leading-relaxed text-ink-2`,children:[(0,$.jsx)(ce,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),`The other sections open once ForgeQE is set up in a project folder: choose the folder, then Set up.`]}),!u&&(!b||R.id!==`setup`&&!o)&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading settings…`}),(0,$.jsx)(`div`,{"data-tour":`section`,className:`flex flex-col`,children:B}),r!==void 0&&b&&O&&(0,$.jsx)(ia,{welcome:E===null||ta(),onStart:vs,step:r,ready:T,coreReady:j,onGo:(e,t)=>void L(e,t),onSkipAll:()=>void te(),onFinish:()=>void L(`done`),note:N},r),(0,$.jsxs)(`div`,{className:`sticky bottom-4 z-10 mt-8 flex flex-col items-end gap-2`,children:[xe,(0,$.jsx)(`div`,{"aria-live":`polite`,className:`contents`,children:!f&&(se.length>0||g||m)&&(0,$.jsx)(`span`,{className:H(`inline-flex min-h-9 items-center gap-2 rounded-full border border-line bg-bg px-4 text-[13px] shadow-composer`,se.length||g?`text-ink-2`:`text-pass`),children:se.length||g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ot,{state:`working`,px:16}),`Saving…`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{size:14,"aria-hidden":`true`}),m]})})})]})]})]})]})})}var vs=()=>{na(),Ye.save({step:`setup`}).catch(()=>{})};function ys({step:e,skipped:t,open:n,onSkip:r}){let i=hs.findIndex(t=>t.id===e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-[16px] font-semibold`,children:`Getting started`}),(0,$.jsx)(`p`,{className:`m-0 px-2 text-[13px] leading-relaxed text-ink-2`,children:`A few steps to start. Everything but Set up can be skipped and changed later in Settings.`}),(0,$.jsx)(`nav`,{"aria-label":`Onboarding steps`,children:(0,$.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:hs.map((r,a)=>{let o=Nn.find(e=>e.id===r.id),s=a>0&&!n,c=r.id===e,l=a<i&&!t.includes(r.id);return(0,$.jsx)(`li`,{children:s?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`After Set up`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(lt,{icon:o.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),(0,$.jsx)(ce,{size:13,"aria-label":`Locked`,className:`flex-none`})]}):(0,$.jsxs)(`a`,{href:be(`welcome`,r.id),"aria-current":c?`step`:void 0,className:H(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,c?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(lt,{icon:o.icon,size:16,className:H(`flex-none`,c?`text-ink`:`text-muted group-hover:text-ink`)}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),l&&(0,$.jsx)(k,{size:13,"aria-label":`Done`,className:`flex-none text-pass`}),t.includes(r.id)&&!c&&(0,$.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Skipped`})]})},r.id)})})}),(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:`inline-flex min-h-8 cursor-pointer items-center gap-2 self-start rounded-[7px] border-0 bg-transparent px-2 text-[13px] text-ink-2 hover:bg-surface-strong hover:text-ink`,children:[(0,$.jsx)(N,{size:14,"aria-hidden":`true`}),`Skip onboarding`]})]})}function bs({sections:e,current:t,locked:n}){let r=[...new Set(e.map(e=>e.group))];return(0,$.jsx)($.Fragment,{children:r.map(r=>{let i=`group-${r}-${e[0]?.id}`;return(0,$.jsxs)(`div`,{role:`group`,"aria-labelledby":i,className:`flex flex-col gap-px`,children:[(0,$.jsx)(`span`,{id:i,className:`px-2 pt-1 pb-1 text-[13px] font-medium text-muted`,children:r}),e.filter(e=>e.group===r).map(e=>n&&e.id!==`setup`?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`Set up ForgeQE in a project folder first`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted opacity-60`,children:[(0,$.jsx)(lt,{icon:e.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,$.jsx)(ce,{size:13,"aria-label":`Locked`,className:`flex-none`})]},e.id):(0,$.jsxs)(`a`,{href:be(`settings`,e.id),"aria-current":t===e.id?`page`:void 0,className:H(`group flex min-h-8 items-center gap-2 rounded-[7px] px-2 text-[13px] no-underline`,t===e.id?`bg-surface-strong font-medium text-ink hover:text-ink`:`text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,$.jsx)(lt,{icon:e.icon,size:16,className:H(`flex-none`,t===e.id?`text-ink`:`text-muted group-hover:text-ink`)}),e.label]},e.id))]},r)})})}function xs({open:e,onToggle:t,children:n}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":`settings-more`,onClick:t,className:`flex h-7 cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-left text-[13px] font-medium text-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:`More settings`}),(0,$.jsx)(E,{size:14,strokeWidth:2,"aria-hidden":`true`,className:H(`flex-none transition-transform duration-200`,e&&`rotate-90`)})]}),(0,$.jsx)(Un,{open:e,id:`settings-more`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})})]})}function Ss({ready:e}){let[t,n]=(0,Q.useState)(``),r=t.toLowerCase().split(/\s+/).filter(Boolean),i=e=>Nn.find(t=>t.id===e)?.label||e,a=r.length?cr.filter(e=>r.every(t=>`${e.label} ${e.key} ${i(e.section)}`.toLowerCase().includes(t))).slice(0,12):[];return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`label`,{htmlFor:`find-setting`,className:`sr-only`,children:`Find a setting`}),(0,$.jsx)(W,{size:`sm`,id:`find-setting`,type:`search`,value:t,disabled:!e,placeholder:`Search settings`,className:`bg-bg`,"data-tip":`By its name or its forgeqe.yaml key: max attempts, memory.dir`,onChange:e=>n(e.target.value)}),r.length>0&&(0,$.jsxs)(`ul`,{"aria-label":`Settings found`,className:`m-0 flex list-none flex-col p-0`,children:[a.length===0&&(0,$.jsx)(`li`,{className:`px-2 py-2 text-[13px] text-muted`,children:`Nothing called that. Every key can also be edited in Settings as text.`}),a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`a`,{href:be(`settings`,e.section),onClick:()=>n(``),className:`flex flex-col rounded-[10px] px-2 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,$.jsx)(`span`,{className:`text-sm`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i(e.section),` · `,(0,$.jsx)(`code`,{className:`font-mono text-[13px]`,children:e.key})]})]})},`${e.section}:${e.key}`))]})]})}export{cs as COMMON_SECTIONS,hs as GUIDE_STEPS,Nn as SECTIONS,kn as SIDEBAR_SECTIONS,_s as Settings};
|